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!
|
|
|
|
|
|
|
|
.export tosadda0, tosaddax
|
2000-06-10 15:48:44 +00:00
|
|
|
.importzp sp
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
tosadda0:
|
|
|
|
ldx #0
|
|
|
|
tosaddax:
|
2000-11-27 22:59:03 +00:00
|
|
|
clc
|
|
|
|
.ifpc02
|
|
|
|
adc (sp) ; 65C02 version - saves 2 cycles
|
|
|
|
ldy #1
|
|
|
|
.else
|
|
|
|
ldy #0
|
|
|
|
adc (sp),y ; lo byte
|
|
|
|
iny
|
|
|
|
.endif
|
2000-06-10 15:48:44 +00:00
|
|
|
pha ; save it
|
2000-11-27 22:59:03 +00:00
|
|
|
txa
|
|
|
|
adc (sp),y ; hi byte
|
2000-05-28 13:40:48 +00:00
|
|
|
tax
|
|
|
|
clc
|
|
|
|
lda sp
|
|
|
|
adc #2
|
|
|
|
sta sp
|
|
|
|
bcc L1
|
|
|
|
inc sp+1
|
2000-06-10 15:48:44 +00:00
|
|
|
L1: pla ; Restore low byte
|
2000-05-28 13:40:48 +00:00
|
|
|
rts
|
|
|
|
|