Optimize for bytecode interp in AUX MEM

This commit is contained in:
David Schmenk 2014-05-23 13:37:28 -07:00
parent 8309669ad8
commit c105d61ca9
3 changed files with 54 additions and 18 deletions

View File

@ -110,10 +110,6 @@ LCRWEN = $C083
LCBNK2 = $00 LCBNK2 = $00
LCBNK1 = $08 LCBNK1 = $08
!SOURCE "plvm02zp.inc" !SOURCE "plvm02zp.inc"
;*
;* ASM VARIABLES
;*
ESP = $E8
end end
; ;
; CALL 6502 ROUTINE ; CALL 6502 ROUTINE

View File

@ -37,7 +37,6 @@ ALTRDON = $C003
ALTWROFF= $C004 ALTWROFF= $C004
ALTWRON = $C005 ALTWRON = $C005
!SOURCE "plvm02zp.inc" !SOURCE "plvm02zp.inc"
ESP = DST+2
;********************************************************** ;**********************************************************
;* ;*
;* INTERPRETER INSTRUCTION POINTER INCREMENT MACRO ;* INTERPRETER INSTRUCTION POINTER INCREMENT MACRO
@ -185,6 +184,8 @@ PAGE3 = *
JMP IINTRP JMP IINTRP
BIT LCRDEN+LCBNK2 ; $03DC - INDIRECT INTERPX ENTRY BIT LCRDEN+LCBNK2 ; $03DC - INDIRECT INTERPX ENTRY
JMP IINTRPX JMP IINTRPX
TMRVEC !WORD TMRRTS
TMRRTS RTS
} }
VMCORE = * VMCORE = *
!PSEUDOPC $D000 { !PSEUDOPC $D000 {
@ -310,6 +311,8 @@ IINTRPX BIT LCRWEN+LCBNK2 ; WRITE ENABLE LANGUAGE CARD
LDA (TMP),Y LDA (TMP),Y
STA IPL STA IPL
DEY DEY
SEI
STA ALTRDON
BEQ FETCHOPX BEQ FETCHOPX
;* ;*
;* INTERP BYTECODE IN AUX MEM ;* INTERP BYTECODE IN AUX MEM
@ -319,11 +322,17 @@ NEXTOPHX INC IPH
DROPX INX DROPX INX
NEXTOPX INY NEXTOPX INY
BEQ NEXTOPHX BEQ NEXTOPHX
FETCHOPX SEI ; INC TICTOC
STA ALTRDON ; BEQ TIMERX
LDA (IP),Y FETCHOPX LDA (IP),Y
STA *+4 STA *+4
JMP (OPXTBL) JMP (OPXTBL) ; USE AUX OPCODES
TIMERX STA ALTRDOFF
CLI
JSR JMPTMR
SEI
STA ALTRDON
JMP FETCHOPX
;* ;*
;* INTERP BYTECODE IN MAIN MEM ;* INTERP BYTECODE IN MAIN MEM
;* ;*
@ -332,10 +341,18 @@ NEXTOPH INC IPH
DROP INX DROP INX
NEXTOP INY NEXTOP INY
BEQ NEXTOPH BEQ NEXTOPH
; INC TICTOC
; BEQ TIMER
FETCHOP LDA (IP),Y FETCHOP LDA (IP),Y
ORA #$80 ; SELECT OP OPCODES ORA #$80 ; USE MAIN OPCODES
STA *+4 STA *+4
JMP (OPTBL) JMP (OPTBL)
TIMER JSR JMPTMR
JMP FETCHOP
;*
;* INDIRECT JUMP TO (TMRVEC)
;*
JMPTMR JMP (TMRVEC)
;* ;*
;* INDIRECT JUMP TO (TMP) ;* INDIRECT JUMP TO (TMP)
;* ;*
@ -980,31 +997,33 @@ LW LDA ESTKL,X
LDY IPY LDY IPY
JMP NEXTOP JMP NEXTOP
; ;
LBX STA ALTRDOFF LBX LDA ESTKL,X
LDA ESTKL,X
STA TMPL STA TMPL
LDA ESTKH,X LDA ESTKH,X
STA TMPH STA TMPH
STY IPY STY IPY
STA ALTRDOFF
LDY #$00 LDY #$00
LDA (TMP),Y LDA (TMP),Y
STA ESTKL,X STA ESTKL,X
STY ESTKH,X STY ESTKH,X
LDY IPY LDY IPY
STA ALTRDON
JMP NEXTOPX JMP NEXTOPX
LWX STA ALTRDOFF LWX LDA ESTKL,X
LDA ESTKL,X
STA TMPL STA TMPL
LDA ESTKH,X LDA ESTKH,X
STA TMPH STA TMPH
STY IPY STY IPY
LDY #$00 STA ALTRDOFF
LDY #$00
LDA (TMP),Y LDA (TMP),Y
STA ESTKL,X STA ESTKL,X
INY INY
LDA (TMP),Y LDA (TMP),Y
STA ESTKH,X STA ESTKH,X
LDY IPY LDY IPY
STA ALTRDON
JMP NEXTOPX JMP NEXTOPX
;* ;*
;* LOAD ADDRESS OF LOCAL FRAME OFFSET ;* LOAD ADDRESS OF LOCAL FRAME OFFSET
@ -1067,6 +1086,7 @@ LLBX +INC_IP
STA ESTKL,X STA ESTKL,X
LDA #$00 LDA #$00
STA ESTKH,X STA ESTKH,X
STA ALTRDON
LDY IPY LDY IPY
JMP NEXTOPX JMP NEXTOPX
LLWX +INC_IP LLWX +INC_IP
@ -1080,6 +1100,7 @@ LLWX +INC_IP
INY INY
LDA (IFP),Y LDA (IFP),Y
STA ESTKH,X STA ESTKH,X
STA ALTRDON
LDY IPY LDY IPY
JMP NEXTOPX JMP NEXTOPX
;* ;*
@ -1129,6 +1150,7 @@ LABX +INC_IP
DEX DEX
STA ESTKL,X STA ESTKL,X
STY ESTKH,X STY ESTKH,X
STA ALTRDON
LDY IPY LDY IPY
JMP NEXTOPX JMP NEXTOPX
LAWX +INC_IP LAWX +INC_IP
@ -1146,6 +1168,7 @@ LAWX +INC_IP
INY INY
LDA (TMP),Y LDA (TMP),Y
STA ESTKH,X STA ESTKH,X
STA ALTRDON
LDY IPY LDY IPY
JMP NEXTOPX JMP NEXTOPX
;* ;*
@ -1188,6 +1211,7 @@ SBX LDA ESTKL+1,X
STA ALTRDOFF STA ALTRDOFF
LDY #$00 LDY #$00
STA (TMP),Y STA (TMP),Y
STA ALTRDON
INX INX
INX INX
LDY IPY LDY IPY
@ -1204,6 +1228,7 @@ SWX LDA ESTKL+1,X
INY INY
LDA ESTKH,X LDA ESTKH,X
STA (TMP),Y STA (TMP),Y
STA ALTRDON
INX INX
INX INX
LDY IPY LDY IPY
@ -1240,6 +1265,7 @@ SLBX +INC_IP
TAY TAY
LDA ESTKL,X LDA ESTKL,X
STA (IFP),Y STA (IFP),Y
STA ALTRDON
INX INX
LDY IPY LDY IPY
JMP NEXTOPX JMP NEXTOPX
@ -1253,6 +1279,7 @@ SLWX +INC_IP
INY INY
LDA ESTKH,X LDA ESTKH,X
STA (IFP),Y STA (IFP),Y
STA ALTRDON
INX INX
LDY IPY LDY IPY
JMP NEXTOPX JMP NEXTOPX
@ -1286,6 +1313,7 @@ DLBX +INC_IP
TAY TAY
LDA ESTKL,X LDA ESTKL,X
STA (IFP),Y STA (IFP),Y
STA ALTRDON
LDY IPY LDY IPY
JMP NEXTOPX JMP NEXTOPX
DLWX +INC_IP DLWX +INC_IP
@ -1298,6 +1326,7 @@ DLWX +INC_IP
INY INY
LDA ESTKH,X LDA ESTKH,X
STA (IFP),Y STA (IFP),Y
STA ALTRDON
LDY IPY LDY IPY
JMP NEXTOPX JMP NEXTOPX
;* ;*
@ -1344,6 +1373,7 @@ SABX +INC_IP
STA ALTRDOFF STA ALTRDOFF
LDY #$00 LDY #$00
STA (TMP),Y STA (TMP),Y
STA ALTRDON
INX INX
LDY IPY LDY IPY
JMP NEXTOPX JMP NEXTOPX
@ -1361,6 +1391,7 @@ SAWX +INC_IP
INY INY
LDA ESTKH,X LDA ESTKH,X
STA (TMP),Y STA (TMP),Y
STA ALTRDON
INX INX
LDY IPY LDY IPY
JMP NEXTOPX JMP NEXTOPX
@ -1406,6 +1437,7 @@ DABX +INC_IP
LDY #$00 LDY #$00
LDA ESTKL,X LDA ESTKL,X
STA (TMP),Y STA (TMP),Y
STA ALTRDON
LDY IPY LDY IPY
JMP NEXTOPX JMP NEXTOPX
DAWX +INC_IP DAWX +INC_IP
@ -1422,6 +1454,7 @@ DAWX +INC_IP
INY INY
LDA ESTKH,X LDA ESTKH,X
STA (TMP),Y STA (TMP),Y
STA ALTRDON
LDY IPY LDY IPY
JMP NEXTOPX JMP NEXTOPX
;* ;*
@ -1791,6 +1824,8 @@ CALLX +INC_IP
STA ALTRDOFF STA ALTRDOFF
CLI CLI
JSR JMPTMP JSR JMPTMP
SEI
STA ALTRDON
PLA PLA
TAY TAY
PLA PLA
@ -1839,6 +1874,8 @@ ICALX LDA ESTKL,X
STA ALTRDOFF STA ALTRDOFF
CLI CLI
JSR JMPTMP JSR JMPTMP
SEI
STA ALTRDON
PLA PLA
TAY TAY
PLA PLA
@ -1897,6 +1934,7 @@ ENTERX +INC_IP
LDA (IP),Y LDA (IP),Y
STA NPARMS STA NPARMS
STY IPY STY IPY
STA ALTRDOFF
LDA IFPL LDA IFPL
PHA PHA
SEC SEC
@ -1906,7 +1944,6 @@ ENTERX +INC_IP
PHA PHA
SBC #$00 SBC #$00
STA IFPH STA IFPH
STA ALTRDOFF
LDY #$01 LDY #$01
PLA PLA
STA (IFP),Y STA (IFP),Y
@ -1927,7 +1964,8 @@ ENTERX4 LDA ESTKH,X
INX INX
DEC TMPL DEC TMPL
BNE ENTERX4 BNE ENTERX4
ENTERX5 LDY IPY ENTERX5 STA ALTRDON
LDY IPY
JMP NEXTOPX JMP NEXTOPX
;* ;*
;* LEAVE FUNCTION ;* LEAVE FUNCTION
@ -1943,6 +1981,7 @@ LEAVE LDY #$01
RET RTS RET RTS
; ;
LEAVEX STA ALTRDOFF LEAVEX STA ALTRDOFF
CLI
LDY #$01 LDY #$01
LDA (IFP),Y LDA (IFP),Y
DEY DEY
@ -1951,7 +1990,6 @@ LEAVEX STA ALTRDOFF
STA IFPL STA IFPL
PLA PLA
STA IFPH STA IFPH
CLI
RTS RTS
RETX STA ALTRDOFF RETX STA ALTRDOFF
CLI CLI

View File

@ -22,6 +22,8 @@ TMPX = TMP+2
NPARMS = TMPL NPARMS = TMPL
FRMSZ = TMPH FRMSZ = TMPH
DVSIGN = TMPX DVSIGN = TMPX
ESP = TMPX
TICTOC = TMP+3
SRC = $06 SRC = $06
SRCL = SRC SRCL = SRC
SRCH = SRC+1 SRCH = SRC+1