3 ms·
I come from a similar but different angle. Have been at 6502, 68k, z80, and some x86/64 over past few decades (mostly demo). I also wonder if this article/post
by Keyframe 2y ago
I come from a similar but different angle. Have been at 6502, 68k, z80, and some x86/64 over past few decades (mostly demo). I also wonder if this article/post was written by AI - he argues for 6502 that it has 6 registers, and thus it's simple. ANYONE who ever touched 6502 for more than a week will know you're pretty much dealing with three, and that's where the nickname of a sempahore CPU comes from (three registers).
6502 is fun and neat, especially if you want to program those machines. If you want more modern approach, it's not really all that suitable. Do what we did in the 90's then and start with MIPS if you want to follow the path of glory days or just start out with Neon. I'd even argue Z80 with all its registers and complexities is more similar to what you'll find today (far from it, but let's entertain the connection between past and present as OP does).
There's nothing inherently complicated about modern asm. Take FASM, start. It's not complicated, but it gets complex rather quickly which was and will be always true for such low level approach. Then you start macroing and sooner or later you have your own poor man's C on top.
- vardump 2y ago6502 really has 262 registers: 256 zero page plus those standard ones mentioned. Or 260 for 6510, as zero page addresses 0 and 1 are for I/O. Practically anything non-trivial uses those zero page addresses as extra registers.
- Keyframe 2y agoI get what you're saying but I wouldn't personally call zeropage bytes _registers_, even though they are physically connected to internal ones. I treat them as a special zone of memory that has special properties. There are many of these things and just like you would start with any of the old machines you'd first take a look at the memory map to see where's what and how to use it. Registers in a traditional sense would be those few mentioned of which you'd only ever really touch A, X, and Y.
- vardump 2y ago> even though they are physically connected to internal ones They're not physically connected, other than through the bus. I mean, zero page is part of DRAM.
- Keyframe 2y agoyou're right, I meant $0000 and $0001 which _are_ registers. The rest 254, yeah. Zeropage is a must on C64 at least. I don't know much about other platforms.
- RiverCrochet 2y agoSo 0 and 1 are connected to the 6510 I/O data direction and I/O data register, but there is still RAM there too. Seems the 6510 won't issue write signals to the bus for addresses 0 and 1, but the VIC can see them and it's readable through sprite collisions.
- RiverCrochet 2y agoOne reason to consider them equivalent to registers is that the cycle time for zero page and register-based instructions is the same (2-3 cycles). The full 16-bit instructions ("absolute") take at least 1 extra cycle and often 2 if crossing a page. Of course there is the Atari 2600 where you only have 128 of those bytes with RAM (80-FF) and the stack is set to page 0 instead of 1 (not that you'll use the stack a lot in an Atari 2600 program).
- markus_zhang 2y agoI think one of the values 6502 provides is that it has so many retro platforms. Apple ][, NES, Atari 2600, BBC, C64, they all use 6502. If you want to do something cool retro stuffs that a lot of people today still enjoy, that's the best bet. But again Z80 looks like a very good option too because it has GB/GBC plus ZX Spectrum. The same goes to 68K -- Mac 68K, Sega Genesis and Neogeo are popular hits. When I was writing my reply to another question (https://news.ycombinator.com/item?id=42891200 https://news.ycombinator.com/item?id=42891200), I was thinking about a new software engineering education system which starts from a retro platform and goes up from there. Maybe all three can fit the bill. I'm very much against the "elegant/pure" way of teaching. BTW totally agree 6502 essentially has 3 registers. You don't get to touch the others.
- Keyframe 2y agoIf you want to do something cool retro stuffs that a lot of people today still enjoy, that's the best bet. This shouldn't be discounted, since it has great pedagogical value in itself. On the other hand, personal opinion here, is that not many things are transferable to modern ISAs. Even back in the 90's, we were shown to work on MIPS instead. 68k is very nice to read and write, almost feels like higher language, but overall ROI for newer stuff is maybe just jump into Neon, x86_64, or as someone said RV directly. It's not _THAT_ hard. It gets complex as programs grow though.
- markus_zhang 2y agoYeah maybe jumping directly into x86-64 is not a bad idea. e.g. for Windows just have to understand the calling conventions and syscalls and such, to push some windows. I need to look into my SDL2/C++ game's assembly code and see how it is done.
- richrichardsson 2y agoDefinitely a bit a stretch to include the program counter, status register and stack pointer as "registers". Of course they all are technically registers, but they really can't be used for anything useful the way the index registers and accumulator can
- kazinator 2y agoOne definition is that if it has to be saved and restored by an interrupt handler, it's a register. :)