mirror of
https://github.com/cc65/cc65.git
synced 2024-12-27 00:29:31 +00:00
e1385c925a
git-svn-id: svn://svn.cc65.org/cc65/trunk@1629 b7a2c559-68d2-44c3-8de9-860c34a00d81
36 lines
809 B
ArmAsm
36 lines
809 B
ArmAsm
;
|
|
; Ullrich von Bassewitz, 25.11.2002
|
|
;
|
|
; CC65 runtime: Swap 2 bytes of register variable space
|
|
;
|
|
|
|
.export regswap2
|
|
.importzp sp, regbank
|
|
|
|
.proc regswap2
|
|
|
|
; First byte
|
|
|
|
lda regbank,x ; Get old value
|
|
pha ; Save it
|
|
lda (sp),y ; Get stack loc
|
|
sta regbank,x ; Store new value
|
|
pla
|
|
sta (sp),y ; Store old value
|
|
|
|
; Second byte
|
|
|
|
iny
|
|
lda regbank+1,x ; Get old value
|
|
pha ; Save it
|
|
lda (sp),y ; Get stack loc
|
|
sta regbank+1,x ; Store new value
|
|
pla
|
|
sta (sp),y ; Store old value
|
|
|
|
rts
|
|
|
|
.endproc
|
|
|
|
|