mirror of
https://github.com/cc65/cc65.git
synced 2024-11-18 15:05:14 +00:00
23c35f27f8
git-svn-id: svn://svn.cc65.org/cc65/trunk@2507 b7a2c559-68d2-44c3-8de9-860c34a00d81
40 lines
598 B
ArmAsm
40 lines
598 B
ArmAsm
;
|
|
; 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
|
|
.importzp sp
|
|
|
|
.macpack cpu
|
|
|
|
tosadda0:
|
|
ldx #0
|
|
tosaddax:
|
|
clc
|
|
.if (.cpu .bitand CPU_ISET_65SC02)
|
|
adc (sp) ; 65SC02 version - saves 2 cycles
|
|
ldy #1
|
|
.else
|
|
ldy #0
|
|
adc (sp),y ; lo byte
|
|
iny
|
|
.endif
|
|
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
|
|
|