248 lines
8.4 KiB
JavaScript
248 lines
8.4 KiB
JavaScript
class IS_JMP_imm16 extends Microcode_Instruction {
|
|
constructor(props) {
|
|
super(props);
|
|
this.Bytecode = 0x2C0;
|
|
this.Mnemonic = "JMP";
|
|
this.LongName = "JUMP to address";
|
|
this.Aliases = new Array();
|
|
|
|
this.Type = InstructionTypes.Immediate16;
|
|
this.Operands = new Array({Operand: "$", Bitwidth: 16});
|
|
this.Words = 2;
|
|
this.Cycles = 4;
|
|
this.Microcode[2] = CONTROL_OUT_PC | CONTROL_RRI;
|
|
this.Microcode[3] = CONTROL_OUT_RO | CONTROL_PCI;
|
|
}
|
|
}
|
|
is_JMP_i = new IS_JMP_imm16;
|
|
Instructions.push(is_JMP_i);
|
|
|
|
class IS_JMP_imm24 extends Microcode_Instruction {
|
|
constructor(props) {
|
|
super(props);
|
|
this.Bytecode = 0x2C1;
|
|
this.Mnemonic = "JMP";
|
|
this.LongName = "JUMP to address";
|
|
this.Aliases = new Array();
|
|
|
|
this.Type = InstructionTypes.Immediate24;
|
|
this.Operands = new Array({Operand: "$", Bitwidth: 24});
|
|
this.Words = 3;
|
|
this.Cycles = 7;
|
|
this.Microcode[2] = CONTROL_OUT_PC | CONTROL_RRI;
|
|
this.Microcode[3] = CONTROL_OUT_I2 | CONTROL_PCC;
|
|
this.Microcode[4] = CONTROL_OUT_PC | CONTROL_RRI;
|
|
this.Microcode[5] = CONTROL_OUT_RO | CONTROL_PCI;
|
|
this.Microcode[6] = CONTROL_OUT_2O | CONTROL_RHI;
|
|
}
|
|
}
|
|
is_JMP_i24 = new IS_JMP_imm24;
|
|
Instructions.push(is_JMP_i24);
|
|
|
|
|
|
class IS_BCC_imm extends Microcode_Instruction {
|
|
constructor(props) {
|
|
super(props);
|
|
this.UsesCarry = true;
|
|
this.Bytecode = 0x2C2;
|
|
this.Mnemonic = "BCC";
|
|
this.LongName = "Branch if Carry Clear";
|
|
this.Aliases = new Array("JNC");
|
|
|
|
this.Type = InstructionTypes.Immediate;
|
|
this.Operands = new Array({Operand: "$", Bitwidth: 16});
|
|
this.Words = 2;
|
|
this.Cycles = 4;
|
|
this.CarryWords = 2;
|
|
this.CarryCycles = 3;
|
|
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 = 0x2C3;
|
|
this.Mnemonic = "BCS";
|
|
this.LongName = "Branch if Carry Set";
|
|
this.Aliases = new Array("JC");
|
|
|
|
this.Type = InstructionTypes.Immediate;
|
|
this.Operands = new Array({Operand: "$", Bitwidth: 16});
|
|
this.Words = 2;
|
|
this.Cycles = 3;
|
|
this.CarryWords = 2;
|
|
this.CarryCycles = 4;
|
|
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 = 0x2C4;
|
|
this.Mnemonic = "BEQ";
|
|
this.LongName = "Branch if Equal";
|
|
this.Aliases = new Array("JE","JZ");
|
|
|
|
this.Type = InstructionTypes.Immediate;
|
|
this.Operands = new Array({Operand: "$", Bitwidth: 16});
|
|
this.Words = 2;
|
|
this.Cycles = 3;
|
|
this.ZeroWords = 2;
|
|
this.ZeroCycles = 4;
|
|
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 = 0x2C5;
|
|
this.Mnemonic = "BNE";
|
|
this.LongName = "Branch if NOT Equal";
|
|
this.Aliases = new Array("JNE","JNZ");
|
|
|
|
this.Type = InstructionTypes.Immediate;
|
|
this.Operands = new Array({Operand: "$", Bitwidth: 16});
|
|
this.Words = 2;
|
|
this.Cycles = 4;
|
|
this.ZeroWords = 2;
|
|
this.ZeroCycles = 3;
|
|
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_imm16 extends Microcode_Instruction {
|
|
constructor(props) {
|
|
super(props);
|
|
this.Bytecode = 0x2FC;
|
|
this.Mnemonic = "JSR";
|
|
this.LongName = "JUMP to Subroutine";
|
|
this.Aliases = new Array();
|
|
|
|
this.Type = InstructionTypes.Immediate16;
|
|
this.Operands = new Array({Operand: "$", Bitwidth: 16});
|
|
this.Words = 2;
|
|
this.Cycles = 6;
|
|
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_i = new IS_JSR_imm16;
|
|
Instructions.push(is_JSR_i);
|
|
|
|
class IS_RTS_paged extends Microcode_Instruction {
|
|
constructor(props) {
|
|
super(props);
|
|
this.Bytecode = 0x2FD;
|
|
this.Mnemonic = "RTS";
|
|
this.LongName = "RETURN from Subroutine (called with 16 bit immediate)";
|
|
this.Aliases = new Array();
|
|
|
|
this.Type = InstructionTypes.RTS16;
|
|
this.Operands = new Array();
|
|
this.Words = 1;
|
|
this.Cycles = 6;
|
|
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_paged = new IS_RTS_paged();
|
|
Instructions.push(is_RTS_paged);
|
|
|
|
|
|
class IS_JSR_imm24 extends Microcode_Instruction {
|
|
constructor(props) {
|
|
super(props);
|
|
this.Bytecode = 0x2FE;
|
|
this.Mnemonic = "JSR";
|
|
this.LongName = "JUMP to Subroutine";
|
|
this.Aliases = new Array();
|
|
|
|
this.Type = InstructionTypes.Immediate24;
|
|
this.Operands = new Array({Operand: "$", Bitwidth: 24});
|
|
this.Words = 3;
|
|
this.Cycles = 11;
|
|
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_SP | CONTROL_RRI;
|
|
this.Microcode[5] = CONTROL_OUT_HO | CONTROL_RI | CONTROL_SPD | CONTROL_SPC;
|
|
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_PCI;
|
|
this.Microcode[10] = CONTROL_OUT_2O | CONTROL_RHI;
|
|
}
|
|
}
|
|
is_JSR_i24 = new IS_JSR_imm24;
|
|
Instructions.push(is_JSR_i24);
|
|
|
|
class IS_RTS extends Microcode_Instruction {
|
|
constructor(props) {
|
|
super(props);
|
|
this.Bytecode = 0x2FF;
|
|
this.Mnemonic = "RTS";
|
|
this.LongName = "RETURN from Subroutine (called with 24 bit immediate)";
|
|
this.Aliases = new Array();
|
|
|
|
this.Type = InstructionTypes.RTS24;
|
|
this.Operands = new Array();
|
|
this.Words = 1;
|
|
this.Cycles = 9;
|
|
this.Microcode[2] = CONTROL_SPC;
|
|
this.Microcode[3] = CONTROL_OUT_SP | CONTROL_RRI;
|
|
this.Microcode[4] = CONTROL_OUT_I2 | CONTROL_SPC;
|
|
this.Microcode[5] = CONTROL_OUT_SP | CONTROL_RRI;
|
|
this.Microcode[6] = CONTROL_OUT_RO | CONTROL_PCI;
|
|
this.Microcode[7] = CONTROL_OUT_2O | CONTROL_RHI | CONTROL_PCC;
|
|
this.Microcode[8] = CONTROL_PCC;
|
|
}
|
|
}
|
|
is_RTS = new IS_RTS;
|
|
Instructions.push(is_RTS);
|