diff options
| author | andromeda <andromeda@lenovo> | 2026-03-09 23:00:39 +0100 |
|---|---|---|
| committer | andromeda <andromeda@lenovo> | 2026-03-09 23:01:12 +0100 |
| commit | a972f38bb636fdcb41a2bb7c856f7f546076b397 (patch) | |
| tree | f41fde5f682d33e228510aa3b73e9bf6041a8df4 /twasm/asm/tests.asm | |
| parent | 869420ef7ab2bfa8bc04c44584e55bb337d83f32 (diff) | |
add get_direct_addressing_ModRM and test_*, fix a couple bugs/typos, add 'reg value' as register metadata
Diffstat (limited to 'twasm/asm/tests.asm')
| -rw-r--r-- | twasm/asm/tests.asm | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/twasm/asm/tests.asm b/twasm/asm/tests.asm index f48d8bf..8480554 100644 --- a/twasm/asm/tests.asm +++ b/twasm/asm/tests.asm @@ -34,6 +34,9 @@ run_tests: call clear_test_arena call test_get_tte_typed_metadata + call clear_test_arena + call test_get_direct_addressing_ModRM + ret .msg db "running test suite...", 0x0A, 0x00 @@ -441,7 +444,8 @@ test_get_tte_typed_metadata: mov di, 0x0003 ; rdx call get_tte_typed_metadata - cmp al, 0x03 ; width: 64 bits + cmp al, 00001011b ; reg: 010b + ; width: 11b (64 bits) jne .fail mov di, 0x0056 ; mov @@ -462,7 +466,52 @@ test_get_tte_typed_metadata: mov rsi, msg_fail call print ret - .msg db "test_get_tte_type...", 0x00 + .msg db "test_get_tte_typed_metadata...", 0x00 + +; ------------------------------------------------------------------------------ +; test_get_direct_addressing_ModRM +; +; description: +; tests get_direct_addressing_ModRM described functionality +; ------------------------------------------------------------------------------ + +test_get_direct_addressing_ModRM: + mov rsi, .msg + call print + + mov di, 0x0000 ; rax + mov si, 0x0000 ; rax + call get_direct_addressing_ModRM + cmp al, 11000000b ; Mod Reg R/M: 11b 000b 000b + jne .fail + + mov di, 0x0000 ; rax + mov si, 0x0003 ; rdx + call get_direct_addressing_ModRM + cmp al, 11000010b ; Mod Reg R/M: 11b 000b 010b + jne .fail + + mov di, 0x0003 ; rdx + mov si, 0x0000 ; rax + call get_direct_addressing_ModRM + cmp al, 11010000b ; Mod Reg R/M: 11b 010b 000b + jne .fail + + mov di, 0x0003 ; rdx + mov si, 0x0003 ; rdx + call get_direct_addressing_ModRM + cmp al, 11010010b ; Mod Reg R/M 11b 010b 010b + jne .fail + + .pass: + mov rsi, msg_pass + call print + ret + .fail: + mov rsi, msg_fail + call print + ret + .msg db "test_get_direct_addressing_ModRM...", 0x00 msg_pass: db 0x0A |
