6502.org http://forum.6502.org/ |
|
[47] 6502 Processor Stack pointer http://forum.6502.org/viewtopic.php?f=7&t=304 |
Page 1 of 1 |
Author: | tonyhall1 [ Sun Apr 23, 2000 4:08 pm ] |
Post subject: | [47.1] 6502 Processor Stack pointer |
Hi Guys, i have a question about the 6502 processor's stack pointer. 1. how big is the stack area of memory and what does it store and in what format? 2. what does the stack pointer store, a memory location(to what) or a position number within the stack area of memory(e.g. location 2) Cheers Tony |
Author: | simonj5 [ Tue Apr 25, 2000 5:07 am ] |
Post subject: | [47.2] 6502 Processor Stack pointer |
Tony, The stack pointer in a 65(C)02 is implemented as an 8-bit register that provides an index into the area of memory between 0x100 and 0x1ff. This is part of the main memory map (unlike some microcontrollers that have a seperate memory map for their stacks?). It is byte aligned and contains a mixture of both 'system' and 'user' information. The system information is typically return addresses held, if memory serves, as low-byte then high-byte. Obviously user information can be in any format. I hope this helps. Regards, Simon J |
Author: | simonj5 [ Tue Apr 25, 2000 5:07 am ] |
Post subject: | [47.3] 6502 Processor Stack pointer |
Tony, The stack pointer in a 65(C)02 is implemented as an 8-bit register that provides an index into the area of memory between 0x100 and 0x1ff. This is part of the main memory map (unlike some microcontrollers that have a seperate memory map for their stacks?). It is byte aligned and contains a mixture of both 'system' and 'user' information. The system information is typically return addresses held, if memory serves, as low-byte then high-byte. Obviously user information can be in any format. I hope this helps. Regards, Simon J |
Author: | JIM1831 [ Fri Apr 28, 2000 10:44 am ] |
Post subject: | [47.4] 6502 Processor Stack pointer |
If I remember correctly, when a JSR instruction is executed, the current program counter is pushed on the stack + or - 2 (something strange like that). Why isn't the return adddress (JSR + 3) put onto the stack for eventual RTS? I've always wanted to know this. Jim Lewandowski |
Author: | leeeeee [ Fri Apr 28, 2000 4:25 pm ] |
Post subject: | [47.5] 6502 Processor Stack pointer |
Hi Jim, You said ... If I remember correctly, when a JSR instruction is executed, the current program counter is pushed on the stack + or - 2 (something strange like that). Why isn't the return adddress (JSR + 3) put onto the stack for eventual RTS? .... The return address-1 is pushed (or JSR +2 whichever you prefer to call it). Why? Well after the return address is pulled from the stack the program counter is incremented by one before the next instruction is fetched. You know it all makes sense. Lee. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |