diff --git a/PLASMA/src/test.pla b/PLASMA/src/test.pla index edd14f53..ab98933e 100755 --- a/PLASMA/src/test.pla +++ b/PLASMA/src/test.pla @@ -1,5 +1,5 @@ ; -; Declare all imported modules and their data/functions. +; Include all imported modules and their data/functions. ; include(stdlib.plh) @@ -22,7 +22,7 @@ def tens(start) i = start repeat print:hex(i) - puts(@spaces) + print:str(@spaces) print:dec(i) print:newln() i = i / 10 diff --git a/PLASMA/src/testlib.pla b/PLASMA/src/testlib.pla index 93ee08c1..29c2a052 100755 --- a/PLASMA/src/testlib.pla +++ b/PLASMA/src/testlib.pla @@ -1,14 +1,22 @@ ; -; Declare all imported modules and their data/functions. +; Include all imported modules and their data/functions. ; + include(stdlib.plh) + +; +; Module data. +; + 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 loadstr[] = "testlib loaded!" + ; ; Define functions. ; + def puth(h) putc('$') putc(valstr[(h >> 12) & $0F]) @@ -16,6 +24,7 @@ def puth(h) putc(valstr[(h >> 4) & $0F]) putc(valstr[ h & $0F]) end + export def puti(i) if i < 0 putc('-') @@ -28,6 +37,7 @@ export def puti(i) putc(i % 10 + '0') fin end + export def putln putc($0D) end