Hacker News new | past | comments | ask | show | jobs | submit login

6502 systems had RAM that ran at system speed. Everything was so much slower then so this was feasible... plus, some systems (like the Commodore VIC-20) used fast static RAM.

The 6502 even had an addressing mode wherein accesses to the first 256 bytes of RAM -- the "zero page" -- were much faster due to not needing address translation, to the point where it was like having 256 extra CPU registers. Critical state for hot loops and such was often placed in the zero page.

Do not presume to apply principles of modern systems to these old systems. They were very different.




The saving for the zero page is only the more compact encoding which saves one cycle for memory access (for the non-indexed variants, anyway)

E.g. LDA $42 is encoded as $A5 $42, and so takes 3 memory accesses (two to read the instruction, one to read from address $42). LDA $1234 is encoded as $AD $34 $12, and so takes 4 cycles: to read $AD $34 $12, and one to read the contents of address $1234. Same for the other zeropage vs. equivalent absolute instructions.

See e.g. timing chart for LDA here:

http://www.romdetectives.com/Wiki/index.php?title=LDA




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: