I have problem when I am subtracting two 16 bits numbers in assembler for i8080 processor.
Example: 0f70 - 00f0 and first number will be in registers B and C, second in D and E.
Binary:
B = 0000 1111 C = 0111 0000
D = 0000 0000 E = 1111 0000
So when I subtract C-E it need "borrow". Ok so I will decrement B but what about C? I know in this case C would be 1000 0000 but other cases?
Code:
ORG 800H
RST 5
MOV B,D
MOV C,E //after this in B and C I have 16bit minuend
RST 5 //after this in D and E I have 16bit subtrahend
MOV A,C //Move C to Accumulator
SUB E //subtract E
JC SUBTRACTINGB //if it don't need borrow jump
DCR B //else decrement B
MVI C,? // and what should be in C???
C
? You don't have to fix it up or anything like that, borrow only goes towards higher bits – harold