diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-02-10 10:32:02 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-02-10 10:32:02 +0100 |
| commit | efcf72fa8d546070995254253753d7ab7b2dcce1 (patch) | |
| tree | d6b1e328f7e746f38dca8af97db70b51249eb5b2 /README.md | |
| parent | f02b1cba329b65763c27d1d9ccf80dfff805c2f1 (diff) | |
| download | style.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.md | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -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 |
