How do I efficiently do signed comparisons on the 8080?
问题 I want to compare two 16-bit numbers and branch on the result: the equivalent of if (a<b) goto negative . I'm using an Intel 8080. The Z80 has a signed arithmetic overflow flag which can be used for this with some degree of effort. The standard code is: ld de, _left ld hl, _right ld a, e sub a, l ld a, d sbc a, h jp po, $+5 ; branch on overflow flag not set xor a, 0x80 ; flip sign bit jm negative ; actually do the test But the 8080 isn't a strict subset of the Z80, and the code above won't