add: minilibc to the examples

This commit is contained in:
2025-01-16 13:38:22 +01:00
parent 2adaa9773a
commit 57aa7b3e13
9 changed files with 276 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
; memset
end_:
push a1
call free
mov eax, 0
end
memset:
; a1 -> buffer
; a2 -> size
; a3 -> value
sub a2, 1
mov a5, 0
mov a4, a1
loop:
cmp a5, a2
je end_
mov (char)*a4, (char)a3
add a4, 1
add a5, 1
jmp loop
main:
mov a2, 10
mov a3, 97 ; 'a'
push a2
call malloc
mov a1, eax ;save the ptr
jmp memset