Added main prefix

This commit is contained in:
2024-07-30 20:02:55 +02:00
parent 323952f4bc
commit 0c1b57b4e4
9 changed files with 34 additions and 20 deletions

View File

@ -4,6 +4,11 @@ import sys
number(x) {
length := 20
buffer := mem.alloc(length)
itoa(x, buffer, length)
mem.free(buffer, length)
}
itoa(x, buffer, length) {
end := buffer + length
tmp := end
digit := 0
@ -15,7 +20,6 @@ number(x) {
if x == 0 {
sys.write(1, tmp, end - tmp)
mem.free(buffer, length)
return
}
}