2 ; Piotr Fusik, 15.04.2002
3 ; originally by Ullrich von Bassewitz
5 ; Integer compare function - used by the compare operators
8 .export tosicmp, tosicmp0
20 lda (sp),y ; Get low byte
26 lda (sp),y ; Get high byte
34 sbc sreg+1 ; Compare high byte
36 cpx sreg ; Compare low byte
38 adc #$FF ; If the C flag is set then clear the N flag
39 ora #$01 ; else set the N flag
43 eor #$FF ; Fix the N flag if overflow
44 ora #$01 ; Clear the Z flag