Clean up test case a little

This commit is contained in:
David Schmenk 2014-05-27 20:43:37 -07:00
parent 5ad39d6897
commit b41e759bc3
2 changed files with 14 additions and 4 deletions

View File

@ -1,5 +1,5 @@
; ;
; Declare all imported modules and their data/functions. ; Include all imported modules and their data/functions.
; ;
include(stdlib.plh) include(stdlib.plh)
@ -22,7 +22,7 @@ def tens(start)
i = start i = start
repeat repeat
print:hex(i) print:hex(i)
puts(@spaces) print:str(@spaces)
print:dec(i) print:dec(i)
print:newln() print:newln()
i = i / 10 i = i / 10

View File

@ -1,14 +1,22 @@
; ;
; Declare all imported modules and their data/functions. ; Include all imported modules and their data/functions.
; ;
include(stdlib.plh) include(stdlib.plh)
;
; Module data.
;
predef puti, puth, putln predef puti, puth, putln
export word print[] = @puti, @puth, @putln export word print[] = @puti, @puth, @putln, @puts, @putc
byte valstr[] = '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' byte valstr[] = '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
byte loadstr[] = "testlib loaded!" byte loadstr[] = "testlib loaded!"
; ;
; Define functions. ; Define functions.
; ;
def puth(h) def puth(h)
putc('$') putc('$')
putc(valstr[(h >> 12) & $0F]) putc(valstr[(h >> 12) & $0F])
@ -16,6 +24,7 @@ def puth(h)
putc(valstr[(h >> 4) & $0F]) putc(valstr[(h >> 4) & $0F])
putc(valstr[ h & $0F]) putc(valstr[ h & $0F])
end end
export def puti(i) export def puti(i)
if i < 0 if i < 0
putc('-') putc('-')
@ -28,6 +37,7 @@ export def puti(i)
putc(i % 10 + '0') putc(i % 10 + '0')
fin fin
end end
export def putln export def putln
putc($0D) putc($0D)
end end