Parameter Passing: Difference between revisions
Content added Content deleted
Line 65: | Line 65: | ||
This one's tricky because of the way pointers work on the 6502. Unlike the other architectures of its day there are no "address registers" per se, but we can make our own using the zero page. |
This one's tricky because of the way pointers work on the 6502. Unlike the other architectures of its day there are no "address registers" per se, but we can make our own using the zero page. |
||
<lang 6502asm> |
|||
LDA #$03 ;load the low byte of the parameter's address |
|||
STA $20 ;store it in the low byte of our pointer variable. |
STA $20 ;store it in the low byte of our pointer variable. |
||
LDA #$00 ;load the high byte. |
LDA #$00 ;load the high byte. |