home *** CD-ROM | disk | FTP | other *** search
/ TopWare Tools / TOOLS.iso / tools / top1290 / cpcemu_e.doc next >
Encoding:
Text File  |  1993-09-07  |  36.4 KB  |  1,109 lines

  1.  ****************************************************************************
  2.  *                                                                          *
  3.  *      Documentation for CPCEMU (v0.8) - the CPC-Emulator for the PC        *
  4.  *                                                                          *
  5.  ****************************************************************************
  6.  
  7. This is the english documentation for CPCEMU , for the german one consult
  8. CPCEMU_G.DOC.
  9.  
  10.  
  11. If you have questions or suggestions, write to
  12.  
  13.     Marco Vieth
  14.     Auf dem Uekern 4
  15.     33165 Lichtenau
  16.     (Germany)
  17.  
  18.     Or by e-mail :
  19.     ali@uni-paderborn.de
  20.  
  21.  
  22.  
  23. 1. IMPORTANT :
  24. ==============
  25.  
  26.     CPCEMU is Copyright 1993 by Marco Vieth, Auf dem Uekern 4,
  27.     33165 Lichtenau, Germany.
  28.     Telephone: (...) 05292/1366
  29.     Internet address:
  30.     ali@uni-paderborn.de
  31.  
  32.     This document and the files listed herein may be freely copied
  33.     without charge, provided copyright notices are left intact. All
  34.     software and documentation is provided "as is" without warranty
  35.     of any kind.
  36.  
  37.     Although this program is freeware, I would certainly accept
  38.     any sort of support, financial or ideal.
  39.  
  40.  
  41.  
  42. 2. INTRODUCTION:
  43. ================
  44.  
  45.  
  46. 2.1  For what purpose is an emulator ?
  47. --------------------------------------
  48.  
  49.     There was (and is) much discussion about speed augmentation
  50.     of older computers, p.ex. by replacing a slow CPU by a faster
  51.     one, but mostly this is impossible (maybe caused by timing-
  52.     problems).
  53.     So why don't we take a much more powerful system as platform
  54.     for running an emulation ?
  55.     With progress in developement of new computer systems our
  56.     old one is automatically improved, not only in speed, also
  57.     concerning ergonomy (p.ex. 70 Hz screen, comfortable keyboard)
  58.     and other advantages (p.ex. a hard-disc).
  59.     Besides, it is a great pity not to be able to use your self-
  60.     written programs on the new computer any more.
  61.     Some years ago, I thought of an EPROM-simulator for testing
  62.     EPROM-code in RAM. This is no problem with this emulator.
  63.     It is at least fascinating to see old programs running on a
  64.     total different computer.
  65.     This all (and much more) offers you an emulator like CPCEMU.
  66.  
  67.  
  68. 2.2  What is a CPC ?
  69. --------------------
  70.  
  71.     To keep it short:
  72.     The AMSTRAD-CPC (Colour Personal Computer) has an 8 bit design
  73.     with Z80A CPU, 3" disc drive, the operating systems AMSDOS
  74.     (sometimes called as Advanced MSDOS, but it is rather
  75.     AMSTRAD DOS), CP/M 2.2 and CP/M Plus.
  76.     A powerful BASIC is implemented, with wich you can utilize
  77.     most hardware qualities.
  78.     For more information consult appendix "Information about the
  79.     CPC" (A1.6).
  80.  
  81.  
  82. 2.3  What is CPCEMU ?
  83. ---------------------
  84.  
  85.     CPCEMU is the first emulator of the CPC computers you can take
  86.     seriously.
  87.     On a 386/33, the emulation is nearly as fast as the original,
  88.     provided that you use little banking.
  89.  
  90.     CPCEMU is written in C and assembler, using Borland 3.1 (with
  91.     80386 code) and TASM.
  92.  
  93.  
  94.  
  95. 3.  REQUIREMENTS FOR CPCEMU :
  96. =============================
  97.  
  98.  
  99. 3.1  Hard- and software requirements :
  100. -------------------------------------
  101.  
  102.     - PC (at least a 386, as usual no limits to more)
  103.     - VGA graphics
  104.  
  105.     - MSDOS (DRDOS hardly supposed)  or
  106.     - OS/2 2.x dos-box
  107.  
  108.  
  109. 3.2  Files which comprise the CPCEMU package :
  110. ----------------------------------------------
  111.  
  112.     CPCEMU.CFG    configuration-file (6.4)
  113.     CPCEMU_E.DOC    this file
  114.     CPCEMU_G.DOC    german documentation
  115.     CPCEMU.EXE    the executable (4.1)
  116.  
  117.     CPCPD1.DSK    example-disk with PD-programs (6.2)
  118.  
  119.     CPCREAD.C    source to CPCREAD.EXE
  120.     CPCREAD.EXE    programm for reading CPC-disks (6.2)
  121.  
  122.     CPMDISKS.DEF    file with CPC-format-definitions for
  123.             22DISK (4.2.1)
  124.  
  125.     INSTALL.BAT    installation program (4.1)
  126.  
  127.     PARALLEL.PAS    transfer program for a parallel interface
  128.             (4.2.2)
  129.  
  130.     README_E.DOC    englisch README
  131.     README_G.DOC    german README
  132.  
  133.     ROMGET.ASC    CPC-BASIC programm to save the ROMs (4.2.1)
  134.  
  135.     Z80CPC.ROM    the "Need-ROM" (4.3)
  136.     Z80DISK.ROM    the program "Copymate" (not used)
  137.     (Replace this ROMs by the original ones.)
  138.  
  139.  
  140. 4. INSTALLATION :
  141. =================
  142.  
  143. 4.1  Installation of CPCEMU :
  144. -----------------------------
  145.  
  146.     Maybe you have done it already :
  147.     Simply copy the archive CPCEMUxx.xxx into a directory of your
  148.     hard-disc and decompress it.
  149.     After that, use INSTALL.BAT, which creates the three
  150.     subdirectories ROM, TAPE, DISC with the necessary files in it,
  151.     where CPCEMU looks for ROM-images, "tape"-files and disc-images.
  152.     Now you can start CPCEMU.EXE, but wait ...
  153.  
  154.  
  155. 4.2  How to get a ROM ?
  156. -----------------------
  157.  
  158.     Problem :
  159.     ---------
  160.     The original CPC-ROMs are NOT enclosed !
  161.     Unfortunately, AMSTRAD has not allowed me to include them. For
  162.     more information look at appendix "Letter from AMSTRAD"    (A1.7).
  163.     So you are forced to get the ROMs from somewhere else.
  164.     In the following some possibilities :
  165.  
  166.     4.2.1  If you have a CPC with 5.25" or 3.5" disc-drive :
  167.     --------------------------------------------------------
  168.     With the 22DISK-utility by SYDEX you are able to read and write
  169.     user-defined formats. I have included a specification for the
  170.     CPC-formats.
  171.     Simply copy the file ROMGET.ASC (a program to save the CPC-ROMs)
  172.     onto a CPC-disc, run to your CPC and run the program.
  173.     The ROMs OS, BASIC and AMSDOS are saved automatically (if
  174.     present). Back on the PC, copy them into the directory .\ROM .
  175.     If you own other ROMs, you can also copy them, after a small
  176.     modification of ROMGET.ASC . Besides, you can "rescue" all
  177.     your CPC-programs in this way.
  178.  
  179.  
  180.     4.2.2  With a parallel interface :
  181.     ----------------------------------
  182.     After you have constructed a special centronics-cable and joined
  183.     CPC and PC together, you can use the transfer-program written by
  184.     Gilles Molinari. In the file PARALLEL.PAS you can find the two
  185.     pascal-sources getfile.pas and sendfile.pas .
  186.  
  187.  
  188.     4.2.3  With a serial interface :
  189.     --------------------------------
  190.     I think, it is as easy as the other possibilities, but I have
  191.     not tried it.
  192.  
  193.  
  194.     4.2.4  Nothing of the kind :
  195.     ----------------------------
  196.     Well, what can you do to enjoy a CPC ?
  197.     - Type the ROM in your computer, maybe from a CPC-ROM-listing.
  198.     - Write your own small operating system (that's only for
  199.       professionals, I think, but I would be glad to receive a copy)
  200.     - Write an advertisement in a computer-magazine with the
  201.       following writing:
  202.         "Who can copy me the CPC-ROM ?"
  203.       ( In a special magazine, someone tries this already the second
  204.         time, it seems, he didn't succeed yet. Why not ? )
  205.     - Ask AMSTRAD for the ROMs (maybe you've more success)
  206.     But I cannot recommend this really.
  207.     Be inventive ...
  208.             ... and use the "Need-Rom" so long.
  209.  
  210.  
  211.  
  212. 4.3  The "Need - ROM" :
  213. ---------------------
  214.  
  215.     For people suffering want (those without the CPC-ROMs),
  216.     I have included a so-called "Need-ROM".
  217.     It is located in the .\ROM-directory after installation and
  218.     is used automatically, if no other ROMs are present under the
  219.     same name.
  220.     It contains only a program, which is total independend from
  221.     the original ROMs (except for thr character-set).
  222.     It is certainly not a satisfactory replacement.
  223.  
  224.  
  225.  
  226. 5.  THE SOFTWARE - CPC :
  227. ======================
  228.  
  229.  
  230. 5.1  The first time :
  231. ---------------------
  232.  
  233.     Congratulations, you have mastered the biggest hurdle before
  234.     using the emulator ingeniously.
  235.     (Therefore you have copied the CPC-ROMs into the .\ROM -
  236.       directory.)
  237.     Execute CPCEMU.EXE, the configuration is loaded, the memory
  238.     is initialized and -- fasten your seat-belts -- the software-
  239.     CPC starts ...
  240.     (To get back to reality, consult appendix
  241.     "Command line parameters" (A1.1).)
  242.  
  243.     The CPC-opening-screen appears and you can do all you know from
  244.     a real CPC.
  245.     F10 interrupts the emulation (you get into the debug-menu),
  246.     'r' continues and 'q' quits.
  247.     Consult appendix "The Debug-Menu" (A1.2).
  248.     However, you must consider some features ...
  249.  
  250.  
  251.  
  252. 6. FEATURES :
  253. =============
  254.  
  255.  
  256. 6.1  The Keyboard :
  257. -------------------
  258.  
  259.     Maybe you have already noticed that some keys react in a
  260.     different way you have expected them to do. The supposed
  261.     output on the screen differs from the lettering on the
  262.     key you have pressed.
  263.     The reason is that the CPC-keyboard-layout is physically
  264.     mapped to that of the PC. This enables all key-combinations.
  265.     If necessary, you must "try and error" with the motto
  266.     "searching and finding".
  267.     There are really all CPC-keys located somewhere (even one
  268.     more, the "secret key").
  269.  
  270.     6.1.1  Special Keys :
  271.     ---------------------
  272.     - ALT, ALTgr : COPY
  273.  
  274.     - F1 - F12 : special functions, in detail :
  275.       F1 :         Help (possibly this text appears)
  276.       F2 :         toggles between CPC-screen (standard view) and
  277.              message-screen (that one with a red border). On the
  278.              latter some messages appear, among other things the
  279.              cassette - catalogue.
  280.       F3 :       Insert a disk. A file from DISC_PATH is displayed
  281.              and you can select it with 'A' <Ret> or 'B' Ret
  282.              for drive A or B. (Not very comfortable.)
  283.              Please don't use this, if the disc is currently
  284.                      in use.
  285.       F4 - F7 :  reserved for future usages
  286.       F8 :       hard-reset (like reset-button for CPC)
  287.              (use this, if CTRL/SHIFT/ESC hangs)
  288.       F9 :       reserved for future usage
  289.       F10 :      debug-menu (look at appendix "The debug-menu"
  290.              (A1.2) )
  291.       F11 - F12: reserved for future usages
  292.  
  293.     - At this point, you will maybe ask, where to find the CPC -
  294.       function-keys. Try the Keypad :
  295.       With 'Num-Lock on', the keypad represents the function-keys of
  296.       the CPC, otherwise the joystick.
  297.  
  298.     - The joystick :
  299.       In addition to the keypad you can use an analog PC-joystick.
  300.       Include "USE_JOYSTICK = YES" in the configuration-file (see
  301.       below). Then you can use a joystick, if one is present.
  302.       Note, that you can always use the "keypad-joystick".
  303.       ( Unfortunately, my current joystick-routine is too slow,
  304.         so you can only use the fire-buttons .)
  305.  
  306.     - The PAUSE-Key holds the PC until it is pressed again.
  307.  
  308.  
  309. 6.2  The Disc-Drive :
  310. ---------------------
  311.  
  312.     Disc-accesses managed by the FDC (Floppy Disc Controller) are
  313.     redirected to a file specified in the configuration-file
  314.     (see below : DISC_PATH + DRV_A respectively DRV_B).
  315.     By using the program CPCREAD you can create such files from
  316.     CPC-discs yourself.
  317.         The file CPCPD1.DSK contains some example PD-programs.
  318.     Look at appendix "Structure of Disc-Images" (A1.4).
  319.  
  320.  
  321. 6.3  The Tape :
  322. ---------------
  323.  
  324.     After the '|TAPE'-command, or if you don't own an AMSDOS-ROM,
  325.     the "tape" is addressed. Tape-access is transformed into file-
  326.     access in the directory TAPE_PATH (see configuration-file).
  327.     By the way, the CATalogue appears on the message-screen
  328.     (use F2 to toggle view).
  329.     Non-ASCII files have included a preceding AMSDOS-header.
  330.     Look at appendix "Structure of the AMSDOS-header" (A1.5).
  331.     This bypass is realized by a ROM-modification, which is
  332.     described in appendix "Function of the ROM-bypass" (A1.3).
  333.     At this point you only need to know, that for cassette-usage
  334.     this bypass must be enabled by the entry 'TAPE_BYPASS = YES'
  335.     in the configuration-file ...
  336.  
  337.  
  338. 6.4  The Configuration - File :
  339. -------------------------------
  340.  
  341.     Now the mystic configuration-file is described, but it is not
  342.     mystic at all.
  343.  
  344.     In general :
  345.     ------------
  346.     The configuration - file CPCEMU.CFG should be located in the
  347.     same directory as CPCEMU.EXE .
  348.     Comments are introduced by a semicolon ';', the rest of the
  349.     line is ignored.
  350.     Blanks, tabs, newlines and ';' are delimiters, they can be used
  351.     between identifiers and values as many as you like.
  352.     Many of the definitions have the syntactical form
  353.         <identifier> {T} '=' {T} <value> {T}
  354.     {T} is a sequence of at least one delimiter.
  355.     Example :
  356.     'ROM_PATH = .\ROM'
  357.     Not allowed is 'ROM_PATH=.\ROM' because of missing delimiters.
  358.     If you don't want to (re-)define an identifier, make a comment
  359.     by writing a ';' in front of it; not allowed is
  360.     'ROM_PATH = <nothing>' .
  361.  
  362.     The following constructs are used sometimes :
  363.     <number> can be given decimal or hexadecimal (with 0x).
  364.     <pathname> may have a length up to 60 characters and
  365.     <filename> up to 20 characters.
  366.  
  367.  
  368.     Valid identifiers :
  369.     -------------------
  370.     The values in brackets are default-values, if the referred
  371.     identifier is not redefined.
  372.  
  373.     SHOW_CONFIG = {YES,NO}        (YES)
  374.       To suppress the configuration-message after starting the
  375.       emulation. If some errors occured during startup, the
  376.       configuration is always displayed.
  377.  
  378.     ROM_PATH = <pathname>        (.\ROM)
  379.       Sets the path to ROM-images. (See also identifier ROM_BLOCKS.)
  380.  
  381.     TAPE_PATH = <pathname>        (.\TAPE)
  382.       Sets the path to "tape"-files.
  383.       (Also used in debug-menu during load, save; look at appendix
  384.        "The Debug-Menu" (A1.2).)
  385.  
  386.     DISC_PATH = <pathname>        (.\DISC)
  387.       Sets the path to disc-images. (See also ident. DRV_A, DRV_B.)
  388.  
  389.     DRV_A = <filename>        (DISC1.DSK)
  390.       The disc actually inserted in drive A (a disc-image file
  391.       in the DISC_PATH - directory).
  392.  
  393.     DRV_B = <filename>        ()
  394.       Same as DRV_A, but for drive B.
  395.  
  396.     PRINTER = <filename>        (PRINTER.PRN)
  397.       A file in TAPE_PATH for lineprinter output.
  398.       It is created at every emulation-start.
  399.  
  400.     TAPE_BYPASS = {YES,NO}        (YES)
  401.       Enables (or disables) the ROM-bypass of the tape-vectors, if
  402.       a known ROM from a CPC 464/664/6128 is found.
  403.       This bypass is necassary, if you want to use tape - files.
  404.       Look at "The Tape" (6.3) and appendix "Function of the
  405.       ROM-bypass" (A1.3).
  406.  
  407.     DISC_BYPASS = {YES,NO}        (NO)
  408.       Enables (or disables) the AMSDOS-ROM-bypass to suppress
  409.       patching of tape-vectors by the AMSDOS-ROM.
  410.       (So the tape-vectors are still pointing to tape, although
  411.       the AMSDOS-ROM is initialized.)
  412.       This is necessary, if you want continue loading from tape
  413.       after a disc-reset, but without giving the '|TAPE'-command
  414.       first.
  415.       (It is done by 'poke &CCF2,&18 : poke &CCF3,&05' in
  416.       AMSDOS-ROM.)
  417.       Sector-instructions are not affected, they always address the
  418.       disc.
  419.  
  420.     DISC_SPEEDUP = {YES,NO}        (YES)
  421.       Enables (or disables) a AMSDOS-ROM modification, which
  422.       minimizes the motor waiting times to render a faster disc-
  423.       access. (The things are managed by DOS, so we needn't the
  424.       delay loops.)
  425.       (The following bytes are modified in AMSDOS-ROM :
  426.         poke &C5D4,&01    :'motor load-time
  427.         poke &C5D8,&01    :'format trk-time
  428.         poke &C5D9,&01    :'short wait
  429.         poke &C5DA,&01    :'short wait
  430.         poke &C602,&01    :'only 1 retry on error
  431.         poke &C784,&01    :'fast seek
  432.         poke &C7E2,&01    :'fast seek    )
  433.  
  434.     USE_JOYSTICK = {YES,NO}        (YES)
  435.       Enables (or disables) a PC-joystick, if present.
  436.       You can always use the "keypad-joystick".
  437.  
  438.     VSYNC_CT = <number>        (1)
  439.       Sets the count, how often the PIO-port B must be asked, until
  440.       the vsync-bit toggles. In reality, this bit is only set
  441.       during vertical frame-fly. Possible values range from 1 to 255.
  442.  
  443.     GENINT = <number>        (300)
  444.       Sets the frequency of interrupt gereration (in Hz).
  445.       In a CPC it is always 300 Hz. On slow computers, this value
  446.       may be decreased to 100 (and SCR_UPD_CT to 2).
  447.       Possible values are 18 Hz to ca. 600 Hz.
  448.  
  449.     SCR_UPD_CT = <number>        (6)
  450.       Sets the screen-update counter. Every <number> interrupts the
  451.       screen is updated, if necessary. With GENINT = 300 and
  452.       SCR_UPD_CT = 6, the screen is updated 50 times per second.
  453.       (Valid values: 1-255).
  454.  
  455.     PORT_B = <value>        (0x3F)
  456.       Sets the input-value "lying" at port B of the PIO.
  457.       You can disable the printer, or select another company name.
  458.       By changing this value to 0x3B, you get "Schneider" instead
  459.       of "Amstrad" (0x3F) on the opening screen.
  460.  
  461.       Meaning of the bits:
  462.         b7 = 0    (TTL-signals from tape; not used)
  463.         b6 = 0    (0 = printer ready, 1 = busy)
  464.         b5 = 1    (EXP-signal)
  465.         b4 = 1      (1 = vsync with 50 Hz or  0 = with 60 Hz; not used)
  466.         b3,b2,b1 = 111
  467.           select company :
  468.           Isp (000), Triumph(001), Saisho(010), Solavox(011),
  469.           Awa(100), Schneider(101), Orion(110), Amstrad(111)
  470.         b0 = 1      (vsync : toggles between 0 and 1 in the emulator,
  471.              the duration depends on VSYNC_CT.)
  472.  
  473.  
  474.     ROM_BLOCKS = <number> {T}    (0)
  475.     <ROM-number> {T} <filename> {T} <offset> {T}
  476.             (repeat this line <number> - times !)
  477.  
  478.       Describes, which ROMs should be loaded :
  479.  
  480.       - <number> is the number of ROMs to load. Every ROM has a size
  481.         of 0x4000 bytes. (<number> ranges from 0 to ca. 8, depending
  482.         on the free memory left.)
  483.  
  484.       - <ROM-number> is the number assigned to the ROM, that means,
  485.         it is selected by 'OUT &DF00,<ROM-number>' .
  486.         Possible values are :
  487.         0         : Foreground-ROM (p.ex. BASIC)
  488.         1 - 251     : Background-ROMs. On a CPC 664/6128, the ROMs
  489.               1-15 are automatically initialized during reset
  490.               (on a CPC 464 only 1-7).
  491.         255        : Lower-ROM (p.ex. OS; has only in emulator this
  492.               number).
  493.  
  494.       - <filename> is a file in the directory ROM_PATH, which
  495.         contains the ROM.
  496.  
  497.       - <offset> is a number of bytes preceiding the ROM-image in
  498.         file <filename>. An AMSDOS - header is overread automatically,
  499.         so don't take any regard to it. With an offset it is possible
  500.         to load several ROMs from the same file.
  501.         If you inspect the lines
  502.         255    Z80CPC.ROM    0x0000
  503.         0    Z80CPC.ROM    0x4000
  504.         you maybe notice, that the lower-ROM and the foreground-ROM
  505.         are loaded one after another from the same file.
  506.  
  507.  
  508.  
  509.  
  510. 6.5  Compatibility of the emulator (or: what is supported) :
  511. ------------------------------------------------------------
  512.  
  513.     6.5.1  The Z80 - CPU :
  514.     ----------------------
  515.  
  516.     All Z80-instructions, also so-called illegal ones.
  517.     You have the choice between a slow Z80-emulation written
  518.     in C and a fast Z80-emulation written in assember by
  519.     Juergen Weber.
  520.     With the "CO-CPU" - technique, every Z80-instruction is
  521.     emulated simultaneously by the slow and the fast version,
  522.     so it gets very slow, but by comparing the registers after
  523.     each instruction many errors are found. Certainly this was
  524.     only used during program-developement.
  525.  
  526.  
  527.     6.5.2  The Gate - Array :
  528.     -------------------------
  529.  
  530.     - all 32 colours of the CPC (27 different ones)
  531.     - all three screen-modes (x, y, colours) :
  532.         mode 0 = 160x200x16
  533.         mode 1 = 320x200x4
  534.         mode 2 = 640x200x2
  535.     - ROM-banking (16KB OS, 16KB BASIC, 16KB AMSDOS and
  536.         additional ROMs)
  537.  
  538.  
  539.     6.5.3  The PAL (Programmable Logic Array) :
  540.     -------------------------------------------
  541.  
  542.     - RAM-banking (8*16KB = 128KB)
  543.       Banking can get very slow, since memory blocks must be swapped.
  544.       Perhaps EMS-memory would help ...
  545.  
  546.  
  547.     6.5.4  The CRTC 6845 (Cathode Ray Tube Controller) :
  548.     ----------------------------------------------------
  549.  
  550.     - screen-base and -offset for hardware-scrolling
  551.     - several screen-sizes from 0x0 to 80x25 with CRTC-registers
  552.       1 and 6.
  553.  
  554.  
  555.     6.5.5  The PIO 8255 (Programmable Input-Output) :
  556.     -------------------------------------------------
  557.  
  558.     - Keyboard (connected to PSG)
  559.     - vsync-emulation
  560.  
  561.  
  562.     6.5.6  The PSG (Programmable Sound Generator) :
  563.     -----------------------------------------------
  564.  
  565.     (no sound yet)
  566.  
  567.  
  568.     6.5.7  The FDC (Floppy Disc Controller) :
  569.     -----------------------------------------
  570.  
  571.     - all necessary FDC-commands to control two drives A and B
  572.       (including sector read/write, seek track, read sector-ID, ... ;
  573.        format track is suppressed.)
  574.     - very flexible disc-formats (up to 18 sectors per track).
  575.       Create them with CPCREAD.
  576.  
  577.  
  578.     6.5.8  The Tape :
  579.     -----------------
  580.  
  581.     - very fast by ROM-bypass.
  582.       Access files in TAPE_PATH (see configuration-file)
  583.  
  584.  
  585.     6.5.9  The Centronics :
  586.     -----------------------
  587.  
  588.     - Printer output to the file PRINTER in TAPE_PATH
  589.       (see configuration-file).
  590.       You can also use the 8-bit printer-patch !
  591.  
  592.  
  593.  
  594. 6.6  Incompatibilities (or: what's not supported) :
  595. ---------------------------------------------------
  596.  
  597.     - overscan (at most for some silly demos)
  598.       (will never be implemented - too slow)
  599.     - several screen-modes on the same screen (flickering)
  600.     - sound (not a single tune)
  601.     - PC-joystick (only the fire-buttons)
  602.     - OS/2 dos-box : flickering during set_palette (no hsync aviable)
  603.     - program Copymate : load/save impossible, since it uses a trick
  604.       to detect the number of sectors per track
  605.  
  606.     - please report all bugs you find !
  607.  
  608.  
  609.  
  610.  
  611. A1.  APPENDIX :
  612. ===============
  613.  
  614.  
  615.  
  616. A1.1  Command line parameters :
  617. -------------------------------
  618.  
  619.     You can start CPCEMU.EXE on several ways by using options,
  620.     introduced by '-' or '/', p.ex 'CPCEMU.EXE /s' .
  621.  
  622.     The following options are aviable:
  623.     CPCEMU /f    : starts CPCEMU in fast-mode (default)
  624.     CPCEMU /s    : starts CPCEMU in slow-mode
  625.     CPCEMU /d    : starts CPCEMU in debug-mode
  626.               (Consult appendix "The Debug-Menu" (A1.2).)
  627.     CPCEMU /h       : displays a help-screen
  628.  
  629.     The option '/d' is automatically used, if an unknown option
  630.     was specified.
  631.  
  632.  
  633.  
  634. A1.2  The Debug - menu :
  635. ------------------------
  636.  
  637.     The complete register-set of the CPU is displayed and can
  638.     be modified. You can "dump" the momory, disassemble or
  639.     modify it. You can load or save areas im memory.
  640.     And the most interesting thing:
  641.     You can single-step through programs !
  642.     (Similar to a real debugger.)
  643.  
  644.     A1.2.1  Overview of the debug-menu :
  645.     ------------------------------------
  646.  
  647. R)un T)race S)tep  A)ssem D)ump I)nput  L)oad saV)e  M)ode  F)ast Q)uit
  648. AF=0000 BC=0000 DE=0000 HL=0000 IX=0000 IY=0000 SP=0000 PC=0000 IR=0000
  649. AF'=0000 BC'=0000 DE'=0000 HL'=0000 IFF1=0 IFF2=0 IMD=0  NZ NC PO P
  650. 0000 : 01 89 7F       LD BC,&7F89
  651. -f->
  652.  
  653.     The first line displays the aviable commands, use the capitalized
  654.     letters.
  655.     The next two lines show the actual values of the Z80-register.
  656.     The next one disassembles the actual instruction at PC position
  657.     and the last is a prompt waiting for your input.
  658.     ('f' indicates that you are using the fast-CPU.)
  659.  
  660.  
  661.     A1.2.2  Preliminaries :
  662.     -----------------------
  663.     Parameters in special brackets are optional [opt].
  664.     Use only hexadecimal values, p.ex <address> = 0000-ffff
  665.     "<ret>" signals you, that you are in a special mode. You may
  666.     press <return> to continue. <String><Return> leaves this mode
  667.     (use p.ex. b<return>).
  668.     Commands are letters, mostly followed by an optional address.
  669.     Between the letter and this address must be a blank or tab.
  670.     Without an address, PC (program-counter) is assumed as default.
  671.  
  672.  
  673.     A1.2.3  Overview of the commands :
  674.     ----------------------------------
  675.  
  676.     R)un :
  677.     r [<address>] : starts emulation from PC or an optional address.
  678.       Examples:
  679.       -f-> r    starts emulation from PC
  680.       -f-> r 100    sets PC to 0x100 and starts emulation
  681.  
  682.     T)race (trace into) :
  683.     t [<address>] : executes only the actual displayed instruction.
  684.       Use <return> to continue in this mode, and so on.
  685.       <string><return> goes back to normal mode.
  686.       All single-step-commands are executed by the slow-CPU (even if
  687.       "-f->" is displayed), since there is no counter in the fast-CPU
  688.       any more.
  689.  
  690.     S)tep (step over) :
  691.     s [<address>] : executes the next instruction.
  692.       Rather all instructions, until PC is equal to the following
  693.       instruction. This can take a long time p.ex after a 'Ret'.
  694.       In this case F10 helps (as usual).
  695.       All single-step-commands are executed by the slow-CPU (even if
  696.       "-f->" is displayed), since there is no counter in the fast-CPU
  697.       any more.
  698.  
  699.     A)ssemble (rather disassemble) :
  700.     a [<address>] : disassemblies the next 16 instructions.
  701.       Use <return> to continue in this mode, and so on.
  702.       <string><return> goes back to normal mode.
  703.  
  704.     D)ump :
  705.     d [<address>] : shows an hex-ascii-dump of the following 256
  706.       256 bytes from address (or PC).
  707.       Use <return> to continue in this mode, and so on.
  708.       <string><return> goes back to normal mode.
  709.  
  710.     I)nput (modifying memory) :
  711.     i [<address>] : shows the actual memory-address with its current
  712.       value, which you can take by <return> or change by <hex-value>
  713.       <return>.
  714.       Leave this mode by using an invalid number like '-1' :
  715.       -1<return> .
  716.  
  717.     L)oad (loading a program) :
  718.     l [<address>]  : prompts you for a filename <name> and loads it
  719.       from the directory TAPE_PATH to <address>
  720.       An AMSDOS-header is recognized.
  721.       Look at Appendix "Structure of the AMSDOS-header".
  722.       Examples:
  723.       -f-> l<return> demo<return>     :
  724.         loads file 'demo' to the actual PC
  725.       -f-> l a000<Return> myprog<Return>     :
  726.         loads file 'myprog' to address 0xA000
  727.  
  728.     saV)e (saving a program) :
  729.     v [<address>]  : prompts you for a filename <name> and the
  730.       length of the memory-block. This block is saved from <address>
  731.       (or PC), as binary-file in the directory TAPE_PATH, which means
  732.       with an AMSDOS-header.
  733.       Look at Appendix "Structure of the AMSDOS-header".
  734.       Example:
  735.       -f-> v<return> demo<return> 4000<return>    :
  736.         saves file "demo" from PC with length 0x4000.
  737.  
  738.     M)ode (changing the display-mode) :
  739.     m : Changes dislay-mode : register-display, instruction-
  740.       disassembling on/off.
  741.  
  742.     F)ast (selecting the type of emulation) :
  743.     f : Flips between the fast Z80-emulation (developed in assembler
  744.       by Juergen Weber, default) and the slow one (written in C).
  745.       The prompt toggles between "-f->" for fast and "-s->" for slow.
  746.       All r, s, t-commands refer to the selected type of emulation.
  747.  
  748.     Q)uit (leaving the program) :
  749.     q : quits the emulator.
  750.  
  751.  
  752.     A1.2.4  Manipulation of registers :
  753.     -----------------------------------
  754.  
  755.     In addition to the one-letter-commands you can change register-
  756.     values with the syntax:        '<register>=<hex-value>'
  757.     Examples:
  758.     - af=345    : set register AF to 0x0345
  759.     - pc=a000    : set program-counter to 0xA000
  760.  
  761.     Here, '=' is handled as delimiter, so no additional blanks are
  762.     necessary (and you can also write '<register>   <hex-value>').
  763.     You can modify all displayed registers, thus
  764.     AF, BC, DE, HL, IX, IY, SP, PC, IR, AF', BC', DE', HL',
  765.     and also IFF1, IFF2 and IMD.
  766.  
  767.  
  768.  
  769. A1.3  Function of the ROM - Bypass :
  770. ------------------------------------
  771.  
  772.     Some special instructions are implemented in the Z80-emulation.
  773.     They call special functions only supplied by the emulator.
  774.     They are entered directly in ROM, so it is still possible to
  775.     patch the RAM-vectors.
  776.  
  777.     The following instructions are aviable :
  778.     ED FC xx  USER &BCxx    (only valid for some RAM-vectors)
  779.     Similar to a call-instruction to an internal function.
  780.     The following values for xx are legal :
  781.     65    :    CAS INIT (BC65)
  782.     77    :    CAS IN OPEN (BC77)
  783.     7A    :    CAS IN CLOSE
  784.     7D    :    CAS IN ABANDON
  785.     80    :    CAS IN CHAR
  786.     83    :    CAS IN DIRECT
  787.     86    :    CAS RETURN
  788.     89    :    CAS TEST EOF
  789.     8C    :    CAS OUT OPEN
  790.     8F    :    CAS OUT CLOSE
  791.     92    :    CAS OUT ABANDON
  792.     95    :    CAS OUT CHAR
  793.     98    :    CAS OUT DIRECT
  794.     9B    :    CAS CATALOG
  795.  
  796.     In addition to that, you can use the user-break-instruction
  797.     ED FC FC  USER &BCFC , it stops the emulation at once.
  798.  
  799.  
  800.  
  801. A1.4  Structure of Disc - Images :
  802. ----------------------------------
  803.  
  804.     Disc-image files consist of a 0x100-byte disc-info block and
  805.     for each track a 0x100-byte track-info block, followed by the
  806.     data for every sector in that track.
  807.  
  808.     A1.4.1  The Disc - Information block :
  809.     --------------------------------------
  810.     Byte (hex) :    Meaning:
  811.     00 - 21        MV - CPCEMU Disk-File\r\nDisk-Info\r\n
  812.             (as characteristic)
  813.     22 - 2F         unused (0)
  814.     30        number of tracks (40, 42, maybe 80)
  815.     31        number of heads (1, 2 not yet supported)
  816.     32 - 33        size of one track (including 0x100-byte track-info)
  817.             With 9 sectors * 0x200 bytes + 0x100 byte track-
  818.             info = 0x1300.
  819.     34 - FF        unused (0)
  820.  
  821.     A1.4.2  The Track - Information block (for every track) :
  822.     ---------------------------------------------------------
  823.     Byte (hex) :    Meaning:
  824.     00 - 0C        Track-Info\r\n
  825.     0D - 0F        unused (0)
  826.     10        track - number (0 to num.of tracks -1)
  827.     11        head - number (0) (maybe 1 later)
  828.     12 - 13        unused (0)
  829.     Format-track-parameters:
  830.     14        BPS (bytes per sector) (2 for 0x200 bytes)
  831.     15        SPT (sectors per track) (9, at the most 18)
  832.     16        GAP#3-format (gap for formatting; 0x4E)
  833.     17        Filling-byte (filling-byte for formatting; 0xE5)
  834.     Sector-info (for every sector at a time):
  835.     18+i        track-number    \
  836.     19+i        head-number     | sector-ID-information
  837.     1A+i        Sector-number     |
  838.     1B+i        BPS              /
  839.     1C+i        state 1 error-code (0)
  840.     1D+i        State 2 error-code (0)
  841.     1E+i , 1F+i    unused (0)
  842.  
  843.     Annotations:
  844.     The sector-data must follow the track-information-block
  845.     in the order of the sector-IDs. No track or sector may be
  846.     omitted. Use CPCREAD to copy CPC-discs into this format.
  847.  
  848.  
  849. A1.5  Structure of the AMSDOS - Header :
  850. ----------------------------------------
  851.  
  852.     Byte (hex:)     Meaning:
  853.     00        user-number (0 , possible values 0-15)
  854.     01 - 0F        filename+extension (possibly filled with 0)
  855.     10        block-number (0)
  856.     11        last-block-flag (0)
  857.     12        file-type (0=basic, 1=protected basic, 2=binary,...)
  858.     13 - 14        length of block (0)
  859.     15 - 16         load-address (0-FFFF)
  860.     17        first-block-flag (0)
  861.     18 - 19         logical length (0-FFFF)
  862.     1A - 1B         entry-address (0-FFFF)
  863.     1C - 3F        free for the user (0)
  864.     40 - 42        real length of file (1-FFFFFF)
  865.     43 - 44        checksum of bytes 00-42
  866.     45 - 7F        unused (random values from sector-buffer)
  867.  
  868.     Annotation:
  869.     A header stands at the beginning of every non-ASCII file. It
  870.     is identified by calculating the checksum.
  871.     Bytes 00-3F originate from the "cassette-area", where files
  872.     were divided up into blocks.
  873.     Necessary are the bytes 12, 15-16, 1A-1B, 40-42, 43-44 .
  874.  
  875.  
  876. A1.6  Information on the CPC :
  877. ------------------------------
  878.  
  879.     It is possible to write several books about this topic,
  880.     maybe in a later doc.
  881.  
  882.  
  883.  
  884. A1.7  Letter from AMSTRAD :
  885. ---------------------------
  886.  
  887.  
  888.     I have written the following letter to AMSTRAD:
  889.  
  890.  
  891.     Dear Sirs,
  892.     I would like to offer you the most outstanding program ever
  893.     written !
  894.  
  895.     It is a CPC-emulator on PC.
  896.  
  897.     You might say, "CPC, that home-computer we designed years ago,
  898.     that is over !"
  899.     But there are many people still using it, potential customers
  900.     of Amstrad-PC's. An emulator would be another reason to buy a
  901.     PC, they can continue using the old well known programs during
  902.     a transitional period.
  903.     For people who already have a PC it is fascinating, too. I was
  904.     totally surprised to see the CPC-opening screen on a complete
  905.     different computer the first time. It drives me to improve the
  906.     emulation (in former times it was only black and white ...),
  907.     so today I would call it a "software CPC". Certainly, it can
  908.     be improved. Some more details of the emulator are enclosed.
  909.  
  910.     Unfortunately I cannot continue programming the emulator
  911.     without support (I am only a student). All programs I have
  912.     ever written are Public Domain, also the current version of
  913.     CPCEMU.
  914.     If you are interested, I can send you the emulator for testing.
  915.  
  916.     If not (but I do not think so), I need to know, under which
  917.     legal condition I can include the original Amstrad-CPC-Rom
  918.     to make a shareware package.
  919.     (Some people asked me for that.)
  920.  
  921.     .
  922.  
  923.     I have received the following answer :
  924.  
  925.     .
  926.  
  927.     Dear Mr Vieth
  928.  
  929.     Thank you for your recent letter concerning the CPC.
  930.  
  931.     Please be advised that the CPC ROM is protected by copyrights
  932.     and therefore regretfully we are unable to offer any assistance
  933.     in this matter.
  934.  
  935.     We are sorry we have been unable to assist you on this occasion
  936.     and regret the inconvenience caused.
  937.  
  938.     .
  939.  
  940.     So I'm not allowed to enclose the ROMs.
  941.     But who has the copyright ?
  942.  
  943.  
  944. A1.8  History of program developement :
  945. ---------------------------------------
  946.  
  947.     A1.8.1  Z80EMU (only a Z80 with less CPC) :
  948.     -------------------------------------------
  949.     - v1.0 (1991)
  950.       first version in pascal (only Z80-emulation)
  951.     - v1.2 (12.8.1992 - 16.8.1992)
  952.       first version in  C (translated with TPTC)
  953.       Z80-problems: P-flag set with ADD HL..., DAA, ldir;
  954.       Z-flag set with BIT... Z,S-flags set with Rotate; ROMs possible
  955.     - v1.3 (18.8.1992)
  956.       port-adressing wrong in lo-byte.
  957.       New memory-management (128 KB RAM, 32 KB ROM)
  958.     - v2.0 (18.8.1992 - 22.8.1992)
  959.       Co-CPU-technique implemented to find errors
  960.       (mit separated memory for the CO-CPU).
  961.       Z80-problems: H-flag set after AND... ; CPI... sets N-Flag;
  962.       Screen colours blue and yellow (former black and white)
  963.     - v2.1 (25.8.1992 - 27.8.1992)
  964.       All pens, colours from the CPC in all modes; only the viewing
  965.       screen is written to.
  966.       Co-Z80-error: alle (ix+zz) with negative distance were wrong !
  967.       Forgotten to take 'signed char'.
  968.     - v2.2 (30.8.1992 - 3.9.1992)
  969.       New keyboard-routine, set palette without flickering (hsync).
  970.       "Need-Rom" with Copymate introduced.
  971.     - v2.3 (15.9.1992 - 19.9.1992)
  972.       FDC-emulation for sector load/save.
  973.       Co-Z80-error: LD XH... was LD H...
  974.     - v2.3b (19.9.1992)
  975.       Screen-update only on blocks 0..3 (not 4..7);
  976.       Port FCxx same as FBxx (for CP/M Plus). At that time, I
  977.       didn't know that OUTI... pre-decrements the B-register.
  978.     - v2.4 test (25.10.1992)
  979.       Only R-register-emulation, if desired (per define);
  980.       Now screen-update every n.interrupt and not for every single
  981.       byte written in memory.
  982.       (Still very slow, it's written in C).
  983.       New memory-management with blocks aligned to segments.
  984.     - v2.5 test (31.10.1992)
  985.       Changed memory-management. Hardware-scrolling and different
  986.       screen-sizes possible.
  987.     - v2.6 test (5.11.1992)
  988.       New keyboard-handler by Arnt Gulbrandsen: all key-combinations
  989.       possible. Screen-update in assembler.
  990.     - v2.7 test
  991.       Unsuccessfully tried to include the fast-Z80-emulation by
  992.       Juergen Weber.
  993.     - v2.8
  994.       Improved Screen-update: Only changed parts are modified on
  995.       the screen.
  996.     - v2.9
  997.       Timer-handler with 300 interrupts. Fast-emulation runs only, if
  998.       no ROM (banking) is needed.
  999.  
  1000.     A1.8.2  CPCEMU (now a CPC) :
  1001.     ----------------------------------
  1002.     - v0.2 (23.12.1992), following Z80EMU v2.9
  1003.       After nearly 4 hours with the Turbo-Debugger I've found the
  1004.       error hanging the fast-emulation: pushed ES instead of DS.
  1005.     - v0.3 (28.12.1992 - 29.12.1992)
  1006.       Set N-flag for INI,OUTI. CPI in fast-Z80 set wrong flags.
  1007.       RL(HL) used read-segment(DS) instead of write-segment(ES).
  1008.       LD A,R now produces random-numbers;
  1009.       All Tape-routines implemented (but wrong CAS IN CHAR).
  1010.     - v0.4 (1.1.1993)
  1011.       IN A,(n): A to b8..b15 (instead of B); RAM-configuration 0xc3:
  1012.       corrected to 0,3,2,7 (for CP/M Plus).
  1013.       KC-Compact (a CPC-compatible from former DDR) uses port
  1014.       EE00 - EE3D, but for what ?
  1015.     - v0.5 (28.1.1993 - 8.2.1993)
  1016.       INIR,... R-register-incrementation depends on B, not on BC.
  1017.       CAS IN CHAR corrcted (wrong patch for CPC 6128).
  1018.     - v0.6 (23.3.1993 - 24.5.1993)
  1019.       Somemone mentioned that the OUTI-instructions pre-decrement
  1020.       the B-register !
  1021.       Now C-parts also in 386-code (with Borland C++ v3.1)
  1022.       Disk-image-files now suffix .DSK.
  1023.       CPCREAD.PAS corrected (head not initialized with 0)
  1024.       and translated to CPCREAD.C .
  1025.       Pio-8255-port-addressing improved (can read, even if port
  1026.       is programmed for output, ...)
  1027.     - v0.7 (26.7.1993 - 29.8.1993) (inoffiziell)
  1028.       Tatally new source, modularized, ...
  1029.       Configuration-file, more ROMs possible.
  1030.       Changed company-name from 'Schneider' to 'Amstrad'.
  1031.       (The user can choose now.)
  1032.       RAM-banking-error removed.
  1033.       New documentation in german.
  1034.     - v0.8 (30.8.1993 - )
  1035.       Slow-emulation: parity-instructions improved by using a table
  1036.       not only for parity.
  1037.           Z80: ED xx with illegal xx is ignored.
  1038.       New documentation in english.
  1039.  
  1040.  
  1041.  
  1042. A1.9  Acknowledgments :
  1043. -----------------------
  1044.  
  1045.     - Special thanks to Juergen Weber, not only for many hints and
  1046.       suggestions, especially for the fast Z80-Emulation from his
  1047.       CP/M-emulator ZSIM.
  1048.  
  1049.             Juergen G. Weber
  1050.             Wiesentalstrasse 1
  1051.             74523 Schwaebisch Hall
  1052.             Federal Republic of Germany
  1053.  
  1054.             email: weberj@dia.informatik.uni-stuttgart.de
  1055.  
  1056.  
  1057.     - Thanks to Arnt Gulbrandsen for his JPP source, where I found
  1058.       ideas to the keyboard-handler, and the joystick-routine.
  1059.       By the way, JPP is a very good emulator for the Spectrum.
  1060.  
  1061.     - Thanks to Gilles Molinari for his transfer program.
  1062.  
  1063.     - Thanks to AMSTRAD fow answering my letter.
  1064.       (It was my first business(?) letter).
  1065.  
  1066.     - And thanks to the many users for sending me suggestions or
  1067.       having ideas ...
  1068.  
  1069.     - (Please excuse my english. This is the first doc.)
  1070.  
  1071.  
  1072. A1.10  Trademarks :
  1073. -----------------------------
  1074.  
  1075.     CP/M, CP/M 2.2 and DRDOS are trademarks of Digital Research.
  1076.     MS-DOS is a trademark of Microsoft.
  1077.     IBM PC, PC-XT, PC-AT and OS/2  are trademarks of International
  1078.     Business Machines.
  1079.  
  1080.     CPC, AMSDOS by Amstrad,
  1081.     BORLAND C, TASM (Turbo Assembler) by Borland,
  1082.     22DISK by SYDEX
  1083.     ...
  1084.  
  1085.  
  1086.  
  1087. A1.11  Address of AMSTRAD :
  1088. ---------------------------
  1089.  
  1090.     Amstrad plc, Brentwood House,
  1091.     169 Kings Road, Brentwood,
  1092.     Essex CM14 4EF
  1093.  
  1094.  
  1095.  
  1096. A1.12  The author :
  1097. -------------------
  1098.  
  1099.     Marco Vieth (22),
  1100.     Student at the University of Paderborn
  1101.     (7.class ?) (WS 93/94)
  1102.  
  1103.  
  1104.  
  1105.     Have fun !
  1106.  
  1107.  
  1108.     ----------------------
  1109.