From 77056cfc4961918cbdbca0b01c404daac854e16a Mon Sep 17 00:00:00 2001 From: MatCat Date: Mon, 12 Apr 2021 21:14:13 -0700 Subject: [PATCH] Added most PLx instructions --- js/defines.js | 1 + js/instruction_doc.js | 7 +- js/isa/plx.js | 443 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 450 insertions(+), 1 deletion(-) diff --git a/js/defines.js b/js/defines.js index 2b34c41..5021f58 100644 --- a/js/defines.js +++ b/js/defines.js @@ -99,6 +99,7 @@ const CONTROL_OUT_I2 = CONTROL_OEME | CONTROL_OEM4 | CONTROL_OEM3; const CONTROL_OUT_2O = CONTROL_OEME | CONTROL_OEM4 | CONTROL_OEM3 | CONTROL_OEM0; const CONTROL_OUT_HO = CONTROL_OEME | CONTROL_OEM4 | CONTROL_OEM3 | CONTROL_OEM1; const CONTROL_OUT_HS = CONTROL_OEME | CONTROL_OEM4 | CONTROL_OEM3 | CONTROL_OEM1 | CONTROL_OEM0; +const CONTROL_OUT_SS = CONTROL_OEME | CONTROL_OEM4 | CONTROL_OEM3 | CONTROL_OEM2; const CONTROL_OUT_AE = CONTROL_AE; const CONTROL_OUT_AO = CONTROL_OEME | CONTROL_OEM4 | CONTROL_OEM3 | CONTROL_OEM2 | CONTROL_OEM0; const CONTROL_OUT_SR = CONTROL_OEME | CONTROL_OEM4 | CONTROL_OEM3 | CONTROL_OEM2 | CONTROL_OEM1; diff --git a/js/instruction_doc.js b/js/instruction_doc.js index 647bde8..ccb9b09 100644 --- a/js/instruction_doc.js +++ b/js/instruction_doc.js @@ -21,11 +21,16 @@ for (let a = 0; a < Instructions.length; a++) { } let totalVarients = 0; +let avgCycles = 0; for (let a = 0; a < ISAPrepList.length; a++) { totalVarients += ISAPrepList[a].Varients.length; + for (let b=0; b < ISAPrepList[a].Varients.length; b++) { + avgCycles += ISAPrepList[a].Varients[b].Cycles; + } } +avgCycles = avgCycles / totalVarients; -let outHTML = `
Total Mnemonics   : ${ISAPrepList.length}
Total Instructions: ${totalVarients}
`; +let outHTML = `
Total Mnemonics   : ${ISAPrepList.length}
Total Instructions: ${totalVarients}
Average Cycles per: ${Math.floor(avgCycles)}
`; ISAPrepList.sort((a, b) => (a.Bytecode > b.Bytecode) ? -1 : 1); for (let a = 0; a < ISAPrepList.length; a++) { outHTML += `
`; diff --git a/js/isa/plx.js b/js/isa/plx.js index ce813b9..b724d02 100644 --- a/js/isa/plx.js +++ b/js/isa/plx.js @@ -98,6 +98,146 @@ class IS_PLAB extends Microcode_Instruction { is_PLAB = new IS_PLAB; Instructions.push(is_PLAB); +class IS_PLAC extends Microcode_Instruction { + constructor(props) { + super(props); + this.Bytecode = 0x2A5; + this.Mnemonic = "PLAC"; + this.LongName = "PULL Stack and place in Register A and C"; + this.Aliases = new Array(); + + this.Type = InstructionTypes.Register; + this.Operands = new Array(); + this.Words = 1; + this.Cycles = 5; + this.Microcode[2] = CONTROL_SPC; + this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[4] = CONTROL_OUT_RO | CONTROL_RAIL | CONTROL_RCIH; + } +} +is_PLAC = new IS_PLAC; +Instructions.push(is_PLAC); + +class IS_PLAD extends Microcode_Instruction { + constructor(props) { + super(props); + this.Bytecode = 0x2A6; + this.Mnemonic = "PLAD"; + this.LongName = "PULL Stack and place in Register A and D"; + this.Aliases = new Array(); + + this.Type = InstructionTypes.Register; + this.Operands = new Array(); + this.Words = 1; + this.Cycles = 5; + this.Microcode[2] = CONTROL_SPC; + this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[4] = CONTROL_OUT_RO | CONTROL_RAIL | CONTROL_RDIH; + } +} +is_PLAD = new IS_PLAD; +Instructions.push(is_PLAD); + +class IS_PLBA extends Microcode_Instruction { + constructor(props) { + super(props); + this.Bytecode = 0x2A7; + this.Mnemonic = "PLBA"; + this.LongName = "PULL Stack and place in Register B and A"; + this.Aliases = new Array(); + + this.Type = InstructionTypes.Register; + this.Operands = new Array(); + this.Words = 1; + this.Cycles = 5; + this.Microcode[2] = CONTROL_SPC; + this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[4] = CONTROL_OUT_RO | CONTROL_RBIL | CONTROL_RAIH; + } +} +is_PLBA = new IS_PLBA; +Instructions.push(is_PLBA); + +class IS_PLBC extends Microcode_Instruction { + constructor(props) { + super(props); + this.Bytecode = 0x2A8; + this.Mnemonic = "PLBC"; + this.LongName = "PULL Stack and place in Register B and C"; + this.Aliases = new Array(); + + this.Type = InstructionTypes.Register; + this.Operands = new Array(); + this.Words = 1; + this.Cycles = 5; + this.Microcode[2] = CONTROL_SPC; + this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[4] = CONTROL_OUT_RO | CONTROL_RBIL | CONTROL_RCIH; + } +} +is_PLBC = new IS_PLBC; +Instructions.push(is_PLBC); + +class IS_PLBD extends Microcode_Instruction { + constructor(props) { + super(props); + this.Bytecode = 0x2A9; + this.Mnemonic = "PLBD"; + this.LongName = "PULL Stack and place in Register B and D"; + this.Aliases = new Array(); + + this.Type = InstructionTypes.Register; + this.Operands = new Array(); + this.Words = 1; + this.Cycles = 5; + this.Microcode[2] = CONTROL_SPC; + this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[4] = CONTROL_OUT_RO | CONTROL_RBIL | CONTROL_RDIH; + } +} +is_PLBD = new IS_PLBD; +Instructions.push(is_PLBD); + +class IS_PLCA extends Microcode_Instruction { + constructor(props) { + super(props); + this.Bytecode = 0x2AA; + this.Mnemonic = "PLCA"; + this.LongName = "PULL Stack and place in Register C and A"; + this.Aliases = new Array(); + + this.Type = InstructionTypes.Register; + this.Operands = new Array(); + this.Words = 1; + this.Cycles = 5; + this.Microcode[2] = CONTROL_SPC; + this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[4] = CONTROL_OUT_RO | CONTROL_RCIL | CONTROL_RAIH; + } +} +is_PLCA = new IS_PLCA; +Instructions.push(is_PLCA); + +class IS_PLCB extends Microcode_Instruction { + constructor(props) { + super(props); + this.Bytecode = 0x2AB; + this.Mnemonic = "PLCB"; + this.LongName = "PULL Stack and place in Register C and B"; + this.Aliases = new Array(); + + this.Type = InstructionTypes.Register; + this.Operands = new Array(); + this.Words = 1; + this.Cycles = 5; + this.Microcode[2] = CONTROL_SPC; + this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[4] = CONTROL_OUT_RO | CONTROL_RCIL | CONTROL_RBIH; + } +} +is_PLCB = new IS_PLCB; +Instructions.push(is_PLCB); + class IS_PLCD extends Microcode_Instruction { constructor(props) { super(props); @@ -117,3 +257,306 @@ class IS_PLCD extends Microcode_Instruction { } is_PLCD = new IS_PLCD; Instructions.push(is_PLCD); + +class IS_PLDA extends Microcode_Instruction { + constructor(props) { + super(props); + this.Bytecode = 0x2AD; + this.Mnemonic = "PLDA"; + this.LongName = "PULL Stack and place in Register D and A"; + this.Aliases = new Array(); + + this.Type = InstructionTypes.Register; + this.Operands = new Array(); + this.Words = 1; + this.Cycles = 5; + this.Microcode[2] = CONTROL_SPC; + this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[4] = CONTROL_OUT_RO | CONTROL_RDIL | CONTROL_RAIH; + } +} +is_PLDA = new IS_PLDA; +Instructions.push(is_PLDA); + +class IS_PLDB extends Microcode_Instruction { + constructor(props) { + super(props); + this.Bytecode = 0x2AE; + this.Mnemonic = "PLDB"; + this.LongName = "PULL Stack and place in Register D and B"; + this.Aliases = new Array(); + + this.Type = InstructionTypes.Register; + this.Operands = new Array(); + this.Words = 1; + this.Cycles = 5; + this.Microcode[2] = CONTROL_SPC; + this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[4] = CONTROL_OUT_RO | CONTROL_RDIL | CONTROL_RBIH; + } +} +is_PLDB = new IS_PLDB; +Instructions.push(is_PLDB); + +class IS_PLDC extends Microcode_Instruction { + constructor(props) { + super(props); + this.Bytecode = 0x2AF; + this.Mnemonic = "PLDC"; + this.LongName = "PULL Stack and place in Register D and C"; + this.Aliases = new Array(); + + this.Type = InstructionTypes.Register; + this.Operands = new Array(); + this.Words = 1; + this.Cycles = 5; + this.Microcode[2] = CONTROL_SPC; + this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[4] = CONTROL_OUT_RO | CONTROL_RDIL | CONTROL_RCIH; + } +} +is_PLDC = new IS_PLDC; +Instructions.push(is_PLDC); + +class IS_PLPC extends Microcode_Instruction { + constructor(props) { + super(props); + this.Bytecode = 0x2B0; + this.Mnemonic = "PLPC"; + this.LongName = "PULL Stack and place in the Program Counter"; + this.Aliases = new Array(); + + this.Type = InstructionTypes.Register; + this.Operands = new Array(); + this.Words = 1; + this.Cycles = 5; + this.Microcode[2] = CONTROL_SPC; + this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[4] = CONTROL_OUT_RO | CONTROL_PCI; + } +} +is_PLPC = new IS_PLPC; +Instructions.push(is_PLPC); + +class IS_PLHR extends Microcode_Instruction { + constructor(props) { + super(props); + this.Bytecode = 0x2B1; + this.Mnemonic = "PLHR"; + this.LongName = "PULL Stack and place in the High RAM Page"; + this.Aliases = new Array(); + + this.Type = InstructionTypes.Register; + this.Operands = new Array(); + this.Words = 1; + this.Cycles = 5; + this.Microcode[2] = CONTROL_SPC; + this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[4] = CONTROL_OUT_RO | CONTROL_RHI; + } +} +is_PLHR = new IS_PLHR; +Instructions.push(is_PLHR); + +class IS_PLSP extends Microcode_Instruction { + constructor(props) { + super(props); + this.Bytecode = 0x2B2; + this.Mnemonic = "PLSP"; + this.LongName = "PULL Stack and place in the Stack Pointer"; + this.Aliases = new Array(); + + this.Type = InstructionTypes.Register; + this.Operands = new Array(); + this.Words = 1; + this.Cycles = 5; + this.Microcode[2] = CONTROL_SPC; + this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[4] = CONTROL_OUT_RO | CONTROL_SPI; + } +} +is_PLSP = new IS_PLSP; +Instructions.push(is_PLSP); + +class IS_PLSR extends Microcode_Instruction { + constructor(props) { + super(props); + this.Bytecode = 0x2B3; + this.Mnemonic = "PLSR"; + this.LongName = "PULL Stack and place in the Status Register"; + this.Aliases = new Array(); + + this.Type = InstructionTypes.Register; + this.Operands = new Array(); + this.Words = 1; + this.Cycles = 10; + + this.Microcode[2] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[3] = CONTROL_OUT_AL | CONTROL_RI; + this.Microcode[4] = CONTROL_SPC; + this.Microcode[5] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[6] = CONTROL_OUT_RO | CONTROL_RAIL | CONTROL_SPD | CONTROL_SPC; + this.Microcode[7] = CONTROL_OUT_SS; + this.Microcode[8] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[9] = CONTROL_OUT_RO | CONTROL_RAIL | CONTROL_SPC; + } +} +is_PLSR = new IS_PLSR; +Instructions.push(is_PLSR); + +class IS_PULL_abs16 extends Microcode_Instruction { + constructor(props) { + super(props); + this.Bytecode = 0x2B5; + this.Mnemonic = "PULL"; + this.LongName = "PULL Stack and place in RAM"; + this.Aliases = new Array(); + + this.Type = InstructionTypes.Absolute16; + this.Operands = new Array({Operand: "", Bitwidth: 16}); + this.Words = 2; + this.Cycles = 8; + this.Microcode[2] = CONTROL_SPC; + this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[4] = CONTROL_OUT_I2; + this.Microcode[5] = CONTROL_OUT_PC | CONTROL_RRI; + this.Microcode[6] = CONTROL_OUT_RO | CONTROL_RRI | CONTROL_PCC; + this.Microcode[7] = CONTROL_OUT_2O | CONTROL_RI; + } +} +is_PULL_a = new IS_PULL_abs16; +Instructions.push(is_PULL_a); + +class IS_PULL_abs24 extends Microcode_Instruction { + constructor(props) { + super(props); + this.Bytecode = 0x2B6; + this.Mnemonic = "PULL"; + this.LongName = "PULL Stack and place in RAM"; + this.Aliases = new Array(); + + this.Type = InstructionTypes.Absolute24; + this.Operands = new Array({Operand: "", Bitwidth: 24}); + this.Words = 3; + this.Cycles = 14; + this.Microcode[2] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[3] = CONTROL_OUT_AB | CONTROL_RI | CONTROL_SPC; + this.Microcode[4] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[5] = CONTROL_OUT_RO | CONTROL_RAIL | CONTROL_RBIH; + this.Microcode[6] = CONTROL_OUT_PC | CONTROL_RRI; + this.Microcode[7] = CONTROL_OUT_I2 | CONTROL_PCC; + this.Microcode[8] = CONTROL_OUT_PC | CONTROL_RRI; + this.Microcode[9] = CONTROL_OUT_RO | CONTROL_RRI; + this.Microcode[10] = CONTROL_OUT_2O | CONTROL_RHI; + this.Microcode[11] = CONTROL_OUT_AB | CONTROL_RI | CONTROL_SPD | CONTROL_SPC; + this.Microcode[12] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[13] = CONTROL_OUT_RO | CONTROL_RAIL | CONTROL_RBIH | CONTROL_SPC; + } +} +is_PULL_a24 = new IS_PULL_abs24; +Instructions.push(is_PULL_a24); + +class IS_PULL_ind16 extends Microcode_Instruction { + constructor(props) { + super(props); + this.Bytecode = 0x2B7; + this.Mnemonic = "PULL"; + this.LongName = "PULL Stack and place in RAM"; + this.Aliases = new Array(); + + this.Type = InstructionTypes.Indirect16; + this.Operands = new Array({Operand: "#", Bitwidth: 16}); + this.Words = 2; + this.Cycles = 9; + this.Microcode[2] = CONTROL_SPC; + this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[4] = CONTROL_OUT_I2; + this.Microcode[5] = CONTROL_OUT_PC | CONTROL_RRI; + this.Microcode[6] = CONTROL_OUT_RO | CONTROL_RRI | CONTROL_PCC; + this.Microcode[7] = CONTROL_OUT_RO | CONTROL_RRI; + this.Microcode[8] = CONTROL_OUT_2O | CONTROL_RI; + } +} +is_PULL_in16 = new IS_PULL_ind16; +Instructions.push(is_PULL_in16); + +class IS_PULL_ind24 extends Microcode_Instruction { + constructor(props) { + super(props); + this.Bytecode = 0x2B8; + this.Mnemonic = "PULL"; + this.LongName = "PULL Stack and place in RAM"; + this.Aliases = new Array(); + + this.Type = InstructionTypes.Indirect24; + this.Operands = new Array({Operand: "#", Bitwidth: 24}); + this.Words = 3; + this.Cycles = 15; + this.Microcode[2] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[3] = CONTROL_OUT_AB | CONTROL_RI | CONTROL_SPC; + this.Microcode[4] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[5] = CONTROL_OUT_RO | CONTROL_RAIL | CONTROL_RBIH; + this.Microcode[6] = CONTROL_OUT_PC | CONTROL_RRI; + this.Microcode[7] = CONTROL_OUT_I2 | CONTROL_PCC; + this.Microcode[8] = CONTROL_OUT_PC | CONTROL_RRI; + this.Microcode[9] = CONTROL_OUT_RO | CONTROL_RRI; + this.Microcode[10] = CONTROL_OUT_2O | CONTROL_RHI; + this.Microcode[11] = CONTROL_OUT_RO | CONTROL_RRI; + this.Microcode[12] = CONTROL_OUT_AB | CONTROL_RI | CONTROL_SPD | CONTROL_SPC; + this.Microcode[13] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[14] = CONTROL_OUT_RO | CONTROL_RAIL | CONTROL_RBIH | CONTROL_SPC; + } +} +is_PULL_in24 = new IS_PULL_ind24; +Instructions.push(is_PULL_in24); + +class IS_PLGP extends Microcode_Instruction { + constructor(props) { + super(props); + this.Bytecode = 0x2BE; + this.Mnemonic = "PLGP"; + this.LongName = "PULL Stack and place in all General Purpose Registers"; + this.Aliases = new Array(); + + this.Type = InstructionTypes.Register; + this.Operands = new Array(); + this.Words = 1; + this.Cycles = 7; + this.Microcode[2] = CONTROL_SPC; + this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[4] = CONTROL_OUT_RO | CONTROL_RCIL | CONTROL_RDIH | CONTROL_SPC; + this.Microcode[5] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[6] = CONTROL_OUT_RO | CONTROL_RAIL | CONTROL_RBIH; + } +} +is_PLGP = new IS_PLGP; +Instructions.push(is_PLGP); + +class IS_PLALL extends Microcode_Instruction { + constructor(props) { + super(props); + this.Bytecode = 0x2BF; + this.Mnemonic = "PLALL"; + this.LongName = "PULL Stack and restore all Registers"; + this.Aliases = new Array(); + + this.Type = InstructionTypes.Register; + this.Operands = new Array(); + this.Words = 1; + this.Cycles = 14; + this.Microcode[2] = CONTROL_SPC; + this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[4] = CONTROL_OUT_RO | CONTROL_RHI | CONTROL_SPC; + this.Microcode[5] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[6] = CONTROL_OUT_RO | CONTROL_PCI | CONTROL_SPC; + this.Microcode[7] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[8] = CONTROL_OUT_RO | CONTROL_RAIL | CONTROL_SPC; + this.Microcode[9] = CONTROL_OUT_SS; + this.Microcode[10] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[11] = CONTROL_OUT_RO | CONTROL_RCIL | CONTROL_RDIH | CONTROL_SPC; + this.Microcode[12] = CONTROL_OUT_SP | CONTROL_RRI; + this.Microcode[13] = CONTROL_OUT_RO | CONTROL_RAIL | CONTROL_RBIH; + } +} +is_PLALL = new IS_PLALL; +Instructions.push(is_PLALL);