1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-04-05 03:37:43 +00:00

Fix 64K VM

This commit is contained in:
David Schmenk 2018-04-13 16:13:12 -07:00
parent 0925945d2e
commit 97e2c48098
7 changed files with 19 additions and 46 deletions

Binary file not shown.

View File

@ -43,8 +43,8 @@ word syspath
word syscmdln
word = @execmod, @open, @close, @read, @write
byte perr
byte jitcount = $10
byte jitsize = $FF
byte jitcount = 0
byte jitsize = 0
//
// Working input buffer overlayed with strings table
//
@ -1369,8 +1369,8 @@ syscmdln = @cmdln
// Try to load autorun.
//
autorun = open(@autorun)
if autorun > 0
cmdln = read(autorun, @autorun, 128)
if autorun
^getlnbuf = read(autorun, getlnbuf + 1, 128)
close(0)
else
//
@ -1381,6 +1381,7 @@ fin
perr = 0
while 1
if ^getlnbuf
strcpy(@cmdln, getlnbuf)
when toupper(parsecmd(getlnbuf))
is 'Q'
reboot()
@ -1406,27 +1407,26 @@ while 1
execsys(getlnbuf)
break
is '+'
saveX
//saveX
execmod(striptrail(getlnbuf))
//
// Clean up
//
restoreX
//restoreX
resetmemfiles
break
otherwise
cout('?')
cout(perr)//cout('?')
wend
if perr
prstr("ERR:$")
prbyte(perr)
perr = 0
else
prstr("OK")
fin
crout()
fin
prstr(pfxop(@prefix, GET_PFX))
strcpy(@cmdln, rdstr($BA))
rdstr($BA)
loop
done

View File

@ -1027,7 +1027,7 @@ def adddef(isfirst, addr, deflast)#1
if not isfirst
preventry = defentry - t_defentry
defsize = addr - preventry=>bytecodeaddr
if defsize <= jitsize // and *jitcomp
if defsize <= jitsize
preventry=>interpaddr = $03D6 // JSR $03D6 (JIT INTERP)
preventry->callcount = jitcount // Set JIT countdown
preventry->bytecodesize = defsize // Set size
@ -1036,8 +1036,7 @@ def adddef(isfirst, addr, deflast)#1
defentry->interpjsr = $20
defentry=>interpaddr = $03DC // JSR $03DC (BYTECODE INTERP)
defentry=>bytecodeaddr = addr
//defentry=>5 = 0 // Clear count and size
defentry->t_defentry = 0 // NULL out next entry
defentry->t_defentry = 0 // NULL out next entry
return defentry
end
def loadmod(mod)#1
@ -1438,8 +1437,8 @@ xheaptop = $A000 // Top where JIT loaded
// Try to load autorun.
//
autorun = open(@autorun)
if autorun > 0
cmdln = read(autorun, @autorun, 128)
if autorun
^getlnbuf = read(autorun, getlnbuf + 1, 128)
close(0)
else
//
@ -1450,6 +1449,7 @@ fin
perr = 0
while 1
if ^getlnbuf
strcpy(@cmdln, getlnbuf)
when toupper(parsecmd(getlnbuf))
is 'Q'
reboot()
@ -1489,13 +1489,12 @@ while 1
if perr
prstr("ERR:$")
prbyte(perr)
perr = 0
else
prstr("OK")
fin
crout()
fin
prstr(pfxop(@prefix, GET_PFX))
strcpy(@cmdln, rdstr($BA))
rdstr($BA)
loop
done

View File

@ -34,6 +34,7 @@ JITCODE = $03E4
;
; INIT VM ENVIRONMENT STACK POINTERS
;
STY $01FF
STY PPL
STY IFPL ; INIT FRAME POINTER = $AF00 (4K FOR JIT CODE)
STY JITCODE

View File

@ -32,10 +32,9 @@ LCBNK1 = $08
;
; INIT VM ENVIRONMENT STACK POINTERS
;
STY PPL
STY $01FF
STY IFPL ; INIT FRAME POINTER = $BF00
LDA #$BF
STA PPH
STA IFPH
LDX #$FE ; INIT STACK POINTER (YES, $FE. SEE GETS)
TXS

View File

@ -29,8 +29,7 @@ LCRWEN = $C083
LCBNK2 = $00
LCBNK1 = $08
!SOURCE "vmsrc/plvmzp.inc"
PSR = TMP+2
DVSIGN = PSR+1
DVSIGN = TMP+3
DROP = $EF
NEXTOP = $F0
FETCHOP = NEXTOP+1
@ -245,19 +244,6 @@ CMDENTRY = *
!WORD CLOSEPARMS
BNE FAIL
;
; INIT VM ENVIRONMENT STACK POINTERS
;
; LDA #$00
STA $01FF ; CLEAR CMDLINE BUFF
STA PPL ; INIT FRAME POINTER
STA IFPL
LDA #$BF ; FRAME POINTER AT $BF00, BELOW PRODOS
STA PPH
STA IFPH
LDX #$FE ; INIT STACK POINTER (YES, $FE. SEE GETS)
TXS
LDX #ESTKSZ/2 ; INIT EVAL STACK INDEX
;
; CHANGE CMD STRING TO SYSPATH STRING
;
LDA STRBUF
@ -317,6 +303,7 @@ DEFCMD = * ;!FILL 28
ENDBYE = *
}
LCDEFCMD = * ;*-28 ; DEFCMD IN LC MEMORY
!ALIGN 255,0
;*
;* ADD TOS TO TOS-1
;*

View File

@ -329,19 +329,6 @@ CMDENTRY = *
!WORD CLOSEPARMS
BNE FAIL
;
; INIT VM ENVIRONMENT STACK POINTERS
;
; LDA #$00
STA $01FF ; CLEAR CMDLINE BUFF
STA PPL ; INIT FRAME POINTER
STA IFPL
LDA #$AF ; FRAME POINTER AT $AF00, BELOW JIT BUFFER
STA PPH
STA IFPH
LDX #$FE ; INIT STACK POINTER (YES, $FE. SEE GETS)
TXS
LDX #ESTKSZ/2 ; INIT EVAL STACK INDEX
;
; CHANGE CMD STRING TO SYSPATH STRING
;
LDA STRBUF