mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-02-02 16:34:26 +00:00
Fix JIT16 SEC bug
This commit is contained in:
parent
34c8a2efa3
commit
2d8f2b9b22
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -22,15 +22,16 @@ const estkh8 = $C000
|
||||
const estkh = $00C0
|
||||
const estkl8 = $D000
|
||||
const estkl = $00D0
|
||||
const ifp16 = $E000
|
||||
const ifp8 = $E000
|
||||
const ifpl8 = $E000
|
||||
const ifph8 = $E100
|
||||
const jmptmp = $00E6
|
||||
const tmp16 = $E700
|
||||
const tmp8 = $E700
|
||||
const tmpl8 = $E700
|
||||
const tmph8 = $E800
|
||||
const fetchop = $00F1
|
||||
const ip16 = $00F2
|
||||
const ip8 = $F200
|
||||
const ip = $00F2
|
||||
//
|
||||
// Bytecode interpreter entrypoints
|
||||
//
|
||||
|
@ -276,7 +276,7 @@ def compiler(defptr)#0
|
||||
^codeptr = $48; codeptr++ // PHA
|
||||
fin
|
||||
if not X_IS_IFP
|
||||
*codeptr = ifp16+$A6 // LDX IFP
|
||||
*codeptr = ifp8+$A6 // LDX IFP
|
||||
codeptr = codeptr + 2
|
||||
X_IS_IFP = TRUE
|
||||
fin
|
||||
@ -450,9 +450,9 @@ def compiler(defptr)#0
|
||||
fin
|
||||
codeptr->0 = $A0 // LDY #$0000
|
||||
codeptr=>1 = $0000
|
||||
codeptr=>3 = tmp16+$85 // STA TMP
|
||||
codeptr=>3 = tmp8+$85 // STA TMP
|
||||
codeptr=>5 = $3868 // PLA; SEC
|
||||
codeptr=>7 = tmp16+$E5 // SBC TMP
|
||||
codeptr=>7 = tmp8+$E5 // SBC TMP
|
||||
codeptr=>9 = $0350 // BVC +3
|
||||
codeptr->11 = $49 // EOR #$8000
|
||||
codeptr=>12 = $8000
|
||||
@ -562,7 +562,7 @@ def compiler(defptr)#0
|
||||
codeptr=>0 = $10E2 // SEP #$10 -> 8 BIT X/Y
|
||||
codeptr->2 = $A9 // LDA #imm
|
||||
codeptr=>3 = codeptr + 12
|
||||
codeptr=>5 = $F285 // STA IP
|
||||
codeptr=>5 = ip8+$85 // STA IP
|
||||
codeptr=>7 = $00A0 // LDY #$00
|
||||
codeptr->9 = $4C // JMP FETCHOP
|
||||
codeptr=>10 = fetchop // FETCHOP
|
||||
@ -611,9 +611,9 @@ def compiler(defptr)#0
|
||||
if not A_IS_TOS
|
||||
^codeptr = $68; codeptr++ // PLA
|
||||
fin
|
||||
codeptr=>0 = tmp16+$85 // STA TMP
|
||||
codeptr=>0 = tmp8+$85 // STA TMP
|
||||
codeptr=>2 = $20E2 // SEP #$20 -> 8 BIT ACCUM/MEM
|
||||
codeptr=>4 = tmp16+$B2 // LDA (TMP)
|
||||
codeptr=>4 = tmp8+$B2 // LDA (TMP)
|
||||
codeptr=>6 = $20C2 // REP #$20 -> 16 BIT ACCUM/MEM
|
||||
codeptr->8 = $29 // AND #$00FF
|
||||
codeptr=>9 = $00FF
|
||||
@ -625,8 +625,8 @@ def compiler(defptr)#0
|
||||
if not A_IS_TOS
|
||||
^codeptr = $68; codeptr++ // PLA
|
||||
fin
|
||||
codeptr=>0 = tmp16+$85 // STA TMP
|
||||
codeptr=>2 = tmp16+$B2 // LDA (TMP)
|
||||
codeptr=>0 = tmp8+$85 // STA TMP
|
||||
codeptr=>2 = tmp8+$B2 // LDA (TMP)
|
||||
codeptr = codeptr + 4
|
||||
A_IS_TOS = TRUE // PHA
|
||||
break
|
||||
@ -638,7 +638,7 @@ def compiler(defptr)#0
|
||||
^codeptr = $48; codeptr++ // PHA
|
||||
fin
|
||||
if not X_IS_IFP
|
||||
*codeptr = ifp16+$A6 // LDX IFP
|
||||
*codeptr = ifp8+$A6 // LDX IFP
|
||||
codeptr = codeptr + 2
|
||||
X_IS_IFP = TRUE
|
||||
fin
|
||||
@ -656,7 +656,7 @@ def compiler(defptr)#0
|
||||
^codeptr = $48; codeptr++ // PHA
|
||||
fin
|
||||
if not X_IS_IFP
|
||||
*codeptr = ifp16+$A6 // LDX IFP
|
||||
*codeptr = ifp8+$A6 // LDX IFP
|
||||
codeptr = codeptr + 2
|
||||
X_IS_IFP = TRUE
|
||||
fin
|
||||
@ -711,7 +711,7 @@ def compiler(defptr)#0
|
||||
^codeptr = $68; codeptr++ // PLA
|
||||
fin
|
||||
if not X_IS_IFP
|
||||
*codeptr = ifp16+$A6 // LDX IFP
|
||||
*codeptr = ifp8+$A6 // LDX IFP
|
||||
codeptr = codeptr + 2
|
||||
X_IS_IFP = TRUE
|
||||
fin
|
||||
@ -738,7 +738,7 @@ def compiler(defptr)#0
|
||||
^codeptr = $68; codeptr++ // PLA
|
||||
fin
|
||||
if not X_IS_IFP
|
||||
*codeptr = ifp16+$A6 // LDX IFP
|
||||
*codeptr = ifp8+$A6 // LDX IFP
|
||||
codeptr = codeptr + 2
|
||||
X_IS_IFP = TRUE
|
||||
fin
|
||||
@ -757,10 +757,10 @@ def compiler(defptr)#0
|
||||
if not A_IS_TOS
|
||||
^codeptr = $68; codeptr++ // PLA
|
||||
fin
|
||||
codeptr=>0 = tmp16+$85 // STA TMP
|
||||
codeptr=>0 = tmp8+$85 // STA TMP
|
||||
codeptr->2 = $68 // PLA
|
||||
codeptr=>3 = $20E2 // SEP #$20 -> 8 BIT ACCUM/MEM
|
||||
codeptr=>5 = tmp16+$92 // STA (TMP)
|
||||
codeptr=>5 = tmp8+$92 // STA (TMP)
|
||||
codeptr=>7 = $20C2 // REP #$20 -> 16 BIT ACCUM/MEM
|
||||
codeptr = codeptr + 9
|
||||
A_IS_TOS = FALSE
|
||||
@ -770,9 +770,9 @@ def compiler(defptr)#0
|
||||
if not A_IS_TOS
|
||||
^codeptr = $68; codeptr++ // PLA
|
||||
fin
|
||||
codeptr=>0 = tmp16+$85 // STA TMP
|
||||
codeptr=>0 = tmp8+$85 // STA TMP
|
||||
codeptr->2 = $68 // PLA
|
||||
codeptr=>3 = tmp16+$92 // STA (TMP)
|
||||
codeptr=>3 = tmp8+$92 // STA (TMP)
|
||||
codeptr = codeptr + 5
|
||||
A_IS_TOS = FALSE
|
||||
break
|
||||
@ -848,9 +848,9 @@ def compiler(defptr)#0
|
||||
if not A_IS_TOS
|
||||
^codeptr = $68; codeptr++ // PLA
|
||||
fin
|
||||
codeptr=>0 = tmp16+$85 // STA TMP
|
||||
codeptr=>0 = tmp8+$85 // STA TMP
|
||||
codeptr=>2 = $3868 // PLA; SEC
|
||||
codeptr=>4 = tmp16+$E5 // SBC TMP
|
||||
codeptr=>4 = tmp8+$E5 // SBC TMP
|
||||
codeptr = codeptr + 6
|
||||
A_IS_TOS = TRUE
|
||||
break
|
||||
@ -881,7 +881,7 @@ def compiler(defptr)#0
|
||||
codeptr=>0 = $10E2 // SEP #$10 -> 8 BIT X/Y
|
||||
codeptr->2 = $A9 // LDA #imm
|
||||
codeptr=>3 = codeptr + 12
|
||||
codeptr=>5 = ip16+$85 // STA IP
|
||||
codeptr=>5 = ip8+$85 // STA IP
|
||||
codeptr=>7 = $00A0 // LDY #$00
|
||||
codeptr->9 = $4C // JMP FETCHOP
|
||||
codeptr=>10 = fetchop // FETCHOP
|
||||
@ -1076,10 +1076,10 @@ def compiler(defptr)#0
|
||||
// SUB
|
||||
//
|
||||
//puts("SUBBRGE "); puti(dest)
|
||||
codeptr=>0 = tmp16+$85 // STA TMP
|
||||
codeptr=>0 = tmp8+$85 // STA TMP
|
||||
codeptr=>2 = $A3+(TOS<<8) // LDA S,TOS
|
||||
codeptr->4 = $68 // SEC
|
||||
codeptr=>5 = tmp16+$E5 // SBC TMP
|
||||
codeptr->4 = $38 // SEC
|
||||
codeptr=>5 = tmp8+$E5 // SBC TMP
|
||||
codeptr=>7 = $83+(TOS<<8) // STA S,TOS
|
||||
codeptr = codeptr + 9
|
||||
fin
|
||||
@ -1133,16 +1133,16 @@ def compiler(defptr)#0
|
||||
^codeptr = $68; codeptr++ // PLA
|
||||
fin
|
||||
if not X_IS_IFP
|
||||
*codeptr = ifp16+$A6 // LDX IFP
|
||||
*codeptr = ifp8+$A6 // LDX IFP
|
||||
codeptr = codeptr + 2
|
||||
X_IS_IFP = TRUE
|
||||
fin
|
||||
codeptr=>0 = tmp16+$85 // STA TMP
|
||||
codeptr=>0 = tmp8+$85 // STA TMP
|
||||
codeptr=>2 = $B5+(j<<8) // LDA dp,X
|
||||
codeptr->4 = $29 // AND #$00FF
|
||||
codeptr=>5 = $00FF
|
||||
codeptr->7 = $18 // CLC
|
||||
codeptr=>8 = tmp16+$65 // ADC TMP
|
||||
codeptr=>8 = tmp8+$65 // ADC TMP
|
||||
codeptr = codeptr + 10
|
||||
A_IS_TOS = TRUE // PHA
|
||||
break
|
||||
@ -1154,7 +1154,7 @@ def compiler(defptr)#0
|
||||
^codeptr = $68; codeptr++ // PLA
|
||||
fin
|
||||
if not X_IS_IFP
|
||||
*codeptr = ifp16+$A6 // LDX IFP
|
||||
*codeptr = ifp8+$A6 // LDX IFP
|
||||
codeptr = codeptr + 2
|
||||
X_IS_IFP = TRUE
|
||||
fin
|
||||
@ -1174,7 +1174,7 @@ def compiler(defptr)#0
|
||||
//
|
||||
// Ensure only byte sized accesses to H/W addresses
|
||||
//
|
||||
codeptr=>0 = tmp16+$85 // STA TMP
|
||||
codeptr=>0 = tmp8+$85 // STA TMP
|
||||
codeptr=>2 = $20E2 // SEP #$20 -> 8 BIT ACCUM/MEM
|
||||
codeptr->4 = $AD // LDA abs
|
||||
codeptr=>5 = dest
|
||||
@ -1182,16 +1182,16 @@ def compiler(defptr)#0
|
||||
codeptr->9 = $29 // AND #$00FF
|
||||
codeptr=>10 = $00FF
|
||||
codeptr->12 = $18 // CLC
|
||||
codeptr=>13 = tmp16+$65 // ADC TMP
|
||||
codeptr=>13 = tmp8+$65 // ADC TMP
|
||||
codeptr = codeptr + 15
|
||||
else
|
||||
codeptr=>0 = tmp16+$85 // STA TMP
|
||||
codeptr=>0 = tmp8+$85 // STA TMP
|
||||
codeptr->2 = $AD // LDA abs
|
||||
codeptr=>3 = dest
|
||||
codeptr->5 = $29 // AND #$00FF
|
||||
codeptr=>6 = $00FF
|
||||
codeptr->8 = $18 // CLC
|
||||
codeptr=>9 = tmp16+$65 // ADC TMP
|
||||
codeptr=>9 = tmp8+$65 // ADC TMP
|
||||
codeptr = codeptr + 11
|
||||
fin
|
||||
A_IS_TOS = TRUE // PHA
|
||||
@ -1215,16 +1215,16 @@ def compiler(defptr)#0
|
||||
^codeptr = $68; codeptr++ // PLA
|
||||
fin
|
||||
if not X_IS_IFP
|
||||
*codeptr = ifp16+$A6 // LDX IFP
|
||||
*codeptr = ifp8+$A6 // LDX IFP
|
||||
codeptr = codeptr + 2
|
||||
X_IS_IFP = TRUE
|
||||
fin
|
||||
codeptr=>0 = tmp16+$85 // STA TMP
|
||||
codeptr=>0 = tmp8+$85 // STA TMP
|
||||
codeptr=>2 = $B5+(j<<8) // LDA dp,X
|
||||
codeptr->4 = $29 // AND #$00FF
|
||||
codeptr=>5 = $00FF
|
||||
codeptr->7 = $0A // ASL
|
||||
codeptr=>8 = tmp16+$65 // ADC TMP
|
||||
codeptr=>8 = tmp8+$65 // ADC TMP
|
||||
codeptr = codeptr + 10
|
||||
A_IS_TOS = TRUE // PHA
|
||||
break
|
||||
@ -1236,7 +1236,7 @@ def compiler(defptr)#0
|
||||
^codeptr = $68; codeptr++ // PLA
|
||||
fin
|
||||
if not X_IS_IFP
|
||||
*codeptr = ifp16+$A6 // LDX IFP
|
||||
*codeptr = ifp8+$A6 // LDX IFP
|
||||
codeptr = codeptr + 2
|
||||
X_IS_IFP = TRUE
|
||||
fin
|
||||
@ -1258,7 +1258,7 @@ def compiler(defptr)#0
|
||||
//
|
||||
// Ensure only byte sized accesses to H/W addresses
|
||||
//
|
||||
codeptr=>0 = tmp16+$85 // STA TMP
|
||||
codeptr=>0 = tmp8+$85 // STA TMP
|
||||
codeptr=>2 = $20E2 // SEP #$20 -> 8 BIT ACCUM/MEM
|
||||
codeptr->4 = $AD // LDA abs
|
||||
codeptr=>5 = dest
|
||||
@ -1266,16 +1266,16 @@ def compiler(defptr)#0
|
||||
codeptr->9 = $29 // AND #$00FF
|
||||
codeptr=>10 = $00FF
|
||||
codeptr->12 = $0A // ASL
|
||||
codeptr=>13 = tmp16+$65 // ADC TMP
|
||||
codeptr=>13 = tmp8+$65 // ADC TMP
|
||||
codeptr = codeptr + 15
|
||||
else
|
||||
codeptr=>0 = tmp16+$85 // STA TMP
|
||||
codeptr=>0 = tmp8+$85 // STA TMP
|
||||
codeptr->2 = $AD // LDA abs
|
||||
codeptr=>3 = dest
|
||||
codeptr->5 = $29 // AND #$00FF
|
||||
codeptr=>6 = $00FF
|
||||
codeptr->8 = $0A // ASL
|
||||
codeptr=>9 = tmp16+$65 // ADC TMP
|
||||
codeptr=>9 = tmp8+$65 // ADC TMP
|
||||
codeptr = codeptr + 11
|
||||
fin
|
||||
A_IS_TOS = TRUE // PHA
|
||||
|
Loading…
x
Reference in New Issue
Block a user