1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-22 08:31:36 +00:00

Update all VMs with new FORTH opcodes

This commit is contained in:
David Schmenk 2024-01-03 13:03:48 -08:00
parent 54a256cd60
commit 68cc31993f
6 changed files with 99 additions and 14 deletions

View File

@ -22,7 +22,7 @@ LOOKUP STRCAT PLASMA STRCAT
: LOADMOD" ( modulename -- )
PAD SWAP STRCPY ( Move module name out of the way in case its immediate )
[ ' " CFA @ ] LITERAL EXECUTE ( Exec word to build a string from input )
34 WORD ( Build a string from input )
LOADMOD
;

View File

@ -36,18 +36,19 @@ predef cin()#1, rdstr(p)#1, toupper(c)#1, strcpy(dst,src)#1, strcat(dst,src)#1
predef markheap()#1, allocheap(size)#1, allocalignheap(size, pow2, freeaddr), releaseheap(newheap)#1, availheap()#1
predef memset(addr,value,size)#0, memcpy(dst,src,size)#0
predef uword_isgt(a,b)#1, uword_isge(a,b)#1, uword_islt(a,b)#1, uword_isle(a,b)#1
predef sext(a)#1, divmod(a,b)#2, execmod(modfile)#1
predef sext(a)#1, divmod(a,b)#2, execmod(modfile)#1, syslookuptbl(a)#1
//
// Exported CMDSYS table
//
word version = $0200 // 02.00
word version = $0201 // 02.01
word syspath
word syscmdln
word = @execmod
word systemflags = 0
word = @execmod
word systemflags = 0
word heap
word symtbl, lastsym
byte perr, refauto
word = @syslookuptbl
//
// String pool.
//
@ -740,6 +741,9 @@ asm cin()#1
STA ESTKH,X
RTS
end
def syslookuptbl(dci)#1
return lookuptbl(dci, symtbl)
end
def crout()#0
cout($0D)
end

View File

@ -121,7 +121,7 @@ OPTBL !WORD ZERO,CN,CN,CN,CN,CN,CN,CN ; 00 02
!WORD NEG,COMP,BAND,IOR,XOR,SHL,SHR,IDXW ; 90 92 94 96 98 9A 9C 9E
!WORD BRGT,BRLT,INCBRLE,ADDBRLE,DECBRGE,SUBBRGE,BRAND,BROR ; A0 A2 A4 A6 A8 AA AC AE
!WORD ADDLB,ADDLW,ADDAB,ADDAW,IDXLB,IDXLW,IDXAB,IDXAW ; B0 B2 B4 B6 B8 BA BC BE
!WORD NATV ; C0
!WORD NATV,JUMPZ,JUMP ; C0 C2 C4
;*
;* DIV TOS-1 BY TOS
;*
@ -1073,6 +1073,28 @@ NATV TYA ; FLATTEN IP
JMP (IP)
+ INC IPH
JMP (IP)
;*
;* JUMPS FOR FORTH COMPILER
;*
JUMPZ INX
LDA ESTKH-1,X
ORA ESTKL-1,X
BEQ JUMP
INY ;+INC_IP
INY
BMI +
JMP NEXTOP
+ JMP FIXNEXT
JUMP INY
LDA (IP),Y
PHA
INY
LDA (IP),Y
STA IPH
PLA
STA IPL
LDY #$00
JMP FETCHOP
A1CMD !SOURCE "vmsrc/apple/a1cmd.a"
SEGEND = *
VMINIT LDY #$10 ; INSTALL PAGE 0 FETCHOP ROUTINE

View File

@ -150,16 +150,16 @@ OPTBL !WORD ZERO,CN,CN,CN,CN,CN,CN,CN ; 00 02
!WORD NEG,COMP,BAND,IOR,XOR,SHL,SHR,IDXW ; 90 92 94 96 98 9A 9C 9E
!WORD BRGT,BRLT,INCBRLE,ADDBRLE,DECBRGE,SUBBRGE,BRAND,BROR ; A0 A2 A4 A6 A8 AA AC AE
!WORD ADDLB,ADDLW,ADDAB,ADDAW,IDXLB,IDXLW,IDXAB,IDXAW ; B0 B2 B4 B6 B8 BA BC BE
!WORD NATV ; C0
!WORD NATV,JUMPZ,JUMP ; C0 C2 C4
;*
;* SYSTEM INTERPRETER ENTRYPOINT
;*
INTERP PLA
CLC
ADC #$01
ADC #$01
STA IPL
PLA
ADC #$00
ADC #$00
STA IPH
LDY #$00
STY IPX
@ -1380,6 +1380,28 @@ NATV TYA ; FLATTEN IP
JMP (IP)
+ INC IPH
JMP (IP)
;*
;* JUMPS FOR FORTH COMPILER
;*
JUMPZ INX
LDA ESTKH-1,X
ORA ESTKL-1,X
BEQ JUMP
INY ;+INC_IP
INY
BMI +
JMP NEXTOP
+ JMP FIXNEXT
JUMP INY
LDA (IP),Y
PHA
INY
LDA (IP),Y
STA IPH
PLA
STA IPL
LDY #$00
JMP FETCHOP
SOSCMD = *
!SOURCE "vmsrc/apple/sossys.a"

View File

@ -269,7 +269,7 @@ OPTBL !WORD ZERO,CN,CN,CN,CN,CN,CN,CN ; 00 02
!WORD NEG,COMP,BAND,IOR,XOR,SHL,SHR,IDXW ; 90 92 94 96 98 9A 9C 9E
!WORD BRGT,BRLT,INCBRLE,ADDBRLE,DECBRGE,SUBBRGE,BRAND,BROR ; A0 A2 A4 A6 A8 AA AC AE
!WORD ADDLB,ADDLW,ADDAB,ADDAW,IDXLB,IDXLW,IDXAB,IDXAW ; B0 B2 B4 B6 B8 BA BC BE
!WORD NATV ; C0
!WORD NATV,JUMPZ,JUMP ; C0 C2 C4
;*
;* ENTER INTO BYTECODE INTERPRETER - IMMEDIATELY SWITCH TO NATIVE
;*
@ -479,7 +479,7 @@ OPXTBL !WORD ZERO,CN,CN,CN,CN,CN,CN,CN ; 00 02
!WORD NEG,COMP,BAND,IOR,XOR,SHL,SHR,IDXW ; 90 92 94 96 98 9A 9C 9E
!WORD BRGT,BRLT,INCBRLE,ADDBRLE,DECBRGE,SUBBRGE,BRAND,BROR ; A0 A2 A4 A6 A8 AA AC AE
!WORD ADDLBX,ADDLWX,ADDABX,ADDAWX,IDXLBX,IDXLWX,IDXABX,IDXAWX ; B0 B2 B4 B6 B8 BA BC BE
!WORD NATV ; C0
!WORD NATV,JUMPZ,JUMP ; C0 C2 C4
;*
;* JIT PROFILING ENTRY INTO INTERPRETER
;*
@ -1846,5 +1846,20 @@ NATV TYA ; FLATTEN IP
STA IP
+INDEX16 ; SET 16 BIT X/Y
JMP (IP)
;*
;* JUMPS FOR FORTH COMPILER
;*
JUMPZ PLA
BEQ JUMP
INY ;+INC_IP
INY
BMI +
JMP NEXTOP
+ JMP FIXNEXT
JUMP INY
LDA (IP),Y
STA IP
LDY #$00
JMP FETCHOP
VMEND = *
}

View File

@ -155,16 +155,16 @@ OPTBL !WORD ZERO,CN,CN,CN,CN,CN,CN,CN ; 00 02
!WORD NEG,COMP,BAND,IOR,XOR,SHL,SHR,IDXW ; 90 92 94 96 98 9A 9C 9E
!WORD BRGT,BRLT,INCBRLE,ADDBRLE,DECBRGE,SUBBRGE,BRAND,BROR ; A0 A2 A4 A6 A8 AA AC AE
!WORD ADDLB,ADDLW,ADDAB,ADDAW,IDXLB,IDXLW,IDXAB,IDXAW ; B0 B2 B4 B6 B8 BA BC BE
!WORD NATV ; C0
!WORD NATV,JUMPZ,JUMP ; C0 C2 C4
;*
;* SYSTEM INTERPRETER ENTRYPOINT
;*
INTERP PLA
CLC
ADC #$01
ADC #$01
STA IPL
PLA
ADC #$00
ADC #$00
STA IPH
LDY #$00
STY IPX
@ -1448,6 +1448,28 @@ NATV TYA ; FLATTEN IP
JMP (IP)
+ INC IPH
JMP (IP)
;*
;* JUMPS FOR FORTH COMPILER
;*
JUMPZ INX
LDA ESTKH-1,X
ORA ESTKL-1,X
BEQ JUMP
INY ;+INC_IP
INY
BMI +
JMP NEXTOP
+ JMP FIXNEXT
JUMP INY
LDA (IP),Y
PHA
INY
LDA (IP),Y
STA IPH
PLA
STA IPL
LDY #$00
JMP FETCHOP
SOSCMD = *
!SOURCE "vmsrc/apple/sossysjit.a"