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

Move inter inner loop to page 0 for all VMs, use common zp include file

This commit is contained in:
David Schmenk 2014-06-15 23:54:47 -07:00
parent e296d7a7ec
commit fd0f767059
6 changed files with 76 additions and 109 deletions

View File

@ -54,7 +54,7 @@ word hcolor[] = $0000,$552A,$2A55,$7F7F,$8080,$D5AA,$AAD5,$FFFF
; def draw_scan(d8p8, scanptr)
;
asm draw_scan
!SOURCE "vmsrc/plvm02zp.inc"
!SOURCE "vmsrc/plvmzp.inc"
WFIXL = $80
WFIXH = $81
WINT = $82

View File

@ -5,7 +5,7 @@ ROMEN = $C082
LCRWEN = $C083
LCBNK2 = $00
LCBNK1 = $08
!SOURCE "vmsrc/plvm02zp.inc"
!SOURCE "vmsrc/plvmzp.inc"
;*
;* MOVE CMD DOWN TO $1000-$2000
;*

View File

@ -8,31 +8,7 @@
;*
;* VM ZERO PAGE LOCATIONS
;*
ESTKSZ = $20
ESTK = $C0
ESTKL = ESTK
ESTKH = ESTK+ESTKSZ/2
VMZP = ESTK+ESTKSZ
IFP = VMZP
IFPL = IFP
IFPH = IFP+1
IP = IFP+2
IPL = IP
IPH = IP+1
IPY = IP+2
TMP = IP+3
TMPL = TMP
TMPH = TMP+1
NPARMS = TMPL
FRMSZ = TMPH
DVSIGN = TMP+2
ESP = TMP+2
SRC = $06
SRCL = SRC
SRCH = SRC+1
DST = SRC+2
DSTL = DST
DSTH = DST+1
!SOURCE "vmsrc/plvmzp.inc"
;*
;* INTERPRETER INSTRUCTION POINTER INCREMENT MACRO
;*
@ -45,16 +21,7 @@ DSTH = DST+1
;* INTERPRETER HEADER+INITIALIZATION
;*
*= $0280
SEGBEGIN LDA #$00 ; INIT FRAME POINTER
STA IFPL
LDA #$80
STA IFPH
LDA #<SEGEND ; SAVE HEAP START
STA SRCL
LDA #>SEGEND
STA SRCH
LDX #ESTKSZ/2 ; INIT EVAL STACK INDEX
JMP A1CMD
SEGBEGIN JMP VMINIT
;*
;* SYSTEM INTERPRETER ENTRYPOINT
;*
@ -63,7 +30,7 @@ INTERP PLA
PLA
STA IPH
LDY #$01
BNE FETCHOP
JMP FETCHOP
;*
;* ENTER INTO USER BYTECODE INTERPRETER
;*
@ -78,18 +45,7 @@ IINTERP PLA
LDA (TMP),Y
STA IPL
DEY
BEQ FETCHOP
;*
;* INTERP BYTECODE
;*
NEXTOPH INC IPH
BNE FETCHOP
DROP INX
NEXTOP INY
BEQ NEXTOPH
FETCHOP LDA (IP),Y
STA *+4
JMP (OPTBL)
JMP FETCHOP
;*
;* MUL TOS-1 BY TOS
;*
@ -228,7 +184,7 @@ ADD LDA ESTKL,X
LDA ESTKH,X
ADC ESTKH+1,X
STA ESTKH+1,X
INX
DROP INX
JMP NEXTOP
;*
;* SUB TOS FROM TOS-1
@ -967,3 +923,31 @@ LEAVE LDY #$01
RET RTS
A1CMD !SOURCE "vmsrc/a1cmd.a"
SEGEND = *
VMINIT LDY #$0D ; INSTALL PAGE 0 FETCHOP ROUTINE
- LDA PAGE0,Y
STA NEXTOP,Y
DEY
BPL -
LDA #$00 ; INIT FRAME POINTER
STA IFPL
LDA #$80
STA IFPH
LDA #<SEGEND ; SAVE HEAP START
STA SRCL
LDA #>SEGEND
STA SRCH
LDX #ESTKSZ/2 ; INIT EVAL STACK INDEX
JMP A1CMD
PAGE0 = *
!PSEUDOPC $00F0 {
;*
;* INTERP BYTECODE INNER LOOP
;*
INY
BEQ NEXTOPH
FETCHOP LDA (IP),Y
STA OPIDX
JMP (OPTBL)
NEXTOPH INC IPH
BNE FETCHOP
}

View File

@ -38,10 +38,7 @@ ALTRDOFF= $C002
ALTRDON = $C003
ALTWROFF= $C004
ALTWRON = $C005
!SOURCE "vmsrc/plvm02zp.inc"
NEXTOP = $F0
OPIDX = NEXTOP+8
OPPAGE = OPIDX+1
!SOURCE "vmsrc/plvmzp.inc"
STRBUF = $0280
INTERP = $03D0
;*

View File

@ -9,39 +9,16 @@
; HARDWARE REGISTERS
;
MEMBANK = $FFEF
!SOURCE "vmsrc/plvmzp.inc"
;
; XPAGE ADDRESSES
;
XPAGE = $1600
;*
;* VM ZERO PAGE LOCATIONS
;*
ESTKSZ = $20
ESTK = $C0
ESTKL = ESTK
ESTKH = ESTK+ESTKSZ/2
VMZP = ESTK+ESTKSZ
IFP = VMZP
IFPL = IFP
IFPH = IFP+1
NEXTOPX = XPAGE+NEXTOP
IFPX = XPAGE+IFPH
IP = IFP+2
IPL = IP
IPH = IP+1
IPX = XPAGE+IPH
IPY = IP+2
TMP = IP+3
TMPL = TMP
TMPH = TMP+1
TMPX = XPAGE+TMPH
NPARMS = TMPL
FRMSZ = TMPH
DVSIGN = TMP+2
ESP = TMP+2
SRC = $06
SRCL = SRC
SRCH = SRC+1
SRCX = XPAGE+SRCH
DST = SRC+2
DSTL = DST
DSTH = DST+1
DSTX = XPAGE+DSTH
;*
;* SOS
@ -73,8 +50,14 @@ DSTX = XPAGE+DSTH
BNE PRHEX
LDA #$01
STA MEMBANK
LDA #$00 ; CLEAR ALL EXTENDED POINTERS
STA TMPX
LDY #$0D ; INSTALL PAGE 0 FETCHOP ROUTINE
LDA #$00
- LDX PAGE0,Y
STX NEXTOP,Y
STA NEXTOPX,Y
DEY
BPL -
STA TMPX ; CLEAR ALL EXTENDED POINTERS
STA SRCX
STA DSTX
STA IFPX ; INIT FRAME POINTER
@ -89,6 +72,19 @@ SEGREQ !BYTE 4
!WORD $9F01
!BYTE $10
!BYTE $00
PAGE0 = *
!PSEUDOPC $00F0 {
;*
;* INTERP BYTECODE INNER LOOP
;*
INY
BEQ NEXTOPH
FETCHOP LDA (IP),Y
STA OPIDX
JMP (OPTBL)
NEXTOPH INC IPH
BNE FETCHOP
}
PRHEX PHA
LSR
LSR
@ -118,7 +114,7 @@ INTERP LDY #$00
PLA
STA IPH
INY
BNE FETCHOP
JMP FETCHOP
;*
;* ENTER INTO USER BYTECODE INTERPRETER
;*
@ -136,18 +132,7 @@ XINTERP PLA
LDA (TMP),Y
STA IPL
DEY
BEQ FETCHOP
;*
;* INTERP BYTECODE
;*
NEXTOPH INC IPH
BNE FETCHOP
DROP INX
NEXTOP INY
BEQ NEXTOPH
FETCHOP LDA (IP),Y
STA *+4
JMP (OPTBL)
JMP FETCHOP
;*
;* INTERNAL DIVIDE ALGORITHM
;*
@ -286,7 +271,7 @@ ADD LDA ESTKL,X
LDA ESTKH,X
ADC ESTKH+1,X
STA ESTKH+1,X
INX
DROP INX
JMP NEXTOP
;*
;* SUB TOS FROM TOS-1

View File

@ -3,6 +3,12 @@
;* VM ZERO PAGE LOCATIONS
;*
;**********************************************************
SRC = $06
SRCL = SRC
SRCH = SRC+1
DST = SRC+2
DSTL = DST
DSTH = DST+1
ESTKSZ = $20
ESTK = $C0
ESTKL = ESTK
@ -18,15 +24,10 @@ IPY = IP+2
TMP = IP+3
TMPL = TMP
TMPH = TMP+1
TMPX = TMP+2
NPARMS = TMPL
FRMSZ = TMPH
DVSIGN = TMPX
ESP = TMPX
TICTOC = TMP+3
SRC = $06
SRCL = SRC
SRCH = SRC+1
DST = SRC+2
DSTL = DST
DSTH = DST+1
DVSIGN = TMP+2
ESP = TMP+2
NEXTOP = $F0
OPIDX = NEXTOP+8
OPPAGE = OPIDX+1