Added main prefix

This commit is contained in:
Eduard Urbach 2024-07-30 20:02:55 +02:00
parent e537e543cc
commit 6510166ae0
Signed by: eduard
GPG key ID: 49226B848C78F6C8
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
}
}