home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / DRI-archive / roche / Z80OPS.TXT < prev   
Internet Message Format  |  2009-12-11  |  3KB

  1. From: "Arobase" <salle.arob...@ville-rochefort.fr>
  2. Newsgroups: comp.os.cpm
  3. Subject: Z80 to 8080 translation
  4. Date: Fri, 14 Jun 2002 12:55:19 +0200
  5. Organization: Salle multimΘdia
  6. Lines: 143
  7. Message-ID: <aecha9$rv$1@wanadoo.fr>
  8. Reply-To: "Arobase" <salle.arob...@ville-rochefort.fr>
  9. NNTP-Posting-Host: apoitiers-102-2-1-132.abo.wanadoo.fr
  10. X-Trace: wanadoo.fr 1024051337 895 193.253.213.132 (14 Jun 2002 10:42:17 GMT)
  11. X-Complaints-To: abuse@wanadoo.fr
  12. NNTP-Posting-Date: 14 Jun 2002 10:42:17 GMT
  13. X-Priority: 3
  14. X-MSMail-Priority: Normal
  15. X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
  16. X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
  17.  
  18. Z80OPS.txt
  19. ----------
  20.  
  21. "Request For Comments"
  22.  
  23. Sorry, group, but I  am working  on a  Z-80 problem,  and cannot
  24. find my doc! (Maybe I should finally do some house cleaning?)
  25.  
  26. I need to translate in 8080 a program  using the  following Z-80
  27. mnemonics:
  28.  
  29. 1) DJNZ label
  30. 2) LDIR
  31. 3) LDDR
  32. 4) CPDR
  33. 5) RLC  B
  34. 6) SBC  HL,DE
  35. 7) SBC  DE,HL
  36. 8) LD   BC,(label)
  37. 9) LD   DE,(label)
  38. 10) LD   (label),DE
  39.  
  40. The only thing I found so  far is  a French  translation of  the
  41. "Z-80 CPU Technical Manual".  My favorite  books by  Alan Miller
  42. are "somewhere" buried in my stuff.
  43.  
  44. Here is my first draft at solving the problem.
  45.  
  46. 1) DJNZ label
  47. decrement B-reg
  48. jump "label" if not zero
  49. so, this must be:
  50. DCR  B
  51. JNZ  label
  52.  
  53. 2) LDIR
  54. (DE) <-- (HL)   ("symbolic operation" in Z-80 Manual)
  55. DE <-- DE+1
  56. HL <-- HL+1
  57. BC <-- BC-1
  58. Repeat until BC=0
  59. so, this must be:
  60. Loop1:
  61. MOV  D,H
  62. MOV  E,L
  63. INX  D
  64. INX  H
  65. DCX  B
  66. JNZ  Loop1
  67. But when is a byte moved? Something is missing.
  68.  
  69. 3) LDDR
  70. (DE) <-- (HL)
  71. DE <-- DE-1
  72. HL <-- HL-1
  73. BC <-- BC-1
  74. Repeat until BC=0
  75. so, this must be:
  76. Loop1:
  77. MOV  D,H
  78. MOV  E,L
  79. DCX  D
  80. DCX  H
  81. DCX  B
  82. JNZ  Loop1
  83. But, again, I don't see any byte moved. (Normally, in  the 8080,
  84. HL is used to "point" to a byte. So, there must be  a "MOV  A,M"
  85. and "MOV M,A" somewhere. I think that the "(DE) <-- (HL)"
  86. must be replaced by "A <-- (HL)" and "(DE) <-- A". What do
  87. you think? And there is also the problem of the number of bytes
  88. to move...)
  89.  
  90. 4) CPDR
  91. A <-- (HL)
  92. HL <-- HL-1
  93. BC <-- BC-1
  94. Repeat until A = (HL) or BC = 0
  95. so, this must be:
  96. Loop1:
  97. MOV  A,M
  98. DCX  H
  99. DCX  B
  100. ???
  101. since BC has just been decremented, we can jump if BC = 0
  102. JZ   Loop1
  103. and, to compare A with (HL), we could use:
  104. LXI  label
  105. CMP  M
  106. JC   Loop1
  107.  
  108. 5) RLC  B
  109. rotate left circular B-reg
  110. ???
  111.  
  112. 6) SBC  HL,DE
  113. subtract with Carry
  114. A <-- A-s-CY    ("s is any of r,n") ???
  115.  
  116. 7) SBC  DE,HL
  117. idem
  118.  
  119. 8) LD   BC,(label)
  120. B-reg <-- (label+1)     (or "HIGH (label)")
  121. C-reg <-- (label)       (or "LOW  (label)")
  122. so, this must be:
  123. LXI  H,label
  124. MOV  C,M
  125. INX  H
  126. MOV  B,M
  127.  
  128. 9) LD   DE,(label)
  129. D-reg <-- (label+1)
  130. E-reg <-- (label)
  131. so, this must be:
  132. LXI  H,label
  133. MOV  E,M
  134. INX  H
  135. MOV  D,M
  136.  
  137. 10) LD   (label),DE
  138. (label+1) <-- D-reg
  139. (label)   <-- E-reg
  140. so, this must be:
  141. LXI  H,label
  142. MOV  M,E
  143. INX  M
  144. MOV  M,D
  145.  
  146. Of course, DJNZ and LDIR are  pretty "standards"  (in fact,  the
  147. BIOS   of    CP/M   Plus    has   a    function   providing    a
  148. hardware-independent  LDIR...),  but  I  am concerned  about the
  149. accuracy of translation of the other opcodes.
  150.  
  151. Relevent comments appreciated.
  152.  
  153. Yours Sincerely,
  154. "French Luser"
  155.  
  156.  
  157. EOF
  158.