It’s extremely easy to see at a glance whether an address is in ROM or RAM—any Spectrum developer knows that RAM starts at address $4000 (16384), so anything below that is a ROM call. Comments will help with the rest. The same applies to system variables.RMartins wrote: ↑Mon Apr 30, 2018 1:48 pm If you got used to recognize a set of specific addresses, than that probably works as a name or reference for you, but it will probably not work with others.
For example, a lot of the systems variables are named in the ZX manual, hence in practice we should use their names, since that is common knowledge, but that doesn't prevent individual A or B, to actually know their address values by heart. But that will not be the general case for sure.
I’ll reiterate: applying high-level programming language practices to assembly—particularly in the context of the Spectrum (what with it being a relatively simple machine)—will only muddy the waters and create confusion. The fewer levels of abstraction exist between the hardware and the software the better.
As for the opcode analogy, I think that’s strawmanning. Assembly already has a one-to-one correspondence between a mnemonic and its opcode, so there’s no practical need in memorizing the latter. In the rare cases of self-modifying code, when you need to inject a different opcode somewhere in your code, a quick glance at the Z80 instruction set is all that’s needed.
I agree about pattern recognition, but there’s also readability and efficiency. You can just as easily recognize the few ROM addresses that are practical to use in programming. Moreover, a fixed address will instantly tell you that you’re making a ROM call or addressing a system variable; whereas a label will signal to you that it’s a reference to a RAM address, which can move from location to location as you work on your code. When both are represented by a label—confusion will inevitably set in.
Either approach will work, of course. Any assembler will happily replace labels with constants or memory addresses. Readability is a different matter, however.
In any case, for the most part, this whole argument becomes moot at some point, as people tend to use ROM calls more and more sparingly once their programming skills have improved and they have come up with their own, more efficient routines.