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 / CPM / TURBODSG / EMUL.DOC < prev    next >
Text File  |  2000-06-30  |  7KB  |  166 lines

  1. EMUL.DOC    as of 12/07/85        version 2.20
  2.  
  3.  
  4. This is version 2.20 of EMUL.CMD, an 8080 emulator for use with the NEC
  5. uPD70116 and uPD70108 series CPUs (also known as the V30 and V20,
  6. respectively).
  7.  
  8. NOTE:    UPDATE INFO APPENDED TO END OF FILE
  9.  
  10.     This copyrighted program has been released to the Public Domain
  11.     for NONCOMMERCIAL uses only. Users wishing to use this utility
  12.     for ANY purpose other than personal use must first obtain written
  13.     authorization. Commercial distribution of this utility is
  14.     strictly forbidden without authorization and a $20.00 royalty fee
  15.     per distributed copy.
  16.     The above does not apply to distribution via "SIG-M library"!
  17.  
  18.     The author assumes no liability of any kind for damages arising
  19.     from the use or inability to use this utility.
  20.  
  21.  
  22. Background:
  23.  
  24. The NEC V20 and V30 are direct hardware replacements for Intel's 8088
  25. and 8086 CPU chips, respectively, and in most cases just drop in and
  26. make life SLIGHTLY faster.  The speed improvement is in many cases nothing
  27. to lose sleep about, certainly not worth the twenty bucks you'll have to
  28. shell out for the chip!  I have run a series of "average" programs and
  29. found that they USUALLY run about 5% faster.  A popular Public Domain
  30. CPU speed test for MSDOS clocked the V30 at 7.85MHz and the 8086 at 7.95!!!!
  31.  
  32. There are 3 reasons, however, why you might want to spend the twenty anyway.
  33. First, the little critters are 80186/80188 instruction compatible. This means
  34. you can do your PUSHAs and POPAs and your string out a'la Z80's OTIR.  Note
  35. that the V-series, unlike the 80186, does not mask the shift/rotate count,
  36. so there is no easy way of telling the chip is not an 8086/88...
  37. Second, NEC crammed a number of unique instructions into the chip, giving
  38. you basically the same type bit handling like the Z80, as well as BCD
  39. shift/rotate. Here a note to BCD: the manual does not explain, but fact is
  40. that a BCD shift/rotate wipes out the high nybble of AL. As if that mattered,
  41. anyway...
  42. Third, and now we're at the bottom of all THIS, NEC has added a mode bit
  43. which, when reset, makes that chip think it's an 8080 with 4 afterburners.
  44. You'll see shortly why afterburners.
  45.  
  46. Foreground:
  47. Picture yourself sitting in front of some CP/M-86 or 16 bit TurboDOS machine
  48. wanting, like I have for YEARS now, to be able to run you favorite text
  49. editor which is unavailable outside the CP/M-80 world.  Frustrating that
  50. you have to put up with old WordPlanet or somesuch, where you could, for
  51. example run MINCE (the king of editors, yea!!!) if you only had something to
  52. run it on!!!!
  53. Now, in the TurboDOS world there is a neat Z80 simulator called TZ80 which
  54. runs nearly every program that would ordinarily run under 8 bit TurboDOS.
  55. Unfortunately, it is a SIMULATOR, and instructions have to be decoded one
  56. at a time and executed. It is SLLLLLLLLLOOOOOOOOOOOOOW. Also, aside from
  57. some inferior Public Domain "emulators", there is no such beast available
  58. for CP/M-86 that runs reliably.
  59.  
  60. Enter EMUL.CMD.
  61. EMUL is a true emulator which only works with NEC's V20 and V30 CPUs and
  62. EXECUTES 8080 instructions. It allows you to run just about ANY CP/M-80
  63. program with the following exceptions:
  64.  
  65. 1. The CP/M-80 program MUST be 8080-only (no Z80 code) or the HCF (halt
  66.    and catch fire) instruction will obliterate every byte of RAM!
  67. 2. You must be running a NEC CPU, either V20 (uPD70108) or V30 (uPD70116);
  68.    EMUL tries to do some checking but may not be able to tell in all cases!
  69. 3. Your 8080 program must not attempt any BIOS calls other than for
  70.    console I/O. All other calls are IGNORED.
  71.  
  72. EMUL has been tested with the following software:
  73. MBASIC 5.21
  74. MINCE 2.6
  75. WordStar 3.3
  76. SID 3.0
  77. M80
  78. LINK-80
  79. BDS C 1.50A
  80.  
  81.  
  82. Internals:
  83. To TurboDOS programmers, the source code may be readable. Those used to
  84. ASM-86 or RASM may find it a bit weird. Sorry, that's what I use around
  85. here.   The only real confusion will arise in the fact that in EMUL ver
  86. 2, the 8080 environment is compacted so as not to take up 64k of mostly
  87. empty space. Since the environment is ORGed in the data segment and the
  88. 8086 data segment includes base page.    Therefore, all offsets used in
  89. the 8080 environment must not only be adjusted for theit actual running
  90. location, but also for their relative location at load time.    This is
  91. why you see equates like "BDOS-0X100",  or in the base page setup code,
  92. "DFCB1-0X100" is used.   End effect is, that EMUL works.   The programs
  93. hardest to please in regard to base page setup were M80 and MBASIC, and
  94. they both work flawlessly now.
  95.  
  96.  
  97.  
  98. The afterburner:
  99.  
  100. I wrote a timing proram with the following core:
  101.  
  102.     MVI    E,50
  103.     LXI    B,0
  104. LOOP:    XTHL
  105.     XTHL
  106.     DCX    B
  107.     MOV    A,B
  108.     ORA    C
  109.     JNZ    LOOP
  110.     DCR    E
  111.     JNZ    LOOP
  112.  
  113. The program, running on a 6MHz Z80 under TurboDOS 1.41 executed
  114. in 35.84 seconds, including time to access the clock.
  115. The same program running on an 8MHz V30 under EMUL executed
  116. in 24.88 seconds, making execution speed equivalent to an 8.64MHz Z80!
  117.  
  118. I have also run the following speed tests under the following conditions:
  119. Z80 TurboDOS, 6MHz CPU, 800k RAM disk on 16 bit slave
  120. 8086 TurboDOS, 8MHz V30, 800k RAM disk on slave
  121.  
  122. Times:                Z80        V30/EMUL
  123. WordStar: ^Q^C on 180k file:    0:59        0:17
  124. WordStar: ^F last line:        1:05        0:21
  125. M80 assemble 64k source:    1:36        0:59
  126. Compile+link RBBS4 (BDS C):    2:59        1:58
  127.  
  128. Ever seen ANY 8080 THAT FAST????!!!!!?????
  129.  
  130. have fun 8080ing!!!!!!!!
  131.  
  132.  
  133. -------------------------- UPDATE INFORMATION ---------------------------
  134.  
  135. VERSION 2.10  11/25/85
  136.     CP/M-86 returns a  version number which may be objectionable to some
  137.     programs. Therefore, the equate "CPMVER" in the source file has been
  138.     added, which should be customized for your system if you do not have
  139.     CP/M-86. It is currently set to return a CP/M version of 2.2,  which
  140.     should work in most cases.  If you run this under either  MP/M-86 or
  141.     TurboDOS, you may want to set it to return 3.0 and/or MP/M.
  142.     To do this, load EMUL.CMD into a debugger (in edit mode,  not trace)
  143.     and change the word at DS:6AF from 22 00 to 30 01.   The low byte is
  144.     the version number and the high byte is the MP/M flag (0 or 1).
  145.     NOTE that EMUL simply routes  ALL other function requests through to
  146.     the host operating system, so no further changes are required to run
  147.     programs that do MP/M record locking.
  148.     TurboDOS  users should always set the  CP/M version to 30 01 and add
  149.     MPMSUP to the slave GEN file.   TurboDOS users may change the CPMVER
  150.     equate and reassemble with TASM and link with TLINK (use -1 option).
  151.  
  152. VERSION 2.11  11/28/85
  153.     Changed default message to show TPA size. Noticed the following:
  154.     If the 8080 stack pointer points to an ODD address, all stack
  155.     operations will be degraded. If possible, check programs and adjust
  156.     stack pointer to point to an EVEN address. Example: A small program
  157.     using CALL and RET ran in 6.4 seconds with even stack pointer and
  158.     8.68 seconds with odd stack pointer.
  159.  
  160. VERSION 2.20  12/07/85
  161.     Minor cosmetic changes.  Also changed error check after opening file
  162.     to work correctly under CP/M-86.  EXPERIMENTALLY trapping the emulator
  163.     BDOS calls now since I suspect certain BDOS functions destroy BP
  164.     (which serves as SP for the 8080).
  165. requests through to
  166.     the host