What does (PC+1) -> PCL and (PC+2) -> PCH mean here?

Building your first 6502-based project? We'll help you get started here.
Post Reply
randomkiwi
Posts: 5
Joined: 26 Oct 2023

What does (PC+1) -> PCL and (PC+2) -> PCH mean here?

Post by randomkiwi »

I was reading the JMP instruction of 6502 at https://www.masswerk.at/6502/6502_instr ... t.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?
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: What does (PC+1) -> PCL and (PC+2) -> PCH mean here?

Post by drogon »

randomkiwi wrote:
I was reading the JMP instruction of 6502 at https://www.masswerk.at/6502/6502_instr ... t.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/
Post Reply