1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-19 19:31:24 +00:00
This commit is contained in:
David Schmenk 2017-12-18 08:58:16 -08:00
commit 8ea7f4cac7
5 changed files with 210 additions and 323 deletions

View File

@ -6,7 +6,7 @@ PLVM02 = PLASMA.SYSTEM\#FF2000
PLVM802 = PLASMA16.SYSTEM\#FF2000 PLVM802 = PLASMA16.SYSTEM\#FF2000
PLVM03 = SOS.INTERP\#050000 PLVM03 = SOS.INTERP\#050000
CMD = CMD\#FF2000 CMD = CMD\#FF2000
ED = ED\#FF2000 ED = ED\#FE1000
SB = SB\#FF2000 SB = SB\#FF2000
ROD = ROD\#FE1000 ROD = ROD\#FE1000
SIEVE = SIEVE\#FE1000 SIEVE = SIEVE\#FE1000
@ -69,7 +69,7 @@ TXTTYPE = .TXT
#SYSTYPE = \#FF2000 #SYSTYPE = \#FF2000
#TXTTYPE = \#040000 #TXTTYPE = \#040000
all: $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVM802) $(PLVM03) $(CMD) $(ARGS) $(MEMMGR) $(MEMTEST) $(FIBER) $(SB) $(MON) $(ROD) $(SIEVE) $(UTHERNET2) $(UTHERNET) $(ETHERIP) $(INET) $(DHCP) $(HTTPD) $(ROGUE) $(ROGUEMAP) $(ROGUECOMBAT) $(ROGUEIO) $(HGR1) $(TONE) $(DGR) $(DGRTEST) $(FILEIO) $(CONIO) $(PORTIO) $(SPIPORT) $(SDFAT) $(FATCAT) $(FATGET) $(FATPUT) $(FATWDSK) $(FATRDSK) $(SANE) $(FPSTR) $(FPU) $(SANITY) $(RPNCALC) all: $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVM802) $(PLVM03) $(CMD) $(ARGS) $(MEMMGR) $(MEMTEST) $(FIBER) $(ED) $(MON) $(ROD) $(SIEVE) $(UTHERNET2) $(UTHERNET) $(ETHERIP) $(INET) $(DHCP) $(HTTPD) $(ROGUE) $(ROGUEMAP) $(ROGUECOMBAT) $(ROGUEIO) $(HGR1) $(TONE) $(DGR) $(DGRTEST) $(FILEIO) $(CONIO) $(PORTIO) $(SPIPORT) $(SDFAT) $(FATCAT) $(FATGET) $(FATPUT) $(FATWDSK) $(FATRDSK) $(SANE) $(FPSTR) $(FPU) $(SANITY) $(RPNCALC)
clean: clean:
-rm *FE1000 *FF2000 $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVM03) -rm *FE1000 *FF2000 $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVM03)
@ -122,8 +122,8 @@ test: samplesrc/test.pla samplesrc/testlib.pla $(PLVM) $(PLASM)
./$(PLVM) TEST ./$(PLVM) TEST
$(ED): toolsrc/ed.pla $(PLVM02) $(PLASM) toolsrc/ed.pla $(ED): toolsrc/ed.pla $(PLVM02) $(PLASM) toolsrc/ed.pla
./$(PLASM) -AOW < toolsrc/ed.pla > toolsrc/ed.a ./$(PLASM) -AMOW < toolsrc/ed.pla > toolsrc/ed.a
acme --setpc 8192 -o $(ED) toolsrc/ed.a acme --setpc 4094 -o $(ED) toolsrc/ed.a
$(SB): toolsrc/sb.pla $(PLVM02) $(PLASM) toolsrc/sb.pla $(SB): toolsrc/sb.pla $(PLVM02) $(PLASM) toolsrc/sb.pla
./$(PLASM) -AOW < toolsrc/sb.pla > toolsrc/sb.a ./$(PLASM) -AOW < toolsrc/sb.pla > toolsrc/sb.a

View File

@ -7,6 +7,8 @@
include "inc/cmdsys.plh" include "inc/cmdsys.plh"
include "inc/args.plh" include "inc/args.plh"
include "inc/fileio.plh" include "inc/fileio.plh"
const FALSE = 0
const TRUE = not FALSE
// //
// Hardware constants // Hardware constants
// //
@ -16,6 +18,7 @@ const pushbttn2 = $C062
const pushbttn3 = $C063 const pushbttn3 = $C063
const keyboard = $C000 const keyboard = $C000
const keystrobe = $C010 const keystrobe = $C010
const cmdline = $01FF
// //
// ASCII key values // ASCII key values
// //
@ -80,16 +83,17 @@ word strpoolmap = $1F00
word strpoolmsz = 224 // $E0 = 28K is memory@16 bytes per bit map, 128 bytes per 8 bit map, 1K bytes per 8 byte map word strpoolmsz = 224 // $E0 = 28K is memory@16 bytes per bit map, 128 bytes per 8 bit map, 1K bytes per 8 byte map
word strpool = $4800 word strpool = $4800
word strpoolsz = $7000 word strpoolsz = $7000
byte exit = FALSE
byte flags = 0 byte flags = 0
byte flash = 0 byte flash = 0
word numlines = 0 word numlines = 0
word cutbuf = 0 word cutbuf = 0
byte perr, cursx, cursy, scrnleft, curscol, underchr, curschr byte cursx, cursy, scrnleft, curscol, underchr, curschr
word keyin, cursrow, scrntop, cursptr word keyin, cursrow, scrntop, cursptr
// //
// Predeclared functions // Predeclared functions
// //
predef cmdmode predef cmdmode#0
// //
// Utility functions // Utility functions
// //
@ -98,26 +102,6 @@ predef cmdmode
asm equates asm equates
!SOURCE "vmsrc/plvmzp.inc" !SOURCE "vmsrc/plvmzp.inc"
end end
//def toupper(c)
// if c >= 'a'
// if c <= 'z'
// return c - $20
// fin
// fin
// return c
//end
asm toupper
LDA ESTKL,X
AND #$7F
CMP #'a'
BCC +
CMP #'z'+1
BCS +
SEC
SBC #$20
+ STA ESTKL,X
RTS
end
asm clrhibit(strptr) asm clrhibit(strptr)
LDA ESTKL,X LDA ESTKL,X
STA SRCL STA SRCL
@ -181,11 +165,8 @@ CPLNLP LDA (SRC),Y
RTS RTS
end end
def crout
cout($0D)
end
def bell def bell
cout($07) putc($07)
end end
// //
// Memory management routines // Memory management routines
@ -204,11 +185,11 @@ def delstr(strptr)
byte mask, ofst byte mask, ofst
if strptr and strptr <> @nullstr if strptr and strptr <> @nullstr
mask = sizemask(^strptr + 1) // mask = sizemask(^strptr + 1)
ofst = (strptr - strheap) >> 4 // ofst = (strptr - strheap) >> 4
mask = mask << (ofst & $07) // mask = mask << (ofst & $07)
ofst = ofst >> 3 // ofst = ofst >> 3
strpoolmap->[ofst] = strpoolmap->[ofst] & ~mask // strpoolmap->[ofst] = strpoolmap->[ofst] & ~mask
fin fin
end end
def newstr(strptr) def newstr(strptr)
@ -217,30 +198,29 @@ def newstr(strptr)
strlen = ^strptr strlen = ^strptr
while (strptr).[strlen] == $8D or (strptr).[strlen] == $A0 while (strptr).[strlen] == $8D or (strptr).[strlen] == $A0
strlen = strlen - 1 strlen--
loop loop
if strlen == 0 if strlen == 0
return @nullstr return @nullstr
fin fin
newptr = strpoolalloc(strlen + 1) // newptr = strpoolalloc(strlen + 1)
if newptr // if newptr
memcpy(newptr, strptr, strlen + 1) // memcpy(newptr, strptr, strlen + 1)
^newptr = strlen // ^newptr = strlen
return newptr // return newptr
fin // fin
return @nullstr return @nullstr
end end
def inittxtbuf#0 def inittxtbuf#0
word i word i
strlinbuf = $1000 // strlinbuf = $1000
strpoolmap = $1F00 // strpoolmap = $1F00
strpoolmsz = 224 // $E0 = 28K is memory@16 bytes per bit map, 128 bytes per 8 bit map, 1K bytes per 8 byte map // strpoolmsz = 224 // $E0 = 28K is memory@16 bytes per bit map, 128 bytes per 8 bit map, 1K bytes per 8 byte map
strpool = $4800 // strpool = $4800
strpoolsz = $7000 // strpoolsz = $7000
// memset(strpoolmap, strheapmsz, 0)
memset(strpoolmap, strheapmsz, 0) // memset(strlinbuf, maxfill * 2, @nullstr)
memset(strlinbuf, maxfill * 2, @nullstr)
numlines = 1 numlines = 1
cursrow = 0 cursrow = 0
curscol = 0 curscol = 0
@ -297,14 +277,6 @@ def txtlower#0
strlower(strlinbuf:[i]) strlower(strlinbuf:[i])
next next
end end
def prbyte(h)#0
cout('$')
call($FDDA, h, 0, 0, 0)
end
def prword(h)#0
cout('$')
call($F941, h >> 8, h, 0, 0)
end
def print(i)#0 def print(i)#0
byte numstr[7] byte numstr[7]
byte place, sign byte place, sign
@ -319,13 +291,13 @@ def print(i)#0
while i >= 10 while i >= 10
numstr[place] = i % 10 + '0' numstr[place] = i % 10 + '0'
i = i / 10 i = i / 10
place = place - 1 place--
loop loop
numstr[place] = i + '0' numstr[place] = i + '0'
place = place - 1 place--
if sign if sign
numstr[place] = '-' numstr[place] = '-'
place = place - 1 place--
fin fin
numstr[place] = 6 - place numstr[place] = 6 - place
puts(@numstr[place]) puts(@numstr[place])
@ -340,26 +312,26 @@ end
def readtxt(filename)#0 def readtxt(filename)#0
byte txtbuf[81], refnum, i, j byte txtbuf[81], refnum, i, j
refnum = open(filename, sysbuf) refnum = fileio:open(filename)
if refnum if refnum
newline(refnum, $7F, $0D) newline(refnum, $7F, $0D)
repeat repeat
txtbuf = read(refnum, @txtbuf + 1, maxlnlen) txtbuf = fileio:read(refnum, @txtbuf + 1, maxlnlen)
if txtbuf if txtbuf
sethibit(@txtbuf) sethibit(@txtbuf)
if flags & uppercase; strupper(@txtbuf); fin if flags & uppercase; strupper(@txtbuf); fin
strlinbuf:[numlines] = newstr(@txtbuf) strlinbuf:[numlines] = newstr(@txtbuf)
numlines = numlines + 1 numlines++
fin fin
if !(numlines & $0F); cout('.'); fin if !(numlines & $0F); putc('.'); fin
until txtbuf == 0 or numlines == maxlines until txtbuf == 0 or numlines == maxlines
close(refnum) fileio:close(refnum)
// //
// Make sure there is a blank line at the end of the buffer // Make sure there is a blank line at the end of the buffer
// //
if numlines < maxlines and strlinbuf:[numlines - 1] <> @nullstr if numlines < maxlines and strlinbuf:[numlines - 1] <> @nullstr
strlinbuf:[numlines] = @nullstr strlinbuf:[numlines] = @nullstr
numlines = numlines + 1 numlines++
fin fin
fin fin
end end
@ -368,9 +340,9 @@ def writetxt(filename)#0
byte j, chr byte j, chr
word i, strptr word i, strptr
destroy(filename) fileio:destroy(filename)
create(filename, $C3, $04, $00) // full access, TXT file fileio:create(filename, $04, $00) // full access, TXT file
refnum = open(filename, sysbuf) refnum = fileio:open(filename)
if refnum == 0 if refnum == 0
return return
fin fin
@ -385,15 +357,15 @@ def writetxt(filename)#0
cpyln(strlinbuf:[i], @txtbuf) cpyln(strlinbuf:[i], @txtbuf)
txtbuf = txtbuf + 1 txtbuf = txtbuf + 1
txtbuf[txtbuf] = $0D txtbuf[txtbuf] = $0D
write(refnum, @txtbuf + 1, txtbuf) fileio:write(refnum, @txtbuf + 1, txtbuf)
if !(i & $0F); cout('.'); fin if !(i & $0F); putc('.'); fin
next next
close(refnum) fileio:close(refnum)
end end
// //
// Screen routines // Screen routines
// //
def clrscrn@0 def clrscrn#0
call($FC58, 0, 0, 0, 0) call($FC58, 0, 0, 0, 0)
end end
def drawrow(row, ofst, strptr)#0 def drawrow(row, ofst, strptr)#0
@ -507,9 +479,9 @@ end
def cursup#0 def cursup#0
if cursrow > 0 if cursrow > 0
cursoff cursoff
cursrow = cursrow - 1 cursrow--
if cursy > 0 if cursy > 0
cursy = cursy - 1 cursy--
else else
scrntop = cursrow scrntop = cursrow
drawscrn(scrntop, scrnleft) drawscrn(scrntop, scrnleft)
@ -527,9 +499,9 @@ end
def cursdown#0 def cursdown#0
if cursrow < numlines - 1 if cursrow < numlines - 1
cursoff cursoff
cursrow = cursrow + 1 cursrow++
if cursy < 23 if cursy < 23
cursy = cursy + 1 cursy++
else else
scrntop = cursrow - 23 scrntop = cursrow - 23
drawscrn(scrntop, scrnleft) drawscrn(scrntop, scrnleft)
@ -547,9 +519,9 @@ end
def cursleft#0 def cursleft#0
if curscol > 0 if curscol > 0
cursoff cursoff
curscol = curscol - 1 curscol--
if cursx > 0 if cursx > 0
cursx = cursx - 1 cursx--
else else
scrnleft = curscol scrnleft = curscol
drawscrn(scrntop, scrnleft) drawscrn(scrntop, scrnleft)
@ -567,9 +539,9 @@ end
def cursright#0 def cursright#0
if curscol < 80 if curscol < 80
cursoff cursoff
curscol = curscol + 1 curscol++
if cursx < 39 if cursx < 39
cursx = cursx + 1 cursx++
else else
scrnleft = curscol - 39 scrnleft = curscol - 39
drawscrn(scrntop, scrnleft) drawscrn(scrntop, scrnleft)
@ -643,7 +615,7 @@ def printtxt(slot)#0
for i = 0 to numlines - 1 for i = 0 to numlines - 1
cpyln(strlinbuf:[i], @txtbuf) cpyln(strlinbuf:[i], @txtbuf)
puts(@txtbuf) puts(@txtbuf)
crout putln
next next
*csw = scrncsw *csw = scrncsw
end end
@ -651,7 +623,7 @@ def openline(row)
if numlines < maxlines if numlines < maxlines
memcpy(@strlinbuf:[row + 1], @strlinbuf:[row], (numlines - row) * 2) memcpy(@strlinbuf:[row + 1], @strlinbuf:[row], (numlines - row) * 2)
strlinbuf:[row] = @nullstr strlinbuf:[row] = @nullstr
numlines = numlines + 1 numlines++
flags = flags | changed flags = flags | changed
return TRUE return TRUE
fin fin
@ -659,11 +631,11 @@ def openline(row)
return FALSE return FALSE
end end
def cutline#0 def cutline#0
freestr(cutbuf) delstr(cutbuf)
cutbuf = strlinbuf:[cursrow] cutbuf = strlinbuf:[cursrow]
memcpy(@strlinbuf:[cursrow], @strlinbuf:[cursrow + 1], (numlines - cursrow) * 2) memcpy(@strlinbuf:[cursrow], @strlinbuf:[cursrow + 1], (numlines - cursrow) * 2)
if numlines > 1 if numlines > 1
numlines = numlines - 1 numlines--
fin fin
flags = flags | changed flags = flags | changed
if cursrow == numlines if cursrow == numlines
@ -675,7 +647,7 @@ def pasteline#0
if cutbuf and numlines < maxlines if cutbuf and numlines < maxlines
memcpy(@strlinbuf:[cursrow + 1], @strlinbuf:[cursrow], (numlines - cursrow) * 2) memcpy(@strlinbuf:[cursrow + 1], @strlinbuf:[cursrow], (numlines - cursrow) * 2)
strlinbuf:[cursrow] = newstr(cutbuf) strlinbuf:[cursrow] = newstr(cutbuf)
numlines = numlines + 1 numlines++
flags = flags | changed flags = flags | changed
redraw redraw
else else
@ -691,10 +663,10 @@ def joinline#0
if joinlen < 80 if joinlen < 80
memcpy(@joinstr + joinstr + 1, strlinbuf:[cursrow + 1] + 1, ^(strlinbuf:[cursrow + 1])) memcpy(@joinstr + joinstr + 1, strlinbuf:[cursrow + 1] + 1, ^(strlinbuf:[cursrow + 1]))
joinstr = joinlen joinstr = joinlen
freestr(strlinbuf:[cursrow]) delstr(strlinbuf:[cursrow])
strlinbuf:[cursrow] = newstr(@joinstr) strlinbuf:[cursrow] = newstr(@joinstr)
freestr(strlinbuf:[cursrow + 1]) delstr(strlinbuf:[cursrow + 1])
numlines = numlines - 1 numlines--
memcpy(@strlinbuf:[cursrow + 1], @strlinbuf:[cursrow + 2], (numlines - cursrow) * 2) memcpy(@strlinbuf:[cursrow + 1], @strlinbuf:[cursrow + 2], (numlines - cursrow) * 2)
flags = flags | changed flags = flags | changed
redraw redraw
@ -715,7 +687,7 @@ def splitline#0
strlinbuf:[cursrow + 1] = newstr(@splitstr) strlinbuf:[cursrow + 1] = newstr(@splitstr)
memcpy(@splitstr + 1, strlinbuf:[cursrow] + 1, curscol) memcpy(@splitstr + 1, strlinbuf:[cursrow] + 1, curscol)
splitstr = curscol splitstr = curscol
freestr(strlinbuf:[cursrow]) delstr(strlinbuf:[cursrow])
strlinbuf:[cursrow] = newstr(@splitstr) strlinbuf:[cursrow] = newstr(@splitstr)
fin fin
else else
@ -757,33 +729,33 @@ def editline(key)
if curscol > 0 if curscol > 0
if curscol <= editstr if curscol <= editstr
memcpy(@editstr[curscol], @editstr[curscol + 1], editstr - curscol) memcpy(@editstr[curscol], @editstr[curscol + 1], editstr - curscol)
editstr = editstr - 1 editstr--
fin fin
curscol = curscol - 1 curscol--
cursoff cursoff
if cursx > 0 if cursx > 0
cursx = cursx - 1 cursx--
drawrow(cursy, scrnleft, @editstr) drawrow(cursy, scrnleft, @editstr)
else else
scrnleft = scrnleft - 1 scrnleft--
drawscrn(scrntop, scrnleft) drawscrn(scrntop, scrnleft)
fin fin
curson curson
fin fin
elsif curscol < maxlnlen elsif curscol < maxlnlen
curscol = curscol + 1 curscol++
cursx = cursx + 1 cursx++
if flags & insmode if flags & insmode
if editstr < maxlnlen or editstr.maxlnlen == $A0 if editstr < maxlnlen or editstr.maxlnlen == $A0
editstr = editstr + 1 editstr++
if curscol >= editstr if curscol >= editstr
editstr = curscol editstr = curscol
else else
memcpy(@editstr[curscol + 1], @editstr[curscol], editstr - curscol) memcpy(@editstr[curscol + 1], @editstr[curscol], editstr - curscol)
fin fin
else else
curscol = curscol - 1 curscol--
cursx = cursx - 1 cursx--
key = editstr[curscol] key = editstr[curscol]
bell bell
fin fin
@ -797,7 +769,7 @@ def editline(key)
if cursx <= 39 if cursx <= 39
drawrow(cursy, scrnleft, @editstr) drawrow(cursy, scrnleft, @editstr)
else else
scrnleft = scrnleft + 1 scrnleft++
cursx = 39 cursx = 39
drawscrn(scrntop, scrnleft) drawscrn(scrntop, scrnleft)
fin fin
@ -809,7 +781,7 @@ def editline(key)
if curscol < editstr if curscol < editstr
strcpy(undoline, @editstr) strcpy(undoline, @editstr)
memcpy(@editstr[curscol + 1], @editstr[curscol + 2], editstr - curscol) memcpy(@editstr[curscol + 1], @editstr[curscol + 2], editstr - curscol)
editstr = editstr - 1 editstr--
cursoff cursoff
drawrow(cursy, scrnleft, @editstr) drawrow(cursy, scrnleft, @editstr)
curson curson
@ -827,7 +799,7 @@ def editline(key)
else else
strlinbuf:[cursrow] = @nullstr strlinbuf:[cursrow] = @nullstr
fin fin
freestr(undoline) delstr(undoline)
fin fin
return key return key
end end
@ -861,7 +833,7 @@ def editmode#0
is keyctrlf is keyctrlf
if numlines < maxlines and cursrow == numlines - 1 if numlines < maxlines and cursrow == numlines - 1
strlinbuf:[numlines] = @nullstr strlinbuf:[numlines] = @nullstr
numlines = numlines + 1 numlines++
fin fin
cursdown cursdown
is keyctrlo is keyctrlo
@ -902,7 +874,7 @@ def editmode#0
redraw redraw
break break
wend wend
until false until exit
end end
// //
// Command mode // Command mode
@ -913,22 +885,23 @@ def prfiles(optpath)
byte firstblk byte firstblk
byte entrylen, entriesblk byte entrylen, entriesblk
byte i, type, len byte i, type, len
word entry, filecnt word databuff, entry, filecnt
if ^optpath if ^optpath
strcpy(@path, optpath) strcpy(@path, optpath)
else else
getpfx(@path) getpfx(@path)
puts(@path) puts(@path)
crout putln
fin fin
refnum = open(@path, sysbuf) databuff = heapalloc(512)
refnum = fileio:open(@path)
if perr if perr
return perr return perr
fin fin
firstblk = 1 firstblk = 1
repeat repeat
if read(refnum, databuff, 512) == 512 if fileio:read(refnum, databuff, 512) == 512
entry = databuff + 4 entry = databuff + 4
if firstblk if firstblk
entrylen = databuff.$23 entrylen = databuff.$23
@ -943,13 +916,13 @@ def prfiles(optpath)
^entry = len ^entry = len
puts(entry) puts(entry)
if type & $F0 == $D0 // Is it a directory? if type & $F0 == $D0 // Is it a directory?
cout('/') putc('/')
len = len + 1 len++
fin fin
for len = 20 - len downto 1 for len = 20 - len downto 1
cout(' ') putc(' ')
next next
filecnt = filecnt - 1 filecnt--
fin fin
entry = entry + entrylen entry = entry + entrylen
next next
@ -958,14 +931,15 @@ def prfiles(optpath)
filecnt = 0 filecnt = 0
fin fin
until filecnt == 0 until filecnt == 0
close(refnum) fileio:close(refnum)
crout heaprelease(databuff)
putln
return 0 return 0
end end
def striplead(strptr, chr)#0 def striplead(strptr, chr)#0
while ^strptr and ^(strptr + 1) == chr while ^strptr and ^(strptr + 1) == chr
memcpy(strptr + 1, strptr + 2, ^strptr) memcpy(strptr + 1, strptr + 2, ^strptr)
^strptr = ^strptr - 1 ^strptr--
loop loop
end end
def parsecmd(strptr) def parsecmd(strptr)
@ -976,7 +950,7 @@ def parsecmd(strptr)
if ^strptr if ^strptr
cmd = ^(strptr + 1) cmd = ^(strptr + 1)
memcpy(strptr + 1, strptr + 2, ^strptr) memcpy(strptr + 1, strptr + 2, ^strptr)
^strptr = ^strptr - 1 ^strptr--
fin fin
if ^strptr if ^strptr
striplead(strptr, ' ') striplead(strptr, ' ')
@ -987,28 +961,22 @@ def chkchng
if flags & changed if flags & changed
puts("LOSE CHANGES TO FILE (Y/N)?") puts("LOSE CHANGES TO FILE (Y/N)?")
if toupper(keyin()) == 'N' if toupper(keyin()) == 'N'
crout putln
return FALSE return FALSE
fin fin
crout putln
fin fin
return TRUE return TRUE
end end
def quit#0 def cmdmode#0
if chkchng
exit
fin
end
def cmdmode
byte slot byte slot
word cmdptr word cmdptr
clrscrn clrscrn
puts("PLASMA ][ EDITOR VERSION 0.99") puts("PLASMA ][ EDITOR VERSION 0.99\n")
crout while not exit
while TRUE
puts(@txtfile) puts(@txtfile)
cmdptr = rdstr($BA) cmdptr = gets($BA)
when toupper(parsecmd(cmdptr)) when toupper(parsecmd(cmdptr))
is 'A' is 'A'
readtxt(cmdptr) readtxt(cmdptr)
@ -1045,7 +1013,7 @@ def cmdmode
printtxt(slot) printtxt(slot)
break break
is 'Q' is 'Q'
quit exit = chkchng
is 'E' is 'E'
is 0 is 0
return return
@ -1057,8 +1025,8 @@ def cmdmode
break break
otherwise otherwise
bell bell
cout('?') putc('?')
crout putln
wend wend
if perr if perr
puts("ERROR: $") puts("ERROR: $")
@ -1066,7 +1034,7 @@ def cmdmode
else else
puts("OK") puts("OK")
fin fin
crout putln
loop loop
end end
// //
@ -1079,8 +1047,8 @@ else
keyin = @keyin2e keyin = @keyin2e
fin fin
inittxtbuf inittxtbuf
if argbuff if ^argNext(argFirst)
strcpy(@txtfile, @argbuff) strcpy(@txtfile, cmdline)
puts(@txtfile) puts(@txtfile)
numlines = 0 numlines = 0
readtxt(@txtfile) readtxt(@txtfile)

View File

@ -2024,7 +2024,7 @@ end
// //
def emit_byte(bval)#0 def emit_byte(bval)#0
^codeptr = bval ^codeptr = bval
codeptr = codeptr + 1 codeptr++
end end
def emit_word(wval)#0 def emit_word(wval)#0
*codeptr = wval *codeptr = wval
@ -2089,12 +2089,12 @@ def emit_data(vartype, consttype, constval, constsize)
elsif consttype == STR_TYPE elsif consttype == STR_TYPE
size = constsize size = constsize
chrptr = constval chrptr = constval
constsize = constsize - 1 constsize--
emit_byte(constsize) emit_byte(constsize)
while constsize > 0 while constsize > 0
emit_byte(^chrptr) emit_byte(^chrptr)
chrptr = chrptr + 1 chrptr++
constsize = constsize - 1 constsize--
loop loop
else else
if vartype & BYTE_TYPE if vartype & BYTE_TYPE
@ -2408,7 +2408,7 @@ def idmatch(nameptr, len, idptr, idcnt)
fin fin
fin fin
idptr = idptr + idptr->idname + idrecsz idptr = idptr + idptr->idname + idrecsz
idcnt = idcnt - 1 idcnt--
loop loop
return 0 return 0
end end
@ -2431,7 +2431,7 @@ def dumpsym(idptr, idcnt)#0
fin fin
crout crout
idptr = idptr + idptr->idname + idrecsz idptr = idptr + idptr->idname + idrecsz
idcnt = idcnt - 1 idcnt--
loop loop
end end
def id_lookup(nameptr, len) def id_lookup(nameptr, len)
@ -2455,7 +2455,7 @@ def idlocal_add(namestr, len, type, size)
lastlocal=>idval = framesize lastlocal=>idval = framesize
lastlocal->idtype = type | LOCAL_TYPE lastlocal->idtype = type | LOCAL_TYPE
nametostr(namestr, len, lastlocal + idname) nametostr(namestr, len, lastlocal + idname)
locals = locals + 1 locals++
lastlocal = lastlocal + idrecsz + len lastlocal = lastlocal + idrecsz + len
if lastlocal > idlocal_tbl + idlocal_tblsz if lastlocal > idlocal_tbl + idlocal_tblsz
prstr(@local_sym_overflw) prstr(@local_sym_overflw)
@ -2463,8 +2463,7 @@ def idlocal_add(namestr, len, type, size)
fin fin
framesize = framesize + size framesize = framesize + size
if framesize > 255 if framesize > 255
prstr(@local_overflw) return parse_err(@local_overflw)
return FALSE
fin fin
return TRUE return TRUE
end end
@ -2474,7 +2473,7 @@ def iddata_add(namestr, len, type, size)
lastglobal->idtype = type lastglobal->idtype = type
nametostr(namestr, len, lastglobal + idname) nametostr(namestr, len, lastglobal + idname)
emit_iddata(datasize, size, lastglobal + idname) emit_iddata(datasize, size, lastglobal + idname)
globals = globals + 1 globals++
lastglobal = lastglobal + idrecsz + len lastglobal = lastglobal + idrecsz + len
if lastglobal > idglobal_tbl + idglobal_tblsz if lastglobal > idglobal_tbl + idglobal_tblsz
prstr(@global_sym_overflw) prstr(@global_sym_overflw)
@ -2496,7 +2495,7 @@ def idglobal_add(namestr, len, type, value)
lastglobal=>idval = value lastglobal=>idval = value
lastglobal->idtype = type lastglobal->idtype = type
nametostr(namestr, len, lastglobal + idname) nametostr(namestr, len, lastglobal + idname)
globals = globals + 1 globals++
lastglobal = lastglobal + idrecsz + len lastglobal = lastglobal + idrecsz + len
if lastglobal > idglobal_tbl + idglobal_tblsz if lastglobal > idglobal_tbl + idglobal_tblsz
prstr(@global_sym_overflw) prstr(@global_sym_overflw)
@ -2878,16 +2877,12 @@ def nextln
cpyln(strlinbuf:[lineno], instr) cpyln(strlinbuf:[lineno], instr)
lineno++ lineno++
if !(lineno & $0F); cout('.'); fin if !(lineno & $0F); cout('.'); fin
print(lineno);cout(':');print(numlines) //print(lineno);cout(':');print(numlines);cout('>');prstr(instr);crout
cout('>')
prstr(instr)
crout
scan scan
else else
cout('<') //cout('<');crout
crout *instr = 0
^instr = 0 //^inbuff = 0
^inbuff = 0
token = DONE_TKN token = DONE_TKN
fin fin
fin fin
@ -3139,7 +3134,7 @@ def parse_value(rvalue)
if deref if deref
push_op(token, 0) push_op(token, 0)
else else
deref = deref + 1 deref++
type = type | BPTR_TYPE type = type | BPTR_TYPE
fin fin
break break
@ -3147,12 +3142,12 @@ def parse_value(rvalue)
if deref if deref
push_op(token, 0) push_op(token, 0)
else else
deref = deref + 1 deref++
type = type | WPTR_TYPE type = type | WPTR_TYPE
fin fin
break break
is AT_TKN is AT_TKN
deref = deref - 1 deref--
break break
is SUB_TKN is SUB_TKN
is ALT_COMP_TKN is ALT_COMP_TKN
@ -3238,7 +3233,8 @@ def parse_value(rvalue)
ref_offset = 0 ref_offset = 0
fin fin
if ref_type & BPTR_TYPE; emit_lb if ref_type & BPTR_TYPE; emit_lb
elsif ref_type & WPTR_TYPE; emit_lw; fin elsif ref_type & WPTR_TYPE; emit_lw
fin
if lookahead <> CLOSE_PAREN_TKN if lookahead <> CLOSE_PAREN_TKN
emit_push emit_push
fin fin
@ -3847,7 +3843,7 @@ def parse_var(type)
byte consttype, constsize, idlen byte consttype, constsize, idlen
word idptr, constval, arraysize, size word idptr, constval, arraysize, size
cout('T') //cout('T')
idlen = 0 idlen = 0
size = 1 size = 1
if scan == OPEN_BRACKET_TKN if scan == OPEN_BRACKET_TKN
@ -3903,7 +3899,7 @@ def parse_struc
byte type, idlen, struclen, constsize byte type, idlen, struclen, constsize
word size, offset, idstr word size, offset, idstr
cout('S') //cout('S')
struclen = 0 struclen = 0
if scan == ID_TKN if scan == ID_TKN
struclen = tknlen struclen = tknlen
@ -3959,7 +3955,7 @@ def parse_vars
byte idlen, type, size byte idlen, type, size
word value, idptr word value, idptr
cout('V') //cout('V')
when token when token
is CONST_TKN is CONST_TKN
if scan <> ID_TKN if scan <> ID_TKN
@ -4012,7 +4008,7 @@ def parse_defs
word func_tag, idptr word func_tag, idptr
if token == DEF_TKN if token == DEF_TKN
cout('D') //cout('D')
if scan <> ID_TKN; return parse_err(@bad_decl); fin if scan <> ID_TKN; return parse_err(@bad_decl); fin
cfnparms = 0 cfnparms = 0
infunc = TRUE infunc = TRUE
@ -4070,7 +4066,7 @@ def parse_module
while parse_defs while parse_defs
nextln nextln
loop loop
cout('I') //cout('I')
framesize = 0 framesize = 0
entrypoint = codeptr entrypoint = codeptr
emit_enter(0) emit_enter(0)
@ -4080,7 +4076,7 @@ def parse_module
nextln nextln
loop loop
fin fin
cout('!') //cout('!')
if prevstmnt <> RETURN_TKN if prevstmnt <> RETURN_TKN
emit_const(0) emit_const(0)
emit_leave emit_leave

View File

@ -0,0 +1,9 @@
# Filetype extension configuration file for Geany
# Insert as many items as you want, separate them with a ";".
# See Geany's main documentation for details.
[Extensions]
PLASMA=*.pla;*.plh;
# Note: restarting is required after editing groups
[Groups]
Programming=PLASMA;

View File

@ -1,86 +0,0 @@
# For complete documentation of this file, please see Geany's main documentation
[styling]
# Edit these in the colorscheme .conf file instead
default=default
commentline=comment_line
number=number_1
string=string_1
character=character
word=keyword_1
global=type
symbol=preprocessor
classname=class
defname=function
operator=operator
identifier=identifier_1
modulename=type
backticks=backticks
instancevar=default
classvar=default
datasection=default
heredelim=operator
worddemoted=keyword_1
stdin=default
stdout=default
stderr=default
regex=regex
here_q=here_doc
here_qq=here_doc
here_qx=here_doc
string_q=string_2
string_qq=string_2
string_qx=string_2
string_qr=string_2
string_qw=string_2
upper_bound=default
error=error
pod=comment_doc
[keywords]
# all items must be in one line
primary=done include import export struc const word byte and predef asm def end not or repeat until break for to downto next when wend is otherwise if else elsif fin while loop return
[settings]
# default extension used when saving files
extension=pla
# MIME type
mime_type=application/x-plasma
# the following characters are these which a "word" can contains, see documentation
$wordchars=$_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
# single comments, like # in this file
comment_single=//
# multiline comments
#comment_open==begin
#comment_close==end
# set to false if a comment character/string should start at column 0 of a line, true uses any
# indentation of the line, e.g. setting to true causes the following on pressing CTRL+d
#command_example();
# setting to false would generate this
# command_example();
# This setting works only for single line comments
comment_use_indent=true
# context action command (please see Geany's main documentation for details)
context_action_cmd=
lexer_filetype=pascal
[indentation]
width=4
# 0 is spaces, 1 is tabs, 2 is tab & spaces
type=0
[build-menu]
# %f will be replaced by the complete filename
# %e will be replaced by the filename without extension
# (use only one of it at one time)
FT_00_LB=_Compile
FT_00_CM=plasm -AMOW < "%f"
FT_00_WD=
EX_00_LB=_Execute
EX_00_CM=plvm "%f#FE1000"
EX_00_WD=