I have to answer the following question about the 6502 assembly language:
"On the stack, there are the following values (top element first): 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
At address 0xc000
is the instruction jsr 0xABCD
. Which value will be stored in the program counter after the fetch/execute cycle and what will be the top element of the stack?"
I know that the program counter will be 0xABCD
, but I'm confused about the stack elements. I know that in the 6502 architecture, the stack grows from the top to the bottom (from 0x01FF
to 0x0100
). So, I assume, the stack pointer is pointing to the element 0x01
, right?
Now, the return address should be program counter + 3
, because there is the next
command, so I would say, 0xc003
will be pushed on the stack, but in little endian order, so c0
will be the top element. Is that correct?