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 gotoxystr[] = "GOTOXY"
byte viewstr[] = "VIEWPORT"
byte putnlstr[] = "PUTNL"
byte putcstr[] = "PUTC"
byte putsstr[] = "PUTS"
byte getcstr[] = "GETC"
@ -59,7 +58,6 @@ byte execstr[] = "EXEC"
word exports[] = @clsstr, @home
word = @gotoxystr, @gotoxy
word = @viewstr, @viewport
word = @putnlstr, @crout
word = @putcstr, @cout
word = @putsstr, @prstr
word = @getcstr, @cin
@ -83,8 +81,9 @@ word stdlibsym = @exports
; String pool.
;
byte version[] = "PLASMA 0.9\n"
byte errorstr[] = "ERR: "
byte errorstr[] = "ERR:$"
byte okstr[] = "OK"
byte huhstr[] = "?\n"
byte freestr[] = "MEM FREE:$"
byte prefix[32] = ""
;
@ -1411,28 +1410,32 @@ crout
while 1
prstr(getpfx(@prefix))
cmdptr = rdstr($BA)
when toupper(parsecmd(cmdptr))
is 'Q'
reboot()
is 'C'
catalog(cmdptr)
is 'P'
setpfx(cmdptr)
is 'V'
volumes();
is '-'
execsys(cmdptr)
perr = $46
is '+'
execmod(cmdptr)
wend
if perr
prstr(@errorstr)
prbyte(perr)
perr = 0
else
prstr(@okstr)
if ^cmdptr
when toupper(parsecmd(cmdptr))
is 'Q'
reboot()
is 'C'
catalog(cmdptr)
is 'P'
setpfx(cmdptr)
is 'V'
volumes();
is '-'
execsys(cmdptr)
perr = $46
is '+'
execmod(cmdptr)
otherwise
prstr(@huhstr)
wend
if perr
prstr(@errorstr)
prbyte(perr)
perr = 0
else
prstr(@okstr)
fin
crout()
fin
crout()
loop
done

View File

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

View File

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