1984-12-17 11:03:13 +00:00
|
|
|
.define Exg2
|
1987-01-30 18:41:42 +00:00
|
|
|
.sect .text
|
|
|
|
.sect .rom
|
|
|
|
.sect .data
|
|
|
|
.sect .bss
|
|
|
|
.sect .text
|
1984-12-17 11:03:13 +00:00
|
|
|
|
|
|
|
! This subroutine exchanges two words on top of the stack.
|
|
|
|
! The top word of the stack is really in the AX registerpair.
|
|
|
|
! So this word is exchanged with the top of the real stack.
|
|
|
|
|
|
|
|
|
|
|
|
Exg2:
|
|
|
|
pha ! save A
|
|
|
|
txa
|
|
|
|
pha ! save X
|
|
|
|
jsr Pop ! get top real stack
|
|
|
|
stx EXG
|
|
|
|
sta EXG+1 ! save top of real stack
|
|
|
|
pla ! get X
|
|
|
|
tax
|
|
|
|
pla ! get A
|
|
|
|
jsr Push ! push on real stack
|
|
|
|
ldx EXG ! get new X
|
|
|
|
lda EXG+1 ! get new A
|
|
|
|
rts
|
|
|
|
|
|
|
|
|