diff --git a/twasm/asm/main.asm b/twasm/asm/main.asm index c8dd826..fa5c3af 100644 --- a/twasm/asm/main.asm +++ b/twasm/asm/main.asm @@ -793,6 +793,38 @@ print: pop rax pop rdx ret + .debug: + push rsi + mov rsi, .debug_msg + call print + pop rsi + call print + ret + .error: + push rsi + mov rsi, .error_msg + call print + pop rsi + call print + ret + .test: + push rsi + mov rsi, .test_msg + call print + pop rsi + call print + ret + .warn: + push rsi + mov rsi, .warn_msg + call print + pop rsi + call print + ret + .debug_msg db "[DEBUG]: ", 0x00 + .error_msg db "[ERROR]: ", 0x00 + .test_msg db "[TEST]: ", 0x00 + .warn_msg db "[WARN]: ", 0x00 ; ------------------------------------------------------------------------------ ; halt diff --git a/twasm/asm/tests.asm b/twasm/asm/tests.asm index 4705829..96276c7 100644 --- a/twasm/asm/tests.asm +++ b/twasm/asm/tests.asm @@ -11,7 +11,7 @@ run_tests: mov rsi, .msg - call print + call print.test call clear_test_arena call test_copy_byte @@ -55,7 +55,7 @@ run_tests: test_copy_byte: mov rsi, .msg - call print + call print.test mov rdi, test_byte ; byte to be copied mov rsi, TEST_ARENA_ADDR ; location of test @@ -88,7 +88,7 @@ test_copy_byte: test_copy_token: mov rsi, .msg - call print + call print.test ; test case: space terminated @@ -143,7 +143,7 @@ test_copy_token: test_elemb: mov rsi, .msg - call print + call print.test ; [0] mov rdi, 5 @@ -204,7 +204,7 @@ test_elemb: test_identify_token: mov rsi, .msg - call print + call print.test ; length1 token that exists mov byte [TEST_ARENA_ADDR], "*" @@ -305,7 +305,7 @@ test_identify_token: test_identify_next_token: mov rsi, .msg - call print + call print.test ; length1 token that exists mov word [TEST_ARENA_ADDR], "* " @@ -400,7 +400,7 @@ test_identify_next_token: test_get_tte_type: mov rsi, .msg - call print + call print.test mov di, 0x0053 ; xor call get_tte_type @@ -441,7 +441,7 @@ test_get_tte_type: test_get_tte_typed_metadata: mov rsi, .msg - call print + call print.test mov di, 0x0053 ; xor call get_tte_typed_metadata @@ -483,7 +483,7 @@ test_get_tte_typed_metadata: test_get_direct_addressing_ModRM: mov rsi, .msg - call print + call print.test mov di, 0x0000 ; rax mov si, 0x0000 ; rax @@ -528,7 +528,7 @@ test_get_direct_addressing_ModRM: test_get_opcode: mov rsi, .msg - call print + call print.test mov di, 0x0053 ; xor call get_opcode @@ -569,7 +569,7 @@ test_get_opcode: test_get_reg_bits: mov rsi, .msg - call print + call print.test mov di, 0x0000 ; rax call get_reg_bits