                         Amiga SPectrum emulator
                         =======================
                                 V0.71
                                 =====
                        (c) Ian Greenway 1999,2000
                        

Introduction:
-------------

  This is a Sinclair ZX Spectrum 48K emulator for Amiga computers.  It is aimed
  mainly at those emulation enthusiasts who enjoy old games or demos for
  nostalgic reasons. It is system compliant and multitasks.
  
  ASp is a very easy program to use, but there are a couple of points to be
  aware of. If you run into problems, please read at least the "Requirements"
  and "Limitations" sections of this ReadMe.
  

New For This Version:
---------------------

  The sound handling is now FIXED! The last (V0.70) release introduced new
  audio.device usage which caused unpleasant buzzing and clicking if the
  emulation dropped below full speed.  The new code reverts to direct "hardware
  bashing" but is still system compliant and it *works*. :-)  The audio channel
  is still allocated via audio.device and you can still run multiple copies of
  ASp simultaneously.
  
  By popular demand, there are now ToolTypes available which allow you to
  specify the initial Load and Save directories, as well as the ROM file name.
  
  Also by popular demand there is a Reload button which instantly reverts to the
  last snapshot loaded.  Also I added a Rewind button, which is kind of the
  same thing for TAP files.
  
  There are F-key shortcuts for Load, Reload, Save and Reset which work whether
  the emulation is running or not.
  
  Clicking on the System Screen display no longer deactivates input.
  

   See Version History for others.
  

Requirements:
-------------

  As an absolute minimum you need a 68020 and WB3.0 (V39).
  Native chipset, OCS/ECS/AGA, is required. Gfx cards not supported yet.
  About 350K of free ram.
  
  You also *NEED* the "spectrum.rom" image file.  If it was not in this
  archive, you can download it from various places on the internet, including
  the ASp support page. (See below).
  
  To get any sort of realistic performance you will need at least a very fast
  68030.  A 50MHz 68030 runs BASIC at about 85% the speed of a real Spectrum.
  This is adequate for simple games like Manic Miner, JSW, etc. Faster machines
  will automatically regulate their speed so they run the same speed as a real
  Spectrum. Any spare CPU time is available for other tasks in the Amiga system.
  
  
How To Use:
-----------

  Very easy! Just copy ASp and the spectrum.rom file anywhere you want. You can
  run ASp from the Shell or the Workbench.
  
  If no GUI appears, there has been some serious initialisation error. Check
  you have enough RAM and all system libraries installed.

  The GUI contains various (hopefully) self-explanatory gadgets.  A brief 
  explanation follows:
  
  
  RUN: If the emulation is stopped, this will start it. Will either continue
   from where it was stopped or will run the just-loaded snapshot. After a Reset
   this will behave as a real Spectrum would if you had just plugged it in.
    
  STOP: You can press this or the Escape key to pause the emulation.

  Reset (F10): Will perform a complete reset of the internal state of the
   emulator, losing any program or data in it. Same effect as unplugging a real
   Spectrum.

  Load (F1): This will allow you to load a ".SNA" or ".Z80" snapshot file. If
   the load fails, an error will be displayed and the previous program in the
   emulator is unaffected.
  
  Reload (F2): This instantly reverts the emulator to the state of the last
   successfully loaded snapshot.  If a snapshot load fails, this function will
   not be available.
  
  Save (F3): This saves the instantaneous state of the emulator to a ".SNA"
   Mirage snapshot which can be reloaded at a later time.  Most other Spectrum
   emulators will also load these files.
  
  Insert: This is like a tape deck. This will allow you to select a ".TAP" file
   which the Spectrum will treat as an audio tape to load. Whenever the Spectrum
   tries to read the tape (eg. after you enter LOAD "") it will try to load from
   this file.  If you haven't selected a file yet, or the tape runs to its end
   it will ask you for another file.
  
  Eject: This removes the ".TAP" file from the virtual tape deck.

  Rewind: This sets the current position in the TAP file to the start. Same as
   inserting the same file again.

  Display Type: Select either Custom AGA Display or OCS/ECS System Screen.
  
  To quit ASp, close its window.
  
  
  Please be aware that, as with all true emulators, no matter how badly the
  "Spectrum" crashes, the Amiga system should remain unaffected and you should
  be able to return to Workbench where you can Reset or Re-Load.
  
  Key mapping is as per a normal Spectrum, ie: a UK keymap. ALT keys are Symbol
  Shift. Cursors, numeric keypad and various symbols work as shortcuts.
  Be aware that A1200 keyboards and some PC keyboard adaptors do not like some
  multiple key combinations.  This is a limitation of the keyboard controller,
  not of ASp. For A1200, you could try redefining keys to 3,E,J,K,space for
  example.  Planned addition of a "key" joystick should overcome most such
  problems in a future version.


Features:
---------

  - 100% sytstem-compliant.
  
  - Multitasks in all modes.
  
  - Small, easy to use, authentic.
  
  - Comprehensive speed-regulated Z80 CPU emulation core which includes all
    undocumented instructions and most undocumented flag behaviour.
  
  - Genuine Spectrum-like display with support for BRIGHT and clean FLASH.
  
  - Stabilised sound (48K and AY-3-8912) synched to CPU T-states.
  
  - Direct Kempston joystick support via normal Amiga gameport.
  

  See http://www.greew.freeserve.co.uk/ for latest info and updates.        
          
  


Limitations and Genral Info:
----------------------------
  
  ASp will load snapshots of type ".SNA" (Mirage) or ".Z80" (48K only). It will
  only save type ".SNA".  Powerpacker compressed files, as saved by ZXAM, are
  not yet supported. For the time being you could use the MCP Crunchloader 
  patch on task "ASp". (Or some other transparent file depacker.)
    
  Currently screen updates, including border effects, are not synchronised
  to the Amiga display hardware.  This means that border stripe effects will not
  work and sprites may glitch or disappear periodically.  This requires a lot
  of effort to overcome, and may slow the emulation down too much on slower
  machines.  Work is being done on this.
 
  128K memory model is being developed for MMU-equipped machines. A non-MMU
  version MAY appear, but much later..
  

About the AGA Custom Display:

  The Amiga has some comprehensive display hardware which can be programmed to
  provide a video display that requires considerably less decode overheads than
  a conventional display for this application.  Unfortunately it is very
  difficult, if not impossible, to persuade the Amiga OS to provide this level
  of display hardware flexibility.  This means ASp "takes over" the display in
  this mode.
  
  For the purists who don't like the sound of that, there is a 100% system-
  friendly screen option. It requires up to 8 times longer to update the
  display so may cause a slowdown under some circumstances especially on slower
  machines.  In most applications however, it is fine.
  
  Despite the AGA display being system "unfriendly", it is still entirely
  system compliant according to the official documentation. Neither multitasking
  nor interrupts are affected and all the rest of the program continues to
  operate in the normal system-friendly way.
  
  It is not advisable to run programs in the background that need prompt
  attention, or which themselves may take over the display hardware.


About the Sound:

  V0.71+ contains what must be about the fifth complete rewrite of the sound
  handling code.  I believe it finally works properly!  When the Amiga is
  running fast enough for the emulation to be full speed you should get
  perfectly smooth sound. If the speed drops, ASp will insert short gaps into
  the sound output causing a sort of warbling effect. It should NOT click or
  buzz like in earlier versions.
  
  The ASp code directly accesses the sound hardware. This is only done after
  correctly allocating the channel and interrupts in the system-approved way.
  This is the only way I can persuade it to work correctly, it should cause no
  problems in a system compliant environment.
  

About the TAP loader:

  The emulator will try to load TAP files *only* if the ROM load routine is
  accessed. Custom loaders will not work.  This means that some multiloading
  games will work (eg. Gauntlet) and others wont (eg. OutRun).
  
  Having said that, OutRun will load as far as its intro screen which has some
  pretty good AY-3-8912 music which works ok even on slower machines.
  
  "Insert"ing a TAP file into the emulator does not actually cause the program
  to run.  You have to type LOAD "" or otherwise ask the Spectrum to access the
  tape.  The Eject function is only included for completeness, it is not
  necessary to eject a TAP before inserting a new one or quitting ASp.
  
  If you use a modified ROM file, the TAP loader may not work as it relies on
  certain opcodes relating to tape loading being in the right places..


About the AY-3-8912 emulation:

  The AY sound chip is found in 128K Spectrums. At the moment, ASp will only
  emulate a 48K Spectrum.  However, many pieces of software use the sound chip
  even in 48K mode resulting in much better audio.
  
  I believe ASp is the first Amiga emulator to correctly and fully support the
  AY chip. All three tone channels and the noise channel are implemented with
  the correct mixing logic. Volume enveloping and 4-bit "sample" mode also work.
  A fairly fast machine is required to hear clean sound in sample mode.


About running multiple copies of ASp:

  As of V0.70 it is possible to run as many copies of ASp as you want, limited
  only by system memory. (Each copy will eat about 55K of chipram and 300K of
  fastram.)
 
  Every time you ask a copy to RUN the emulation, it will try to allocate an
  audio channel. ASp will try to steal the channels even if they are in use by
  another program, but can still be blocked. So you have a theoretical maximum
  of four available audio channels allowing a maximum of four emulations running
  simulataneously.  Of course, whether they will all run at top speed or with
  clean sound is another thing altogether. :-) A fast 68060 will manage about
  three simultaneously.

About the ToolTypes:

  You can add tooltypes to ASp's icon which will be read on startup. It doesn't
  matter whether it's started from the WB or CLI.

  LOADPATH is the directory the Load and Insert file requester will initially
   open at. Default is nothing, which is the directory from which ASp was run.

  SAVEPATH is the directory the Save file requester will initially use. Default
   is "RAM:".
  
  ROMFILE is the directory and filename of the ROM file you want to use. This
   file must be exactly 16384 bytes long. If it isn't a real ROM you will find
   strange things happen!  Defaults to "PROGDIR:Spectrum.ROM".
   


Other Stuff:
------------

  This program is Freeware. You may freely redistribute the archive in its
  entirety, no files may be added, removed or modified. You may not redistribute
  it for profit. The copyright remains with me, the author. You use this program
  entirely at your own risk. No responsibility is accepted by the author for
  damages caused by this program.


Contact and Support:
--------------------

PLEASE email me with any comments, suggestions or problems you have, at..

    iang@ukonline.co.uk

There is support available on my website, where you can find the latest version,
program information, the rom file, etc..

    http://www.greew.freeserve.co.uk/

You may see me around on ArcNET IRC channels as "Laser". Feel free to talk to
me about ASp.


Thanks for trying ASp!


Credits:
--------

Various people and sources of information have been very helpful during the
creation of this program. Thanks and acknowldegments to them all:

  Stephen Brookes         Mac Buster
  
  Lee Cook                David Cripps

  Martijn van der Heide   Thomas Richter
  
  Mario Sarno             Gerard Sweeney
  
  and others.....
  
  
  Information from:
  
  A Z80 Workshop Manual - E.A. Parr
  
  MC68030 User's Manual - Motorola
  
  The "TechInfo.doc" from the "Z80" emulator - Gerton Lunter.
  
  Various anonymous documents on the internet.
  
  And my trusty rubber-keyed Spectrum 48K, of course!
  


  ASp has been written from scratch in 680x0 asm using HiSoft's Devpac 3.18.
  Some of the data structures have been created in TurboCalc2 and processed
  using programs I've compiled with VBCC.


  NewIcon images by Lee Cook. Thanks Lee!


History:
========

  V0.71:  Fix: Rewrote sound handling. No longer uses audio.device calls.
          Added ToolTypes: LOADPATH, SAVEPATH, ROMFILE.
          Added Reload and Rewind functions.
          Key shortcuts for Load, Save, Reload, Reset.
          System screen now *activates* input!
          Fixed "." on numeric pad.
          Test for AGA chipset.
          Filerequesters are a bit nicer.
          Inactive GUI buttons are ghosted.
          Some potential deadlocks removed.

  V0.70:  Speeded up sound routines.
          Now all audio goes through audio.device! 100% system friendly.
          Allows running multiple copies at once. :)
          Add emulation of INI/OUTI/IND/OUTD.
          Generalised i/o port decoding.

  V0.69:  Internal Test Version. Added AY-3-8912 sound emulation.

  V0.68:  Beta Release only. Limited ".TAP" loading support.

  V0.67:  Now has choice of Custom AGA Display or Native System Screen.
          GUI: Added STOP button and Display-Type cycle gadget.
          Can now Load/Save/Reset even if emulator is running.
          Now requires WB3.0 (V39) or above.
          Lee Cook contributed an alternative NewIcon. Thanks!
          
  V0.65-V0.66: Internal.

  V0.64:  Interim bugfix release:
          Fixed a nasty enforcer hit in the .SNA loader! Oops! :-)
          Added facility to load ".Z80" files, versions 1, 2 & 3, 48K type only.

  V0.63:  Added some error requestors.
          Fiddled around with parts of the source to aid future updates.
  
  V0.62B: Made emulation code more regular at minor cost in speed on '030.
          First public release.

