1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-10 21:30:04 +00:00

Hash dictionary entries to speed up vocabulary lookup

This commit is contained in:
David Schmenk 2023-12-31 22:36:56 -08:00
parent b466a48a16
commit 3b8bad0abd
5 changed files with 716 additions and 573 deletions

View File

@ -203,6 +203,7 @@ cp samplesrc/sfm.pla prodos/bld/samples/SFM.PLA.TXT
cp samplesrc/sfmsprt.pla prodos/bld/samples/SFMSPRT.PLA.TXT
cp samplesrc/fppow.pla prodos/bld/samples/FPPOW.PLA.TXT
cp samplesrc/plasma.4th prodos/bld/samples/PLASMA.4TH.TXT
cp samplesrc/grlib.4th prodos/bld/samples/GRLIB.4TH.TXT
cp samplesrc/bounce.4th prodos/bld/samples/BOUNCE.4TH.TXT
cp utilsrc/apple/mon.pla prodos/bld/samples/MON.PLA.TXT
cp utilsrc/apple/zipchip.pla prodos/bld/samples/ZIPCHIP.PLA.TXT

View File

@ -7,13 +7,22 @@
?PLASMA ( Load PLASMA if not already )
: ?GRLIB
" GRLIB" FIND
0= IF
" GRLIB.4TH" SRC
THEN
;
?GRLIB ( Load GRLIB if not already )
5 VARIABLE BALLCLR
10 VARIABLE BALLX
20 VARIABLE BALLY
10 VARIABLE OLDX
20 VARIABLE OLDY
1 VARIABLE INCX
1 VARIABLE INCY
1 VARIABLE INCX
1 VARIABLE INCY
: MOVEBALL
BALLX @ 0= IF INCX @ NEG INCX ! THEN
@ -22,22 +31,24 @@
BALLY @ 47 = IF INCY @ NEG INCY ! THEN
INCX @ BALLX +!
INCY @ BALLY +!
BALLCLR @ GRCOLOR DROP
BALLX @ BALLY @ GRPLOT DROP
0 GRCOLOR DROP
OLDX @ OLDY @ GRPLOT DROP
BALLCLR @ GRCOLOR
BALLX @ BALLY @ GRPLOT
0 GRCOLOR
OLDX @ OLDY @ GRPLOT
BALLX @ OLDX !
BALLY @ OLDY !
;
: BOUNCE
0 GRMODE DROP
1 GRMODE DROP
0 GRDRAWBUF
0 GRCLEAR
BEGIN
MOVEBALL
?TERMINAL
UNTIL
KEY
40 TEXTMODE DROP
0 GRMODE DROP
;
BOUNCE

16
src/samplesrc/grlib.4th Normal file
View File

@ -0,0 +1,16 @@
LOADMOD" GRLIB"
LOOKUP GRPLOT PLASMA GRPLOT
LOOKUP GRHLIN PLASMA GRHLIN
LOOKUP GRVLIN PLASMA GRVLIN
LOOKUP GRBLT PLASMA GRBLT
LOOKUP GRTILE PLASMA GRTILE
LOOKUP GRTILESTR PLASMA GRTILESTR
LOOKUP GRFILL PLASMA GRFILL
LOOKUP DGRVLB PLASMA DGRVLB
LOOKUP GRCLEAR PLASMA GRCLEAR
LOOKUP GRMODE PLASMA GRMODE
LOOKUP GRSHOW PLASMA GRSHOW
LOOKUP GRSWAP PLASMA GRSWAP
LOOKUP GRDRAWBUF PLASMA GRDRAWBUF
LOOKUP GRCOLOR PLASMA GRCOLOR

View File

@ -1,10 +1,19 @@
: IFACE 2 * + @ ;
LOOKUP CMDSYS 3 IFACE PLASMA EXECMOD
LOOKUP CMDSYS 0 IFACE CONSTANT PLASMA_VER
LOOKUP CMDSYS 2 IFACE CONSTANT CMDLINE
LOOKUP CMDSYS 3 IFACE PLASMA EXECMOD
LOOKUP STRCPY PLASMA STRCPY
LOOKUP STRCAT PLASMA STRCAT
: .PLASMAVER
PLASMA_VER 12 RSHIFT $0F AND 48 + EMIT
PLASMA_VER 8 RSHIFT $0F AND 48 + EMIT
46 EMIT
PLASMA_VER 4 RSHIFT $0F AND 48 + EMIT
PLASMA_VER $0F AND 48 + EMIT
;
: CPYCMD
CMDLINE " . " STRCPY DROP ( Need a dummy value for the module name )
34 WORD CMDLINE SWAP STRCAT DROP ( Quote deliminted string )
@ -15,9 +24,17 @@ LOOKUP STRCAT PLASMA STRCAT
EXECMOD 0< IF ." Failed to exec module" CR THEN
;
: LOADMOD
EXECMOD 0< IF ." Failed to load module" CR THEN
;
: LOADMOD"
34 WORD ( Quote deliminted string )
EXECMOD 0< IF ." Failed to load module" CR THEN
LOADMOD
;
: EDIT
" ED" EXECMOD 0< IF ." Failed to run ED" CR ABORT THEN
;
: EDIT"
@ -25,21 +42,54 @@ LOOKUP STRCAT PLASMA STRCAT
" ED" EXECMOD 0< IF ." Failed to run ED" CR ABORT THEN
;
: CAT
" CAT" EXECMOD 0< IF ." Failed to run CAT" CR ABORT THEN
;
: CAT"
CPYCMD
" CAT" EXECMOD 0< IF ." Failed to run CAT" CR ABORT THEN
;
: DEL"
CPYCMD
" DEL" EXECMOD 0< IF ." Failed to run DEL" CR ABORT THEN
;
: REN"
CPYCMD
" REN" EXECMOD 0< IF ." Failed to run REN" CR ABORT THEN
;
: COPY"
CPYCMD
" COPY" EXECMOD 0< IF ." Failed to run COPY" CR ABORT THEN
;
: NEWDIR"
CPYCMD
" NEWDIR" EXECMOD 0< IF ." Failed to run NEWDIR" CR ABORT THEN
;
( LOADMOD" FILEIO" FILEIO is already available in plforth )
LOOKUP FILEIO CONSTANT FILEIOAPI
FILEIOAPI 0 IFACE PLASMA GETPFX
FILEIOAPI 1 IFACE PLASMA SETPFX
: .PFX
HERE GETPFX HERE (.")
;
: SETPFX"
34 WORD SETPFX DROP
;
( LOADMOD" CONIO" CONIO is already available in plforth )
LOOKUP CONIO CONSTANT CONIOAPI
CONIOAPI 3 IFACE PLASMA HOME
CONIOAPI 4 IFACE PLASMA GOTOXY
CONIOAPI 7 IFACE PLASMA TEXTMODE
CONIOAPI 8 IFACE PLASMA GRMODE
CONIOAPI 9 IFACE PLASMA GRCOLOR
CONIOAPI 10 IFACE PLASMA GRPLOT
CONIOAPI 11 IFACE PLASMA TONE
CONIOAPI 12 IFACE PLASMA RAND

File diff suppressed because it is too large Load Diff