1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-02-20 17:29:11 +00:00
This commit is contained in:
David Schmenk 2014-06-16 19:26:40 -07:00
parent c29dcb65c8
commit 117ed34748
2 changed files with 28 additions and 56 deletions

View File

@ -552,7 +552,7 @@ def prstr(str)
loop
end
def rdstr(prompt)
byte ch, maxlen, i
byte ch, maxlen
maxlen = 0
inbuff.0 = 0
cout(prompt)
@ -575,9 +575,7 @@ def rdstr(prompt)
if inbuff.0
cout('#')
cout(inbuff[inbuff.0])
for i = inbuff.0 + 1 to maxlen
inbuff[i - 1] = inbuff[i]
next
memcpy(inbuff + inbuff.0, inbuff + inbuff.0 + 1, maxlen - inbuff.0)
maxlen = maxlen - 1
inbuff.0 = inbuff.0 - 1
fin
@ -592,11 +590,13 @@ def rdstr(prompt)
inbuff.0 = 0
ch = $0D
otherwise
cout(ch)
inbuff.0 = inbuff.0 + 1
inbuff[inbuff.0] = ch
if inbuff.0 > maxlen
maxlen = inbuff.0
if ch >= ' '
cout(ch)
inbuff.0 = inbuff.0 + 1
inbuff[inbuff.0] = ch
if inbuff.0 > maxlen
maxlen = inbuff.0
fin
fin
wend
until ch == $0D or inbuff.0 == $7F
@ -897,43 +897,11 @@ def loadmod(mod)
; Free up the end-of-module in main memory.
;
releaseheap(modend)
return 0
return fixup
end
;
; Command mode
;
;def catalog
; byte type, len
; word entry, filecnt
; opendir
; repeat
; entry = readdir
; if !perr
; type = ^entry
; if type
; len = type & $0F
; ^entry = len
; prstr(entry)
; if type & $F0 == $D0 ; Is it a directory?
; cout('/')
; len = len + 1
; elsif (entry).$10 == $FF
; cout('-')
; len = len + 1
; elsif (entry).$10 == $FE
; cout('+')
; len = len + 1
; fin
; for len = 19 - len downto 0
; cout(' ')
; next
; fin
; fin
; until perr
; perr = 0
; return crout()
;end
def stripchars(strptr)
while ^strptr and ^(strptr + 1) <> ' '
memcpy(strptr + 1, strptr + 2, ^strptr)
@ -1033,8 +1001,6 @@ while 1
quit
is 'M'
syscall($02)
; is 'C'
; catalog
is '+'
execmod(cmdptr)
otherwise

View File

@ -519,15 +519,19 @@ end
; loop
; return 0
asm lookuptbl
LDY #$00
STY DSTL
LDA ESTKL,X
STA DSTL
STA DSTX
LDA ESTKH,X
STA DSTH
BNE +
DEC DSTX
LDA #$80
+ STA DSTH
LDA ESTKL+1,X
STA SRCL
LDA ESTKH+1,X
STA SRCH
LDY #$00
- LDA (DST),Y
BEQ +
CMP (SRC),Y
@ -544,6 +548,8 @@ asm lookuptbl
+ INX
STA ESTKL,X
STY ESTKH,X
LDA #$00
STA DSTX
RTS
++ LDY #$00
-- LDA (DST),Y
@ -875,7 +881,7 @@ end
; tbl = tbl + 2
; loop
;end
def addtbl(dci, val, last)
def addtbl(dci, val, seg, last)
word tblentry
tblentry = *last
while ^dci & $80
@ -895,7 +901,7 @@ def lookupsym(sym)
return lookuptbl(sym, symtbl)
end
def addsym(sym, addr)
return addtbl(sym, addr, @lastsym);
return addtbl(sym, addr, symtbl, @lastsym);
end
;
; Module routines.
@ -906,7 +912,7 @@ def lookupmod(mod)
end
def addmod(mod, addr)
byte dci[17]
return addtbl(modtosym(mod, @dci), addr, @lastsym)
return addtbl(modtosym(mod, @dci), addr, symtbl, @lastsym)
end
def lookupextern(esd, index)
word sym, addr
@ -1039,7 +1045,7 @@ def loadmod(mod)
;
; Locate bytecode defs in allocated segment.
;
modseg[modid] = seg_find($00, @codeseg, @defaddr, (rld - bytecode + 255) >> 8, modid + $11)
modseg[modid] = seg_find($00, @codeseg, @defaddr, (rld - bytecode + 255) >> 8, modid + $12)
if perr
return -perr
fin
@ -1261,7 +1267,7 @@ def execmod(modfile)
word saveheap, savesym, saveflags
if stodci(modfile, @moddci)
saveheap = heap
saveheap = heap
savesym = lastsym
saveflags = systemflags
^lastsym = 0
@ -1280,11 +1286,11 @@ end
;
init_cons
;
; Init symbol table.
; Init 2K symbol table.
;
symtbl = allocheap($400)
lastsym = symtbl
^lastsym = 0
seg_find($00, @symtbl, @lastsym, $08, $11)
lastsym = symtbl & $FF00
pokeb(symtbl, lastsym, 0)
stodci(@stdlibstr, heap)
addmod(heap, @systemflags)
while *stdlibsym