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

Switch all VMs to lazy IP update

This commit is contained in:
Dave Schmenk 2018-01-18 20:27:53 -08:00
parent a3b12f9c28
commit e06a217f33
4 changed files with 768 additions and 794 deletions

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,6 @@ PSR = TMP+2
DVSIGN = PSR+1
DROP = $EF
NEXTOP = $F0
;FETCHOP = NEXTOP+3
FETCHOP = NEXTOP+1
IP = FETCHOP+1
IPL = IP
@ -372,12 +371,9 @@ PAGE0 = *
!PSEUDOPC DROP {
INX ; DROP @ $EF
INY ; NEXTOP @ $F0
; BEQ NEXTOPH
LDA $FFFF,Y ; FETCHOP @ $F3, IP MAPS OVER $FFFF @ $F4
STA OPIDX
JMP (OPTBL) ; OPIDX AND OPPAGE MAP OVER OPTBL
;NEXTOPH INC IPH
; BNE FETCHOP
}
PAGE3 = *
;*
@ -1333,13 +1329,13 @@ BRFLS INX
LDA ESTKH-1,X
ORA ESTKL-1,X
BNE NOBRNCH
BRNCH TYA ; FLATTEN IP
BRNCH TYA ; FLATTEN IP
CLC
ADC IPL
STA TMPL
LDA #$00
ADC IPH
STA TMPH ; ADD BRANCH OFFSET
STA TMPH ; ADD BRANCH OFFSET
INY
LDA (IP),Y
CLC

View File

@ -14,7 +14,7 @@ MEMBANK = $FFEF
DVSIGN = TMP+2
DROP = $EF
NEXTOP = $F0
FETCHOP = NEXTOP+3
FETCHOP = NEXTOP+1
IP = FETCHOP+1
IPL = IP
IPH = IPL+1
@ -44,8 +44,12 @@ DSTX = XPAGE+DSTH
;*
!MACRO INC_IP {
INY
BNE *+4
INC IPH
BPL +
INC IPH
TYA
AND #$7F
TAY
+
}
;*
;* INTERPRETER HEADER+INITIALIZATION
@ -113,12 +117,9 @@ PAGE0 = *
;*
INX ; DROP
INY ; NEXTOP
BEQ NEXTOPH
LDA $FFFF,Y ; FETCHOP @ $F3, IP MAPS OVER $FFFF @ $F4
STA OPIDX
JMP (OPTBL)
NEXTOPH INC IPH
BNE FETCHOP
}
;*
;* SYSTEM INTERPRETER ENTRYPOINT
@ -539,7 +540,7 @@ CB LDA #$00
;*
LA = *
CW DEX
+INC_IP
INY ;+INC_IP
LDA (IP),Y
STA ESTKL,X
+INC_IP
@ -550,7 +551,7 @@ CW DEX
;* CONSTANT STRING
;*
CS DEX
+INC_IP
INY ;+INC_IP
TYA ; NORMALIZE IP
CLC
ADC IPL
@ -695,7 +696,7 @@ LLW +INC_IP
;* LOAD VALUE FROM ABSOLUTE ADDRESS
;*
!IF SELFMODIFY {
LAB +INC_IP
LAB INY ;+INC_IP
LDA (IP),Y
STA LABLDA+1
+INC_IP
@ -708,7 +709,7 @@ LABLDA LDA $FFFF
STA ESTKH,X
JMP NEXTOP
} ELSE {
LAB +INC_IP
LAB INY ;+INC_IP
LDA (IP),Y
STA TMPL
+INC_IP
@ -723,7 +724,7 @@ LAB +INC_IP
LDY IPY
JMP NEXTOP
}
LAW +INC_IP
LAW INY ;+INC_IP
LDA (IP),Y
STA TMPL
+INC_IP
@ -764,8 +765,6 @@ SB LDA ESTKL,X
STA (TMP),Y
LDY IPY
INX
; INX
; JMP NEXTOP
JMP DROP
}
SW LDA ESTKL,X
@ -781,8 +780,6 @@ SW LDA ESTKL,X
STA (TMP),Y
LDY IPY
INX
; INX
; JMP NEXTOP
JMP DROP
;*
;* STORE VALUE TO LOCAL FRAME OFFSET
@ -794,8 +791,6 @@ SLB +INC_IP
LDA ESTKL,X
STA (IFP),Y
LDY IPY
; INX
; JMP NEXTOP
JMP DROP
SLW +INC_IP
LDA (IP),Y
@ -807,8 +802,6 @@ SLW +INC_IP
LDA ESTKH,X
STA (IFP),Y
LDY IPY
; INX
; JMP NEXTOP
JMP DROP
;*
;* STORE VALUE TO LOCAL FRAME OFFSET WITHOUT POPPING STACK
@ -836,7 +829,7 @@ DLW +INC_IP
;* STORE VALUE TO ABSOLUTE ADDRESS
;*
!IF SELFMODIFY {
SAB +INC_IP
SAB INY ;+INC_IP
LDA (IP),Y
STA SABSTA+1
+INC_IP
@ -844,11 +837,9 @@ SAB +INC_IP
STA SABSTA+2
LDA ESTKL,X
SABSTA STA $FFFF
; INX
; JMP NEXTOP
JMP DROP
} ELSE {
SAB +INC_IP
SAB INY ;+INC_IP
LDA (IP),Y
STA TMPL
+INC_IP
@ -859,11 +850,9 @@ SAB +INC_IP
LDY #$00
STA (TMP),Y
LDY IPY
; INX
; JMP NEXTOP
JMP DROP
}
SAW +INC_IP
SAW INY ;+INC_IP
LDA (IP),Y
STA TMPL
+INC_IP
@ -877,14 +866,12 @@ SAW +INC_IP
LDA ESTKH,X
STA (TMP),Y
LDY IPY
; INX
; JMP NEXTOP
JMP DROP
;*
;* STORE VALUE TO ABSOLUTE ADDRESS WITHOUT POPPING STACK
;*
!IF SELFMODIFY {
DAB +INC_IP
DAB INY ;+INC_IP
LDA (IP),Y
STA DABSTA+1
+INC_IP
@ -894,7 +881,7 @@ DAB +INC_IP
DABSTA STA $FFFF
JMP NEXTOP
} ELSE {
DAB +INC_IP
DAB INY ;+INC_IP
LDA (IP),Y
STA TMPL
+INC_IP
@ -907,7 +894,7 @@ DAB +INC_IP
LDY IPY
JMP NEXTOP
}
DAW +INC_IP
DAW INY ;+INC_IP
LDA (IP),Y
STA TMPL
+INC_IP
@ -993,29 +980,33 @@ BRTRU INX
LDA ESTKH-1,X
ORA ESTKL-1,X
BNE BRNCH
NOBRNCH +INC_IP
NOBRNCH INY ;+INC_IP
+INC_IP
JMP NEXTOP
BRFLS INX
LDA ESTKH-1,X
ORA ESTKL-1,X
BNE NOBRNCH
BRNCH LDA IPH
STA TMPH
LDA IPL
+INC_IP
BRNCH TYA ; FLATTEN IP
CLC
ADC (IP),Y
ADC IPL
STA TMPL
LDA TMPH
+INC_IP
ADC (IP),Y
LDA #$00
ADC IPH
STA TMPH ; ADD BRANCH OFFSET
INY
LDA (IP),Y
CLC
ADC TMPL
STA TMPL
INY
LDA (IP),Y
ADC TMPH
STA IPH
LDA TMPL
STA IPL
DEY
DEY
JMP NEXTOP
LDY #$01
JMP FETCHOP
BREQ INX
LDA ESTKL-1,X
CMP ESTKL,X
@ -1059,10 +1050,10 @@ IBRNCH LDA IPL
;*
;* CALL INTO ABSOLUTE ADDRESS (NATIVE CODE)
;*
CALL +INC_IP
CALL INY ;+INC_IP
LDA (IP),Y
STA CALLADR+1
+INC_IP
INY ;+INC_IP
LDA (IP),Y
STA CALLADR+2
TYA
@ -1146,7 +1137,7 @@ ENTER LDA IFPH
;*
;* LEAVE FUNCTION
;*
LEAVE +INC_IP
LEAVE INY ;+INC_IP
LDA (IP),Y
CLC
ADC IFPL

View File

@ -55,7 +55,7 @@ PSR = TMP+2
HWSP = PSR+1
DROP = $EF
NEXTOP = DROP+1
FETCHOP = NEXTOP+3
FETCHOP = NEXTOP+1
IP = FETCHOP+1
IPL = IP
IPH = IPL+1
@ -76,10 +76,11 @@ NOS = $03 ; TOS-1
;*
!MACRO INC_IP {
INY
BNE +
LDX IPH
INX
STX IPH
BPL +
INC IPH
TYA
AND #$7F
TAY
+
}
;*
@ -468,13 +469,8 @@ PAGE0 = *
!PSEUDOPC DROP {
PLA ; DROP @ $EF
INY ; NEXTOP @ $F0
BEQ NEXTOPH
LDX $FFFF,Y ; FETCHOP @ $F3, IP MAPS OVER $FFFF @ $F4
JMP (OPTBL,X) ; OPIDX AND OPPAGE MAP OVER OPTBL
NEXTOPH LDX IPH
INX
STX IPH
BRA FETCHOP
}
PAGE3 = *
;*
@ -782,15 +778,15 @@ CB +INC_IP
;* LOAD ADDRESS & LOAD CONSTANT WORD (SAME THING, WITH OR WITHOUT FIXUP)
;*
LA = *
CW +INC_IP
CW INY ;+INC_IP
LDA (IP),Y
+INC_IP
PHA
+INC_IP
JMP NEXTOP
;*
;* CONSTANT STRING
;*
CS +INC_IP
CS INY ;+INC_IP
TYA ; NORMALIZE IP AND SAVE STRING ADDR ON ESTK
CLC
ADC IP
@ -800,7 +796,7 @@ CS +INC_IP
TAY
JMP NEXTOP
;
CSX +INC_IP
CSX INY ;+INC_IP
TYA ; NORMALIZE IP
CLC
ADC IP
@ -968,49 +964,48 @@ LLWX +INC_IP
;* LOAD VALUE FROM ABSOLUTE ADDRESS
;*
!IF SELFMODIFY {
LAB +INC_IP
LAB INY ;+INC_IP
LDA (IP),Y
+INC_IP
STA LABLDX+1
LABLDX LDX $FFFF
TXA
PHA
+INC_IP
JMP NEXTOP
} ELSE {
LAB +INC_IP
LAB INY ;+INC_IP
LDA (IP),Y
+INC_IP
STA TMP
TYA ; QUICKY CLEAR OUT MSB
+ACCMEM8 ; 8 BIT A/M
LDA (TMP)
+ACCMEM16 ; 16 BIT A/M
PHA
+INC_IP
JMP NEXTOP
}
LAW +INC_IP
LAW INY ;+INC_IP
LDA (IP),Y
+INC_IP
STA TMP
LDA (TMP)
PHA
+INC_IP
JMP NEXTOP
;
!IF SELFMODIFY {
LABX +INC_IP
LABX INY ;+INC_IP
LDA (IP),Y
+INC_IP
STA LABXLDX+1
STX ALTRDOFF
LABXLDX LDX $FFFF
STX ALTRDON
TXA
PHA
+INC_IP
JMP NEXTOP
} ELSE {
LABX +INC_IP
LABX INY ;+INC_IP
LDA (IP),Y
+INC_IP
STA TMP
TYA ; QUICKY CLEAR OUT MSB
STX ALTRDOFF
@ -1019,16 +1014,17 @@ LABX +INC_IP
+ACCMEM16 ; 16 BIT A/M
STX ALTRDON
PHA
+INC_IP
JMP NEXTOP
}
LAWX +INC_IP
LAWX INY ;+INC_IP
LDA (IP),Y
+INC_IP
STA TMP
STX ALTRDOFF
LDA (TMP)
STX ALTRDON
PHA
+INC_IP
JMP NEXTOP
;
;*
@ -1132,61 +1128,61 @@ DLW +INC_IP
;* STORE VALUE TO ABSOLUTE ADDRESS
;*
!IF SELFMODIFY {
SAB +INC_IP
SAB INY ;+INC_IP
LDA (IP),Y
+INC_IP
STA SABSTX+1
PLA
TAX
SABSTX STX $FFFF
+INC_IP
JMP NEXTOP
} ELSE {
SAB +INC_IP
SAB INY ;+INC_IP
LDA (IP),Y
+INC_IP
STA TMP
PLA
+ACCMEM8 ; 8 BIT A/M
STA (TMP)
+ACCMEM16 ; 16 BIT A/M
+INC_IP
JMP NEXTOP
}
SAW +INC_IP
SAW INY ;+INC_IP
LDA (IP),Y
+INC_IP
STA TMP
PLA
STA (TMP)
+INC_IP
JMP NEXTOP
;*
;* STORE VALUE TO ABSOLUTE ADDRESS WITHOUT POPPING STACK
;*
!IF SELFMODIFY {
DAB +INC_IP
DAB INY ;+INC_IP
LDA (IP),Y
+INC_IP
STA DABSTX+1
LDA TOS,S
TAX
DABSTX STX $FFFF
+INC_IP
JMP NEXTOP
} ELSE {
DAB +INC_IP
DAB INY ;+INC_IP
LDA (IP),Y
+INC_IP
STA TMP
+ACCMEM8 ; 8 BIT A/M
LDA TOS,S
STA (TMP)
+ACCMEM16 ; 16 BIT A/M
+INC_IP
JMP NEXTOP
}
DAW +INC_IP
DAW INY ;+INC_IP
LDA (IP),Y
+INC_IP
STA TMP
LDA TOS,S
STA (TMP)
+INC_IP
JMP NEXTOP
;*
;* COMPARES
@ -1249,18 +1245,20 @@ ISLT PLA
;*
BRTRU PLA
BNE BRNCH
NOBRNCH +INC_IP
NOBRNCH INY ;+INC_IP
+INC_IP
JMP NEXTOP
BRFLS PLA
BNE NOBRNCH
BRNCH LDA IP
+INC_IP
BRNCH TYA ; FLATTEN IP
CLC
ADC IP
INY ;+INC_IP
CLC ; ADD BRANCH OFFSET
ADC (IP),Y
STA IP
DEY
JMP NEXTOP
LDY #$01
JMP FETCHOP
BREQ PLA
CMP TOS,S
BEQ BRNCH
@ -1295,7 +1293,7 @@ IBRNCH PLA
;*
;* CALL INTO ABSOLUTE ADDRESS (NATIVE CODE)
;*
CALL +INC_IP
CALL INY ;+INC_IP
LDA (IP),Y
INY
BNE EMUSTK
@ -1411,7 +1409,7 @@ EMUSTK STA TMP
;*
;* CALL INTO ABSOLUTE ADDRESS (NATIVE CODE)
;*
CALLX +INC_IP
CALLX INY ;+INC_IP
LDA (IP),Y
INY
BNE EMUSTKX
@ -1575,12 +1573,12 @@ ENTER PEI (IFP) ; SAVE ON STACK FOR LEAVE
;*
;* LEAVE FUNCTION
;*
LEAVEX +INC_IP
LEAVEX INY ;+INC_IP
+ACCMEM8 ; 8 BIT A/M
LDA (IP),Y ; DEALLOCATE POOL + FRAME
STA ALTRDOFF
BRA +
LEAVE +INC_IP
LEAVE INY ;+INC_IP
+ACCMEM8 ; 8 BIT A/M
LDA (IP),Y ; DEALLOCATE POOL + FRAME
+ STA TMPL