1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-22 23:29:55 +00:00

Fix DEFER for compiled code

This commit is contained in:
David Schmenk 2024-02-04 21:16:36 -08:00
parent 969277f8ae
commit f25f4c6dc7
13 changed files with 73 additions and 21 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -39,4 +39,5 @@ cat scripts/rod.4th | ./ac.jar -ptx PLFORTH.PO scripts/ROD.4TH TX
cat scripts/bounce.4th | ./ac.jar -ptx PLFORTH.PO scripts/BOUNCE.4TH TXT
cat scripts/dbounce.4th | ./ac.jar -ptx PLFORTH.PO scripts/DBOUNCE.4TH TXT
cat scripts/hrbounce.4th | ./ac.jar -ptx PLFORTH.PO scripts/HRBOUNCE.4TH TXT
cat scripts/hrplot.4th | ./ac.jar -ptx PLFORTH.PO scripts/HRPLOT.4TH TXT
echo "+PLFORTH PLASMA.4TH" | ./ac.jar -ptx PLFORTH.PO AUTORUN TXT

View File

@ -231,7 +231,7 @@ cat samplesrc/testlib.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/TESTLIB.PL
cat samplesrc/playseq.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/PLAYSEQ.PLA TXT
cat samplesrc/rpncalc.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/RPNCALC.PLA TXT
cat samplesrc/fatcat.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/FATCAT.PLA TXT
cat samplesrc/gfxdemo.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/GFXDEMO.PLA TXT
#cat samplesrc/gfxdemo.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/GFXDEMO.PLA TXT
cat samplesrc/lz4cat.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/LZ4CAT.PLA TXT
cat samplesrc/sfm.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/SFM.PLA TXT
cat samplesrc/sfmsprt.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/SFMSPRT.PLA TXT
@ -244,6 +244,7 @@ cat scripts/rod.4th | ./ac.jar -ptx PLASMA-2.1.po bld/scripts/ROD.4TH TXT
cat scripts/bounce.4th | ./ac.jar -ptx PLASMA-2.1.po bld/scripts/BOUNCE.4TH TXT
cat scripts/dbounce.4th | ./ac.jar -ptx PLASMA-2.1.po bld/scripts/DBOUNCE.4TH TXT
cat scripts/hrbounce.4th | ./ac.jar -ptx PLASMA-2.1.po bld/scripts/HRBOUNCE.4TH TXT
cat scripts/hrplot.4th | ./ac.jar -ptx PLASMA-2.1.po bld/scripts/HRPLOT.4TH TXT
#mkdir bld/examples
#cat samplesrc/examples/ex.1.pla bld/examples/EX.1.PLA TXT

View File

@ -50,7 +50,7 @@ cat samplesrc/rod.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/ROD.PL
cat samplesrc/playseq.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/PLAYSEQ.PLA TXT
cat samplesrc/rpncalc.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/RPNCALC.PLA TXT
#cat samplesrc/fatcat.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/FATCAT.PLA TXT
cat samplesrc/gfxdemo.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/GFXDEMO.PLA TXT
#cat samplesrc/gfxdemo.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/GFXDEMO.PLA TXT
cat samplesrc/lz4cat.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/LZ4CAT.PLA TXT
cat samplesrc/sfm.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/SFM.PLA TXT
cat samplesrc/sfmsprt.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/SFMSPRT.PLA TXT
@ -62,3 +62,4 @@ cat scripts/rod.4th | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/scripts/ROD.4T
cat scripts/bounce.4th | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/scripts/BOUNCE.4TH TXT
cat scripts/dbounce.4th | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/scripts/DBOUNCE.4TH TXT
cat scripts/hrbounce.4th | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/scripts/HRBOUNCE.4TH TXT
cat scripts/hrplot.4th | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/scripts/HRPLOT.4TH TXT

View File

@ -61,15 +61,15 @@ cp rel/TX2FORTH#FE1000 prodos/sys/TX2FORTH.REL
cp rel/PLFORTH#FE1000 prodos/sys/PLFORTH.REL
mkdir prodos/sys/scripts
cp scripts/plasma.4th prodos/sys/scripts/PLASMA.4TH.TXT
cp scripts/machid.4th prodos/sys/scripts/MACHID.4TH.TXT
cp scripts/conio.4th prodos/sys/scripts/CONIO.4TH.TXT
cp scripts/fileio.4th prodos/sys/scripts/FILEIO.4TH.TXT
cp scripts/grlib.4th prodos/sys/scripts/GRLIB.4TH.TXT
cp scripts/dgrlib.4th prodos/sys/scripts/DGRLIB.4TH.TXT
cp scripts/hgrlib.4th prodos/sys/scripts/HGRLIB.4TH.TXT
cp scripts/int32.4th prodos/sys/scripts/INT32.4TH.TXT
cp scripts/fpu.4th prodos/sys/scripts/FPU.4TH.TXT
cp scripts/plasma.4th prodos/sys/scripts/PLASMA.4TH.TXT
cp scripts/machid.4th prodos/sys/scripts/MACHID.4TH.TXT
cp scripts/conio.4th prodos/sys/scripts/CONIO.4TH.TXT
cp scripts/fileio.4th prodos/sys/scripts/FILEIO.4TH.TXT
cp scripts/grlib.4th prodos/sys/scripts/GRLIB.4TH.TXT
cp scripts/dgrlib.4th prodos/sys/scripts/DGRLIB.4TH.TXT
cp scripts/hgrlib.4th prodos/sys/scripts/HGRLIB.4TH.TXT
cp scripts/int32.4th prodos/sys/scripts/INT32.4TH.TXT
cp scripts/fpu.4th prodos/sys/scripts/FPU.4TH.TXT
rm -rf prodos/demos
mkdir prodos/demos
@ -148,6 +148,7 @@ cp scripts/rod.4th prodos/bld/scripts/ROD.4TH.TXT
cp scripts/bounce.4th prodos/bld/scripts/BOUNCE.4TH.TXT
cp scripts/dbounce.4th prodos/bld/scripts/DBOUNCE.4TH.TXT
cp scripts/hrbounce.4th prodos/bld/scripts/HRBOUNCE.4TH.TXT
cp scripts/hrplot.4th prodos/bld/scripts/HRPLOT.4TH.TXT
#mkdir prodos/bld/examples
#cp samplesrc/examples/ex.1.pla prodos/bld/examples/EX.1.PLA.TXT

View File

@ -74,11 +74,13 @@ FPULIB 65 IFACE PLASMA _FPPOW : FPPOW _FPPOW FPERR ! ;
FPULIB 66 IFACE PLASMA _FPCOMP : FPCOMP _FPCOMP FPERR ! ;
FPULIB 67 IFACE PLASMA _FPANNUITY : FPANNUITY _FPANNUITY FPERR ! ;
FPULIB 68 IFACE PLASMA _FPRANDNUM : FPRANDNUM _FPRANDNUM FPERR ! ;
1 CONSTANT FPSTR.FIXED
1 CONSTANT FPSTR.FIXED
0 CONSTANT FPSTR.FLOAT
2 CONSTANT FPSTR.STRIP
4 CONSTANT FPSTR.EXP
8 CONSTANT FPSTR.FLEX
: FP. HERE 10 4 FPSTR.FLEX FPSTR! HERE (.") ;
: >FPINT PAD ! PAD FPINT@ ;
: FPINT> PAD FPINT! PAD @ ;
: FP. PAD 10 4 FPSTR.FLEX FPSTR! PAD (.") ;
: FPEXT CREATE 10 ALLOT ;
FPRESET
FPRESET

44
src/scripts/hrplot.4th Normal file
View File

@ -0,0 +1,44 @@
LOOKUP HRFORTH ( HGR page 1 reserved )
NOT ?ABORT" Must run with HRFORTH."
SRC" PLASMA.4TH"
SRC" CONIO.4TH"
SRC" HGRLIB.4TH"
SRC" FPU.4TH"
: DRAWAXIS
0 HGRMODE HGRDRAWBUF TILEDRAWBUF DROP
1 HGRCOLOR
0 96 279 96 HGRLINE
139 0 139 191 HGRLINE
140 0 140 191 HGRLINE
;
: PLOTDONE
KEY DROP
-1 HGRMODE DROP
;
FPEXT XSCALE
FPCONSTPI 140 >FPINT FP/ XSCALE FPEXT!
FPEXT YSCALE
96 >FPINT YSCALE FPEXT!
DEFER FUNC
: PLOTFUNC
3 HGRCOLOR
279 0 DO
I DUP 139 - >FPINT XSCALE FPEXT@ FP*
FUNC
YSCALE FPEXT@ FP* FPINT> 95 +
OVER 1+ OVER HGRPLOT HGRPLOT
LOOP
;
' FPSIN IS FUNC
DRAWAXIS PLOTFUNC PLOTDONE
' FPCOS IS FUNC
DRAWAXIS PLOTFUNC PLOTDONE

View File

@ -7,7 +7,8 @@ include "inc/longjmp.plh"
// Internal variables
//
const JSR = $20 // 6502 JSR opcode needed for VM entry
const RTS = $60
const RTS = $60 // 6502 RTS opcode
const JMP = $4C // 6502 JMP opcode
const SRCREFS = 2
const INBUF_SIZE = 128
word latest, infunc, inptr, IIP, W
@ -1322,7 +1323,7 @@ def _dodefer_#0
end
def _defer_#0
newdict
_dictaddb_(RTS); _dictaddb_(0) // NO-OP and space for deferred pfa
_dictaddb_(RTS); _dictaddw_(0) // NO-OP and space for deferred pfa
addhash(latest)
end
def _is_(a)#0
@ -1330,12 +1331,13 @@ def _is_(a)#0
dentry = find(nextword(' '))
if dentry
if ^_ffa_(a) & itc_flag
*_cfa_(dentry) = @_dodefer_
*_pfa_(dentry) = a
^(_ffa_(dentry)) = ^(_ffa_(dentry)) | itc_flag
^(_ffa_(dentry)) = ^(_ffa_(a))
if ^_ffa_(dentry) & itc_flag
*_cfa_(dentry) = @_dodefer_
*_pfa_(dentry) = a
else // comp_pbc_flag
*_cfa_(dentry) = *_cfa_(a)
^_pfa_(dentry) = JMP
*(_pfa_(dentry) + 1) = *_cfa_(a)
fin
else
puts(a); puts(" Not found")