From 3943201db1a09fb57d60b63a58c50c3df87d671e Mon Sep 17 00:00:00 2001 From: MatCat Date: Mon, 5 Apr 2021 02:49:12 -0700 Subject: [PATCH] Added many instructions and some UI improvements --- index.html | 31 +-- js/cpu.js | 106 ++++++++-- js/main.js | 85 +++++++- js/microcode_compiler.js | 418 ++++++++++++++++++++++++++++++++++++++- 4 files changed, 606 insertions(+), 34 deletions(-) diff --git a/index.html b/index.html index 4982290..da91aec 100644 --- a/index.html +++ b/index.html @@ -6,48 +6,49 @@
-
- ADDRESS: -
DATA:
- PC: + PC  :
- MCC: + MCC :
- CO: + CO  :
- SP: + SP  :
- SR: + SR  :
- IR: + IR  :
- GPA: + GPA :
- GPB: + GPB :
- GPC: + GPC :
- GPD: + GPD :
- 0 + 0 0x
- RAM:
+ Text Output (0x8000-0x83ff):
+ +
+
+ RAM : []
RAM (STACK):
diff --git a/js/cpu.js b/js/cpu.js index b763049..d268e44 100644 --- a/js/cpu.js +++ b/js/cpu.js @@ -1,4 +1,17 @@ -function formatHex(value,places) { +let intval = null; +let breakpt = null; + +function stringToRAM(rstring,ram,address) { + for (let a = 0; a < rstring.length; a++) { + ram[address+a] = rstring.charCodeAt(a); + } +} + +function reverseString(str) { + return str.split("").reverse().join(""); +} + +function formatHex(value,places,spaces=0) { let hexval = parseInt(value,10).toString(16).toUpperCase(); if (hexval.length < places) { let placecount = (places - hexval.length); @@ -6,6 +19,39 @@ function formatHex(value,places) { hexval = "0" + hexval; } } + if (spaces > 0) { + hexval = reverseString(hexval); + let newhexval = ""; + for (let a = 0; a < hexval.length; a++) { + newhexval += hexval.substring(a,a+1); + if ((a % spaces) === 3 && a !== hexval.length-1) newhexval += " "; + } + hexval = reverseString(newhexval); + } + return hexval; +} + +function formatBinary(value,places,spaces=0,labels = false) { + let hexval = parseInt(value,10).toString(2); + if (hexval.length < places) { + let placecount = (places - hexval.length); + for (let a = 0; a < placecount; a++) { + hexval = "0" + hexval; + } + } + if (spaces > 0) { + hexval = reverseString(hexval); + let newhexval = ""; + for (let a = 0; a < hexval.length; a++) { + if (labels) { + newhexval += reverseString(``) + hexval.substring(a,a+1) + reverseString(``); + } else { + newhexval += hexval.substring(a,a+1); + } + if ((a % spaces) === 3 && a !== hexval.length-1) newhexval += " "; + } + hexval = reverseString(newhexval); + } return hexval; } @@ -26,6 +72,34 @@ function generateClocks(clk_cnt) { } } +function generateClocks_Interval() { +/* if (cpu._CLK) { + cpu.CLOCK(false); + } else { + cpu.CLOCK(true); + }*/ + cpu.CLOCK(true); + cpu.CLOCK(false); + + updateHTML(); + if (cpu.ADDRBUS === breakpt) clearInterval(intval); +} + +function RunUntilBreak(addr) { + breakpt = addr; + intval = setInterval(function(){ + generateClocks_Interval(); + }, 1); +} + +function printTextOut(ram,startaddr,endaddr) { + let outString = ""; + for (let a = startaddr; a <= endaddr; a++) { + if (ram[a] === 0) return outString; // kill on null + outString += String.fromCharCode(ram[a]); + } +} + function printRAM(ram) { let sp_ram = document.getElementById("RAM"); let ramtext = "ADDR  :   0    1    2    3    4    5    6    7    8    9    A    B    C    D    E    F
"; @@ -56,30 +130,32 @@ function printRAM(ram) { function updateHTML() { let sp_addr = document.getElementById("Address_BUS"); - sp_addr.innerText = "0x" + cpu.ADDRBUS.toString(16).toUpperCase(); + sp_addr.innerText = "0x" + formatHex(cpu.ADDRBUS,6); let sp_data = document.getElementById("Data_BUS"); - sp_data.innerText = "0x" + cpu.DATABUS.toString(16).toUpperCase(); + sp_data.innerText = "0x" + formatHex(cpu.DATABUS,4); let sp_pc = document.getElementById("PC_Register"); - sp_pc.innerText = "0x" + cpu.PC.toString(16).toUpperCase(); + sp_pc.innerText = "0x" + formatHex(cpu.PC,4); let sp_mcc = document.getElementById("MCC_Register"); sp_mcc.innerText = "0x" + cpu.MCC.toString(16).toUpperCase(); let sp_co = document.getElementById("CO_Register"); - sp_co.innerText = "0b" + cpu.MC_Controls.toString(2); + sp_co.innerHTML = "0b" + formatBinary(cpu.MC_Controls,32,4,["Microcode Counter Reset to 8","Microcode Counter Reset to 0","Instruction Register Input Enable","RAM Input Enable","","Output MUX Enable","Output Enable MUX4","Output Enable MUX3","Output Enable MUX2","Output Enable MUX1","Output Enable MUX0","ALU Shift Right","ALU Shift Left","ALU Carry","ALU Invert B","ALU MUX1","ALU MUX0","RAM Address High Byte Input Enable","RAM Address Register Input Enable","GPD High Byte Input Enable","GPD Low Byte Input Enable","GPC High Byte Input Enable","GPC Low Byte Input Enable","GPB High Byte Input Enable","GPB Low Byte Input Enable","GPA High Byte Input Enable","GPA Low Byte Input Enable","SP Input Enable","SP Counter Clock","SP Decrement","PC Input Enable","PC Increment"]); let sp_sp = document.getElementById("SP_Register"); - sp_sp.innerText = "0x" + cpu.SP.toString(16).toUpperCase(); + sp_sp.innerText = "0x" + formatHex(cpu.SP,4); let sp_sr = document.getElementById("SR_Register"); - sp_sr.innerText = "0b" + cpu.SR.toString(2); + sp_sr.innerHTML = "0b" + formatBinary(cpu.SR,8,4,["","","","","","Negative","Zero","Carry"]); let sp_ir = document.getElementById("IR_Register"); - sp_ir.innerText = "0b" + cpu.IR.toString(2) + " (" + GetMnemonic(Instructions,cpu.IR) + ")"; + sp_ir.innerText = "0b" + formatBinary(cpu.IR,16,4) + " (" + GetMnemonic(Instructions,cpu.IR) + ")"; let sp_gpa = document.getElementById("GPA_Register"); - sp_gpa.innerText = "0x" + cpu.GPA.toString(16).toUpperCase(); + sp_gpa.innerText = "0x" + formatHex(cpu.GPA,2); let sp_gpb = document.getElementById("GPB_Register"); - sp_gpb.innerText = "0x" + cpu.GPB.toString(16).toUpperCase(); + sp_gpb.innerText = "0x" + formatHex(cpu.GPB,2); let sp_gpc = document.getElementById("GPC_Register"); - sp_gpc.innerText = "0x" + cpu.GPC.toString(16).toUpperCase(); + sp_gpc.innerText = "0x" + formatHex(cpu.GPC,2); let sp_gpd = document.getElementById("GPD_Register"); - sp_gpd.innerText = "0x" + cpu.GPD.toString(16).toUpperCase(); + sp_gpd.innerText = "0x" + formatHex(cpu.GPD,2); printRAM(cpu.RAM); + let sp_textout = document.getElementById("TEXT_OUT"); + sp_textout.innerText = printTextOut(cpu.RAM,0x8000,0x83ff); } // Setup a few bitmasks we can use in the code that are handy to clean inputs to registers const BITMASK_8 = 0x00000000000000ff; @@ -242,15 +318,15 @@ class CPU_8SA1 { this.DATABUS = 0; this.MCC += 1; if (this.MCC > 15) this.MCC = 0; - let mcra = ((this.IR & 0b0000001111111111) << 4) | this.MCC | ((this.SR & 0b00000011) << 15); + let mcra = ((this.IR & 0b0000001111111111) << 4) | this.MCC | ((this.SR & 0b00000011) << 14); let MC_Controls = this.MCRAM[mcra]; if (MC_Controls & CONTROL_MCL0) this.MCC = 0; if (MC_Controls & CONTROL_MCL8) this.MCC = 8; if (MC_Controls & CONTROL_MCL0) console.log(`Reset microcode counter to 0`); if (MC_Controls & CONTROL_MCL8) console.log(`Reset microcode counter to 8`); - mcra = ((this.IR & 0b0000001111111111) << 4) | this.MCC | ((this.SR & 0b00000011) << 15); + mcra = ((this.IR & 0b0000001111111111) << 4) | this.MCC | ((this.SR & 0b00000011) << 14); MC_Controls = this.MCRAM[mcra]; - + if (MC_Controls === undefined) MC_Controls = 0; console.log(`[${mcra.toString(2)}] Control Lines: ${MC_Controls.toString(2)}`); if (MC_Controls !== this.MC_Controls) { if (MC_Controls & CONTROL_OEME) { diff --git a/js/main.js b/js/main.js index a0a8144..b7a42a2 100644 --- a/js/main.js +++ b/js/main.js @@ -1,6 +1,7 @@ let cpu = new CPU_8SA1(); GenerateMicrocode(Instructions,cpu); -cpu.RAM[0] = is_LDA_i.Bytecode; + +/*cpu.RAM[0] = is_LDA_i.Bytecode; cpu.RAM[1] = 0; cpu.RAM[2] = is_LDB_i.Bytecode; cpu.RAM[3] = 100; @@ -13,10 +14,87 @@ cpu.RAM[9] = is_STDL_i.Bytecode; cpu.RAM[10] = 0x69; cpu.RAM[11] = is_PHD.Bytecode; cpu.RAM[12] = is_PLC.Bytecode; +*/ +/*cpu.RAM[0] = is_JSR.Bytecode; +cpu.RAM[1] = 0x40; +cpu.RAM[2] = is_LDA_i.Bytecode; +cpu.RAM[3] = 0x20; +cpu.RAM[4] = is_PLB.Bytecode; +cpu.RAM[5] = is_ADD.Bytecode; +cpu.RAM[0x40] = is_PLAB.Bytecode; +cpu.RAM[0x41] = is_LDC_i.Bytecode; +cpu.RAM[0x42] = 0x22; +cpu.RAM[0x43] = is_PHC.Bytecode; +cpu.RAM[0x44] = is_PHAB.Bytecode; +cpu.RAM[0x45] = is_RTS.Bytecode;*/ +/*cpu.RAM[0] = is_LDA_i.Bytecode; +cpu.RAM[1] = 0x0; +cpu.RAM[2] = is_LDB_i.Bytecode; +cpu.RAM[3] = 0; +cpu.RAM[4] = is_CMP.Bytecode; +*/ + +cpu.RAM[0] = is_LDAB_i.Bytecode; +cpu.RAM[1] = 0x0050; +cpu.RAM[2] = is_PHAB.Bytecode; +cpu.RAM[3] = is_JSR.Bytecode; +cpu.RAM[4] = 0x00D0; + +cpu.RAM[0xD0] = is_PLAB.Bytecode; +cpu.RAM[0xD1] = is_PLCD.Bytecode; +cpu.RAM[0xD2] = is_PHAB.Bytecode; +cpu.RAM[0xD3] = is_LDAB_i.Bytecode; +cpu.RAM[0xD4] = 0x8000; +cpu.RAM[0xD5] = is_PHAB.Bytecode; +cpu.RAM[0xD6] = is_LDAB_GPCD.Bytecode; +cpu.RAM[0xD7] = is_CMP.Bytecode; +cpu.RAM[0xD8] = is_BEQ_i.Bytecode; +cpu.RAM[0xD9] = 0x00FB; +cpu.RAM[0xDA] = is_STAB_sp.Bytecode; +cpu.RAM[0xDB] = is_TCA.Bytecode; +cpu.RAM[0xDC] = is_LDB_i.Bytecode; +cpu.RAM[0xDD] = 1; +cpu.RAM[0xDE] = is_ADD.Bytecode; +cpu.RAM[0xDF] = is_BCS_i.Bytecode; +cpu.RAM[0xE0] = 0x00EC; +cpu.RAM[0xE1] = is_TAC.Bytecode; +cpu.RAM[0xE2] = is_PLAB.Bytecode; +cpu.RAM[0xE3] = is_PHCD.Bytecode; +cpu.RAM[0xE4] = is_TBC.Bytecode; +cpu.RAM[0xE5] = is_LDB_i.Bytecode; +cpu.RAM[0xE6] = 1; +cpu.RAM[0xE7] = is_ADD.Bytecode; +cpu.RAM[0xE8] = is_TCB.Bytecode; +cpu.RAM[0xE9] = is_PLCD.Bytecode; +cpu.RAM[0xEA] = is_JMP_i.Bytecode; +cpu.RAM[0xEB] = 0x00D5; +cpu.RAM[0xEC] = is_TAC.Bytecode; +cpu.RAM[0xED] = is_TDA.Bytecode; +cpu.RAM[0xEE] = is_LDB_i.Bytecode; +cpu.RAM[0xEF] = 1; +cpu.RAM[0xF0] = is_ADD.Bytecode; +cpu.RAM[0xF1] = is_TAD.Bytecode; +cpu.RAM[0xF2] = is_PLAB.Bytecode; +cpu.RAM[0xF3] = is_LDA_i.Bytecode; +cpu.RAM[0xF4] = 1; +cpu.RAM[0xF5] = is_ADD.Bytecode; +cpu.RAM[0xF6] = is_TAB.Bytecode; +cpu.RAM[0xF7] = is_LDA_i.Bytecode; +cpu.RAM[0xF8] = 0; +cpu.RAM[0xF9] = is_JMP_i.Bytecode; +cpu.RAM[0xFA] = 0x00D5; +cpu.RAM[0xFB] = is_PLAB.Bytecode; +cpu.RAM[0xFC] = is_RTS.Bytecode; + + + +stringToRAM("Blackbeard420 is a Butt Fuckers",cpu.RAM,0x50); updateHTML(); let btn_clk = document.getElementById("btn_clk"); +let btn_runtil = document.getElementById("btn_runtil"); +let brkpt = document.getElementById("addrbrk"); let btn_rst = document.getElementById("btn_rst"); let clk_counter = document.getElementById("clk_counter"); let clk_count = 0; @@ -33,6 +111,11 @@ btn_clk.addEventListener('mouseup', function(evt) { updateHTML(); }); +btn_runtil.addEventListener('click', function(evt) { + let addr = parseInt("0x" + brkpt.value); + RunUntilBreak(addr); +}); + btn_rst.addEventListener('click', function(evt) { cpu.PC = 0; cpu.MCC = 0xf; diff --git a/js/microcode_compiler.js b/js/microcode_compiler.js index c325260..7d9078d 100644 --- a/js/microcode_compiler.js +++ b/js/microcode_compiler.js @@ -42,11 +42,20 @@ 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_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(); @@ -56,8 +65,8 @@ function GenerateMicrocode(mcarray,cpu) { for (let c = 0; c < 3; c++) { let offset = 0; - if (c === 1) offset = 0b0100000000000000; - if (c === 2) offset = 0b1000000000000000; + if (c === 1) offset = 0b1000000000000000; + if (c === 2) offset = 0b0100000000000000; for (let b = 0; b < 16; b++) { let bytecode = mcarray[a].Bytecode; @@ -139,6 +148,31 @@ class IS_LDD_imm extends Microcode_Instruction { 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); @@ -243,6 +277,177 @@ class IS_STDH_imm extends Microcode_Instruction { 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 { @@ -257,6 +462,132 @@ class IS_ADD extends Microcode_Instruction { 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); @@ -305,6 +636,31 @@ class IS_PHD extends Microcode_Instruction { 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); @@ -357,6 +713,32 @@ class IS_PLD extends Microcode_Instruction { 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) { @@ -445,6 +827,36 @@ class IS_BNE_imm extends Microcode_Instruction { 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) {