From 3e0d81d09d853e90a7b17c15ebb22daf491a41e4 Mon Sep 17 00:00:00 2001 From: David Schmenk Date: Tue, 3 Apr 2018 10:10:41 -0700 Subject: [PATCH] Put buffer at beginning of SBANK --- src/inc/cmdsys.plh | 1 - src/vmsrc/apple/plvm03.s | 35 +++++++++++++---------------------- src/vmsrc/apple/soscmd.pla | 16 ++++++++++------ src/vmsrc/apple/sossys.pla | 22 +++++++++++++--------- 4 files changed, 36 insertions(+), 38 deletions(-) diff --git a/src/inc/cmdsys.plh b/src/inc/cmdsys.plh index e476d19..d258e54 100644 --- a/src/inc/cmdsys.plh +++ b/src/inc/cmdsys.plh @@ -55,7 +55,6 @@ import cmdsys byte jitsize byte refcons // Apple /// specific byte devcons // Apple /// specific - word cmdparser // Apple /// specific end // // CMD exported functions diff --git a/src/vmsrc/apple/plvm03.s b/src/vmsrc/apple/plvm03.s index 1363f81..84aeab9 100755 --- a/src/vmsrc/apple/plvm03.s +++ b/src/vmsrc/apple/plvm03.s @@ -31,8 +31,6 @@ JMPTMPX = XPAGE+JMPTMP TMPX = XPAGE+TMPH SRCX = XPAGE+SRCH DSTX = XPAGE+DSTH -JITCOMP = $B7F0 ; JIT VARS AT THE END OF INTER -JITCODE = $B7F2 ;* ;* SOS ;* @@ -134,6 +132,10 @@ PAGE0 = * } VMCORE = * !PSEUDOPC $A000 { +TEMPBUF !FILL $F0 +CMDPARS !WORD 0 ; $A0F0 +JITCOMP !WORD 0 ; $A0F2 +JITCODE !WORD 0 ; $A0F4 ;* ;* OPCODE TABLE ;* @@ -171,7 +173,7 @@ XINTERP PLA STA TMPL PLA STA TMPH - LDY #$03 +- LDY #$03 LDA (TMP),Y STA IPX DEY @@ -186,34 +188,20 @@ XINTERP PLA ;* JIT PROFILING ENTRY INTO INTERPRETER ;* JITINTRP PLA - SEC - SBC #$02 ; POINT TO DEF ENTRY STA TMPL PLA - SBC #$00 STA TMPH - LDY #$06 + LDY #$04 LDA (TMP),Y ; DEC JIT COUNT SEC SBC #$01 STA (TMP),Y - BEQ RUNJIT - DEY ; INTERP BYTECODE AS USUAL - LDA (TMP),Y - STA IPX - DEY - LDA (TMP),Y - STA IPH - DEY - LDA (TMP),Y - STA IPL - LDY #$00 - JMP FETCHOP -RUNJIT LDA JITCOMP + BNE - ; INTERP BYTECODE + LDA JITCOMP ; CALL JIT COMPILER STA SRCL LDA JITCOMP+1 STA SRCH - DEY ; LDY #$05 + INY ; LDY #$05 LDA (SRC),Y STA IPX DEY @@ -224,9 +212,12 @@ RUNJIT LDA JITCOMP STA IPL DEX ; ADD PARAMETER TO DEF ENTRY LDA TMPL + SEC + SBC #$02 ; POINT TO DEF ENTRY PHA ; AND SAVE IT FOR LATER STA ESTKL,X LDA TMPH + SBC #$00 PHA STA ESTKH,X LDY #$00 @@ -1357,7 +1348,7 @@ CALL INY ;+INC_IP INY ;+INC_IP LDA (IP),Y STA CALLADR+2 - TYA +_CALL TYA SEC ADC IPL PHA diff --git a/src/vmsrc/apple/soscmd.pla b/src/vmsrc/apple/soscmd.pla index 7c8e9dd..883b8b8 100755 --- a/src/vmsrc/apple/soscmd.pla +++ b/src/vmsrc/apple/soscmd.pla @@ -1,5 +1,9 @@ include "inc/cmdsys.plh" // +// Temp buff addresses +// +const cmdparser = $A0F0 +// // JIT compiler values // // @@ -16,11 +20,11 @@ end // // JIT compiler values // -const jitcomp = $B7F0 -const jitcodeptr = $B7F2 -const codemax = $9FE0 -const directentry = $A0C2 // Right afer opcode table -const indirectentry = $A0D5 // Yikes! Grabbed from plvm03.sym +const jitcomp = $A0F2 +const jitcodeptr = $A0F4 +const codemax = $A000 +const directentry = $A1C2 // Right afer opcode table +const indirectentry = $A1F0 // Yikes! Grabbed from plvm03.sym // // COPY FROM EXT MEM TO MAIN MEM. // @@ -304,7 +308,7 @@ end // // Save pointer to command line handler // -cmdsys:cmdparser = @shell +*cmdparser = @shell // // Install JIT compiler // diff --git a/src/vmsrc/apple/sossys.pla b/src/vmsrc/apple/sossys.pla index 03739ec..02d7aaf 100755 --- a/src/vmsrc/apple/sossys.pla +++ b/src/vmsrc/apple/sossys.pla @@ -17,6 +17,11 @@ const resxhgr2 = $0080 const modkeep = $2000 const modinitkeep = $4000 // +// Temp buff addresses +// +const instr = $A020 +const cmdparser = $A0F0 +// // Indirect interpreter DEFinition entrypoint // struc t_defentry @@ -30,8 +35,8 @@ end // // JIT compiler values // -const jitcomp = $B7F0 -const jitcodeptr = $B7F2 +const jitcomp = $A0F2 +const jitcodeptr = $A0F4 const codemax = $A000 // // Pedefined functions. @@ -55,7 +60,6 @@ byte jitcount = 0 byte jitsize = 0 byte refcons = 0 byte devcons = 0 -word cmdparser // // String pool. // @@ -940,12 +944,12 @@ def print(i)#0 end def rdstr(prompt)#1 cout(prompt) - ^heap = read(refcons, heap + 1, 128) - if heap->[^heap] == $0D - ^heap-- + ^instr = read(refcons, instr+1, 128) + if instr->[^instr] == $0D + ^instr-- fin crout - return heap + return instr end def prbyte(v)#0 cout(hexchar[(v >> 4) & $0F]) @@ -1045,7 +1049,7 @@ def adddef(isfirst, ext, addr, deflast)#1 if not isfirst preventry = defentry - t_defentry defsize = addr - preventry=>bytecodeaddr - if defsize <= jitsize // and *jitcomp + if defsize <= jitsize preventry=>interpaddr = jitinterp // JSR JITINTRP preventry->callcount = jitcount // Set JIT countdown preventry->bytecodesize = defsize // Set size @@ -1337,7 +1341,7 @@ fin // Call cmd line parser // repeat - execmod(cmdparser()) + execmod((*cmdparser)()) write(refcons, @textmode, 3) cmdln = 0 until 0