diff options
| author | Jan Tuomi <jan@jantuomi.fi> | 2025-03-04 22:55:32 +0200 |
|---|---|---|
| committer | Jan Tuomi <jan@jantuomi.fi> | 2025-03-04 22:55:32 +0200 |
| commit | 5899f8f02a90a3ba03f7799bcaf87fbb5d2d63f2 (patch) | |
| tree | b205381dc1030d36da4a57bd589ffa458b09fc96 /atk16_schasm/note.md | |
| parent | 8c25522dedc4ee1e382cdb63c54cdf5263bce6a7 (diff) | |
Add %if and %if-else macros, refactor, add indirection levels
Diffstat (limited to 'atk16_schasm/note.md')
| -rw-r--r-- | atk16_schasm/note.md | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/atk16_schasm/note.md b/atk16_schasm/note.md new file mode 100644 index 0000000..e48e7a5 --- /dev/null +++ b/atk16_schasm/note.md @@ -0,0 +1,35 @@ +# note about loads & stores + +the indirection count tells the CPU how many times to dereference the address before reading or writing the value. in loads, the value can range from 0 to 3, and in stores, the value can range from 1 to 3. the indirection count is 0-indexed, so a value of 0 means no indirection, 1 means one level of indirection, and so on. + + ;; asm + (ld R0 (u16 #x1234) indirect: 0) + ;; equivalent pseudocode + R0 := 0x1234 + + ;; asm + (ld R0 (u16 #x1234) indirect: 2) + ;; equivalent pseudocode + R0 := **(0x1234) + + ;; asm + (ld R0 R1) + ;; equivalent pseudocode + R0 := R1 + + ;; asm + (ld R0 R1 indirect: 3) + ;; equivalent pseudocode + R0 := ***R1 + + ;; asm + (st R0 (u16 #x1234) indirect: 2) + ;; equivalent pseudocode + **(0x1234) := R0 + + ;; asm + (st R0 R1 indirect: 1) + ;; equivalent pseudocode + *R1 := R0 + +a load with an indirection count of 0 in reg mode is a `mov`. |
