-5>5 is true since this is unsigned so A should be 4 now

4<<-5 is false since this is signed (like basic) so A is still 4

Is it outputting something else?

Unless my understanding of how signed comparisons work, the routine should always work.

`xor a ;Make A zero`

ld b,h ;H is saved for later

sbc hl,de ;The values are compared unsigned (carry flag)

ld h,a ;Command returns 1 or 0 so high byte is zeroed

rra ;Carry is put into bit 7 of a

xor b ;Bit 7 is xored with sign bit of original left argument

xor d ;Bit 7 is xored with sign bit of original right argument

rlca ;Bit 7 put into bit 0

and %00000001 ;Mask to make this a 1 or 0

ld l,a ;HL holds (sign1 xor sign2 xor comparison)