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