Talk:Stack: Difference between revisions

From NESdev Wiki
Jump to navigationJump to search
(Mismatched comments on stack pulling example)
 
mNo edit summary
Line 1: Line 1:
 
= Mismatched comments on stack pulling example =
<pre>
<pre>
_pullstack:
_pullstack:
Line 12: Line 12:
</pre>
</pre>
I'm not exactly well-versed in 6502 assembly, but the comments seem mismatched. <code>PLA</code> pops the stack content as intended, although afterwards <code>TAX</code> moves the accumulator to the X register, which doesn't seem to be indicated in the comment. Likewise, the next stack value is again popped, but then it is transferred to Y, despite the comment indicating that that the value would end up in the X register instead. Nothing is done to the last popped value, although the comment indicates the value ending up on the Y register.
I'm not exactly well-versed in 6502 assembly, but the comments seem mismatched. <code>PLA</code> pops the stack content as intended, although afterwards <code>TAX</code> moves the accumulator to the X register, which doesn't seem to be indicated in the comment. Likewise, the next stack value is again popped, but then it is transferred to Y, despite the comment indicating that that the value would end up in the X register instead. Nothing is done to the last popped value, although the comment indicates the value ending up on the Y register.
[[User:Tevo|Tevo]] ([[User talk:Tevo|talk]]) 10:43, 4 August 2020 (MDT)

Revision as of 16:43, 4 August 2020

Mismatched comments on stack pulling example

_pullstack:
  pla		; Pull the value $ff off the stack, and put it into the accumulator.
  tax		; S now becomes $FD.

  pla		; Pull the next value ($bb) off the stack, and put it into the X register.
  tay		; S now becomes $FE.

  pla		; Pull $e0 off the stack, and put it into the Y register.
		; S now becomes $FF -- which is where we started!

I'm not exactly well-versed in 6502 assembly, but the comments seem mismatched. PLA pops the stack content as intended, although afterwards TAX moves the accumulator to the X register, which doesn't seem to be indicated in the comment. Likewise, the next stack value is again popped, but then it is transferred to Y, despite the comment indicating that that the value would end up in the X register instead. Nothing is done to the last popped value, although the comment indicates the value ending up on the Y register.

Tevo (talk) 10:43, 4 August 2020 (MDT)