1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2024-09-30 07:57:05 +00:00

Sync cleanjit with jitcore

This commit is contained in:
David Schmenk 2018-04-06 08:25:42 -07:00
parent f35f0b3bba
commit 625ce2704e
2 changed files with 58 additions and 52 deletions

View File

@ -87,16 +87,10 @@ def compiler(defptr)#0
// //
isdata = addrxlate // Use this buffer isdata = addrxlate // Use this buffer
i = 0 i = 0
while i <= defptr->bytecodesize while i < defptr->bytecodesize
if not ^(isdata+i) if not ^(isdata+i)
when (^(bytecode+i) & $FE) when (^(bytecode+i) & $FE)
// //
// Multi-byte operands
//
is $2E // CS
i = i + ^(bytecode+i+1)// + 1
break
//
// Double byte operands // Double byte operands
// //
is $26 // LA is $26 // LA
@ -113,7 +107,13 @@ def compiler(defptr)#0
is $B6 // ADDAW is $B6 // ADDAW
is $BC // IDXAB is $BC // IDXAB
is $BE // IDXAW is $BE // IDXAW
i++ i = i + 2
break
//
// Multi-byte operands
//
is $2E // CS
i = i + ^(bytecode+i+1)
// //
// Single byte operands // Single byte operands
// //
@ -340,8 +340,8 @@ def compiler(defptr)#0
break break
is $26 // LA is $26 // LA
is $2C // CW is $2C // CW
i++ dest = *(bytecode+i+1)
dest = *(bytecode+i) i = i + 2
//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
@ -353,7 +353,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++
@ -758,7 +757,6 @@ def compiler(defptr)#0
A_IS_TOSL = FALSE A_IS_TOSL = FALSE
break break
is $54 // CALL is $54 // CALL
i++
//puts("CALL $"); puth(*(bytecode+i)) //puts("CALL $"); puth(*(bytecode+i))
// //
// Call address // Call address
@ -769,11 +767,11 @@ def compiler(defptr)#0
codeptr = codeptr + 2 codeptr = codeptr + 2
fin fin
codeptr->0 = $20 // JSR abs codeptr->0 = $20 // JSR abs
codeptr=>1 = *(bytecode+i) codeptr=>1 = *(bytecode+i+1)
codeptr = codeptr + 3 codeptr = codeptr + 3
VY = UNKNOWN VY = UNKNOWN
A_IS_TOSL = FALSE A_IS_TOSL = FALSE
i++ i = i + 2
break break
is $56 // ICAL is $56 // ICAL
//puts("ICAL") //puts("ICAL")
@ -941,8 +939,8 @@ def compiler(defptr)#0
i++ i++
break break
is $6A // LAW is $6A // LAW
i++ dest = *(bytecode+i+1)
dest = *(bytecode+i) i = i + 2
//puts("LAW $"); puth(dest) //puts("LAW $"); 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
@ -956,7 +954,6 @@ def compiler(defptr)#0
codeptr=>6 = dest codeptr=>6 = dest
codeptr = codeptr + 8 codeptr = codeptr + 8
A_IS_TOSL = TOS_DIRTY // STA ESTKL,X A_IS_TOSL = TOS_DIRTY // STA ESTKL,X
i++
break break
is $6C // DLB is $6C // DLB
i++ i++
@ -968,11 +965,18 @@ def compiler(defptr)#0
A_IS_TOSL = TOS_CLEAN A_IS_TOSL = TOS_CLEAN
fin fin
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 VY = j
fin fin
*codeptr = $E091 // STA (IFP),Y *codeptr = $E091 // STA (IFP),Y
codeptr = codeptr + 2
if VY <> 0
*codeptr = $00A0 // LDY #$00
codeptr = codeptr + 2
VY = 0
fin
*codeptr = $C094+(VX<<8) // STY ESTKH,X
codeptr = codeptr + 2 codeptr = codeptr + 2
break break
is $6E // DLW is $6E // DLW
@ -1069,22 +1073,22 @@ def compiler(defptr)#0
A_IS_TOSL = FALSE A_IS_TOSL = FALSE
break break
is $78 // SAB is $78 // SAB
i++ dest = *(bytecode+i+1)
i = i + 2
//puts("SAB $"); puth(*(bytecode+i)) //puts("SAB $"); 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
fin fin
codeptr->0 = $8D // STA abs codeptr->0 = $8D // STA abs
codeptr=>1 = *(bytecode+i) codeptr=>1 = dest
codeptr = codeptr + 3 codeptr = codeptr + 3
VX++ // INX VX++ // INX
A_IS_TOSL = FALSE A_IS_TOSL = FALSE
i++
break break
is $7A // SAW is $7A // SAW
i++ dest = *(bytecode+i+1)
dest = *(bytecode+i) i = i + 2
//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
@ -1098,24 +1102,29 @@ def compiler(defptr)#0
codeptr = codeptr + 8 codeptr = codeptr + 8
VX++ // INX VX++ // INX
A_IS_TOSL = FALSE A_IS_TOSL = FALSE
i++
break break
is $7C // DAB is $7C // DAB
i++ dest = *(bytecode+i+1)
i = i + 2
//puts("DAB $"); puth(*(bytecode+i)) //puts("DAB $"); 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
if VY <> 0
*codeptr = $00A0 // LDY #$00
codeptr = codeptr + 2
VY = 0
fin
codeptr->0 = $8D // STA abs codeptr->0 = $8D // STA abs
codeptr=>1 = *(bytecode+i) codeptr=>1 = dest
codeptr = codeptr + 3 codeptr=>3 = $C094+(VX<<8) // STY ESTKH,X
i++ codeptr = codeptr + 5
break break
is $7E // DAW is $7E // DAW
i++ dest = *(bytecode+i+1)
dest = *(bytecode+i) i = i + 2
//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
@ -1129,7 +1138,6 @@ def compiler(defptr)#0
codeptr=>6 = dest+1 codeptr=>6 = dest+1
codeptr = codeptr + 8 codeptr = codeptr + 8
VY = UNKNOWN VY = UNKNOWN
i++
break break
is $80 // NOT is $80 // NOT
//puts("NOT") //puts("NOT")
@ -1630,24 +1638,23 @@ def compiler(defptr)#0
A_IS_TOSL = FALSE A_IS_TOSL = FALSE
break break
is $B4 // ADDAB is $B4 // ADDAB
i++ dest = *(bytecode+i+1)
i = i + 2
//puts("ADDAB $"); puth(*(bytecode+i)) //puts("ADDAB $"); 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
fin fin
codeptr=>0 = $6D18 // CLC; ADC abs codeptr=>0 = $6D18 // CLC; ADC abs
codeptr=>2 = *(bytecode+i) codeptr=>2 = dest
codeptr=>4 = $0290 // BCC +2 codeptr=>4 = $0290 // BCC +2
codeptr=>6 = $C0F6+(VX<<8) // INC ESTKH,X codeptr=>6 = $C0F6+(VX<<8) // INC ESTKH,X
codeptr = codeptr + 8 codeptr = codeptr + 8
A_IS_TOSL = TOS_DIRTY // STA ESTKL,X A_IS_TOSL = TOS_DIRTY // STA ESTKL,X
i++
break break
is $B6 // ADDAW is $B6 // ADDAW
i++ dest = *(bytecode+i+1)
dest = *(bytecode+i) i = i + 2
i++
//puts("ADDAW $"); puth(dest) //puts("ADDAW $"); 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
@ -1723,7 +1730,8 @@ def compiler(defptr)#0
A_IS_TOSL = FALSE A_IS_TOSL = FALSE
break break
is $BC // IDXAB is $BC // IDXAB
i++ dest = *(bytecode+i+1)
i = i + 2
//puts("IDXAB $"); puth(*(bytecode+i)) //puts("IDXAB $"); puth(*(bytecode+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
@ -1734,7 +1742,7 @@ def compiler(defptr)#0
codeptr = codeptr + 2 codeptr = codeptr + 2
fin fin
codeptr->0 = $AD // LDA abs codeptr->0 = $AD // LDA abs
codeptr=>1 = *(bytecode+i) codeptr=>1 = dest
codeptr->3 = $0A // ASL codeptr->3 = $0A // ASL
codeptr=>4 = $0290 // BCC +2 codeptr=>4 = $0290 // BCC +2
codeptr=>6 = $18C8 // INY; CLC codeptr=>6 = $18C8 // INY; CLC
@ -1746,12 +1754,10 @@ def compiler(defptr)#0
codeptr = codeptr + 17 codeptr = codeptr + 17
VY = UNKNOWN VY = UNKNOWN
A_IS_TOSL = FALSE A_IS_TOSL = FALSE
i++
break break
is $BE is $BE // IDXAW
i++ dest = *(bytecode+i+1)
dest = *(bytecode+i) i = i + 2
i++
//puts("IDXAW $"); puth(dest) //puts("IDXAW $"); 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

View File

@ -851,18 +851,18 @@ def compiler(defptr)#0
A_IS_TOSL = TOS_CLEAN A_IS_TOSL = TOS_CLEAN
fin fin
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 VY = j
fin fin
*codeptr = $E091 // STA (IFP),Y *codeptr = $E091 // STA (IFP),Y
codeptr = codeptr + 2 codeptr = codeptr + 2
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 = $C094+(VX<<8) // STY ESTKH,X *codeptr = $C094+(VX<<8) // STY ESTKH,X
codeptr = codeptr + 2 codeptr = codeptr + 2
break break
is $6E // DLW is $6E // DLW
@ -1474,7 +1474,8 @@ def compiler(defptr)#0
A_IS_TOSL = FALSE A_IS_TOSL = FALSE
break break
is $BC // IDXAB is $BC // IDXAB
i++ dest = *(bytecode+i+1)
i = i + 2
//puts("IDXAB $"); puth(*(bytecode+i)) //puts("IDXAB $"); puth(*(bytecode+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
@ -1485,7 +1486,7 @@ def compiler(defptr)#0
codeptr = codeptr + 2 codeptr = codeptr + 2
fin fin
codeptr->0 = $AD // LDA abs codeptr->0 = $AD // LDA abs
codeptr=>1 = *(bytecode+i) codeptr=>1 = dest
codeptr->3 = $0A // ASL codeptr->3 = $0A // ASL
codeptr=>4 = $0290 // BCC +2 codeptr=>4 = $0290 // BCC +2
codeptr=>6 = $18C8 // INY; CLC codeptr=>6 = $18C8 // INY; CLC
@ -1497,7 +1498,6 @@ def compiler(defptr)#0
codeptr = codeptr + 17 codeptr = codeptr + 17
VY = UNKNOWN VY = UNKNOWN
A_IS_TOSL = FALSE A_IS_TOSL = FALSE
i++
break break
is $BE // IDXAW is $BE // IDXAW
dest = *(bytecode+i+1) dest = *(bytecode+i+1)