commit 7fdcd643a67b07f19041f5b234cda2a52db2febe
parent 5fc529a960accf10f51736dbb3e8f29db7708259
Author: Christian Ermann <christianermann@gmail.com>
Date: Thu, 5 Dec 2024 19:09:52 -0800
Refactor 'align' and rename to 'align-data'
Diffstat:
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/src/forth.s b/src/forth.s
@@ -1183,19 +1183,13 @@ defcode "compile," compile_comma, 0x8D0A6736
pop w
next
-defword "align", align, 0x602C63DE
- jal data_pointer
- jal dup
- jal fetch
- jal lit
- .int 3
- jal plus
- jal lit
- .int -4
- jal and_
- jal swap
- jal store
- exit
+defcode "align-data", align_data, 0x78D58E59
+ la x, _data_pointer
+ lw y, 0(x)
+ addi y, y, cell-1
+ andi y, y, -cell
+ sw y, 0(x)
+ next
defcode "align-code", align_code, 0xBC9CE4E0
la x, _code_pointer
@@ -1551,7 +1545,7 @@ defword "string>header", string_to_header, 0x16FBE3AB
jal comma
push_imm 0
jal char_comma
- jal align
+ jal align_data
# update latest
la x, _data_pointer
load_cell x, 0(x)