1

I have 8085 assembly code for dividing 2 data 8 bit

:
        MVI  C,FFH
        LXI  H,1900H
        MOV  A,M   (A=08)
        INX  H
        MOV  B,M   (B=3)
REPEAT: INR  C
        SUB  B
        JNC  REPEAT
        ADD  B
        INX  H
        MOV  M,C
        INX  H
        MOV  M,A
        HLT
Ted Lyngmo
  • 93,841
  • 5
  • 60
  • 108
谢RenS
  • 21
  • 2
  • 2
    Have you tried [8-bit divisions using shifts](http://map.grauw.nl/articles/mult_div_shifts.php#8bitdivsh) – Ted Lyngmo Oct 14 '20 at 10:49

1 Answers1

3

If you don't use the special opcodes RIM and SIM that only the 8085 has, the resulting machine code will run in almost all cases on the Z80 without changes. This is the case with your program.

However, if your task is to translate the mnemonics, just do a search-and-replace session. Start with the first one, MVI, and change it to LD. And so on.

You will need to change operands like M to (HL), too, because that is the syntax of the Z80 assembler.

Anyway, you need both instruction sets to do this.

the busybee
  • 10,755
  • 3
  • 13
  • 30