Fix binary parsing and more tests

This commit is contained in:
PleegWat
2026-09-02 21:33:58 +02:00
parent fd5469aafc
commit 9ff0a3192c
2 changed files with 21 additions and 2 deletions
+2 -2
View File
@@ -77,7 +77,7 @@ atoi_bin_loop:
load_8 r3, [r2]
cmp r3, 0x30 ; '0'
jl atoi_done
cmp r3, 0x39 ; '1'
cmp r3, 0x31 ; '1'
jg atoi_done
add r2, r2, 1
sub r3, r3, 0x30 ; '0'
@@ -143,4 +143,4 @@ add r2, r2, 1
sub r3, r3, 0x37 ; 'A' - 10
lsl r1, r1, 4
add r1, r1, r3
jmp atoi_hex_loop
jmp atoi_hex_loop
+19
View File
@@ -47,6 +47,20 @@ mov r13, test7_pass
jmp atoi_test
test7_pass:
mov r1, 8
mov r2, test8
mov r3, test8_end
mov r13, test8_pass
jmp atoi_test
test8_pass:
mov r1, 9
mov r2, test9
mov r3, test9_end
mov r13, test9_pass
jmp atoi_test
test9_pass:
success:
jmp success
@@ -103,5 +117,10 @@ test6_end: "\0"
test7: U32 19 "023"
test7_end: "9\0"
test8: U32 11 "0b1011"
test8_end: "\0"
test9: U32 17 "0b10001"
test9_end: "2\0"
include stdlib