Veltas/zenv

Optimize "DU<" with "U<"

Closed this issue · 1 comments

Part of the "U<" code can be used in "DU<".
` HEADER du_less_than, "DU<", 0
du_less_than:
LD C, L
LD B, H
POP DE
POP HL
OR A
SBC HL, BC
JR Z, u_less_than.equal
JR common_less_than.not_equal

HEADER u_less_than, "U<", 0

u_less_than:
EX DE, HL
.equal:
POP HL
common_less_than:
OR A
SBC HL, DE
.not_equal:
LD HL, 0
JR NC, .exit
DEC HL
.exit: JP next
`

Veltas commented

Thanks, this is a good size optimisation for a less-used double word. Changes based on this suggestion in b458ef3 and fe7901f.