2000-05-28 13:40:48 +00:00
|
|
|
;
|
|
|
|
; Ullrich von Bassewitz, 05.08.1998
|
|
|
|
;
|
|
|
|
; CC65 runtime: sub ints
|
|
|
|
;
|
|
|
|
|
|
|
|
.export tossuba0, tossubax
|
2000-11-27 23:37:53 +00:00
|
|
|
.import addysp1
|
2001-11-17 11:25:12 +00:00
|
|
|
.importzp sp
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2003-10-10 17:52:12 +00:00
|
|
|
.macpack cpu
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
; AX = TOS - AX
|
|
|
|
|
|
|
|
tossuba0:
|
|
|
|
ldx #0
|
|
|
|
tossubax:
|
2001-11-17 11:25:12 +00:00
|
|
|
sec
|
|
|
|
eor #$FF
|
2003-10-10 17:52:12 +00:00
|
|
|
.if (.cpu .bitand CPU_ISET_65SC02)
|
2001-11-17 11:25:12 +00:00
|
|
|
adc (sp)
|
|
|
|
ldy #1
|
2000-11-27 23:37:53 +00:00
|
|
|
.else
|
|
|
|
ldy #0
|
2001-11-17 11:25:12 +00:00
|
|
|
adc (sp),y ; Subtract low byte
|
|
|
|
iny
|
2000-11-27 23:37:53 +00:00
|
|
|
.endif
|
2001-11-17 11:25:12 +00:00
|
|
|
pha ; Save high byte
|
|
|
|
txa
|
|
|
|
eor #$FF
|
|
|
|
adc (sp),y ; Subtract high byte
|
|
|
|
tax ; High byte into X
|
|
|
|
pla ; Restore low byte
|
|
|
|
jmp addysp1 ; drop TOS
|
2000-05-28 13:40:48 +00:00
|
|
|
|