mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-08-09 16:25:01 +00:00
Looking for one more JITC bug
This commit is contained in:
@@ -109,7 +109,7 @@ def compiler(defptr)#0
|
|||||||
//
|
//
|
||||||
is $50 // BRNCH
|
is $50 // BRNCH
|
||||||
is $22 // BREQ
|
is $22 // BREQ
|
||||||
is $24 // BENE
|
is $24 // BRNE
|
||||||
is $4C // BRFLS
|
is $4C // BRFLS
|
||||||
is $4E // BRTRU
|
is $4E // BRTRU
|
||||||
is $A0 // BRGT
|
is $A0 // BRGT
|
||||||
@@ -293,6 +293,7 @@ def compiler(defptr)#0
|
|||||||
is $2C // CW
|
is $2C // CW
|
||||||
i++
|
i++
|
||||||
dest = *(bytecode+i)
|
dest = *(bytecode+i)
|
||||||
|
i++
|
||||||
//puts("LA/CW $"); puth(dest)
|
//puts("LA/CW $"); puth(dest)
|
||||||
if A_IS_TOSL & TOS_DIRTY
|
if A_IS_TOSL & TOS_DIRTY
|
||||||
*codeptr = $D095+(VX<<8) // STA ESTKL,X
|
*codeptr = $D095+(VX<<8) // STA ESTKL,X
|
||||||
@@ -304,7 +305,6 @@ def compiler(defptr)#0
|
|||||||
codeptr=>4 = $A9+(dest<<8) // LDA #>VAL
|
codeptr=>4 = $A9+(dest<<8) // LDA #>VAL
|
||||||
codeptr = codeptr + 6
|
codeptr = codeptr + 6
|
||||||
A_IS_TOSL = TOS_DIRTY // STA ESTKL,X
|
A_IS_TOSL = TOS_DIRTY // STA ESTKL,X
|
||||||
i++
|
|
||||||
break
|
break
|
||||||
is $28 // LLA
|
is $28 // LLA
|
||||||
i++
|
i++
|
||||||
@@ -420,7 +420,7 @@ def compiler(defptr)#0
|
|||||||
i++
|
i++
|
||||||
j = ^(bytecode+i)
|
j = ^(bytecode+i)
|
||||||
//puts("ADDI $"); putb(^(bytecode+i))
|
//puts("ADDI $"); putb(^(bytecode+i))
|
||||||
is $8C // INCR
|
is $8C // INCR
|
||||||
if opcode == $8C
|
if opcode == $8C
|
||||||
//puts("INCR")
|
//puts("INCR")
|
||||||
j = 1
|
j = 1
|
||||||
@@ -778,17 +778,16 @@ def compiler(defptr)#0
|
|||||||
if VY <> j
|
if VY <> j
|
||||||
*codeptr = $A0+(j<<8) // LDY #imm
|
*codeptr = $A0+(j<<8) // LDY #imm
|
||||||
codeptr = codeptr + 2
|
codeptr = codeptr + 2
|
||||||
VY = j
|
|
||||||
fin
|
fin
|
||||||
*codeptr = $E0B1 // LDA (IFP),Y
|
*codeptr = $E0B1 // LDA (IFP),Y
|
||||||
codeptr = codeptr + 2
|
codeptr = codeptr + 2
|
||||||
if VY
|
if j <> 0
|
||||||
*codeptr = $00A0 // LDY #$00
|
*codeptr = $00A0 // LDY #$00
|
||||||
codeptr = codeptr + 2
|
codeptr = codeptr + 2
|
||||||
VY = 0
|
|
||||||
fin
|
fin
|
||||||
*codeptr = $C094+(VX<<8) // STY ESTKH,X
|
*codeptr = $C094+(VX<<8) // STY ESTKH,X
|
||||||
codeptr = codeptr + 2
|
codeptr = codeptr + 2
|
||||||
|
VY = 0
|
||||||
A_IS_TOSL = TOS_DIRTY // STA ESTKL,X
|
A_IS_TOSL = TOS_DIRTY // STA ESTKL,X
|
||||||
break
|
break
|
||||||
is $66 // LLW
|
is $66 // LLW
|
||||||
@@ -820,60 +819,36 @@ def compiler(defptr)#0
|
|||||||
dest = *(bytecode+i)
|
dest = *(bytecode+i)
|
||||||
i++
|
i++
|
||||||
if A_IS_TOSL & TOS_DIRTY
|
if A_IS_TOSL & TOS_DIRTY
|
||||||
*codeptr = $D095+(VX<<8) // STA ESTKL,X
|
*codeptr = $D095+(VX<<8) // STA ESTKL,X
|
||||||
codeptr = codeptr + 2
|
codeptr = codeptr + 2
|
||||||
fin
|
fin
|
||||||
VX-- // DEX
|
VX-- // DEX
|
||||||
if opcode == $68
|
if opcode == $68
|
||||||
//puts("LAB $"); puth(*(bytecode+i))
|
//puts("LAB $"); puth(*(bytecode+i))
|
||||||
if VY <> 0
|
if VY <> 0
|
||||||
*codeptr = $00A0 // LDY #$00
|
*codeptr = $00A0 // LDY #$00
|
||||||
codeptr = codeptr + 2
|
codeptr = codeptr + 2
|
||||||
VY = 0
|
VY = 0
|
||||||
fin
|
fin
|
||||||
codeptr=>0 = $C094+(VX<<8) // STY ESTKH,X
|
*codeptr = $C094+(VX<<8) // STY ESTKH,X
|
||||||
codeptr = codeptr + 2
|
codeptr = codeptr + 2
|
||||||
else
|
else
|
||||||
//puts("LAW $"); puth(dest)
|
//puts("LAW $"); puth(dest)
|
||||||
codeptr->0 = $AD // LDA abs
|
codeptr->0 = $AD // LDA abs
|
||||||
codeptr=>1 = dest+1
|
codeptr=>1 = dest+1
|
||||||
codeptr=>3 = $C095+(VX<<8) // STA ESTKH,X
|
codeptr=>3 = $C095+(VX<<8) // STA ESTKH,X
|
||||||
codeptr = codeptr + 5
|
codeptr = codeptr + 5
|
||||||
fin
|
fin
|
||||||
codeptr->0 = $AD // LDA abs
|
codeptr->0 = $AD // LDA abs
|
||||||
codeptr=>1 = dest
|
codeptr=>1 = dest
|
||||||
codeptr = codeptr + 3
|
codeptr = codeptr + 3
|
||||||
A_IS_TOSL = TOS_DIRTY // STA ESTKL,X
|
A_IS_TOSL = TOS_DIRTY // STA ESTKL,X
|
||||||
break
|
|
||||||
is $70 // SB
|
|
||||||
is $72 // SW
|
|
||||||
if not A_IS_TOSL
|
|
||||||
*codeptr = $D0B5+(VX<<8) // LDA ESTKL,X
|
|
||||||
codeptr = codeptr + 2
|
|
||||||
fin
|
|
||||||
codeptr=>0 = $C095-$0100+(VX<<8) // STA ESTKH-1,X
|
|
||||||
codeptr=>2 = $D0B5+$0100+(VX<<8) // LDA ESTKL+1,X
|
|
||||||
codeptr=>4 = $C081-$0100+(VX<<8) // STA (ESTKH-1,X)
|
|
||||||
if opcode == $70
|
|
||||||
//puts("SB")
|
|
||||||
codeptr = codeptr + 6
|
|
||||||
else
|
|
||||||
//puts("SW")
|
|
||||||
codeptr=>6 = $C0B5+$0100+(VX<<8) // LDA ESTKH+1,X
|
|
||||||
codeptr=>8 = $C0F6-$0100+(VX<<8) // INC ESTKH-1,X
|
|
||||||
codeptr=>10 = $02D0 // BNE +2
|
|
||||||
codeptr=>12 = $C0F6+(VX<<8) // INC ESTKH,X
|
|
||||||
codeptr=>14 = $C081-$0100+(VX<<8) // STA (ESTKH-1,X)
|
|
||||||
codeptr = codeptr + 16
|
|
||||||
fin
|
|
||||||
VX = VX + 2 // INX; INX
|
|
||||||
A_IS_TOSL = FALSE
|
|
||||||
break
|
break
|
||||||
is $6C // DLB
|
is $6C // DLB
|
||||||
is $74 // SLB
|
|
||||||
i++
|
i++
|
||||||
j = ^(bytecode+i)
|
j = ^(bytecode+i)
|
||||||
if not A_IS_TOSL
|
//puts("DLB "); puti(j)
|
||||||
|
if not A_IS_TOSL
|
||||||
*codeptr = $D0B5+(VX<<8) // LDA ESTKL,X
|
*codeptr = $D0B5+(VX<<8) // LDA ESTKL,X
|
||||||
codeptr = codeptr + 2
|
codeptr = codeptr + 2
|
||||||
A_IS_TOSL = TOS_CLEAN
|
A_IS_TOSL = TOS_CLEAN
|
||||||
@@ -883,36 +858,8 @@ def compiler(defptr)#0
|
|||||||
codeptr = codeptr + 2
|
codeptr = codeptr + 2
|
||||||
VY = j
|
VY = j
|
||||||
fin
|
fin
|
||||||
*codeptr = $E091 // STA (IFP),Y
|
*codeptr = $E091 // STA (IFP),Y
|
||||||
codeptr = codeptr + 2
|
codeptr = codeptr + 2
|
||||||
if opcode == $74
|
|
||||||
//puts("SLB "); puti(j)
|
|
||||||
VX++ // INX
|
|
||||||
A_IS_TOSL = FALSE
|
|
||||||
//else
|
|
||||||
//puts("DLB "); puti(j)
|
|
||||||
fin
|
|
||||||
break
|
|
||||||
is $76 // SLW
|
|
||||||
i++
|
|
||||||
j = ^(bytecode+i)
|
|
||||||
//puts("SLW "); puti(j)
|
|
||||||
if not A_IS_TOSL
|
|
||||||
*codeptr = $D0B5+(VX<<8) // LDA ESTKL,X
|
|
||||||
codeptr = codeptr + 2
|
|
||||||
fin
|
|
||||||
if VY <> j
|
|
||||||
*codeptr = $A0+(j<<8) // LDY #imm
|
|
||||||
codeptr = codeptr + 2
|
|
||||||
fin
|
|
||||||
codeptr=>0 = $E091 // STA (IFP),Y
|
|
||||||
codeptr->2 = $C8 // INY
|
|
||||||
codeptr=>3 = $C0B5+(VX<<8) // LDA ESTKH,X
|
|
||||||
codeptr=>5 = $E091 // STA (IFP),Y
|
|
||||||
codeptr = codeptr + 7
|
|
||||||
VX++ // INX
|
|
||||||
VY = j + 1
|
|
||||||
A_IS_TOSL = FALSE
|
|
||||||
break
|
break
|
||||||
is $6E // DLW
|
is $6E // DLW
|
||||||
i++
|
i++
|
||||||
@@ -937,61 +884,105 @@ def compiler(defptr)#0
|
|||||||
codeptr = codeptr + 9
|
codeptr = codeptr + 9
|
||||||
A_IS_TOSL = TOS_CLEAN
|
A_IS_TOSL = TOS_CLEAN
|
||||||
break
|
break
|
||||||
is $78 // SAB
|
is $70 // SB
|
||||||
is $7C // DAB
|
is $72 // SW
|
||||||
i++
|
|
||||||
if not A_IS_TOSL
|
if not A_IS_TOSL
|
||||||
*codeptr = $D0B5+(VX<<8) // LDA ESTKL,X
|
*codeptr = $D0B5+(VX<<8) // LDA ESTKL,X
|
||||||
codeptr = codeptr + 2
|
codeptr = codeptr + 2
|
||||||
A_IS_TOSL = TOS_CLEAN
|
|
||||||
fin
|
fin
|
||||||
codeptr->0 = $8D // STA abs
|
codeptr=>0 = $C095-$0100+(VX<<8) // STA ESTKH-1,X
|
||||||
codeptr=>1 = *(bytecode+i)
|
codeptr=>2 = $D0B5+$0100+(VX<<8) // LDA ESTKL+1,X
|
||||||
codeptr = codeptr + 3
|
codeptr=>4 = $C081-$0100+(VX<<8) // STA (ESTKH-1,X)
|
||||||
if opcode == $78
|
if opcode == $70
|
||||||
//puts("SAB $"); puth(*(bytecode+i))
|
//puts("SB")
|
||||||
VX++ // INX
|
codeptr = codeptr + 6
|
||||||
A_IS_TOSL = FALSE
|
else
|
||||||
//else
|
//puts("SW")
|
||||||
//puts("DAB $"); puth(*(bytecode+i))
|
codeptr=>6 = $C0B5+$0100+(VX<<8) // LDA ESTKH+1,X
|
||||||
|
codeptr=>8 = $C0F6-$0100+(VX<<8) // INC ESTKH-1,X
|
||||||
|
codeptr=>10 = $02D0 // BNE +2
|
||||||
|
codeptr=>12 = $C0F6+(VX<<8) // INC ESTKH,X
|
||||||
|
codeptr=>14 = $C081-$0100+(VX<<8) // STA (ESTKH-1,X)
|
||||||
|
codeptr = codeptr + 16
|
||||||
fin
|
fin
|
||||||
i++
|
VX = VX + 2 // INX; INX
|
||||||
|
A_IS_TOSL = FALSE
|
||||||
break
|
break
|
||||||
|
is $74 // SLB
|
||||||
|
is $76 // SLW
|
||||||
|
i++
|
||||||
|
j = ^(bytecode+i)
|
||||||
|
if not A_IS_TOSL
|
||||||
|
*codeptr = $D0B5+(VX<<8) // LDA ESTKL,X
|
||||||
|
codeptr = codeptr + 2
|
||||||
|
fin
|
||||||
|
if VY <> j
|
||||||
|
*codeptr = $A0+(j<<8) // LDY #imm
|
||||||
|
codeptr = codeptr + 2
|
||||||
|
VY = j
|
||||||
|
fin
|
||||||
|
codeptr=>0 = $E091 // STA (IFP),Y
|
||||||
|
if opcode == $74
|
||||||
|
//puts("SLB "); puti(j)
|
||||||
|
codeptr = codeptr + 2
|
||||||
|
else
|
||||||
|
//puts("SLW "); puti(j)
|
||||||
|
codeptr->2 = $C8 // INY
|
||||||
|
codeptr=>3 = $C0B5+(VX<<8) // LDA ESTKH,X
|
||||||
|
codeptr=>5 = $E091 // STA (IFP),Y
|
||||||
|
codeptr = codeptr + 7
|
||||||
|
VY++
|
||||||
|
fin
|
||||||
|
VX++ // INX
|
||||||
|
A_IS_TOSL = FALSE
|
||||||
|
break
|
||||||
|
is $78 // SAB
|
||||||
is $7A // SAW
|
is $7A // SAW
|
||||||
i++
|
i++
|
||||||
dest = *(bytecode+i)
|
dest = *(bytecode+i)
|
||||||
|
i++
|
||||||
//puts("SAW $"); puth(dest)
|
//puts("SAW $"); puth(dest)
|
||||||
if not A_IS_TOSL
|
if not A_IS_TOSL
|
||||||
*codeptr = $D0B5+(VX<<8) // LDA ESTKL,X
|
*codeptr = $D0B5+(VX<<8) // LDA ESTKL,X
|
||||||
codeptr = codeptr + 2
|
codeptr = codeptr + 2
|
||||||
fin
|
fin
|
||||||
codeptr->0 = $8D // STA abs
|
codeptr->0 = $8D // STA abs
|
||||||
codeptr=>1 = dest
|
codeptr=>1 = dest
|
||||||
codeptr=>3 = $C0B5+(VX<<8) // LDA ESTKH,X
|
if opcode == $78
|
||||||
codeptr->5 = $8D // STA abs+1
|
//puts("SAB $"); puth(*(bytecode+i))
|
||||||
codeptr=>6 = dest+1
|
codeptr = codeptr + 3
|
||||||
codeptr = codeptr + 8
|
else
|
||||||
VX++ // INX
|
codeptr=>3 = $C0B5+(VX<<8) // LDA ESTKH,X
|
||||||
A_IS_TOSL = FALSE
|
codeptr->5 = $8D // STA abs+1
|
||||||
i++
|
codeptr=>6 = dest+1
|
||||||
|
codeptr = codeptr + 8
|
||||||
|
fin
|
||||||
|
VX++ // INX
|
||||||
|
A_IS_TOSL = FALSE
|
||||||
break
|
break
|
||||||
|
is $7C // DAB
|
||||||
is $7E // DAW
|
is $7E // DAW
|
||||||
i++
|
i++
|
||||||
dest = *(bytecode+i)
|
dest = *(bytecode+i)
|
||||||
|
i++
|
||||||
//puts("DAW $"); puth(*(bytecode+i))
|
//puts("DAW $"); puth(*(bytecode+i))
|
||||||
if not A_IS_TOSL
|
if not A_IS_TOSL
|
||||||
*codeptr = $D0B5+(VX<<8) // LDA ESTKL,X
|
*codeptr = $D0B5+(VX<<8) // LDA ESTKL,X
|
||||||
codeptr = codeptr + 2
|
codeptr = codeptr + 2
|
||||||
A_IS_TOSL = TOS_CLEAN
|
A_IS_TOSL = TOS_CLEAN
|
||||||
fin
|
fin
|
||||||
codeptr->0 = $8D // STA abs
|
codeptr->0 = $8D // STA abs
|
||||||
codeptr=>1 = dest
|
codeptr=>1 = dest
|
||||||
codeptr=>3 = $C0B4+(VX<<8) // LDY ESTKH,X
|
if opcode == $7C
|
||||||
codeptr->5 = $8C // STY abs+1
|
//puts("DAB $"); puth(*(bytecode+i))
|
||||||
codeptr=>6 = dest+1
|
codeptr = codeptr + 3
|
||||||
codeptr = codeptr + 8
|
else
|
||||||
VY = UNKNOWN
|
codeptr=>3 = $C0B4+(VX<<8) // LDY ESTKH,X
|
||||||
i++
|
codeptr->5 = $8C // STY abs+1
|
||||||
|
codeptr=>6 = dest+1
|
||||||
|
codeptr = codeptr + 8
|
||||||
|
VY = UNKNOWN
|
||||||
|
fin
|
||||||
break
|
break
|
||||||
is $80 // NOT
|
is $80 // NOT
|
||||||
//puts("NOT")
|
//puts("NOT")
|
||||||
@@ -1067,7 +1058,7 @@ def compiler(defptr)#0
|
|||||||
codeptr = codeptr + 2
|
codeptr = codeptr + 2
|
||||||
fin
|
fin
|
||||||
codeptr->0 = $20 // JSR INTERP
|
codeptr->0 = $20 // JSR INTERP
|
||||||
codeptr=>1 = directentry // INTERP
|
codeptr=>1 = directentry // INTERP
|
||||||
codeptr=>3 = $C000+opcode // OPCODE; NATV CODE
|
codeptr=>3 = $C000+opcode // OPCODE; NATV CODE
|
||||||
codeptr = codeptr + 5
|
codeptr = codeptr + 5
|
||||||
VY = UNKNOWN
|
VY = UNKNOWN
|
||||||
@@ -1159,8 +1150,8 @@ def compiler(defptr)#0
|
|||||||
is $A0 // BRGT - FOR/NEXT SPECIFIC TEST & BRANCH
|
is $A0 // BRGT - FOR/NEXT SPECIFIC TEST & BRANCH
|
||||||
i++
|
i++
|
||||||
dest = i + *(bytecode+i)
|
dest = i + *(bytecode+i)
|
||||||
//puts("BRGT "); puti(dest)
|
|
||||||
i++
|
i++
|
||||||
|
//puts("BRGT "); puti(dest)
|
||||||
codeptr, VX = resolveX(codeptr, VX)
|
codeptr, VX = resolveX(codeptr, VX)
|
||||||
if A_IS_TOSL & TOS_DIRTY
|
if A_IS_TOSL & TOS_DIRTY
|
||||||
*codeptr = $D095//+(VX<<8) // STA ESTKL,X
|
*codeptr = $D095//+(VX<<8) // STA ESTKL,X
|
||||||
@@ -1185,8 +1176,8 @@ def compiler(defptr)#0
|
|||||||
is $A2 // BRLT - FOR/NEXT SPECIFIC TEST & BRANCH
|
is $A2 // BRLT - FOR/NEXT SPECIFIC TEST & BRANCH
|
||||||
i++
|
i++
|
||||||
dest = i + *(bytecode+i)
|
dest = i + *(bytecode+i)
|
||||||
//puts("BRLT "); puti(dest)
|
|
||||||
i++
|
i++
|
||||||
|
//puts("BRLT "); puti(dest)
|
||||||
codeptr, VX = resolveX(codeptr, VX)
|
codeptr, VX = resolveX(codeptr, VX)
|
||||||
if not A_IS_TOSL
|
if not A_IS_TOSL
|
||||||
*codeptr = $D0B5//+(VX<<8) // LDA ESTKL,X
|
*codeptr = $D0B5//+(VX<<8) // LDA ESTKL,X
|
||||||
@@ -1247,9 +1238,9 @@ def compiler(defptr)#0
|
|||||||
// BRLE
|
// BRLE
|
||||||
//
|
//
|
||||||
codeptr=>0 = $D0B5+$0100//+(VX<<8) // LDA ESTKL+1,X
|
codeptr=>0 = $D0B5+$0100//+(VX<<8) // LDA ESTKL+1,X
|
||||||
codeptr=>2 = $D0D5+(VX<<8) // CMP ESTKL,X
|
codeptr=>2 = $D0D5//+(VX<<8) // CMP ESTKL,X
|
||||||
codeptr=>4 = $C0B5+$0100//+(VX<<8) // LDA ESTKH+1,X
|
codeptr=>4 = $C0B5+$0100//+(VX<<8) // LDA ESTKH+1,X
|
||||||
codeptr=>6 = $C0F5+(VX<<8) // SBC ESTKH
|
codeptr=>6 = $C0F5//+(VX<<8) // SBC ESTKH
|
||||||
codeptr=>8 = $0250 // BVC +2
|
codeptr=>8 = $0250 // BVC +2
|
||||||
codeptr=>10 = $8049 // EOR #$80
|
codeptr=>10 = $8049 // EOR #$80
|
||||||
codeptr=>12 = $0330 // BMI +3
|
codeptr=>12 = $0330 // BMI +3
|
||||||
@@ -1365,6 +1356,7 @@ def compiler(defptr)#0
|
|||||||
if VY <> j
|
if VY <> j
|
||||||
*codeptr = $A0+(j<<8) // LDY #imm
|
*codeptr = $A0+(j<<8) // LDY #imm
|
||||||
codeptr = codeptr + 2
|
codeptr = codeptr + 2
|
||||||
|
VY = j
|
||||||
fin
|
fin
|
||||||
codeptr->0 = $18 // CLC
|
codeptr->0 = $18 // CLC
|
||||||
codeptr=>1 = $E071 // ADC (IFP),Y
|
codeptr=>1 = $E071 // ADC (IFP),Y
|
||||||
@@ -1373,8 +1365,7 @@ def compiler(defptr)#0
|
|||||||
codeptr=>3 = $0290 // BCC +2
|
codeptr=>3 = $0290 // BCC +2
|
||||||
codeptr=>5 = $C0F6+(VX<<8) // INC ESTKH,X
|
codeptr=>5 = $C0F6+(VX<<8) // INC ESTKH,X
|
||||||
codeptr = codeptr + 7
|
codeptr = codeptr + 7
|
||||||
VY = j
|
A_IS_TOSL = TOS_DIRTY // STA ESTKL,X
|
||||||
A_IS_TOSL = TOS_DIRTY // STA ESTKL,X
|
|
||||||
else
|
else
|
||||||
//puts("ADDLW "); puti(j)
|
//puts("ADDLW "); puti(j)
|
||||||
codeptr=>3 = $D095+(VX<<8) // STA ESTKL,X
|
codeptr=>3 = $D095+(VX<<8) // STA ESTKL,X
|
||||||
@@ -1383,8 +1374,8 @@ def compiler(defptr)#0
|
|||||||
codeptr=>8 = $E071 // ADC (IFP),Y
|
codeptr=>8 = $E071 // ADC (IFP),Y
|
||||||
codeptr=>10 = $C095+(VX<<8) // STA ESTKH,X
|
codeptr=>10 = $C095+(VX<<8) // STA ESTKH,X
|
||||||
codeptr = codeptr + 12
|
codeptr = codeptr + 12
|
||||||
VY = j + 1
|
VY++
|
||||||
A_IS_TOSL = FALSE
|
A_IS_TOSL = FALSE
|
||||||
fin
|
fin
|
||||||
break
|
break
|
||||||
is $B4 // ADDAB
|
is $B4 // ADDAB
|
||||||
@@ -1429,7 +1420,7 @@ def compiler(defptr)#0
|
|||||||
fin
|
fin
|
||||||
*codeptr = $E0B1 // LDA (IFP),Y
|
*codeptr = $E0B1 // LDA (IFP),Y
|
||||||
codeptr = codeptr + 2
|
codeptr = codeptr + 2
|
||||||
if j
|
if j <> 0
|
||||||
*codeptr = $00A0 // LDY #$00
|
*codeptr = $00A0 // LDY #$00
|
||||||
codeptr = codeptr + 2
|
codeptr = codeptr + 2
|
||||||
fin
|
fin
|
||||||
@@ -1468,8 +1459,8 @@ def compiler(defptr)#0
|
|||||||
codeptr=>13 = $D075+(VX<<8) // ADC ESTKL,X
|
codeptr=>13 = $D075+(VX<<8) // ADC ESTKL,X
|
||||||
codeptr=>15 = $D095+(VX<<8) // STA ESTKL,X
|
codeptr=>15 = $D095+(VX<<8) // STA ESTKL,X
|
||||||
codeptr->17 = $98 // TYA
|
codeptr->17 = $98 // TYA
|
||||||
codeptr=>18 = $C075+(VX<<8) // ADC ESTKLH,X
|
codeptr=>18 = $C075+(VX<<8) // ADC ESTKH,X
|
||||||
codeptr=>20 = $C095+(VX<<8) // STA ESTKLH,X
|
codeptr=>20 = $C095+(VX<<8) // STA ESTKH,X
|
||||||
codeptr = codeptr + 22
|
codeptr = codeptr + 22
|
||||||
VY = UNKNOWN
|
VY = UNKNOWN
|
||||||
A_IS_TOSL = FALSE
|
A_IS_TOSL = FALSE
|
||||||
@@ -1494,13 +1485,13 @@ def compiler(defptr)#0
|
|||||||
codeptr=>10 = $D095+(VX<<8) // STA ESTKL,X
|
codeptr=>10 = $D095+(VX<<8) // STA ESTKL,X
|
||||||
codeptr->12 = $98 // TYA
|
codeptr->12 = $98 // TYA
|
||||||
codeptr=>13 = $C075+(VX<<8) // ADC ESTKH,X
|
codeptr=>13 = $C075+(VX<<8) // ADC ESTKH,X
|
||||||
codeptr=>15 = $C095+(VX<<8) // STA ESTKLH,X
|
codeptr=>15 = $C095+(VX<<8) // STA ESTKH,X
|
||||||
codeptr = codeptr + 17
|
codeptr = codeptr + 17
|
||||||
VY = UNKNOWN
|
VY = UNKNOWN
|
||||||
A_IS_TOSL = FALSE
|
A_IS_TOSL = FALSE
|
||||||
i++
|
i++
|
||||||
break
|
break
|
||||||
is $BE
|
is $BE // IDXAW
|
||||||
i++
|
i++
|
||||||
dest = *(bytecode+i)
|
dest = *(bytecode+i)
|
||||||
i++
|
i++
|
||||||
@@ -1513,7 +1504,7 @@ def compiler(defptr)#0
|
|||||||
codeptr=>1 = dest
|
codeptr=>1 = dest
|
||||||
codeptr->3 = $0A // ASL
|
codeptr->3 = $0A // ASL
|
||||||
codeptr=>4 = $E785 // STA $E7:TMPL
|
codeptr=>4 = $E785 // STA $E7:TMPL
|
||||||
codeptr->6 = $AD // LDA abs
|
codeptr->6 = $AD // LDA abs+1
|
||||||
codeptr=>7 = dest+1
|
codeptr=>7 = dest+1
|
||||||
codeptr=>9 = $A82A // ROL; TAY
|
codeptr=>9 = $A82A // ROL; TAY
|
||||||
codeptr=>11 = $E7A5 // LDA $E7:TMPL
|
codeptr=>11 = $E7A5 // LDA $E7:TMPL
|
||||||
@@ -1522,7 +1513,7 @@ def compiler(defptr)#0
|
|||||||
codeptr=>16 = $D095+(VX<<8) // STA ESTKL,X
|
codeptr=>16 = $D095+(VX<<8) // STA ESTKL,X
|
||||||
codeptr->18 = $98 // TYA
|
codeptr->18 = $98 // TYA
|
||||||
codeptr=>19 = $C075+(VX<<8) // ADC ESTKH,X
|
codeptr=>19 = $C075+(VX<<8) // ADC ESTKH,X
|
||||||
codeptr=>21 = $C095+(VX<<8) // STA ESTKLH,X
|
codeptr=>21 = $C095+(VX<<8) // STA ESTKH,X
|
||||||
codeptr = codeptr + 23
|
codeptr = codeptr + 23
|
||||||
VY = UNKNOWN
|
VY = UNKNOWN
|
||||||
A_IS_TOSL = FALSE
|
A_IS_TOSL = FALSE
|
||||||
|
@@ -136,6 +136,9 @@ TEMPBUF !FILL $F0
|
|||||||
CMDPARS !WORD 0 ; $A0F0
|
CMDPARS !WORD 0 ; $A0F0
|
||||||
JITCOMP !WORD 0 ; $A0F2
|
JITCOMP !WORD 0 ; $A0F2
|
||||||
JITCODE !WORD 0 ; $A0F4
|
JITCODE !WORD 0 ; $A0F4
|
||||||
|
SENTRY !WORD INTERP ; $A0F6
|
||||||
|
XENTRY !WORD XINTERP ; $A0F8
|
||||||
|
JENTRY !WORD JITINTRP ; $A0FA
|
||||||
;*
|
;*
|
||||||
;* OPCODE TABLE
|
;* OPCODE TABLE
|
||||||
;*
|
;*
|
||||||
|
@@ -1,9 +1,5 @@
|
|||||||
include "inc/cmdsys.plh"
|
include "inc/cmdsys.plh"
|
||||||
//
|
//
|
||||||
// Temp buff addresses
|
|
||||||
//
|
|
||||||
const cmdparser = $A0F0
|
|
||||||
//
|
|
||||||
// JIT compiler values
|
// JIT compiler values
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@@ -18,13 +14,16 @@ struc t_defentry
|
|||||||
byte bytecodesize
|
byte bytecodesize
|
||||||
end
|
end
|
||||||
//
|
//
|
||||||
// JIT compiler values
|
// Private addresses
|
||||||
//
|
//
|
||||||
const jitcomp = $A0F2
|
const codemax = $A000
|
||||||
const jitcodeptr = $A0F4
|
const cmdparser = $A0F0
|
||||||
const codemax = $A000
|
const jitcomp = $A0F2
|
||||||
const directentry = $A1C2 // Right afer opcode table
|
const jitcodeptr = $A0F4
|
||||||
const indirectentry = $A1F0 // Yikes! Grabbed from plvm03.sym
|
const sinterp = $A0F6
|
||||||
|
const xinterp = $A0F8
|
||||||
|
const jitinterp = $A0FA
|
||||||
|
word directentry, indirectentry
|
||||||
//
|
//
|
||||||
// COPY FROM EXT MEM TO MAIN MEM.
|
// COPY FROM EXT MEM TO MAIN MEM.
|
||||||
//
|
//
|
||||||
@@ -312,6 +311,8 @@ end
|
|||||||
//
|
//
|
||||||
// Install JIT compiler
|
// Install JIT compiler
|
||||||
//
|
//
|
||||||
|
directentry = *sinterp
|
||||||
|
indirectentry = *xinterp
|
||||||
*jitcomp = @compiler
|
*jitcomp = @compiler
|
||||||
cmdsys.jitcount = 44
|
cmdsys.jitcount = 44
|
||||||
cmdsys.jitsize = 96
|
cmdsys.jitsize = 96
|
||||||
|
@@ -17,10 +17,12 @@ const resxhgr2 = $0080
|
|||||||
const modkeep = $2000
|
const modkeep = $2000
|
||||||
const modinitkeep = $4000
|
const modinitkeep = $4000
|
||||||
//
|
//
|
||||||
// Temp buff addresses
|
// Private addresses
|
||||||
//
|
//
|
||||||
const instr = $A020
|
const instr = $A020
|
||||||
const cmdparser = $A0F0
|
const cmdparser = $A0F0
|
||||||
|
const xinterp = $A0F8
|
||||||
|
const jitinterp = $A0FA
|
||||||
//
|
//
|
||||||
// Indirect interpreter DEFinition entrypoint
|
// Indirect interpreter DEFinition entrypoint
|
||||||
//
|
//
|
||||||
@@ -459,25 +461,6 @@ asm sext(a)#1
|
|||||||
RTS
|
RTS
|
||||||
end
|
end
|
||||||
//
|
//
|
||||||
// Addresses of internal routines.
|
|
||||||
//
|
|
||||||
asm xinterp()#1
|
|
||||||
DEX
|
|
||||||
LDA #<XINTERP
|
|
||||||
STA ESTKL,X
|
|
||||||
LDA #>XINTERP
|
|
||||||
STA ESTKH,X
|
|
||||||
RTS
|
|
||||||
end
|
|
||||||
asm jitinterp()#1
|
|
||||||
DEX
|
|
||||||
LDA #<JITINTRP
|
|
||||||
STA ESTKL,X
|
|
||||||
LDA #>JITINTRP
|
|
||||||
STA ESTKH,X
|
|
||||||
RTS
|
|
||||||
end
|
|
||||||
//
|
|
||||||
// A DCI string is one that has the high bit set for every character except the last.
|
// A DCI string is one that has the high bit set for every character except the last.
|
||||||
// More efficient than C or Pascal strings.
|
// More efficient than C or Pascal strings.
|
||||||
//
|
//
|
||||||
@@ -1050,13 +1033,13 @@ def adddef(isfirst, ext, addr, deflast)#1
|
|||||||
preventry = defentry - t_defentry
|
preventry = defentry - t_defentry
|
||||||
defsize = addr - preventry=>bytecodeaddr
|
defsize = addr - preventry=>bytecodeaddr
|
||||||
if defsize <= jitsize
|
if defsize <= jitsize
|
||||||
preventry=>interpaddr = jitinterp // JSR JITINTRP
|
preventry=>interpaddr = *jitinterp // JSR JITINTRP
|
||||||
preventry->callcount = jitcount // Set JIT countdown
|
preventry->callcount = jitcount // Set JIT countdown
|
||||||
preventry->bytecodesize = defsize // Set size
|
preventry->bytecodesize = defsize // Set size
|
||||||
fin
|
fin
|
||||||
fin
|
fin
|
||||||
defentry->interpjsr = $20
|
defentry->interpjsr = $20 // JSR
|
||||||
defentry=>interpaddr = xinterp
|
defentry=>interpaddr = *xinterp // XINTERP
|
||||||
defentry=>bytecodeaddr = addr
|
defentry=>bytecodeaddr = addr
|
||||||
defentry->bytecodexbyte = ext
|
defentry->bytecodexbyte = ext
|
||||||
defentry->t_defentry = 0
|
defentry->t_defentry = 0
|
||||||
|
Reference in New Issue
Block a user