I've got a good inkling for how the stack works, but I wanted to confirm something.
When I do the following in code:
LDA #$FF
TXS
Is the stack now initialized to 0x01ff?
I just want to verify the result of the following code:
LDA #$FF
TXS
JSR Place
Place:
LDA #$FF
STA $FF
RTS
I want to make sure this wouldn't corrupt my return address, due to a stack-push from an RTS.
Conversely, I would assume that this code *would* break:
LDA #$FF
TXS
JSR Place
Place:
LDA #$FF
STA $01FF
RTS
Can someone confirm?
Below is some documentation from the 7800 dev guide I found for reference, but it isn't *too* concrete in its explanation of the stack.
There are two (2) 6116 2Kx8 RAM chips on the 7800 PC board.
Together they occupy addresses x '1800' to x'27FF'. They are
also partly accessible (shadowed) at addresses x '0040' - x
'00ff' and x '0140' - x '00FF' to extend zero page (quick access)
RAM and first page (stack) RAM. Refer to the memory map appendix
for further information.
Memory map:
_________________________________
0000 | |
| TIA Registers |
|_________________________________| 001F
0020 | |
| MARIA Registers |
|_________________________________| 003F
0040 | |
| RAM |
| (6116 Block Zero) |
|_________________________________| 00FF
0100 | |
| Shadow of Page 0 |
| (TIA and MARIA) |
|_________________________________| 013F
0140 | |
| RAM |
| (6116 Block One) |
|_________________________________| 01FF
Many thanks to anyone who can confirm this!
-John
P.S. Sorry for posting a lot here recently, but I'm working on a project, and am trying to dive back in.














