1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-26 08:32:00 +00:00
cc65/libsrc/runtime/rsub.s

38 lines
712 B
ArmAsm
Raw Normal View History

;
; Ullrich von Bassewitz, 05.08.1998
2017-03-12 22:21:43 +00:00
; Christian Krueger, 11-Mar-2017, added 65SC02 optimization
;
; CC65 runtime: sub ints reversed
;
.export tosrsuba0, tosrsubax
.import addysp1
.importzp sp, tmp1
2017-03-12 22:21:43 +00:00
.macpack cpu
;
; AX = AX - TOS
;
tosrsuba0:
ldx #0
tosrsubax:
sec
2017-03-12 22:21:43 +00:00
.if (.cpu .bitand CPU_ISET_65SC02)
sbc (sp)
ldy #1
.else
ldy #0
sbc (sp),y ; lo byte
2017-03-12 22:21:43 +00:00
iny
.endif
sta tmp1 ; save lo byte
txa
sbc (sp),y ; hi byte
tax
lda tmp1
jmp addysp1 ; drop TOS, set condition codes