Remix.run Logo
satiated_grue 9 days ago

The 6502's lack of registers is one point of view.

Another point of view is that the zero page provides 256 registers:

https://spectrum.ieee.org/q-a-with-co-creator-of-the-6502-pr...

"[Bill Mensch]:Rod Orgill and I had completed the designs of a few microprocessors before the 6501/6502. In other words, Rod and I already knew what was successful in an instruction set. And lower cost was key. So we looked at what instructions we really needed. And we figured out how to have addressable registers by using zero page [the first 256 bytes in RAM]. So you can have one byte for the op code and one byte for the address, and [the code is compact and fast]. There are limitations, but compared to other processors, zero page was a big deal."

https://news.ycombinator.com/item?id=38627821

http://forum.6502.org/viewtopic.php?f=2&t=7304

renewedrebecca 9 days ago | parent [-]

I see this idea a lot, but I don't really buy it. I've coded in 6502 assembly for years, and the zero page is not register-like at all.

Best thing you can say about zero page is that it only requires one read cycle to fetch a value from. (Or one write cycle to store a value to it.)

Why ZP isn't like registers: You can't do register operations with it. For example, you can do this with the accumulator:

LDA #03 ; load immediate value of 3. STA $c000 ; store it at $c000.

or

LDA $1004 ; load a value from $1004. ADC $4000 ; add the value stored at $4000. STA $4001 ; store to $4001.

You can't do this at all with a zero page address. You have to go through an actual register first.