shoving addresses into the program counter typo?
Posted: Thu Jun 16, 2022 3:40 am
My copy of the Scanlon book, 6502 Software Design, is in. I was just thrown for a loop by the last sentence in this paragraph on page 18, so I'm posting my thoughts here in case it trips anyone else up (bold emphasis mine):
Huh? It seems to claim that for (multi-byte) instructions that contain an address, the address goes into the program counter? If that's the case, then LDA $0000 would set the PC to $0000 instead of loading the value at $0000 into A. Or is $0000 considered "data" and goes into the ALU in this case? I think only the various jump and branch instructions are the kinds of address-carrying instructions the author was thinking of that sometimes change the PC. But many instructions, like shifts, rotates, loads, and stores, etc., do not otherwise change the PC apart of allowing it to increment to the next instruction. Is my understanding correct?
Quote:
Instructions are comprised of one, two, or three bytes. The first byte always holds the machine-code equivalent of the operation code (op code), so this byte is directed into the instruction register and routed to the instruction decode logic. The instruction decode logic issues appropriate internal-control signals to all other elements of the microprocessor,
and possibly to external circuits in the microcomputer system. The second and third bytes, if the instruction has them, are gated into the data bus buffer, from which they are routed into either the Arithmetic Logic Unit (ALU) if they represent data, or into the program counter if they represent an address.
and possibly to external circuits in the microcomputer system. The second and third bytes, if the instruction has them, are gated into the data bus buffer, from which they are routed into either the Arithmetic Logic Unit (ALU) if they represent data, or into the program counter if they represent an address.