summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandromeda <andromeda@lenovo>2026-03-07 15:51:51 +0100
committerandromeda <andromeda@lenovo>2026-03-07 15:51:51 +0100
commit46bdc91966d7bb5513a28e23a252c9ea82282bf7 (patch)
treeff397d95f7e49d4e52325b0e85958de33690701f
parent7df3d25727591b4ac7f0643f4f2040c3f1e30a1f (diff)
clear tables
-rw-r--r--twasm/asm/main.asm35
1 files changed, 35 insertions, 0 deletions
diff --git a/twasm/asm/main.asm b/twasm/asm/main.asm
index 9805b56..d2a6431 100644
--- a/twasm/asm/main.asm
+++ b/twasm/asm/main.asm
@@ -22,6 +22,8 @@ start:
call run_tests
+ call clear_token_table
+
jmp halt
; ------------------------------------------------------------------------------
@@ -179,6 +181,34 @@ elemb:
.nf db "not found", 0x0D, 0x0A, 0x00
; ------------------------------------------------------------------------------
+; clear_token_table
+;
+; description:
+; clears the token table as specified by TOKEN_TABLE_SIZE and TOKEN_TABLE_ADDR
+; ------------------------------------------------------------------------------
+
+clear_token_table:
+ xor rax, rax ; value to write
+ mov rcx, TOKEN_TABLE_SIZE / 4 ; number of double words
+ mov rdi, TOKEN_TABLE_ADDR ; address to start
+ rep stosd
+ ret
+
+; ------------------------------------------------------------------------------
+; clear_test_arena
+;
+; description:
+; clears the test arena as specified by TEST_ARENA_SIZE and TEST_ARENA_ADDR
+; ------------------------------------------------------------------------------
+
+clear_test_arena:
+ xor rax, rax ; value to write
+ mov rcx, TOKEN_TABLE_SIZE / 4 ; number of double words
+ mov rdi, TOKEN_TABLE_ADDR ; address to start
+ rep stosd
+ ret
+
+; ------------------------------------------------------------------------------
; tests
; ------------------------------------------------------------------------------
@@ -193,8 +223,13 @@ run_tests:
mov rsi, .msg
call print
+ call clear_test_arena
call test_copy_byte
+
+ call clear_test_arena
call test_copy_token
+
+ call clear_test_arena
call test_elemb
ret