2000-05-28 13:40:48 +00:00
|
|
|
;
|
|
|
|
; Ullrich von Bassewitz, 05.08.1998
|
|
|
|
;
|
|
|
|
; CC65 runtime: add ints
|
|
|
|
;
|
|
|
|
|
|
|
|
; Make this as fast as possible, even if it needs more space since it's
|
|
|
|
; called a lot!
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.export tosadda0, tosaddax
|
|
|
|
.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
|
|
|
tosadda0:
|
2013-05-09 11:56:54 +00:00
|
|
|
ldx #0
|
2000-05-28 13:40:48 +00:00
|
|
|
tosaddax:
|
2013-05-09 11:56:54 +00:00
|
|
|
clc
|
2003-10-10 17:52:12 +00:00
|
|
|
.if (.cpu .bitand CPU_ISET_65SC02)
|
2013-05-09 11:56:54 +00:00
|
|
|
adc (sp) ; 65SC02 version - saves 2 cycles
|
|
|
|
ldy #1
|
2000-11-27 22:59:03 +00:00
|
|
|
.else
|
2013-05-09 11:56:54 +00:00
|
|
|
ldy #0
|
|
|
|
adc (sp),y ; lo byte
|
|
|
|
iny
|
2000-11-27 22:59:03 +00:00
|
|
|
.endif
|
2013-05-09 11:56:54 +00:00
|
|
|
pha ; save it
|
|
|
|
txa
|
|
|
|
adc (sp),y ; hi byte
|
|
|
|
tax
|
|
|
|
clc
|
|
|
|
lda sp
|
|
|
|
adc #2
|
|
|
|
sta sp
|
|
|
|
bcc L1
|
|
|
|
inc sp+1
|
|
|
|
L1: pla ; Restore low byte
|
|
|
|
rts
|
2000-05-28 13:40:48 +00:00
|
|
|
|