summaryrefslogtreecommitdiff
path: root/twasm/asm/main.asm
diff options
context:
space:
mode:
Diffstat (limited to 'twasm/asm/main.asm')
-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