ack/mach/i80/libem/cmps_mag.s
David Given d63a359a49 Fix nearly all the comparisons, a lot of which were broken. Using a rst for
unsigned comparisons is surprisingly not that useful due to marshalling
overhead; it's only four bytes to do inline (plus jc), or six for a constant.
Also add some useful top optimisations.  Star Trek goes from 39890 to 39450
bytes.
2019-02-15 21:30:27 +01:00

20 lines
428 B
ArmAsm

.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
! Does a tristate signed comparison of hl <> de.
! Returns m flag if hl < de.
! Returns p flag if hl >= de.
! This doesn't set z coherently.
.define .cmps_mag
.cmps_mag:
mov a, d
xra h
jp .cmpu_mag ! signs are the same, so an unsigned comparison will do
xra h ! set A=H and set the sign flag
ral ! move sign flag into carry
ret