From 8f5d4647bf23b9523fac7055f993b1020c08507d Mon Sep 17 00:00:00 2001 From: David Schmenk Date: Sun, 25 Mar 2018 17:31:07 -0700 Subject: [PATCH] Update ops $60-$6E --- src/libsrc/apple/jit.pla | 244 ++++++++++++++++++++++++--------------- 1 file changed, 151 insertions(+), 93 deletions(-) diff --git a/src/libsrc/apple/jit.pla b/src/libsrc/apple/jit.pla index 1206d26..1f77f1b 100644 --- a/src/libsrc/apple/jit.pla +++ b/src/libsrc/apple/jit.pla @@ -511,7 +511,7 @@ def compiler(defptr)#0 codeptr = codeptr + 12 + j A_IS_TOSL = FALSE break - // DROP,DROP2,DUP,DIVMOD,ADDI,SUBI,ANDI,ORI ; 30 32 34 36 38 3A 3C 3E + // DROP,DROP2,DUP,DIVMOD,ADDI,SUBI,ANDI,ORI ; 30 32 34 36 38 3A 3C 3E is $32 // DROP2 //puts("DROP2") VX++ // INX @@ -633,7 +633,7 @@ def compiler(defptr)#0 codeptr = codeptr + 2 A_IS_TOSL = TOSL_DIRTY break - // ISEQ,ISNE,ISGT,ISLT,ISGE,ISLE,BRFLS,BRTRU ; 40 42 44 46 48 4A 4C 4E + // ISEQ,ISNE,ISGT,ISLT,ISGE,ISLE,BRFLS,BRTRU ; 40 42 44 46 48 4A 4C 4E is $40 // ISEQ //puts("ISEQ") if not A_IS_TOSL @@ -928,8 +928,8 @@ def compiler(defptr)#0 //codeptr = codeptr + 2 A_IS_TOSL = FALSE break - // BRNCH,SEL,CALL,ICAL,ENTER,LEAVE,RET,CFFB ; 50 52 54 56 58 5A 5C 5E - is $50 + // BRNCH,SEL,CALL,ICAL,ENTER,LEAVE,RET,CFFB ; 50 52 54 56 58 5A 5C 5E + is $50 // BRNCH i++ dest = i + *(bytecode+i) i++ @@ -952,7 +952,7 @@ def compiler(defptr)#0 //codeptr = codeptr + 2 A_IS_TOSL = FALSE break - is $52 + is $52 // SEL i++ case = i + *(bytecode+i) i++ @@ -1026,7 +1026,7 @@ def compiler(defptr)#0 fin A_IS_TOSL = FALSE break - is $54 + is $54 // CALL i++ //puts("CALL $"); puth(*(bytecode+i)) // @@ -1048,7 +1048,7 @@ def compiler(defptr)#0 A_IS_TOSL = FALSE i++ break - is $56 + is $56 // ICAL //puts("ICAL") // // Pull address off stack @@ -1083,7 +1083,7 @@ def compiler(defptr)#0 codeptr = codeptr + 5 A_IS_TOSL = FALSE break - is $5A + is $5A // LEAVE i++ //puts("LEAVE "); puti(^(bytecode+i)) // @@ -1104,7 +1104,7 @@ def compiler(defptr)#0 codeptr = codeptr + 5 A_IS_TOSL = FALSE break - is $5C + is $5C // RET //puts("RET") if A_IS_TOSL & TOSL_DIRTY *codeptr = $D095+(VX<<8) // STA ESTKL,X @@ -1115,7 +1115,7 @@ def compiler(defptr)#0 codeptr++ A_IS_TOSL = FALSE break - is $5E + is $5E // CFFB i++ //puts("CFFB $FF"); putb(^(bytecode+i)) if A_IS_TOSL & TOSL_DIRTY @@ -1129,7 +1129,7 @@ def compiler(defptr)#0 codeptr=>2 = $C095+(VX<<8) // STA ESTKH,X //^codeptr = $95; codeptr++ // STA zp,X //^codeptr = $C0+VX; codeptr++ // ESTKH - codeptr=>4 = $A9 + (^(bytecode+i)<<8) // LDA #imm + codeptr=>4 = $A9+(^(bytecode+i)<<8) // LDA #imm //^codeptr = $A9; codeptr++ // LDA #imm //^codeptr = ^(bytecode+i); codeptr++ //^codeptr = $95; codeptr++ // STA zp,X @@ -1137,97 +1137,129 @@ def compiler(defptr)#0 codeptr = codeptr + 6 A_IS_TOSL = TOSL_DIRTY break - // LB,LW,LLB,LLW,LAB,LAW,DLB,DLW ; 60 62 64 66 68 6A 6C 6E - is $60 + // LB,LW,LLB,LLW,LAB,LAW,DLB,DLW ; 60 62 64 66 68 6A 6C 6E + is $60 // LB //puts("LB") if not A_IS_TOSL *codeptr = $D0B5+(VX<<8) // LDA ESTKL,X codeptr = codeptr + 2 fin - ^codeptr = $95; codeptr++ // STA zp,X - ^codeptr = $C0-1+VX; codeptr++ // ESTKH-1 - ^codeptr = $A1; codeptr++ // LDA (zp,X) - ^codeptr = $C0-1+VX; codeptr++ // ESTKH-1 - ^codeptr = $94; codeptr++ // STY zp,X - ^codeptr = $C0+VX; codeptr++ // ESTKH + codeptr=>0 = ($C095-$0100)+(VX<<8) // STA ESTKH-1,X + //^codeptr = $95; codeptr++ // STA zp,X + //^codeptr = $C0-1+VX; codeptr++ // ESTKH-1 + codeptr=>2 = ($C0A1-$0100)+(VX<<8) // LDA (ESTKH-1,X) + //^codeptr = $A1; codeptr++ // LDA (zp,X) + //^codeptr = $C0-1+VX; codeptr++ // ESTKH-1 + codeptr=>4 = $C094+(VX<<8) // STY ESTKH,X + //^codeptr = $94; codeptr++ // STY zp,X + //^codeptr = $C0+VX; codeptr++ // ESTKH //^codeptr = $95; codeptr++ // STA zp,X //^codeptr = $D0+VX; codeptr++ // ESTKL + codeptr = codeptr + 6 A_IS_TOSL = TOSL_DIRTY break - is $62 + is $62 // LW //puts("LW") if not A_IS_TOSL *codeptr = $D0B5+(VX<<8) // LDA ESTKL,X codeptr = codeptr + 2 fin - ^codeptr = $95; codeptr++ // STA zp,X - ^codeptr = $C0-1+VX; codeptr++ // ESTKH-1 - ^codeptr = $A1; codeptr++ // LDA (zp,X) - ^codeptr = $C0-1+VX; codeptr++ // ESTKH-1 - ^codeptr = $95; codeptr++ // STA zp,X - ^codeptr = $D0+VX; codeptr++ // ESTKL - ^codeptr = $F6; codeptr++ // INC zp,X - ^codeptr = $C0-1+VX; codeptr++ // ESTKH-1 - ^codeptr = $D0; codeptr++ // BNE rel - ^codeptr = $02; codeptr++ // +2 - ^codeptr = $F6; codeptr++ // INC zp,X - ^codeptr = $C0+VX; codeptr++ // ESTKH - ^codeptr = $A1; codeptr++ // LDA (zp,X) - ^codeptr = $C0-1+VX; codeptr++ // ESTKH-1 - ^codeptr = $95; codeptr++ // STA zp,X - ^codeptr = $C0+VX; codeptr++ // ESTKH + codeptr=>0 = ($C095-$0100)+(VX<<8) // STA ESTKH-1,X + //^codeptr = $95; codeptr++ // STA zp,X + //^codeptr = $C0-1+VX; codeptr++ // ESTKH-1 + codeptr=>2 = ($C0A1-$0100)+(VX<<8) // LDA (ESTKH-1,X) + //^codeptr = $A1; codeptr++ // LDA (zp,X) + //^codeptr = $C0-1+VX; codeptr++ // ESTKH-1 + codeptr=>4 = $D095+(VX<<8) // STA ESTKL,X + //^codeptr = $95; codeptr++ // STA zp,X + //^codeptr = $D0+VX; codeptr++ // ESTKL + codeptr=>6 = ($C0F6-$0100)+(VX<<8) // INC ESTKH-1,X + //^codeptr = $F6; codeptr++ // INC zp,X + //^codeptr = $C0-1+VX; codeptr++ // ESTKH-1 + codeptr=>8 = $02D0 // BNE +2 + //^codeptr = $D0; codeptr++ // BNE rel + //^codeptr = $02; codeptr++ // +2 + codeptr=>10 = $C0F6+(VX<<8) // INC ESTKH,X + //^codeptr = $F6; codeptr++ // INC zp,X + //^codeptr = $C0+VX; codeptr++ // ESTKH + codeptr=>12 = ($C0A1-$0100)+(VX<<8) // LDA (ESTKH-1,X) + //^codeptr = $A1; codeptr++ // LDA (zp,X) + //^codeptr = $C0-1+VX; codeptr++ // ESTKH-1 + codeptr=>14 = $C095+(VX<<8) // STA ESTKH,X + //^codeptr = $95; codeptr++ // STA zp,X + //^codeptr = $C0+VX; codeptr++ // ESTKH + codeptr = codeptr + 16 A_IS_TOSL = FALSE break - is $64 + is $64 // LLB i++ //puts("LLB "); puti(^(bytecode+i)) if A_IS_TOSL & TOSL_DIRTY *codeptr = $D095+(VX<<8) // STA ESTKL,X codeptr = codeptr + 2 fin - VX-- //^codeptr = $CA; codeptr++ // DEX + VX-- // DEX if ^(bytecode+i) <> 0 - ^codeptr = $A0; codeptr++ // LDY #imm - ^codeptr = ^(bytecode+i); codeptr++ + *codeptr = $A0+(^(bytecode+i)<<8) // LDY #imm + codeptr = codeptr + 2 + //^codeptr = $A0; codeptr++ // LDY #imm + //^codeptr = ^(bytecode+i); codeptr++ fin - ^codeptr = $B1; codeptr++ // LDA (zp),Y - ^codeptr = $E0; codeptr++ // IFP + *codeptr = $E0B1 // LDA (IFP),Y + codeptr = codeptr + 2 + //^codeptr = $B1; codeptr++ // LDA (zp),Y + //^codeptr = $E0; codeptr++ // IFP if ^(bytecode+i) <> 0 - ^codeptr = $A0; codeptr++ // LDY #imm - ^codeptr = $00; codeptr++ // $00 + *codeptr = $00A0 // LDY #$00 + codeptr = codeptr + 2 + //^codeptr = $A0; codeptr++ // LDY #imm + //^codeptr = $00; codeptr++ // $00 fin - ^codeptr = $94; codeptr++ // STY zp,X - ^codeptr = $C0+VX; codeptr++ // ESTKH + *codeptr = $C094+(VX<<8) // STY ESTKH,X + //^codeptr = $94; codeptr++ // STY zp,X + //^codeptr = $C0+VX; codeptr++ // ESTKH //^codeptr = $95; codeptr++ // STA zp,X //^codeptr = $D0+VX; codeptr++ // ESTKL + codeptr = codeptr + 2 A_IS_TOSL = TOSL_DIRTY break - is $66 + is $66 // LLW i++ //puts("LLW "); puti(^(bytecode+i)) if A_IS_TOSL & TOSL_DIRTY *codeptr = $D095+(VX<<8) // STA ESTKL,X codeptr = codeptr + 2 fin - VX-- //^codeptr = $CA; codeptr++ // DEX + VX-- // DEX if ^(bytecode+i) <> 0 - ^codeptr = $A0; codeptr++ // LDY #imm - ^codeptr = ^(bytecode+i); codeptr++ + *codeptr = $A0+(^(bytecode+i)<<8) // LDY #imm + codeptr = codeptr + 2 + //^codeptr = $A0; codeptr++ // LDY #imm + //^codeptr = ^(bytecode+i); codeptr++ fin - ^codeptr = $B1; codeptr++ // LDA (zp),Y - ^codeptr = $E0; codeptr++ // IFP - ^codeptr = $95; codeptr++ // STA zp,X - ^codeptr = $D0+VX; codeptr++ // ESTKL - ^codeptr = $C8; codeptr++ // INY - ^codeptr = $B1; codeptr++ // LDA (zp),Y - ^codeptr = $E0; codeptr++ // IFP - ^codeptr = $95; codeptr++ // STA zp,X - ^codeptr = $C0+VX; codeptr++ // ESTKH + codeptr=>0 = $E0B1 // LDA (IFP),Y + //^codeptr = $B1; codeptr++ // LDA (zp),Y + //^codeptr = $E0; codeptr++ // IFP + codeptr=>2 = $D095+(VX<<8) // STA ESTKL,X + //^codeptr = $95; codeptr++ // STA zp,X + //^codeptr = $D0+VX; codeptr++ // ESTKL + codeptr->4 = $C8 // INY + //^codeptr = $C8; codeptr++ // INY + codeptr=>5 = $E0B1 // LDA (IFP),Y + //^codeptr = $B1; codeptr++ // LDA (zp),Y + //^codeptr = $E0; codeptr++ // IFP + codeptr=>7 = $C095+(VX<<8) // STA ESTKH,X + //^codeptr = $95; codeptr++ // STA zp,X + //^codeptr = $C0+VX; codeptr++ // ESTKH if ^(bytecode+i) <> 0 - ^codeptr = $A0; codeptr++ // LDY #imm - ^codeptr = $00; codeptr++ // $00 + codeptr=>9 = $00A0 // LDY #$00 + codeptr = codeptr + 11 + //^codeptr = $A0; codeptr++ // LDY #imm + //^codeptr = $00; codeptr++ // $00 else - ^codeptr = $88; codeptr++ // DEY + codeptr->9 = $88 // DEY + codeptr = codeptr + 10 + //^codeptr = $88; codeptr++ // DEY fin A_IS_TOSL = FALSE break @@ -1238,13 +1270,17 @@ def compiler(defptr)#0 *codeptr = $D095+(VX<<8) // STA ESTKL,X codeptr = codeptr + 2 fin - VX-- //^codeptr = $CA; codeptr++ // DEX - ^codeptr = $AD; codeptr++ // LDA abs - *codeptr = *(bytecode+i); codeptr = codeptr + 2 - ^codeptr = $94; codeptr++ // STY zp,X - ^codeptr = $C0+VX; codeptr++ // ESTKH + VX-- // DEX + codeptr->0 = $AD // LDA abs + //^codeptr = $AD; codeptr++ // LDA abs + codeptr=>1 = *(bytecode+i) + //*codeptr = *(bytecode+i); codeptr = codeptr + 2 + codeptr=>3 = $C094+(VX<<8) // STY ESTKH,X + //^codeptr = $94; codeptr++ // STY zp,X + //^codeptr = $C0+VX; codeptr++ // ESTKH //^codeptr = $95; codeptr++ // STA zp,X //^codeptr = $D0+VX; codeptr++ // ESTKL + codeptr = codeptr + 5 A_IS_TOSL = TOSL_DIRTY i++ break @@ -1255,15 +1291,21 @@ def compiler(defptr)#0 *codeptr = $D095+(VX<<8) // STA ESTKL,X codeptr = codeptr + 2 fin - VX-- //^codeptr = $CA; codeptr++ // DEX - ^codeptr = $AD; codeptr++ // LDA abs - *codeptr = *(bytecode+i)+1; codeptr = codeptr + 2 - ^codeptr = $95; codeptr++ // STA zp,X - ^codeptr = $C0+VX; codeptr++ // ESTKH - ^codeptr = $AD; codeptr++ // LDA abs - *codeptr = *(bytecode+i); codeptr = codeptr + 2 + VX-- // DEX + codeptr->0 = $AD // LDA abs + //^codeptr = $AD; codeptr++ // LDA abs + codeptr=>1 = *(bytecode+i)+1 + //*codeptr = *(bytecode+i)+1; codeptr = codeptr + 2 + codeptr=>3 = $C095+(VX<<8) // STA ESTKH,X + //^codeptr = $95; codeptr++ // STA zp,X + //^codeptr = $C0+VX; codeptr++ // ESTKH + codeptr->5 = $AD // LDA abs + //^codeptr = $AD; codeptr++ // LDA abs + codeptr=>6 = *(bytecode+i) + //*codeptr = *(bytecode+i); codeptr = codeptr + 2 //^codeptr = $95; codeptr++ // STA zp,X //^codeptr = $D0+VX; codeptr++ // ESTKL + codeptr = codeptr + 8 A_IS_TOSL = TOSL_DIRTY i++ break @@ -1276,14 +1318,20 @@ def compiler(defptr)#0 A_IS_TOSL = TOSL_CLEAN fin if ^(bytecode+i) <> 0 - ^codeptr = $A0; codeptr++ // LDY #imm - ^codeptr = ^(bytecode+i); codeptr++ + *codeptr = $A0+(^(bytecode+i)<<8) // LDY #imm + codeptr = codeptr + 2 + //^codeptr = $A0; codeptr++ // LDY #imm + //^codeptr = ^(bytecode+i); codeptr++ fin - ^codeptr = $91; codeptr++ // STA (zp),Y - ^codeptr = $E0; codeptr++ // IFP + *codeptr = $E091 // STA (IFP),Y + codeptr = codeptr + 2 + //^codeptr = $91; codeptr++ // STA (zp),Y + //^codeptr = $E0; codeptr++ // IFP if ^(bytecode+i) <> 0 - ^codeptr = $A0; codeptr++ // LDY #imm - ^codeptr = $00; codeptr++ // $00 + *codeptr = $00A0 // LDY #$00 + codeptr = codeptr + 2 + //^codeptr = $A0; codeptr++ // LDY #imm + //^codeptr = $00; codeptr++ // $00 fin break is $6E @@ -1294,23 +1342,33 @@ def compiler(defptr)#0 codeptr = codeptr + 2 fin if ^(bytecode+i) <> 0 - ^codeptr = $A0; codeptr++ // LDY #imm - ^codeptr = ^(bytecode+i)+1; codeptr++ + *codeptr = $A0+((^(bytecode+i)+1)<<8) // LDY #imm + codeptr = codeptr + 2 + //^codeptr = $A0; codeptr++ // LDY #imm + //^codeptr = ^(bytecode+i)+1; codeptr++ else ^codeptr = $C8; codeptr++ // INY fin - ^codeptr = $B5; codeptr++ // LDA zp,X - ^codeptr = $C0+VX; codeptr++ // ESTKH - ^codeptr = $91; codeptr++ // STA (zp),Y - ^codeptr = $E0; codeptr++ // IFP - ^codeptr = $88; codeptr++ // DEY - ^codeptr = $B5; codeptr++ // LDA zp,X - ^codeptr = $D0+VX; codeptr++ // ESTKL - ^codeptr = $91; codeptr++ // STA (zp),Y - ^codeptr = $E0; codeptr++ // IFP + codeptr=>0 = $C0B5+(VX<<8) // LDA ESTKH,X + //^codeptr = $B5; codeptr++ // LDA zp,X + //^codeptr = $C0+VX; codeptr++ // ESTKH + codeptr=>2 = $E091 // STA (IFP),Y + //^codeptr = $91; codeptr++ // STA (zp),Y + //^codeptr = $E0; codeptr++ // IFP + codeptr->4 = $88 // DEY + //^codeptr = $88; codeptr++ // DEY + codeptr=>5 = $D0B5+(VX<<8) // LDA ESTKL,X + //^codeptr = $B5; codeptr++ // LDA zp,X + //^codeptr = $D0+VX; codeptr++ // ESTKL + codeptr=>7 = $E091 // STA (IFP),Y + //^codeptr = $91; codeptr++ // STA (zp),Y + //^codeptr = $E0; codeptr++ // IFP + codeptr = codeptr + 9 if ^(bytecode+i) <> 0 - ^codeptr = $A0; codeptr++ // LDY #imm - ^codeptr = $00; codeptr++ // $00 + *codeptr = $00A0 // LDY #$00 + codeptr = codeptr + 2 + //^codeptr = $A0; codeptr++ // LDY #imm + //^codeptr = $00; codeptr++ // $00 fin A_IS_TOSL = TOSL_CLEAN break