home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 95 / af095sub.adf / Speccylator.LZX / Speccylator / Docs / Speccylator.doc next >
Text File  |  1997-01-15  |  20KB  |  472 lines

  1. This document describes the use and distribution permissions of the program
  2. Speccylator, a Sinclair ZX Spectrum emulator. The program and this document
  3. are copyrighted (C) 1993-1997 Richard Carlsson.
  4.  
  5.    This document (the original Texinfo file, or any representation generated
  6. from it) may be reproduced and distributed in any form or processed in any
  7. way, provided no literal content, and in particular the above copyright
  8. notice and this notice of permission, is lost in the resulting product.
  9.  
  10. Speccylator Documentation
  11. *************************
  12.  
  13.    The Speccylator program emulates a Sinclair ZX Spectrum computer. It is
  14. available for Motorola MC680x0-based Amiga computers only and is copyrighted
  15. (C) 1993-1997 Richard Carlsson.
  16.  
  17. Distribution
  18. ============
  19.  
  20.    The Speccylator program itself may be distributed freely under the
  21. conditions that no fee is charged above the costs of distribution and media,
  22. and that the program is not modified in any way.
  23.  
  24.    The file `Spectrum.ROM' contains an image of the 16 kByte Sinclair ZX
  25. Spectrum ROM and it is copyright (C) Amstrad. Cliff Lawson of Amstrad
  26. (CompuServe 75300,1517) has given special permission for emulator authors
  27. to use the Spectrum's ROM code. (1)
  28.  
  29.    This documentation (the original Texinfo file, or any representation
  30. generated from it) may be reproduced and distributed in any form or
  31. processed in any way, provided no literal content, and in particular the
  32. above copyright notices and this notice of permission, is lost in the
  33. resulting product.
  34.  
  35.    The sample snapshot file `demo.sna', and other files included in the
  36. original distribution of the Speccylator program which are not covered by
  37. the above, have no restrictions whatsoever on distribution or use.
  38.  
  39.    ---------- Footnotes ----------
  40.  
  41.    (1)  This paragraph is basically a quote from the documentation of
  42. Spectrum Emulator 1.7 by Peter McGavin.
  43.  
  44. Introduction
  45. ============
  46.  
  47.    The "Speccylator" is a program that emulates the Sinclair ZX Spectrum
  48. computer. It is written for Amiga computers as an application of a generic
  49. Z80 emulator core for the Motorola M68000 family of processors. It is fast,
  50. completely multitasking and totally system-friendly. It requires at least
  51. release 2.0 of the Amiga operating system, and about 435 kByte of available
  52. RAM. It requires no particular hardware beyond that of a standard Amiga 500.
  53.  
  54.    At startup, the program attempts to load a file containing an image of
  55. the 16 kByte Sinclair ZX Spectrum ROM. (By default, this file is called
  56. `Spectrum.ROM'. See Tool Types, the `ROMFILE' Tool Type.) The file included
  57. in the Speccylator distribution is copyright (C) Amstrad. See Distribution,
  58. for details.
  59.  
  60.    The current version (1.0) of the program emulates only the 48k model of
  61. the ZX Spectrum. It reads and writes so-called "snapshot" project files on
  62. the common `.sna' format (see Snapshot files).
  63.  
  64.    The emulator uses a custom screen for the ZX Spectrum display; nothing
  65. else would be practical. The allocated custom screen has a depth of 4
  66. bitplanes and uses Lo-res resolution without interlacing.
  67.  
  68.    The program can allocate up to two audio channels, if available, for its
  69. sound generation; at most one left channel and one right channel. Both
  70. channels will receive the same output data.
  71.  
  72. Usage from Workbench
  73. ====================
  74.  
  75.    The Speccylator program can be run from the Amiga Workbench, and may be
  76. passed a single snapshot file as argument. (See the `Amiga User's Manual'
  77. for details about passing arguments from the Workbench and setting Tool
  78. Type values.) Simplest, this is done by double-clicking on the program's
  79. icon, or by similarly activating a project icon that has the Speccylator
  80. program as its default tool.
  81.  
  82. Tool Types
  83. ----------
  84.  
  85.    The following Tool Types affect the behaviour of the program. (Where they
  86. exist, abbreviations are given in addition to the standard name. However,
  87. these can only be used when running the program from the Command Line
  88. Interface. See Usage from CLI.) Booleans can be specified as `TRUE', `YES'
  89. or `ON', and `FALSE', `NO' or `OFF' respectively; these keywords are not
  90. case-dependent. If no valid right-hand value is found for a Tool Type, its
  91. original setting is unchanged.
  92.  
  93. `AUDIOCHANS'
  94. `AC'
  95.      (String.) `BOTH', `RIGHT', `LEFT', `ANY', `NONE', or any disjunction
  96.      of these; e.g., `RIGHT|LEFT' equals `BOTH'.  `BOTH' overrides `LEFT'
  97.      and `RIGHT'. `BOTH', `LEFT' and `RIGHT' override `ANY'. All of them
  98.      override `NONE'.  (Default `BOTH'.)
  99.  
  100. `DEBUG'
  101.      (Boolean.) Only available if the program was compiled with the
  102.      compilation option `DEBUG' (not in the standard distribution), this
  103.      flag makes the program run in debugging mode, which causes the user
  104.      interface to be handled by a separately launched process, while the
  105.      Z80 emulation is done by the original process.  (Default `FALSE'.)
  106.  
  107. `DIRECTORY'
  108. `DIR'
  109.      (String.) Specifies the directory in which to look for snapshot files.
  110.      If not given, the current directory is used.
  111.  
  112. `EMULPRI'
  113. `PRI'
  114.      (Integer.) The priority (-128-127) of the task running the Z80
  115.      emulation. *If not specified, the spawned task runs at the same
  116.      priority as the original process.* (The priority of the latter can be
  117.      specified from Workbench using the standard `TOOLPRI' Tool Type, or
  118.      from CLI with the `ChangeTaskPri' command.) *The recommended value is
  119.      -1 or lower.*
  120.  
  121. `GAMEPORTUNIT'
  122. `GU'
  123.      (Integer.) Amiga game port unit number for joystick use; see the
  124.      `JOYSTICK' Tool Type.  (The default value is 1.)
  125.  
  126. `INTPERIOD'
  127. `IP'
  128.      (Integer.) The period (a nonnegative number), in number of vertical
  129.      blankings (50/s for PAL, 60/s for NTSC), of the maskable interrupt (an
  130.      `INT' signal). A zero value turns the periodic interrupt triggering
  131.      off; even then, single maskable interrupts can still be triggered
  132.      manually.  (The default value is 1.)
  133.  
  134. `JOYSTICK'
  135. `JOY'
  136.      (Boolean.) If `TRUE', the Amiga game port selected by the
  137.      `GAMEPORTUNIT' Tool Type is activated, if it is available. (The
  138.      default unit is 1, the normal port for joysticks; the system generally
  139.      uses unit 0 for the mouse.) This only has effect on the emulation if a
  140.      ZX Spectrum joystick interface (such as `KEMPSTON') is also selected.
  141.      (Default `FALSE'.)
  142.  
  143. `KEMPSTON'
  144. `KI'
  145.      (Boolean.) If `TRUE', a Kempston joystick interface attached to the
  146.      extension port of the ZX Spectrum is emulated. If a game port on the
  147.      Amiga is activated by the `JOYSTICK' Tool Type, a joystick connected
  148.      to that port will appear to be connected to the emulated interface.
  149.      (Default `FALSE'.)
  150.  
  151. `ROMFILE'
  152. `ROM'
  153.      (String.) The name (relative to the current directory) of the file
  154.      containing the 16 kByte ROM image to be read into the the ZX Spectrum
  155.      memory at address 0 before emulation starts. If not specified, a file
  156.      `Spectrum.ROM' is searched for, first in the current directory and
  157.      then in the directory containing the program.
  158.  
  159. `SAVEICONS'
  160. `SI'
  161.      (Boolean.) If `TRUE', the current settings are automatically saved as
  162.      the project's default settings when snapshots are saved, and icons are
  163.      automatically created where none previously exist. See Project
  164.      settings.  (Default `TRUE'.)
  165.  
  166. `SCREENPERIOD'
  167. `SP'
  168.      (Integer.) The period (a nonnegative number), in number of vertical
  169.      blankings (50/s for PAL, 60/s for NTSC), of the Spectrum screen
  170.      refresh. A zero value turns the periodic screen updating off.  (The
  171.      default value is 1.)
  172.  
  173. `TITLEBAR'
  174. `TB'
  175.      (Boolean.) If `TRUE', the title bar of the custom screen will be
  176.      visible.  (Default `TRUE'.)
  177.  
  178. `VERIFYACTIONS'
  179. `VA'
  180.      (Boolean.) If `TRUE', selecting any potentially harmful user action,
  181.      like quitting the program, will first ask for verification before
  182.      being executed.  (Default `TRUE'.)
  183.  
  184. `VERIFYSIGNALS'
  185. `VS'
  186.      (Boolean.) If `TRUE', commands to trigger processor signals like `RES'
  187.      will first ask the user for verification before being executed.
  188.      (Default `TRUE'.)
  189.  
  190. Default program settings
  191. ------------------------
  192.  
  193.    Default program settings are saved as Tool Types in the Speccylator
  194. program icon (the `.info' file associated with the program). If no such file
  195. exists when defaults are saved, a new `.info' file will be created, using
  196. the built-in image for the program. If the file already existed, only its
  197. Tool Types are affected, and of these only the ones pertaining to the
  198. Speccylator program (see Tool Types) are modified.
  199.  
  200. Project settings
  201. ----------------
  202.  
  203.    Settings particular to individual projects override any default settings
  204. or settings specified on the command line. They are stored as Tool Types in
  205. the project icon (the `.info' file associated with the project file). If no
  206. such file exists when project settings are saved, a new `.info' file will
  207. be created analogously to the case of saving default settings.  See Default
  208. program settings. If the `Create Icons' menu option (see The Settings menu)
  209. is turned on, project settings are automatically saved when saving a
  210. snapshot.
  211.  
  212. Usage from the Command Line Interface
  213. =====================================
  214.  
  215.    The program has the following CLI template:
  216.  
  217.      SNAPSHOT, AC=AUDIOCHANS/K, DEBUG/S, NODEBUG/S, DIR=DIRECTORY/K,
  218.      PRI=EMULPRI/N, GU=GAMEPORTUNIT/N, IP=INTPERIOD/N, JOY=JOYSTICK/S,
  219.      NJOY=NOJOYSTICK/S, KI=KEMPSTON/S, NKI=NOKEMPSTON/S, ROM=ROMFILE/K,
  220.      SI=SAVEICONS/S, NSI=NOSAVEICONS/S, SP=SCREENPERIOD/N, TB=TITLEBAR/S,
  221.      NTB=NOTITLEBAR/S, VA=VERIFYACTIONS/S, NVA=NOVERIFYACTIONS/S,
  222.      VS=VERIFYSIGNALS/S, NVS=NOVERIFYSIGNALS/S
  223.  
  224.    Most options have abbreviations, and every boolean option has a
  225. corresponding negated form, whose name is `NO' (or `N' for the
  226. abbreviations) appended with the name of the positive form. The negated and
  227. abbreviated forms can only be used when running from the CLI. See Tool
  228. Types, for descriptions of the effects of these options.
  229.  
  230.    Options specified on the command line override any default settings. For
  231. instance, entering:
  232.  
  233.      Speccylator JetPac.sna PRI -1 AC ANY JOYSTICK NTB KEMPSTON
  234.  
  235. the Speccylator would attempt to load a snapshot (project) file named
  236. `JetPac.sna', and execute with Z80 emulation task priority -1, allocating a
  237. single audio channel, the joystick enabled (in the default joystick port),
  238. the titlebar hidden, and Kempston interface emulated. (This is unless the
  239. CLI options are overridden by project settings. See Project settings.)
  240.  
  241. Program operation
  242. =================
  243.  
  244.    The program is controlled via menus or corresponding short-cut keys
  245. (where such exist, they are shown in the menus). Keypresses which are not
  246. intercepted by the system or the graphical user interface are interpreted by
  247. the ZX Spectrum keyboard emulation (see Keyboard layout).
  248.  
  249. The menus
  250. ---------
  251.  
  252. The Project menu
  253. ................
  254.  
  255. `Open Snapshot...'
  256.      Opens a file requester for selecting a project snapshot file to be
  257.      loaded.  If the `DIRECTORY' Tool Type (see Tool Types) has been
  258.      specified, the requester will show that directory (if it exists);
  259.      otherwise, the program's current directory is shown.
  260.  
  261. `Save Snapshot...'
  262.      Like `Open Snapshot...', but a Save requester is opened instead. The
  263.      Z80 emulation is automatically halted during the whole of the
  264.      operation. If the `Create Icons' menu option is turned on (see The
  265.      Settings menu), the current settings are automatically saved in the
  266.      project icon file. See Project settings.
  267.  
  268. `Reload Project'
  269.      Reloads the current project, without reloading settings.
  270.  
  271. `Save Screen...'
  272.      Opens a Save requester for writing the current contents of the screen
  273.      to a file, in IFF ILBM format. The Z80 emulation is automatically
  274.      halted during the whole of the operation. No icon is created for the
  275.      image file.
  276.  
  277. `Save Settings'
  278.      Saves the current settings as the project's default settings. See
  279.      Project settings.
  280.  
  281. `Reload Settings'
  282.      Loads settings from the project's icon file (if it exists).
  283.  
  284. `Save Defaults'
  285.      Saves the current settings as the defaults. See Default program
  286.      settings.
  287.  
  288. `Reload Defaults'
  289.      Loads settings from the program's icon file (if it exists).
  290.  
  291. `Quit'
  292.      Terminates the Speccylator program.
  293.  
  294. The Settings menu
  295. .................
  296.  
  297. `Title Bar'
  298.      If turned on, the title bar of the custom screen is visible. See Tool
  299.      Types, the `TITLEBAR' Tool Type.
  300.  
  301. `Create Icons'
  302.      If turned on, the current settings are automatically saved as the
  303.      project's default settings when a snapshot is saved, and new project
  304.      icons are created where none already exist. See Project settings. Also
  305.      Tool Types, the `SAVEICONS' Tool Type.
  306.  
  307. `Verifications'
  308.      If turned on, the program asks for verification before executing any
  309.      potentially harmful user action. See Tool Types, the `VERIFYACTIONS'
  310.      Tool Type.
  311.  
  312. `Audio'
  313.      Selects the audio channels to be used (if available): `Both', `Right',
  314.      `Left', `Any' (a single channel) or `No Audio'.  The `No Audio'
  315.      submenu item can be toggled, in which case the setting prior to the
  316.      first selection is restored. See Tool Types, the `AUDIOCHANS' Tool
  317.      Type.
  318.  
  319. `Screen Updating'
  320.      Sets the refresh frequency of the ZX Spectrum screen, in percent of the
  321.      vertical blanking frequency (50 Hz for PAL, 60 Hz for NTSC), or turns
  322.      it off completely. The `Off' submenu item can be toggled, in which
  323.      case the setting prior to the first selection is restored. Values
  324.      other than those in the submenu can be set using the `SCREENPERIOD'
  325.      Tool Type. See Tool Types.
  326.  
  327. `Task Priority'
  328.      Sets the priority of the task running the Z80 emulation. Values other
  329.      than those in the submenu can be set using the `EMULPRI' Tool Type.
  330.      See Tool Types.
  331.  
  332. The Emulation menu
  333. ..................
  334.  
  335. `Pause'
  336.      When selected, all emulation (processor, interrupts, screen updating,
  337.      etc.) is halted. When deselected, everything is turned on again. All
  338.      functions are affected, even if some have been individually enabled or
  339.      disabled.
  340.  
  341. `Joystick'
  342.      If turned on, the Amiga game port selected by the `GAMEPORTUNIT' Tool
  343.      Type is activated, if it is available. (Default unit is 1, the normal
  344.      joystick port.) See Tool Types, the `JOYSTICK' Tool Type.
  345.  
  346. `INT Frequency'
  347.      Sets the frequency of the periodic maskable interrupt signal, in
  348.      percent of the vertical blanking frequency (50 Hz for PAL, 60 Hz for
  349.      NTSC), or turns it off completely. The `Off' submenu item can be
  350.      toggled, in which case the setting prior to the first selection is
  351.      restored. Values other than those in the submenu can be set using the
  352.      `INTPERIOD' Tool Type.  See Tool Types.
  353.  
  354. `Interfaces'
  355.     `Kempston'
  356.           If turned on, a Kempston joystick interface attached to the
  357.           extension port of the ZX Spectrum is emulated. If a game port on
  358.           the Amiga is activated (see the `Joystick' menu option above), a
  359.           joystick connected to that port will appear to be connected to
  360.           the emulated interface. See Tool Types, the `KEMPSTON' Tool Type.
  361.  
  362. The Processor menu
  363. ..................
  364.  
  365. `Halt'
  366.      If turned on, the Z80 emulation is halted (but other functions of the
  367.      emulation remain unaffected).
  368.  
  369. `Verifications'
  370.      If turned on, the program asks for verification before executing any
  371.      command to trigger a processor signal, like `RES'.
  372.  
  373. `INT'
  374.      Triggers the Z80's `INT' (maskable interrupt) signal.
  375.  
  376. `NMI'
  377.      Triggers the Z80's `NMI' (nonmaskable interrupt) signal.
  378.  
  379. `RES'
  380.      Triggers the Z80's `RES' (reset) signal.
  381.  
  382. Keyboard layout
  383. ***************
  384.  
  385.    The basic correspondence between the Amiga keyboard and that of the ZX
  386. Spectrum is simple: the alphanumerical Amiga keys (`A'-`Z' and `0'-`9') map
  387. directly to the same keys on the ZX Spectrum keyboard, and the Space bar to
  388. the Spectrum's Space key.
  389.  
  390.    Both Shift keys map to the Spectrum's Caps Shift key, and both Alt keys
  391. to the Symbol Shift key. When the Amiga Caps Lock is activated, the effect
  392. is that of keeping the Spectrum's Caps Shift key pressed down; when Caps
  393. Lock is turned off again, it corresponds to releasing Caps Shift.
  394.  
  395.    The Numeric pad works similarly; Enter maps to the Spectrum's Enter key,
  396. and the keys `0'-`9' map to the corresponding Spectrum keys.
  397.  
  398.    The Help key, the function keys (`F1'-`F10'), the Ctrl key and the two
  399. Amiga keys have no effect on the ZX Spectrum keyboard emulation.
  400.  
  401.    All remaining keys are mapped to sequences of keypresses on the ZX
  402. Spectrum keyboard, rather than to particular keys or symbols. Some of them
  403. can be modified by holding down a Shift key, but not all. The keys are
  404. interpreted according to the standard American keyboard (since it seems
  405. likely that most people are more or less familiar with that layout), and
  406. produce keypress sequences that yield the corresponding symbol or effect if
  407. initiated in the normal editing mode of the ZX Spectrum BASIC line editor.
  408.  
  409.    In particular, the following keys are of interest:
  410.  
  411.    * Esc: Go into E-mode.
  412.  
  413.    * Back Space and Del: Delete (Caps Shift + `0').
  414.  
  415.    * Left Arrow, Down Arrow, Up Arrow and Right Arrow: Cursor keys (Caps
  416.      Shift + `5', `6', `7' and `8', respectively).
  417.  
  418. Snapshot files
  419. **************
  420.  
  421.    A "snapshot file" is a complete machine state dump of a 48 kByte
  422. Sinclair ZX Spectrum - the RAM memory contents and the processor state. The
  423. format is also called the Mirage Microdrive format, after the piece of
  424. hardware from which it originates.
  425.  
  426.    Snapshot file names are usually suffixed with `.sna' or `.snapshot'. A
  427. publicly available program named "spconv", written by Henk de Groot, can be
  428. used to convert such files to and from other snapshot formats, such as the
  429. common `.Z80' format.
  430.  
  431. The snapshot format
  432. -------------------
  433.  
  434.    A snapshot reflects the state of the machine after the occurrence of a
  435. non-maskable interrupt. Thus, the 2 bytes on top of the stack (the address
  436. pointed to by the saved stack pointer, and the next higher address) form the
  437. address to which the program counter was pointing when the interrupt
  438. occurred - this is always the address of the instruction which was to be
  439. executed next. The lower stack address contains the least significant byte
  440. (bits 0-7) of the program counter, and the higher address the most
  441. significant byte (bits 8-15); this is how 16-bit words are always handled
  442. in the Z80.
  443.  
  444.    The first 27 bytes of the snapshot file hold the saved processor and
  445. hardware state, at the following offsets (16-bit registers stored with the
  446. least significant byte first; for e.g. the register pair `HL', this is the
  447. 8-bit register `L'):
  448.  
  449.      Offset  Name  Comment
  450.      
  451.       0:     I     (8-bit register)
  452.       1:     H'L'  (16-bit register pair)
  453.       3:     D'E'  (16-bit register pair)
  454.       5:     B'C'  (16-bit register pair)
  455.       7:     A'F'  (16-bit register pair)
  456.       9:     HL    (16-bit register pair)
  457.      11:     DE    (16-bit register pair)
  458.      13:     BC    (16-bit register pair)
  459.      15:     IY    (16-bit register)
  460.      17:     IX    (16-bit register)
  461.      19:     ---   (8 bits): Bit 2 set if maskable interrupts are enabled.
  462.      20:     R     (8-bit register)
  463.      21:     AF    (16-bit register)
  464.      23:     SP    (16-bit register): The stack pointer
  465.      25:     ---   (8 bits): Interrupt mode: 0, 1 or 2.
  466.      26:     ---   (8 bits): Border colour (0-7) in bits 0-2.
  467.  
  468.    Directly after this (at offset 27 from the start of the file) follow the
  469. contents of the 48 kByte RAM (located at addresses 16384-65535) of the
  470. machine at the time the nonmaskable interrupt occurred.
  471.  
  472.