(FileOutputStream fos, FileOutputStream fos_h, FileOutputStream fos_op, FileOutputStream fos_init, FileOutputStream fos32, String name, boolean eaa, String bits, boolean useCL, String source, String destSave1, String destSave2, String cycles, String inst, int mask, int mod, boolean checkForZero, String dyn)
| 350 | } |
| 351 | |
| 352 | public void shiftBase(FileOutputStream fos, FileOutputStream fos_h, FileOutputStream fos_op, FileOutputStream fos_init, FileOutputStream fos32, String name, boolean eaa, String bits, boolean useCL, String source, String destSave1, String destSave2, String cycles, String inst, int mask, int mod, boolean checkForZero, String dyn) throws IOException { |
| 353 | if (fos_h!=null) { |
| 354 | if (eaa) |
| 355 | out(fos_h, "void " + name + "(CPU* cpu, U32 eaa, U32 var2);"); |
| 356 | else |
| 357 | out(fos_h, "void " + name + "(CPU* cpu, U32 reg, U32 var2);"); |
| 358 | } |
| 359 | if (fos_op!=null) { |
| 360 | out(fos_op, "void OPCALL normal_" + name + "_op(CPU* cpu, DecodedOp* op) {"); |
| 361 | out(fos_op, " START_OP(cpu, op);"); |
| 362 | String shiftSource = (useCL?"CL & 0x1F":"op->imm"); |
| 363 | if (eaa) |
| 364 | out(fos_op, " " + name + "(cpu, eaa(cpu, op), " + shiftSource + ");"); |
| 365 | else |
| 366 | out(fos_op, " " + name + "(cpu, op->reg, " + shiftSource + ");"); |
| 367 | out(fos_op, " NEXT();"); |
| 368 | out(fos_op, "}"); |
| 369 | |
| 370 | out(fos32, "void dynamic_"+name+"_op(DynamicData* data, DecodedOp* op) {"); |
| 371 | String param; |
| 372 | String paramType; |
| 373 | |
| 374 | if (dyn.length()>0) { |
| 375 | out(fos32, " if (!op->needsToSetFlags()) {"); |
| 376 | if (eaa) |
| 377 | out(fos32, " calculateEaa(op, DYN_ADDRESS);"); |
| 378 | out(fos32, dyn); |
| 379 | out(fos32, " INCREMENT_EIP(op->len);"); |
| 380 | out(fos32, " return;"); |
| 381 | out(fos32, " }"); |
| 382 | } |
| 383 | if (useCL) { |
| 384 | // reg = CL & 0x1F; |
| 385 | out(fos32, " movToRegFromCpu(DYN_SRC, CPU_OFFSET_OF(reg[1].u8), DYN_8bit);"); |
| 386 | out(fos32, " instRegImm('&', DYN_SRC, DYN_8bit, 0x1F);"); |
| 387 | out(fos32, " movToRegFromReg(DYN_SRC, DYN_32bit, DYN_SRC, DYN_8bit, false);"); |
| 388 | param = "DYN_SRC"; |
| 389 | paramType = "DYN_PARAM_REG_32"; |
| 390 | } else { |
| 391 | // op->imm |
| 392 | param = "op->imm"; |
| 393 | paramType = "DYN_PARAM_CONST_32"; |
| 394 | } |
| 395 | if (eaa) { |
| 396 | out(fos32, " calculateEaa(op, DYN_ADDRESS);"); |
| 397 | out(fos32, " callHostFunction(" + name + ", false, 3, 0, DYN_PARAM_CPU, false, DYN_ADDRESS, DYN_PARAM_REG_32, true, " + param + ", " + paramType + ", " + (useCL ? "true" : "false") + ");"); |
| 398 | } else { |
| 399 | out(fos32, " callHostFunction(" + name + ", false, 3, 0, DYN_PARAM_CPU, false, op->reg, DYN_PARAM_CONST_32, false, " + param + ", " + paramType + ", " + (useCL ? "true" : "false") + ");"); |
| 400 | } |
| 401 | } |
| 402 | if (name.startsWith("ro") || name.startsWith("rc")) { |
| 403 | out(fos32, " data->currentLazyFlags=FLAGS_NONE;"); |
| 404 | } else { |
| 405 | out(fos32, " data->currentLazyFlags=FLAGS_"+name.substring(0, 3).toUpperCase()+bits+";"); |
| 406 | } |
| 407 | out(fos32, " INCREMENT_EIP(op->len);"); |
| 408 | out(fos32, "}"); |
| 409 |
no test coverage detected