8SA1Sim/js/microcode_compiler.js

880 lines
28 KiB
JavaScript

/*
const CONTROL_PCC = 0b00000000000000000000000000000001; // PC CLK UP
const CONTROL_PCI = 0b00000000000000000000000000000010; // PC Input Enable
const CONTROL_SPD = 0b00000000000000000000000000000100; // SP Count Down
const CONTROL_SPC = 0b00000000000000000000000000001000; // SP CLK (UP / DOWN)
const CONTROL_SPI = 0b00000000000000000000000000010000; // SP Input Enable
const CONTROL_RAIL = 0b00000000000000000000000000100000; // GPA LOW Input Enable
const CONTROL_RAIH = 0b00000000000000000000000001000000; // GPA HIGH Input Enable
const CONTROL_RBIL = 0b00000000000000000000000010000000; // GPB LOW Input Enable
const CONTROL_RBIH = 0b00000000000000000000000100000000; // GPB HIGH Input Enable
const CONTROL_RCIL = 0b00000000000000000000001000000000; // GPC LOW Input Enable
const CONTROL_RCIH = 0b00000000000000000000010000000000; // GPC HIGH Input Enable
const CONTROL_RDIL = 0b00000000000000000000100000000000; // GPD LOW Input Enable
const CONTROL_RDIH = 0b00000000000000000001000000000000; // GPD HIGH Input Enable
const CONTROL_RRI = 0b00000000000000000010000000000000; // LOW Ram Register Input Enable
const CONTROL_RHI = 0b00000000000000000100000000000000; // HIGH Ram Register Input Enable
const CONTROL_ALUM0 = 0b00000000000000001000000000000000; // ALU MUX 0
const CONTROL_ALUM1 = 0b00000000000000010000000000000000; // ALU MUX 1
const CONTROL_ALUI = 0b00000000000000100000000000000000; // ALU Invert (high side)
const CONTROL_ALUC = 0b00000000000001000000000000000000; // ALU Carry Input
const CONTROL_ALUSL = 0b00000000000010000000000000000000; // ALU Shift Left
const CONTROL_ALUSR = 0b00000000000100000000000000000000; // ALU Shift Right
const CONTROL_OEM0 = 0b00000000001000000000000000000000; // Output Enable MUX 0
const CONTROL_OEM1 = 0b00000000010000000000000000000000; // Output Enable MUX 1
const CONTROL_OEM2 = 0b00000000100000000000000000000000; // Output Enable MUX 2
const CONTROL_OEM3 = 0b00000001000000000000000000000000; // Output Enable MUX 3
const CONTROL_OEM4 = 0b00000010000000000000000000000000; // Output Enable MUX 4
const CONTROL_OEME = 0b00000100000000000000000000000000; // Output Enable MUX Enable
const CONTROL_RI = 0b00010000000000000000000000000000; // RAM Input Enable
const CONTROL_IRI = 0b00100000000000000000000000000000; // Instruction Register Input Enable
const CONTROL_MCL0 = 0b01000000000000000000000000000000; // Microcode Counter to 0
const CONTROL_MCL8 = 0b10000000000000000000000000000000; // Microcode Counter to 8
*/
const CONTROL_OUT_PC = CONTROL_OEME;
const CONTROL_OUT_SP = CONTROL_OEME | CONTROL_OEM0;
const CONTROL_OUT_AL = CONTROL_OEME | CONTROL_OEM1;
const CONTROL_OUT_AH = CONTROL_OEME | CONTROL_OEM1 | CONTROL_OEM0;
const CONTROL_OUT_BL = CONTROL_OEME | CONTROL_OEM2;
const CONTROL_OUT_BH = CONTROL_OEME | CONTROL_OEM2 | CONTROL_OEM0;
const CONTROL_OUT_CL = CONTROL_OEME | CONTROL_OEM2 | CONTROL_OEM1;
const CONTROL_OUT_CH = CONTROL_OEME | CONTROL_OEM2 | CONTROL_OEM1 | CONTROL_OEM0;
const CONTROL_OUT_DL = CONTROL_OEME | CONTROL_OEM3;
const CONTROL_OUT_DH = CONTROL_OEME | CONTROL_OEM3 | CONTROL_OEM0;
const CONTROL_OUT_AB = CONTROL_OEME | CONTROL_OEM3 | CONTROL_OEM1;
const CONTROL_OUT_CD = CONTROL_OEME | CONTROL_OEM4 | CONTROL_OEM1;
const CONTROL_OUT_AE = CONTROL_OEME | CONTROL_OEM4 | CONTROL_OEM3 | CONTROL_OEM2;
const CONTROL_OUT_AO = CONTROL_OEME | CONTROL_OEM4 | CONTROL_OEM3 | CONTROL_OEM2 | CONTROL_OEM0;
const CONTROL_OUT_RO = CONTROL_OEME | CONTROL_OEM4 | CONTROL_OEM3 | CONTROL_OEM2 | CONTROL_OEM1 | CONTROL_OEM0;
const CONTROL_ALU_ADD = CONTROL_OUT_AE;
const CONTROL_ALU_SUB = CONTROL_OUT_AE | CONTROL_ALUI | CONTROL_ALUC;
const CONTROL_ALU_NOT = CONTROL_OUT_AE | CONTROL_ALUI;
const CONTROL_ALU_AND = CONTROL_OUT_AE | CONTROL_ALUM0;
const CONTROL_ALU_NAND = CONTROL_OUT_AE | CONTROL_ALUM0 | CONTROL_ALUI;
const CONTROL_ALU_OR = CONTROL_OUT_AE | CONTROL_ALUM1;
const CONTROL_ALU_NOR = CONTROL_OUT_AE | CONTROL_ALUM1 | CONTROL_ALUI;
const CONTROL_ALU_XOR = CONTROL_OUT_AE | CONTROL_ALUM1 | CONTROL_ALUM0;
const CONTROL_ALU_XNOR = CONTROL_OUT_AE | CONTROL_ALUM1 | CONTROL_ALUM0 | CONTROL_ALUI;
let Instructions = new Array();
function FindInstructon(ins) {
for (let a = 0; a < Instructions.length; a++) {
if (Instructions[a].Mnemonic.toLowerCase() === ins.Instruction.toLowerCase()) {
return Instructions[a];
}
}
return false;
}
function GenerateMicrocode(mcarray,cpu) {
for (let a = 0; a < mcarray.length; a++) {
for (let c = 0; c < 3; c++) {
let offset = 0;
if (c === 1) offset = 0b1000000000000000;
if (c === 2) offset = 0b0100000000000000;
for (let b = 0; b < 16; b++) {
let bytecode = mcarray[a].Bytecode;
let mca = mcarray[a].Bytecode << 4;
mca |= b;
let mcv = mcarray[a].Microcode[b];
if (mcarray[a].UsesZero && c === 1) mcv = mcarray[a].MicrocodeZero[b];
if (mcarray[a].UsesCarry && c === 2) mcv = mcarray[a].MicrocodeCarry[b];
cpu.MCRAM[offset + mca] = mcv;
//console.log(`[${bytecode.toString(16)}] ${mca.toString(16)}: ${mcv.toString(2)}`);
}
}
}
}
class Microcode_Instruction {
constructor() {
this.Bytecode = 0x000; // MAX IS 0x3ff
this.Mnemonic = "NOP";
this.Microcode = new Array(16);
this.UsesCarry = false;
this.UsesZero = false;
this.Microcode[0] = CONTROL_OUT_PC | CONTROL_RRI;
this.Microcode[1] = CONTROL_OUT_RO | CONTROL_IRI | CONTROL_PCC;
for (let a = 2; a < 16; a++) {
this.Microcode[a] = CONTROL_MCL0;
}
}
}
class IS_LDA_imm extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x000;
this.Mnemonic = "LDA";
this.Microcode[2] = CONTROL_OUT_PC | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_RO | CONTROL_RAIL | CONTROL_PCC;
}
}
is_LDA_i = new IS_LDA_imm;
Instructions.push(is_LDA_i);
class IS_LDB_imm extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x001;
this.Mnemonic = "LDB";
this.Microcode[2] = CONTROL_OUT_PC | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_RO | CONTROL_RBIL | CONTROL_PCC;
}
}
is_LDB_i = new IS_LDB_imm;
Instructions.push(is_LDB_i);
class IS_LDC_imm extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x002;
this.Mnemonic = "LDC";
this.Microcode[2] = CONTROL_OUT_PC | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_RO | CONTROL_RCIL | CONTROL_PCC;
}
}
is_LDC_i = new IS_LDC_imm;
Instructions.push(is_LDC_i);
class IS_LDD_imm extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x003;
this.Mnemonic = "LDD";
this.Microcode[2] = CONTROL_OUT_PC | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_RO | CONTROL_RDIL | CONTROL_PCC;
}
}
is_LDD_i = new IS_LDD_imm;
Instructions.push(is_LDD_i);
class IS_LDAB_GPCD extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x020;
this.Mnemonic = "LDAB";
this.Microcode[2] = CONTROL_OUT_CD | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_RO | CONTROL_RAIL | CONTROL_RBIH;
}
}
is_LDAB_GPCD = new IS_LDAB_GPCD;
Instructions.push(is_LDAB_GPCD);
class IS_LDAB_imm extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x021;
this.Mnemonic = "LDAB";
this.Microcode[2] = CONTROL_OUT_PC | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_RO | CONTROL_RAIL | CONTROL_RBIH | CONTROL_PCC;
}
}
is_LDAB_i = new IS_LDAB_imm;
Instructions.push(is_LDAB_i);
class IS_STAL_imm extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x004;
this.Mnemonic = "STAL";
this.Microcode[2] = CONTROL_OUT_PC | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_RO | CONTROL_RRI | CONTROL_PCC;
this.Microcode[4] = CONTROL_OUT_AL | CONTROL_RI;
}
}
is_STAL_i = new IS_STAL_imm;
Instructions.push(is_STAL_i);
class IS_STAH_imm extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x005;
this.Mnemonic = "STAH";
this.Microcode[2] = CONTROL_OUT_PC | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_RO | CONTROL_RRI | CONTROL_PCC;
this.Microcode[4] = CONTROL_OUT_AH | CONTROL_RI;
}
}
is_STAH_i = new IS_STAH_imm;
Instructions.push(is_STAH_i);
class IS_STBL_imm extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x006;
this.Mnemonic = "STBL";
this.Microcode[2] = CONTROL_OUT_PC | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_RO | CONTROL_RRI | CONTROL_PCC;
this.Microcode[4] = CONTROL_OUT_BL | CONTROL_RI;
}
}
is_STBL_i = new IS_STBL_imm;
Instructions.push(is_STBL_i);
class IS_STBH_imm extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x007;
this.Mnemonic = "STBH";
this.Microcode[2] = CONTROL_OUT_PC | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_RO | CONTROL_RRI | CONTROL_PCC;
this.Microcode[4] = CONTROL_OUT_BH | CONTROL_RI;
}
}
is_STBH_i = new IS_STBH_imm;
Instructions.push(is_STBH_i);
class IS_STCL_imm extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x008;
this.Mnemonic = "STCL";
this.Microcode[2] = CONTROL_OUT_PC | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_RO | CONTROL_RRI | CONTROL_PCC;
this.Microcode[4] = CONTROL_OUT_CL | CONTROL_RI;
}
}
is_STCL_i = new IS_STCL_imm;
Instructions.push(is_STCL_i);
class IS_STCH_imm extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x009;
this.Mnemonic = "STCH";
this.Microcode[2] = CONTROL_OUT_PC | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_RO | CONTROL_RRI | CONTROL_PCC;
this.Microcode[4] = CONTROL_OUT_CH | CONTROL_RI;
}
}
is_STCH_i = new IS_STCH_imm;
Instructions.push(is_STCH_i);
class IS_STDL_imm extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x00A;
this.Mnemonic = "STDL";
this.Microcode[2] = CONTROL_OUT_PC | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_RO | CONTROL_RRI | CONTROL_PCC;
this.Microcode[4] = CONTROL_OUT_DL | CONTROL_RI;
}
}
is_STDL_i = new IS_STDL_imm;
Instructions.push(is_STDL_i);
class IS_STDH_imm extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x00B;
this.Mnemonic = "STDH";
this.Microcode[2] = CONTROL_OUT_PC | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_RO | CONTROL_RRI | CONTROL_PCC;
this.Microcode[4] = CONTROL_OUT_DH | CONTROL_RI;
}
}
is_STDH_i = new IS_STDH_imm;
Instructions.push(is_STDH_i);
class IS_STAB_imm extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x00C;
this.Mnemonic = "STAB";
this.Microcode[2] = CONTROL_OUT_PC | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_RO | CONTROL_RRI | CONTROL_PCC;
this.Microcode[4] = CONTROL_OUT_AB | CONTROL_RI;
}
}
is_STAB_i = new IS_STAB_imm;
Instructions.push(is_STAB_i);
class IS_STAB_sp extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x00D;
this.Mnemonic = "STAB";
this.Microcode[2] = CONTROL_SPC;
this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI;
this.Microcode[4] = CONTROL_OUT_RO | CONTROL_RRI | CONTROL_SPD | CONTROL_SPC;
this.Microcode[5] = CONTROL_OUT_AB | CONTROL_RI;
}
}
is_STAB_sp = new IS_STAB_sp;
Instructions.push(is_STAB_sp);
class IS_TAB extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x040;
this.Mnemonic = "TAB";
this.Microcode[2] = CONTROL_OUT_AL | CONTROL_RBIL;
}
}
is_TAB = new IS_TAB;
Instructions.push(is_TAB);
class IS_TAC extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x041;
this.Mnemonic = "TAC";
this.Microcode[2] = CONTROL_OUT_AL | CONTROL_RCIL;
}
}
is_TAC = new IS_TAC;
Instructions.push(is_TAC);
class IS_TAD extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x042;
this.Mnemonic = "TAD";
this.Microcode[2] = CONTROL_OUT_AL | CONTROL_RDIL;
}
}
is_TAD = new IS_TAD;
Instructions.push(is_TAD);
class IS_TBA extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x043;
this.Mnemonic = "TBA";
this.Microcode[2] = CONTROL_OUT_BL | CONTROL_RAIL;
}
}
is_TBA = new IS_TBA;
Instructions.push(is_TBA);
class IS_TBC extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x044;
this.Mnemonic = "TBC";
this.Microcode[2] = CONTROL_OUT_BL | CONTROL_RCIL;
}
}
is_TBC = new IS_TBC;
Instructions.push(is_TBC);
class IS_TBD extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x045;
this.Mnemonic = "TBD";
this.Microcode[2] = CONTROL_OUT_BL | CONTROL_RDIL;
}
}
is_TBD = new IS_TBD;
Instructions.push(is_TBD);
class IS_TCA extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x046;
this.Mnemonic = "TCA";
this.Microcode[2] = CONTROL_OUT_CL | CONTROL_RAIL;
}
}
is_TCA = new IS_TCA;
Instructions.push(is_TCA);
class IS_TCB extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x047;
this.Mnemonic = "TCB";
this.Microcode[2] = CONTROL_OUT_CL | CONTROL_RBIL;
}
}
is_TCB = new IS_TCB;
Instructions.push(is_TCB);
class IS_TCD extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x048;
this.Mnemonic = "TCD";
this.Microcode[2] = CONTROL_OUT_CL | CONTROL_RDIL;
}
}
is_TCD = new IS_TCD;
Instructions.push(is_TCD);
class IS_TDA extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x049;
this.Mnemonic = "TDA";
this.Microcode[2] = CONTROL_OUT_DL | CONTROL_RAIL;
}
}
is_TDA = new IS_TDA;
Instructions.push(is_TDA);
class IS_TDB extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x04A;
this.Mnemonic = "TDB";
this.Microcode[2] = CONTROL_OUT_DL | CONTROL_RBIL;
}
}
is_TDB = new IS_TDB;
Instructions.push(is_TDB);
class IS_TDC extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x04B;
this.Mnemonic = "TDC";
this.Microcode[2] = CONTROL_OUT_DL | CONTROL_RCIL;
}
}
is_TDC = new IS_TDC;
Instructions.push(is_TDC);
// This is a simple ADD command which will ADD GPA and GPB putting the sum in GPA
class IS_ADD extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x100;
this.Mnemonic = "ADD";
this.Microcode[2] = CONTROL_ALU_ADD;
this.Microcode[3] = CONTROL_RAIL | CONTROL_OUT_AO;
}
}
is_ADD = new IS_ADD;
Instructions.push(is_ADD);
class IS_SUB extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x101;
this.Mnemonic = "SUB";
this.Microcode[2] = CONTROL_ALU_SUB;
this.Microcode[3] = CONTROL_RAIL | CONTROL_OUT_AO;
}
}
is_SUB = new IS_SUB;
Instructions.push(is_SUB);
class IS_NOT extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x102;
this.Mnemonic = "NOT";
this.Microcode[2] = CONTROL_OUT_SP | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_AL | CONTROL_RI | CONTROL_SPD | CONTROL_SPC;
this.Microcode[4] = CONTROL_RAIL;
this.Microcode[5] = CONTROL_ALU_NOT;
this.Microcode[6] = CONTROL_RBIL | CONTROL_OUT_AO | CONTROL_SPC;
this.Microcode[7] = CONTROL_OUT_SP | CONTROL_RRI;
this.Microcode[8] = CONTROL_OUT_RO | CONTROL_RAIL;
}
}
is_NOT = new IS_NOT;
Instructions.push(is_NOT);
class IS_FNOT extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x103;
this.Mnemonic = "FNOT";
this.Microcode[2] = CONTROL_ALU_NOT;
this.Microcode[3] = CONTROL_RBIL | CONTROL_OUT_AO | CONTROL_SPC;
}
}
is_FNOT = new IS_FNOT;
Instructions.push(is_FNOT);
class IS_AND extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x104;
this.Mnemonic = "AND";
this.Microcode[2] = CONTROL_ALU_AND;
this.Microcode[3] = CONTROL_RAIL | CONTROL_OUT_AO | CONTROL_SPC;
}
}
is_AND = new IS_AND;
Instructions.push(is_AND);
class IS_NAND extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x105;
this.Mnemonic = "NAND";
this.Microcode[2] = CONTROL_ALU_NAND;
this.Microcode[3] = CONTROL_RAIL | CONTROL_OUT_AO | CONTROL_SPC;
}
}
is_NAND = new IS_NAND;
Instructions.push(is_NAND);
class IS_OR extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x106;
this.Mnemonic = "OR";
this.Microcode[2] = CONTROL_ALU_OR;
this.Microcode[3] = CONTROL_RAIL | CONTROL_OUT_AO | CONTROL_SPC;
}
}
is_OR = new IS_OR;
Instructions.push(is_OR);
class IS_NOR extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x107;
this.Mnemonic = "NOR";
this.Microcode[2] = CONTROL_ALU_NOR;
this.Microcode[3] = CONTROL_RAIL | CONTROL_OUT_AO | CONTROL_SPC;
}
}
is_NOR = new IS_NOR;
Instructions.push(is_NOR);
class IS_XOR extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x108;
this.Mnemonic = "XOR";
this.Microcode[2] = CONTROL_ALU_XOR;
this.Microcode[3] = CONTROL_RAIL | CONTROL_OUT_AO | CONTROL_SPC;
}
}
is_XOR = new IS_XOR;
Instructions.push(is_XOR);
class IS_XNOR extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x109;
this.Mnemonic = "XNOR";
this.Microcode[2] = CONTROL_ALU_XNOR;
this.Microcode[3] = CONTROL_RAIL | CONTROL_OUT_AO | CONTROL_SPC;
}
}
is_XNOR = new IS_XNOR;
Instructions.push(is_XNOR);
class IS_CMP extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x110;
this.Mnemonic = "CMP";
this.Microcode[2] = CONTROL_ALU_ADD;
this.Microcode[3] = CONTROL_MCL0;
}
}
is_CMP = new IS_CMP;
Instructions.push(is_CMP);
class IS_PHA extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x180;
this.Mnemonic = "PHA";
this.Microcode[2] = CONTROL_OUT_SP | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_AL | CONTROL_RI | CONTROL_SPD | CONTROL_SPC;
}
}
is_PHA = new IS_PHA;
Instructions.push(is_PHA);
class IS_PHB extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x181;
this.Mnemonic = "PHB";
this.Microcode[2] = CONTROL_OUT_SP | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_BL | CONTROL_RI | CONTROL_SPD | CONTROL_SPC;
}
}
is_PHB = new IS_PHB;
Instructions.push(is_PHB);
class IS_PHC extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x182;
this.Mnemonic = "PHC";
this.Microcode[2] = CONTROL_OUT_SP | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_CL | CONTROL_RI | CONTROL_SPD | CONTROL_SPC;
}
}
is_PHC = new IS_PHC;
Instructions.push(is_PHC);
class IS_PHD extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x183;
this.Mnemonic = "PHD";
this.Microcode[2] = CONTROL_OUT_SP | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_DL | CONTROL_RI | CONTROL_SPD | CONTROL_SPC;
}
}
is_PHD = new IS_PHD;
Instructions.push(is_PHD);
class IS_PHAB extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x184;
this.Mnemonic = "PHAB";
this.Microcode[2] = CONTROL_OUT_SP | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_AB | CONTROL_RI | CONTROL_SPD | CONTROL_SPC;
}
}
is_PHAB = new IS_PHAB;
Instructions.push(is_PHAB);
class IS_PHCD extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x185;
this.Mnemonic = "PHCD";
this.Microcode[2] = CONTROL_OUT_SP | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_CD | CONTROL_RI | CONTROL_SPD | CONTROL_SPC;
}
}
is_PHCD = new IS_PHCD;
Instructions.push(is_PHCD);
class IS_PLA extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x1A0;
this.Mnemonic = "PLA";
this.Microcode[2] = CONTROL_SPC;
this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI;
this.Microcode[4] = CONTROL_OUT_RO | CONTROL_RAIL;
}
}
is_PLA = new IS_PLA;
Instructions.push(is_PLA);
class IS_PLB extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x1A1;
this.Mnemonic = "PLB";
this.Microcode[2] = CONTROL_SPC;
this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI;
this.Microcode[4] = CONTROL_OUT_RO | CONTROL_RBIL;
}
}
is_PLB = new IS_PLB;
Instructions.push(is_PLB);
class IS_PLC extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x1A2;
this.Mnemonic = "PLC";
this.Microcode[2] = CONTROL_SPC;
this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI;
this.Microcode[4] = CONTROL_OUT_RO | CONTROL_RCIL;
}
}
is_PLC = new IS_PLC;
Instructions.push(is_PLC);
class IS_PLD extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x1A3;
this.Mnemonic = "PLD";
this.Microcode[2] = CONTROL_SPC;
this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI;
this.Microcode[4] = CONTROL_OUT_RO | CONTROL_RDIL;
}
}
is_PLD = new IS_PLD;
Instructions.push(is_PLD);
class IS_PLAB extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x1A4;
this.Mnemonic = "PLAB";
this.Microcode[2] = CONTROL_SPC;
this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI;
this.Microcode[4] = CONTROL_OUT_RO | CONTROL_RAIL | CONTROL_RBIH;
}
}
is_PLAB = new IS_PLAB;
Instructions.push(is_PLAB);
class IS_PLCD extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x1A5;
this.Mnemonic = "PLCD";
this.Microcode[2] = CONTROL_SPC;
this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI;
this.Microcode[4] = CONTROL_OUT_RO | CONTROL_RCIL | CONTROL_RDIH;
}
}
is_PLCD = new IS_PLCD;
Instructions.push(is_PLCD);
class IS_JMP_imm extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x200;
this.Mnemonic = "JMP";
this.Microcode[2] = CONTROL_OUT_PC | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_RO | CONTROL_PCI;
}
}
is_JMP_i = new IS_JMP_imm;
Instructions.push(is_JMP_i);
class IS_BCC_imm extends Microcode_Instruction {
constructor(props) {
super(props);
this.UsesCarry = true;
this.Bytecode = 0x201;
this.Mnemonic = "BCC";
this.MicrocodeCarry = new Array(16);
for (let a = 0; a < 16; a++) {
this.MicrocodeCarry[a] = this.Microcode[a];
}
this.Microcode[2] = CONTROL_OUT_PC | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_RO | CONTROL_PCI;
this.MicrocodeCarry[2] = CONTROL_PCC; // Step over the immediate value
}
}
is_BCC_i = new IS_BCC_imm;
Instructions.push(is_BCC_i);
class IS_BCS_imm extends Microcode_Instruction {
constructor(props) {
super(props);
this.UsesCarry = true;
this.Bytecode = 0x202;
this.Mnemonic = "BCS";
this.MicrocodeCarry = new Array(16);
for (let a = 0; a < 16; a++) {
this.MicrocodeCarry[a] = this.Microcode[a];
}
this.Microcode[2] = CONTROL_PCC; // Step over the immediate value
this.MicrocodeCarry[2] = CONTROL_OUT_PC | CONTROL_RRI;
this.MicrocodeCarry[3] = CONTROL_OUT_RO | CONTROL_PCI;
}
}
is_BCS_i = new IS_BCS_imm;
Instructions.push(is_BCS_i);
class IS_BEQ_imm extends Microcode_Instruction {
constructor(props) {
super(props);
this.UsesZero = true;
this.Bytecode = 0x203;
this.Mnemonic = "BEQ";
this.MicrocodeZero = new Array(16);
for (let a = 0; a < 16; a++) {
this.MicrocodeZero[a] = this.Microcode[a];
}
this.Microcode[2] = CONTROL_PCC; // Step over the immediate value
this.MicrocodeZero[2] = CONTROL_OUT_PC | CONTROL_RRI;
this.MicrocodeZero[3] = CONTROL_OUT_RO | CONTROL_PCI;
}
}
is_BEQ_i = new IS_BEQ_imm;
Instructions.push(is_BEQ_i);
class IS_BNE_imm extends Microcode_Instruction {
constructor(props) {
super(props);
this.UsesZero = true;
this.Bytecode = 0x204;
this.Mnemonic = "BNE";
this.MicrocodeZero = new Array(16);
for (let a = 0; a < 16; a++) {
this.MicrocodeZero[a] = this.Microcode[a];
}
this.MicrocodeZero[2] = CONTROL_PCC; // Step over the immediate value
this.Microcode[2] = CONTROL_OUT_PC | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_RO | CONTROL_PCI;
}
}
is_BNE_i = new IS_BNE_imm;
Instructions.push(is_BNE_i);
class IS_JSR extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x205;
this.Mnemonic = "JSR";
this.Microcode[2] = CONTROL_OUT_SP | CONTROL_RRI;
this.Microcode[3] = CONTROL_OUT_PC | CONTROL_RI | CONTROL_SPD | CONTROL_SPC;
this.Microcode[4] = CONTROL_OUT_PC | CONTROL_RRI;
this.Microcode[5] = CONTROL_OUT_RO | CONTROL_PCI;
}
}
is_JSR = new IS_JSR;
Instructions.push(is_JSR);
class IS_RTS extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x206;
this.Mnemonic = "RTS";
this.Microcode[2] = CONTROL_SPC;
this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI;
this.Microcode[4] = CONTROL_OUT_RO | CONTROL_PCI;
this.Microcode[5] = CONTROL_PCC;
}
}
is_RTS = new IS_RTS;
Instructions.push(is_RTS);
class IS_NOP extends Microcode_Instruction {
constructor(props) {
super(props);
this.Bytecode = 0x3ff;
this.Mnemonic = "NOP";
}
}
is_NOP = new IS_NOP;
Instructions.push(is_NOP);