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