home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / pc / progs / emulatez80 / ReadMe next >
Encoding:
Text File  |  1992-06-14  |  7.2 KB  |  149 lines

  1. Z80 EMULATOR by Dave Higton
  2.  
  3. This is not yet complete, but I have uploaded it to gauge interest.  It
  4. emulates a Z80, specifically in the environment of a Vector Graphic System B
  5. computer.  The memory map is as follows:
  6.  
  7. 0000-DFFF RAM
  8. E000-EFFF EPROM (E000-E7FF is monitor, rest is extensions)
  9. F000-F77F Video RAM, direct mapped to screen as 80 * 24
  10. F780-F7FF RAM, not mapped to screen
  11. F800-FBFF EPROM, sometimes used for disc boot EPROMs
  12. FC00-FFFF RAM, used by monitor and basic I/O for stack etc.
  13.  
  14. All the RAM from F000-F7FF is accessible in the original machine during
  15. vertical blanking only, therefore the area from F780-F7FF is very rarely
  16. used in practice.
  17.  
  18. The original machine uses the PHANTOM line of the S100 bus to relocate EPROM
  19. to locations 0000-0FFF for the first instruction following a hard reset.
  20. The first three bytes in EPROM are a jump to a location in the monitor
  21. EPROM.  Therefore I have made the reset jump to &E000 rather than 0000. This
  22. is directly equivalent.
  23.  
  24. The I/O map of the original cannot be exactly copied in the emulator since
  25. this would require three serial ports, for instance.  However, the keyboard
  26. status port is at 00, keyboard data at 01, and serial status/data INPUT
  27. ports are at 05 and 04.  The original computer had Micropolis 5 1/4"
  28. hard-sectored disc drives (this was state of the art when it was designed!)
  29. and the emulation cannot reflect this either.  I'm working on mapping the
  30. Arc's floppy disc hardware into the I/O map at &F0 to &F5, but this isn't
  31. complete yet.  See later caution!
  32.  
  33. There is no concept of interrupts in this emulator.  However, none of the
  34. normal system software requires them, so this shouldn't be a problem.
  35.  
  36. All single byte instructions are emulated except &76 (HALT) which would be
  37. meaningless (would cause the machine to freeze because there aren't any
  38. interrupts to un-HALT it), therefore causes an abort.  All the CB-prefixed
  39. instructions are emulated.  The easier ED-prefixed instructions are
  40. emulated, others aren't yet (e.g. RLD and so on).  The indexed instructions
  41. using IX are complete except for the DD CB group (shifts/rotates/bit
  42. test/set/reset). The IY instructions are not present except for PUSH IY and
  43. POP IY.  When I have finished the IX group, it will be easy to complete the
  44. IY group, largely by copying and global search/replace.
  45.  
  46. The monitor has the following commands:
  47. A ASCII Dump <start> <end>
  48. B Boot Disc (this will cause an abort)
  49. C Compare <start> <end> <2nd block start> Compares 2 blocks of memory
  50. D Hex Dump <start> <end>
  51. E Ext Com (copies serial port's input to screen)
  52. F Find-2 <start> <end> <byte1> <byte2>
  53. G Go to <address>
  54. H Hi RAM (jumps to an address in the top 1K of RAM)
  55. I Input <port>
  56. J Jump to DOS (at 0000, to cause a CP/M warm start)
  57. K Break at <address> Enter breakpoint
  58. L Lo ram (jumps to an address in main RAM)
  59. M Move <start> <end> <new start> (copies a block of memory)
  60. N Non-destructive RAM test <start> <end>
  61. O Output <port> <data>
  62. P Program <address>
  63. Q Checksum <start> <end>
  64. R Registers
  65. S Search-1 <start> <end> <byte>
  66. T Test RAM <start> <end> (destructive test, i.e. overwrites old contents)
  67. U User area
  68. V Boot Dualstor (would boot some kind of disc, but won't - yet!)
  69. W Boot Megastor (would boot a hard disc, but won't - yet!)
  70. X Exchange <start> <end> <snd block start> Exchanges 2 blocks of memory
  71. Y Echo keys (to screen)
  72. Z Zero/fill RAM <start> <end> <data>
  73.  
  74. Commands such as N, T and Y are terminated by the Esc key.  Others return
  75. immediately to the monitor main loop, except for the disc boot operations.
  76.  
  77. The character generator is faithfully emulated.  Printing characters from
  78. &20 to &7F are standard ASCII.  Characters from &00 to &1F are block graphic
  79. characters.  Setting bit 7 displays any character in inverse video - this
  80. enables displaying the 6th block graphic.
  81.  
  82. The monitor has several entry points. &E000 is the cold start entry, &E003
  83. is the warm start, &E009 is the video driver.  Executing opcode &FF (RST
  84. 38H) prints the register contents and enters the monitor.
  85.  
  86. Any opcodes which are not implemented cause the emulator to print out all
  87. register contents and exit.  The emulator runs in system mode.  Interrupts
  88. are enabled, but I'm not sure what interrupts are actually accepted and
  89. serviced.  The monotonic timer appears not to run.  The emulator is an
  90. application, i.e. it executes at &8000 and takes over the machine
  91. completely.
  92.  
  93. I recommend that you don't output to ports &F0 to &F5 because of the mapping
  94. to the disc hardware of the Arc.  If you do, you could manage to write to a
  95. floppy disc, thereby damaging the information held on it.  You have been
  96. warned!
  97.  
  98. The video driver handles various control characters, but they may not be the
  99. ones you are expecting.  E.g. control-D clears screen, control-U is cursor
  100. up, control-R is cursor down, control-W is cursor left, control-Z is cursor
  101. right, control-P is erase to beg. of line, control-X is erase to beg. of
  102. line, control-T toggles normal/inverse video.  There is no bell or beep on
  103. the machine being emulated.
  104.  
  105. While executing, the Esc key does not cause an escape event.  This is
  106. because the monitor programme requires use of the escape key.  It is reset
  107. to normal when the emulator exits.  An abort (due to an illegal instruction)
  108. is the only way to exit - like the PC emulator.
  109.  
  110.                               SPEED
  111.  
  112. Everyone asks this.  There isn't, however, a one-number answer.  Some
  113. instructions execute fast (e.g. LD R, R'), others execute slowly.  The final
  114. answer on speed has to come from any individual programme.  In general, it
  115. executes on an ARM2 A3000 a bit slower than a 4 MHz Z80 with no wait states.
  116. Since it is an interpreter, I don't know any way to speed it up.
  117.  
  118.                             THE FUTURE
  119.  
  120. 1) I do intend to implement all the instructions!
  121.  
  122. 2) The floppy disc hardware will be mapped in properly.  This won't be
  123.    simple because the emulator doesn't execute fast enough to read/write
  124.    sectors/tracks directly; however, it should end up simple to use.
  125.  
  126. 3) If someone can tell me how to write a keyboard handler, I'll make the
  127.    Arc's cursor keys emit the codes expected by the monitor programme and 
  128.    the other software written by Vector Graphic.
  129.  
  130. 4) I want to customise CP/M for this hardware.  Clearly, the original 
  131.    version was for a hard-sectored controller.
  132.  
  133. If I manage to get it to that state, then there will be a very good text
  134. editor (SCOPE - SCreen Oriented Program Editor) and an excellent debugger
  135. (ZRAID - Z80 RApid Interactive Debugger) available.  These programmes were
  136. written by Vector Graphic.  I also have used, and can thoroughly recommend,
  137. SLR Systems' assembler and linker - the virtual linker (SLRNK+) being
  138. particularly useful since it can cope with a full 64K and more, overlays,
  139. etc.  However, the SLR Systems programmes are current (as is the company)
  140. and so these programmes would have to be bought by any user.  Vector Graphic
  141. was an American company which went bankrupt some years ago - can anyone
  142. advise me on what the legal status of their software might be?  Clearly
  143. Digital Research are still in business, and own the copyright of CP/M.  So
  144. if anyone knows anything about the legal requirements of distributing a
  145. newly customised version of CP/M, I'd like to hear from you.
  146.  
  147. Leave messages for me on The World Of Cryton BBS.
  148.  
  149. Dave Higton