diff options
| -rw-r--r-- | README.md | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -173,6 +173,24 @@ your editor (and this repository also holds an [.editorconfig](./.editorconfig) to help you on this). If your editor doesn't support some of these options, just replace it. +# Numeric literals + +In 6502 assembly you can express numeric literals in decimal, hexadecimal and +binary formats. One useful rule I have been developing over the course of +programming in 6502 assembly is: + +1. Prefer the hexadecimal format: debuggers, emulators, ROM dumps, and related + tooling will default to this format. +2. Use the decimal format for simple numbers which can be trivially translated + into hexadecimal format, but which are more simple to write this way + (e.g. `lda #0`). +3. Use binary format for bitmap masks, or other arrangements where each bit has + been set/unset following a very strict order (e.g. preparing the value for a + PPU register). As for masks, it might be quite trivial to mentally parse + which bits are set/unset with something like `lda #$81`, but something like + `lda #$AC` might take more time to mentally parse than the more explicit `lda + #%10101100`. + # Allocation conventions I am not going to reinvent the wheel here: just stick to the comments on the |
