Added basic putuint to the standard library, i need to implement proper 0 handling but that probably needs and if statement
This commit is contained in:
parent
bf4f1c19af
commit
5b7dd220ae
6 changed files with 94 additions and 2 deletions
|
|
@ -6,6 +6,22 @@ proc getchar
|
|||
0xCFFFFFFFFFFFFFFE ld8
|
||||
endproc
|
||||
|
||||
proc putuint
|
||||
@val
|
||||
1 @divisor
|
||||
|
||||
while &val &divisor u/ 9 u> do
|
||||
10 &divisor u* @divisor
|
||||
endwhile
|
||||
|
||||
while &divisor 0 u> do
|
||||
&val &divisor u/ 10 u%
|
||||
48 u+ :putchar
|
||||
|
||||
&divisor 10 u/ @divisor
|
||||
endwhile
|
||||
endproc
|
||||
|
||||
proc puts
|
||||
while dup ld8 0 == not do
|
||||
dup ld8 :putchar
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue