mirror of
https://github.com/cc65/cc65.git
synced 2024-11-12 07:07:19 +00:00
c2a88fd697
git-svn-id: svn://svn.cc65.org/cc65/trunk@671 b7a2c559-68d2-44c3-8de9-860c34a00d81
44 lines
721 B
ArmAsm
44 lines
721 B
ArmAsm
;
|
|
; Ullrich von Bassewitz, 10.12.1998
|
|
;
|
|
; Integer compare function - used by the compare operators
|
|
;
|
|
|
|
.export tosicmp
|
|
.importzp sp, sreg
|
|
|
|
|
|
tosicmp:
|
|
sta sreg
|
|
stx sreg+1 ; Save ax
|
|
|
|
ldy #$01
|
|
lda (sp),y ; Get high byte
|
|
tax
|
|
dey
|
|
lda (sp),y ; Get low byte
|
|
|
|
; Inline incsp2 for better performance
|
|
|
|
inc sp ; 5
|
|
bne @L1 ; 3
|
|
inc sp+1 ; (5)
|
|
@L1: inc sp ; 5
|
|
bne @L2 ; 3
|
|
inc sp+1 ; (5)
|
|
|
|
; Do the compare.
|
|
|
|
@L2: cpx sreg+1 ; Compare high byte
|
|
bne @L3
|
|
cmp sreg ; Compare low byte
|
|
beq @L3
|
|
bcs @L4
|
|
lda #$FF ; Set the N flag
|
|
@L3: rts
|
|
|
|
@L4: lda #$01 ; Clear the N flag
|
|
rts
|
|
|
|
|