this post was submitted on 20 Jul 2024
120 points (96.9% liked)
Programming
17423 readers
41 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities !webdev@programming.dev
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I mostly used this page to know what's possible, and occasionally reinvented the wheel. Conditional jumps are still arcane and fragile in my hands. But I benchmarked all kinds of sequential memory access patterns before realizing the 6502 does not give a dang about reusing the same address.
On Z80, you want to load two registers, use them as a pointer, and tweak the low byte. The 6502 can just take an address and an offset in four cycles. So if you want to access $3000 as an array and read index 4, 5, 6, 7, you don't LDX 4 and INC X, you LDX 4 and then LDA $3000,X, LDA $3001,X, LDA $3002,X, LDA $3004,X. For e.g. controller reads, you can hardcode bare addresses and it's twice as fast.