1 typedef CINESTATE (*opcode_func)(int); 2 3 4 /* a lot of jump table entries evaluate to the same thing */ 5 #define opINP_AA_AA opINP_A_AA 6 #define opINP_BB_AA opINP_A_AA 7 #define opOUTbi_AA_A opOUTbi_A_A 8 #define opOUTbi_BB_A opOUTbi_A_A 9 #define opOUT16_AA_A opOUT16_A_A 10 #define opOUT16_BB_A opOUT16_A_A 11 #define opOUT64_AA_A opOUT64_A_A 12 #define opOUT64_BB_A opOUT64_A_A 13 #define opOUTWW_AA_A opOUTWW_A_A 14 #define opOUTWW_BB_A opOUTWW_A_A 15 #define opLDAimm_AA_AA opLDAimm_A_AA 16 #define opLDAimm_BB_AA opLDAimm_A_AA 17 #define opLDAdir_AA_AA opLDAdir_A_AA 18 #define opLDAdir_BB_AA opLDAdir_A_AA 19 #define opLDAirg_AA_AA opLDAirg_A_AA 20 #define opLDAirg_BB_AA opLDAirg_A_AA 21 #define opADDimm_AA_AA opADDimm_A_AA 22 #define opADDimm_BB_AA opADDimm_A_AA 23 #define opADDimmX_AA_AA opADDimmX_A_AA 24 #define opADDimmX_BB_AA opADDimmX_A_AA 25 #define opADDdir_AA_AA opADDdir_A_AA 26 #define opADDdir_BB_AA opADDdir_A_AA 27 #define opAWDirg_AA_AA opAWDirg_A_AA 28 #define opAWDirg_BB_AA opAWDirg_A_AA 29 #define opADDirg_A_AA opAWDirg_A_AA 30 #define opADDirg_AA_AA opAWDirg_A_AA 31 #define opADDirg_BB_AA opAWDirg_A_AA 32 #define opADDirg_B_AA opAWDirg_B_AA 33 #define opSUBimm_AA_AA opSUBimm_A_AA 34 #define opSUBimm_BB_AA opSUBimm_A_AA 35 #define opSUBimmX_AA_AA opSUBimmX_A_AA 36 #define opSUBimmX_BB_AA opSUBimmX_A_AA 37 #define opSUBdir_AA_AA opSUBdir_A_AA 38 #define opSUBdir_BB_AA opSUBdir_A_AA 39 #define opSUBirg_AA_AA opSUBirg_A_AA 40 #define opSUBirg_BB_AA opSUBirg_A_AA 41 #define opCMPdir_AA_AA opCMPdir_A_AA 42 #define opCMPdir_BB_AA opCMPdir_A_AA 43 #define opANDirg_AA_AA opANDirg_A_AA 44 #define opANDirg_BB_AA opANDirg_A_AA 45 #define opLDJimm_AA_A opLDJimm_A_A 46 #define opLDJimm_BB_A opLDJimm_A_A 47 #define opLDJirg_AA_A opLDJirg_A_A 48 #define opLDJirg_BB_A opLDJirg_A_A 49 #define opLDPimm_AA_A opLDPimm_A_A 50 #define opLDPimm_BB_A opLDPimm_A_A 51 #define opLDIdir_AA_A opLDIdir_A_A 52 #define opLDIdir_BB_A opLDIdir_A_A 53 #define opSTAdir_AA_A opSTAdir_A_A 54 #define opSTAdir_BB_A opSTAdir_A_A 55 #define opSTAirg_AA_A opSTAirg_A_A 56 #define opSTAirg_BB_A opSTAirg_A_A 57 #define opXLT_AA_AA opXLT_A_AA 58 #define opXLT_BB_AA opXLT_A_AA 59 #define opMULirg_AA_AA opMULirg_A_AA 60 #define opMULirg_BB_AA opMULirg_A_AA 61 #define opLSRe_AA_AA opLSRe_A_AA 62 #define opLSRe_BB_AA opLSRe_A_AA 63 #define opLSRf_AA_AA opLSRf_A_AA 64 #define opLSRf_BB_AA opLSRf_A_AA 65 #define opLSLe_AA_AA opLSLe_A_AA 66 #define opLSLe_BB_AA opLSLe_A_AA 67 #define opLSLf_AA_AA opLSLf_A_AA 68 #define opLSLf_BB_AA opLSLf_A_AA 69 #define opASRe_AA_AA opASRe_A_AA 70 #define opASRe_BB_AA opASRe_A_AA 71 #define opASRf_AA_AA opASRf_A_AA 72 #define opASRf_BB_AA opASRf_A_AA 73 #define opASRDe_AA_AA opASRDe_A_AA 74 #define opASRDe_BB_AA opASRDe_A_AA 75 #define opASRDf_AA_AA opASRDf_A_AA 76 #define opASRDf_BB_AA opASRDf_A_AA 77 #define opLSLDe_AA_AA opLSLDe_A_AA 78 #define opLSLDe_BB_AA opLSLDe_A_AA 79 #define opLSLDf_AA_AA opLSLDf_A_AA 80 #define opLSLDf_BB_AA opLSLDf_A_AA 81 #define opJMP_AA_A opJMP_A_A 82 #define opJMP_BB_A opJMP_A_A 83 #define opJEI_AA_A opJEI_A_A 84 #define opJEI_BB_A opJEI_A_A 85 #define opJEI_AA_B opJEI_A_B 86 #define opJEI_BB_B opJEI_A_B 87 #define opJLT_AA_A opJLT_A_A 88 #define opJLT_BB_A opJLT_A_A 89 #define opJEQ_AA_A opJEQ_A_A 90 #define opJEQ_BB_A opJEQ_A_A 91 #define opJA0_AA_A opJA0_A_A 92 #define opJA0_BB_A opJA0_A_A 93 #define opJNC_AA_A opJNC_A_A 94 #define opJNC_BB_A opJNC_A_A 95 #define opJDR_AA_A opJDR_A_A 96 #define opJDR_BB_A opJDR_A_A 97 #define opNOP_AA_A opNOP_A_A 98 #define opNOP_BB_A opNOP_A_A 99 #define opJPP32_AA_B opJPP32_A_B 100 #define opJPP32_BB_B opJPP32_A_B 101 #define opJPP16_AA_B opJPP16_A_B 102 #define opJPP16_BB_B opJPP16_A_B 103 #define opJPP8_AA_B opJPP8_A_B 104 #define opJPP8_BB_B opJPP8_A_B 105 #define opJLT_AA_B opJLT_A_B 106 #define opJLT_BB_B opJLT_A_B 107 #define opJEQ_AA_B opJEQ_A_B 108 #define opJEQ_BB_B opJEQ_A_B 109 #define opJA0_AA_B opJA0_A_B 110 #define opJA0_BB_B opJA0_A_B 111 #define opJNC_AA_B opJNC_A_B 112 #define opJNC_BB_B opJNC_A_B 113 #define opJDR_AA_B opJDR_A_B 114 #define opJDR_BB_B opJDR_A_B 115 #define opNOP_AA_B opNOP_A_B 116 #define opNOP_BB_B opNOP_A_B 117 #define opLLT_AA_AA opLLT_A_AA 118 #define opLLT_BB_AA opLLT_A_AA 119 #define opVIN_AA_A opVIN_A_A 120 #define opVIN_BB_A opVIN_A_A 121 #define opWAI_AA_A opWAI_A_A 122 #define opWAI_BB_A opWAI_A_A 123 #define opVDR_AA_A opVDR_A_A 124 #define opVDR_BB_A opVDR_A_A 125 #define tOUT_AA_A tOUT_A_A 126 #define tOUT_BB_A tOUT_B_BB 127 #define tJMI_B_BB2 tJMI_B_BB1 128 #define tJPP_AA_B tJPP_A_B 129 #define tJPP_BB_B tJPP_A_B 130 131 132 /* prototypes for the function handlers */ 133 static CINESTATE opADDdir_A_AA (int opcode); 134 static CINESTATE opADDdir_B_AA (int opcode); 135 static CINESTATE opADDimmX_A_AA (int opcode); 136 static CINESTATE opADDimmX_B_AA (int opcode); 137 static CINESTATE opADDimm_A_AA (int opcode); 138 static CINESTATE opADDimm_B_AA (int opcode); 139 static CINESTATE opANDirg_A_AA (int opcode); 140 static CINESTATE opANDirg_B_AA (int opcode); 141 static CINESTATE opASRDe_A_AA (int opcode); 142 static CINESTATE opASRDe_B_AA (int opcode); 143 static CINESTATE opASRDf_A_AA (int opcode); 144 static CINESTATE opASRDf_B_AA (int opcode); 145 static CINESTATE opASRe_A_AA (int opcode); 146 static CINESTATE opASRe_B_AA (int opcode); 147 static CINESTATE opASRf_A_AA (int opcode); 148 static CINESTATE opASRf_B_AA (int opcode); 149 static CINESTATE opAWDirg_A_AA (int opcode); 150 static CINESTATE opAWDirg_B_AA (int opcode); 151 static CINESTATE opCMPdir_A_AA (int opcode); 152 static CINESTATE opCMPdir_B_AA (int opcode); 153 static CINESTATE opINP_A_AA (int opcode); 154 static CINESTATE opINP_B_AA (int opcode); 155 static CINESTATE opJA0_A_A (int opcode); 156 static CINESTATE opJA0_A_B (int opcode); 157 static CINESTATE opJA0_B_BB (int opcode); 158 static CINESTATE opJDR_A_A (int opcode); 159 static CINESTATE opJDR_A_B (int opcode); 160 static CINESTATE opJDR_B_BB (int opcode); 161 static CINESTATE opJEQ_A_A (int opcode); 162 static CINESTATE opJEQ_A_B (int opcode); 163 static CINESTATE opJEQ_B_BB (int opcode); 164 static CINESTATE opJLT_A_A (int opcode); 165 static CINESTATE opJLT_A_B (int opcode); 166 static CINESTATE opJLT_B_BB (int opcode); 167 static CINESTATE opJMP_A_A (int opcode); 168 static CINESTATE opJMP_B_BB (int opcode); 169 static CINESTATE opJNC_A_A (int opcode); 170 static CINESTATE opJNC_A_B (int opcode); 171 static CINESTATE opJNC_B_BB (int opcode); 172 static CINESTATE opLDAdir_A_AA (int opcode); 173 static CINESTATE opLDAdir_B_AA (int opcode); 174 static CINESTATE opLDAimm_A_AA (int opcode); 175 static CINESTATE opLDAimm_B_AA (int opcode); 176 static CINESTATE opLDAirg_A_AA (int opcode); 177 static CINESTATE opLDAirg_B_AA (int opcode); 178 static CINESTATE opLDIdir_A_A (int opcode); 179 static CINESTATE opLDIdir_B_BB (int opcode); 180 static CINESTATE opLDJimm_A_A (int opcode); 181 static CINESTATE opLDJimm_B_BB (int opcode); 182 static CINESTATE opLDJirg_A_A (int opcode); 183 static CINESTATE opLDJirg_B_BB (int opcode); 184 static CINESTATE opLDPimm_A_A (int opcode); 185 static CINESTATE opLDPimm_B_BB (int opcode); 186 static CINESTATE opLLT_A_AA (int opcode); 187 static CINESTATE opLLT_B_AA (int opcode); 188 static CINESTATE opLSLDe_A_AA (int opcode); 189 static CINESTATE opLSLDe_B_AA (int opcode); 190 static CINESTATE opLSLDf_A_AA (int opcode); 191 static CINESTATE opLSLDf_B_AA (int opcode); 192 static CINESTATE opLSLe_A_AA (int opcode); 193 static CINESTATE opLSLe_B_AA (int opcode); 194 static CINESTATE opLSLf_A_AA (int opcode); 195 static CINESTATE opLSLf_B_AA (int opcode); 196 static CINESTATE opLSRe_A_AA (int opcode); 197 static CINESTATE opLSRe_B_AA (int opcode); 198 static CINESTATE opLSRf_A_AA (int opcode); 199 static CINESTATE opLSRf_B_AA (int opcode); 200 static CINESTATE opMULirg_A_AA (int opcode); 201 static CINESTATE opMULirg_B_AA (int opcode); 202 static CINESTATE opNOP_A_A (int opcode); 203 static CINESTATE opNOP_A_B (int opcode); 204 static CINESTATE opNOP_B_BB (int opcode); 205 static CINESTATE opSTAdir_A_A (int opcode); 206 static CINESTATE opSTAdir_B_BB (int opcode); 207 static CINESTATE opSTAirg_A_A (int opcode); 208 static CINESTATE opSTAirg_B_BB (int opcode); 209 static CINESTATE opSUBdir_A_AA (int opcode); 210 static CINESTATE opSUBdir_B_AA (int opcode); 211 static CINESTATE opSUBimmX_A_AA (int opcode); 212 static CINESTATE opSUBimmX_B_AA (int opcode); 213 static CINESTATE opSUBimm_A_AA (int opcode); 214 static CINESTATE opSUBimm_B_AA (int opcode); 215 static CINESTATE opSUBirg_A_AA (int opcode); 216 static CINESTATE opSUBirg_B_AA (int opcode); 217 static CINESTATE opVDR_A_A (int opcode); 218 static CINESTATE opVDR_B_BB (int opcode); 219 static CINESTATE opVIN_A_A (int opcode); 220 static CINESTATE opVIN_B_BB (int opcode); 221 static CINESTATE opWAI_A_A (int opcode); 222 static CINESTATE opWAI_B_BB (int opcode); 223 static CINESTATE opXLT_A_AA (int opcode); 224 static CINESTATE opXLT_B_AA (int opcode); 225 static CINESTATE tJMI_AA_A (int opcode); 226 static CINESTATE tJMI_AA_B (int opcode); 227 static CINESTATE tJMI_A_A (int opcode); 228 static CINESTATE tJMI_A_B (int opcode); 229 static CINESTATE tJMI_BB_A (int opcode); 230 static CINESTATE tJMI_BB_B (int opcode); 231 static CINESTATE tJMI_B_BB1 (int opcode); 232 static CINESTATE tJPP_AA_B (int opcode); 233 static CINESTATE tJPP_A_B (int opcode); 234 static CINESTATE tJPP_BB_B (int opcode); 235 static CINESTATE tJPP_B_BB (int opcode); 236 static CINESTATE tOUT_A_A (int opcode); 237 static CINESTATE tOUT_B_BB (int opcode); 238 239 240 241 /* Opcode cycle counts according to Zonn's cineinst.txt */ 242 static UINT8 ccpu_cycles[] = 243 { 244 /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ 245 /*0*/ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* LDA */ 246 /*1*/ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* INP */ 247 /*2*/ 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* ADD */ 248 /*3*/ 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* SUB */ 249 /*4*/ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* LDJ */ 250 /*5*/ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* Jumps: 2 extra cycles if jump made */ 251 /*6*/ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* ADD */ 252 /*7*/ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* SUB */ 253 /*8*/ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* LDP */ 254 /*9*/ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* OUT */ 255 /*A*/ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* LDA */ 256 /*B*/ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* CMP */ 257 /*C*/ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* LDI */ 258 /*D*/ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* STA */ 259 /*E*/ 1, 2, 7, 2, 0, 0, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, /* LTT and WAI have special timing */ 260 /*F*/ 1, 2, 7, 2, 0, 0, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1 /* same as E */ 261 }; 262 263 /* the main opcode table */ 264 static opcode_func cineops[4][256] = 265 { 266 { 267 /* table for state "A" -- Use this table if the last opcode was not 268 * an ACC related opcode, and was not a B flip/flop operation. 269 * Translation: 270 * Any ACC related routine will use A-reg and go on to opCodeTblAA 271 * Any B flip/flop instructions will jump to opCodeTblB 272 * All other instructions remain in opCodeTblA 273 * JMI will use the current sign of the A-reg 274 */ 275 opLDAimm_A_AA, opLDAimm_A_AA, opLDAimm_A_AA, opLDAimm_A_AA, opLDAimm_A_AA, opLDAimm_A_AA, opLDAimm_A_AA, opLDAimm_A_AA, 276 opLDAimm_A_AA, opLDAimm_A_AA, opLDAimm_A_AA, opLDAimm_A_AA, opLDAimm_A_AA, opLDAimm_A_AA, opLDAimm_A_AA, opLDAimm_A_AA, 277 opINP_A_AA, opINP_A_AA, opINP_A_AA, opINP_A_AA, opINP_A_AA, opINP_A_AA, opINP_A_AA, opINP_A_AA, 278 opINP_A_AA, opINP_A_AA, opINP_A_AA, opINP_A_AA, opINP_A_AA, opINP_A_AA, opINP_A_AA, opINP_A_AA, 279 280 opADDimmX_A_AA,opADDimm_A_AA, opADDimm_A_AA, opADDimm_A_AA, opADDimm_A_AA, opADDimm_A_AA, opADDimm_A_AA, opADDimm_A_AA, 281 opADDimm_A_AA, opADDimm_A_AA, opADDimm_A_AA, opADDimm_A_AA, opADDimm_A_AA, opADDimm_A_AA, opADDimm_A_AA, opADDimm_A_AA, 282 opSUBimmX_A_AA,opSUBimm_A_AA, opSUBimm_A_AA, opSUBimm_A_AA, opSUBimm_A_AA, opSUBimm_A_AA, opSUBimm_A_AA, opSUBimm_A_AA, 283 opSUBimm_A_AA, opSUBimm_A_AA, opSUBimm_A_AA, opSUBimm_A_AA, opSUBimm_A_AA, opSUBimm_A_AA, opSUBimm_A_AA, opSUBimm_A_AA, 284 285 opLDJimm_A_A, opLDJimm_A_A, opLDJimm_A_A, opLDJimm_A_A, opLDJimm_A_A, opLDJimm_A_A, opLDJimm_A_A, opLDJimm_A_A, 286 opLDJimm_A_A, opLDJimm_A_A, opLDJimm_A_A, opLDJimm_A_A, opLDJimm_A_A, opLDJimm_A_A, opLDJimm_A_A, opLDJimm_A_A, 287 tJPP_A_B, tJMI_A_B, opJDR_A_B, opJLT_A_B, opJEQ_A_B, opJNC_A_B, opJA0_A_B, opNOP_A_B, 288 opJMP_A_A, tJMI_A_A, opJDR_A_A, opJLT_A_A, opJEQ_A_A, opJNC_A_A, opJA0_A_A, opNOP_A_A, 289 290 opADDdir_A_AA, opADDdir_A_AA, opADDdir_A_AA, opADDdir_A_AA, opADDdir_A_AA, opADDdir_A_AA, opADDdir_A_AA, opADDdir_A_AA, 291 opADDdir_A_AA, opADDdir_A_AA, opADDdir_A_AA, opADDdir_A_AA, opADDdir_A_AA, opADDdir_A_AA, opADDdir_A_AA, opADDdir_A_AA, 292 opSUBdir_A_AA, opSUBdir_A_AA, opSUBdir_A_AA, opSUBdir_A_AA, opSUBdir_A_AA, opSUBdir_A_AA, opSUBdir_A_AA, opSUBdir_A_AA, 293 opSUBdir_A_AA, opSUBdir_A_AA, opSUBdir_A_AA, opSUBdir_A_AA, opSUBdir_A_AA, opSUBdir_A_AA, opSUBdir_A_AA, opSUBdir_A_AA, 294 295 opLDPimm_A_A, opLDPimm_A_A, opLDPimm_A_A, opLDPimm_A_A, opLDPimm_A_A, opLDPimm_A_A, opLDPimm_A_A, opLDPimm_A_A, 296 opLDPimm_A_A, opLDPimm_A_A, opLDPimm_A_A, opLDPimm_A_A, opLDPimm_A_A, opLDPimm_A_A, opLDPimm_A_A, opLDPimm_A_A, 297 tOUT_A_A, tOUT_A_A, tOUT_A_A, tOUT_A_A, tOUT_A_A, tOUT_A_A, tOUT_A_A, tOUT_A_A, 298 tOUT_A_A, tOUT_A_A, tOUT_A_A, tOUT_A_A, tOUT_A_A, tOUT_A_A, tOUT_A_A, tOUT_A_A, 299 300 opLDAdir_A_AA, opLDAdir_A_AA, opLDAdir_A_AA, opLDAdir_A_AA, opLDAdir_A_AA, opLDAdir_A_AA, opLDAdir_A_AA, opLDAdir_A_AA, 301 opLDAdir_A_AA, opLDAdir_A_AA, opLDAdir_A_AA, opLDAdir_A_AA, opLDAdir_A_AA, opLDAdir_A_AA, opLDAdir_A_AA, opLDAdir_A_AA, 302 opCMPdir_A_AA, opCMPdir_A_AA, opCMPdir_A_AA, opCMPdir_A_AA, opCMPdir_A_AA, opCMPdir_A_AA, opCMPdir_A_AA, opCMPdir_A_AA, 303 opCMPdir_A_AA, opCMPdir_A_AA, opCMPdir_A_AA, opCMPdir_A_AA, opCMPdir_A_AA, opCMPdir_A_AA, opCMPdir_A_AA, opCMPdir_A_AA, 304 305 opLDIdir_A_A, opLDIdir_A_A, opLDIdir_A_A, opLDIdir_A_A, opLDIdir_A_A, opLDIdir_A_A, opLDIdir_A_A, opLDIdir_A_A, 306 opLDIdir_A_A, opLDIdir_A_A, opLDIdir_A_A, opLDIdir_A_A, opLDIdir_A_A, opLDIdir_A_A, opLDIdir_A_A, opLDIdir_A_A, 307 opSTAdir_A_A, opSTAdir_A_A, opSTAdir_A_A, opSTAdir_A_A, opSTAdir_A_A, opSTAdir_A_A, opSTAdir_A_A, opSTAdir_A_A, 308 opSTAdir_A_A, opSTAdir_A_A, opSTAdir_A_A, opSTAdir_A_A, opSTAdir_A_A, opSTAdir_A_A, opSTAdir_A_A, opSTAdir_A_A, 309 310 opVDR_A_A, opLDJirg_A_A, opXLT_A_AA, opMULirg_A_AA, opLLT_A_AA, opWAI_A_A, opSTAirg_A_A, opADDirg_A_AA, 311 opSUBirg_A_AA, opANDirg_A_AA, opLDAirg_A_AA, opLSRe_A_AA, opLSLe_A_AA, opASRe_A_AA, opASRDe_A_AA, opLSLDe_A_AA, 312 opVIN_A_A, opLDJirg_A_A, opXLT_A_AA, opMULirg_A_AA, opLLT_A_AA, opWAI_A_A, opSTAirg_A_A, opAWDirg_A_AA, 313 opSUBirg_A_AA, opANDirg_A_AA, opLDAirg_A_AA, opLSRf_A_AA, opLSLf_A_AA, opASRf_A_AA, opASRDf_A_AA, opLSLDf_A_AA 314 }, 315 316 { 317 /* opcode table AA -- Use this table if the last opcode was an ACC 318 * related opcode. Translation: 319 * Any ACC related routine will use A-reg and remain in OpCodeTblAA 320 * Any B flip/flop instructions will jump to opCodeTblB 321 * All other instructions will jump to opCodeTblA 322 * JMI will use the sign of acc_old 323 */ 324 325 opLDAimm_AA_AA, opLDAimm_AA_AA, opLDAimm_AA_AA, opLDAimm_AA_AA, opLDAimm_AA_AA, opLDAimm_AA_AA, opLDAimm_AA_AA, opLDAimm_AA_AA, 326 opLDAimm_AA_AA, opLDAimm_AA_AA, opLDAimm_AA_AA, opLDAimm_AA_AA, opLDAimm_AA_AA, opLDAimm_AA_AA, opLDAimm_AA_AA, opLDAimm_AA_AA, 327 opINP_AA_AA, opINP_AA_AA, opINP_AA_AA, opINP_AA_AA, opINP_AA_AA, opINP_AA_AA, opINP_AA_AA, opINP_AA_AA, 328 opINP_AA_AA, opINP_AA_AA, opINP_AA_AA, opINP_AA_AA, opINP_AA_AA, opINP_AA_AA, opINP_AA_AA, opINP_AA_AA, 329 330 opADDimmX_AA_AA,opADDimm_AA_AA, opADDimm_AA_AA, opADDimm_AA_AA, opADDimm_AA_AA, opADDimm_AA_AA, opADDimm_AA_AA, opADDimm_AA_AA, 331 opADDimm_AA_AA, opADDimm_AA_AA, opADDimm_AA_AA, opADDimm_AA_AA, opADDimm_AA_AA, opADDimm_AA_AA, opADDimm_AA_AA, opADDimm_AA_AA, 332 opSUBimmX_AA_AA,opSUBimm_AA_AA, opSUBimm_AA_AA, opSUBimm_AA_AA, opSUBimm_AA_AA, opSUBimm_AA_AA, opSUBimm_AA_AA, opSUBimm_AA_AA, 333 opSUBimm_AA_AA, opSUBimm_AA_AA, opSUBimm_AA_AA, opSUBimm_AA_AA, opSUBimm_AA_AA, opSUBimm_AA_AA, opSUBimm_AA_AA, opSUBimm_AA_AA, 334 335 opLDJimm_AA_A, opLDJimm_AA_A, opLDJimm_AA_A, opLDJimm_AA_A, opLDJimm_AA_A, opLDJimm_AA_A, opLDJimm_AA_A, opLDJimm_AA_A, 336 opLDJimm_AA_A, opLDJimm_AA_A, opLDJimm_AA_A, opLDJimm_AA_A, opLDJimm_AA_A, opLDJimm_AA_A, opLDJimm_AA_A, opLDJimm_AA_A, 337 tJPP_AA_B, tJMI_AA_B, opJDR_AA_B, opJLT_AA_B, opJEQ_AA_B, opJNC_AA_B, opJA0_AA_B, opNOP_AA_B, 338 opJMP_AA_A, tJMI_AA_A, opJDR_AA_A, opJLT_AA_A, opJEQ_AA_A, opJNC_AA_A, opJA0_AA_A, opNOP_AA_A, 339 340 opADDdir_AA_AA, opADDdir_AA_AA, opADDdir_AA_AA, opADDdir_AA_AA, opADDdir_AA_AA, opADDdir_AA_AA, opADDdir_AA_AA, opADDdir_AA_AA, 341 opADDdir_AA_AA, opADDdir_AA_AA, opADDdir_AA_AA, opADDdir_AA_AA, opADDdir_AA_AA, opADDdir_AA_AA, opADDdir_AA_AA, opADDdir_AA_AA, 342 opSUBdir_AA_AA, opSUBdir_AA_AA, opSUBdir_AA_AA, opSUBdir_AA_AA, opSUBdir_AA_AA, opSUBdir_AA_AA, opSUBdir_AA_AA, opSUBdir_AA_AA, 343 opSUBdir_AA_AA, opSUBdir_AA_AA, opSUBdir_AA_AA, opSUBdir_AA_AA, opSUBdir_AA_AA, opSUBdir_AA_AA, opSUBdir_AA_AA, opSUBdir_AA_AA, 344 345 opLDPimm_AA_A, opLDPimm_AA_A, opLDPimm_AA_A, opLDPimm_AA_A, opLDPimm_AA_A, opLDPimm_AA_A, opLDPimm_AA_A, opLDPimm_AA_A, 346 opLDPimm_AA_A, opLDPimm_AA_A, opLDPimm_AA_A, opLDPimm_AA_A, opLDPimm_AA_A, opLDPimm_AA_A, opLDPimm_AA_A, opLDPimm_AA_A, 347 tOUT_AA_A, tOUT_AA_A, tOUT_AA_A, tOUT_AA_A, tOUT_AA_A, tOUT_AA_A, tOUT_AA_A, tOUT_AA_A, 348 tOUT_AA_A, tOUT_AA_A, tOUT_AA_A, tOUT_AA_A, tOUT_AA_A, tOUT_AA_A, tOUT_AA_A, tOUT_AA_A, 349 350 opLDAdir_AA_AA, opLDAdir_AA_AA, opLDAdir_AA_AA, opLDAdir_AA_AA, opLDAdir_AA_AA, opLDAdir_AA_AA, opLDAdir_AA_AA, opLDAdir_AA_AA, 351 opLDAdir_AA_AA, opLDAdir_AA_AA, opLDAdir_AA_AA, opLDAdir_AA_AA, opLDAdir_AA_AA, opLDAdir_AA_AA, opLDAdir_AA_AA, opLDAdir_AA_AA, 352 opCMPdir_AA_AA, opCMPdir_AA_AA, opCMPdir_AA_AA, opCMPdir_AA_AA, opCMPdir_AA_AA, opCMPdir_AA_AA, opCMPdir_AA_AA, opCMPdir_AA_AA, 353 opCMPdir_AA_AA, opCMPdir_AA_AA, opCMPdir_AA_AA, opCMPdir_AA_AA, opCMPdir_AA_AA, opCMPdir_AA_AA, opCMPdir_AA_AA, opCMPdir_AA_AA, 354 355 opLDIdir_AA_A, opLDIdir_AA_A, opLDIdir_AA_A, opLDIdir_AA_A, opLDIdir_AA_A, opLDIdir_AA_A, opLDIdir_AA_A, opLDIdir_AA_A, 356 opLDIdir_AA_A, opLDIdir_AA_A, opLDIdir_AA_A, opLDIdir_AA_A, opLDIdir_AA_A, opLDIdir_AA_A, opLDIdir_AA_A, opLDIdir_AA_A, 357 opSTAdir_AA_A, opSTAdir_AA_A, opSTAdir_AA_A, opSTAdir_AA_A, opSTAdir_AA_A, opSTAdir_AA_A, opSTAdir_AA_A, opSTAdir_AA_A, 358 opSTAdir_AA_A, opSTAdir_AA_A, opSTAdir_AA_A, opSTAdir_AA_A, opSTAdir_AA_A, opSTAdir_AA_A, opSTAdir_AA_A, opSTAdir_AA_A, 359 360 opVDR_AA_A, opLDJirg_AA_A, opXLT_AA_AA, opMULirg_AA_AA, opLLT_AA_AA, opWAI_AA_A, opSTAirg_AA_A, opADDirg_AA_AA, 361 opSUBirg_AA_AA, opANDirg_AA_AA, opLDAirg_AA_AA, opLSRe_AA_AA, opLSLe_AA_AA, opASRe_AA_AA, opASRDe_AA_AA, opLSLDe_AA_AA, 362 opVIN_AA_A, opLDJirg_AA_A, opXLT_AA_AA, opMULirg_AA_AA, opLLT_AA_AA, opWAI_AA_A, opSTAirg_AA_A, opAWDirg_AA_AA, 363 opSUBirg_AA_AA, opANDirg_AA_AA, opLDAirg_AA_AA, opLSRf_AA_AA, opLSLf_AA_AA, opASRf_AA_AA, opASRDf_AA_AA, opLSLDf_AA_AA 364 }, 365 366 { 367 /* opcode table B -- use this table if the last opcode was a B-reg flip/flop 368 * Translation: 369 * Any ACC related routine uses B-reg, and goes to opCodeTblAA 370 * All other instructions will jump to table opCodeTblBB (including 371 * B flip/flop related instructions) 372 * JMI will use current sign of the A-reg 373 */ 374 opLDAimm_B_AA, opLDAimm_B_AA, opLDAimm_B_AA, opLDAimm_B_AA, opLDAimm_B_AA, opLDAimm_B_AA, opLDAimm_B_AA, opLDAimm_B_AA, 375 opLDAimm_B_AA, opLDAimm_B_AA, opLDAimm_B_AA, opLDAimm_B_AA, opLDAimm_B_AA, opLDAimm_B_AA, opLDAimm_B_AA, opLDAimm_B_AA, 376 opINP_B_AA, opINP_B_AA, opINP_B_AA, opINP_B_AA, opINP_B_AA, opINP_B_AA, opINP_B_AA, opINP_B_AA, 377 opINP_B_AA, opINP_B_AA, opINP_B_AA, opINP_B_AA, opINP_B_AA, opINP_B_AA, opINP_B_AA, opINP_B_AA, 378 379 opADDimmX_B_AA,opADDimm_B_AA, opADDimm_B_AA, opADDimm_B_AA, opADDimm_B_AA, opADDimm_B_AA, opADDimm_B_AA, opADDimm_B_AA, 380 opADDimm_B_AA, opADDimm_B_AA, opADDimm_B_AA, opADDimm_B_AA, opADDimm_B_AA, opADDimm_B_AA, opADDimm_B_AA, opADDimm_B_AA, 381 opSUBimmX_B_AA,opSUBimm_B_AA, opSUBimm_B_AA, opSUBimm_B_AA, opSUBimm_B_AA, opSUBimm_B_AA, opSUBimm_B_AA, opSUBimm_B_AA, 382 opSUBimm_B_AA, opSUBimm_B_AA, opSUBimm_B_AA, opSUBimm_B_AA, opSUBimm_B_AA, opSUBimm_B_AA, opSUBimm_B_AA, opSUBimm_B_AA, 383 384 opLDJimm_B_BB, opLDJimm_B_BB, opLDJimm_B_BB, opLDJimm_B_BB, opLDJimm_B_BB, opLDJimm_B_BB, opLDJimm_B_BB, opLDJimm_B_BB, 385 opLDJimm_B_BB, opLDJimm_B_BB, opLDJimm_B_BB, opLDJimm_B_BB, opLDJimm_B_BB, opLDJimm_B_BB, opLDJimm_B_BB, opLDJimm_B_BB, 386 tJPP_B_BB, tJMI_B_BB1, opJDR_B_BB, opJLT_B_BB, opJEQ_B_BB, opJNC_B_BB, opJA0_B_BB, opNOP_B_BB, 387 opJMP_B_BB, tJMI_B_BB2, opJDR_B_BB, opJLT_B_BB, opJEQ_B_BB, opJNC_B_BB, opJA0_B_BB, opNOP_B_BB, 388 389 opADDdir_B_AA, opADDdir_B_AA, opADDdir_B_AA, opADDdir_B_AA, opADDdir_B_AA, opADDdir_B_AA, opADDdir_B_AA, opADDdir_B_AA, 390 opADDdir_B_AA, opADDdir_B_AA, opADDdir_B_AA, opADDdir_B_AA, opADDdir_B_AA, opADDdir_B_AA, opADDdir_B_AA, opADDdir_B_AA, 391 opSUBdir_B_AA, opSUBdir_B_AA, opSUBdir_B_AA, opSUBdir_B_AA, opSUBdir_B_AA, opSUBdir_B_AA, opSUBdir_B_AA, opSUBdir_B_AA, 392 opSUBdir_B_AA, opSUBdir_B_AA, opSUBdir_B_AA, opSUBdir_B_AA, opSUBdir_B_AA, opSUBdir_B_AA, opSUBdir_B_AA, opSUBdir_B_AA, 393 394 opLDPimm_B_BB, opLDPimm_B_BB, opLDPimm_B_BB, opLDPimm_B_BB, opLDPimm_B_BB, opLDPimm_B_BB, opLDPimm_B_BB, opLDPimm_B_BB, 395 opLDPimm_B_BB, opLDPimm_B_BB, opLDPimm_B_BB, opLDPimm_B_BB, opLDPimm_B_BB, opLDPimm_B_BB, opLDPimm_B_BB, opLDPimm_B_BB, 396 tOUT_B_BB, tOUT_B_BB, tOUT_B_BB, tOUT_B_BB, tOUT_B_BB, tOUT_B_BB, tOUT_B_BB, tOUT_B_BB, 397 tOUT_B_BB, tOUT_B_BB, tOUT_B_BB, tOUT_B_BB, tOUT_B_BB, tOUT_B_BB, tOUT_B_BB, tOUT_B_BB, 398 399 opLDAdir_B_AA, opLDAdir_B_AA, opLDAdir_B_AA, opLDAdir_B_AA, opLDAdir_B_AA, opLDAdir_B_AA, opLDAdir_B_AA, opLDAdir_B_AA, 400 opLDAdir_B_AA, opLDAdir_B_AA, opLDAdir_B_AA, opLDAdir_B_AA, opLDAdir_B_AA, opLDAdir_B_AA, opLDAdir_B_AA, opLDAdir_B_AA, 401 opCMPdir_B_AA, opCMPdir_B_AA, opCMPdir_B_AA, opCMPdir_B_AA, opCMPdir_B_AA, opCMPdir_B_AA, opCMPdir_B_AA, opCMPdir_B_AA, 402 opCMPdir_B_AA, opCMPdir_B_AA, opCMPdir_B_AA, opCMPdir_B_AA, opCMPdir_B_AA, opCMPdir_B_AA, opCMPdir_B_AA, opCMPdir_B_AA, 403 404 opLDIdir_B_BB, opLDIdir_B_BB, opLDIdir_B_BB, opLDIdir_B_BB, opLDIdir_B_BB, opLDIdir_B_BB, opLDIdir_B_BB, opLDIdir_B_BB, 405 opLDIdir_B_BB, opLDIdir_B_BB, opLDIdir_B_BB, opLDIdir_B_BB, opLDIdir_B_BB, opLDIdir_B_BB, opLDIdir_B_BB, opLDIdir_B_BB, 406 opSTAdir_B_BB, opSTAdir_B_BB, opSTAdir_B_BB, opSTAdir_B_BB, opSTAdir_B_BB, opSTAdir_B_BB, opSTAdir_B_BB, opSTAdir_B_BB, 407 opSTAdir_B_BB, opSTAdir_B_BB, opSTAdir_B_BB, opSTAdir_B_BB, opSTAdir_B_BB, opSTAdir_B_BB, opSTAdir_B_BB, opSTAdir_B_BB, 408 409 opVDR_B_BB, opLDJirg_B_BB, opXLT_B_AA, opMULirg_B_AA, opLLT_B_AA, opWAI_B_BB, opSTAirg_B_BB, opADDirg_B_AA, 410 opSUBirg_B_AA, opANDirg_B_AA, opLDAirg_B_AA, opLSRe_B_AA, opLSLe_B_AA, opASRe_B_AA, opASRDe_B_AA, opLSLDe_B_AA, 411 opVIN_B_BB, opLDJirg_B_BB, opXLT_B_AA, opMULirg_B_AA, opLLT_B_AA, opWAI_B_BB, opSTAirg_B_BB, opAWDirg_B_AA, 412 opSUBirg_B_AA, opANDirg_B_AA, opLDAirg_B_AA, opLSRf_B_AA, opLSLf_B_AA, opASRf_B_AA, opASRDf_B_AA, opLSLDf_B_AA, 413 }, 414 415 { 416 /* opcode table BB -- use this table if the last opcode was not an ACC 417 * related opcode, but instruction before that was a B-flip/flop instruction. 418 * Translation: 419 * Any ACC related routine will use A-reg and go to opCodeTblAA 420 * Any B flip/flop instructions will jump to opCodeTblB 421 * All other instructions will jump to table opCodeTblA 422 * JMI will use the current state of the B-reg 423 */ 424 opLDAimm_BB_AA, opLDAimm_BB_AA, opLDAimm_BB_AA, opLDAimm_BB_AA, opLDAimm_BB_AA, opLDAimm_BB_AA, opLDAimm_BB_AA, opLDAimm_BB_AA, 425 opLDAimm_BB_AA, opLDAimm_BB_AA, opLDAimm_BB_AA, opLDAimm_BB_AA, opLDAimm_BB_AA, opLDAimm_BB_AA, opLDAimm_BB_AA, opLDAimm_BB_AA, 426 opINP_BB_AA, opINP_BB_AA, opINP_BB_AA, opINP_BB_AA, opINP_BB_AA, opINP_BB_AA, opINP_BB_AA, opINP_BB_AA, 427 opINP_BB_AA, opINP_BB_AA, opINP_BB_AA, opINP_BB_AA, opINP_BB_AA, opINP_BB_AA, opINP_BB_AA, opINP_BB_AA, 428 429 opADDimmX_BB_AA,opADDimm_BB_AA, opADDimm_BB_AA, opADDimm_BB_AA, opADDimm_BB_AA, opADDimm_BB_AA, opADDimm_BB_AA, opADDimm_BB_AA, 430 opADDimm_BB_AA, opADDimm_BB_AA, opADDimm_BB_AA, opADDimm_BB_AA, opADDimm_BB_AA, opADDimm_BB_AA, opADDimm_BB_AA, opADDimm_BB_AA, 431 opSUBimmX_BB_AA,opSUBimm_BB_AA, opSUBimm_BB_AA, opSUBimm_BB_AA, opSUBimm_BB_AA, opSUBimm_BB_AA, opSUBimm_BB_AA, opSUBimm_BB_AA, 432 opSUBimm_BB_AA, opSUBimm_BB_AA, opSUBimm_BB_AA, opSUBimm_BB_AA, opSUBimm_BB_AA, opSUBimm_BB_AA, opSUBimm_BB_AA, opSUBimm_BB_AA, 433 434 opLDJimm_BB_A, opLDJimm_BB_A, opLDJimm_BB_A, opLDJimm_BB_A, opLDJimm_BB_A, opLDJimm_BB_A, opLDJimm_BB_A, opLDJimm_BB_A, 435 opLDJimm_BB_A, opLDJimm_BB_A, opLDJimm_BB_A, opLDJimm_BB_A, opLDJimm_BB_A, opLDJimm_BB_A, opLDJimm_BB_A, opLDJimm_BB_A, 436 tJPP_BB_B, tJMI_BB_B, opJDR_BB_B, opJLT_BB_B, opJEQ_BB_B, opJNC_BB_B, opJA0_BB_B, opNOP_BB_B, 437 opJMP_BB_A, tJMI_BB_A, opJDR_BB_A, opJLT_BB_A, opJEQ_BB_A, opJNC_BB_A, opJA0_BB_A, opNOP_BB_A, 438 439 opADDdir_BB_AA, opADDdir_BB_AA, opADDdir_BB_AA, opADDdir_BB_AA, opADDdir_BB_AA, opADDdir_BB_AA, opADDdir_BB_AA, opADDdir_BB_AA, 440 opADDdir_BB_AA, opADDdir_BB_AA, opADDdir_BB_AA, opADDdir_BB_AA, opADDdir_BB_AA, opADDdir_BB_AA, opADDdir_BB_AA, opADDdir_BB_AA, 441 opSUBdir_BB_AA, opSUBdir_BB_AA, opSUBdir_BB_AA, opSUBdir_BB_AA, opSUBdir_BB_AA, opSUBdir_BB_AA, opSUBdir_BB_AA, opSUBdir_BB_AA, 442 opSUBdir_BB_AA, opSUBdir_BB_AA, opSUBdir_BB_AA, opSUBdir_BB_AA, opSUBdir_BB_AA, opSUBdir_BB_AA, opSUBdir_BB_AA, opSUBdir_BB_AA, 443 444 opLDPimm_BB_A, opLDPimm_BB_A, opLDPimm_BB_A, opLDPimm_BB_A, opLDPimm_BB_A, opLDPimm_BB_A, opLDPimm_BB_A, opLDPimm_BB_A, 445 opLDPimm_BB_A, opLDPimm_BB_A, opLDPimm_BB_A, opLDPimm_BB_A, opLDPimm_BB_A, opLDPimm_BB_A, opLDPimm_BB_A, opLDPimm_BB_A, 446 tOUT_BB_A, tOUT_BB_A, tOUT_BB_A, tOUT_BB_A, tOUT_BB_A, tOUT_BB_A, tOUT_BB_A, tOUT_BB_A, 447 tOUT_BB_A, tOUT_BB_A, tOUT_BB_A, tOUT_BB_A, tOUT_BB_A, tOUT_BB_A, tOUT_BB_A, tOUT_BB_A, 448 449 opLDAdir_BB_AA, opLDAdir_BB_AA, opLDAdir_BB_AA, opLDAdir_BB_AA, opLDAdir_BB_AA, opLDAdir_BB_AA, opLDAdir_BB_AA, opLDAdir_BB_AA, 450 opLDAdir_BB_AA, opLDAdir_BB_AA, opLDAdir_BB_AA, opLDAdir_BB_AA, opLDAdir_BB_AA, opLDAdir_BB_AA, opLDAdir_BB_AA, opLDAdir_BB_AA, 451 opCMPdir_BB_AA, opCMPdir_BB_AA, opCMPdir_BB_AA, opCMPdir_BB_AA, opCMPdir_BB_AA, opCMPdir_BB_AA, opCMPdir_BB_AA, opCMPdir_BB_AA, 452 opCMPdir_BB_AA, opCMPdir_BB_AA, opCMPdir_BB_AA, opCMPdir_BB_AA, opCMPdir_BB_AA, opCMPdir_BB_AA, opCMPdir_BB_AA, opCMPdir_BB_AA, 453 454 opLDIdir_BB_A, opLDIdir_BB_A, opLDIdir_BB_A, opLDIdir_BB_A, opLDIdir_BB_A, opLDIdir_BB_A, opLDIdir_BB_A, opLDIdir_BB_A, 455 opLDIdir_BB_A, opLDIdir_BB_A, opLDIdir_BB_A, opLDIdir_BB_A, opLDIdir_BB_A, opLDIdir_BB_A, opLDIdir_BB_A, opLDIdir_BB_A, 456 opSTAdir_BB_A, opSTAdir_BB_A, opSTAdir_BB_A, opSTAdir_BB_A, opSTAdir_BB_A, opSTAdir_BB_A, opSTAdir_BB_A, opSTAdir_BB_A, 457 opSTAdir_BB_A, opSTAdir_BB_A, opSTAdir_BB_A, opSTAdir_BB_A, opSTAdir_BB_A, opSTAdir_BB_A, opSTAdir_BB_A, opSTAdir_BB_A, 458 459 opVDR_BB_A, opLDJirg_BB_A, opXLT_BB_AA, opMULirg_BB_AA, opLLT_BB_AA, opWAI_BB_A, opSTAirg_BB_A, opADDirg_BB_AA, 460 opSUBirg_BB_AA, opANDirg_BB_AA, opLDAirg_BB_AA, opLSRe_BB_AA, opLSLe_BB_AA, opASRe_BB_AA, opASRDe_BB_AA, opLSLDe_BB_AA, 461 opVIN_BB_A, opLDJirg_BB_A, opXLT_BB_AA, opMULirg_BB_AA, opLLT_BB_AA, opWAI_BB_A, opSTAirg_BB_A, opAWDirg_BB_AA, 462 opSUBirg_BB_AA, opANDirg_BB_AA, opLDAirg_BB_AA, opLSRf_BB_AA, opLSLf_BB_AA, opASRf_BB_AA, opASRDf_BB_AA, opLSLDf_BB_AA, 463 } 464 }; 465 466