aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2025-02-10 10:32:02 +0100
committerMiquel Sabaté Solà <mikisabate@gmail.com>2025-02-10 10:32:02 +0100
commitefcf72fa8d546070995254253753d7ab7b2dcce1 (patch)
treed6b1e328f7e746f38dca8af97db70b51249eb5b2 /README.md
parentf02b1cba329b65763c27d1d9ccf80dfff805c2f1 (diff)
downloadstyle.nes-efcf72fa8d546070995254253753d7ab7b2dcce1.tar.gz
style.nes-efcf72fa8d546070995254253753d7ab7b2dcce1.zip
Clarify constants as upper case
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'README.md')
-rw-r--r--README.md13
1 files changed, 9 insertions, 4 deletions
diff --git a/README.md b/README.md
index d57385b..f57193d 100644
--- a/README.md
+++ b/README.md
@@ -254,7 +254,7 @@ By simply looking at this you quickly know that:
Even if the name turns out to not be too flashy, it's imperative when writing
assembly code to be as clear as possible.
-## UPPER_CASE for macros and aliases to memory-mapped I/O
+## UPPER_CASE for macros and regular constants
In a similar spirit as many code styles for C, use `UPPER_CASE` for macros, as
that makes it more apparent what they are.
@@ -269,13 +269,18 @@ that makes it more apparent what they are.
.endmacro
```
-In a similar way, there are some assignments which are simply aliases to
-memory-mapped I/O. These "variables" are to be defined also in upper case as
-they are quite special.
+In a similar way, there are assignments which are simply a way to name regular
+numeric constants. This differs to how "variables" are assigned as they are not
+memory addresses that the CPU can directly access. Hence, for constant numbers
+or memory addresses which are not directly tied to the CPU (i.e. memory-mapped
+I/O), use upper case in the same way you would in C.
``` assembly
lda PPU::m_control ; bad!
lda PPU::CONTROL ; good!
+
+bad_constant = 1
+GOOD_CONSTANT = 1
```
# Calling conventions