You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
809 B
ArmAsm
36 lines
809 B
ArmAsm
12 years ago
|
;
|
||
|
; 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
|
||
|
|
||
|
|