Flag unkown CMD input, move putnl to TESTLIB

This commit is contained in:
David Schmenk 2014-05-20 21:52:08 -07:00
parent e72a9bc297
commit 9fe7d4d29d
3 changed files with 36 additions and 29 deletions

View File

@ -37,7 +37,6 @@ byte stdlibstr[] = "STDLIB"
byte clsstr[] = "CLS" byte clsstr[] = "CLS"
byte gotoxystr[] = "GOTOXY" byte gotoxystr[] = "GOTOXY"
byte viewstr[] = "VIEWPORT" byte viewstr[] = "VIEWPORT"
byte putnlstr[] = "PUTNL"
byte putcstr[] = "PUTC" byte putcstr[] = "PUTC"
byte putsstr[] = "PUTS" byte putsstr[] = "PUTS"
byte getcstr[] = "GETC" byte getcstr[] = "GETC"
@ -59,7 +58,6 @@ byte execstr[] = "EXEC"
word exports[] = @clsstr, @home word exports[] = @clsstr, @home
word = @gotoxystr, @gotoxy word = @gotoxystr, @gotoxy
word = @viewstr, @viewport word = @viewstr, @viewport
word = @putnlstr, @crout
word = @putcstr, @cout word = @putcstr, @cout
word = @putsstr, @prstr word = @putsstr, @prstr
word = @getcstr, @cin word = @getcstr, @cin
@ -83,8 +81,9 @@ word stdlibsym = @exports
; String pool. ; String pool.
; ;
byte version[] = "PLASMA 0.9\n" byte version[] = "PLASMA 0.9\n"
byte errorstr[] = "ERR: " byte errorstr[] = "ERR:$"
byte okstr[] = "OK" byte okstr[] = "OK"
byte huhstr[] = "?\n"
byte freestr[] = "MEM FREE:$" byte freestr[] = "MEM FREE:$"
byte prefix[32] = "" byte prefix[32] = ""
; ;
@ -1411,6 +1410,7 @@ crout
while 1 while 1
prstr(getpfx(@prefix)) prstr(getpfx(@prefix))
cmdptr = rdstr($BA) cmdptr = rdstr($BA)
if ^cmdptr
when toupper(parsecmd(cmdptr)) when toupper(parsecmd(cmdptr))
is 'Q' is 'Q'
reboot() reboot()
@ -1425,6 +1425,8 @@ while 1
perr = $46 perr = $46
is '+' is '+'
execmod(cmdptr) execmod(cmdptr)
otherwise
prstr(@huhstr)
wend wend
if perr if perr
prstr(@errorstr) prstr(@errorstr)
@ -1434,5 +1436,6 @@ while 1
prstr(@okstr) prstr(@okstr)
fin fin
crout() crout()
fin
loop loop
done done

View File

@ -2,11 +2,11 @@
; Declare all imported modules and their data/functions. ; Declare all imported modules and their data/functions.
; ;
import stdlib import stdlib
predef cls, gotoxy, viewport, puts, putc, putnl, getc predef cls, gotoxy, viewport, puts, putc, getc
end end
import testlib import testlib
predef puti predef puti, putnl
end end
; ;
; Predeclare any functions called before defined. ; Predeclare any functions called before defined.

View File

@ -4,7 +4,7 @@
import stdlib import stdlib
predef cls, gotoxy, puts, putc predef cls, gotoxy, puts, putc
end end
byte loadstr[] = "testlib loaded!\n" byte loadstr[] = "testlib loaded!"
; ;
; Define functions. ; Define functions.
; ;
@ -20,6 +20,10 @@ export def puti(i)
putc(i % 10 + '0') putc(i % 10 + '0')
fin fin
end end
export def putnl
putc($0D)
end
puts(@loadstr); puts(@loadstr)
putnl
done done