diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-03-10 22:07:56 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-03-10 22:07:56 +0100 |
| commit | d8847d6eb13162ac2bae191e176bff18a8161245 (patch) | |
| tree | b857360eec7d81ea4ccfa4207cc2926f3163fb7f /list.s | |
| parent | 23fda2e0742a9a87fc499816a0872926a1fb570b (diff) | |
| download | list.nes-d8847d6eb13162ac2bae191e176bff18a8161245.tar.gz list.nes-d8847d6eb13162ac2bae191e176bff18a8161245.zip | |
Allow base pointers to be configurable
The `ptr` and the `last` pointers can then be configured when including
them by simply setting an alternative definition.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'list.s')
| -rw-r--r-- | list.s | 22 |
1 files changed, 15 insertions, 7 deletions
@@ -58,13 +58,21 @@ ;; For more information on the usage and the API check the documentation ;; (README.md file on the https://github.com/mssola/list.nes repository). .scope List - ;; NOTE (important): this library needs 4 bytes ($60-$63) to store - ;; information of this list. These are two 16-bit pointers which are used - ;; for the subroutines being defined here. If you have a clash with these - ;; memory addresses, do feel free to change them, but remember that the code - ;; assumes that both pointers are 16-bit (they don't need to be contiguous). - ptr = $60 - last = $62 + ;; NOTE (important): this library needs 4 bytes to store information of this + ;; list. These are two 16-bit pointers which are used for the subroutines + ;; being defined here. The exact location of these pointers are set to + ;; $60-$63 by default, but they can be changed by providing definitions for + ;; `LIST_PTR_ADDRESS` and `LIST_LAST_ADDRESS`. + .ifdef LIST_PTR_ADDRESS + ptr = LIST_PTR_ADDRESS + .else + ptr = $60 + .endif + .ifdef LIST_LAST_ADDRESS + last = LIST_LAST_ADDRESS + .else + last = $62 + .endif ;; Set the value of `a` into the list and advance one position without ;; growing the list. |
