home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 March / Chip_1998-03_cd.bin / hry / Sinclair / SimDOS2 / Z80.DOC < prev    next >
Text File  |  1996-11-10  |  169KB  |  3,388 lines

  1. Sinclair ZX Spectrum Emulator 'Z80' v3.05  -  11/11/96  -  by G.A. Lunter
  2.  
  3.  
  4.  
  5. Contents:
  6.  
  7.     1.    INTRODUCTION, REGISTRATION, GENERAL INFORMATION
  8.     1.1   Some general remarks
  9.     1.2   Registration
  10.     1.3   Other emulators
  11.     1.4   Acknowledgements
  12.     1.5   Disclaimers
  13.     1.6   Copyright notices
  14.  
  15.     2.    THE EMULATOR
  16.     2.1   Starting the emulator
  17.     2.2   Using the emulator
  18.     2.3   Keyboard emulation
  19.     2.4   Screen emulation
  20.     2.5   Sound emulation
  21.     2.6   Loading programs from tape
  22.     2.7   Using .TAP files
  23.     2.8   Using .VOC files
  24.     2.9   Multi-load games
  25.     2.10  Using the Microdrive
  26.     2.11  Using the Disciple and Plus D interfaces
  27.     2.12  Using the Multiface
  28.     2.13  Using the RS232 channel
  29.     2.14  On joysticks and mice
  30.     2.15  The utility ConvZ80
  31.     2.16  Converting file formats - the utility CONVERT
  32.     2.17  The utilities Z802TAP, TAP2TAPE and TAP2VOC
  33.     2.18  The utility OUT2VOC - and how to make .OUT files
  34.     2.19  The utilities READVOC and READSB
  35.     2.20  Quick overview of command line switches, and features
  36.     2.21  Miscellaneous remarks
  37.  
  38.     3.    THE SAMRAM
  39.     3.1   Basic extensions
  40.     3.2   NMI software
  41.     3.3   The built-in monitor
  42.  
  43.     4.    THE SPECTRUM
  44.     4.1   The Spectrum
  45.     4.2   The Interface I
  46.     4.3   The DISCiPLE and Plus D Interfaces - Introduction
  47.     4.4   The DISCiPLE and Plus D Interfaces - Basic commands
  48.     4.5   The DISCiPLE and Plus D Interfaces - More advanced commands
  49.     4.6   The DISCiPLE and Plus D Interfaces - The snapshot button
  50.     4.7   The DISCiPLE and Plus D Interfaces - The system variables
  51.     4.8   The Spectrum 128
  52.  
  53.     5.    TECHNICAL INFORMATION  (in file TECHINFO.DOC)
  54.     5.1   The Spectrum 48K
  55.     5.2   The Spectrum 128K
  56.     5.3   The AY-3-8912 sound chip
  57.     5.4   The ZX Printer
  58.     5.5   The Interface I
  59.     5.6   The SamRam
  60.     5.7   The Multiface 128
  61.     5.8   The AMX mouse interface
  62.     5.9   The Z80 microprocessor
  63.     5.10  File formats
  64.  
  65.  
  66.  
  67.  
  68.  
  69. 1. INTRODUCTION, REGISTRATION, GENERAL INFORMATION
  70.  
  71.  
  72.  
  73.  
  74. 1.1  Some general remarks
  75.  
  76.  
  77.     This is the documentation for 'Z80', a Sinclair ZX Spectrum 48/128
  78.     emulator.  The program turns your PC into a Spectrum.  Its features in
  79.     a (largish) nut-shell:
  80.  
  81.       - Emulates ZX Spectrum 48K model 2 or 3, and Spectrum 128K.
  82.       - Best compatibility of current Spectrum emulators.
  83.       - Emulates Interface I and Microdrive (cartridge in cartridge file),
  84.         Disciple and Plus D disk interfaces, Multiface 128.
  85.       - Full tape support: loads both normal and turbo-saved programs using
  86.         either tape interface on LPT port, SoundBlaster AD converter or
  87.         .VOC sound sample files; can also use .TAP binary tape image files
  88.         by trapping ROM save/load routines.  Saving back to tape is also
  89.         possible, either directly to tape or to a .VOC sound sample file.
  90.       - Full emulation of Spectrum screen, including all colour effects.
  91.         Border, and timing-sensitive border and attribute effects are also
  92.         emulated.
  93.       - Emulation of ZX Printer, for Epson and HP Laserjet compatible
  94.         printers.
  95.       - Emulation of beeper through PC beeper, and of 128K sound through
  96.         either PC beeper or AdLib (SoundBlaster) compatible cards
  97.       - Supports digital and analogue joysticks, and mouse, controlling
  98.         Cursor, Sinclair, Kempston or user-defined joystick.
  99.       - Emulates Spectrum AMX Mouse interface (used by e.g. Art Studio)
  100.       - Runs on any PC, including oldies with 8088/8086 processor.
  101.       - Emulator runs just above 100% of actual Spectrum speed on 20 MHz
  102.         286 and 25 MHz 386SX; can be slowed down on faster machines.
  103.       - Z80 emulation includes emulation of R register, all unofficial
  104.         instruction codes, and unofficial flags; interrupts once every
  105.         1/50th emulated second; I have tried to make each instruction
  106.         execute in a time proportional to the time taken on a real Z80.
  107.       - Registered package includes all source files.
  108.       - Interface I and Spectrum 128's "p" channel input/output can be
  109.         re-routed to LPT or COM port, or to a file.
  110.       - Includes several utilities; to convert from and to other snapshot
  111.         and tape file formats, to convert snapshots into tape files, tape
  112.         files into sound sample files, to display contents of snapshot
  113.         files, to convert screen snapshots to .PCX and .GIF files, to read
  114.         .VOC sound sample files from the LPT tape interface or
  115.         SoundBlaster.
  116.       - A program is included which makes .VOC or raw sound sample files
  117.         of sounds produces by the Spectrum, either by the beeper, the
  118.         soundchip of the Spectrum 128, or the MIC port.
  119.       - OUTs to any port can be logged, and stored in a log file with
  120.         timing information.  This log file can be translated into a .VOC
  121.         sound sample file using OUT2VOC, for both ear and AY soundchip
  122.         output.
  123.       - Simple tracing feature
  124.       - Opcode mapping feature, tags bytes that are executed during
  125.         emulation; useful for debugging and disassembling purposes.
  126.         (It is meant to be used with the disassembler program DNSA by
  127.          Leslie Styles, lms@soton.ac.uk)
  128.       - Multi-level support as in XZX 0.5.2; also support of .SLT files.
  129.       - Emulator can set a breakpoint, invisible to the running program.
  130.       - Emulator can load and save blocks of Spectrum memory to disk
  131.         directly.
  132.       - Emulator can run under Windows (95).
  133.       - Supports VGA, EGA, CGA and Hercules video adapters including
  134.         monochrome VGA.  (Support for Plantronics discontinued.)
  135.  
  136.     There is quite a lot to explain in this documentation.  First of all
  137.     the emulator itself requires some of your PC's resources.  It is not
  138.     really a demanding program, but there are some things that need
  139.     attention.  These technicalities are dealt with in section 2.1.
  140.  
  141.  
  142.     Some general things about the emulator are explained in section 2.2.
  143.     After reading sections 2.1 and 2.2, you will know most of the basics.
  144.     The details can be found in subsequent sections.
  145.  
  146.     The Spectrum has a number of ways to communicate with the outside
  147.     world, like the obvious keyboard and the screen, but also the
  148.     microdrives, the DISCiPLE/Plus D disk interfaces, the tape interface,
  149.     the beeper, the sound chip of the Spectrum 128, the Kempston joystick,
  150.     the AMX Mouse, the ZX Printer interface, and the RS232 channel of the
  151.     Interface I and Spectrum 128 can be used to communicate with PC
  152.     channels in some way. For instance, the keyboard is connected to the PC
  153.     keyboard, and the tape I/O can be routed to a file, as well as to a
  154.     physical tape recorder, or it can come from a .VOC sound sample file.
  155.     All these things are explained in the rest of chapter 2.
  156.  
  157.     For our own Spectrums Johan Muizelaar and I built a piece of hardware
  158.     we called the SamRam (which has nothing to do with the SAM Coupe, by
  159.     the way!).  It contains a monitor program and software to make
  160.     snapshots of programs.  It's still very useful and I still use it a
  161.     lot.  An explanation of its functions is to be found in chapter 3.
  162.  
  163.     Some things peculiar to the Spectrum or its interfaces, not specific to
  164.     this program but useful to know, are collected in chapter 4.  It
  165.     contains for instance a table of Spectrum keywords and the key
  166.     combination to get them; unfortunately this information is not printed
  167.     on standard PC keyboards! More importantly, in this chapter it is
  168.     explained how to use the Microdrive and DISCiPLE interfaces, both of
  169.     which are probably unfamiliar to many former Spectrum users.
  170.  
  171.     There are some interesting technical facts about the Spectrum that I
  172.     discovered while debugging the emulator.  As much as I could think of
  173.     is contained in the final chapter, which can be found in the separate
  174.     file TECHINFO.DOC.  You don't need to read this chapter to use the
  175.     emulator.  A specification of the file formats used by the emulator is
  176.     also included there.
  177.  
  178.     Please note that the Tatort BBS, which used to be the 'Spectrum
  179.     emulator support BBS', has ceased to exist.
  180.  
  181.     There is by now a great lot of Spectrum-related information and
  182.     software available on the net.  A good starting point is the FAQ
  183.     (Frequently Asked Questions) list originally started by Marat
  184.     Fayzullin, and now maintained by Damien Burke.  It can be found at
  185.     http://www.cs.bham.ac.uk/~dmb/speccy/faq.html.  It is also available at
  186.     ftp://ftp.nvg.unit.no/pub/sinclair/docs/specfaq.  This latter site
  187.     carries a lot of Spectrum snapshot and Sinclair-related information.
  188.     Highly recommended!  A long list of FTP sites carrying Spectrum
  189.     programs is included in Damien Burke's FAQ list.
  190.  
  191.     If you have access to internet newsgroups, take a look at
  192.     comp.sys.sinclair, where many Sinclair enthousiasts meet and share
  193.     thoughts.  You will find lots of well-informed people there.  Please
  194.     read the aforementioned FAQ file before asking questions, but be
  195.     invited to join in afterwards.  Note: Please do *not* post binaries to
  196.     the comp.sys.sinclair newsgroup!
  197.  
  198.  
  199.  
  200.  
  201.  
  202. 1.2  Registration
  203.  
  204.  
  205.     'Z80' is a shareware program.  The program is not completely
  206.     functional, and the parts which are left out are included when you
  207.     register.  You are encouraged to give this demo version to friends, but
  208.     DO NOT change the original archive in any way, please.  The shareware
  209.     version of the emulator consists of the Z80-304.ZIP archive file, which
  210.     should contain the following 12 files:
  211.  
  212.         Z80.EXE      - The emulator itself.
  213.         Z80.INI      - Default initialisation file (used by Z80.EXE).
  214.         Z80.PIF      - Program Info File to run 'Z80' under Windows
  215.         Z80.ICO      - Windows icon.
  216.         Z80.DOC      - Documentation file for the emulator.
  217.         Z80FAQ.DOC   - Frequently asked questions and answers.
  218.         REGISTER.DOC - This file.
  219.         NEW.DOC      - The What's New file.
  220.         ROMS.BIN     - Various ROM images (used by Z80.EXE).
  221.         TECHINFO.DOC - Technical info about the Spectrum etc.
  222.         LAYOUT.SCR   - Keyboard layout help screen (used by Z80.EXE).
  223.         DIAGRAM.Z80  - Circuit diagram for tape interface, and calibration
  224.  
  225.     The shareware version of the emulator differs from the registered
  226.     version in the following respects: it displays a message when the
  227.     program is started, and will only run normally for five minutes, after
  228.     which the program cannot be slowed down anymore.  Furthermore, it
  229.     cannot load from or save to tape, and it does not emulate the DISCiPLE
  230.     and the Plus D interfaces.  Everything else works as in the registered
  231.     version.
  232.  
  233.     If you register, you get the fully working version, and the following
  234.     utilities:
  235.  
  236.  
  237.         CONVERT  - a general conversion program: can list out BASIC and
  238.                    translate it back, produce .GIF or .PCX files from
  239.                    screen dumps, translate Spectrum ASCII (CR) to PC ASCII
  240.                    (CR/LF), and some other things.
  241.         CONVZ80  - Translates various snapshot and tape formats of other
  242.                    Spectrum emulators into each other.  Can handle the
  243.                    familiar .SNA format use by several emulators (JPP,
  244.                    XZX,...), and also Pedro Gimeno's (VGASPEC and SPECTRUM)
  245.                    .SP format and Kevin J. Phairs' (SPECEM) .PRG format.
  246.                    It can also handle tape files of SPECEM and L. Rindt and
  247.                    E. Brukner's emulator ZX.
  248.         DISCIPLE - Reads DISCiPLE and Plus D diskettes, both 3.5'' and
  249.                    5.25''.  It translates the 48K and 128K snapshot files
  250.                    to .Z80 snapshots, and ordinary files and screen
  251.                    snapshots to .TAP tape files. (Not necessary for the
  252.                    fully registered version, but handy for the cheaper
  253.                    one.)
  254.         ADDDAT   - Utility to edit the additional data part of .SLT
  255.                    snapshot files, which contain loading screens and level
  256.                    data.
  257.         Z802TAP  - Converts a .Z80 snapshot, 48K or 128K, to a .TAP file
  258.                    which can be loaded into the emulator and saved to tape
  259.                    by the next utility:
  260.         TAP2TAPE - Saves the contents of a .TAP file back to tape, to load
  261.                    it into an ordinary Spectrum.
  262.         TAP2VOC  - Converts a .TAP file to a .VOC sound sample file, to
  263.                    write to tape, or to load into the emulator.
  264.         READVOC  - Reads in a long, 'digital' .VOC sound sample, to be used
  265.                    as input to the emulator, from the LPT tape interface or
  266.                    a SoundBlaster.
  267.         READSB   - Reads .VOC sound samples from SoundBlaster using DMA,
  268.                    and applies a digital filtering and oversampling algo-
  269.                    rithm tuned for Spectrum tapes.
  270.         OUT2VOC  - Converts .OUT log files into .VOC or raw sound sample
  271.                    files, so that you can easily extract music samples from
  272.                    Spectrum/Spectrum 128 games, or SAVE directly to a .VOC
  273.                    or raw sample file.
  274.         Z80DUMP  - Shows the header and the contents of a .Z80 file.
  275.  
  276.  
  277.     You will also receive the source files of the emulator, the above
  278.     utilities and the SamRam, and you will be kept informed about future
  279.     updates.
  280.  
  281.     You can also choose to register for the emulator without DISCiPLE and
  282.     Plus D emulation, if you are not interested in those parts.  The
  283.     registration fee is a bit lower then, but you will receive everything
  284.     stated above (including the DISCIPLE program); the only difference is
  285.     that you get a version of the emulator that will not emulate the M.G.T.
  286.     interfaces.
  287.  
  288.     There are several registration sites, the main one being B.G. Services
  289.     in the U.K.  You can also register with Jimaz in the Czech Republic,
  290.     or David Pomeroy in New Zealand, whichever is most convenient.  Please
  291.     note that Friendware in Spain and Sinclair Freakeren are no longer
  292.     registration sites.
  293.  
  294.     IMPORTANT NOTE:
  295.  
  296.     When sending registrations, please either PRINT your order and address,
  297.     or use BLOCK CAPITALS to aid readability.  If you use a postal cheque
  298.     service, or direct transfer, please try to also send a letter to the
  299.     site with details of the payment etc.  Many payment slips are
  300.     unreadable copies.
  301.  
  302.  
  303.  
  304.     B G Services, U.K.
  305.     ------------------
  306.  
  307.     The registration fee is BP 20 or BP 15 (BP=British Pound) for the
  308.     version with or without DISCiPLE/Plus D emulation respectively.
  309.     Payment can be by cheques (Sterling on a UK bank, or Eurocheques) or UK
  310.     postal order made payable to B G Services.  You can also transfer
  311.     directly to the Giro account 324.82.16  (B G Services).  Girobank plc,
  312.     Bootle, Merseyside G1R 0AA.
  313.  
  314.     You can also send money in cash.  Please send British Pounds and no
  315.     other currencies!
  316.  
  317.     Please do not use other currencies than British Pounds on cheques; it
  318.     is not economic to change.  If it is the only option available, please
  319.     add BP 8 to cover drawing costs.  I regret I cannot accept orders via
  320.     charge or credit card.
  321.  
  322.     The address is:
  323.  
  324.                 B G Services
  325.                 64 Roebuck Road
  326.                 Chessington
  327.                 Surrey KT9 1JX
  328.                 (United Kingdom)
  329.  
  330.     Telephone enquiries on (0181) 287 4180, Fax (0181) 391 0744, or from
  331.     abroad: +44 181 287 4180 and +44 181 391 0744 respectively.
  332.  
  333.     B G Services can also supply ready built tape interfaces for BP 14.50.
  334.     These are professional quality items built into 25W 'D' connectors.
  335.     (If this archive is old, please enquire on price before ordering)
  336.  
  337.     Files will be on a 3.5" HD disc together with some ready converted
  338.     software, which is either PD, or has the approval of the authors.
  339.     Other disc sizes may be requested, but these may not contain all the
  340.     extra files.
  341.  
  342.  
  343.  
  344.  
  345.     Myself, The Netherlands
  346.     -----------------------
  347.  
  348.     Registration via B G Services is fastest, and is preferred.  In some
  349.     cases, however, sending money to The Netherlands may be more convenient.
  350.  
  351.     Dutch users can transfer NLG 50,- (full version) or NLG 35,-- (without
  352.     Disciple emulation) to the following Giro account:
  353.  
  354.         59.45.263  (G.A. Lunter, Groningen)
  355.  
  356.     The registration fee of BP 20/BP 15, US$ 30/US$ 25, DM 50/DM 40, can
  357.     also be sent, in cash, to the following address:
  358.  
  359.         Gerton Lunter
  360.         P.O. Box 2535
  361.         NL-9704 CM  Groningen
  362.         The Netherlands
  363.  
  364.     Any other (convertible) currency of an approximately equivalent amount
  365.     will also be accepted.  From Spain and Italy, postal money orders work
  366.     best.
  367.  
  368.     Eurocheques can also be accepted.  Please do NOT use other currencies
  369.     than Dutch Guilders (NLG), and do NOT fill in the place you live, but
  370.     write 'Groningen' or leave blank.  Cheques that are filled in
  371.     differently cost HFL 15-25 to draw.
  372.  
  373.  
  374.  
  375.  
  376.     Jimaz, Czech Republic
  377.     ---------------------
  378.  
  379.     For registrations in the Czech Republic, you can contact Jimaz.
  380.  
  381.                 JIMAZ s.r.o.
  382.                 Hermanova 37
  383.                 170 00 Praha 7
  384.                 phone: +42 2 379 498
  385.                 fax:   +42 2 378 103
  386.                 Email: vondrack@jimaz.cz
  387.  
  388.     Registration fee is 500 and 650 Czech crowns.
  389.  
  390.  
  391.  
  392.     David Pomeroy, New Zealand and Australia
  393.     ----------------------------------------
  394.  
  395.     For registrations in New Zealand and Australia, contact
  396.  
  397.                 David Pomeroy
  398.                 P O Box 2939
  399.                 Shortland Street
  400.                 Auckland
  401.                 New Zealand
  402.                 Phone: (09) 627-9618
  403.                 Email: davidpom@iconz.co.nz
  404.  
  405.  
  406.     The registration fee is 40/50 NZ$, or 30/40 AUS$.
  407.  
  408.  
  409.  
  410.                               ==================
  411.  
  412.  
  413.  
  414.     All sites reserve the right to ignore any order which does not comply
  415.     with the conditions above.
  416.  
  417.     If you have an older registered version and wish to upgrade, please
  418.     contact your registration site, sending return postage.  Updates within
  419.     the same version number and normally sent free if a disc and return
  420.     postage is received.  Updates from previous versions will carry a small
  421.     update fee.
  422.  
  423.  
  424.  
  425.  
  426.  
  427. 1.3  Other emulators
  428.  
  429.  
  430.     I used to have a list of other emulators for the PC and other computers
  431.     here, but the list in Marat Fayzullin/Damien Burke's FAQ was much more
  432.     complete and detailed, so I deleted mine.  It lists:
  433.  
  434.     14 emulators for PC's,
  435.     6 for the Commodore Amiga,
  436.     4 for the Acorn Archimedes,
  437.     4 for UNIX platforms,
  438.     3 for the Macintosh,
  439.     1 for the Atari ST,
  440.     1 for the NeXTStep, and
  441.     1 very old one for the Commodore 64
  442.  
  443.     I believe this makes the Sinclair ZX Spectrum the most often emulated
  444.     computer ever!
  445.  
  446.     There are also emulators available for the ZX81.  Carlo Delhez, who
  447.     also wrote a Spectrum emulator for the QL, wrote the ZX81 emulators
  448.     XTricator (for the QL) and XTender (for PC's).  There are probably
  449.     more.  For more information, take a look at the FAQ of the newsgroup
  450.     comp.sys.emulators.misc.
  451.  
  452.  
  453.  
  454.  
  455. 1.4  Acknowledgements
  456.  
  457.  
  458.     From the very first beginning in november 1988, when I wrote the first
  459.     lines of code for the emulator, Johan Muizelaar has been a very
  460.     demanding and critical user, being only satisfied when it was perfect.
  461.     Besides, there are quite a few things I would never have started
  462.     working on if he hadn't insisted that I would!
  463.  
  464.     I have also profited much from the fine cooperation with Brian Gaff,
  465.     who, besides handling the UK registrations, also generates a continual
  466.     stream of suggestions, remarks and bug reports.  He also brought me
  467.     into contact with many people that contributed to the emulator in
  468.     several ways.
  469.  
  470.     A major part of the things new to version 3 of the emulator have been
  471.     written by Hugh McLenaghan.  He wrote all code for the Disciple/Plus D
  472.     emulation, and for the ZX Printer emulation (where I subsequently
  473.     introduced bugs...)  Also, Hugh wrote much of the documentation for the
  474.     Disciple and Plus D interfaces in this file.
  475.  
  476.     
  477.     Finally, many thanks are due to
  478.  
  479.     o   Carlo Delhez for information on the '128 and several other things,
  480.     o   Andre Mostert for some more '128 info and info on EMS memory,
  481.     o   Walter Prins for many '128 programs,
  482.     o   Marco Holmer for making the program such a big hit at the HCC dagen,
  483.     o   Henk de Groot, for finding a solution to a bug in A86 v3.22,
  484.     o   Arnt Gulbrandsen for a suggestion which made the emulator faster,
  485.             and information on a group of unofficial Z80 opcodes,
  486.     o   Ruud Zandbergen for his digital joystick interface,
  487.     o   Jan Garnier for providing the chips to reanimate my real Spectrum,
  488.     o   Ettore de Simone for finding a noisy bug,
  489.     o   Rudy Biesma and Tonnie Stap for providing info on the DISCiPLE disk
  490.             formats,
  491.     o   Burkhard Taige for various bug reports on it,
  492.     o   Ian Cull for enhancing the DISCiPLE program and two bugfixes,
  493.     o   Bert Lenaerts for information on the AZERTY keyboard,
  494.     o   Chris Lemon for fixing a bug in the CALL instruction,
  495.     o   Robert Zmyslowicz, Einar Gattoni Saukas, Bernhard Lutz,
  496.             Erik Kunze and Mr. Lee Tonks aka Blood for their thorough
  497.             beta-testing of v3.05.
  498.  
  499.     and all the people that I forgot to mention.
  500.  
  501.  
  502.  
  503.  
  504. 1.5  Disclaimers
  505.  
  506.  
  507.     The last version contained a few bugs, but this version is guaranteed
  508.     to be bug-free.  You can safely operate nuclear power plants or life
  509.     support systems with this software.  And if it still happens to break
  510.     down, feel free to sue me.
  511.  
  512.     Many of the bugs that disfigured the previous version are gotten rid of
  513.     now.  Most notably, the problem that saving a Disciple/+D snapshot
  514.     caused old data to be overwritten has been fixed.  On the other hand,
  515.     FORMATting Disciple/+D disks still has its problems, but, depending on
  516.     the machine in question, they have overcome in particular cases.
  517.  
  518.     Many people have sent me bug reports, for which I am very grateful.  I
  519.     have removed most of those, but have not been able to remove them all,
  520.     sometimes because the report was too vague and/or irreproducible on my
  521.     machine, or because of a mixture of reasons like: difficult to find,
  522.     not a problem to most people, easily circumvented, or laziness on my
  523.     part.
  524.  
  525.  
  526.  
  527.  
  528. 1.6  Copyrights etc.
  529.  
  530.  
  531.     Amstrad still holds the copyright on the 48K and 128K rom.  However,
  532.     they have kindly allowed free use of them.
  533.  
  534.     The Disciple ROM is (c) Bruce Gordon / Format Publications.
  535.  
  536.     The Plus D ROM is copyright Datel / Format Publications.
  537.  
  538.     Multiface and Lifeguard are registered trademarks of Romantic Robot.
  539.     They are licensed from Romantic Robot for use in Z80.
  540.  
  541.     The registered version of the Spectrum emulator 'Z80', and the version
  542.     distributed with PC Format, may NOT be further distributed.  The source
  543.     codes, which are part of the registered package, may NOT be used in
  544.     other Spectrum emulators running on PC's.  In principle, it is okay to
  545.     use the Z80 emulator code in an emulator for another Z80-based
  546.     computer; however, please do contact me if you want to use it.
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553. 2.  THE EMULATOR
  554.  
  555.  
  556.  
  557.  
  558. 2.1  Starting the emulator
  559.  
  560.  
  561.     The emulator will work on any PC with 640K memory and at least a 80286
  562.     processor, with a VGA, EGA, Hercules or CGA video adapter.  If
  563.     available, it will also use EMS memory, an Adlib compatible soundcard,
  564.     the SoundBlaster card, a mouse, and an analogue or digital joystick.
  565.  
  566.     The emulator will first read in the switches that are given in the
  567.     Z80.INI file.  You can enter switches there just like you do on the
  568.     command line.  Lines starting with a % sign are ignored; they are used
  569.     for comments.
  570.  
  571.     After any switches, you may specify a snapshot file on the command
  572.     line. This file will then be loaded and executed directly.  The
  573.     extension .Z80 is not necessary.  The emulator will also read .SNA
  574.     files (the snapshot format of, amongst others, Arnt Gulbrandsen's JPP);
  575.     you don't have to convert them to .Z80 files (but you may want to to
  576.     save disk space), and it reads .SLT files (containing snapshots plus
  577.     additional data, mostly level data for games consisting of various game
  578.     levels).
  579.  
  580.     The emulator tries to figure out what hardware is available, and uses
  581.     things as it finds them.  Most of the time this will work without you
  582.     having to tell it anything, but if you have to, you can override the
  583.     defaults by putting switches on the command line.  Switches that you
  584.     use often can be put in the Z80.INI file.  If you give a switch a
  585.     second time, for instance if it is also in the Z80.INI file, it will
  586.     disable it again.
  587.  
  588.     If you're using a Trident VGA with version 3 BIOS, you may see the
  589.     picture compressed at the top of the screen, while the bottom half
  590.     contains vertical white lines.  This is due to a bug in the Trident VGA
  591.     Bios.  Start the emulator with the switch -xv to get a full picture.
  592.  
  593.     Some VGA adapters do not produce a stable picture when Z80 is using the
  594.     standard VGA mode.  If your monitor doesn't sync, try switch -xv.
  595.  
  596.     Some black-and-white VGA monitors only display one of the three RGB
  597.     colours (green most of the times), resulting in several Spectrum
  598.     colours becoming indistinguishable.  Use -xb to use grey tones instead
  599.     of colours.
  600.  
  601.     If you are using Hercules, try starting the emulator with -xh on the
  602.     command line.  The emulator will use a non-standard Hercules mode to
  603.     display a full-screen Spectrum picture.  You may need to calibrate your
  604.     monitor to make the image steady.
  605.  
  606.     If you're using Plantronics, try -p and -q to see which gives the best
  607.     result.
  608.  
  609.     If you haven't got EMS memory, the page swapping of the Spectrum 128
  610.     cannot be emulated exactly, and, more seriously, it is extremely slow.
  611.     Although most programs will work, they will be too slow to be of any
  612.     use.  Also, the emulator needs lots of base memory if no EMS memory is
  613.     present; if you don't have enough, try specifying -xt on the command
  614.     line to make the emulator use as little memory as possible (by
  615.     shrinking several buffers).  The emulator uses 332K or 572K of base
  616.     memory (with and without EMS memory respectively), and 47K less in both
  617.     cases if -xt is specified.  If this is still not enough, try to use
  618.     -xu, which saves 83K, but then Hi Resolution Colour emulation does not
  619.     work anymore.
  620.  
  621.     On 386 and 486 machines you can emulate EMS by software using EMM386
  622.     for instance.  The speed of the EMS emulator determines in part the
  623.     emulation speed of Spectrum 128K programs, so it may be wise to try a
  624.     few for the best results.  I use QEMM, which seems to be faster than
  625.     EMM386.
  626.  
  627.     The Spectrum 128 has a built-in sound chip.  If you have an Adlib
  628.     compatible soundcard installed, the Spectrum 128 sound will be played
  629.     through the Adlib card.  If you haven't, the loudest of the three sound
  630.     channels will be played through the internal PC speaker.  Sometimes the
  631.     effect is quite nice, sometimes it is horrible, but it's all I can do
  632.     on a standard PC.  If you don't want to have the Spectrum 128 sound
  633.     played through the internal speaker, use the switch -xi.  If you don't
  634.     want the Adlib card to be used (for instance to hear the sound through
  635.     the internal speaker) use -xa.
  636.  
  637.     If you're using the Pro-Audio Spectrum 16 sound card, do not install
  638.     the resident FM.EXE program; it causes problems with the emulator. Do
  639.     make sure that MVSOUND.SYS is installed in your CONFIG.SYS file, to
  640.     make the Pro-Audio Spectrum 16 Adlib compatible.
  641.  
  642.     The noise channels of the Spectrum 128 sound chip can work on different
  643.     frequencies, whereas the FM chips of the Adlib card cannot.  However,
  644.     if your Soundblaster is equipped with CMS chips, the noise frequency
  645.     can be programmed.  Specify -xc to use the CMS chips.  (These chips are
  646.     not available on Soundblaster Pro cards, and neither on most
  647.     Soundblaster clones).
  648.  
  649.     If you're living in Belgium or France, you are probably using an AZERTY
  650.     keyboard.  Specifying -xz on the command line will make all letter keys
  651.     and many punctuation keys work in the right way.
  652.  
  653.     If the emulator erroneously detects an analogue or digital joystick,
  654.     use the switch -kk.
  655.  
  656.     The emulator can now also be run under Windows 3.1!  However, you
  657.     cannot use the tape interface and Real mode doesn't work anymore.  In
  658.     version 3.04, keyboard handling under Windows is much improved, and
  659.     works as well as without Windows.  If you let the emulator run
  660.     full-screen you may use EGA or VGA, if you want to run it windowed
  661.     you'll have to use CGA, because the virtual video display driver of
  662.     Windows cannot handle the VGA mode I use (although it's only a standard
  663.     text mode; even Windows 95 doesn't know how to handle it). You'll
  664.     probably want other default settings of some parameters (such as the
  665.     video mode) if you run the emulator under Windows; the emulator will
  666.     always use the .INI file in the directory of the Z80.EXE file so the
  667.     other switches must be put on the command line or in a .PIF file. An
  668.     example .PIF file (which runs the emulator in windowed CGA mode) and a
  669.     .ICO icon file are supplied.
  670.  
  671.     The emulator measures the speed of the computer it runs on in the
  672.     normal way.  Under Windows 95 this gives reliable results; however,
  673.     Windows 3.1 causes Z80 to run about 3 to 4 times slower than normal.
  674.     You may have to tinker with the speed setting to get it to run at a
  675.     reasonable speed.
  676.  
  677.     The emulator will automatically detect whether Windows is running, and
  678.     act appropriately.  To run the emulator in Windows compatibility mode
  679.     in a normal DOS environment, use -xw.  If you use this switch under
  680.     Windows, it turns windows compatibility mode OFF, and hangs unless you
  681.     use Hi Resolution Colour emulation (which doesn't rely on the timer).
  682.  
  683.     When running the emulator under Desqview, use -e for EGA mode display.
  684.  
  685.     At present running under OS/2 is not a good idea as it will crash if
  686.     the speed is altered.
  687.  
  688.     These are the most important switches that you have to specify when you
  689.     start the emulator.  Most of the other switches are used to select
  690.     default values for various things which can also be changed when the
  691.     emulator is running.  Some useful things to select are default
  692.     directories for .Z80, .TAP and .MDR files; these will be explained
  693.     below.
  694.  
  695.  
  696.  
  697.  
  698. 2.2  Using the emulator
  699.  
  700.  
  701.     In this section, the basic functions of the emulator, residing under
  702.     the function keys F1-F10, are explained.
  703.  
  704.     When the emulator starts, you'll see the usual Spectrum copyright
  705.     message appear on screen.  Pressing F1 will pop up a small help screen
  706.     that explains the function of the function keys and various other
  707.     special keys.
  708.  
  709.     By pressing F10, you enter the main menu of the emulator.  Most of the
  710.     menu options can be chosen directly by pressing another function key; a
  711.     small help screen pops up if you press F1.  If you're somewhere deep in
  712.     the menu structure from the main menu, pressing ESC will get you one
  713.     level higher most of the time.  Pressing F10 will get you back to the
  714.     main menu.
  715.  
  716.     The 'Select Hardware' menu option sits under function key F9.  There
  717.     are seven major configuration to choose from:
  718.  
  719.         Spectrum 48K
  720.         Spectrum 48K + Interface I
  721.         Spectrum 48K + SamRam + Interface I
  722.         Spectrum 48K + M.G.T. Interface  (i.e. DISCiPLE or Plus D)
  723.         Spectrum 128K
  724.         Spectrum 128K + Interface I
  725.         Spectrum 128K + M.G.T.
  726.  
  727.     This menu also allows to choose the M.G.T. type, +D, Disciple with a
  728.     pre-loaded operating system supporting graphics output using the Epson
  729.     format, and one supporting HP-PCL format graphics output.
  730.  
  731.     In all configurations except the one with SamRam, the Multiface 128 can
  732.     be emulated too.  The Multiface 128 software is aware of, and can read
  733.     and write to, the Microdrive of the Interface I and the Disciple and +D
  734.     disk drive.
  735.  
  736.     After a change has been made, pressing ENTER switches to that mode and
  737.     resets the Spectrum.  If you don't want the Spectrum to reset, pressing
  738.     CTRL-ENTER will switch to the new mode while preserving as much of the
  739.     runninge program as possible.  Switching from 128K mode to 48K mode
  740.     will almost always crash the program, except if you enter the SPECTRUM
  741.     command before switching.  Be careful when you change the disk drive
  742.     emulation; when switching an MGT interface (Disciple or +D) on or off,
  743.     it is wise always to reset the emulator, as otherwise the hardware will
  744.     often not match the system variables.
  745.  
  746.     To use SamRam's monitor on a 128 program, switch the hardware from the
  747.     main menu, and generate an NMI (Extra functions - N) before returning
  748.     to the emulator.  This will often work, but you can't return to the
  749.     program without crashing it.
  750.  
  751.     On a real Spectrum 128, the menu bar of the startup screen is moved
  752.     using the cursor keys on the '128 keyboard.  These keys simultaneously
  753.     press a normal cursor key (5,6,7 or 8) and shift.  So you can shift the
  754.     menu bar with shift-6 and shift-7.  It is possible to use the PC cursor
  755.     keys for this; you have to select Cursor joystick emulation (which is
  756.     selected by default) and press Num-Lock once to have the PC-cursor keys
  757.     press the Spectrum Shift key too.  You could also specify -xs on the
  758.     command line (or put it in the Z80.INI file) to make the PC cursor keys
  759.     by default press shift for you in '128 mode; see also the Miscellaneous
  760.     remarks section.
  761.  
  762.     The Save and Load Program options (F2 and F3) will save the whole state
  763.     of the Spectrum and some of the emulators' settings to a .Z80 snapshot
  764.     file.  It will pack the data somewhat, so that the length of the file
  765.     varies.  The amount of memory saved depends on the current hardware
  766.     mode; 48K for normal Spectrum, 80K for SamRam, and 128K for Spectrum
  767.     128.  (Note that the RAM contents of the M.G.T. interface or the
  768.     Multiface 128 are not saved.)  The settings that are saved are those
  769.     that are program dependent, for instance which joystick emulation is
  770.     used, and more technical settings like those of the R register, LDIR
  771.     and Issue 2 emulation and video synchronisation.  These are explained
  772.     below.
  773.  
  774.     Loading a .Z80 file will cause several settings to be changed.
  775.     Resetting the Spectrum will not reset these settings to their default
  776.     values!  Especially the joystick emulation setting change can be
  777.     confusing.
  778.  
  779.     All settings can be checked and changed in the Change Settings menu,
  780.     which pops up if you press F4. You can do many things here.  The I and
  781.     O options can be used to redirect the RS232 output; see section 2.13
  782.     for information on this.  R - R register emulation, and L - LDIR
  783.     emulation are usually only necessary when loading programs;  for
  784.     remarks on these options see section 2.6, and section 5.1 for more
  785.     technical details.  Other settings and switches are:
  786.  
  787.     H - Hi resolution colour emulation, also called 'coppering'.  To
  788.     eliminate flickering of moving characters, and to see some colour
  789.     effects otherwise not visible.  Also, this allows you to see the famous
  790.     loading stripes in the border.  See section 2.4 for more information.
  791.  
  792.     2 - Issue 2 emulation will turn the emulated Spectrum in an Issue 2
  793.     Spectrum.  (This option also works, but is out of place, in Spectrum
  794.     128 mode).  Some very old programs (Blue Ribband, Spinads) will not
  795.     respond to the keyboard properly on Issue 3 Spectrums, and for these
  796.     programs this option was added.  Seldom needed.
  797.  
  798.     S - sound enables you to turn off all sound, useful for late-night
  799.     playing.
  800.  
  801.     F - toggle between 50 Hz frame interrupt rate (the standard value) and
  802.     some value defined via the switch -dN, setting the frame rate to 100/N
  803.     Hz.  Without switches, the alternate rate is 100 Hz.  If -dN is used
  804.     the default rate is set to 100/N Hz and alternate rate to 50 Hz; is -dN
  805.     is specified twice (with the same divisor N) then default and alternate
  806.     rate are swapped.
  807.  
  808.     Doubling the interrupt frequency is useful for slow machines, as
  809.     some programs will run faster when this option is on.  If you're typing
  810.     in a BASIC program on a slow machine, always turn this on, since the
  811.     keyboard, which is polled by an interrupt routine, will respond much
  812.     better.  On fast machines, this feature is useful for running Spectrum
  813.     programs quickly while keeping a normal keyboard response.  Some
  814.     programs will crash with a frame interrupt rate different from 50 Hz.
  815.  
  816.     V - video synchronisation is used to remove the flickering of moving
  817.     characters in some programs.  You can choose between Normal, High and
  818.     Low.  Normal works well for almost all programs; Ghosts and Goblins and
  819.     Zynaps look much better when this is turned to High.  If you see
  820.     characters not moving smoothly or flicker, or a background not moving
  821.     as a whole, experiment a little bit with this setting, and re-save the
  822.     snapshot when you've found the best setting.  On fast computers, try to
  823.     use Hi res colour emulation instead.  This setting has no effect when
  824.     Hi res colour emulation is on.  (For a more detailed discussion of this
  825.     option see section 2.4 and section 5.1)
  826.  
  827.     J - joystick emulation specifies which Spectrum joystick the PC cursor
  828.     keys (and mouse, and analogue or digital joystick, if available)
  829.     control. You can choose from Cursor (default), Kempston, Interface 2
  830.     and user-defined.  As already said above, if Cursor joystick is chosen,
  831.     the Num-Lock key controls whether Shift is pressed too with a joystick
  832.     movement. (Since the shift and number keys are pressed exactly
  833.     simultaneously, it is possible that the Spectrum has already read the
  834.     Shift key, but not yet the others, when you press both keys down.
  835.     Sometimes you will therefore get the number 5,6,7 or 8 instead of a
  836.     cursor movement. If you have used a +3 or +2A Spectrum, you will be
  837.     familiar with this!)
  838.  
  839.     Finally, C - Change speed lets you control the speed of the emulator.
  840.     As a side effect, slowing down the emulator makes the timing of the
  841.     various opcodes correspond more exactly to the actual timing on a real
  842.     processor.  (Remember this is not possible on slow PCs!)
  843.  
  844.     That concludes the discussion of the F4-'change settings' menu.  Let's
  845.     continue with the other function keys.
  846.  
  847.     F5 generates an NMI. This is used to activate the Samram, Multiface
  848.     128, or start the Disciple/+D Snapshot facility. If none of these are
  849.     active it may reset the Spectrum or do nothing.
  850.  
  851.     ALT-F5 or CTRL-F5 resets the Spectrum.
  852.  
  853.     F6 turns on Real Mode.  Try this when the emulator is playing a tune
  854.     and sounds a little harsh.  This mode is needed when you want to load
  855.     turbo-saved games from tape; see below for more information.
  856.  
  857.     F7 and F8 activate the tape and Microdrive/M.G.T. menus.  Again, see
  858.     below for more information.
  859.  
  860.     Resetting the Spectrum, or generating an NMI can be done from the main
  861.     menu too, in the X - Extra Functions menu.  This is useful if you want
  862.     to activate the NMI software of the SamRam for instance just after
  863.     loading a snapshot file, or just after you changed the hardware mode.
  864.  
  865.     In this menu it is also possible to save or load a memory block or
  866.     screen snapshot; to set a breakpoint (see section 2.21) or to
  867.     temporarily shell to DOS. Furthermore, here you can find another
  868.     sub-menu for the OUT logging feature.  If port FE is logged, such a log
  869.     file can be translated into a .VOC sound sample file using the OUT2VOC
  870.     utility.
  871.  
  872.     When you're typing BASIC-programs in 48K mode, you'll probably have to
  873.     look up some Spectrum keywords.  Further down in this documentation
  874.     there is an alphabetical list of all keywords and their
  875.     key-combination. For 'on-line' help, press ALT-F1 to see the Spectrum
  876.     keyboard layout.
  877.  
  878.  
  879.  
  880.  
  881. 2.3  Keyboard emulation
  882.  
  883.  
  884.     The keyboard.  Letter keys are mapped to the Spectrum's letter keys.
  885.     The ALT and CTRL keys can both be used for Symbol Shift.  Then, there
  886.     are a lot of keys on the PC keyboard which don't exist on the Spectrum
  887.     keyboard.  Many of them are used, to make things easier:
  888.  
  889.     The function keys have several special functions.  See the previous
  890.     section.
  891.  
  892.     CTRL-Break and CTRL-ALT-DEL quit the emulator.  Better use F10-Q-Y
  893.     though.
  894.  
  895.     The punctuation keys - = ; ' , .  / and their shifts: _ + : " < > ?
  896.     have the effect of pressing Symbol Shift and the corresponding letter
  897.     key, so you can use these in the straightforward way.
  898.  
  899.     The ESC key presses Shift-1, EDIT, used as a sort of ESC key in many
  900.     Spectrum programs.  The Backspace key presses Shift-0, the Delete of
  901.     the Spectrum.  CapsLock presses Shift-2, Spectrum's capslock key.
  902.  
  903.     The PC-cursor keys and the numeric keypad keys 8,4,6 and 2 control the
  904.     Cursor, Interface 2, Kempston or user-defined joystick.  The TAB key,
  905.     and 0,5 and ./DEL on the numeric keypad control the fire button.  If
  906.     the Cursor joystick is selected, you can select whether Shift should
  907.     also be pressed with the NumLock key (but see the discussion above of
  908.     the -xs switch).
  909.  
  910.     If you're running the emulator on a slow computer, try doubling the
  911.     interrupt frequency (switch -d).  Most programs poll the keyboard by
  912.     interrupt, in any case the ROM does, and doubling the frequency with
  913.     which this happens will make the emulated Spectrum react much more
  914.     quickly on your keystrokes.
  915.  
  916.     If you've got an AZERTY keyboard, the standard mappings of the keys
  917.     won't work at all properly.  Include the switch -xz in your Z80.INI
  918.     file in this case; many punctuation keys will now also work properly.
  919.     There is no support for other non-US keyboard layouts; sorry!
  920.  
  921.     You can re-map the keyboard by yourself by using the -kx switch.  It
  922.     has the format
  923.  
  924.         -kxABCD
  925.  
  926.     where #AB denoted the scan-code (in hex, between #01 and #58) and #CD
  927.     the key that should be pressed when the emulator sees this scan code.
  928.     Normal keys are coded by bytes below #40; the lower three bits denote
  929.     the row number (0-7), and the upper three bits the column number (1-5).
  930.     Column 1 of rows 0-7 are respectively Shift,A,Q,1,0,P,Enter and Space.
  931.     Column 2 to 5 are the keys on the same line, but more toward the
  932.     center.  For instance, C is on row 0, column 4, and has code 0+8*4=32=
  933.     #20.  Function key F11 has scan code #57, so to map F11 to C use
  934.     -kx5720.  Code keys '#CD' in the range #C0 - #DD are used to code for
  935.     special keys.  Here is the list of codes in this range:
  936.  
  937.         #C0  Edit                          #CF  Joystick left
  938.         #C1  - or _                        #D0  Joystick right
  939.         #C2  + or =                        #D1  + or =
  940.         #C3  Delete                        #D2  Joystick down
  941.         #C4  ; or :                        #D3  Joystick fire
  942.         #C5  " or '                        #D4  F1
  943.         #C6  , or <                        #D5  F2
  944.         #C7  . or >                        #D6  F3
  945.         #C8  / or ?                        #D7  F4
  946.         #C9  *                             #D8  F5
  947.         #CA  Capslock                      #D9  F10
  948.         #CB  Numlock (Shift toggle)        #DA  F6
  949.         #CC  Scroll lock (+CTRL=Quit)      #DB  F7
  950.         #CD  Joystick up                   #DC  F8
  951.         #CE  - or _ (for grey -)           #DD  F9
  952.  
  953.     Simultaneous keypresses on the PC keyboard are only transmitted to the
  954.     PC to a certain extent, depending on the particular keyboard.  My old
  955.     keyboard could handle TAB and the keys on the numerical keypad
  956.     simultaneously, but my new keyboard can't: when I press TAB and hold it
  957.     down, further key presses on the numeric pad are not seen by the PC
  958.     at all.  There is absolutely nothing to be done about it.  Playing
  959.     games can be a problem sometimes.  You'll have to live with it.  All
  960.     information sent by the keyboard is used.
  961.  
  962.  
  963.  
  964.  
  965. 2.4  Screen emulation
  966.  
  967.  
  968.     There are two different ways the emulator can emulate the screen.  The
  969.     standard way, in which 50 times an emulated second the screen is
  970.     checked for changes, and they are subsequently displayed on the
  971.     monitor. This works fine, and was the only mode available in previous
  972.     versions. It works basically the same with all video modes; however,
  973.     some are much slower than others. EGA is notoriously slow, due to the
  974.     ugly way it has to be addressed. VGA is definetely the fastest. EGA and
  975.     VGA are the only video modes in which the colour of the overscan can be
  976.     controlled; in these modes, some emulation of border effects (loading
  977.     stripes, for example) can be done. You don't see these effects in the
  978.     other video modes.
  979.  
  980.     Changing the overscan colour results in 'snow' lines appearing on the
  981.     screen.  It is possible to eliminate these by waiting until the video
  982.     adapter is in horizontal retrace.  This takes some time, therefore the
  983.     emulator doesn't do this in Real Mode. Real time loading requires
  984.     minimum delay, so the screen does not update. You can select the update
  985.     option, but you risk Tape Loading errors!
  986.  
  987.     In the standard mode, the point (relative to the 50 Hz interrupt) at
  988.     which the screen is displayed can be controlled by setting the 'Video
  989.     Synchronisation Mode' to normal, high or low.  If you see moving
  990.     characters flickering excessively, try changing this setting.  For
  991.     instance, BC's Quest for Tires won't look at all good with a wrong
  992.     setting; many programs display subtle differences in different modes.
  993.  
  994.     In the Hercules and CGA modes not all colours can be displayed.  In EGA
  995.     mode, all colours can be displayed, but some colours have the same
  996.     intensity in Bright 1 as in in Bright 0.  Only in VGA mode the colours
  997.     resemble closely the Spectrum originals.
  998.  
  999.     The other video emulation mode is called Hi-resolution colour emulation
  1000.     mode. In this mode great care is taken to display each video line at
  1001.     exactly the right time, and also the precise times the border colour is
  1002.     changed is used to build the border pattern. In this mode, every
  1003.     hi-resolution colour effect is visible; all flickering problems are
  1004.     also eliminated (provided they weren't already there on a real
  1005.     Spectrum!), so no need to adjust the Video Synchronisation Mode.
  1006.  
  1007.     The drawback of using this mode is that it is much slower, since the
  1008.     emulator has to keep track of the number of T states passed, and also
  1009.     has to grab a line from screen memory and put it in a buffer 192 times,
  1010.     50 times a second.  But on fast computers, 486's and up, the emulator
  1011.     can still easily emulate at 100%.
  1012.  
  1013.     HRC mode only works with a VGA video adapter.
  1014.  
  1015.     Finally, when loading turbo-saved programs in Real mode, screen updates
  1016.     are suspended because they take too much time (even on fast computers).
  1017.     You can refresh the screen by pressing U - Update in Real mode, but you
  1018.     should do this only if you're sure that the emulated program is not
  1019.     loading a block, for pressing U during loading is a sure way to get a
  1020.     tape loading error.
  1021.  
  1022.  
  1023.  
  1024.  
  1025. 2.5  Sound emulation
  1026.  
  1027.  
  1028.     The Spectrum beeper is emulated by the PC's internal beeper.  Because
  1029.     every 1/50th of a second the screen has to be updated, and this takes a
  1030.     little time even if there are no changes, the sound is a bit harsh.  If
  1031.     you select real mode, the emulator won't update the screen and music
  1032.     will sound good.  If you select HRC mode, the sound will be even
  1033.     harsher than it does in normal mode.
  1034.  
  1035.     The sound of the Spectrum 128's sound chip is played through the Adlib
  1036.     card; if you haven't got such a card some notes are played through the
  1037.     internal speaker.  That sound will be turned off, however, as soon as
  1038.     the program makes a sound through the normal speaker of the Spectrum.
  1039.     Some Spectrum 128 programs use the sound chip and the beeper at the
  1040.     same time, and this won't work properly without an Adlib card.
  1041.  
  1042.  
  1043.  
  1044.  
  1045. 2.6  Loading programs from tape
  1046.  
  1047.  
  1048.     This emulator can load programs that are saved to tape in the usual
  1049.     way, but also turbo-saved programs can be loaded.  Furthermore, you can
  1050.     make a disk file act as an 'emulated tape', so that the normal SAVE and
  1051.     LOAD commands can be used to transfer data to and from disk easily.
  1052.  
  1053.     The emulator can load programs from .VOC sound sample files.  This is
  1054.     very useful for multi level games; the levels on the tape can be put in
  1055.     .VOC samples, and loaded when needed without having to re-install the
  1056.     tape recorder.  How to use .VOC files is described in section 2.8
  1057.     below.  The current section is about loading programs directly from
  1058.     tape.
  1059.  
  1060.     First of all, you need an interface to connect the tape recorder to the
  1061.     PC.  There are two ways of doing this.  You can use a tape interface on
  1062.     the LPT port.  A circuit diagram is in the DIAGRAM.Z80 program, or you
  1063.     can obtain a ready-made interface from B G Services, see section 1.2
  1064.     for more details.
  1065.  
  1066.     Version 3 can also use the SoundBlaster for tape input.  This is easier
  1067.     since no additional interface is needed.  The LPT tape interface
  1068.     however is more robust in loading.  When using the SoundBlaster, you
  1069.     have to be careful not to put the volume level too high, since
  1070.     otherwise the SoundBlaster will clip, which is a sure way to producing
  1071.     tape loading errors.  The LPT tape interface is not sensitive to this.
  1072.  
  1073.     It has proven very difficult to load programs directly via
  1074.     SoundBlaster.  This is due to the fact that the emulator does not have
  1075.     time to filter the SoundBlaster input (except for a trivial hi-pass
  1076.     filter to remove a 50 Hz hum) in Real mode.  For direct loading, the
  1077.     LPT interface is strongly recommended.  For loading via the
  1078.     SoundBlaster, the utility READSB (see section 2.19) will read in and
  1079.     filter the sample.  Loading via READSB is, I think, as reliable as
  1080.     loading via the LPT interface.
  1081.  
  1082.     If you want to save programs back to tape, you have to use the LPT
  1083.     interface; it is not possible to use the SoundBlaster for this.  (There
  1084.     is a way to save programs in standard format to tape though; put them
  1085.     in a .TAP file - see below - convert it to a .VOC file and play this
  1086.     sample to a tape.  Use a good sample player, one that doesn't halt for
  1087.     half a millisecond between blocks!)
  1088.  
  1089.     In the program DIAGRAM.Z80 a tape tester is present.  The LPT tape
  1090.     interface has to be calibrated, and this program can also be used to
  1091.     check the volume level when using the SoundBlaster as input device. The
  1092.     variable resistor of the LPT tape interface has to be adjusted so that
  1093.     the bar, which should go to 0% when the volume is down, points just
  1094.     below 50% at normal volume.  In the case of the SoundBlaster, when the
  1095.     volume is turned up, the bar first goes from 0% to 50% and over, and
  1096.     then saturates and drops below 50% again.  The volume has to be set
  1097.     such that it is just 50% in the non-saturated zone.
  1098.  
  1099.     You have to tell the emulator which LPT port you use for tape I/O.  Use
  1100.     command line switch -b2 for example to select LPT2 for tape input (or
  1101.     put it in the Z80.INI file).  Use -xo to select the SoundBlaster for
  1102.     tape input.  It uses base address 0220 by default; if this is not
  1103.     correct, use for instance -xq 0240 to specify address 0240.  The
  1104.     emulator does not use the SoundBlaster interrupts.
  1105.  
  1106.     There are two ways to load programs: in 'real' or normal mode.  In real
  1107.     mode, the emulator doesn't update the screen or scan the keyboard, so
  1108.     that the emulated Spectrum program can run smoothly.  The emulator has
  1109.     to run at about 100%, but then you're able to load everything a normal
  1110.     Spectrum would load, including turbo-saved programs.  The only thing
  1111.     you see on screen are the loading bars in the border (on EGA or VGA
  1112.     screens).  Real mode is selected by pressing F6.  Saving programs in
  1113.     real mode is a bit useless but it works; enter the SAVE command, press
  1114.     a key to start saving and quickly press F6 when the saving starts.  It
  1115.     will continue in real mode.
  1116.  
  1117.     Please note that in real mode, the PC clock is not updated.  It will
  1118.     run behind for as many minutes as real mode has been switched on.  The
  1119.     CMOS clock won't be affected, so the next time you start up your
  1120.     computer things will be normal again.
  1121.  
  1122.     If your computer is just fast enough, don't slow the emulator down too
  1123.     much.  Because the IN instruction is relatively slow, the emulator has
  1124.     to run at about 110% for the best results.  If your computer is really
  1125.     fast, you can best slow it down to exactly 100%.  If your computer is
  1126.     just a bit too slow, you can try to make your tape recorder run slower
  1127.     too (usually you can do this by adjusting a little screw at the back of
  1128.     the motor), I successfully loaded several speed-saved programs at 90%.
  1129.  
  1130.     In normal mode, the standard ROM loading and saving routines are
  1131.     'trapped' (at addresses 04d8 and 056a) when they're about to start
  1132.     saving or loading.  A routine in the emulator itself then takes over,
  1133.     and loads or saves a block to tape (or a disk file, see below).
  1134.  
  1135.     When you enter LOAD "", the emulator starts loading using its internal
  1136.     loading routine.  You'll see a blue window appear.  Pressing F6 now
  1137.     will switch to Real mode, and the emulated Spectrum program will
  1138.     continue the loading process (if it is running at 100%).
  1139.  
  1140.     Every time a block is loaded or saved, a window containing some
  1141.     information of the block to be loaded or saved appears.  If you don't
  1142.     want this, for example because you want to enjoy the loading screen,
  1143.     specify -tx on the command line.
  1144.  
  1145.     Using these SAVE and LOAD routines has a great advantage as well as a
  1146.     disadvantage compared to using the Spectrum's own routines in real
  1147.     mode. The advantage is that the internal routines work on every
  1148.     machine, no matter how slow or fast, without having to make the
  1149.     emulator run at 100%.  The disadvantage at using them is that they
  1150.     obviously won't understand turbo-saved files.  For normal use, these
  1151.     internal routines work much easier, and real mode loading is only
  1152.     necessary for turbo-saved and well protected programs.
  1153.  
  1154.     Today, most programs are protected.  The emulation of the Z80 processor
  1155.     has to be exactly right, or those strange decoding routines that use
  1156.     all features of the processor the programmer could think of, will
  1157.     definitely crash.  It is most important to switch the R-register and
  1158.     LDIR emulation on, as virtually all protected programs use at least the
  1159.     R register.  Sometimes programs are real sensitive to the timing of the
  1160.     interrupts; if programs refuse to load, try sampling the first few
  1161.     blocks in a .VOC file (see below) and load it from there (of course
  1162.     with R register and LDIR emulation on); when loading from VOC files,
  1163.     interrupt timings are exact.
  1164.  
  1165.  
  1166.  
  1167.  
  1168. 2.7  Using .TAP files
  1169.  
  1170.  
  1171.     The emulator uses files with the extension .TAP to hold a piece of
  1172.     'tape', with several blocks on it.  Each block is usually either a
  1173.     header or a data block; a normal file thus consists of two blocks.
  1174.     There are two modes of operation when loading and saving to disk files,
  1175.     single and multiple .TAP file mode.
  1176.  
  1177.     In single .TAP file mode, each block saved is appended to the end of
  1178.     the .TAP file, like what would happen if you were actually saving to
  1179.     tape.  In the same way, when loading in single file mode, each time the
  1180.     ROM wants to load a block, it is presented the next block in the .TAP
  1181.     file.  It is handled as it would if the block was loaded from tape, so
  1182.     that if the ROM needs a header and is presented a data block, it will
  1183.     skip it.  The header will however be considered to be read.  So,
  1184.     entering LOAD "rubbish" will show all headers in the .TAP file, just as
  1185.     an actual Spectrum would show all headers on the tape if you left the
  1186.     tape running.
  1187.  
  1188.     If the last block is loaded, the file pointer is moved to the start
  1189.     again.  So a .TAP file can be considered to be an infinite tape. Single
  1190.     .TAP file mode is useful to save whole programs to disk, or for
  1191.     multi-load games that need to load in levels as you play.
  1192.  
  1193.     A sort of 'random access' file management is also useful, for instance
  1194.     when you're developing a program and need to save several pieces of
  1195.     data to disk and later load back a specific one.  This can be done in
  1196.     single .TAP file mode (by positioning the file pointer using the Browse
  1197.     function), but there's a different mode of operation that makes things
  1198.     easier: multiple .TAP file mode.  In fact, by default the emulator is
  1199.     in this mode.
  1200.  
  1201.     When the emulator is in multiple .TAP file mode, it will read all
  1202.     blocks from all .TAP files in a specified directory, one after the
  1203.     other.  When it has finished reading the last one, it will start all
  1204.     over again.
  1205.  
  1206.     When saving, the emulator will put the two blocks of a normal file, the
  1207.     header and the data block, in one .TAP file with a unique name made up
  1208.     of the printable letters of the file name and a two-digit number.  The
  1209.     name of the .TAP file is irrelevant to the emulator, but to have it
  1210.     resemble the name of the actual Spectrum file you saved is simply
  1211.     convenient.  If the Spectrum program saves a data block to tape without
  1212.     first saving a header, the .TAP file produced will contain only this
  1213.     data block, and the DOS file name will be HDRLES, with a two-digit
  1214.     number appended to make it unique.  The format of the .TAP files saved
  1215.     in multiple .TAP file mode is exactly the same as the format used in
  1216.     single .TAP file mode.
  1217.  
  1218.     You can easily string together .TAP files; for instance a number of
  1219.     .TAP files created in multiple .TAP file mode can be put into one big
  1220.     .TAP file simply by concatenating them, e.g.
  1221.  
  1222.         COPY /B FILE1.TAP + FILE2.TAP ALL.TAP.
  1223.  
  1224.     Now you know what you can do, but how to get the emulator to do it?
  1225.     That's what the final section is about: the tape menu.
  1226.  
  1227.     Press F7 to enter the tape menu.  Pressing S will select or de-select
  1228.     single file mode.  As a default, multiple .TAP file mode is selected.
  1229.     In this mode there are three other possible choices in the menu.  First
  1230.     of all, D selects a tape-file directory where the .TAP files will be
  1231.     saved into and loaded from.  A default directory can be selected by
  1232.     putting the -xs switch on the command line or in the Z80.INI file; for
  1233.     example -xs c:\spectrum\taps.
  1234.  
  1235.     The I and O options are used to select the source and destination of
  1236.     the saving and loading: the LPT port (in/out) or SoundBlaster port
  1237.     (only input) for a physical tape recorder, or 'disk' for disk files.
  1238.     Input and output are directed to disk by default if a default tape file
  1239.     directory is given by means of a switch on the command line or .INI
  1240.     file.
  1241.  
  1242.     If Single .TAP file mode is selected, different and more menu options
  1243.     appear.  With R and W, the input and output tape files can be selected.
  1244.     They may be the same.  If a specified output file already exists, you
  1245.     may choose to append to or overwrite this old file.  Saving is always
  1246.     at the end of the file; loading always starts at the beginning of the
  1247.     .TAP file.
  1248.  
  1249.     A useful shortcut is ALT-F7: it will automatically select single file
  1250.     mode, and prompt for an input .TAP file.
  1251.  
  1252.     With the B option - Browse - the position of the file pointer into the
  1253.     input .TAP file can be changed.  If you, for instance, type LOAD""
  1254.     instead of LOAD "" CODE, the first header is read, and you would have
  1255.     to read all other headers before trying to load the file again.  With
  1256.     the browse option you can conveniently change the file pointer.  Of
  1257.     every header (that is, every block with flag byte 0 and length exactly
  1258.     17) the name and type, and of every data block the length is shown.
  1259.  
  1260.     The option B can also be used to delete specific blocks from a .TAP
  1261.     file.  Make sure you do not only delete a data block or a header, or
  1262.     the ROM may get confused.  (Double data blocks will be skipped, but
  1263.     double headers can generate Tape Loading errors).
  1264.  
  1265.     As in multiple .TAP file mode, I and O are used to specify the source
  1266.     and destination for saving and loading.  If you enter a .TAP file name
  1267.     with R or W, this will automatically be set correctly.  You can then
  1268.     always reset the input or output back to physical i/o again, of course.
  1269.  
  1270.     Finally, in Single .TAP file mode you can use 'tape mirroring': loading
  1271.     programs from tape (in normal mode, i.e.  not using Real mode) and at
  1272.     the same time saving a copy of each block loaded into a .TAP file. This
  1273.     .TAP file can later be used to load the program again, in case
  1274.     something goes wrong.  There are two ways of mirroring: normal
  1275.     mirroring and exact mirroring.  The last one must be used only in
  1276.     exceptional cases; it will always make a copy of a block, even if it
  1277.     had a tape error (the corresponding block in the .TAP file will also
  1278.     have a tape error).  This causes ticks in leader tones to make 0-byte
  1279.     blocks, so the .TAP file may get messy.  Do not use exact mirroring if
  1280.     you don't really have to; I think normal mirroring will always work in
  1281.     practice.
  1282.  
  1283.     If you try to leave the tape menu when for instance tape mirroring is
  1284.     selected, and no output filename is given, the emulator will warn you
  1285.     and will insist that the error be corrected.  Yes, it's stubborn!
  1286.  
  1287.     One final point about multiple .TAP file mode.  If you select a
  1288.     directory that contains no .TAP files at all, and try to load from the
  1289.     directory, the emulator will reset itself to physical tape I/O.  Select
  1290.     a different directory and try again.  Note that simply putting a .TAP
  1291.     file in the directory does not reset the emulator to multiple .TAP file
  1292.     mode, as it will not look in the directory again as soon as it uses
  1293.     physical tape I/O.
  1294.  
  1295.  
  1296.  
  1297.  
  1298. 2.8  Using .VOC files
  1299.  
  1300.  
  1301.     .VOC files contain sound samples, so they can also contain the sound of
  1302.     a computer tape.  The emulator can load programs from these sound
  1303.     sample files, by keeping track of exactly how much time elapses during
  1304.     the emulation of a program, and every time the emulated Spectrum
  1305.     program reads the EAR port, supplying it with the right sample.  Via an
  1306.     intermediate file, a .OUT log file, the emulator can also SAVE and
  1307.     produce a .VOC file with the right sounds in it.
  1308.  
  1309.     In this section .VOC file playback is discussed.  For a discussion of
  1310.     how to SAVE to a .VOC file, or how to produce a .VOC file of
  1311.     Spectrum-generated music, please read section 2.18 about the OUT2VOC
  1312.     utility.
  1313.  
  1314.     Because the emulator has to keep track of the emulated time, and also
  1315.     has to do some calculation every time the EAR port is read (which a
  1316.     program does rather often when loading), the emulation speed drops
  1317.     considerably (by a factor of two, roughly) when playing back .VOC
  1318.     sample files.  So loading programs using VOC files may take longer than
  1319.     loading them directly.  On the other hand, it is not at all necessary
  1320.     to have the emulator run at 100% now, so that even slow computers can
  1321.     load turbo-saved programs, provided that they can read samples.  And on
  1322.     fast computers, the emulator can be set at the maximum speed, to load
  1323.     programs much faster than usual.
  1324.  
  1325.     Using .VOC files is sensible for instance when you have a multi level
  1326.     game, where subsequent levels are saved in a non-standard format, so
  1327.     that they cannot be stored in .TAP files.  The higher levels can be
  1328.     stored in .VOC files, and loaded when needed, without having to
  1329.     re-install the cassette player.
  1330.  
  1331.     You can take a sample with any sampler program.  The emulator supports
  1332.     most VOC block types.  It does not support compressed blocks, though;
  1333.     use full 8 bit samples.  The problem with some samplers is that they
  1334.     leave a small gap between subsequent blocks within the .VOC file.
  1335.     These gaps are usually inaudible, but do cause tape loading errors.  It
  1336.     is very important that the sample is taken without any gaps.  The
  1337.     READVOC program reads samples from the LPT tape interface or the
  1338.     SoundBlaster, and can take long continuous samples without gaps.
  1339.     Because the emulator converts the 8-bit sample to a simple High or Low
  1340.     value, READVOC also uses only two values for the signal height.  This
  1341.     results in highly compressible .VOC files; compression factors of about
  1342.     25 are no exception.
  1343.  
  1344.     READVOC is good at taking samples from the LPT tape interface, but it
  1345.     performs worse when used to take samples from sound cards.  You'll be
  1346.     better off using samplers provided with the card.
  1347.  
  1348.     It is also possible to convert .TAP files to .VOC files, with the
  1349.     utility TAP2VOC.  This was useful to test the .VOC playback feature,
  1350.     and also makes it possible to write .TAP files back to tape using a
  1351.     sample player.
  1352.  
  1353.     To play back a VOC file, press F7 to go to the tape menu, and press P
  1354.     to select the VOC file playback menu, and enter the name of the VOC
  1355.     file to be played. The VOC file is now in stand-by. Just for
  1356.     convenience, the emulator starts playing back the VOC file as soon as
  1357.     the ROM loading routine is hit; that is, as soon as you type LOAD ""
  1358.     and ENTER.  The emulator will now play the VOC file to the end
  1359.     (irrespective of what the emulated Spectrum program is doing with the
  1360.     sound supplied to the EAR port!).  When the end is reached, a window
  1361.     will pop up, and the emulator switches back to normal emulation mode.
  1362.  
  1363.     It is possible to pause the play-back at any time.  Do not do this
  1364.     while loading, since it will immediately result in a tape loading
  1365.     error.  It is also possible to start play-back without LOAD "", which
  1366.     is necessary for instance when the VOC file consists of a turbo-saved
  1367.     block.
  1368.  
  1369.     And finally, it is possible to wind and re-wind the VOC file, as if it
  1370.     were a tape.  The position is displayed in minutes, seconds and
  1371.     hundreds of seconds.
  1372.  
  1373.     Starting the emulator by "z80 -tv file.voc" will play that .VOC file to
  1374.     the EAR input as soon as the emulator starts.  It makes sense also to
  1375.     load a .Z80 snapshot file from the command line.  To make a snapshot
  1376.     file that starts loading right away, type LOAD "" <ENTER>, press F6
  1377.     (real mode), B (back to normal mode), F2 (save snapshot) and save it.
  1378.  
  1379.  
  1380.  
  1381.  
  1382. 2.9  Multi-load games
  1383.  
  1384.  
  1385.     Some games have several levels saved on the tape, to be loaded when a
  1386.     previous level is completed.  There are several ways to handle these
  1387.     programs.
  1388.  
  1389.     First, simply playing it, and loading next levels using a real
  1390.     tape-recorder seems a good solution.
  1391.  
  1392.     If the data blocks in which the level data is saved are written to tape
  1393.     in the standard format, you can convert them to .TAP files.  It is most
  1394.     likely that the program uses the usual ROM routine to load the blocks,
  1395.     and this routine is trapped by the emulator, so that instead of loading
  1396.     from tape, the blocks can be loaded from these .TAP files.  To convert
  1397.     the blocks to .TAP file, use a standard tape-to-tape copy program and,
  1398.     in the Tape menu (F7), specify that tape output should go to some file.
  1399.     If the blocks are just code blocks with header, simply enabling the
  1400.     Tape Mirroring option and loading the blocks at 16384 (ignore the
  1401.     crashes that most probably result; just reset the emulator and
  1402.     continue) will do the trick.  If the blocks are headerless, then go to
  1403.     the SamRam, press NMI (F5), D for Disassembler, and L:4000 (with tape
  1404.     mirroring enabled) to load and mirror each block.  Here also, ignore
  1405.     possible crashes which result if the block is too long.
  1406.  
  1407.     A general method is to store the level data blocks in .VOC sample
  1408.     files.  These files are huge, lengths of several megabytes are common,
  1409.     but they can be compressed very tightly (if you used READVOC or READSB
  1410.     to make them).  Then, if you need a block, simply shell to DOS,
  1411.     decompress it, and load it.
  1412.  
  1413.     Finally, if you want to hack into the program, you can also try to find
  1414.     the routine that is responsible for the loading of a level.  At the
  1415.     appropriate point, enter an ED FB instruction, with A containing the
  1416.     level number, and HL the address at which the block is to be loaded.
  1417.     The emulator will then try to load the data.  If loading failed, the
  1418.     carry flag is toggled; it is untouched if the data was loaded
  1419.     successfully.
  1420.  
  1421.     The level data can be stored in a .SLT file (Super Loader Trap file),
  1422.     which contains a snapshot and can contain data for several levels.  If
  1423.     the current program was not loaded from a .SLT file, the emulator will
  1424.     look for files with the .DAT extension.  The name is made from the
  1425.     snapshot last loaded, with the required level number appended in
  1426.     decimal; letters are dropped from the file name if necessary to make
  1427.     them at most 8 characters long. If the file is not found, the user is
  1428.     informed of the level number, and given the opportunity to specify a
  1429.     name.
  1430.  
  1431.     .SLT files can be produced using the ADDDAT utility.  See also section
  1432.     5.10, file formats, for more information.
  1433.  
  1434.     This ED FB feature first appeared in XZX 0.5.2, and was devised by
  1435.     Russell Marks.  It is now supported by many other emulators as well.
  1436.  
  1437.  
  1438.  
  1439.  
  1440. 2.10  Using the microdrive
  1441.  
  1442.  
  1443.     Compared to the tape, this is really simple.  Cartridges are emulated
  1444.     by files of 137923 bytes.  These files have the extension .MDR, and can
  1445.     contain up to 126K of data.  The emulator emulates 8 microdrives, the
  1446.     maximum amount the Interface I software can handle, and each of these
  1447.     cartridge files can be inserted in any of the 8 microdrives.  (Do not
  1448.     insert one file into more than one microdrive; this will cause problems
  1449.     with the buffering done by the emulator as well as the Interface I, and
  1450.     might result in data loss).
  1451.  
  1452.     Press F8 to enter the microdrive menu.  Press 1 to 8 to select a
  1453.     microdrive, and I to insert a microdrive cartridge.  You can select an
  1454.     existing one, or type a new name.  If the cartridge file isn't found,
  1455.     the emulator asks whether it should create it.  When created, you'll
  1456.     have to format it first; if you don't, you'll get a 'microdrive not
  1457.     present' error when you try to read it, just as happens with real
  1458.     unformatted cartridges.  To format a cartridge, type
  1459.  
  1460.         FORMAT "m";1;"name"
  1461.  
  1462.     After this the cartridge should have 126K of free space.
  1463.  
  1464.     The cartridge can be write protected; see the menu option in the F8
  1465.     menu.  This is a characteristic of the cartridge, and the write protect
  1466.     tab information is therefore stored in the cartridge file.
  1467.  
  1468.     As on the real Spectrum, you'll have to be careful with OUT's if a
  1469.     cartridge is inserted.  Try OUT 239,0 (on a real Spectrum, this turns
  1470.     on the microdrive motor) and wait a few seconds; most of your data will
  1471.     be lost!  You can stop the microdrive motor by typing STOP (or, more
  1472.     generally, generate an error).
  1473.  
  1474.     The microdrives are emulated at IN/OUT level.  This means that every
  1475.     utility or program that uses microdrives ought to work on the emulator.
  1476.     Most utilities use hook codes, and these will certainly work.
  1477.  
  1478.     The GAP line is emulated; this signal is activated if the interface I
  1479.     senses a piece of tape with no data on it.  If the checksum of the
  1480.     first header block of a microdrive header or data block is not correct,
  1481.     that block is considered to be a GAP.  This will only happen if some
  1482.     utility writes a bad block to microdrive deliberately, if the file is
  1483.     newly created and unformatted, or when you type OUT 239,0.
  1484.  
  1485.     To try the microdrive, load a Spectrum program, switch to Spectrum
  1486.     48K+If.1 mode if necessary, and turn on Multiface 128 emulation.  Press
  1487.     F8, I(nsert cartridge), enter some file name and create an unformatted
  1488.     cartridge, return to the Spectrum and press F5 (NMI), S(ave), enter
  1489.     some name, choose M(icrodrive), choose F(ormat) and wait a few seconds,
  1490.     then choose S(ave).  Then reset the Spectrum, and type LOAD
  1491.     *"m";1;"name" to re-load the snapshot you just made.
  1492.  
  1493.     Alternatively, switch to SamRam mode, make sure a formatted cartridge
  1494.     is present, press F5, S, M, S, name, and press ENTER twice to have the
  1495.     SamRam save a snapshot to microdrive.  This snapshot can only be loaded
  1496.     in SamRam mode.
  1497.  
  1498.  
  1499.  
  1500.  
  1501. 2.11  Using the DISCiPLE and Plus D interfaces
  1502.  
  1503.  
  1504.     For an explanation of the commands of the DISCiPLE and Plus D
  1505.     interfaces, see the relevant sections in chapter 4.
  1506.  
  1507.     The ROM of the DISCiPLE is supplied with the emulator, together with
  1508.     two version of the D.O.S. pre-loaded in RAM.  The ROM of the Plus D
  1509.     interface is not supplied, for copyright reasons.  The emulator will
  1510.     only emulate a Plus D interface if it can find a file PLUSDROM.BIN in
  1511.     the emulator's own directory.  If you have a Plus D yourself, you can
  1512.     transfer the ROM in the following way.  Load the operating system from
  1513.     a Plus D system diskette, and save the entire ROM, together with the
  1514.     operating system, to disk by entering SAVE d1"rom" CODE 0,16384.  Then,
  1515.     start the emulator and choose hardware mode Spectrum 48K + Disciple
  1516.     (not Plus D of course), then type LOAD d1"rom" CODE 32768 to load the
  1517.     rom at address 32768.  Then type
  1518.  
  1519.         POKE 48623,0
  1520.  
  1521.     to reset the 'open file' counter; failing to do so will result in data
  1522.     being overwritten when you use the Plus D snapshot feature as the Plus
  1523.     D system will not build up a used-sector-bitmap if this counter is
  1524.     non-zero.  You can check that this counter is 1 by typing PRINT PEEK
  1525.     48623; this one open file is the file "rom" itself.
  1526.  
  1527.     Finally, press F10, X, S for Save Data block, set start address and
  1528.     length to 32768 and 16384 (decimal) respectively, and save the ROM by
  1529.     the name PLUSDROM.BIN.  If you re-start the emulator now, it will
  1530.     emulate the Plus D too.
  1531.  
  1532.     (Aside: to use your own version of the DISCiPLE rom, proceed as above,
  1533.     but type
  1534.  
  1535.         POKE 40431,0
  1536.  
  1537.     Note that for this, the base of DISCiPLE's system variables must be
  1538.     #0298 = 664 decimal.  If it is different, change above address
  1539.     (corresponding to location #1DEF but displaced by #8000 bytes, i.e.
  1540.     relative position 6999 decimal).  Then use DEBUG or any flexible
  1541.     file cut-and-paste utility to put the 16K file in the correct position
  1542.     in the ROMS.BIN file; see file TECHINFO.DOC for the exact position.
  1543.     End of aside.)
  1544.  
  1545.     The emulation of the DISCiPLE or Plus D interfaces in turned on simply
  1546.     by choosing the right hardware mode in the F9 menu.  Changing the
  1547.     M.G.T. type will result in a Spectrum reset (unless you change with
  1548.     CTRL-ENTER), since a different ROM is switched in.
  1549.  
  1550.     By default, disks 1 and 2 refer to drives A: and B: respectively, but
  1551.     this can be changed in the F8 menu.
  1552.  
  1553.  
  1554.  
  1555.  
  1556. 2.12  Using the Multiface 128
  1557.  
  1558.  
  1559.     The following is an excerpt from the original Multiface 128
  1560.     documentation:
  1561.  
  1562.     MULTIFACE is a registered trademark af RORANTIC ROBOT.  Multiface 128
  1563.     is a true multi-purpose interface with
  1564.  
  1565.     1) fully universal and 100% automatic back-up facility for tape,
  1566.        microdrive, Discovery, Plus D or Disciple (although the Discovery is
  1567.        not emulated, so that that feature is not usable),
  1568.     2) 8K RAM extension - suitable for GENIE, LIFEGUARD, or as a buffer,
  1569.     3) MULTI TOOLKIT to study/modify/develop programs, POKE infinite lives,
  1570.        etc.
  1571.  
  1572.     Multiface 128 works on the Spectrum 48/128.  It can be used any time in
  1573.     any mode; it is immaterial what is inside the Spectrum at that moment
  1574.     or how or from what source (tape, disk, cartridge) it has been loaded
  1575.     (or typed in, etc.).  Multiface does not save programs, but computer
  1576.     contents (compressed RAM image).  Upon returning from the M128 or upon
  1577.     re-loading, the programs continue as if never frozen.  To use the M128:
  1578.  
  1579.     1) Push the NMI key (F5)
  1580.     2) Select the required option from the menu
  1581.  
  1582.     The MAIN MENU options are:
  1583.  
  1584.     Exit: to abandon the Multiface and exit to BASIC (provided BASIC is
  1585.       present).  By using exit, you come out of the Multiface entirely.
  1586.       All efforts are made to preserve the current program in the Spectrum
  1587.       intact.  The main condition is the existence of standard system
  1588.       variables - without these the Spectrum crashes.  A successful exit
  1589.       gives you full access to the program.  To restart it, if needed, you
  1590.       must know the starting line or address.  Exit is impossible in the
  1591.       128K mode when the edit ROM is paged and Spectrum ROM is off; in such
  1592.       cases it does not appear on the menu at all.  All in all, you can
  1593.       only exit to BASIC if it exists - it is like jumping into a pool: a
  1594.       joy if it's full of water, a crash if there is none.
  1595.  
  1596.     Return: to continue the program.
  1597.  
  1598.     Save: to proceed to the SAVE routines:
  1599.       a) input the name of the program.  Up to 9 characters (or just press
  1600.          ENTER to the input RUN automatically as a default)
  1601.       b) save to: Tape, Microdrive, Opus [does nothing], Disciple (use D
  1602.          for Plus D too).  You can save the entire program (including the
  1603.          screen), or the screen only.  Programs are compressed to take the
  1604.          minimal room possible and to load faster.  Screens saved on their
  1605.          own are left intact as standard Spectrum screens.
  1606.       c) Format microdrive cartridges.  Cartridges are automatically named
  1607.          after the programs to be saved.
  1608.  
  1609.     Tool: to access the MULTI TOOLKIT routines.
  1610.       quit - to return to the main menu
  1611.       Enter - to PEEK and scroll through addresses or to POKE
  1612.       Space - to allow you to type in a new address
  1613.       hex - to toggle between hexadecimal and decimal display format
  1614.       reg - to point to the Z80 registers as they were when the program was
  1615.         frozen
  1616.       window - to open a window with full on-screen editing using the
  1617.         cursor keys.  The flashing window address corresponds to the
  1618.         address in the bottom edit line.  The window display is by default
  1619.         in hex, but you can change it to
  1620.       text - to see the 128 bytes in the window as ASCII text.
  1621.       select - to inspect RAM banks 0-7 in 128K mode.  Press s + the bank
  1622.         number
  1623.  
  1624.     Print - to dump screen to printer.  For printer interfaces using COPY
  1625.       command.  You can POKE address 8200 (decimal) with the following
  1626.       values, if you wish to
  1627.       113 to turn the line feed on (cr+lf)
  1628.       112 to turn the line feed off (cr)
  1629.       17 to dump screen as text with the line feed on
  1630.       16 to dump screen as text with the line feed off
  1631.  
  1632.     Jump - not to return, but jump to another address.  Strictly for
  1633.       machine code users only.  Enter the address to jump at 8192/3
  1634.       (low/hi).  You can jump to Spectrum ROM/RAM and to M128 8K RAM.  As
  1635.       the M128 overshadows the ZX ROM (8192-16383), address 8194 determines
  1636.       the paging status: if it is 0, the M128 RAM remains paged, 1 pages
  1637.       out the RAM and any other value disables the jump command completely.
  1638.       [Note: if it is 0, also the M128 ROM (0-8191) remains paged.]
  1639.  
  1640.       You can jump from the main menu, and you can also pre-program M128 to
  1641.       jump directly upon NMI (F5) and by-pass the M128 ROM software
  1642.       entirely.  To program the direct jump, POKE 8192-3 with the jump
  1643.       address, and then also 8195-7 with a special identification word RUN
  1644.       (i.e. 82,85,87).  Whenever you press NMI now, you will jump to the
  1645.       predefined address and not see the M128 menu.  To return from your
  1646.       program to the program you stopped, use RST 0.  To revert back to the
  1647.       Multiface normal operation, press NMI and BREAK (shift+space)
  1648.       simultaneously.  This also cancels the code word RUN.
  1649.  
  1650.       In standard mode M128 uses 8192-11144 as a buffer (8192-13496 once
  1651.       you proceed to SAVE) and overwrites anything in there.  Using direct
  1652.       jump, you have 8257-16338 available.
  1653.  
  1654.     Clear - to clear the extra 64K RAM bank (in 128K mode only!).  You can
  1655.       clear any time, but it is only useful with 48K programs in 128K mode.
  1656.       However, you should save 48K programs in 48K mode anyway.  Also, for
  1657.       obvious reasons, clearing the banks in 128K programs is not a good
  1658.       idea.
  1659.  
  1660.  
  1661.     The actual M128 has a software on/off switch, so that it could be made
  1662.     completely invisible to programs until the NMI switch was pressed. This
  1663.     software switch is not emulated.  The M128 could be turned off by
  1664.     pressing 'O' in the main menu; this does not work on the emulator.  You
  1665.     can turn off the M128 in the Select Hardware (F9) menu.
  1666.  
  1667.     Using the extra 8K RAM - M128 has an 8K Rom containing its own
  1668.     software, and an 8K RAM used as a buffer.  You can use the 8K RAM for
  1669.     your own mcode routines or for data (but not for BASIC).  The RAM must
  1670.     be paged in machine code to be accessed: use IN A,(191) to page in, and
  1671.     IN A,(63) to page out.  The BASIC In and Out commands can not be used
  1672.     here (they work, but result in a crash).  The 8K RAM overshadows the
  1673.     Spectrum ROM and thus anything contained in the M128 RAM cannot make
  1674.     any calls to the Spectrum ROM, as they both occupy the same area. The
  1675.     M128 RAM routines should therefore be self-contained, independent of
  1676.     the Spectrum ROM.
  1677.  
  1678.     Poking infinite lives - To POKE, say 31000,0, first load the program as
  1679.     usual.  When it's loaded, press NMI (F5) and select the tool by
  1680.     pressing T.  When the toolkit menu appears, press SPACE and type 31000.
  1681.     Once you type 5 digits the cursor automatically moves to the value
  1682.     field (no need to press ENTER), so type 0 (value is 1-3 digits long)
  1683.     and this time press ENTER.  Finally press Q to quit the toolkit and R
  1684.     to return to the program.
  1685.  
  1686.  
  1687.     The Multiface 128 was designed by Romantic Robot UK Ltd, 54 Deanscroft
  1688.     Avenue, London NW9 8EN, tel. 081-200 8870.
  1689.  
  1690.  
  1691.  
  1692.  
  1693. 2.13  Using the RS232 channel
  1694.  
  1695.  
  1696.     This was the only Spectrum i/o channel that could be used in the early
  1697.     versions of the emulator.  Using .TAP files instead of the RS232
  1698.     channel is often easier, but sometimes using the RS232 channel can be
  1699.     very useful too, for instance if you've got a null-modem lead that
  1700.     connects a Spectrum with interface I to the PC you can use it to
  1701.     transfer data and programs easily.  Furthermore, the RS232 channel is
  1702.     the easiest way to let the emulator communicate with a PC printer.
  1703.  
  1704.     Several things send their output to the channel designated as 'RS232
  1705.     output channel'.  First of all the ordinary Interface I RS232 "B" and
  1706.     "T" channels.  Secondly the 128K printer "P" channel.  Thirdly, ZX
  1707.     Printer output is converted to a format appropriate for Epson or HP PCL
  1708.     printers (works for most dot matrix, and most laser/inkjet printers
  1709.     respectively) and also sent to this channel. Input from the 'RS232
  1710.     input channel' is sent to the Interface I's "B" and "T" channels.
  1711.  
  1712.     The Interface I RS232 port, the "B" or "T" channel, behave slightly
  1713.     differently.  The first, binary, channel is the raw channel.  It will
  1714.     let all data go through unchanged.  The "T" channel won't let all
  1715.     control codes through and will expand any keyword; useful for LISTing a
  1716.     program but otherwise annoying.
  1717.  
  1718.     The Spectrum 128 has its own RS232 port; it is called the "P" channel.
  1719.     Output to either the Interface I's or Spectrum 128's own RS232 port
  1720.     will all be processed as 'RS232 output'.
  1721.  
  1722.     The output to the RS232 channel can be routed to an LPT port, to a COM
  1723.     port or to a file on disk.  Input can come from either a file or a COM
  1724.     port.
  1725.  
  1726.     If you want to use the RS232 channel for printing using LPRINT and
  1727.     LLIST (shorthand for PRINT #3 and LIST #3), be sure to open that
  1728.     channel for output to RS232; by default it sends its output to the ZX
  1729.     Printer, which is not supported.  You can open the channel by typing
  1730.     OPEN #3,"B" (or "T" for listings, or "P" on a Spectrum 128).
  1731.  
  1732.     Input and output are buffered.  This is important to remember when
  1733.     you're transferring files using the SAVE and LOAD *"b" commands of the
  1734.     Interface I.  If the header is missed, for instance if you try to load
  1735.     the wrong file type, re-sending the file will not directly work because
  1736.     there will still be bytes in the buffer.  You have to clear the input
  1737.     buffer before re-sending the file.  When inputting from a disk file,
  1738.     the file pointer can be reset to point to the start of the file again
  1739.     to re-read the header.
  1740.  
  1741.     When inputting from or outputting to a disk file, the read or write
  1742.     position is displayed as a byte-count.  An <EOF> sign will appear if an
  1743.     input file is read completely through to the end.
  1744.  
  1745.     The RS232 redirection options are in the Change Settings (F4) menu.
  1746.  
  1747.     When using a COM port, make sure you have initialised it before
  1748.     starting the emulator with the Dos MODE command, for instance
  1749.  
  1750.         MODE com1:96,n,8,1
  1751.  
  1752.     initialises COM1 to send and receive at 9600 baud, no parity, 8 data
  1753.     bits and 1 stop bit, the default for the Interface I.
  1754.  
  1755.     Here is how to transfer programs from a Spectrum to the PC using the
  1756.     RS232 lead.  First, you need a null-modem lead.  I myself use the
  1757.     following cable:
  1758.  
  1759.           Spectrum                                  'AT'      'PC'
  1760.           (9 pins)                                (9 pins)  (25 pins)
  1761.  
  1762.             3 TxD   ───────────────────────── RxD     2         3
  1763.  
  1764.             4 DSR   ───────────────────────── DTR     4        20
  1765.  
  1766.                                         ┌──── CTS     7         4
  1767.                                         └──── RTS     8         5
  1768.  
  1769.             7 GND   ───────────────────────── GND     5         7
  1770.  
  1771.     (so CTS and RTS have to be connected!)  This is not a full null-modem
  1772.     lead; you can only send data from the Spectrum to a PC.  If you have an
  1773.     Interface I, you can use the LOAD *"b" and SAVE *"b" commands on both
  1774.     your real Spectrum and the emulator to transfer programs and data. It's
  1775.     best to first type LOAD *"b" and then SAVE instead of the other way
  1776.     around.  If you have problems with transferring data, try to lower the
  1777.     baud rate to 4800 or 2400 baud; this sometimes helps.
  1778.  
  1779.     If you don't have an Interface I, but do have a printer interface using
  1780.     RS232 leads, then you can transfer data using LPRINT on the Spectrum
  1781.     side, and INKEY$ #3 on the emulator side.  It needs a little bit of
  1782.     programming.
  1783.  
  1784.  
  1785.  
  1786.  
  1787. 2.14  On joysticks and mice
  1788.  
  1789.  
  1790.     The emulator support several joysticks and the Microsoft mouse, to
  1791.     control several Spectrum joystick interfaces, and the AMX Mouse
  1792.     interface.  First, joysticks are discussed.
  1793.  
  1794.     As was already said in the introduction, the emulated Spectrum joystick
  1795.     (Cursor, Interface 2, Kempston or user defined) is controlled by the PC
  1796.     cursor keys and 5/0/.  on the numeric keypad and TAB as fire keys.  The
  1797.     emulated joystick can also be controlled by a mouse, or by a real
  1798.     joystick, either analogue (PC standard) or digital.
  1799.  
  1800.     The analogue joystick support is rather straightforward.  If you've got
  1801.     one, it works - it couldn't be simpler.  The digital joystick support
  1802.     is less obvious, since PC's don't support these.
  1803.  
  1804.     To use digital joysticks, Ruud Zandbergen has made a device that uses
  1805.     the two inputs of a normal analogue joystickinterface to connect a
  1806.     digital joystick to a PC.  Here's the circuit diagram:
  1807.  
  1808.  
  1809.     15 pins male  (pc)                           9 pins male (joystick)
  1810.  
  1811.  
  1812.     1+9 <─────────┬───────────┬────────────┬─────────────┬──> 7 (5V)
  1813.                  ┌┴┐         ┌┴┐          ┌┴┐           ┌┴┐
  1814.         4 x 1 kΩ │ │ ¼ Watt  │ │          │ │           │ │
  1815.                  └┬┘         └┬┘          └┬┘           └┬┘
  1816.     3   <─────────┴──> 4 (up) │            │             │
  1817.                               │            │             │
  1818.     6   <─────────────────────┴──> 3 (dwn) │             │
  1819.                                            │             │
  1820.     13  <──────────────────────────────────┴──> 1 (rght) │
  1821.                                                          │
  1822.     11  <────────────────────────────────────────────────┴──> 2 (lft)
  1823.                        ┌────────────────────┐
  1824.     2   <──────────────┤    47 Ω ¼ Watt     ├───────────────> 6 (fire)
  1825.                        └────────────────────┘
  1826.     4+5+14 <────────────────────────────────────────────────> 8 (0V)
  1827.  
  1828.  
  1829.     4+5+14 means: connect pins 4, 5 and 14.  The same applies for pins 1 and
  1830.     9.  Here's the list of ingredients:
  1831.  
  1832.         1 x 9 pins D plug, male
  1833.         1 x 15 pins D plug, male
  1834.         4 x 1kΩ , ¼ Watt resistors
  1835.         1 x 47 Ω, ¼ Watt resistor
  1836.         piece of 7-wire flatcable
  1837.  
  1838.     Everything can be fitted into the 15-pins plug. Make sure the resistors
  1839.     don't touch the other blank connections! This interface can be used for
  1840.     all usual digital joysticks, with or without auto fire (that is every
  1841.     joystick that work with a Kempston joystick interface, or that work on
  1842.     a Commodore 64/Amiga or Atari). The joysticks for the Spectrum +2/+3
  1843.     will not work, however the pin layout is easy to change.
  1844.  
  1845.     This joystick interface needs an analogue PC-joystick interface on
  1846.     which you can connect TWO analogue joysticks (on one plug!).  Most
  1847.     cards can do this, but some multi-I/O cards support only one joystick.
  1848.     Check the documentation of your I/O card to see whether your
  1849.     joystickinterface is suitable.  The soundblaster joystick interface
  1850.     works fine.
  1851.  
  1852.     A number of PC games will behave strangely when the digital joystick
  1853.     interface is connected; they run very slow or crash.  When this
  1854.     happens, remove the joystick interface (not only the joystick!).
  1855.  
  1856.     With version 3, the Spectrum joystick (Cursor, Kempston, Sinclair 2 or
  1857.     user defined) can not only be controlled by the cursor keys or a real
  1858.     joystick, but also by a mouse.  Specify -km on the command line to have
  1859.     the mouse control the joystick too.  (By default, this switch is
  1860.     already in the Z80.INI file.)
  1861.  
  1862.     Finally, the Microsoft mouse can control the AMX Mouse interface, as
  1863.     supported for example by Art Studio.  Specify -ka on the command line
  1864.     to select this option.  The mouse will not control the joystick
  1865.     anymore.  Because of I/O address clashes, the AMX Mouse does not work
  1866.     with SamRam or an M.G.T. interface enabled.  Also, since the AMX
  1867.     interface must be initialized, and the state of the AMX interface is
  1868.     not saved in the .Z80 snapshot file, it may be necessary to make the
  1869.     snapshot before the point at which the Spectrum program initializes the
  1870.     AMX interface.  The program Art Studio re-initializes the AMX interface
  1871.     regularly, however, so with this program you don't have to worry about
  1872.     it.  You still need to customize the program to use the AMX mouse of
  1873.     course, so a snapshot of Art Studio will not automatically work; you
  1874.     need to load the original from tape again, and go through the
  1875.     customization procedure.
  1876.  
  1877.  
  1878.  
  1879.  
  1880. 2.15  The utility ConvZ80
  1881.  
  1882.  
  1883.     This program converts between various snapshot formats, and it can also
  1884.     convert various tape file formats to .TAP files.  Currently it supports
  1885.     .SNA format (used in various emulators, such as JPP, Peter McGavin's
  1886.     emulator on the Amiga, and XZX), the .SP format of VGASPEC and
  1887.     SPECTRUM, the .PRG format of SpecEm, and all old .Z80 file formats.
  1888.  
  1889.     If conversion is to a .Z80 file, the old (v1.45) format will be used.
  1890.     This is still supported by the emulator, and some other programs do not
  1891.     support the new format.  Note that, because of this, ConvZ80 will not
  1892.     convert .Z80 files containing snapshots of 128K or SamRam programs.
  1893.  
  1894.     CONVZ80 recognizes what it should do by the extension of the files you
  1895.     enter on the command line; to distinguish between VGASPEC's and
  1896.     SPECTRUM's .SP formats you can use the switch -o.  If the extension
  1897.     consists of digits only, it is taken to be a ZX tape file, and if it
  1898.     contains non-digits and is none of .SP, .Z80, .SNA, .PRG or .TAP it is
  1899.     regarded as a SpecEm tape file.
  1900.  
  1901.     SpecEm can load .PRG snapshot files, but cannot save them.  However, it
  1902.     emulates the Multiface I, which can save snapshots to tape.  SpecEm
  1903.     will save these blocks as tape files to disk.  If you convert these to
  1904.     a .TAP file (in the correct order!), you can load them into Z80 and
  1905.     save the program as a .Z80 file.
  1906.  
  1907.  
  1908.  
  1909.  
  1910. 2.16  Converting file formats - the utility CONVERT
  1911.  
  1912.  
  1913.     This section is about the utility CONVERT, which can convert some of
  1914.     the Spectrum's own format into each other, and also converts some of
  1915.     the emulator's formats into others.  It is not about converting files
  1916.     from other emulators; read section 2.15 if you want to know about that.
  1917.  
  1918.     CONVERT was useful when the emulator could only communicate with
  1919.     snapshot files and the RS232 link.  It has become less useful now, with
  1920.     .TAP files and the possibility to load and save blocks directly into
  1921.     and from Spectrum memory, but it still has some useful features.
  1922.  
  1923.     It can read three types of input files: pure ASCII, pure bytes (for
  1924.     instance a .SCR screen dump), and files produced by a SAVE *"b"
  1925.     command.
  1926.  
  1927.     Output is pure bytes, ASCII with either CR (Spectrum standard) or CR/LF
  1928.     (PC standard) for line breaks, SAVE *"b" files containing a Basic or
  1929.     code file, a .PCX or a .GIF file.
  1930.  
  1931.     So what can you do? Main uses are adding LF (10 hex) bytes to a text
  1932.     file produced by the Spectrum; converting a code block into a SAVE *"b"
  1933.     to load it into the Spectrum using LOAD *"b" (and the reverse of
  1934.     course: converting a SAVE *"b" file to pure bytes), and converting a
  1935.     screen dump to .PCX or .GIF graphics files.
  1936.  
  1937.     Less useful, but possible: LISTing a program (SAVE *"b" file) to
  1938.     produce readable ASCII, and the reverse: converting an ASCII listing to
  1939.     executable Basic again.
  1940.  
  1941.     If you want to make a .PCX or a .GIF file, input should be a SAVE *"b"
  1942.     file of a screen (length 6921 bytes exactly) or a bare .SCR screendump
  1943.     (length 6912 bytes).  You can make screendumps by selecting the X-Extra
  1944.     functions menu from the main menu.
  1945.  
  1946.  
  1947.  
  1948.  
  1949. 2.17  The utilities Z802TAP, TAP2TAPE and TAP2VOC
  1950.  
  1951.  
  1952.     The SamRam has built in it some snapshot software.  Using this software
  1953.     you can save any 48K Spectrum program to tape or to a .TAP file, as is
  1954.     explained in section 3.2 below.  But the SamRam software cannot handle
  1955.     a 128K program.  The Multiface 128 can also write a snapshot to tape,
  1956.     but in some cases it is still preferrable to use TAP2TAPE, since the
  1957.     latter produces less and shorter blocks, and doesn't corrupt the screen
  1958.     as much as the Multiface code does (on Spectrums without Multiface).
  1959.  
  1960.     The utility that can convert a 128K snapshot (and 48K ones for that
  1961.     matter) to a .TAP file is called Z802TAP.  The .TAP file includes a
  1962.     basic loader, and a loading screen if you want.  Z802TAP compresses the
  1963.     blocks it writes (using a better method than used in compressing .Z80
  1964.     files) to save loading time.  If you don't want it to compress the
  1965.     blocks, for instance when you want to take a look at the ram pages of
  1966.     the Spectrum 128, specify -u when you run Z802TAP.  You can load the
  1967.     converted program simply by executing
  1968.  
  1969.         Z80 -ti tapefile
  1970.  
  1971.     and typing LOAD "" (for a 48K program) or changing the hardware mode to
  1972.     Spectrum 128 and choose 'Tape Loader' in the menu.
  1973.  
  1974.     Of course you could also use Multiface 128 or the SamRam to convert a
  1975.     snapshot to a .TAP file.
  1976.  
  1977.     The program TAP2TAPE writes .TAP files back to tape.  The program
  1978.     consists of a batch file TAP2TAPE.BAT, which executes the TAP2TAPE.Z80
  1979.     file using the emulator.  The .TAP file is written to tape exactly as
  1980.     it is, so that if a block contains a tape error, it won't load
  1981.     correctly from tape either.  If the entire .TAP file has been saved the
  1982.     emulator will start loading from tape.  At that point, press space once
  1983.     to return to DOS.
  1984.  
  1985.     The TAP2VOC program converts the tape block in a .TAP file to the
  1986.     corresponding bips and clicks.  The resulting .VOC file will be rather
  1987.     large.  It can be loaded back into the emulator, which is rather silly
  1988.     since using the original .TAP file is better in all respects, or you
  1989.     can write the program to tape using a sample player.
  1990.  
  1991.  
  1992.  
  1993.  
  1994. 2.18  The utility OUT2VOC - and how to make .OUT files
  1995.  
  1996.  
  1997.     The emulator can log OUTs to any I/O port.  These OUTs are logged in a
  1998.     .OUT file, in which is stored what was written to which port at what
  1999.     time.  These log files are used for recording sounds the emulated
  2000.     Spectrum produces.
  2001.  
  2002.     The OUTs to port FE, which controls the internal beeper, and those to
  2003.     ports BFFD and FFFD, which control the soundchip of the Spectrum 128,
  2004.     are translated into a sample file by OUT2VOC.
  2005.  
  2006.     There are a number of command line switches.  The sample frequency can
  2007.     be chosen by specifying "-f frequency" on the command line.  By default
  2008.     a sampling frequency of 10 kHz is used.
  2009.  
  2010.     Ordinarily the OUT2VOC program filters out all frequencies above half
  2011.     the sampling frequency, so that no aliasing occurs when the signal is
  2012.     stored as a sequence of samples in a .VOC sample file.  For sample
  2013.     files containing tape data, these aliasing effects are not important.
  2014.     For these sample files you can use -d to produce 'digital' sample
  2015.     files, containing only 'high' and 'low' sample values, and nothing in
  2016.     between.  These sample files can be compressed much better.
  2017.  
  2018.     By default, the OUT2VOC program listens to the EAR output only.
  2019.     Specify -m to have it listen to the MIC output (only), and -a to have
  2020.     it listen to the AY-3-8912 soundchip of the Spectrum 128.  If you
  2021.     specify for example -e -a, the program will listen to both
  2022.     corresponding channels.
  2023.  
  2024.     Usually, not all registers of the AY soundchip are updated continually.
  2025.     Some registers are initialised and left at that value.  So it may be
  2026.     necessary to supply the initial values of the soundchip registers.  Do
  2027.     this by specifying '-i file', where 'file' is the snapshot taken just
  2028.     before you started recording the OUTs.
  2029.  
  2030.     Some Spectrum programs use extremely many OUTs to produce sounds.
  2031.     Fairlight for example OUTs about 70000 times a second, thereby indeed
  2032.     producing one of the finest music I've every heard coming out of an
  2033.     ordinary Spectrum.  The OUT2VOC program takes quite some time to
  2034.     compute the .VOC file from the raw .OUT output.  Use -q for a quick
  2035.     and little less precise conversion.  The difference seems to be barely
  2036.     audible.  This switch has no effect when converting AY soundchip music.
  2037.  
  2038.     If you specify -s, silences of longer than 1 second will be truncated
  2039.     to 1 second.
  2040.  
  2041.     Finally, use -r to produce a raw sample file, without any header or
  2042.     length info.
  2043.  
  2044.     To record a sample, go to the Extra Functions menu (F10, X), and select
  2045.     O.  Select the ports you want to log (by default only FE is logged) and
  2046.     enter a name for the log file.  OUTs will be logged until you specify
  2047.     an illegal name, or press ENTER on an empty line here.
  2048.  
  2049.     To save a block of data to a .OUT file, simply type the right SAVE
  2050.     command or use any (turbo-save) program to save it to tape.  Note that
  2051.     .OUT files tend to grow fast; one bit on the tape corresponds to two
  2052.     OUTs and therefore two 5-byte entries in the .OUT file; a 48K file will
  2053.     produce a .OUT file of at least 4 Megabytes.
  2054.  
  2055.     If you give a 16 bit address for an I/O port, only OUTs to this address
  2056.     will be logged.  If you give an address smaller than 100 hex, all
  2057.     addresses whose low byte equal this number are logged.  Note that it
  2058.     is not possible to log all OUTs to, say, an even port.  Although the
  2059.     MIC and EAR ports respond to all even port addresses, virtually no
  2060.     program uses a port different from FE, so this will be no problem in
  2061.     practice.
  2062.  
  2063.     Note that whereas the 'official' addresses of the register and
  2064.     value-port of the AY soundchip are FFFD and BFFD respectively, some
  2065.     programs use other ports that work too.  One particular program uses
  2066.     BEFD, heaven knows why.  For these programs, specify FD (or 00FD) as
  2067.     OUT port to log; this will ensure that all OUTs to any address with low
  2068.     byte FD is logged (which, alas, includes the much-used port 7FFD).
  2069.  
  2070.     A recent discussion on comp.sys.sinclair revealed that the AY
  2071.     conversion of OUT2VOC leaves much to be desired.  It is on my list of
  2072.     things-to-do.
  2073.  
  2074.  
  2075.  
  2076. 2.19  The utilities READVOC and READSB
  2077.  
  2078.  
  2079.     These programs can read samples from the LPT port or the SoundBlaster
  2080.     and store them in .VOC files, for later play-back to the emulator.
  2081.     This is useful when you use the SoundBlaster as input device, as direct
  2082.     loading is not very reliable then because Z80 does not filter its input
  2083.     appropriately; you can store level data of games on hard-disk and load
  2084.     them without having to play the actual tape again; thirdly, this allows
  2085.     you to try to load the program with different emulator settings easily.
  2086.  
  2087.     READVOC uses polling to read the sample.  This method does not allow
  2088.     for very high sample frequencies (even 20 kHz is too much sometimes),
  2089.     and does not work reliably in multi-tasking environments (DOS boxes of
  2090.     Windows (95) for example).  It is however the only way to take samples
  2091.     from the LPT interface, and works well under DOS.
  2092.  
  2093.     READSB has been written for taking samples from the SoundBlaster.  It
  2094.     uses DMA to read the sample, and applies a digital filtering algorithm
  2095.     for reliable loading.  It offers a number of command-line switches.
  2096.     Digital filtering is highly recommended: for programs that use the
  2097.     ordinary tape format, -n is appropriate; for turbo-save formats, use
  2098.     -d.  If neither of -d and -n are used, ordinary analogue sample files
  2099.     are produced, which will very often not load successfully when played
  2100.     back to Z80.  For low sample rates, say 10 kHz, it is a good thing to
  2101.     use two-times oversampling (switch -2).
  2102.  
  2103.     When READSB is started, it displays a signal level bar.  Set the volume
  2104.     so that a reasonable input level is reached; do not increase the volume
  2105.     too much above 50%.  Press any key to start sampling, and then 'p' to
  2106.     pause and display the signal level bar again, or any other key to save
  2107.     the sample and quit.
  2108.  
  2109.     READSB uses 0220 as default base SoundBlaster I/O address, and IRQ 7 as
  2110.     default interrupt level.  Be sure to set these to their appropriate
  2111.     values if your card is not set to these defaults.
  2112.  
  2113.     Both READVOC and READSB produce very large files.  Be sure to have
  2114.     several megabytes of free disk space available.  After sampling, these
  2115.     sample files can be compressed using ordinary compression programs to
  2116.     very small sizes.
  2117.  
  2118.  
  2119.  
  2120. 2.20  Quick overview of command line switches, and features
  2121.  
  2122.  
  2123.     In this section I will briefly explain all command line switches.  It
  2124.     is useful to at least once read this section carefully; there are a few
  2125.     small handy features that will otherwise be readily overlooked. Starred
  2126.     switches are by default put in the Z80.INI file.
  2127.  
  2128.        -h        Hercules graphics
  2129.        -c        CGA graphics
  2130.        -e        EGA graphics
  2131.        -v        VGA graphics
  2132.  
  2133.     Usually the emulator will by itself correctly determine which mode to
  2134.     use.  VGA mode is by far the best: it is the only mode in which all
  2135.     colours are correct (including the bright hues), and it is also the
  2136.     fastest mode.  Versions prior to v3.04 also had Plantronics and Extended
  2137.     Hercules as possible video modes; these are removed to save memory.
  2138.  
  2139.        -xv       400-line VGA (for some Tridents)
  2140.        -xb       Black-and-white VGA
  2141.  
  2142.     The black-and-white switch is useful on black-and-white monitors;
  2143.     sometimes those only display one component of the RGB signal instead of
  2144.     a weighted average, so that some colours become indistinguishable grey
  2145.     tones.
  2146.  
  2147.     Some Trident video adapters, as well as some others, have a bug in
  2148.     their video BIOS: they don't want to be put in 200-line mode.  To get
  2149.     around this, when -xv is specified 400-line mode is used with a double
  2150.     amount of lines.
  2151.  
  2152.        -n        Emulate Spectrum without Interface I
  2153.        -s        Emulate Spectrum with SamRam
  2154.        -1[28]    Emulate Spectrum 128 (can be used with -n)
  2155.        -xk       Emulate Multiface 128 interface  (can't be used with SamRam)
  2156.        -9        Default to M.G.T. interface instead of Interface I
  2157.        -0d       M.G.T. = DISCiPLE ROM (default)
  2158.        -0p       M.G.T. = Plus D
  2159.  
  2160.     These switches select the default start-up hardware configuration of
  2161.     the emulator.  This can all be changed in the Change Hardware menu
  2162.     under function key F9.
  2163.  
  2164.     *  -znnn.n   Emulate the Spectrum at speed nnn.n%
  2165.  
  2166.     The most sensible setting for this is -z100.  By default this is done
  2167.     in the Z80.INI file.
  2168.  
  2169.        -xx       Hi-resolution colour emulation
  2170.  
  2171.     This selects hi-res colour emulation by default, so that border effects
  2172.     and hi-res colour effects are visible.  This setting can be changed in
  2173.     the F4 menu.
  2174.  
  2175.        -r        Emulate the R register
  2176.  
  2177.     This is usually necessary in turbo loaders and otherwise protected
  2178.     programs, since they almost invariably use the R register to decode
  2179.     things.  The R register has to be updated every instruction, so that
  2180.     enabling the emulation of it reduces the emulation speed considerably,
  2181.     by some 30%.  Don't do it unless it proves to be necessary.  I don't
  2182.     know of any program that uses it on the run.  If the R register is not
  2183.     emulated, the R register acts as a random generator.
  2184.  
  2185.     *  -l        Better (but slower) LDIR/LDDR emulation
  2186.  
  2187.     Normally a 8086 MOVSB is used to emulate an LDIR or LDDR.  This is a
  2188.     fast instruction.  Programs that use them a lot, most notably Jetset
  2189.     Willy and Manic Miner, run very fast.  On slow computers these programs
  2190.     are the only ones that are really playable.  On fast computers they run
  2191.     much too fast, so it is a wise thing to use -l on fast computers.
  2192.     Secondly, without -l the LDIR instruction is not emulated correctly
  2193.     when it overwrites itself; with -l it is.
  2194.  
  2195.        -yl, -yh  Low, high video synchronization mode
  2196.  
  2197.     These switches control the phase between the 50 Hz interrupt and the
  2198.     screen refresh.  Some programs need a different setting in order to
  2199.     remove flickering of moving characters.  Enabling hi-resolution colour
  2200.     emulation also eliminates these problems.
  2201.  
  2202.        -2        Emulate an Issue-2 Spectrum
  2203.  
  2204.     Make the EAR line 1 when there's no signal, instead of 0 as it is on
  2205.     Issue 3 Spectrum's.  Some old programs need it (Spinads for example).
  2206.  
  2207.        -dN       Set frame interrupt frequency to 100/N Hz
  2208.  
  2209.     There used to be an option -d which set the frame interrupt frequency
  2210.     to 100 Hz; therefore now -d is equivalent to -d1.  -d2 is the default
  2211.     setting, 50 Hz.  On slow computers, -d helps to get a better keyboard
  2212.     response.  On the other hand, setting for instance -z350 -d7 makes Z80
  2213.     emulate a Spectrum 3.5 times as fast while maintaining normal keyboard
  2214.     response.  At run time, the frame interrupt rate may be toggled between
  2215.     50 Hz and the value set by this switch.  If you set -dN twice, then the
  2216.     emulator starts off with a 50 Hz frame rate, with alternate rate set to
  2217.     100/N Hz.
  2218.  
  2219.        -aN       Redirect Spectrum RS232 output to LPTn
  2220.        -oN       Redirect Spectrum RS232 output to COMn
  2221.        -uF       Redirect file F to Spectrum RS232 input
  2222.        -iN       Redirect COMn to Spectrum RS232 input
  2223.        -wF       Redirect Spectrum RS232 output to file F
  2224.  
  2225.     All output to, and reading from, the Interface I's RS232 channel
  2226.     (channels "b" and "t"), the 128K printer channel (channel "p") will be
  2227.     sent to, respectively read from, the appropriate device.  Furthermore,
  2228.     output to the ZX Printer will be converted in a format suited for Epson
  2229.     matrix printers or HP Laserjet printers and also be sent to the 'RS232
  2230.     output' device or file.
  2231.  
  2232.        -g        No sound
  2233.        -xa       Do NOT use AdLib for 128 sound
  2234.        -xc       Use SoundBlaster CMS chips for noise
  2235.        -xi       Do NOT use internal PC speaker for '128 sound
  2236.  
  2237.     If no AdLib compatible card is detected, 128K sound output will be
  2238.     sent, as far as is possible, to the internal PC speaker.  Use -xa to
  2239.     hear 128K sound through the PC speaker when there is an AdLib card
  2240.     present.
  2241.  
  2242.     Without CMS chips, the 128K soundchip's noise cannot be faithfully
  2243.     reproduced.  If you have CMS chips installed, use -xc to use them.  If
  2244.     the SoundBlaster is on a different base address than 0220, use -xq to
  2245.     select it.
  2246.  
  2247.     *  -km       Use MS Mouse to control Spectrum joystick
  2248.        -ka       Emulate Spectrum AMX mouse interface controlled by MS Mouse
  2249.        -kz       Use digital Zandbergen joystick
  2250.        -kk       Do not look for analogue or Zandbergen joystick
  2251.        -k1       Do not use 2nd analogue joystick as Sinclair 1 (1,2,3,4,5)
  2252.        -k2       Use 2nd joystick as Sinclair 1 always
  2253.  
  2254.     The emulated joystick (Cursor, Kempston, Sinclair 2 or user defined) is
  2255.     controlled by the arrow keys and TAB, 5, INS (0) on the PC keyboard,
  2256.     and optionally also by a digital joystick, and analogue IBM joystick or
  2257.     a mouse.  Use -kk if the emulator erroneously detects either joystick.
  2258.     If -ka is specified, the PC mouse controls the emulated AMX mouse
  2259.     interface.  Because of I/O address clashes, this only works with SamRam
  2260.     and the M.G.T. interfaces disabled.  The AMX mouse is supported by e.g.
  2261.     Art Studio.
  2262.  
  2263.     A second analogue joystick will, when present, always be attached to
  2264.     keys 1 to 5, the Sinclair 1 joystick keys.  If neither -k1 nor -k2 is
  2265.     given, the emulator will look if the second joystick is in an
  2266.     acceptable neutral position (i.e. is attached) and if so will use it.
  2267.     This will usually work.  If it incorrectly recognizes the joystick use
  2268.     -k1.  If it doesn't recognize a joystick while it is connected, use
  2269.     -k2.
  2270.  
  2271.        -jc       Emulate Cursor joystick (default)
  2272.        -jk       Emulate Kempston joystick
  2273.        -j2       Emulate Sinclair joystick 2 (keys 6,7,8,9 and 0)
  2274.        -ju<lf><rt><up><dn><fire>  User defined joystick
  2275.  
  2276.     Also quite clear I think.  For instance, -juipqzm makes the joystick
  2277.     control the i,p,q,z and m keys, for instance to play those lovely
  2278.     Horace games.  Special characters are [ for shift, ] for symbol shift,
  2279.     / for enter and \ for space.
  2280.  
  2281.     *  -xs       Default to shifted cursor keys (NumLock) in '128 mode
  2282.  
  2283.     By default, the PC arrow keys control the cursor keys 5,6,7,8 and 0 of
  2284.     the Spectrum.  The Spectrum 128 had its arrow keys press the cursor
  2285.     keys plus shift, and the menu bar of the reset screen of the '128 only
  2286.     responds to shift+cursor key.
  2287.  
  2288.        -bN       Use LPTn for tape I/O
  2289.        -xo       Use SoundBlaster's A/D Converter for tape input
  2290.        -xq adr   Set base IO address for SoundBlaster (default 0220)
  2291.  
  2292.     Either the LPT tape interface of the SoundBlaster is used for tape
  2293.     input.  Only the LPT tape interface can be used for tape (MIC) output.
  2294.  
  2295.        -tv F     Play .VOC file F to 'ear' input
  2296.        -m N F    Insert cartridge file F{.MDR} into microdrive N
  2297.        -xm D     Select default directory D for .MDR files
  2298.        -td D     Select directory D for Multiple .TAP File mode
  2299.        -ts D     Specify default directory for Single .TAP File mode
  2300.        -ti F     Use F{.TAP} as tape input
  2301.        -to F     Use F{.TAP} as tape output (if exists, append)
  2302.        -tm       Mirror tape input to disk (Do also specify output file!)
  2303.        -te       Mirror tape input to disk in EXACT mode
  2304.        -tw       Don't wrap load pointer of tapefile at end
  2305.        -tp       Pause after loading .TAP block
  2306.  
  2307.     All quite clear I think.  If -tv is used, the VOC file starts playing
  2308.     immediately, so be sure there's an appropriate snapshot running to do
  2309.     something with the signal.  -tw makes the emulator load from physical
  2310.     tape when a .TAP file has been read to the end, instead of starting
  2311.     again from the beginning.  It is used in Tap2Tape.
  2312.  
  2313.        -xl N     Select LPTn for ZX-Printer output
  2314.        -xj       'Off-line=wait' instead of 'Off-line=No ZX Printer'
  2315.        -0e       Epson printer (for ZX PRINTER & M.G.T.)
  2316.        -0h       HP PCL printer (for ZX PRINTER & M.G.T.)
  2317.        -0f N     Issue a Form Feed every N ZX Printer lines when printing
  2318.                  to a HP PCL compatible printer
  2319.  
  2320.     Output to the ZX Printer will be converted into graphic data in Epson
  2321.     (most matrix printers) or HP PCL (most inkjet and laser printers)
  2322.     format.  Use -0e or -0h to select which format to use; default is Epson
  2323.     format (defaulted in Z80.INI).  Also, this selects the default DISCiPLE
  2324.     ROM to be used; the two ROMs have different screen dump routines
  2325.     pre-loaded.  If you're using a Laser printer, use -0f 103 to have Z80
  2326.     eject the page once in a while.  103 lines approximate one sheet A4.
  2327.     Select the LPT port to print the data to with -xl; default is LPT1.
  2328.  
  2329.     If the printer to which ZX Printer output is sent is absent, busy or
  2330.     off-line, the emulator tells the Spectrum program that the ZX Printer
  2331.     is not attached.  If you want the Spectrum program to wait in case of
  2332.     an off-line or busy printer, then put -xj in the Z80.INI file.  This
  2333.     switch is not defaulted because printers sometimes say they're merely
  2334.     busy or off-line when in fact they are not there at all.  Besides, some
  2335.     Spectrum programs do a COPY without asking, and with this switch the
  2336.     program would lock up (as versions 3.00 to 3.02 did; in v3.03 and above
  2337.     you can BREAK into such a loop).
  2338.  
  2339.     If a printer becomes off-line or unavailable during printing, Z80 will
  2340.     try to finish its job anyhow, and the program may appear to hang.
  2341.     Pressing the space bar will make Z80 break the printing loop, and
  2342.     signal to the Spectrum program that the ZX Printer does not exist.
  2343.     This, in turn, will cause the ROM printer routines to just skip
  2344.     printing.  Z80 will periodically check the printer status, and when it
  2345.     becomes available again will make the ZX Printer appear again.
  2346.  
  2347.        -0i       Disable Disciple interrupt
  2348.  
  2349.     Normally the Disciple and Plus D have their own interrupt routine being
  2350.     executed 50 times a second.  Because this involves many page swaps,
  2351.     this is quite slow on the emulator.  Since the interrupt is not really
  2352.     necessary anyway, it is reduced to once every two seconds.  On some
  2353.     computers this may still be too much, in which case -0i completely
  2354.     disables the Disciple and Plus D interrupts.  Do not try this in
  2355.     Unidos!  (which is not emulated [yet].)
  2356.  
  2357.        -0sND     Set Disciple/+D drive N to D:
  2358.  
  2359.     By default, the Disciple/+D drive 1 controls drive A: while 2 controls
  2360.     B:.  If, for example, your B: drive is your only 3.5'' drive, you might
  2361.     want to map both 1 and 2 to B: which is accomplished by putting -0s1b
  2362.     in the Z80.INI file.
  2363.  
  2364.        -xp D     Select default directory D for .Z80 snapshot files
  2365.  
  2366.     Clear.
  2367.  
  2368.        -xz       Assume AZERTY keyboard layout
  2369.  
  2370.     Assumes the Belgian and French AZERTY keyboard layout.
  2371.  
  2372.        -xr F     Use file F as standard Spectrum rom
  2373.  
  2374.     The ROM will be used in 48K modes only, and must be exactly 16K long.
  2375.  
  2376.        -xt       Use as little memory as possible with full functionality
  2377.        -xu       Use as little memory as possible; disable HRC emulation
  2378.  
  2379.     With -xt, all unnecessary buffers used for efficiency purposes only are
  2380.     reduced to minimum size.  Saves 47K, but can make all the difference
  2381.     sometimes.  With -xu, 83K is saved, but Hi Resolution Colour emulation
  2382.     won't work anymore.
  2383.  
  2384.        -tx       Do not display tape info window when loading or saving
  2385.        -00       Do not show intro screen, and don't pause at startup
  2386.  
  2387.     Some people seem to really hate either, or even both.  Don't know why.
  2388.     For better annoyance, -00 only works in the registered version.  Hehe.
  2389.  
  2390.        -xe       Do not use expanded memory
  2391.  
  2392.     Specifying this switch will result in the emulator using 240K more base
  2393.     memory (making a grand total of 564K).  Furthermore, all page swapping
  2394.     will be much slower, so especially the 128K emulation gets verrry slow.
  2395.  
  2396.        -xg       Log all outs to FE in OUT log file
  2397.        -xy       Dump trace of program in .OUT file
  2398.  
  2399.     By default, OUTs to port #FE that do not change the state of either MIC
  2400.     or EAR are not saved to the log file, to save disk space.  If, for some
  2401.     reason, you want all OUTs to be logged, -xg will do the trick.  The -xy
  2402.     option can be used for producing a somewhat crude trace; see section
  2403.     5.10 on the .OUT format for more details.
  2404.  
  2405.        -0m F     Build map of opcode locations in file F
  2406.  
  2407.     When this option is specified, Z80 keeps a map of the 65536 address
  2408.     locations in memory, and tags the address of each instruction that is
  2409.     emulated.  When the emulator is shut down, this map is written to disk
  2410.     as a 8192 byte file.  See section 5.10 of TECHINFO.DOC for an
  2411.     explanation of the file format, and remarks on how to use this feature.
  2412.  
  2413.        -xw       Run in Windows compatibility mode
  2414.  
  2415.     In this mode, the timer is not re-programmed.  The emulator counts T
  2416.     states to see when an interrupt has to be generated (so emulation will
  2417.     be slower).  In a Windows (3.1 or 95) DOS box, using -xw will turn
  2418.     Windows compatibility mode off (as Z80 is aware of Windows and has
  2419.     turned this switch on itself in that case) and the emulator will
  2420.     usually hang.  There is probably never a need to use this switch.
  2421.  
  2422.        -kxABCD   Press key #CD for scancode #AB.
  2423.  
  2424.     This can be used to re-map the keyboard, for instance if your C key is
  2425.     broken, you can re-map it to F11, or any other key for that matter.
  2426.     Combinations are hard-coded, so that a key pressing , also presses <
  2427.     when shifted.  The scan code is between #01 (ESC) and #58 (F12); a full
  2428.     list can be found in many places.  The format of the key byte is
  2429.     explained in section 2.3.
  2430.  
  2431.        -xf       Switch full 16K of Interface I ROM
  2432.  
  2433.     Useless.
  2434.  
  2435.  
  2436.  
  2437.  
  2438. 2.21  Miscellaneous remarks
  2439.  
  2440.  
  2441.     1. Problems at the Rom/Ram boundary
  2442.  
  2443.     There are a few Spectrum programs that have an odd stack pointer, and
  2444.     run over the ram/rom boundary, for instance Deep Strike, and Elite.
  2445.     This crashed version 1.45 of the emulator; the problem was circumvented
  2446.     somewhat in version 2.01, and has been removed in version 3: in most
  2447.     cases, a word read from or written to FFFF will be read or written as
  2448.     two bytes.  You can check this by typing CLEAR 65535: POKE 65535,0:
  2449.     RETURN in BASIC; this will lock up version 1.45 of the emulator, it
  2450.     will lock up version 2.01 if the 80386 is in virtual mode, and it will
  2451.     only crash the emulated Spectrum (as it should) on version 3.
  2452.  
  2453.     The check on FFFF is not done at every potentially problematic op-code,
  2454.     because this would make the emulator noticeably slower.  It is
  2455.     therefore still possible to 'hang' the emulator.  Not going to tell you
  2456.     how, though.  All existing programs seem to work okay now.
  2457.  
  2458.  
  2459.     2. Critical timings
  2460.  
  2461.     A few programs (the only examples known to me are Fireman and Thing,
  2462.     but there are more) are quite sensitive to the relative actual
  2463.     execution speed of emulated Z80 instructions, and crash if it isn't
  2464.     right.  They rely on this-or-that amount of instructions to be executed
  2465.     between interrupts.  If you slow down the emulator, these program will
  2466.     run fine, because then individual instructions are more carefully
  2467.     timed.  When running in Windows compatibility mode, loading .VOC files
  2468.     or when the Hi-Res Colour emulation is switched on, these problems
  2469.     disappear completely as the emulator is then counting off the exact
  2470.     number of T states to elapse between interrupts.
  2471.  
  2472.  
  2473.     3. Shifted cursor keys
  2474.  
  2475.     It may be annoying to have to press Num-Lock every time you use the
  2476.     Spectrum 128 (because otherwise you'll have to use Shift with the
  2477.     cursor keys to move the menu bar).  To make the emulator press shift by
  2478.     default every time you use the PC cursor keys in '128 mode, use the
  2479.     switch -xs. If you press Num-Lock now (in '128 mode), the shift-key
  2480.     won't be pressed.  The 48K modes are not affected by this switch.
  2481.  
  2482.  
  2483.     4. Running non-standard ROMs
  2484.  
  2485.     To run the emulator with a different rom than the standard one, you can
  2486.     specify a rom image file on the command line.  Use the switch -xr file,
  2487.     where 'file' is the name of the image file.  This file should be
  2488.     exactly 16384 bytes long.  It will of course not be used in Spectrum
  2489.     128 or SamRam mode.
  2490.  
  2491.     The emulator 'ZX' by Rindt and Bruckner comes with several roms, stored
  2492.     in their tape format.  You can convert these files to .TAP files, and
  2493.     then load them in the normal way (in RAM), and then save the 16K image
  2494.     from RAM directly.  You can also extract it from the files directly by
  2495.     using the DOS debug utility:
  2496.  
  2497.         C:\>debug rom.000       (or other rom file (of 16406 bytes))
  2498.         -m 115 L 4000,100       (move the rom down, overwrite header)
  2499.         -rcx                    (new length of exactly 16K bytes)
  2500.         CX 4016
  2501.         4000
  2502.         -n rom000.bin           (or some other name)
  2503.         -w                      (write it)
  2504.         Writing 04000 bytes
  2505.         -q                      (and quit)
  2506.  
  2507.  
  2508.     5. Printing with DISCiPLE and Plus D
  2509.  
  2510.     If, emulating a DISCiPLE/+D and by entering POKE @11,0 the parallel
  2511.     printer output has been selected, going back to a hardware mode without
  2512.     M.G.T. interface causes problems with printing to the ZX Printer, since
  2513.     the output addresses of the "p" channel have been changed by the M.G.T.
  2514.     ROM.  Use the "b" channel of the Interface I instead.  You can reset
  2515.     the channel to the ZX Printer by entering POKE @11,1 while still
  2516.     emulating the M.G.T. interface.  Note however that the printer OUT port
  2517.     #FB of the ZX Printer is used by the Disciple printer interface, so
  2518.     that using the ordinary ZX Printer code of the ROM results in rubbish
  2519.     coming out of the printer.  The +D can use the Centronics interface and
  2520.     the old ZX Printer at the same time.
  2521.  
  2522.     Although by default channel #3 prints to the ZX Printer, in all
  2523.     hardware modes, if a DISCiPLE/+D is emulated output to the ZX Printer
  2524.     is ignored, as these interfaces use the ZX Printer I/O ports for their
  2525.     own purposes.
  2526.  
  2527.  
  2528.     6. Breakpoints
  2529.  
  2530.     A Breakpoint may be set in the Extra Functions menu, option B.  If it
  2531.     is set, the emulator will at the beginning of each instruction check
  2532.     whether the program counter is equal to the breakpoint address.  If
  2533.     this is the case, it notifies the user, and continues to the main menu.
  2534.     You could now save the snapshot and inspect register values using
  2535.     Z80Dump, for example.  You could change hardware mode to SamRam, and
  2536.     generate an NMI from the menu (using Extra Functions, N) to inspect the
  2537.     code around the breakpoint.
  2538.  
  2539.     Some fine points.  If a breakpoint is hit, the instruction at the
  2540.     breakpoint address is not yet executed.  It will be upon returning.  If
  2541.     you generate an NMI, and subsequently return from it, the first
  2542.     instruction that will be executed after the NMI is the instruction at
  2543.     the breakpoint; this will thus make the emulator go to the main menu
  2544.     once again.  Press ESC to continue emulating.
  2545.  
  2546.     For technical reasons, when counting T states, the time taken by the
  2547.     instruction directly preceding (in execution) the one at the breakpoint
  2548.     address is not taken into account.  When the emulator hits a
  2549.     breakpoint, the current frame will be a few T states longer.  Not that
  2550.     you'll notice, probably.  The R register is counted through properly
  2551.     (if it's emulated, that is.)
  2552.  
  2553.     If the breakpoint address happens to point to an operand instead of an
  2554.     opcode, the emulator will not respond.
  2555.  
  2556.  
  2557.     7.  Emulation of floating bus
  2558.  
  2559.     Reading from e.g. port #FE accesses the ULA bus which is used to read
  2560.     the screen memory.  While the ULA is generating the border or
  2561.     horizontal or vertical retrace signals, this will result in #FF;
  2562.     otherwise, the value returned is the ATTR or screen byte the ULA is
  2563.     currently reading.  Some programs use this to check whether the ULA is
  2564.     in vertical retrace (Arkanoid), some use it to actually wait for
  2565.     specific bytes to pass, which signals that a certain part of the screen
  2566.     is being generated (Ricochet).  Only in Hi Res Color mode will the
  2567.     emulation of this effect be reasonably accurate to get Ricochet running
  2568.     correctly.  Arkanoid runs reasonably well, but due to the way it is
  2569.     implemented it produces 'ticks' in the speaker when it is not run in
  2570.     HRC mode.
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577. 3.  THE SAMRAM
  2578.  
  2579.  
  2580.  
  2581.  
  2582. 3.1  Basic extensions
  2583.  
  2584.  
  2585.     The SamRam is a hardware device Johan and I built for our Spectrums. It
  2586.     consists of a 32K static RAM chip which contains a modified copy of the
  2587.     normal Basic ROM and a number of other useful routines, like a monitor
  2588.     and snapshot software.  You can compare it to a Multiface I interface,
  2589.     but it's more versatile.  Another useful feature was a simple hardware
  2590.     switch which allowed use of the shadow 32K Ram, present at 8000-FFFF in
  2591.     most Spectrums, but hardly ever actually used.
  2592.  
  2593.     For more details on the low-level hardware features of the SamRam read
  2594.     chapter 5.  In this chapter I'll explain the software features of the
  2595.     SamRam software, somewhat bombastically called the 'SamRam 32 Software
  2596.     System' or the 'Sam Operating System'.  By the way, all similarity
  2597.     between existing computers is in fact purely coincidental and has in no
  2598.     way been intended.  Really!
  2599.  
  2600.     The SamRam offers a few new Basic commands, and a lot of useful
  2601.     routines that are activated by an NMI, i.e.  by pressing F5.  First
  2602.     I'll discuss the Basic extension.
  2603.  
  2604.     Select the SamRam by starting the emulator with the -s switch, or by
  2605.     selecting it from the F9 menu.  Normal Basic functions as usual; the
  2606.     character set is different from the original one.  There are four new
  2607.     commands: *RS, *MOVE, *SAVE and *SPECTRUM, and two new functions, DEC
  2608.     and HEX, which have replaced ASN and ACS.  DEC takes a string argument
  2609.     containing a hexadecimal number, and returns the decimal value of it.
  2610.     HEX is the inverse of the DEC function, and yields a four-character
  2611.     string.
  2612.  
  2613.     *RS sends its arguments directly to the RS232 channel.  You don't have
  2614.     to open a "b" or "t" channel first.  You're right, it's of limited use.
  2615.     Example: *RS 13,10
  2616.  
  2617.     *MOVE is useful: it moves a block of memory to another place.  Example:
  2618.     *MOVE 50000,16384,6912 moves a screen-sized block from 50000 to the
  2619.     start of the screen memory.
  2620.  
  2621.     *SAVE works like *MOVE, except that it activates the shadow SamRam ROM
  2622.     before moving.  I used this command to update the shadow ROM, but on
  2623.     the emulator you can use it to move the shadow ROM to a convenient
  2624.     place in Ram where you can take a look at it, for instance by executing
  2625.     *SAVE 0,32768,16384.
  2626.  
  2627.     *SPECTRUM resets the SamRam Spectrum to a normal one.  You lose all
  2628.     data in memory.  By resetting the emulator by pressing ALT-F5, the
  2629.     SamRam is activated again.  Not very useful either.
  2630.  
  2631.     Then there's the Ramdisk, which is, like the Spectrum 128 ramdisk,
  2632.     accessed via the SAVE!, LOAD!, CAT!, ERASE! and FORMAT!.  The syntax is
  2633.     straightforward.  FORMAT! and CAT! need no parameters; ERASE! only
  2634.     needs a name.  If a file is not found, the SamRam will respond with a
  2635.     5-End of File error.  The Ramdisk has a capacity of 25K.
  2636.  
  2637.  
  2638.  
  2639.  
  2640. 3.2  The NMI software
  2641.  
  2642.  
  2643.     Select the SamRam (F9-3), and press F5.  A menu with eight icons pops
  2644.     up.  You can select each icon by moving the arrow to it (using the
  2645.     cursor keys or the Kempston joystick), and pressing '0' or fire.  The
  2646.     icons can also be selected by pressing the appropriate letter key.
  2647.  
  2648.     The eight icons are two arrows with N and E within them, a magnifying
  2649.     glass with the letters 'mc' in it (activated by pressing D), two
  2650.     screens (identified by 1 and 2), a printer (P), a cassette (S) and a
  2651.     box saying 'overig'.  The 'D' activates the monitor or disassembler;
  2652.     read section 3.3 for information on this program.
  2653.  
  2654.     Pressing N or E returns you to the Spectrum.  If you pressed N, the
  2655.     normal Spectrum rom will be selected when the NMI software returns; if
  2656.     you press E, the Rom with the Basic extensions will be selected.  Some
  2657.     games may crash if they see a different rom than the standard Spectrum
  2658.     one.
  2659.  
  2660.     Pressing 1 selects the tiny screen editor.  You can move a '+' shaped
  2661.     cursor about the screen using the cursor keys.  The following commands
  2662.     are available:
  2663.  
  2664.         H: Get the current ATTR colour from the screen at the cursor's
  2665.            current position, and store it in memory.  This colour will be
  2666.            used by the next command:
  2667.         Z: Put the colour on the screen
  2668.         G: Get a character from the screen
  2669.         P: Put the character on the screen
  2670.         R: Remove all screen data that is invisible by the ATTR colour
  2671.         L: Take a look at the bitmap below the ATTR colour codes
  2672.         T: Return to the main menu.  You can also return by pressing
  2673.            EDIT, or ESC in the emulator.
  2674.         B: Change border colour
  2675.         V: Clear the whole screen
  2676.  
  2677.     If you press 0, you can edit the current 8x8 character block at pixel
  2678.     level.  Again you control the cursor with the cursor keys.  Now 0
  2679.     toggles a pixel.  In this mode there are two commands: C clears the
  2680.     whole block, and I inverts it.  Pressing EDIT (ESC) returns you to the
  2681.     big screen again.
  2682.  
  2683.     The SamRam has two screen buffers.  Buffer 1 is used to hold the screen
  2684.     which was visible when you pressed NMI, to be able to restore it when
  2685.     returning.  This is the screen you edit with '1'.  The second screen
  2686.     buffer can be used to hold a screen for some time; it is not touched by
  2687.     the NMI software directly, and will not even be destroyed by a Reset.
  2688.     If you press '2', a menu appears with four Dutch entries:
  2689.  
  2690.         1: Scherm 1 opslaan        (Store screen 1 into buffer 2)
  2691.         2: Scherm 2 veranderen     (Edit screen 2)
  2692.         3: Schermen verwisselen    (Swap screens)
  2693.         4: Scherm 2 weghalen       (Remove screen 2)
  2694.  
  2695.     These four functions are rather obvious, I believe.
  2696.  
  2697.     Pressing 'P' pops up the printer menu.  The screendump program is
  2698.     written specifically for my printer, a Star SG-10.  It will probably
  2699.     work on some other printers, but not on most.  The output is sent to
  2700.     the RS232 channel, so you have to redirect it to an LPT output.
  2701.  
  2702.     Skipping the most interesting, 'S', for a moment, let's first discuss
  2703.     the final menu, 'O' for 'Overig', Dutch for miscellaneous.  There are
  2704.     five menu options, of which three are not useful.  The first gives a
  2705.     directory of the cartridge currently in Microdrive 1.  The last, 'E',
  2706.     returns you to Basic if this is anywhere possible: it resets some
  2707.     crucial system variables and generates a Break into Program.  You can
  2708.     use this for instance to break in a BEEP, or crack a not-so-very-well-
  2709.     protected program.  The three other options select normal or speed-
  2710.     save, and store the current setting in CMOS Ram.  Speed-save won't work
  2711.     properly on the emulator, because the speed-save routine toggles the
  2712.     upper 32K ram bank regularly, and this takes too much time on the
  2713.     emulator.  The setting is not important if you use the internal save
  2714.     routine (which will be used by default, unless you select Real Mode).
  2715.  
  2716.     Finally, the 'S' option.  This option allows you to save a snapshot to
  2717.     tape or microdrive.  I used it a lot on my real Spectrum, and it works
  2718.     just as well on the emulator.  It is very useful is you want to load a
  2719.     .Z80 program back into a real Spectrum again.  There are three
  2720.     'switches' you can toggle.  The active choice is indicated by a bright
  2721.     green box, inactive boxes are non-bright.  You have to use EGA or VGA
  2722.     to be able to see it...  The first switch lets you select whether the
  2723.     SamRam rom should be active if the program loads or not.  This is only
  2724.     meaningful is you load it back in a SamRam again.  Usually I want the
  2725.     SamRam rom to be active because I like the character set better.  The
  2726.     second switch indicates whether the SamRam should save a 'loading
  2727.     screen', which it takes from screen buffer 2.  If screen buffer 2
  2728.     contains a screen, this switch will by default be on.  Finally, the
  2729.     last switch lets you select the output media, tape or cartridge.
  2730.  
  2731.     If the program is loaded back into the SamRam, the only bytes that have
  2732.     been corrupted are four bytes down on the stack; this will virtually
  2733.     never be any problem.  If the program is loaded back to a normal
  2734.     Spectrum, these four bytes will also be corrupted, and the bottom two
  2735.     pixel lines of the screen will be filled with data.  (This is
  2736.     considerably less than any other snapshotter I've seen: for instance
  2737.     the Multiface I uses more than 35% of the screen!)
  2738.  
  2739.     The Microdrive BASIC loader needs code in the SamRam rom to start the
  2740.     program (the RANDOMIZE USR 43 calls it).  It won't be very difficult to
  2741.     write a standard BASIC loader that doesn't need this code, but I don't
  2742.     think many people desperately need it...  Anyway, using the Multiface
  2743.     128 you can write a compressed snapshot to cartridge which doesn't need
  2744.     the Multiface.
  2745.  
  2746.  
  2747.  
  2748.  
  2749. 3.3  The built-in monitor
  2750.  
  2751.  
  2752.     This is a really very convenient part of the emulator, and I use it a
  2753.     lot.  It is very MONS-like in its commands and visual appearance.  It
  2754.     cannot single-step however, but on the positive side it has some
  2755.     features MONS hasn't.  It is a part of the SamRam, and cannot therefore
  2756.     be used with Spectrum 128 programs.  If you want to take a look at a
  2757.     Spectrum 128 program, press F10, then change the hardware to SamRam
  2758.     without resetting, and finally generate an NMI in the Extra Functions
  2759.     menu.  You won't probably be able to continue to run the program, but
  2760.     at least you're able to see what it was doing.
  2761.  
  2762.     Press F5 for NMI, and D to enter the monitor/disassembler.  The first
  2763.     eight lines are the first eight instructions, starting at the Memory
  2764.     Pointer, from here on abbreviated by MP.  At first, MP is zero.  The
  2765.     disassembler knows all official instructions, and the SLL instruction.
  2766.     If another inofficial instruction (i.e.  starting with DD, FD or ED) is
  2767.     encountered, the first byte is displayed on a blank line.  The four
  2768.     lines below these display the value of PC and SP, the first nine words
  2769.     on the stack (including AF and the program counter, which have been
  2770.     pushed during NMI), and three MP-memories.  These can be used for
  2771.     temporary storage of the MP, for instance when you take a look at the
  2772.     body of a CALL, and want to return to the main procedure later.
  2773.  
  2774.     The bottom part of the screen displays 24 bytes around the memory
  2775.     pointer.
  2776.  
  2777.     Commands are one letter long; no ENTER needs to be given.  If one or
  2778.     more operands are needed, a colon will appear.  By default the monitor
  2779.     accepts hexadecimal input.  A leading $ denotes that the number is to
  2780.     be regarded as decimal.  If you give the # command, the default will
  2781.     toggle to decimal, and you need to explicitly put a # in front of a
  2782.     number which is to be interpreted as a hex number.  Also, after the #
  2783.     command all addresses on screen will be decimal.  A single character
  2784.     preceded by the " symbol evaluates to its ASCII code, and the single
  2785.     character M will evaluate to the current value of the memory pointer.
  2786.  
  2787.     The monitor commands:
  2788.  
  2789.         Q: Decrease the memory pointer by one.  You effectively shift one
  2790.            byte up.
  2791.         A: Increase the memory pointer, shifting one byte down.
  2792.         ENTER: Shift one instruction down: the memory pointer is
  2793.            increased by the length of first instruction displayed on
  2794.            screen.
  2795.         M: Change the value of the memory pointer.  For instance, M:M
  2796.            won't change it.
  2797.         P: Put.  The word operand supplied will be stored in the first MP
  2798.            memory, and the others will shift on place to the right.
  2799.            Usually, you'll want to store the memory pointer by P:M
  2800.         G: Get.  Typing G:1, G:2 or G:3 moves the value of one of the MP
  2801.            memories to the MP.
  2802.         B: Byte.  This command needs a byte operand; it will be poked
  2803.            into memory, and the memory pointer will move one up.
  2804.         I: Insert.  The same as B, except that you can poke more than one
  2805.            byte.  It continues to ask for bytes to poke until you type
  2806.            Enter on a blank line.
  2807.         #: Toggles the default number base between hexadecimal and
  2808.            decimal.
  2809.         F: Find.  You can enter up to ten bytes, which will be searched
  2810.            through memory.  Searching will stop at address 0, because
  2811.            since the search string is stored in shadow Ram, searching
  2812.            would otherwise not always terminate.  Typing Enter on a blank
  2813.            line starts the search.  Byte operands are entered as usual,
  2814.            but:
  2815.            - If a number bigger than 256 decimal is entered, it is
  2816.              treated as a word in the standard LSB/MSB format.  So, 1234
  2817.              will search for 34,12 hex in that order.  Note that 0012
  2818.              will search for 12, not 12,00.
  2819.            - A line starting with " decodes into the string of characters
  2820.              (up to ten) behind it.  Normally this would only be the
  2821.              first character.  So instead of typing "M "Y "N "A "M "E
  2822.              (space=enter here) you type "MYNAME.  Note that any
  2823.              terminating " will also be searched for!
  2824.            - An x is treated as a wildcard.  So if you search for CD x 80
  2825.              any call to a subroutine in the block 8000-80FF is a hit.
  2826.              If you search for x 8000, you'll see every one-byte
  2827.              instruction that has the address 8000 as operand.
  2828.         N: Continues the search started by F from the current MP.
  2829.         $: Displays one page of disassembly on screen.  In this mode,
  2830.            the following commands are possible:
  2831.            $: Back to the main screen
  2832.            7: [Shift 7 also works, cursor up]: Go to the previous page.
  2833.               The monitor stores the addresses of the previous eight
  2834.               pages only.
  2835.            Q: Go back one byte (decrease MP by one)
  2836.            A: Go one byte forward (increase MP by one)
  2837.            Z: Dump this screen to the printer, in ASCII format.  Redirect
  2838.               the RS232 output to a file, and run CONVERT on it to convert
  2839.               the CR's into CR/LF's before printing (or tell your printer
  2840.               to do the conversion).
  2841.            Every other key displays the next page of disassembly.
  2842.         K: List.  The same mode as with $ is entered, but instead of a
  2843.            disassembly the bytes with their ASCII characters are
  2844.            displayed.  Useful to look for text.
  2845.         C: Clear.  Fills blocks of memory with a specified value.  The
  2846.            monitor prompts with 'First', 'Last' and 'With'.  The 'Last'
  2847.            address is inclusive!
  2848.         D: Dump.  Prompts with 'First' and 'Last', and dumps a
  2849.            disassembly of the block between these addresses to the
  2850.            printer.  See remark at $-Z.  The 'Last' address is again
  2851.            inclusive.
  2852.         R: Registers.  If you press Enter after R, an overview of the
  2853.            registers contents is displayed.  If you type one of A,B,C,D,
  2854.            E,H,L,A',B',C',D',E',H',L',I,R,AF,BC,DE,HL,AF',BC',DE',HL',
  2855.            IX,IY,SP or PC, you can change the value of it.  Changing the
  2856.            value of SP also changes the PC and AF values by the way.  You
  2857.            cannot change the Interrupt mode or IFF.
  2858.         V: Verplaats.  (Move).  Prompts with 'From', 'To' and 'Length'.
  2859.            Obvious.
  2860.         S: Save.  Enter the start of the block you wish to save first.
  2861.            The monitor then prompts with 'Length'.  The block is saved
  2862.            without a header, as a normal data block (A, the flagbyte, is
  2863.            0FF)
  2864.         L: Load.  Loads a block of data from tape, at the specified
  2865.            address.  Normal data blocks, headers and blocks with non-
  2866.            standard flag bytes can be loaded.  The first byte in memory
  2867.            will contain the flag byte.  If the checksum isn't 0 after
  2868.            loading, indicating a tape error, you'll hear a beep.
  2869.         H: Header read.  Loads headers and displays the contents on
  2870.            screen.
  2871.  
  2872.  
  2873.     As you're reading this part, I assume you know something of machine
  2874.     code.  Probably you would be interested in peeking into the software of
  2875.     the SamRam, the Interface I, the Spectrum 128, the Disciple or the
  2876.     Multiface 128.  You'll first have to move these roms in ram to be able
  2877.     to look at them with the monitor.
  2878.  
  2879.     The Interface I rom can be moved into ram by saving it to microdrive or
  2880.     to the "b" channel, with SAVE *"m";1;"rom" CODE 0,8192 or SAVE *"b"
  2881.     CODE 0,8192, and loading it back again at 32768 for instance.  You can
  2882.     also put this small machine code routine at 23296 and run it: F3 21 0C
  2883.     5B E5 21 00 00 E5 C3 08 00 21 00 00 11 00 80 01 00 20 ED B0 FB C3 00
  2884.     07.  You ought to be able to disassemble this piece by heart.
  2885.  
  2886.     The two SamRam roms are easy.  The first you don't need to transfer;
  2887.     the monitor looks at the extended basic rom by default.  The second rom
  2888.     can be moved to 32768 by typing *SAVE 0,32768,16384.  (The SAVE is not
  2889.     the keyword SAVE!)
  2890.  
  2891.     The first '128 rom, the one which is active at reset and contains most
  2892.     of the new code, is moved up by typing SAVE!"rom"CODE 0,16384, then
  2893.     LOAD!"rom"CODE 32768.  The other rom is most conveniently moved by
  2894.     saving it to a .TAP file and loading it back again in ram.  To select
  2895.     the SamRam type SPECTRUM first, and then switch the hardware without
  2896.     resetting.
  2897.  
  2898.     The Disciple and Plus D roms can be transferred to RAM by simply saving
  2899.     them to disk and loading them back at say 32768.
  2900.  
  2901.     The Multiface ROM is paged by an IN from 191, and paged out again by
  2902.     INning from address 63.  Don't forget to disable interrupts in between,
  2903.     I'm not sure whether the M128 has a well-behaved interrupt routine.
  2904.     ROM is from 0-8191, RAM on top of that.
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911. 4.  THE SPECTRUM
  2912.  
  2913.  
  2914.  
  2915.  
  2916. 4.1  The Spectrum
  2917.  
  2918.  
  2919.     This emulator supports the Interface I, the Multiface 128, the DISCiPLE
  2920.     and Plus D interfaces, and the Spectrum 128.  Many Spectrum users will
  2921.     have no experience with them, so some comments may be useful.  On the
  2922.     other hand, I don't think this is the right place to describe the
  2923.     Spectrum Basic in full detail.  If you want to know it all, read the
  2924.     official manuals!  Information on the Multiface 128 can be found in
  2925.     section 2.12.
  2926.  
  2927.     If you want to use Spectrum Basic, you will need the keywords.  You
  2928.     could by the way now also use the Spectrum 128 Basic where you can type
  2929.     the keywords in by full.
  2930.  
  2931.     If you press ALT-F1 in the emulator, the Spectrum keyboard layout will
  2932.     appear.  For completeness I include an alphabetical list of all
  2933.     keywords and their key-combination.  In the list below, K stands for
  2934.     Keyword mode, E for E-mode (type Shift-Alt of Shift-Ctrl to select
  2935.     E-mode), S for Symbol Shift, and SE for Symbol Shifted (Alt/Ctrl)
  2936.     E-mode: select E mode and type the letter while depressing Symbol
  2937.     Shift.
  2938.  
  2939.  
  2940.         Keyw.    Code | Keyw.    Code | Keyw.    Code | Keyw.    Code
  2941.  
  2942.         ABS      E g    DRAW     K w    MERGE    SE t   SAVE     K s
  2943.         ACS      SE w   ERASE    SE 7   MOVE     SE 6   SCREEN$  SE k
  2944.         AND      S y    EXP      E x    NEW      K a    SGN      E f
  2945.         ASN      SE q   FLASH    SE v   NEXT     K n    SIN      E q
  2946.         AT       S i    FN       SE 2   NOT      S s    SQR      E h
  2947.         ATN      SE e   FOR      K f    OPEN #   SE 4   STEP     S d
  2948.         ATTR     SE l   FORMAT   SE 0   OR       S u    STOP     S a
  2949.         BEEP     SE z   GO SUB   K h    OUT      SE o   STR$     E y
  2950.         BIN      E b    GO TO    K g    OVER     SE n   TAB      E p
  2951.         BORDER   K b    IF       K u    PAPER    SE c   TAN      E e
  2952.         BRIGHT   SE b   IN       SE i   PAUSE    K m    THEN     S g
  2953.         CAT      SE 9   INK      SE x   PEEK     E o    TO       S f
  2954.         CHR$     E u    INKEY$   E n    PI       E m    USR      E l
  2955.         CIRCLE   SE h   INPUT    K i    PLOT     K q    VAL      E j
  2956.         CLEAR    K x    INT      E r    POINT    SE 8   VAL$     SE j
  2957.         CLOSE #  SE 5   INVERSE  SE m   POKE     K o    VERIFY   SE r
  2958.         CLS      K v    LEN      E k    PRINT    K p    <=       S q
  2959.         CODE     E i    LET      K l    RANDOMIZE K t   >=       S e
  2960.         CONTINUE K c    LIST     K k    READ     E a    <>       S w
  2961.         COPY     K z    LINE     SE 3   REM      K e
  2962.         COS      E w    LLIST    E v    RESTORE  E s    DEC      SE q
  2963.         DATA     E d    LN       E z    RETURN   K y    HEX      SE w
  2964.         DEF FN   SE 1   LOAD     K j    RND      E t
  2965.         DIM      K d    LPRINT   E c    RUN      K r
  2966.  
  2967.  
  2968.         Character  Spectrum kbrd   On PC keyboard
  2969.  
  2970.         &          S 6             ALT (or CTRL) 6
  2971.         '          S 7             ALT 7 or '/"
  2972.         (          S 8             ALT 8
  2973.         )          S 9             ALT 9
  2974.         _          S 0             ALT 0 or SHFT _/-
  2975.         <          S r             ALT r or SHFT </,
  2976.         >          S t             ALT t or SHFT >/,
  2977.         ;          S o             ALT o or :/;
  2978.         "          S p             ALT p or SHFT "/'
  2979.         ^          S h             ALT h
  2980.         -          S j             ALT j or _/-
  2981.         +          S k             ALT k or SHFT +/= or GREY +
  2982.         =          S l             ALT l or +/=
  2983.         :          S z             ALT z or SFHT :/;
  2984.         ?          S c             ALT c or SHFT ?//
  2985.         /          S v             ALT v or ?//
  2986.         *          S b             ALT b or GREY PRTSC/*
  2987.         ,          S n             ALT n or </,
  2988.         .          S m             ALT m or >/.
  2989.  
  2990.  
  2991.  
  2992.  
  2993. 4.2  The Interface I
  2994.  
  2995.  
  2996.     If you want to use the microdrive, you'll need cartridge files.  The
  2997.     emulator can create an empty cartridge file for you.  You have to
  2998.     format it before you can use it.  Type
  2999.  
  3000.         FORMAT "m";1;"name"
  3001.  
  3002.     to format the cartridge currently in Microdrive 1 giving it the name
  3003.     'name'.  Next, type CAT 1 to get a catalogue of the files on it (none
  3004.     of course) and the number of kilobytes free.  You can save a file by
  3005.     typing for instance
  3006.  
  3007.         SAVE *"m";1;"screen"SCREEN$
  3008.  
  3009.     Instead of SCREEN$ you can use all other expressions that are permitted
  3010.     also when saving to tape, like LINE nnnn or CODE x,y etcetera.  To load
  3011.     a file back from cartridge, you type (you guessed it)
  3012.  
  3013.         LOAD *"m";1;"screen"SCREEN$
  3014.  
  3015.     If the file doesn't exist or is of the wrong type you'll get the
  3016.     appropriate error message.  To erase a file, type for instance
  3017.  
  3018.         ERASE "m";1;"screen"
  3019.  
  3020.     Note that no * is needed (or even permitted), and that only the name
  3021.     should be given.  There's another way to create a file on a cartridge,
  3022.     and that is by using a command like OPEN #3;"m";1;"name", and printing
  3023.     to that stream.  You can use MOVE to move data from stream to stream,
  3024.     but I'll not go into that --- it's not very much used anyway.
  3025.  
  3026.     Instead of to the microdrive, you can also 'save to the RS232 link'.
  3027.     For instance, type SAVE *"b"SCREEN$ (note: there's no name!) to save a
  3028.     screen.  On the emulator you can send the output to the RS232 channel
  3029.     to a printer (then SAVE *"b" is useless), to a file (can be useful) or
  3030.     to the COM port (very useful if you connect a real Spectrum to the PC's
  3031.     COM port!).  You can load the data back by typing LOAD *"b"SCREEN$ and
  3032.     making sure the RS232 channel is fed with the right input (from a COM
  3033.     port or a file).  See also section 2.13.
  3034.  
  3035.     If you want to use the RS232 channel for printing, open stream 3 for
  3036.     output to that channel by typing
  3037.  
  3038.         OPEN #3,"b"
  3039.  
  3040.     or
  3041.  
  3042.         OPEN #3,"t"
  3043.  
  3044.     The first will simply copy everything you send to stream 3 (using for
  3045.     instance LPRINT or LLIST) to the RS232 channel; the second converts
  3046.     CR's into CR/LF's, breaks off lines at 80 characters and translates
  3047.     keywords into character sequences.  "t" is useful for LLISTings, but
  3048.     not for anything else.
  3049.  
  3050.     Useful extra commands: CLS #, to clear the screen and reset the
  3051.     attributes to their reset defaults, and CLEAR # to do a CLS # and close
  3052.     all currently open streams (discarding all data that may still be
  3053.     buffered!)
  3054.  
  3055.     The Interface I uses its own system variables.  At the first error
  3056.     message you make (or RASP, or flashing question mark) and at the first
  3057.     Interface I statement you execute, it inserts them automatically.  Some
  3058.     programs will not run when the Interface I has inserted its system
  3059.     variables.  So if you load a game from tape, reset the Spectrum first
  3060.     and don't make an error typing LOAD "".  With a bit of exercise you
  3061.     should be able to do this.
  3062.  
  3063.  
  3064.  
  3065.  
  3066. 4.3  The DISCiPLE and Plus D Interfaces - Introduction
  3067.  
  3068.  
  3069.     The DISCiPLE and Plus D were two disk interfaces for the spectrum
  3070.     designed by M.G.T. (Miles Gordon Technology).  The first of these
  3071.     interfaces was the DISCiPLE, this interface consisted of a disk
  3072.     interface, microdrive network compatible interface, parallel printer
  3073.     interface, 2 joystick ports (emulating kempston, cursor, and Sinclair 1
  3074.     and 2).  The unit also had an inhibit button which disabled the
  3075.     interface hardware (except the joystick ports), and finally a snapshot
  3076.     button which when pressed stopped the computer to allow the program to
  3077.     be saved to disk or the screen to be printed.  This was made by
  3078.     Rockfort.
  3079.  
  3080.     The Plus D was the second of the interfaces, this was a cut-down
  3081.     version of the DISCiPLE, this interface only had a disk interface,
  3082.     parallel printer interface and a snapshot button.
  3083.  
  3084.     Both interfaces had a D.O.S. (Disk Operating System) which was partly
  3085.     ROM (8K) and partly RAM (8K).  When the spectrum was turned on, the ROM
  3086.     part of the D.O.S. was in control and whenever the command RUN was
  3087.     issued the ROM tries to load up the RAM part of the D.O.S. from floppy
  3088.     disk.  The advantage of this is that the D.O.S. can be upgraded without
  3089.     having to change chips over (unless of course it was a major upgrade!).
  3090.     Another advantage was that D.O.S. extensions could be incorporated or
  3091.     replace other systems (see later).
  3092.  
  3093.     With both interfaces, they extended the BASIC commands, but unlike the
  3094.     microdrives and several other types of drives available, the DISCiPLE
  3095.     and Plus D took up none of the spectrum's RAM, therefore it was the
  3096.     most invisible of the disk systems available, not only that, but the
  3097.     DISCiPLE and Plus D used the same type of disk drives as the BBC micro,
  3098.     therefore disk drives were both cheap and widely available, also the
  3099.     disks themselves were also standard, ie 5.25" (800K DS/DD), then later
  3100.     3.5" (800K DS/DD).
  3101.  
  3102.     The ROM of the DISCiPLE is supplied with the emulator, together with
  3103.     two version of the D.O.S. pre-loaded in RAM.  The ROM of the Plus D
  3104.     interface is not supplied, for copyright reasons.  The emulator will
  3105.     only emulate a Plus D interface if it can find a file PLUSDROM.BIN in
  3106.     the emulator's own directory.  If you have a Plus D yourself, you can
  3107.     transfer the ROM in the following way.  Load the operating system from
  3108.     a Plus D system diskette, and save the entire ROM, together with the
  3109.     operating system, to disk by entering SAVE d1"rom" CODE 0,16384.  Then,
  3110.     start the emulator and choose hardware mode Spectrum 48K + Disciple
  3111.     (not Plus D of course), then type LOAD d1"rom" CODE 32768.  Finally,
  3112.     press F10, X, S for Save Data block, set start address and length to
  3113.     8000 and 4000 (hexadecimal) respectively, and save the ROM under the
  3114.     name PLUSDROM.BIN.  If you re-start the emulator now, it will emulate
  3115.     the Plus D too.
  3116.  
  3117.  
  3118.  
  3119.  
  3120. 4.4  The DISCiPLE and Plus D Interfaces - The basic commands
  3121.  
  3122.  
  3123.     There are several levels of commands that can be used, these range from
  3124.     the most straightforward everyday use, to the more advanced, programmer
  3125.     type commands.
  3126.  
  3127.     I will first explain the most common commands, so that you can quickly
  3128.     and easily access DISCiPLE and Plus D disks.  Where a 1 is used in the
  3129.     following commands 2 could be used instead.  These commands are:-
  3130.  
  3131.      RUN -   when no D.O.S. (system file) is loaded it will cause this to
  3132.              be loaded. Otherwise it will just run the BASIC PROGRAM.  Please
  3133.              note that with the emulator the system file is already loaded,
  3134.              therefore this command is not required, although I have
  3135.              explained it for completeness.
  3136.  
  3137.      CAT 1 - will display a longhand catalogue of the disk drive selected.
  3138.              The form of this catalogue is as follows:-
  3139.  
  3140.                     program no., program name, sectors used, file type,
  3141.                     file size
  3142.  
  3143.      CAT * - will display a longhand catalogue of the currently selected disk
  3144.              drive in the same form as described above.
  3145.  
  3146.      CAT 1! - displays a shorthand catalogue of the disk drive selected.
  3147.               This catalogue consists of a 3 column list of the filename of
  3148.               the programs.
  3149.  
  3150.      CAT *! - displays a shorthand catalogue of the current disk drive.
  3151.  
  3152.      LOAD pn - p - letter p, n - number between 1 & 80.  This is the program
  3153.                number of the file on the disk, the program number is the
  3154.                number printed before the name in the longhand catalogue.
  3155.  
  3156.      LOAD d1"name" - load from drive 1 the program called name
  3157.  
  3158.      LOAD d*"name" - load from the current drive the program called name
  3159.  
  3160.      LOAD d1"name" S - load an 48K snapshot from drive 1 called name
  3161.  
  3162.      LOAD d1"name" K - load an 128K snapshot from drive 1 called name
  3163.  
  3164.      LOAD d1;a$ - load from drive 1 the program whose name is held in the
  3165.                   string a$
  3166.  
  3167.      LOAD d*;a$ - load from the current drive the program whose name is held
  3168.                   in the string a$
  3169.  
  3170.      FORMAT d1 -  format the disk in drive 1
  3171.  
  3172.  
  3173.  
  3174.  
  3175. 4.5  The DISCiPLE and Plus D Interfaces - More advanced commands
  3176.  
  3177.  
  3178.     In the previous section I explained enough of the commands so that you
  3179.     could get to use the floppy disks with DISCiPLE/Plus D software on. Now
  3180.     I am going to explain the commands that the more experienced user and
  3181.     those who want to do just a little bit more than just load the
  3182.     programs.
  3183.  
  3184.     First of all comes the simple commands of SAVE, MERGE, VERIFY and LOAD.
  3185.     All of these commands are the same as rge tape versions except that you
  3186.     have d1, d2 or d* after the LOAD, SAVE etc.  There are only two
  3187.     exceptions to this rule, the first is when you have a string for the
  3188.     filename, in this case the command becomes:-
  3189.  
  3190.              LOAD d1;n$ ....... etc
  3191.              LOAD d*;n$ ....... etc
  3192.  
  3193.     The second exception is actually an extension.  When you save a code
  3194.     block, you can actually get it to autorun when it is loaded by adding a
  3195.     third parameter to the SAVE command, e.g. if you had a code block from
  3196.     40000 to 45000 and the run address was 41023 and you wanted it to be
  3197.     called testcode to drive 1, you would save it as:-
  3198.  
  3199.              SAVE d1"testcode"CODE 40000,5001,41023
  3200.  
  3201.     Now for the extensions.
  3202.  
  3203.     Any sector on the disk may be loaded to any area of RAM from 16384 to
  3204.     65535-512. The sector may also be loaded into the RAM of the interface,
  3205.     however caution should be used at all times when doing this, as you may
  3206.     destroy the operating system or cause it to behave irrationally.
  3207.  
  3208.     The syntax of the command is:-
  3209.  
  3210.              LOAD @n,tr,sec,add
  3211.  
  3212.     Where:-
  3213.  
  3214.              n   = drive number, ie 1 or 2, note * may not be used!
  3215.              tr  = track number => 0->79=side 0, 128->207=side 1
  3216.              sec = sector number => 1->10 normally, may not be 0!  If you
  3217.                                     try and load a sector that is sector 0,
  3218.                                     then the operating system will crash!
  3219.  
  3220.     You may also save to disk in the same way, so if you wanted to write to
  3221.     Track 5, Side 0, Sector 3 with code from 32768 to 33279 to drive 1 you
  3222.     would type:-
  3223.  
  3224.              SAVE @1,5,3,32768
  3225.  
  3226.     To format a disk all you need to type is:-
  3227.  
  3228.              FORMAT d1       or       FORMAT d2
  3229.  
  3230.     This is not however as simple as it seems!  Although a disk formatted
  3231.     on the DISCiPLE/Plus D will work with the PC it does not work the other
  3232.     way round, i.e. a disk formatted on the PC with this emulator will not
  3233.     necessarily work on the DISCiPLE/Plus D. This is because of differences
  3234.     of the floppy disk controller chips.  With the PC, it puts a special
  3235.     byte at the beginning of each track to tell the controller whether the
  3236.     disk is Double Density or High Density, and the spectrum floppy disk
  3237.     controller does not understand this byte and therefore will not read
  3238.     the track!  If you find this otherwise, then please write and let us
  3239.     know about it.
  3240.  
  3241.     You can set some of the D.O.S. system variables using an extended POKE
  3242.     command. The syntax is:-
  3243.  
  3244.              POKE @address,value
  3245.  
  3246.     The address is the BASE address of the system variables of the
  3247.     interface concerned, the BASE address for each of the interfaces is
  3248.     different, but the address you use in the POKE command is the same.
  3249.  
  3250.  
  3251.  
  3252.  
  3253. 4.6  The DISCiPLE and Plus D Interfaces - The snapshot button
  3254.  
  3255.  
  3256.     The snapshot button is a button which is used to stop the processor
  3257.     from executing instructions and making it do something else. In the
  3258.     case of the DISCiPLE/PLUS D the button can do 5 different tasks
  3259.     initially. Later on I'll discuss how the fuctions can be altered so
  3260.     that it can do other tasks. Once these tasks are carried out, the
  3261.     processor is returned to it's original state and the program continues
  3262.     from where it left off from.
  3263.  
  3264.     There are 5 functions that can be carried out with the initial system
  3265.     file.
  3266.  
  3267.     To use the button, first you must get to a point in the program that
  3268.     you want to use the button at, then press the button on the emulator
  3269.     the snapshot button is F5 (NMI).  Once you do this the program will
  3270.     stop and the border of the computer will flash, this may also be
  3271.     accompanied with a buzzing noise on the speaker.  This is to tell you
  3272.     that the snapshot button has been activated.  The following functions
  3273.     can then be carried out:-
  3274.  
  3275.         1   - Print screen to printer in black/white screen size
  3276.         2   - Print screen to printer in grey scale A4 size
  3277.         3   - Snapshot screen to disk in SCREEN$ format
  3278.         4   - Snapshot program to disk in 48K SNAP format
  3279.         5   - Snapshot program to disk in 128K SNAP format
  3280.       SPACE - go back to program (ie if F5 was pressed by mistake)
  3281.  
  3282.     The printer options will print out to EPSON compatible printers,
  3283.     however the DISCiPLE code has been changed and it is now possible to
  3284.     print to HPGL printers (e.g. Deskjet and Laserjet printers).
  3285.  
  3286.     The Snapshot screen and snapshot 48K are very self explanatory and easy
  3287.     to use.
  3288.  
  3289.     The Snapshot 128K is slightly more complicated.  Once you select this
  3290.     option the disk drive will start up then after a slight pause the
  3291.     screen display may/may not change.  The border flashes again and you
  3292.     have to press y or n depending on whether the screen display changed or
  3293.     not.  If the screen stayed the same then press n, but if the screen
  3294.     changed type y.  This is because the 128K spectrum has 2 screens, and
  3295.     there is no way for the computer to determine which is being used by
  3296.     itself, therefore it needs the user's help.  After you press y or n the
  3297.     program will be saved onto disk.
  3298.  
  3299.     Seeing it is possible for you to load programs into the DISCiPLE/PLUS D
  3300.     RAM area it is possible to have these interfaces carry out other tasks.
  3301.     The snapshot button code is located in RAM, so you can therefore load a
  3302.     program into this part of the RAM and as soon as you press the snapshot
  3303.     button it will execute the new program.  There is one problem however,
  3304.     which is that the program must be written in assembly language and must
  3305.     also be compiled for running in that part of RAM, also it must take
  3306.     care of what it does because the SPECTRUM ROM is not paged in,
  3307.     therefore ROM calls are not easily carried out.
  3308.  
  3309.     There are several different commercial programs which use the snapshot
  3310.     button to carry out different tasks, some of these are:-
  3311.  
  3312.                         Snapshot compressing programs
  3313.                         Debugging tools
  3314.                         Cheat finders for games
  3315.                         Programs to allow snapshots back onto tape
  3316.  
  3317.     The list is endless, and if you are capable of writing a machine-code
  3318.     program and have the relevant information, then you too could write
  3319.     your own programs.
  3320.  
  3321.  
  3322.  
  3323. 4.7  The DISCiPLE and Plus D Interfaces - The system variables
  3324.  
  3325.  
  3326.     The system variables reside in the RAM of the interface, and cannot be
  3327.     read of changed by using the normal POKE statement.  For access to
  3328.     these locations the designer of the Disciple and +D ROM has implemented
  3329.     the POKE @x,y command.  It changes the value at address (#0298+x) in
  3330.     the interface's RAM.  Here are the system variables, with their
  3331.     meaning.  Default values are between brackets.
  3332.  
  3333.     Note that when y (the second argument) of a POKE @ command is larger
  3334.     than 255, it is interpreted as a word, and it is poked at locations x
  3335.     and x+1.  Handy for locations 14 and 16.
  3336.  
  3337.     POKE @0: (7)   Border change mask when reading/writing disks
  3338.     POKE @1: (80+128=208)   Number of tracks of drive 1. 128 means DS
  3339.     POKE @2: (208) Same for drive 2
  3340.     POKE @3: (6)   Step rate in ms (may not be lower than 6)
  3341.     POKE @4: (1)   Network (0=off, 1=master, 2..10=assistant, 11..63=slave)
  3342.     POKE @5: (80)  Printer line width (# of chars printed before CR is
  3343.                    inserted)
  3344.     POKE @6: (0)   Control code conversion (0=on, 1=off)
  3345.     POKE @7: (12)  Printer line feed when printing graphics (1/72th inches)
  3346.     POKE @8: (1)   Number of Line Feeds (10) inserted after each CR (13)
  3347.     POKE @9: (0)   Left margin: number of spaces printed after each CR
  3348.     POKE @10:(0)   Convert some characters into graphics (0=off, 1=on)
  3349.     POKE @11:(0)   Enable MGT Centronics printer interface (0=yes,
  3350.                    1=route to standard "p" channel, i.e. ZX Printer)
  3351.     POKE @12:(word 0)     Unused
  3352.     POKE @14:(word 0)     Basic extension call vector
  3353.     POKE @16:(word #3b0)  Basic extension call vector (I think)
  3354.  
  3355.     The default value of variable 10 was changed to 0.  Previous rom images
  3356.     supplied with Z80 had @11 set to 1 (printer disabled) and @8 to 0
  3357.     (don't add line feeds), but these were not Disciple/+D defaults, so
  3358.     they were changed back in version 3.05.
  3359.  
  3360.  
  3361.  
  3362. 4.8  The Spectrum 128
  3363.  
  3364.  
  3365.     The main new features of the Spectrum 128 are its larger memory, that
  3366.     can be used as a Ram drive in Basic, and music capabilities.
  3367.  
  3368.     The Ram drive is accessed via the LOAD!, SAVE!, ERASE! and CAT!
  3369.     commands.  They work as you would expect.  Examples:
  3370.  
  3371.         SAVE !"name"SCREEN$
  3372.         CAT!
  3373.         LOAD !"name"SCREEN$
  3374.         ERASE !"name"
  3375.  
  3376.     The 3 channel sound chip of the Spectrum 128 can be used in Basic with
  3377.     the PLAY command.  Example:
  3378.  
  3379.         PLAY "cde","efg","gAB"
  3380.  
  3381.     plays three chords.  You can program complex effects, melodies and
  3382.     rhythms with the play command; they require many commands in the three
  3383.     voice strings which I won't explain...  They are explained in the
  3384.     Spectrum 128's user guide.
  3385.  
  3386.  
  3387.  
  3388.