New functions to swap register variables

git-svn-id: svn://svn.cc65.org/cc65/trunk@1629 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2002-11-25 12:38:38 +00:00
parent da44e7ae4b
commit e1385c925a
4 changed files with 88 additions and 0 deletions

22
libsrc/runtime/regswap1.s Normal file
View File

@@ -0,0 +1,22 @@
;
; Ullrich von Bassewitz, 25.11.2002
;
; CC65 runtime: Swap 1 byte of register variable space
;
.export regswap1
.importzp sp, regbank
.proc regswap1
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
rts
.endproc