How to converting 8085 code to z80 assembly

250 views Asked by At

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
1

There are 1 answers

0
the busybee On

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.