randomkiwi wrote:
I was reading the JMP instruction of 6502 at
https://www.masswerk.at/6502/6502_instruction_set.html#CMP It states the folllowing:
Quote:
JMP: Jump to New Location
(PC+1) -> PCL
(PC+2) -> PCH
I understand that the JMP instruction will change the Program Counter to the address given by the operand of the JMP instruction, after which it starts executing instructions starting from this new location. But I don't understand what does (PC+1) -> PCL and (PC+2) -> PCH mean exactly?
Generally, ()'s round something means an indirection, so (PC+1) means the byte
at the location PC+1 and not the
value of PC+1.
So the CPU is decoding the JMP instruction at PC, the CPU fetches the byte at PC+1 and stores it into PCL, (The low byte of the 16-bit program counter) fetches the next byte and stores in into PCH (high byte) then fetches the next instruction at the new PC.
You may next wonder how it can fetch the high byte after it's modified the low byte of the PC... How deep do you want to go?
-Gordon
_________________
--
Gordon Henderson.
See my
Ruby 6502 and 65816 SBC projects here:
https://projects.drogon.net/ruby/