From ad03eff0eb074808cf7cf77066932d63eb8aecf5 Mon Sep 17 00:00:00 2001 From: David Schmenk Date: Fri, 27 Dec 2024 10:10:11 -0800 Subject: [PATCH] BIG update to expand eval stack to 32. These are the dependencies: --- src/dhgr.tk/utils/dhgrrgb.pla | 12 +++++------- src/inc/cmdsys.plh | 2 +- src/inc/longjmp.plh | 2 +- src/libsrc/apple/jit.pla | 8 ++++---- src/libsrc/apple/jit16.pla | 8 ++++---- src/libsrc/fiber.pla | 8 ++++---- src/samplesrc/sfm.pla | 8 ++++---- src/toolsrc/plforth.pla | 22 +++++++++++----------- src/vmsrc/apple/plvmzp.inc | 6 +++--- src/vmsrc/apple/soscmdjit.pla | 8 ++++---- src/vmsrc/plvm.h | 2 +- 11 files changed, 42 insertions(+), 44 deletions(-) diff --git a/src/dhgr.tk/utils/dhgrrgb.pla b/src/dhgr.tk/utils/dhgrrgb.pla index f60e344..768a422 100644 --- a/src/dhgr.tk/utils/dhgrrgb.pla +++ b/src/dhgr.tk/utils/dhgrrgb.pla @@ -540,8 +540,7 @@ def rgbImportExport(rgbfile, dhgrfile)#0 rgbErr=>[GRN] = -1 rgbErr=>[BLU] = -1 memset(rgbScanline, 0, 563 * 3) - //for j = 0 to 191 I seem to have overflowed the stack - j = 0; repeat + for j = 0 to 191 fileio:read(refnum, rgbScanline, 560 * 3) memset(@ntscCycle, GREY_CHROMA, 24) // Reset chroma cycle rgbptr = rgbScanline @@ -568,11 +567,10 @@ def rgbImportExport(rgbfile, dhgrfile)#0 errptr = errptr + 3 * 2 next if flags & MEM_MODE; putc('.'); fin - //if ^$C000 == $83 - // break - //fin - //next - j++; until j == 192 or ^$C000 == $83 + if ^$C000 == $83 + break + fin + next fileio:close(refnum) if ^dhgrfile if flags & MEM_MODE diff --git a/src/inc/cmdsys.plh b/src/inc/cmdsys.plh index f73b987..ff4013f 100644 --- a/src/inc/cmdsys.plh +++ b/src/inc/cmdsys.plh @@ -2,7 +2,7 @@ import cmdsys // // Useful values for everyone // - const _SYSVER_ = $0211 // Version built against + const _SYSVER_ = $0220 // Version built against const FALSE = 0 const TRUE = not FALSE const NULL = 0 diff --git a/src/inc/longjmp.plh b/src/inc/longjmp.plh index 466bbae..7d0c079 100644 --- a/src/inc/longjmp.plh +++ b/src/inc/longjmp.plh @@ -1,4 +1,4 @@ import longjmp - const t_except = $0140 + const t_except = $0180 predef except(env), throw(env, retval) end diff --git a/src/libsrc/apple/jit.pla b/src/libsrc/apple/jit.pla index f0bd2e9..0fa74d6 100644 --- a/src/libsrc/apple/jit.pla +++ b/src/libsrc/apple/jit.pla @@ -18,10 +18,10 @@ end const jitcomp = $03E2 const jitcodeptr = $03E4 const codemax = $BEE0 -const estkh8 = $C000 -const estkh = $00C0 -const estkl8 = $D000 -const estkl = $00D0 +const estkh8 = $A000 +const estkh = $00A0 +const estkl8 = $C000 +const estkl = $00C0 const ifpl8 = $E000 const ifph8 = $E100 const jmptmp = $00E6 diff --git a/src/libsrc/apple/jit16.pla b/src/libsrc/apple/jit16.pla index be03a35..749b267 100644 --- a/src/libsrc/apple/jit16.pla +++ b/src/libsrc/apple/jit16.pla @@ -18,10 +18,10 @@ end const jitcomp = $03E2 const jitcodeptr = $03E4 const codemax = $BEE0 -const estkh8 = $C000 -const estkh = $00C0 -const estkl8 = $D000 -const estkl = $00D0 +const estkh8 = $A000 +const estkh = $00A0 +const estkl8 = $C000 +const estkl = $00C0 const ifp8 = $E000 const ifpl8 = $E000 const ifph8 = $E100 diff --git a/src/libsrc/fiber.pla b/src/libsrc/fiber.pla index 64915da..cd108a4 100644 --- a/src/libsrc/fiber.pla +++ b/src/libsrc/fiber.pla @@ -24,8 +24,8 @@ export byte fbrCount = 0 // Zero Page VM state and 6502 stack // struc t_vm - byte estkhi[$10] - byte estklo[$10] + byte estkhi[$20] + byte estklo[$20] word ifp word pp byte hwsp @@ -55,7 +55,7 @@ asm fbrSwap(saveVM, restoreVM)#0 STX ESP TSX STX HWSP - LDY #$26 + LDY #$46 - LDA ESTK,Y STA (DST),Y LDA (SRC),Y @@ -86,7 +86,7 @@ asm fbrLoad(loadVM)#0 STA SRCL LDA ESTKH,X STA SRCH - LDY #$26 + LDY #$46 - LDA (SRC),Y STA ESTK,Y DEY diff --git a/src/samplesrc/sfm.pla b/src/samplesrc/sfm.pla index 7efd7fb..4db2d6a 100644 --- a/src/samplesrc/sfm.pla +++ b/src/samplesrc/sfm.pla @@ -41,14 +41,14 @@ byte curstar, buzz //asm spkrTone(pitch, duration)#0 byte _spkrTone[] byte = $86, $E5 // STX ESP -byte = $B4, $C0 // LDY ESTKH,X -byte = $B5, $D0 // LDA ESTKL,X +byte = $B4, $A0 // LDY ESTKH,X +byte = $B5, $C0 // LDA ESTKL,X byte = $F0, $01 // BEQ +1 byte = $C8 // INY byte = $85, $08 // STA DSTL byte = $84, $09 // STY DSTH -byte = $B4, $C1 // LDY ESTKL+1,X -byte = $B5, $D1 // LDA ESTKL+1,X +byte = $B4, $A1 // LDY ESTKL+1,X +byte = $B5, $C1 // LDA ESTKL+1,X byte = $F0, $01 // BEQ +1 byte = $C8 // INY byte = $85, $E7 // STA TMPL diff --git a/src/toolsrc/plforth.pla b/src/toolsrc/plforth.pla index 743ef1d..884745e 100644 --- a/src/toolsrc/plforth.pla +++ b/src/toolsrc/plforth.pla @@ -62,18 +62,18 @@ byte brk = 0 byte _get_estack = $8A // TXA byte = $49, $FF // EOR #$FF byte = $38 // SEC -byte = $69, $10 // ADC #$10 -byte = $C9, $11 // CMP #$11 +byte = $69, $20 // ADC #$20 +byte = $C9, $21 // CMP #$21 byte = $90, $02 // BCC +2 -byte = $A2, $10 // LDX #ESTKSZ/2 +byte = $A2, $20 // LDX #ESTKSZ/2 byte = $CA // DEX byte = $95 // STA -byte _estkl = $D0 // ESTKL,X +byte _estkl = $C0 // ESTKL,X byte = $A9, $00 // LDA #$00 byte = $95 // STA -byte _estkh = $C0 // ESTKH,X +byte _estkh = $A0 // ESTKH,X byte = $60 // RTS -byte _reset_estack = $A2, $10 // LDX #ESTKSZ/2 +byte _reset_estack = $A2, $20 // LDX #ESTKSZ/2 byte = $60 // RTS // // FORTH dictionary layout @@ -1022,7 +1022,7 @@ def _execword_(dentry)#0 fin W = _cfa_(dentry) (*W)()#0 - if (@_get_estack)()#1 > 16 + if (@_get_estack)()#1 > 32 puts("Stack over/underflow\n") _quit_ fin @@ -1946,7 +1946,7 @@ def _prstack_#0 byte depth for depth = 1 to (@_get_estack)()#1 - val = ^(_estkl + 16 - depth) | (^(_estkh + 16 - depth) << 8) + val = ^(_estkl + 32 - depth) | (^(_estkh + 32 - depth) << 8) puti(val); putc(' ') next end @@ -2100,9 +2100,9 @@ end // // Start FORTH // -puts("FORTH for PLASMA 2.1\n") -if cmdsys:sysver < $0201 - puts("PLASMA >= 2.01 required\n") +puts("FORTH for PLASMA 2.20\n") +if cmdsys:sysver < $0220 + puts("PLASMA >= 2.20 required\n") return fin // diff --git a/src/vmsrc/apple/plvmzp.inc b/src/vmsrc/apple/plvmzp.inc index 9517eeb..45d575d 100755 --- a/src/vmsrc/apple/plvmzp.inc +++ b/src/vmsrc/apple/plvmzp.inc @@ -9,9 +9,9 @@ SRCH = SRC+1 DST = SRC+2 DSTL = DST DSTH = DST+1 -ESGUARD = $BE -ESTKSZ = $20 -ESTK = $C0 +ESGUARD = $9E +ESTKSZ = $40 +ESTK = $A0 ESTKH = ESTK ESTKL = ESTK+ESTKSZ/2 VMZP = ESTK+ESTKSZ diff --git a/src/vmsrc/apple/soscmdjit.pla b/src/vmsrc/apple/soscmdjit.pla index 1ad0e56..f130239 100755 --- a/src/vmsrc/apple/soscmdjit.pla +++ b/src/vmsrc/apple/soscmdjit.pla @@ -25,10 +25,10 @@ const jitcodeptr = $A0F4 const sinterp = $A0F6 const xinterp = $A0F8 const jitinterp = $A0FA -const estkh8 = $C000 -const estkh = $00C0 -const estkl8 = $D000 -const estkl = $00D0 +const estkh8 = $A000 +const estkh = $00A0 +const estkl8 = $C000 +const estkl = $00C0 const ifpl8 = $E000 const ifph8 = $E100 const jmptmp = $00E6 diff --git a/src/vmsrc/plvm.h b/src/vmsrc/plvm.h index 1573ba1..997caeb 100644 --- a/src/vmsrc/plvm.h +++ b/src/vmsrc/plvm.h @@ -62,7 +62,7 @@ typedef uint16_t address; * 6502 memory map */ #define MEM6502_SIZE 0x00010000 -#define ESTK_SIZE 16 +#define ESTK_SIZE 32 #define CMDLINE_STR 0x01FF #define CMDLINE_BUF 0x0200 #define SYSPATH_STR 0x0280