home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / ENTERPRS / CPM / UTILS / S / ZSIM12.ZIP / ZSIM.DOC < prev    next >
Text File  |  1992-01-12  |  31KB  |  827 lines

  1.  
  2.     **********************************************************************
  3.     **********************************************************************
  4.  
  5.  
  6.  
  7.        ZZZZZZZZZZ                 SSSSSSSS    IIII    M         M
  8.               ZZ                 SS            II     MM       MM
  9.              ZZ                   SS           II     M M     M M
  10.             ZZ                     SS          II     M  M   M  M
  11.            ZZ       ---------        SS        II     M   M M   M
  12.           ZZ        ---------          SS      II     M    M    M
  13.          ZZ                            SS      II     M         M
  14.         ZZ                           SSS       II     M         M
  15.        ZZZZZZZZZZZ               SSSSS        IIII   MMM       MMM
  16.  
  17.  
  18.  
  19.                        The hundred percent Z80 Emulator
  20.  
  21.                                Version 1.2
  22.  
  23.                         (C) 1990, 1992 by Jürgen Weber
  24.  
  25.  
  26.                               Jürgen Weber
  27.                             Wiesentalstr. 1
  28.                         W-7170 Schwäbisch Hall
  29.                      Federal Republic of Germany
  30.  
  31.  
  32.  
  33.     **********************************************************************
  34.     **********************************************************************
  35.  
  36.     IMPORTANT:
  37.  
  38.     The author assumes no responsibility for the correctness of the
  39.     documentation or the function of the program.  The user is advised to
  40.     test the programm fully.  The risk of using the software is exclusive
  41.     to the user.  The author assumes no responsibility whatever for damages
  42.     of any kind that might result from using the program.
  43.  
  44.     Cited product names are [registered] trade names.
  45.  
  46.     Hardware/Software preconditions:
  47.  
  48.     PC/XT/AT, 1 Diskdrive (5 1/4 " recommended), 256K free memory,
  49.     MSDOS 2.1 or compatible.
  50.  
  51.     Serious work is only possible with machines faster than 8 MHz 80286.
  52.     Every 10 MHz shown by the Landmark test correspond to 1 MHz of the
  53.     emulated Z80.
  54.  
  55.  
  56.  
  57.  
  58.     IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT
  59.     *********************************************************************
  60.     IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT
  61.  
  62.     Be sure that you do not insert a MS-DOS disk when prompted for a CP/M
  63.     disk.  The CP/M BIOS would overwrite the MS-DOS disk without
  64.     prompting.  Also MS-DOS overwrites CP/M disks.
  65.  
  66.     As soon as the emulator prompts for inserting a CP/M disk only use CP/M
  67.     disks.  Be sure that the CP/M disk has the right format.  Insert the
  68.     disk WRITE PROTECTED and display the directory.  If only dots are
  69.     displayed it is a clue for a wrong format.  But also if "NO FILE" is
  70.     displayed it might be a wrong format except if you are sure that the
  71.     disk is indeed empty.
  72.  
  73.  
  74.     IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT
  75.     *********************************************************************
  76.     IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT
  77.  
  78.  
  79.  
  80.  
  81.     INSTALLATION:
  82.  
  83.     Copy the files in the package into a directory of your hard disk.
  84.  
  85.  
  86.     GENERAL:
  87.  
  88.     ZSIM emulates a Z80 CP/M Machine (CP/M 2.2), but not the CP/M operating
  89.     system itself.  In order to start CP/M, a CP/M System disk must be
  90.     inserted into drive A:, where from ZSIM boots CP/M.
  91.  
  92.     The CP/M system or a compatible operating system (SUPERDOS and Z80DOS
  93.     are included in the ZSIM package) also can be put into a file
  94.     CPMSYS.CPM on the hard disk.
  95.  
  96.     Every CP/M program I could test ran correctly, even the floating point
  97.     library of the public domain program SMALL-C, that requires a high
  98.     compatiblity, as it uses undocumented Z80 codes.
  99.  
  100.     The complete compatibility to a CP/M machine is reached because
  101.     contrary to other emulators that emulate the operating system
  102.     themselves ZSIM only emulates the Z80 and the BIOS.  On this virtual
  103.     machine runs an original CP/M compatible operating system or CP/M.
  104.  
  105.  
  106.     EMULATOR:
  107.  
  108.     The following information only describes the specialties of the virtual
  109.     CP/M machine.  For information concerning the CP/M operating system
  110.     please consult appropriate literature covering this subject.
  111.  
  112.     ZSIM creates a CP/M machine with 64K ram, one disk drive and a
  113.     ramdisk.  There is only one physical drive supported.  The physical
  114.     drive can be set to IBM-PC drive 0 or 1 by changing the disk parameters
  115.     in the control-Break menu.  The physical drive is always CP/M drive A.
  116.  
  117.     The whole memory pool that is not required by MSDOS, ZSIM and the 64K
  118.     working space for the Z80, is used as ramdisk (440K ramdisk in a 640K
  119.     PC).  This ramdisk can be saved in a MS-DOS File, that will be
  120.     automatically loaded when starting ZSIM next time, but only if there is
  121.     enough memory for the ramdisk.  So don't use more TSRs next time.  This
  122.     way you can keep important utilities in the ramdisk and have them
  123.     present every time you start ZSIM.
  124.  
  125.  
  126.     STARTING:
  127.  
  128.     When starting ZSIM tries to load CP/M BDOS from a MS-DOS file
  129.     CPMSYS.CPM into memory.  The file must be in the directory ZSIM was
  130.     started in.
  131.  
  132.     The ZSIM package contains two CP/M compatible operating systems in the
  133.     files SUPERDOS.SYS and Z80DOS.SYS.  Both contain the ZCPR1 command line
  134.     processor.  Z80DOS is a derivative of SUPERDOS and supports date and
  135.     time (ZSIM' s BIOS furnishes time and date).  But there may be write
  136.     errors if you use disks that were already written to by the original
  137.     CP/M system.  This is because Z80DOS uses another faster file system.
  138.  
  139.     To use one of the public domain operating systems simply copy
  140.     SUPERDOS.SYS or Z80DOS.SYS to CPMSYS.CPM:
  141.  
  142.        COPY SUPERDOS.SYS CPMSYS.CPM
  143.  
  144.     If you format a disk using the utility CPMFRM you can start CP/M
  145.     programs, e.g.  Small-C, without having the original CP/M operating
  146.     system.  Create, as described above, CPMSYS.CPM, insert a disk
  147.     formatted by CPMFRM and start ZSIM.
  148.  
  149.     If CPMSYS.CPM is not present, ZSIM tries to load the system from the
  150.     boot tracks by scanning all sectors within the reserved tracks for the
  151.     Copyright message of Digital Research.  If it is found DR's copyright
  152.     is displayed and the following sectors are loaded as system.  A system
  153.     disk is only required for boot up, afterwards the system is kept in
  154.     memory.
  155.  
  156.     For example:
  157.  
  158.     Even if you would like to use the original CP/M system disk it is only
  159.     necessary to start ZSIM.  Afterwards the system is kept in memory.
  160.  
  161.     After successful boot from disk you can create with MOVCPM a file
  162.     containing the system (don't forget the blank between the * *) and
  163.     transfer it to MSDOS.  There it is put into PUNCH.CPM.  Afterwards you
  164.     should rename it to CPMSYS.CPM.
  165.  
  166.     Example:
  167.  
  168.  
  169.     jgw 59K TPA cp/m 80 BIOS ver 1.0 --  05/09/90  (C) 1990 by Jürgen Weber
  170.  
  171.     BDOS: COPYRIGHT (C) 1979, DIGITAL RESEARCH
  172.  
  173.     A>b:
  174.     B>movcpm * *
  175.  
  176.     CONSTRUCTING 64k CP/M vers 2.2
  177.     READY FOR "SYSGEN" OR
  178.     "SAVE 34 CPM63.COM"
  179.     B>save 34 cpm.sys
  180.     B>pip
  181.     *up2:=cpm.sys[o]
  182.     *
  183.  
  184.     For safety's sake first empty the punch buffer and delete the punch
  185.     file (in this order) to make sure the CP/M system will be put at the
  186.     beginning of PUNCH.CPM.  Transfer as shown above the system.  Empty the
  187.     punch buffer, start a SHELL and rename PUNCH.CPM into CPMSYS.CPM.
  188.  
  189.     You can specifiy behind MOVCPM a smaller number, too.  This generates a
  190.     smaller CP/M system and leaves Z80 memory behind CP/M TPA and the
  191.     system area.  ZSIM automatically loads the smaller CP/M to the right
  192.     place.
  193.  
  194.     The public domain operating systems SUPERDOS and Z80DOS are always
  195.     loaded by ZSIM so that BDOS is situated at 0EC00h.
  196.  
  197.  
  198.  
  199.     DISK FORMATS:
  200.  
  201.     Following CP/M disk formats are supported:
  202.  
  203.        Amstrad CPC System  (169K, phys. Sectors 41h-49h)
  204.        Amstrad CPC Data    (178K, phys. Sectors 0C1h-0C9h)
  205.        CP/M 86 SS DD  (153K)
  206.        CP/M 86 DS DD  (316K)
  207.  
  208.     and additionally a special format corresponding to CPC data format but
  209.     with physical sector numbers starting at 1.
  210.  
  211.     The Amstrad is a Z80 Homecomputer that was quite popular in Europe in
  212.     the middle of the eighties.
  213.  
  214.     The first two formats are special formats of the Amstrad CPC.  The high
  215.     nibble of the sector number is used to diffentiate the formats.  The
  216.     other two are used by CP/M 86 on an IBM PC and also by CCP/M 86 and DOS
  217.     Plus, that is shipped with the Amstrad PCs.
  218.  
  219.     DOS Plus is compatible to CP/M 86 and PC-DOS and good for copying
  220.     between CP/M and MSDOS.  An additional advantage of this format is,
  221.     that disks can be created using the MDDOS FORMAT.COM (FORMAT /8).  But
  222.     before that the sector fill byte in the drive parameter table of MSDOS
  223.     must be set to 0E5h.
  224.  
  225.     If you find this to be too awkward you can use the program CPMFRM.EXE.
  226.     It installs the necessary parameters and calls FORMAT.COM.  If there is
  227.     the MSDOS default fill byte 0F6h in the CP/M directory CP/M sees an
  228.     entry and thinks the disk is full.
  229.  
  230.     ZSIM recognizes the format of the inserted disk at every warm boot if
  231.     it is one of the five specified above.  So every time you insert
  232.     another disk you should press Control-C.  But this is recommended
  233.     anyway as BDOS aborts with "BDOS Error on A:RO" on any write attempt to
  234.     a disk that was not logged in with Control-C.
  235.  
  236.     It is possible to edit manually the disk parameters from the Control
  237.     Break Menu and adapt them to a given manufacturer dependent format.
  238.  
  239.     Also you can start ZSIM with parameter /f <diskparfile>.  <diskparfile>
  240.     can be created by Control-Break menu Save Parameters.  Note that single
  241.     density formats are not supported by the IBM BIOS and 8 inch disks
  242.     don't like being pressed into a 5 1/4 inch drive.
  243.  
  244.     SCREEN DRIVER
  245.  
  246.     The screen driver supports the CP/M Plus screen control codes.
  247.     Additionally a subset of control codes of the Amstrad CPC is
  248.     supported.  For a description of the control codes see appendix 1.
  249.     Contrary to Digital Research's recommendation Bit 7 of the input ASCII
  250.     code is not zeroed.
  251.  
  252.     If you enter an international character (e.g. a German umlaut) it is
  253.     translated from IBM coding into CP/M coding (e.g.  ä => { ).  To
  254.     display an international character set it should be switched on by ESC
  255.     2 2.
  256.  
  257.  
  258.     PRINTER:
  259.  
  260.     Characters are sent to printer lpt0.  ZSIM waits until the printer has
  261.     taken the character correctly.  This can result in an infinite loop if
  262.     the printer is switched off.  To prevent this there is a test for
  263.     Control-C.  If it is pressed there is a warm boot.  This is only
  264.     recommended in case of emergency because this way the calling program
  265.     is aborted too, of course.
  266.  
  267.  
  268.     PUNCH:
  269.  
  270.     Digital Research specified function 6 for serving a punch.  As punches
  271.     haven't great importance anymore I used functions 6 and 7 to transfer
  272.     data to MSDOS and vice versa.  Characters are appended to the MSDOS
  273.     file PUNCH.CPM.  It is created if it is non-existent.  Characters are
  274.     buffered until the buffer buffer full.  The buffer is also written out
  275.     if you hit Control-Break.
  276.  
  277.  
  278.     Calling function 6:
  279.  
  280.     It's easiest done with PIP.  But don't use the logical device PUN:
  281.     (Punch) because then PIP first sends some zero bytes.  You should
  282.     either use PTP: or UP2:.  If you use PTP: and transfered an ASCII file
  283.     PIP appends EOF.
  284.  
  285.       PIP UP2:=ANYFILE.EXT[o]
  286.  
  287.     The option [o] (object file) prevents PIPs stopping after the first
  288.     1Ah (EOF) byte while transfering a non ascii file.  The option is not
  289.     necessary for transfering an ASCII file.
  290.  
  291.     Remind that data are APPENDED to PUNCH.CPM.
  292.  
  293.     You should proceed as fellowing:
  294.  
  295.       - transfer the file with PIP as described above
  296.       - in Control-Break menu select Empty Punch Buffer
  297.       - in Control-Break menu select OS Shell and under MSDOS
  298.       renam  PUNCH.CPM into the name you want:
  299.              REN PUNCH.CPM file.txt
  300.              EXIT
  301.  
  302.  
  303.     ENDING THE EMULATION:
  304.  
  305.  
  306.     The Z80 emulation can be terminated by pressing Control-Break where
  307.     after a menu pops up.  You will also see this menu if the emulator
  308.     encounters the Z80 code HALT.
  309.  
  310.     Warning:  Hitting Control-Break only sets a flag that has to be
  311.               evaluated during the next BIOS call.  That means if the Z80
  312.               is stuck in an infinite loop you have to reboot the PC.
  313.               Regularly testing the flag during the emulation would take
  314.               too much time.
  315.  
  316.     In rare cases a fatal error can occur: when MSDOS loads ZSIM and its
  317.     disk buffers to an unlucky address, so that a so called DMA Boundary
  318.     Crossing is happening.  Then the emulation is instantly aborted.  The
  319.     emulator must be loaded to another address.  Simply start a new shell
  320.     with entering COMMAND and afterwards ZSIM again.
  321.  
  322.  
  323.  
  324.     CONTROL BREAK MENU
  325.  
  326.     After pressing Control-Break the fellowing menu pops up:
  327.  
  328.  
  329.  
  330.                 +-------------------+
  331.                 | Continue          |
  332.                 | Save Ramdisk/Quit |
  333.                 | Quit              |
  334.                 | Save Ramdisk      |
  335.                 | Delete Punch File |
  336.                 | Init Reader       |
  337.                 | OS Shell          |
  338.                 | Disk Parameters   |
  339.                 | Save Parameters   |
  340.                 | Load Parameters   |
  341.                 | Warm Boot         |
  342.                 | About             |
  343.                 +-------------------+
  344.  
  345.  
  346.  
  347.  
  348.     Use the cursor keys to select the action you wish.
  349.  
  350.     ESC finishes the menu, same as Continue.
  351.  
  352.     Continue           continues the CP/M emulation
  353.  
  354.     Save Ramdisk/Quit  saves the ramdisk to the disk ZSIM was started
  355.                        from and ends ZSIM.
  356.  
  357.     Quit           ends ZSIM without saving the ramdisk.
  358.  
  359.     Save Ramdisk   saves the ramdisk and continues the emulation.
  360.                    This makes sense if you wish to save different
  361.                    contents of the ramdisk. Important: after that
  362.                    you have to start an OS Shell and rename the
  363.                    saved ramdisk (RAMDISC.CPM) else it would be
  364.                    overwritten if you save the ramdisk next time.
  365.  
  366.     Empty Punch Buffer empties the buffer the punch writes its data to
  367.                        and then writes the data onto the hard disk.
  368.  
  369.     Delete Punch File deletes the MSDOS file that the punch data are
  370.                       written into.
  371.  
  372.     OS Shell        starts a DOS Shell, but you only get 64K memory
  373.                     for it. But that is enough for REN and COPY.
  374.  
  375.     Disk Parameters is used for editing the CP/M disk parameters
  376.                     (described below).
  377.  
  378.     Save Parameters saves the disk parameters to a file. Enter
  379.                     herefore a filename with extention. The parameters
  380.                     are saved as hexbytes in the same order they appear
  381.                     in the edit box. Before the parameters the bytes
  382.                     'JW' are saved as signature.
  383.                     The autologin flag is not saved.
  384.  
  385.     Load Parameters loads the disk parameters from a file that was
  386.                     saved with Save Parameters. Enter for loading the
  387.                     filename with extention. After loading the
  388.                     autologin flag is cleared and a warm boot is made.
  389.  
  390.     Warm Boot       has the same effect as pressing Control-C under
  391.                     CP/M, but it also works if a program runs.
  392.  
  393.     About           tells the program name and Author.
  394.  
  395.  
  396.     DISK PARAMETERS
  397.  
  398.     If you select Disk Parameters in the Control-Break menu you can edit
  399.     the parameters in an edit panel.
  400.  
  401.     During input only valid hex digits are accepted, other characters are
  402.     ignored.  ESC ends editing, changes until the line before the cursor
  403.     are valid.  Use BACKSPACE to delete characters in the cursor line.  An
  404.     input line must be ended with ENTER.  If you press ENTER without having
  405.     entered a new value the old value is kept (like in the following
  406.     example in the lines where there is no value behind the colon).
  407.  
  408.     Example:
  409.  
  410.     jgw 59K TPA cp/m 80 BIOS ver 1.1 - 10/12/91 (C) 1990 by Jürgen G. Weber
  411.  
  412.     BDOS: COPYRIGHT (C) 1979, DIGITAL RESEARCH
  413.  
  414.     Unknown disk format. Insert new disk and press any key
  415.  
  416.      +------------------+
  417.      |SPT: 0024  : 28   |
  418.      |BSH:   03  :      |
  419.      |BLM:   07  :      |
  420.      |EXM:   00  :      |
  421.      |DSM: 00A8  : B8   |
  422.      |DRM: 003F  :      |
  423.      |AL0:   C0  :      |
  424.      |AL1:   00  :      |
  425.      |CKS: 0010  : 40   |
  426.      |OFF :0002  : 3    |
  427.      |                  |
  428.      |DRV:   00  :      |
  429.      |PTR:   28  :      |
  430.      |PST:   09  : 5    |
  431.      |BPS:   02  : 3    |
  432.      |FSC:   01  :      |
  433.      |LOG:   FF  : 0    |
  434.      +------------------+
  435.  
  436.  
  437.     Here I had inserted an alien disk (Osborne DD).  After ZSIM had
  438.     complained about an unknown disk format I had pressed Control-Break.
  439.     Afterwards I entered the correct values.
  440.  
  441.     The parameters in the upper half are standard CP/M parameters. The
  442.     others are an extention by me and mean the following:
  443.  
  444.     DRV: physical number of the drive with the CP/M disk (0 or 1);
  445.          but this is always drive A: within CP/M
  446.  
  447.     PTR: physical track number, 40 with a 360K drive, else (with 720K,
  448.          1.2 MB or 1.4 MB) up to 80 tracks
  449.  
  450.     PST: number of physical sectors per track, 9 with 360K drives
  451.  
  452.     BPS: physical sector length; BPS=log2(SecLen in bytes )-7; this value
  453.          is required by the disk controller
  454.  
  455.     FSC: physical number of first sector of track, usually 1
  456.  
  457.     LOG: FF=autologin, 0=no autologin
  458.  
  459.     If you change the parameters set LOG to 0, else the next autologin
  460.     would change the parameters again.
  461.  
  462.     To get standard parameters, set LOG to FF, insert a disk with normal
  463.     format and press Control-C.  But a secure format adaption only is
  464.     possible with single sided formats.  Some two sided formats address the
  465.     second side as extention of the tracks of the first side (with the
  466.     effect of more sectors per track), others double the track count.
  467.     ZSIMs BIOS uses the method of CP/M 86 double sided (double sector count
  468.     and track translation).
  469.  
  470.  
  471.     EMULATION OF THE Z80
  472.  
  473.     The emulated machine is almost as complete as a real Z80 CP/M machine.
  474.  
  475.     All emulated Z80 instructions that change or use flags where tested
  476.     (especially how they influence flags).  All defined flags are
  477.     influenced exactly as on an original Z80 chip.
  478.  
  479.     I tested this by looping the register pair HL from 0 to FFFFh and
  480.     copying it with PUSH HL - POP AF to AF, executing the instruction to
  481.     test and adding the resulting AF register pair to a check sum.
  482.  
  483.     I improved the emulation until all flag influencing instructions
  484.     resulted the same checksum on the Z80 and on the emulation.  The Z80
  485.     flags that are not defined by Zilog and show more or less random
  486.     behaviour are not defined within ZSIM either.  But different undefined
  487.     flag status may result.  ZSIM supports non-documented Z80 instructions,
  488.     the so called illegal opcodes.
  489.  
  490.     All CP/M programs I tested run with ZSIM as on a CP/M machine, even the
  491.     floating point package of the Small-C compiler that uses undocumented
  492.     Z80 instructions.
  493.  
  494.     A preeminent difference between emulation and original Z80 chip is the
  495.     execution time.  There is no proportinal relation between the cylcles
  496.     an operation takes on the emulation and the cycles needed on a Z80.  So
  497.     you cannot realise time critical applications like cassette storing
  498.     routines with ZSIM.
  499.  
  500.     A Z80 uses the R register for refreshing dynamic rams and continually
  501.     increments it.  Some programmers used this on a Z80 as random number
  502.     generator.  So ZSIM loads it with "random" values derived from the
  503.     system time.
  504.  
  505.     Port operations do not execute port accesses, as input you get 0FFh.
  506.     The flags are set and port operations with block repeat change the
  507.     count registers accordingly.  You can change all this in module PORTIO.
  508.  
  509.  
  510.     Some Tests of the speed of the emulation:
  511.  
  512.     I used the fellowing benchmarks:
  513.  
  514.     1)   Compile the programm TEST.C included with Ron Cain's Small-C
  515.          Compiler.
  516.  
  517.          The executable TEST.COM is very hard to emulate as its floating
  518.          point routines use undocumented Z80 ops.  Contrary to all other
  519.          emulators I know, ZSIM emulates these operations correctly and
  520.          TEST.COM works.
  521.  
  522.     2)   Compiling MC.PAS (on the Turbo disk) with TURBO PASCAL 3.0 on
  523.          disk.
  524.  
  525.     3)   Compiling LISTER.PAS (on the Turbo disk) with TURBO PASCAL 3.0 in
  526.          memory.
  527.  
  528.     4)   Enter a short assembler loop with the debugger and execute it:
  529.  
  530.               LD   B,20
  531.          L1:  LD   HL,0
  532.          L2:  INC  HL
  533.               LD   A,H
  534.               OR   L
  535.               JP   NZ,L2
  536.               DJNZ L1
  537.  
  538.     5)   let DDT dump a range of memory:
  539.  
  540.          D0,8000
  541.  
  542.          RESULTS (on a 16 MHz 386 SX), Z80 Tests were run on an Amstrad
  543.          CPC, Z80 A, 4 MHz:
  544.  
  545.          TestNr ZSIM:Z80   CPC/Z80     ZSIM
  546.  
  547.             1     0,85     3.37.00   3.04.00
  548.  
  549.             2     0,88     1.20.00   1.10.00
  550.  
  551.             3     0,99     0.03.65   0.03.63
  552.  
  553.             4     1,37     0.17.10   0.23.45
  554.  
  555.             5     0,41     4.06.00   1.40.00
  556.  
  557.  
  558.     Nr. 4 is the test that says most about emulation speed because here
  559.     only calculation time without BIOS overhead is measured.  Test Nr.  1
  560.     strains the disk drive as compiling, assembling and linking are made on
  561.     disk.  The huge disk buffers of ZSIM greatly speed this up.  Test Nr.
  562.     4 is similar to test 1.
  563.  
  564.     Test Nr 3 should give a similar result as Nr. 4, but Turbo Pascal
  565.     continually displays the line it compiles therefore the slow screen
  566.     output of the CPC takes time.
  567.  
  568.     In test Nr 5 screen output is the bottle neck, where the CPC with its
  569.     text output in graphic mode has no chance against the screen output of
  570.     an 80386.
  571.  
  572.  
  573.                         Appendix 1
  574.                         ==========
  575.  
  576.     Implemented screen control sequences:
  577.  
  578.     CPC
  579.  
  580.     ASCII        Operation
  581.      2           cursor off
  582.      3           cursor on
  583.      7           Bell
  584.      8           Cursor left
  585.      9           Cursor right
  586.     10           Cursor down
  587.     11           Cursor up
  588.     12           clear screen
  589.     13           Cursor to beginning of line
  590.     16           delete char under cursor
  591.     17           delete line to cursor
  592.     18           delete line from cursor
  593.     19           delete screen to cursor
  594.     20           delete screen from cursor
  595.     24           toggle highlight
  596.     30           cursor home
  597.     31 x y       cursor column x,line y (home = 1,1 )
  598.  
  599.     CP/M Plus:
  600.  
  601.     ESC @        Init Screen: CLS,HOME,highlight off, cursor on,
  602.              underline off, US char set
  603.     ESC 2 x      select country character set:
  604.                 x        country:
  605.  
  606.                 0        USA
  607.                 1        France
  608.                 2        Germany
  609.                 3        Britain
  610.                 4        Denmark
  611.                 5        Sweden
  612.                 6        Italy
  613.                 7        Spain
  614.  
  615.     ESC A        cursor up
  616.     ESC B        cursor down
  617.     ESC C        cursor right
  618.     ESC D        cursor left
  619.     ESC E        clear screen, cursor keeps position
  620.     ESC H        cursor home
  621.     ESC I        cursor up, scroll if necessary
  622.     ESC J        clear screen from cursor
  623.     ESC K        delete line from cursor
  624.     ESC L        insert line
  625.     ESC M        delete line
  626.     ESC N        delete char below cursor
  627.     ESC Y y x    cursor to column x,line y, Home = 32,32
  628.     ESC d        delete line to cursor
  629.     ESC e        cursor on
  630.     ESC f        cursor off
  631.     ESC j        store cursor position
  632.     ESC k        get stored cursor position
  633.     ESC o        delete line to cursor
  634.     ESC p        highlight on
  635.     ESC q        highlight off
  636.     ESC r        underline on
  637.     ESC s        blinking on
  638.     ESC t        blinking off
  639.     ESC u        underline off
  640.  
  641.  
  642.  
  643.                         Appendix 2
  644.                         ==========
  645.  
  646.     Technical description of the implemented CP/M 80 BIOS.
  647.  
  648.     Every BIOS routine is called by executing a pseudo Z80 CALLN opcode
  649.     (EDED) with BIOS number as following byte.
  650.  
  651.     description of the calls:
  652.  
  653.     0 Cold boot
  654.  
  655.     Loads BDOS from MS-DOS file CPMSYS.CPM into memory and installs BIOS jp
  656.     table and disk parameters in Z80 ram.  Drive A: is selected,
  657.     IO-Byte and punch buffer cleared and control passed to BIOS routine
  658.     warm boot.
  659.  
  660.     If CPMSYS.CPM does not exist, boot tries to load BDOS from the system
  661.     tracks.  ZSIM searches all reserved tracks (<OFF) for the copyright
  662.     message of Digital Reasearch.  If found the following sectors are
  663.     loaded as BDOS.
  664.  
  665.     If this was successful you can create with MOVCPM a file that contains
  666.     the BDOS.  This file must be transfered to the MS-DOS Start Disk of
  667.     ZSIM and be renamed to CPMSYS.CPM.
  668.  
  669.     1 Warm boot
  670.  
  671.     Copy the BDOS that was loaded by function 0 into memory to its correct
  672.     position in the Z80 memory area.  ZSIM takes the correct address
  673.     specified by MOVCPM.  Afterwards it is tested if the disk has a known
  674.     format.  If known the right disk parameters are created.  Now the Z80
  675.     simulator is started and CP/M CCP called.
  676.  
  677.     2 Console Status
  678.  
  679.     return 0FFh in A if there is a char ready on keyboard.
  680.  
  681.     3 Console Input
  682.  
  683.     return ASCII code from keyboard in A.
  684.  
  685.     Contrary to suggested by Digital Research Bit 7 is not cleared.  If an
  686.     international character (e.g.  German Umlaut) is input it is
  687.     transformed from IBM code into CP/M code (e.g.  ä => { ).
  688.  
  689.     International character sets are only displayed if switched on with ESC
  690.     2 x.
  691.  
  692.     Extended PC keys: If in CONIO.ASM the constant WS_KEY is set to TRUE,
  693.     the cursor keys, Ins, Del, Home, End, PgUp and PgDn are converted to
  694.     WordStar control sequences (^Q...  ).  The following call of CONIN
  695.     returns ^Q and the next the corresponding Code.
  696.  
  697.     4 Console Output
  698.  
  699.     Displays char in C on screen.  Control sequences are evaluated as
  700.     described in appendix 1.
  701.  
  702.     5 List Character
  703.  
  704.     Copies char in C to printer lpt0.  Waits until the printer has accepted
  705.     the char correctly.  This would result in an infinite loop is there is
  706.     no printer.  Therefore the function tests for Control-C.  If pressed, a
  707.     jump to Z80 address 0 folllows.  There is normally a jump to warm boot.
  708.  
  709.     6 Punch Character
  710.  
  711.     Digital Research provided this function for serving a punch.  As
  712.     punches/readers aren't of overwhelming importance anymore I used this
  713.     function to transfer data to MS-DOS.  Characters transferred to this
  714.     function are appended to the MS-DOS file PUNCH.CPM.  If it does not
  715.     exist it is created.
  716.  
  717.     The characters are buffered and written out, if buffer is full.  This
  718.     buffer is also written out if the Control-Break menu pops up.
  719.  
  720.  
  721.     7 Read Character
  722.  
  723.     Reads characters from MS-DOS file READER.CPM.  This only works with
  724.     files that don't contain CPM_EOF (26).  The PIP option [o] does not
  725.     help as there is no way to signal PIP the actual end of file and PIP
  726.     gets stuck in an infinite loop.
  727.  
  728.     If READER.CPM does not exist or is read to end, CPM_EOF (26) is
  729.     returned.
  730.  
  731.     To diffentiate EOF from a 26 byte in a binary file this function
  732.     additionally returns at the end of READER.CPM -1 (0ffffh) in HL else
  733.     H=0, L=char.  This is not provided by DR and is not interpreted by
  734.     standard programs especially not by PIP!
  735.  
  736.     The following assembler lines return the character read in L or -1
  737.     in HL:
  738.  
  739.          LD   HL,(1)
  740.          LD   DE,6*3  ; BIOS READER, RETURN IN HL OR -1 IF ERROR
  741.          ADD  HL,DE
  742.          JP   (HL)    ;
  743.  
  744.     After transfering a file you should execute Init Reader in Control
  745.     Break menu.
  746.  
  747.     Example:
  748.  
  749.           PIP B:ANYFILE.TXT=RDR:
  750.  
  751.  
  752.     8 Home
  753.  
  754.     Should return the read/write heads of the drive to track 0, but is not
  755.     executed for speed reasons.  Only set track with parameter 0 is called.
  756.  
  757.     9 Selekt Disk
  758.  
  759.     Selects the Drive given in register C and returns if the drive exists
  760.     in register HL conatins a pointer of its DPH else 0.  There are only
  761.     the physical drive A: and the ramdisk b:
  762.  
  763.     10 Set Track
  764.  
  765.     In register C.
  766.  
  767.     11 Set Sector
  768.  
  769.     In register C.
  770.  
  771.     12 Set DMA
  772.  
  773.     Register BC contains Data transfer buffer address.
  774.  
  775.     13 Read Sector
  776.  
  777.     Reads the sector selected by functions 9,10,10.  Reading from ramdisk
  778.     is quite easy.  Reading from disk is more difficult and for reasons of
  779.     speed the directory track and one data track are buffered in ram.
  780.  
  781.     First must be decided if the sector is already in buffer.  If not the
  782.     track first must be read from disk.  Afterwards the correct address in
  783.     buffer must be calculated.
  784.  
  785.     14 Write Sector
  786.  
  787.     Writes the sector selected by functions 9,10,10.  Writing to ramdisk is
  788.     quite easy.  Writing to disk is more difficult as for reasons of speed
  789.     the directory track and one data track are buffered in ram.  If the
  790.     sector is in the directory track the sector is written out immediately
  791.     for security reasons.  Otherwise the sector is buffered in ram.  It is
  792.     save enough only to write out the directory track immediately as after
  793.     changing a file the directory is updated which results in writing out
  794.     the directory track and the data track.
  795.  
  796.     15 List Status
  797.  
  798.     Signals if the printer is ready to receive (A=1 = ready).
  799.  
  800.     16 Sector Translation
  801.  
  802.     Some CP/M systems make a logical sector translation for the skew
  803.     factor.  This is done by function 16.
  804.  
  805.     26 read/set time and date
  806.  
  807.     This function is a supplement not provided in the CP/M 80 BIOS.  It
  808.     works like in CP/M Plus.  It is also supported by the public domain
  809.     BDOS Z80DOS.  To use it in the source of Z80DOS the entry address of
  810.     time must be set:
  811.  
  812.     BIOStim equ     BIOS+4EH
  813.  
  814.     Writing of date and time (c=0FFh) is not supported in order not to
  815.     change the real time clock of the PC.
  816.  
  817.     A call with C=0 reads the time and returns a pointer in HL to the
  818.     following structure:
  819.  
  820.        dw   @date  ; full days since Jan, 1st, 1978
  821.        db   @hour  ; hours in BCD format
  822.        db   @min   ; minutes in BCD format
  823.        db   @sec   ; seconds in BCD format
  824.  
  825.  
  826.     End of ZSIM.DOC
  827.