diff --git a/index.html b/index.html
index 285f007..f80f9bf 100644
--- a/index.html
+++ b/index.html
@@ -46,6 +46,9 @@
RAM:
+
+ RAM (STACK):
+
diff --git a/js/cpu.js b/js/cpu.js
index 37702b6..b763049 100644
--- a/js/cpu.js
+++ b/js/cpu.js
@@ -39,6 +39,19 @@ function printRAM(ram) {
ramtext += "
";
}
sp_ram.innerHTML = ramtext;
+
+ let sp_stackram = document.getElementById("STACK-RAM");
+ ramtext = "ADDR : 0 1 2 3 4 5 6 7 8 9 A B C D E F
";
+ for (let a = 0xffa0; a < 0x10000; a+=16) {
+ ramtext += "0x" + formatHex(a,4) + ": ";
+ for (let b = 0; b < 16; b++) {
+ if (cpu.ADDRBUS === (a)+b) ramtext += '';
+ ramtext += formatHex(ram[(a)+b],4) + " ";
+ if (cpu.ADDRBUS === (a)+b) ramtext += '';
+ }
+ ramtext += "
";
+ }
+ sp_stackram.innerHTML = ramtext;
}
function updateHTML() {
diff --git a/js/main.js b/js/main.js
index 989abb4..2878378 100644
--- a/js/main.js
+++ b/js/main.js
@@ -11,6 +11,8 @@ cpu.RAM[7] = is_LDD_i.Bytecode;
cpu.RAM[8] = 69;
cpu.RAM[9] = is_STDL_i.Bytecode;
cpu.RAM[10] = 0x69;
+cpu.RAM[11] = is_PHD.Bytecode;
+cpu.RAM[12] = is_PLC.Bytecode;
updateHTML();
diff --git a/js/microcode_compiler.js b/js/microcode_compiler.js
index 4eaa360..c325260 100644
--- a/js/microcode_compiler.js
+++ b/js/microcode_compiler.js
@@ -59,10 +59,6 @@ function GenerateMicrocode(mcarray,cpu) {
if (c === 1) offset = 0b0100000000000000;
if (c === 2) offset = 0b1000000000000000;
- if (c === 0) console.log(`Now populating no-conditional instructions...`);
- if (c === 1) console.log(`Now populating conditional ZERO instructions...`);
- if (c === 2) console.log(`Now populating conditional Carry instructions...`);
-
for (let b = 0; b < 16; b++) {
let bytecode = mcarray[a].Bytecode;
let mca = mcarray[a].Bytecode << 4;
@@ -261,6 +257,107 @@ class IS_ADD extends Microcode_Instruction {
is_ADD = new IS_ADD;
Instructions.push(is_ADD);
+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_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_JMP_imm extends Microcode_Instruction {
constructor(props) {
super(props);
@@ -288,10 +385,67 @@ class IS_BCC_imm extends Microcode_Instruction {
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_NOP extends Microcode_Instruction {
constructor(props) {
super(props);