You can use temporary variables or the stack. Temporary variables tend to be easier to comprehend, and the SNES (IMO) has a lot of RAM. The choice is yours. There's no wrong way. I think at this point though using temporary variables in direct page/RAM would be easier for you.
The issue with the stack is that because of the use of a subroutine via JSR, the last 2 bytes pushed onto the stack are going to be the address of the last byte of the operand of the JSR, which isn't what you're wanting via PLX/PLY.
That said, your code still had a bug relating to doing PHP followed by a (16-bit) PLX, so that's responsible for one of two issues.
Movax12 mentioned stack-based addressing, which is something the 65816 has (6502/65c02 does not have this). I don't know what the exact syntax is in WLA DX for it, but the common syntax for addressing is
n,s where
n is an "offset" that starts at the active stack pointer (S) and works backwards -- it's kinda like indexing using
n,x or
n,y just "via the stack" (which works backwards due to the fact that S decrements, not increments). Stack-relative stuff consists of a 2-byte instruction, which means it can only address up to 256 bytes "backwards from S". It also
does not modify the stack, so it's still your responsibility to pull data off (to keep from having a stack overflow) later. Some example code:
Code:
rep #$20
lda #$1234
pha
jsr myroutine
...
...
pla ; Pull previous data (PHA) off stack (keep stack overflow from happening)
loop:
bra loop
myroutine:
php
rep #$10
lda $4,s ; Load 16-bit data pushed onto the stack via PHA earlier, into accumulator
; $3,s would be one of the bytes of the JSR address
; $2,s would be one of the bytes of the JSR address
; $1,s would be the value of P pushed via PHP
...
plp
rts
The thing to remember about stack-based addressing is that the "last byte pushed on the stack" would be
$1,s, because S always points to the "next" available spot. You shouldn't ever do something like
$0,s.
It's believed that the main reason this mode was implemented was solely for things like subroutines that mimic C or other languages where arguments passed to a function are pushed on to the stack prior to the function (subroutine) being used.
One downside to stack-based addressing (and this upset a lot of people at the time): the number of opcodes supporting this addressing mode are very few, and all relate to the accumulator. You thus cannot do something like
ldx $2,s (there is no such opcode supporting that addressing mode).
But as I said near the start: I think right now, using temporary variables would keep things simpler for you. No judgement there whatsoever -- you're still learning, so it's perfectly fine. :-)
P.S. -- I myself have never used the stack-relative addressing mode. This is the first time I've actually taken the time to fully look at it and take a shot at some example code using it. Here be dragons.