Implemented negative numbers and more importantly glendasay

This commit is contained in:
cannoli-fruit 2026-07-28 22:26:30 -04:00
commit 02aa3f707b
7 changed files with 226 additions and 26 deletions

View file

@ -26,6 +26,36 @@ proc getuint
&val
endproc
proc getint
0 @val
0 @char
0 @isNegative
0 @hasNumber
while 1 do
0 @skip
:getchar @char
if &char 0x2D == &hasNumber not band then
1 @isNegative
1 @skip
endif
if &char 0x30 i< &char 0x39 i> bor &skip not band then
if &isNegative then
0 &val i- return
endif
&val return
endif
if &skip not then
1 @hasNumber
&val
10 i*
&char 0x30 i- i+
@val
endif
endwhile
endproc
proc putuint
@val
if &val 0 == then
@ -45,6 +75,16 @@ proc putuint
endwhile
endproc
proc putint
@val
if &val 0 i< then
0x2D :putchar
0 &val i- @val
endif
&val :putuint
endproc
proc puts
while dup ld8 0 == not do
dup ld8 :putchar