clear tables

This commit is contained in:
andromeda
2026-03-07 15:51:51 +01:00
parent 7df3d25727
commit 46bdc91966

View File

@@ -22,6 +22,8 @@ start:
call run_tests
call clear_token_table
jmp halt
; ------------------------------------------------------------------------------
@@ -178,6 +180,34 @@ elemb:
.f db "found", 0x0D, 0x0A, 0x00
.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