home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / emulator / spectrumemu / spectrum.doc < prev    next >
Text File  |  1995-02-27  |  42KB  |  1,117 lines

  1.  
  2.  
  3.             Sinclair ZX Spectrum Emulator V1.7      7 Jun 1993
  4.             ----------------------------------
  5.  
  6.  
  7. This program emulates a Sinclair ZX Spectrum 48-kbyte z80-based computer on
  8. any Amiga computer.
  9.  
  10. The files in this archive may be distributed anywhere provided they are
  11. unmodified and are not sold for profit.
  12.  
  13. The file Spectrum.rom contains an image of the Spectrum's ROM and it is
  14. copyright to Amstrad.  Cliff Lawson of Amstrad (CompuServe 75300,1517) has
  15. given special permission for emulator authors to use the Spectrum's ROM code.
  16.  
  17. I have gone to a lot of trouble to make sure that the emulator runs on all
  18. amigas (from OS 1.2), so please don't compress the files with an old version
  19. of PowerPacker or Imploder, for example, which would render the emulator
  20. useless on a 68040 system.
  21.  
  22. Ownership and copyright of all files except Spectrum.rom remains with the
  23. author:
  24.  
  25.     Peter McGavin, 86 Totara Crescent, Lower Hutt, New Zealand.
  26.     e-mail: peterm@maths.grace.cri.nz
  27.  
  28.  
  29. Spectrum-00 is an executable for 68000-based Amigas only.
  30.  
  31. Spectrum-10 is for 68010-based Amigas, but also works on higher processors.
  32.  
  33. Spectrum-20 is optimised for 68020/30/40...-based Amigas with fast memory.
  34.  
  35. Spectrum-00-special is for 68000-based Amigas.  It is faster and dangerous.
  36.  
  37.  
  38. The Spectrum-00-special version takes some shortcuts to get some extra speed.
  39. Some games will run up to 2 times faster in Spectrum-00-special than in
  40. Spectrum-00, but because of the shortcuts, not all programs will work.  In
  41. the special version:
  42.  
  43.     o  Self-modifying z80 code does not work at all.  This affects some
  44.         games.  It also means that you will only be able to run one
  45.         program and then quit.  If you try to load a second Spectrum
  46.         program, without quitting Spectrum-00-special and re-running
  47.         it first, it very probably won't work.
  48.  
  49.     o  Code is optimised for faster animated graphics and scrolling, at
  50.         the expense of speed when the display is static, so you will
  51.         get faster animated games and slower ray-tracing  :-)
  52.  
  53.     o  The ROM is unprotected.  Note that the standard Spectrum ROM
  54.         corrupts itself.  In particular, location 0 usually gets
  55.         overwritten very quickly, so that RANDOMIZE USR 0 does not
  56.         work any more.
  57.  
  58. Do not try to develop or write Spectrum programs with Spectrum-00-special,
  59. because you will probably lose your work.  It is provided only because it is
  60. significantly faster for running some animated Spectrum games.
  61.  
  62. The emulator uses the dreaded move-sr instruction after almost every z80
  63. instruction emulated.  It ran 30-40% slower when I tried replacing the
  64. move-sr instruction with a call to GetCC()!  This is quite exceptional ---
  65. with most programs you wouldn't notice the difference.  Therefore I have
  66. supplied a 68010 version which uses move-ccr instead of move-sr.
  67.  
  68. The Spectrum-20 version uses 68020 addressing modes which are not available
  69. on lower processors.
  70.  
  71. I developed the code, entirely in assembler, in my spare time using z80
  72. emulation code based (originally) on Ulf Nordquist's CP/M emulator (Fred Fish
  73. disk 165).  I have fixed several bugs in the z80 emulation code, and made it
  74. more than twice as fast, but there are still some (very hard to find) bugs.
  75.  
  76.     
  77. Features:
  78. ---------
  79.  
  80. The following Spectrum features are implemented:
  81.  
  82.     screen output in the same resolution and colours as a real Spectrum
  83.         --- includes bright, reverse and flash attributes, and border
  84.         colour (looks much better than the old TV!)
  85.  
  86.     keyboard implemented at the z80 "in" instruction level.  Note that
  87.         like a real Spectrum you have to hold the key down until it
  88.         registers.  Because the emulator is running slower, you might
  89.         have to hold keys down longer.  More often, you might have to
  90.         hold your fingers off the keyboard for longer.  Make sure the
  91.         Spectrum window is active when you start to type.  See
  92.         Appendix 1 for key map.
  93.  
  94.     kempston joystick implemented at the Z80 "in" instruction level.  This
  95.         uses the rear Amiga gameport.  Note that the joystick is
  96.         active only when the Spectrum window is active.  If another
  97.         Amiga program is currently using the joystick, you will get a
  98.         retry/no-joystick requester.
  99.  
  100.     sound implemented using 2 techniques.  Calls to the "beeper" routine
  101.         at $03b5 in the Spectrum rom are trapped and the sound is
  102.         emulated at the exact same frequency and duration.  Sound is
  103.         also reproduced when a Spectrum program outputs to z80 port
  104.         254.  In this case the pitch and duration may or may not
  105.         sound correct, depending on the Spectrum program and the speed
  106.         of the Amiga you are using.
  107.  
  108.     cassette tape loading, if you have a sound sampler capable of at least
  109.         20 kHz sampling rate attached to your parallel port.  This is
  110.         implemented by trapping calls to the "ld-bytes" routine at
  111.         $056b in the Spectrum rom.  Note that copy-protected games
  112.         with custom loaders cannot always be loaded this way.
  113.  
  114. It is possible to save to and load from amiga disk files.
  115.  
  116.  
  117.  
  118. Operation:
  119. ----------
  120.  
  121. You can start the emulator from either the Workbench or SHELL (or CLI).
  122.  
  123. If you use the SHELL (or CLI), Spectrum.rom must be in the current directory.
  124. You can specify the name of a snapshot file as a parameter and then the
  125. snapshot will be loaded automatically.
  126.  
  127. From the workbench, Spectrum.rom should be in the same directory as the
  128. program.  You can create project icons for your snapshots (e.g, with
  129. IconEdit), so you can have an icon for ManicMiner for example, but currently
  130. the emulator does not create its own icons.
  131.  
  132. If the emulator can't find Spectrum.rom, then it will display a requester
  133. saying so, and it will not run.
  134.  
  135. Under AmigaOS 2.x and up the emulator uses the ASL file requester.  This is
  136. not available in earlier operating systems (e.g, 1.3), so in those
  137. circumstances the emulator tries to use the ARP file requester instead.
  138. If neither asl.library nor arp.library is available (in your LIBS: directory)
  139. then you cannot load or save disk files in the emulator.
  140.  
  141. The emulator runs in its own custom screen and window.
  142.  
  143. The emulator does not disable multitasking, and it does not interfere with
  144. other tasks (except when loading from a sound sampler).  You can drag the
  145. screen down or click it to the back with the mouse, in the usual way.
  146.  
  147. The emulator lowers its own priority to -5, otherwise it would significantly
  148. slow down other tasks.  Raising the priority back to 0 does not significantly
  149. speed up the emulator on a standard system.  Raising it higher prevents most
  150. other tasks from running at all.  You can change the emulator's priority from
  151. the menus.
  152.  
  153. To exit the emulator, do either of the following:
  154.  
  155.     o  select "Quit..." from the Project menu, or
  156.  
  157.     o  press the ESC key.
  158.  
  159.  
  160.  
  161. Menus:
  162. ------
  163.  
  164. Project menu
  165.  
  166.     Reset...
  167.     Resets the z80, unless you cancel the requester that pops up.
  168.     This is like the Spectrum NEW command, but it works even when you
  169.     are running an "unbreakable" or "crashed" program.
  170.  
  171.     Load snapshot...  F1
  172.  
  173.     Loads a disk file that has been created with "Save snapshot",
  174.     restoring the state of the system to what it was when the snapshot
  175.     was made.  Any currently loaded Spectrum program is lost.
  176.  
  177.     You can use "Load snapshot..." even if the Spectrum has "crashed",
  178.     or if you are running a Spectrum program which does not have a
  179.     "quit" option.
  180.  
  181.     Save snapshot...  F2
  182.  
  183.     Saves the current state of the emulator to a disk file.  The entire
  184.     state of the system is saved, including all 48 kbytes of Spectrum ram
  185.     and the state of the z80 processor.
  186.  
  187.     The format of a snapshot file is listed in Appendix 2.
  188.  
  189.     Help...         HELP
  190.  
  191.     Displays the "Spectrum.help" file, which is a diagram of a real
  192.     Spectrum keyboard.  You need about 70 kb of CHIP ram free for this.
  193.  
  194.     Quit...          ESC
  195.  
  196.     Quits the emulator.  (You get a chance to change your mind.)
  197.  
  198.  
  199. Settings menu
  200.  
  201.     LOAD/MERGE/VERIFY...
  202.  
  203.     Selects what happens when the emulator executes a Spectrum BASIC
  204.     LOAD, MERGE or VERIFY command.
  205.  
  206.     Note that this has nothing at all to do with "Load snapshot", which
  207.     always loads from disk.  What it does do, is to change the behaviour
  208.     of the standard Spectrum BASIC tape loading commands, which are
  209.     normally used to load, merge and verify BASIC programs, array data
  210.     and binary code, from cassette tape.
  211.  
  212.     In fact, this selects what happens when any program (including any
  213.     machine code program) calls the cassette tape loading routine in the
  214.     Spectrum rom.
  215.  
  216.     You have a choice of:
  217.  
  218.         Disk files
  219.  
  220.         Select a disk file using a file requester.  The data in the
  221.         file is interpreted as if it is being read from cassette tape.
  222.  
  223.         The first byte in the file is the "header" byte, then the raw
  224.         data, then the checksum byte.
  225.  
  226.         The Spectrum normally reads 2 blocks of data from cassette
  227.         tape, a "header" file followed by the "data" file.  These
  228.         should be stored in 2 separate disk files.  The emulator will
  229.         request both files.  I implemented it this way to allow support
  230.         for "headerless" files which are used by many Spectrum machine
  231.         code programs.
  232.  
  233.         Note that the Spectrum still thinks it is reading from cassette
  234.         tape, so you might see messages like "Start tape now", even
  235.         though it is reading from disk.
  236.  
  237.         If the file you select is not in the correct format, or if the
  238.         checksum is wrong, the Spectrum will usually just request the
  239.         same file again, without any messages, as if it read garbage
  240.         noise from cassette tape.
  241.  
  242.         ProSound
  243.  
  244.         Read data from a ProSound sound sampler connected to the
  245.         parallel port.
  246.  
  247.         Rombo
  248.  
  249.         Read data from a Rombo sound sampler connected to the parallel
  250.         port (the sampler that comes with MegaMIX Master software).
  251.         Please note that this option is untested.
  252.  
  253.         Other sampler
  254.  
  255.         Read data from any other kind of sound sampler connected to the
  256.         parallel port.
  257.  
  258.         The sampler must be capable of at least 20 kHz sampling rate
  259.         and it must be connected to the parallel port (not the game
  260.         port).
  261.  
  262.         You should be able to feed standard Spectrum cassette tapes in.
  263.  
  264.         Some copy-protected programs have custom loaders that will not
  265.         work in the emulator.
  266.  
  267.         It is possible to connect the Spectrum EAR output to the sound
  268.         sampler to transfer data directly from your Spectrum.  (Use a
  269.         SAVE command at one end, and a LOAD at the other.)
  270.  
  271.         Important: Interrupts on the amiga are disabled while you are
  272.         loading from a sound sampler.  This will interfere with other
  273.         tasks.  For example, a file transfer running in the background
  274.         will probably fail.  Please make certain that no other tasks
  275.         are writing to disk at the instant you start sampling!
  276.  
  277.         It seems as if the whole amiga has frozen while interrupts are
  278.         disabled.  To restore control, click the left mouse button.
  279.  
  280.     SAVE...
  281.  
  282.     Selects what happens when the emulator executes a Spectrum BASIC
  283.     SAVE command.
  284.  
  285.     Note that this has nothing at all to do with "Save snapshot", which
  286.     always saves to disk.  What it does do, is to change the behaviour
  287.     of the standard Spectrum BASIC SAVE commands, which are normally used
  288.     to save BASIC programs, array data and binary code, to cassette tape.
  289.  
  290.     In fact, this selects what happens when any program (including any
  291.     machine code program) calls the cassette tape saving routine in the
  292.     Spectrum rom.
  293.  
  294.     You have a choice of:
  295.  
  296.         Disk files
  297.  
  298.         Select a disk file using a file requester.  The data that
  299.         would normally be written to cassette tape is written to the
  300.         selected file instead.
  301.  
  302.         The first byte in the file is the "header" byte, then the raw
  303.         data, then a checksum byte.
  304.  
  305.         The Spectrum normally writes 2 blocks of data to cassette
  306.         tape, a "header" file followed by the "data" file.  These
  307.         should be stored in 2 separate disk files.  The emulator will
  308.         request both files.  I implemented it this way to allow support
  309.         for "headerless" files which are used by many Spectrum machine
  310.         code programs.
  311.  
  312.         Note that the Spectrum still thinks it is writing to cassette
  313.         tape, so you might see messages like "Start tape, then press
  314.         any key".
  315.  
  316.         Audio
  317.  
  318.         Save to audio to be recorded on to cassette tape to be loaded
  319.         back on a real Spectrum.
  320.  
  321.         WARNING:
  322.         I have had a lot of trouble with this option (so I disabled it
  323.         in earlier versions) and so far have not been able to load
  324.         back anything I have ever saved, even though the noise sounds
  325.         right and the code looks right.  Maybe you will have better
  326.         luck than me, but my guess is that there is something
  327.         seriously wrong and that it will not work for anybody.
  328.  
  329.         Sorry there is no way to break into a save to audio in
  330.         progress --- you have to wait until it has finished.  The
  331.         amiga continues to multitask, however.
  332.  
  333.  
  334.     Audio Volume...
  335.  
  336.     Lets you choose the sound volume from one of:
  337.  
  338.         Off
  339.         Quiet
  340.         Normal (default)
  341.         Loud
  342.  
  343.  
  344.     Titlebar...
  345.  
  346.     Lets you turn the screen titlebar on and off.
  347.  
  348.  
  349.     Task Priority
  350.  
  351.     Lets you choose the priority of the Spectrum task from one of:
  352.  
  353.         -10    Lowest priority
  354.          -5    The default (and the recommended value)
  355.           0    Same as most programs
  356.           1    Same as workbench
  357.           2
  358.           5    Highest priority
  359.  
  360.     If you really want a priority that's not on the list, use one of the
  361.     public domain system monitor programs like xoper or ARTM.  But be
  362.     careful --- you can lock up your system if you set it to 10 or more,
  363.     because that is ahead of input devices or Intuition which the emulator
  364.     relies on.
  365.  
  366.     In most circumstances changing the emulator's priority does not
  367.     significantly affect the speed of the emulator.  But because the
  368.     emulator is a CPU hog (i.e, it does not normally Wait() because it is
  369.     continuously busy emulating Z80 instructions), raising its priority
  370.     will slow down or stop other tasks.
  371.  
  372.  
  373. More on Reading Cassette Tapes:
  374. -------------------------------
  375.  
  376. To load a cassette tape through your sound sampler, first select your sampler
  377. type in the Settings menu, then enter LOAD "" (that is, J followed by ALT/P
  378. twice, then RETURN).  Now start the cassette tape playing into your sound
  379. sampler.  If it is working, the screen border should flash colours, very much
  380. like your Spectrum, and the mouse pointer will be frozen.
  381.  
  382. The MERGE and VERIFY commands should also work, as should things like
  383. LOAD "" CODE, etc.
  384.  
  385. The border of the screen flashes different colours, exactly like a real
  386. Spectrum.  The colours mean:
  387.  
  388.     flashing yellow and blue:    the load is working
  389.     flashing red and white:        synchronising or not working
  390.     not flashing:            not working or tape not playing
  391.  
  392. If it doesn't work, try adjusting the volume and tone controls on the tape
  393. recorder.  If you have trouble, try adjusting the controls while sampling
  394. with software that came with your sampler.  Ideally, the input should be a
  395. square wave which fills the graphic display.  I found it necessary to have
  396. the volume control much lower than when using a real Spectrum, but it
  397. probably varies, depending on the sampler type.
  398.  
  399. You should be able to save directly from your Spectrum to the Amiga with a
  400. direct connection --- i.e, no cassette tape or recorder at all.  Use a SAVE
  401. command on the Spectrum and a corresponding LOAD command in the emulator.
  402.  
  403. Loading works by intercepting calls to the LD-BYTES routine at location
  404. $056b in the Spectrum ROM.  If a Spectrum program has its own loading
  405. routine, then it won't work.  Some copy-protected games and fast-loaders
  406. are like that, and they will not work.  On the other hand, some Spectrum
  407. programs call LD-BYTES to load headerless tape files.  Those programs
  408. should work fine.
  409.  
  410. If you have been using the parallel port recently (for printing or ParNet
  411. for example), you might get a requester asking you to please free up the
  412. parallel port.  Try shutting down the program that has allocated it.
  413.  
  414. The following sound samplers should be suitable, but I have not had the
  415. opportunity to test any except the first:
  416.  
  417.     o ProSound
  418.  
  419.     o Rombo (the one that comes with MegaMIX Master)
  420.  
  421.     o Perfect Sound (except that recent Perfect Sound samplers are
  422.         different from early versions and recent ones might not work)
  423.  
  424.     o Datel DSS
  425.  
  426.     o Future Sound
  427.  
  428. Documentation on how various samplers work seems to be hard to obtain.
  429. They all seem to be slightly different, especially the way stereo/mono
  430. modes are switched and different channels are selected.
  431.  
  432. For the technically minded, here are the cia register settings currently
  433. used by the loader:
  434.                 ProSound    Rombo        Other
  435.     setup ciab-ddra        4        7        6
  436.     setup ciab-pra        4,0 or none *    6        4
  437.     inter-sample ciab-pra    4,0,4,0        none        none
  438.     ciaa-prb input bias    $80        $80        $80
  439.  
  440.     * If bit 0 of ciab-pra is 0 then output 4 followed by 0 else none.
  441.  
  442. Note that the tape-loading routine disables interrupts for the whole time
  443. it takes to load a tape.  That greatly exceeds Commodore's recommended
  444. limit of 250 microseconds.  While interrupts are disabled, the mouse
  445. pointer freezes, the keyboard is locked out, all other tasks stop, and any
  446. data arriving at the serial port is lost.
  447.  
  448. Please make sure your disks are not busy when you start to load a tape.
  449. Especially make certain that no other program is writing to your hard disk!
  450.  
  451. If I knew another way to make it work, I'd do it that way.  As far as I am
  452. aware, all sound sampling software on the Amiga disables interrupts for
  453. excessive periods.  The Spectrum loader has to interpret the incoming data
  454. in real time, which is quite a lot more than just saving it to a buffer in
  455. memory.
  456.  
  457. To break out of the load routine without actually loading anything, press
  458. the left mouse button.  The Spectrum BREAK key (SHIFT/SPACE) won't work in
  459. this situation.
  460.  
  461. The load routine is based on code kindly provided by Kristian Nielson.
  462. It has been tested on both standard and accelerated amigas.
  463.  
  464.  
  465. General Notes:
  466. --------------
  467.  
  468. o   The emulator runs about 2 to 8 times slower than a real Spectrum, on a
  469.     standard 68000-based A500.  If you are the lucky owner of an Amiga 3000,
  470.     the emulator runs faster than a real Spectrum, but make certain it's
  471.     running out of FAST ram.  If you run it out of CHIP ram, then it's more
  472.     than twice as slow.  I'm afraid the 68000 doesn't have a built-in z80
  473.     emulation mode, and a 3.5 MHz z80 is much harder to emulate than a 6502
  474.     as used in the Commodore 64 and BBC microcomputers.  The Spectrum NEW
  475.     command takes 9.7 seconds on an A500, compared with about 2.0 seconds on
  476.     a real Spectrum, 1.8 seconds on an A3000 (in FAST static-column ram), and
  477.     1.6 seconds on a 33MHz Mega-Midget-Racer with 32-bit ram.  One person
  478.     reported to me that it runs about 3 times faster again on a 68040.
  479.     Several people have told me that some games run too fast on an A1200!
  480.  
  481.  
  482. o   This version of Spectrum uses the blitter to refresh the screen in
  483.     parallel with the emulator.  That is, it uses multi-processing.  Thus,
  484.     the overhead of a z80 instruction writing to the Spectrum's display file
  485.     is minimised.  Before you A3000 owners complain that the 68030 is faster
  486.     than the blitter for blitting, remember that while the blitter is
  487.     refreshing the screen, the 68030 is busy emulating the z80.  The program
  488.     uses QBlit() for concurrency, not OwnBlitter() which would block the z80
  489.     emulator.
  490.  
  491.  
  492. o   I've just about run out of ideas on how to significantly speed up the
  493.     code from what it is now.  One thought is to code some common ROM routines
  494.     in pure 68000.  Obvious candidates are the text output, scrolling, and
  495.     maskable interrupt routines.  Of course this would only speed up programs
  496.     that call the ROM, which excludes most games.  Also, It would probably be
  497.     illegal.  The major speed bottleneck used to be the z80 instruction
  498.     decode.  I've pretty well eliminated that by going to threaded code.  The
  499.     display routines are about as fast as I can get them.  Taking over the
  500.     machine and doing everything at the hardware level would probably give
  501.     only a slight speed improvement, and the program would become much less
  502.     friendly and less portable.
  503.  
  504.  
  505. o   The emulator calls CopyMem() and CopyMemQuick() in several places.  You
  506.     may or may not achieve a speedup by installing the Public Domain
  507.     CopyMemQuicker patch by Arthur Hagen, depending on your configuration.
  508.     (I found CopyMemQuicker available for ftp on amiga.physik.unizh.ch and
  509.     ftp.etsu.edu.)
  510.  
  511.  
  512. o   In version 1.7, the following Spectrum features are NOT implemented yet:
  513.  
  514.     bank roms (e.g, Interface 1);
  515.  
  516.     printing to a printer
  517.  
  518.  
  519. o   The following z80 features are NOT properly implemented:
  520.  
  521.     the z80 h processor flag;
  522.  
  523.     the z80 daa instruction (decimal adjust a) --- daa works properly only
  524.         immediately after add, sub, adc or sbc.  A few games use daa
  525.         in the scoring routine and might fail because of this.
  526.  
  527.     undocumented condition code flags do not necessarily behave the same
  528.         as on a real Z80.  Some programs probably fail because of this.
  529.  
  530.     the timer interrupt occurs after every 1500 branch, jump, call and
  531.         return z80 machine instructions, instead of every 20 ms.  On
  532.         accelerated amigas, interrupts will not occur any faster than
  533.         every 20 ms.
  534.  
  535.     updating of the flash attribute occurs every 24000 branch, jump, call
  536.         and return z80 instructions, instead of every 320 ms.  On
  537.         accelerated amigas, the flash speed will never be faster than
  538.         every 320 ms.
  539.  
  540.     interrupts and screen updates can occur only immediately after branch,
  541.         jump, call, return and halt z80 machine instructions.
  542.  
  543.     because the emulator is not real-time, the real interval between timer
  544.         interrupts and flash attribute updates depends on the nature
  545.         of the Spectrum program being run.
  546.  
  547.     there might still be rare problems executing certain long,
  548.     self-modifying z80 instructions located at exactly 32763..32766 in z80
  549.     memory, because of the 68000 addressing modes used to load instruction
  550.     operands;
  551.  
  552.     there is at least one other bug I haven't been able to track down yet.
  553.  
  554.  
  555. o   The emulator allocates and uses two sound channels.  If there are not
  556.     enough free channels, you get the option of running the emulator with no
  557.     sound.  If you have enough memory you can test this by running 3 copies of
  558.     Spectrum at once!
  559.  
  560.  
  561. o   Because it's running slower, maybe now you can get past that "impossible"
  562.     level in your favourite game.
  563.  
  564.  
  565. o   Now you can print Spectrum graphics by transferring to your Amiga.
  566.  
  567.  
  568. o   If you're cross-developing Spectrum software, now you can see which parts
  569.     need speeding up.
  570.  
  571.  
  572. o   I've tested it with several Sinclair Basic programs and all ran perfectly.
  573.  
  574.  
  575. o   I've tried lots machine-code programs and most work ok.  The following
  576.     programs seem to work ok in the emulator:
  577.  
  578.         Zeus Assembler and Monitor
  579.         Scrabble
  580.         Jetset Willy
  581.         Atic Atac
  582.         Jetpac
  583.         Tron
  584.         The Train Game
  585.         Backgammon
  586.         PSSST
  587.         Horace and the Spiders
  588.         Sam Spade
  589.         Draughts
  590.         Sam Stoat
  591.         3D Deathchase
  592.         Technician Ted
  593.         Kosmic Kanga
  594.         Monty Mole
  595.         Talk Chess
  596.         Horace Goes Skiing
  597.         Hungry Horace
  598.         Star Raid
  599.         Cyclone
  600.         Wheelie
  601.         Full Throttle
  602.         Mugsy
  603.         Dynamite Dan
  604.         Dynamite Dan II
  605.         Heathrow
  606.         IS Chess 48
  607.         Matchpoint
  608.         Max Headroom            no joystick
  609.         Spy vs Spy
  610.         Kong
  611.         The Alchemist
  612.         Daley Decathlon
  613.         Automania
  614.         Penetrator
  615.         Gyron
  616.         Alien8
  617.         Cyberun
  618.         KnightLore
  619.         Batman
  620.         Tomahawk
  621.         Fighter Pilot
  622.         Athena
  623.         Basil the Detective
  624.         Pacland
  625.         Orbix
  626.         Meteor
  627.         Manic Miner
  628.         Madmix
  629.         Kokotoni Wilf
  630.         Ikari Warriers
  631.         Gauntlet
  632.         Dustin
  633.         Ant Attack
  634.  
  635.  
  636.     St Bernard resets the Spectrum at the end of the first level.
  637.  
  638.     SabreWulf runs, except sometimes the rhino runs backwards (very
  639.     amusing).
  640.  
  641.     (If you know why either of these programs don't work, please tell me.)
  642.  
  643.     Note: The Amiga doesn't crash.  If a Spectrum program crashes, you can
  644.     either:  Quit the emulator and continue working on the Amiga, or:
  645.     Press F1 and load another snapshot.
  646.  
  647.     Note: Some of the above have not been tested since Spectrum v0.7 or v0.8.
  648.  
  649.     Another note: Some of the above programs won't load from tape, but they
  650.     will run if you can create a snapshot file somehow (e.g, Mirage Microdriver
  651.     and serial port).
  652.  
  653.     One user reported to me that out of 350 games he tried on his A1200, all
  654.     except about 10 or 15 worked properly.  (He was not loading from tape.)
  655.     Other people have sent me long lists of hundreds of games that work okay.
  656.  
  657.  
  658. o   One problem I have had with snapshotting games by transferring a snapshot
  659.     file from the real Spectrum to the amiga, is as follows:  If there is
  660.     non-standard hardware in your real Spectrum (like a non-standard joystick or
  661.     disk drive), and the program knows about the special hardware, then the
  662.     program might have already done a hardware test (before you made the
  663.     snapshot) that makes it believe the special hardware exists permanently.
  664.     Then, when run under the emulator, the program tries to access the
  665.     non-existent hardware and behaves erratically.
  666.  
  667.     What is wrong is that the program was started in one environment (the real
  668.     Spectrum with add-ons) and is now running in another (the plain Spectrum
  669.     emulator).  For example, if your program behaves as if the joystick button
  670.     is continuously pressed (when run in the emulator), maybe it is because
  671.     you made the original snapshot from a Spectrum which has non-standard
  672.     joystick hardware.  See if you can disconnect the joystick interface and
  673.     reload the original program from tape before you make a snapshot.
  674.  
  675.  
  676. o   I am not supplying the source of the emulator yet.
  677.  
  678.  
  679. o   Please report bugs to peterm@maths.grace.cri.nz.  I'd much prefer bug
  680.     reports like "the `or' instruction doesn't zero the carry flag" to
  681.     "Dan Dare doesn't work".
  682.  
  683.  
  684.  
  685. Appendix 1:  The keyboard:
  686.  
  687. The Spectrum has a weird way of mapping functions to keys that doesn't
  688. translate nicely to the Amiga.  To get a "[" on a real Spectrum, for example,
  689. you press CAPS-SHIFT and SYMBOL-SHIFT together followed by SYMBOL-SHIFT and F.
  690. In the emulator, you do the same thing except CAPS-SHIFT is either of the
  691. SHIFT keys and SYMBOL-SHIFT is either of the ALT keys.  Pressing "[" on the
  692. Amiga keyboard won't work.
  693.  
  694. The following table lists the Amiga key(s) corresponding to each Spectrum key:
  695.  
  696.     Amiga key        Spectrum key
  697.  
  698.     0..9            0..9
  699.     keypad 0..9        0..9
  700.     A..Z            A..Z
  701.     SPACE            SPACE
  702.     RETURN or ENTER        ENTER
  703.     either SHIFT key    CAPS-SHIFT
  704.     either ALT key        SYMBOL-SHIFT
  705.  
  706. The following special Amiga keys correspond to Spectrum key combinations.
  707.  
  708.     Amiga key        Spectrum key combination
  709.  
  710.     .            SYMBOL-SHIFT/M
  711.     ,            SYMBOL-SHIFT/N
  712.     ;            SYMBOL-SHIFT/O
  713.     -            SYMBOL-SHIFT/J
  714.     =            SYMBOL-SHIFT/L
  715.     keypad (        SYMBOL-SHIFT/8
  716.     keypad )        SYMBOL-SHIFT/9
  717.     keypad /        SYMBOL-SHIFT/V
  718.     keypad *        SYMBOL-SHIFT/B
  719.     keypad -        SYMBOL-SHIFT/J
  720.     keypad +        SYMBOL-SHIFT/K
  721.     keypad ENTER        ENTER
  722.     keypad .        SYMBOL-SHIFT/M
  723.     left arrow        SHIFT/5
  724.     down arrow        SHIFT/6
  725.     up arrow        SHIFT/7
  726.     right arrow        SHIFT/8
  727.  
  728. ESC quits the emulator (unless you cancel the requester that comes up).
  729.  
  730. HELP displays the Spectrum.help file, which is a diagram of the real Spectrum
  731. keyboard.  (You need about 70 kb of CHIP ram free for this.)
  732.  
  733. F1 brings up the load snapshot requester.
  734.  
  735. F2 brings up the save snapshot requester.
  736.  
  737. F3 changes the sampler type for cassette tape loading.
  738.  
  739. All the other Amiga keys do nothing.
  740.  
  741. Note that the Amiga's hardware and software impose some restrictions on the
  742. number of keys that are recognised when several keys are held down at once.
  743. This varies between models of amigas, but don't expect 3 or 4 keys down at
  744. once to behave exactly the same as a Spectrum.
  745.  
  746.  
  747.  
  748. Appendix 2:  Snapshot file format:
  749.  
  750. This format is based on the format used by the Mirage Microdriver "Dump"
  751. command.  Snapshot files are always 49179 bytes long.  Note that in the table,
  752. the byte offset starts from 0, not 1.
  753.  
  754.     Byte offset into file        Value
  755.  
  756.     0                i  register
  757.     1                l' register
  758.     2                h' register
  759.     3                e' register
  760.     4                d' register
  761.     5                c' register
  762.     6                b' register
  763.     7                f' register
  764.     8                a' register
  765.     9                l  register
  766.     10                h  register
  767.     11                e  register
  768.     12                d  register
  769.     13                c  register
  770.     14                b  register
  771.     15                iy low register
  772.     16                iy high register
  773.     17                ix low register
  774.     18                ix high register
  775.     19                bit 2 is set if interrupts are enabled
  776.     20                r register
  777.     21                flags register
  778.     22                a register
  779.     23                sp low register
  780.     24                sp high register
  781.     25                interrupt mode (0, 1 or 2)
  782.     26                border colour in low 3 bits
  783.     27..49178            48 kbytes ram dump
  784.  
  785. The JPP Spectrum emulator for 80386-based PC's by Arnt Gulbrandsen uses exactly
  786. the same snapshot format.
  787.  
  788.  
  789. Appendix 3:  Other Spectrum Emulators:
  790.  
  791.  
  792. When I started this project I did not know of any other Spectrum emulators.
  793. Now I have heard of at least 12, including this one, in various stages of
  794. development.
  795.  
  796. 1: This one.
  797.  
  798. 2: The public domain K.G.B. emulator advertised in "Amiga Format".  I have
  799. seen only version 1.2 which does not multitask and does not work properly on
  800. my A3000.
  801.  
  802. 3: An Italian emulator was released (possibly commercially) about 4 years ago
  803. by A.Schifano and Gervasi.  The version I saw was very bug free and worked
  804. on accelerated amigas, but it did not multitask and was slightly slower than
  805. mine.  A believe that an early (buggy) demo version was released on the
  806. coverdisk of an Italian magazine several years ago too.
  807.  
  808. 4: An emulator is under development in Sweden.
  809.  
  810. 5: Another emulator, intended to be commercial, was written in Holland, but it
  811. was never released as far as I know.  From what I have heard about it, it is
  812. much faster than mine.
  813.  
  814. 6: The Whitby Software Spectrum Simulator is a Spectrum ROM rewrite for the
  815. C64.  It runs just fine under TheA64Package and is surprisingly fast.  Because
  816. it is a ROM rewrite and not a z80 emulator, you cannot run z80 machine code
  817. programs (i.e, most games).
  818.  
  819. 7: VGASPEC is a Spectrum emulator for the IBM-PC and clones (not for the
  820. amiga).  A VGA graphics adaptor is required.  I think it was developed in
  821. Spain or Portugal (I don't recognise the language that all the messages are
  822. written in).
  823.  
  824. 8: JPP is another Spectrum emulator for the IBM-PC and clones, developed
  825. recently by Arnt Gulbrandsen.  An 80386 and VGA are required.  It is faster
  826. than VGASPEC.  The name JPP is derived from the keys you press to get LOAD "".
  827.  
  828. 9: There is another very good Spectrum emulator for the IBM-PC.  It is called
  829. Z80, and written by G.A.Lunter, and it includes lots of advanced features.
  830.  
  831. 10: There is a Spectrum emulator for the Atari ST available from various ftp
  832. sites.  Try terminator.cc.umich.edu, perhaps directory /atari/emulators.
  833.  
  834. 11: I heard from one person working on a Spectrum emulator for the BBC RISC
  835. computer (status unknown).
  836.  
  837. 12: I have heard rumours of other emulators in various stages of development
  838. in Australia and Germany for platforms including the Amiga, the IBM-PC and
  839. Unix/X-Windows.
  840.  
  841. There is a good collection of Spectrum emulators available by ftp from
  842. wuarchive.wustl.edu and its mirrors.  Programs to convert between various
  843. snapshot formats are also available there, in source form.  (Look in the
  844. PC Spectrum emulator archives for these.)  Other ftp sites to try are
  845. ftp.nvg.unit.no (run by Arnt Gulbrandsen) and ftp.sun.ac.za (in South Africa).
  846.  
  847. There is also a mailing list for Sinclair-related gossip.  E-mail Mauricio
  848. Tavares at mauricio@gauss.aero.ufl.edu for details.
  849.  
  850.  
  851. Appendix 4:   Update Notes:
  852.  
  853.  
  854. v0.0    22 Oct 1990
  855.  
  856. First release.
  857.  
  858.  
  859. v0.1    15 Nov 1990
  860.  
  861. Sped up display code slightly.  Also sped up main instruction decode slightly.
  862. Display flash attribute as reverse.
  863.  
  864.  
  865. v0.2    30 Dec 1990
  866.  
  867. Now use double buffered display and implemented flash attribute properly.
  868. Added error requesters.
  869. Used pc-relative jump tables in z80 emulator --- slightly faster, and much,
  870. much smaller.
  871.  
  872.  
  873. v0.3    20 Jan 1991
  874.  
  875. Changed display routines to update screen periodically instead of after every
  876. z80 instruction that pokes the Spectrum's display file.  Used the blitter for
  877. this, running in parallel with the z80 emulator.  (Only character rows that
  878. have changed since the last screen update are redrawn.)
  879. Reverted to single buffer display and used blitter to implement flash.  (It's
  880. smaller and faster this way.)
  881. Fixed bug where couldn't use path string in arp file requester.
  882.  
  883.  
  884. v0.4
  885.  
  886. Changed the z80 emulator to use threaded code.  Now all that is executed between
  887. each pair of z80 instructions is "move.w (a3)+,d6; jmp table(pc,d6.w)" instead
  888. of about ten 68000 instructions to decode the next z80 opcode byte.  Overheads
  889. introduced are a new 128 kbyte table giving the routine offset for every byte
  890. in z80 ram, and the necessity to write a zero word into this table every time
  891. the emulator writes to z80 ram.  The overall speed increase is about 20%.
  892. Expanded some subroutines to macros and expanded $dd and $fd prefix
  893. instructions to independent code for a slight speed increase.  A side-effect
  894. is that the executable increased in size from 27k to over 40k.
  895. Introduced some bugs during the systematic changes that are proving hard to
  896. track down.
  897.  
  898.  
  899. v0.5     7 Apr 1991
  900.  
  901. Fixed bug in "sra a" instruction.
  902. Fixed bugs in rotate and shift (ix+d) and (iy+d) instructions.
  903. Fixed bugs where used "offset(a4,rr.w)" to address z80 memory space where offset
  904. is -2, -1, 1 or 2.  (Can't use that mode because of the unlikely event of rr.w
  905. being near $8000.)
  906. Implemented mode 2 interrupts.  Low byte of interrupt vector (normally
  907. provided by an external peripheral device) is assumed to be 0.
  908. Increased the interrupt interval from 2500 instructions to every 5000
  909. instructions, because otherwise some programs with their own (mode 2)
  910. interrupt routines overflowed the stack.
  911.  
  912.  
  913. v0.6    23 Apr 1991
  914.  
  915. Fixed bugs in the following z80 instructions:
  916.     ld     ixh,b
  917.     ld    ixh,d
  918.     rl    (ix+dd)
  919.     rr    (ix+dd)
  920.     sla    (ix+dd)
  921.     cpdr
  922. and iy equivalents of the above instructions.
  923. Implemented ini, outi, ind, outd, inir, otir, indr, otdr.  (Out instructions do
  924.     nothing).
  925. Now preserve (otherwise) unused flag bits in push af, pop af and ex af,af'
  926.     (instead of setting them all to 0).
  927. Changed layout of vector table for threaded code (origin now in middle).
  928. Fixed bug in vector table wraparound code (when pc incremented from 32767 to
  929.     32768).
  930. Sped up ram writes by optimising macro for writing a byte to ram.
  931. Added processor type check.  Now you get a requester when you try to run the
  932.     wrong version for your processor type, instead of "Software Error,
  933.     Task Held".
  934. Implemented sound by opening audio.device and trapping calls to the "beeper"
  935. subroutine at $03b5 in Spectrum ROM.
  936.  
  937.  
  938. v0.7
  939.  
  940. Optimised blits to update flash attributes by keeping track of which parts of
  941. the display are flashing and updating only those parts.  That saves a lot of
  942. blits.  No blits are needed at all when there are no flashing characters
  943. displayed.  It used to redraw the entire display for every blink.
  944.  
  945.  
  946. v0.8    13 May 1991
  947.  
  948. Further optimised the display routines by adding a 6144-byte lookup table.
  949.  
  950.  
  951. v0.9    22 Jul 1991
  952.  
  953. Lower task priority to -5 at startup.  This is friendlier to other tasks
  954. because Spectrum is highly CPU intensive.  If Spectrum is running at a higher
  955. priority than another task, then that other task is completely blocked.
  956. Sped up the emulator by 5% by checking for interrupts only after branch, jump,
  957. call and return instructions, instead of after all instructions.
  958. Open gameport.device and emulate Kempston joystick (at Z80 "in" instruction
  959. level) using the rear Amiga gameport.
  960.  
  961.  
  962. v0.9b    1 Sep 1991
  963.  
  964. Implemented all the undocumented z80 sls instructions.
  965. Fixed bug in ld (nn),sp instruction.  (It didn't work at all!)
  966. Implemented the z80 n flag --- all instructions now set/reset the n flag.
  967. Fixed bugs in inc/dec (hl), inc/dec (ix+dd) & inc/dec (iy+dd) (never set v).
  968. The daa instruction now works correctly after add and sub (not just adc & sbc).
  969. Incorporated Kristian Nielson's tape load routine.
  970. Allocate/free misc.resource.
  971. Added "File already exists! Overwrite?" requester (in save snapshot).
  972. Fixed keypad 0 key.
  973. Rationalised keyboard.  Arrow keys are now equivalent to SHIFT+5/6/7/8 instead
  974. of 5/6/7/8 (without the SHIFT).
  975. ESC key quits.
  976. The halt instruction now calls WaitTOF().  (Was too fast.)  The Spectrum Basic
  977. PAUSE function now works correctly.
  978. Added a separate timer task to prevent interrupts occurring too quickly.  The
  979. "flash" rate and keyboard interrupt rates are now more constant.
  980. The HELP key now displays Spectrum.help IFF/ILBM file from current directory.
  981. Reorganised register usage in z80 emulator to try to speed it up (lots of work
  982. but not much success).
  983.  
  984.  
  985. v1.0    9 Nov 1991
  986.  
  987. Implemented menus.
  988. Added noise correction code to cassette tape loader.
  989. Added support for 2 kinds of sound samplers.
  990. Screen to front after error requester in IFF loader.
  991. Use an interrupt server instead of extra task for timer.
  992. Further optimised blitter routines.
  993. Put z80 parity byte in a register (slight speedup).
  994. Implemented ld-bytes and sa-bytes to/from disk.
  995.  
  996.  
  997. v1.1    Dec 1991
  998.  
  999. Created 68020 version (uses 68020/30/40-only addressing modes for extra speed)
  1000. Moved z80 address space to FAST RAM with a copy of 16384..22527 in CHIP RAM
  1001. (instead of having the whole Z80 address space in CHIP RAM).
  1002. Added more undocumented z80 instructions.
  1003. Sped up display routines by changing update algorithm.  Animated graphics and
  1004. scrolling are now faster by a factor of 2 or 3.
  1005.  
  1006.  
  1007. v1.2    7 Jan 1992
  1008.  
  1009. Rewrote joystick handling routines to avoid continuous polling.
  1010.  
  1011.  
  1012. v1.3    Feb 1992
  1013.  
  1014. Implemented a much faster algorithm for handling z80 prefix instructions that
  1015. was suggested to me by Richard Carlsson.
  1016. Preserve high bit of R register between LD R,A and LD A,R, and also in snapshot
  1017. files.  Tomahawk works now.
  1018. GetCC() is now documented to preserve d0/d1/a0/a1.  Fixed movesr macro.
  1019. Mode 2 interrupts assume $ff is on the external bus, not $00.  This change
  1020. fixed quite a few games.
  1021. Fixed glaring bug in "set 4,l" instruction.  Sabre Wulf, Fighter Pilot, Basil
  1022. the Detective, Athena and lots of other programs work now.
  1023. Changed implementation of daa instruction to speed up add/adc/sub/sbc instrs.
  1024. Use blitter to do comparisons as well as copies in display updater.
  1025. Sped up CPU computation of blitter attribute masks in display updater.
  1026. Display updater now translates black to bright black on the fly.  This leaves a
  1027. colour register free for the border colour (one day).
  1028. Fixed bug in display updater that caused flashing to fail sometimes.
  1029.  
  1030.  
  1031. v1.4    17 Mar 1992
  1032.  
  1033. Changed ld-bytes ROM patch entry point from $0556 to $056b to be compatible
  1034. with more programs.
  1035.  
  1036.  
  1037. v1.4a    22 Mar 1992
  1038.  
  1039. Sped up LDIR by calling CopyMem().  This nearly doubled the speed of some
  1040. programs (e.g, ManicMiner and JetsetWilly).
  1041. Increased the interrupt rate and screen refresh rate when executing lots of
  1042. large LDIRs.
  1043.  
  1044.  
  1045. v1.5    27 Dec 1992 (This version later abandoned)
  1046.  
  1047. Major revamp of z80 emulator, as suggested by several correspondents (3 days'
  1048. work).
  1049. Implemented conventional decoding scheme for z80 instructions, and did away
  1050. with threaded code tables and the overhead of updating them on every write.
  1051. 68000 and 68010 versions now use 2-instruction decode (self-modifying) as
  1052. follows:
  1053.     move.b    (a3)+,1$+2-base(a5)    ; get opcode and modify next instr
  1054. 1$:    jmp    $ff00(a5)        ; jump directly to next instruction
  1055. 68020/30/40 version uses a slightly longer macro to avoid self-modifying code.
  1056. Instruction routines are all exactly 256 bytes in size and the total size of
  1057. all 256 routines is 64 kbytes.
  1058. Added about 5 more such 64 kb blocks of code for prefixed instructions.
  1059. Managed to interleave all the 64 kb code blocks so that they effectively
  1060. reduced to a single 64 kb code block (even sharing the same base address
  1061. register but each table having a different byte-offset).
  1062. About 25 instruction routines didn't fit in their allocated space and
  1063. required long jumps to routines elsewhere.
  1064. Several features broke, including ROM write-protection, invisible ROM-hooks
  1065. for load/save/beep, (in fact I did not re-implement ROM hooks, so loading,
  1066. saving and sound did not work at all), daa mechanism, fast prefix mechanism,
  1067. potential to treat common sequences of instructions as a single instruction
  1068. with no overhead, etc.
  1069. Speed was almost exactly the same as v1.4a (which still had the broken features
  1070. intact), and there seemed to be no significant advantages.
  1071.  
  1072.  
  1073. v1.6    25 Jan 1993
  1074.  
  1075. Gave up on conventional decoding and reverted to v1.4a sources.
  1076. Implemented border colour (at last!)  Made window borderless and changed
  1077. colours.
  1078. The old "filler" byte in the snapshot file format now holds the border colour.
  1079. Added "Reset" menu item.
  1080. Changed sa-bytes ROM patch entry point from $04c2 to $04c6 to be compatible
  1081. with more programs.
  1082. The ld-bytes and sa-bytes routines were not always setting the de, ix and flag
  1083. registers on return, causing some tape-copying programs to fail.  Corrected
  1084. the problem.
  1085. File-names longer than 10 characters passed to the SAVE command could crash
  1086. the amiga.  Corrected the problem.
  1087. Added support for Rombo sound sampler (the one that comes with MegaMIX
  1088. Master).  I do not own a Rombo sound sampler and I have been unable to test
  1089. this option.  (I used information provided by a correspondent in Portugal,
  1090. who also informed me that v1.4a did not work with his Rombo sampler.)
  1091. Implemented sound at the z80 port 254, bit 4, level.
  1092. Changed keyboard handling code to precalculate the most common z80 port address
  1093. values whenever a key is pressed or released, instead of doing a full
  1094. calculation every time an "in" instruction is executed.
  1095.  
  1096.  
  1097. v1.7    7 Jun 1993
  1098.  
  1099. Sped up OUT instructions.  (Sound is noticeably higher pitched.)
  1100. Fixed bug where key-up event was lost after SAVE-ing to disk.
  1101. Applied dozens of small code optimisations suggested by Mark Knibbs, mainly
  1102. in the Z80 emulator and in the display routines.
  1103. Input from IO port 255 (or any other port than the standard ones) now
  1104. sometimes returns 0 or a video attribute from the current display,
  1105. to better emulate a real Spectrum.  It used to always return 255.
  1106. Fixed bug which caused emulator task to go into an unbreakable loop when
  1107. certain multi-byte instructions crossed the 32767/32768 address boundary.
  1108. Use ASL file-requester if available (requires OS 2.x and up for this).
  1109. Moved requesters to custom screen.
  1110. Added menu options to switch the titlebar on and off, set the task priority
  1111. and control the sound volume.
  1112. Enabled "Save to Audio", even though it doesn't seem to work properly.
  1113. Window is now a title-less backdrop window that is the width of the screen.
  1114. The close-box feature has gone.  Use menus or ESC to quit instead.
  1115. Load snapshot from CLI command-line or project icon.
  1116. Distribute Spectrum.rom with emulator.
  1117.