From a769f65a13db5546e427989d85f9646303f4fa32 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Tue, 8 Dec 2020 10:42:10 -0500 Subject: - Implemented support for the Orthogonal extension into both the assembler, and the emulator. I finally figured out how I could get support for the Ortho extension implemented into the old assembler. The only reason for doing this, is to buy me some while I start work on the new assembler, and to help me get an idea for how to do the same in the new assembler. --- enums.h | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 142 insertions(+), 17 deletions(-) (limited to 'enums.h') diff --git a/enums.h b/enums.h index bca5010..834566d 100644 --- a/enums.h +++ b/enums.h @@ -1,23 +1,59 @@ enum am { /* Part of Base ISA. */ - IMM, /* Immediate Data. */ - ZM, /* Zero Matrix. */ - ZMX, /* Zero Matrix, indexed with X. */ - ZMY, /* Zero Matrix, indexed with Y. */ - IND, /* Indirect. */ - INDX, /* Indexed Indirect. */ - INDY, /* Indirect Indexed. */ - ABS, /* Absolute. */ - REL, /* Relative to Program Counter. */ - BREG, /* B Register. */ - IMPL, /* Implied. */ + IMM, /* Immediate Data. */ + ZM, /* Zero Matrix. */ + ZMX, /* Zero Matrix, indexed with X. */ + ZMY, /* Zero Matrix, indexed with Y. */ + IND, /* Indirect. */ + INDX, /* Indexed Indirect. */ + INDY, /* Indirect Indexed. */ + ABS, /* Absolute. */ + REL, /* Relative to Program Counter. */ + BREG, /* B Register. */ + IMPL, /* Implied. */ /* Part of Base Extension. */ - ABSX, /* Absolute, Indexed with X. */ - ABSY, /* Absolute, Indexed with Y. */ - AIND, /* Absolute Indirect. */ - AINDX, /* Absolute Indexed Indirect. */ - AINDY, /* Absolute Indirect Indexed. */ - EIND, /* Effective Address Register, Indirect. */ + ABSX, /* Absolute, Indexed with X. */ + ABSY, /* Absolute, Indexed with Y. */ + AIND, /* Absolute Indirect. */ + AINDX, /* Absolute Indexed Indirect. */ + AINDY, /* Absolute Indirect Indexed. */ + EIND, /* Effective Address Register, Indirect. */ +}; + +/* Part of the Orthogonal Extension. */ +enum ortho_reg { + REG_A, + REG_B, + REG_X, + REG_Y, + REG_E, + REG_C, + REG_D, + REG_S, + REG_F, + REG_SP, + REG_BP, + REG_R11, + REG_R12, + REG_R13, + REG_R14, + REG_R15, +}; + +enum ortho_mem { + MEM_ABS, /* Absolute. */ + MEM_ZM, /* Zero Matrix. */ + MEM_ABSR, /* Absolute, Indexed with register. */ + MEM_ZMR, /* Zero Matrix, Indexed with register. */ + MEM_AIND, /* Absolute Indirect. */ + MEM_IND, /* Zero Matrix Indirect. */ + MEM_AINDR, /* Absolute, Indirect Indexed Register. */ + MEM_ZINDR, /* Zero Matrix, Indirect Indexed Register. */ + MEM_ARIND, /* Absolute, Indexed Indirect Register. */ + MEM_ZRIND, /* Zero Matrix, Indexed Indirect Register. */ + MEM_RIND, /* Register Indirect. */ + MEM_IMM, /* Immediate Data. */ + MEM_SIB = 0xE, /* Scale Index Base. */ }; enum mne { @@ -149,6 +185,25 @@ enum ext_mne { SNE }; +enum ortho_mne { + MNG, + MPO, + MCS, + MCC, + MEQ, + MNE, + MVS, + MVC, + OR , + MOV, + IML, + IDV, + PSH, + PUL, + NEG, + SET +}; + enum base_isa { CPS_IMP = 0x00, /* Clear Processor Status. */ ADC_IMM = 0x01, /* ADd with Carry. */ @@ -486,3 +541,73 @@ enum base_ext { SWP_E = 0xFA, /* SWP E Indirect. */ PCN_E = 0xFC /* PCN E Indirect. */ }; + +#define ORTHO_1CC(mne, base, cc) \ + mne##_R##cc = base, mne##_M##cc = base|0x10 + +#define ORTHO_1OP(mne, base) \ + mne##_R = base, mne##_M = base|0x10 + +#define ORTHO_2OP(mne, base) \ + mne##_RR = base, mne##_RM = base|0x08, mne##_MR = base|0x10, mne##_MM = base|0x18 + +enum ortho { + /* 0x00-0x1C */ + ORTHO_2OP(MNG, 0x00/**/), /* Move if NeGative. */ + ORTHO_2OP(ADC, 0x01/**/), /* ADC Ortho. */ + ORTHO_2OP(ROR, 0x02/**/), /* ROR Ortho. */ + ORTHO_2OP(ADD, 0x03/**/), /* ADD Ortho. */ + ORTHO_1OP(PSH, 0x04/**/), /* PuSH operand onto the stack. */ + ORTHO_1CC(SET, 0x05, NG), /* SET if NeGative. */ + ORTHO_1OP(PEA, 0x0C/**/), /* PEA Ortho. */ + /* 0x20-0x3C */ + ORTHO_2OP(MPO, 0x20/**/), /* Move if POsitive. */ + ORTHO_2OP(SBC, 0x21/**/), /* SBC Ortho. */ + ORTHO_2OP(MUL, 0x22/**/), /* MUL Ortho. */ + ORTHO_2OP(SUB, 0x23/**/), /* SUB Ortho. */ + ORTHO_1OP(PUL, 0x24/**/), /* PuLl operand off of the stack. */ + ORTHO_1CC(SET, 0x25, PO), /* SET if POsitive. */ + ORTHO_1OP(SWP, 0x2C/**/), /* SWP Ortho. */ + /* 0x40-0x55 */ + ORTHO_2OP(MCS, 0x40/**/), /* Move if Carry Set. */ + ORTHO_2OP(AND, 0x41/**/), /* AND Ortho. */ + ORTHO_2OP(DIV, 0x42/**/), /* DIV Ortho. */ + ORTHO_2OP(PCN, 0x43/**/), /* PCN Ortho. */ + ORTHO_1OP(NOT, 0x44/**/), /* NOT Ortho. */ + ORTHO_1CC(SET, 0x45, CS), /* SET if Carry Set. */ + /* 0x60-0x75 */ + ORTHO_2OP(MCC, 0x60/**/), /* Move if Carry Clear. */ + ORTHO_2OP(OR , 0x61/**/), /* Bitwise OR. */ + ORTHO_2OP(ASR, 0x62/**/), /* ASR Ortho. */ + ORTHO_2OP(LEA, 0x63/**/), /* LEA Ortho. */ + ORTHO_1OP(NEG, 0x64/**/), /* NEGate operand. */ + ORTHO_1CC(SET, 0x65, CC), /* SET if Carry Clear. */ + /* 0x80-0x95 */ + ORTHO_2OP(MEQ, 0x80/**/), /* Move if EQual. */ + ORTHO_2OP(XOR, 0x81/**/), /* XOR Ortho. */ + ORTHO_2OP(CMP, 0x82/**/), /* CMP Ortho. */ + ORTHO_1OP(DEC, 0x84/**/), /* DEC Ortho. */ + ORTHO_1CC(SET, 0x85, EQ), /* SET if EQual. */ + /* 0xA0-0xB5 */ + ORTHO_2OP(MNE, 0xA0/**/), /* Move if Not Equal. */ + ORTHO_2OP(LSL, 0xA1/**/), /* LSL Ortho. */ + ORTHO_2OP(MOV, 0xA2/**/), /* MOVe data from source, to destination. */ + ORTHO_1OP(INC, 0xA4/**/), /* INC Ortho. */ + ORTHO_1CC(SET, 0xA5, NE), /* SET if Not Equal. */ + /* 0xC0-0xD5 */ + ORTHO_2OP(MVS, 0xC0/**/), /* Move if oVerflow Set. */ + ORTHO_2OP(LSR, 0xC1/**/), /* LSR Ortho. */ + ORTHO_2OP(IML, 0xC2/**/), /* Integer MuLtiply. */ + ORTHO_1OP(CLZ, 0xC4/**/), /* CLZ Ortho. */ + ORTHO_1CC(SET, 0xC5, VS), /* SET if oVerflow Set. */ + /* 0xE0-0xF5 */ + ORTHO_2OP(MVC, 0xE0/**/), /* Move if oVerflow Clear. */ + ORTHO_2OP(ROL, 0xE1/**/), /* ROL Ortho. */ + ORTHO_2OP(IDV, 0xE2/**/), /* Integer DiVide. */ + ORTHO_1OP(CLO, 0xE4/**/), /* CLO Ortho. */ + ORTHO_1CC(SET, 0xE5, VC) /* SET if oVerflow Clear. */ +}; + +#undef ORTHO_1CC +#undef ORTHO_1OP +#undef ORTHO_2OP -- cgit v1.2.3-13-gbd6f