(FileOutputStream fos, FileOutputStream fos_init, FileOutputStream fos32, FileOutputStream fosOps_h, FileOutputStream fosOps_cpp, String functionName, String enumName, String op, boolean imm)
| 153 | } |
| 154 | |
| 155 | public void bitE32(FileOutputStream fos, FileOutputStream fos_init, FileOutputStream fos32, FileOutputStream fosOps_h, FileOutputStream fosOps_cpp, String functionName, String enumName, String op, boolean imm) throws IOException { |
| 156 | if (imm) { |
| 157 | out(fosOps_h, "void common_"+functionName+"(CPU* cpu, U32 mask, U32 address, U32 reg);"); |
| 158 | out(fosOps_cpp, "void common_"+functionName+"(CPU* cpu, U32 mask, U32 address, U32 reg) {"); |
| 159 | } else { |
| 160 | out(fosOps_h, "void common_"+functionName+"(CPU* cpu, U32 address, U32 reg);"); |
| 161 | out(fosOps_cpp, "void common_"+functionName+"(CPU* cpu, U32 address, U32 reg) {"); |
| 162 | out(fosOps_cpp, " U32 mask=1 << (cpu->reg[reg].u32 & 31);"); |
| 163 | } |
| 164 | out(fosOps_cpp, " U32 value;"); |
| 165 | out(fosOps_cpp, " cpu->fillFlagsNoCF();"); |
| 166 | if (!imm) { |
| 167 | out(fosOps_cpp, " address+=(((S32)cpu->reg[reg].u32)>>5)*4;"); |
| 168 | } |
| 169 | out(fosOps_cpp, " value = readd(address);"); |
| 170 | out(fosOps_cpp, " cpu->setCF(value & mask);"); |
| 171 | if (op.length()>0) { |
| 172 | out(fosOps_cpp, " "+op); |
| 173 | } |
| 174 | out(fosOps_cpp, "}"); |
| 175 | |
| 176 | out(fos, "void OPCALL normal_"+functionName+"(CPU* cpu, DecodedOp* op) {"); |
| 177 | out(fos, " START_OP(cpu, op);"); |
| 178 | out(fos, " common_"+functionName+"(cpu, "+(imm?"op->imm, ":"") +"eaa(cpu,op), op->reg);"); |
| 179 | out(fos, " NEXT();"); |
| 180 | out(fos, "}"); |
| 181 | |
| 182 | out(fos_init, "INIT_CPU("+enumName+", "+functionName+")"); |
| 183 | |
| 184 | out(fos32, "void dynamic_"+functionName+"(DynamicData* data, DecodedOp* op) {"); |
| 185 | out(fos32, " calculateEaa(op, DYN_ADDRESS);"); |
| 186 | if (imm) { |
| 187 | out(fos32, " callHostFunction(common_" + functionName + ", false, 4, 0, DYN_PARAM_CPU, false, op->imm, DYN_PARAM_CONST_32, false, DYN_ADDRESS, DYN_PARAM_REG_32, true, op->reg, DYN_PARAM_CONST_32, false);"); |
| 188 | } else { |
| 189 | out(fos32, " callHostFunction(common_" + functionName + ", false, 3, 0, DYN_PARAM_CPU, false, DYN_ADDRESS, DYN_PARAM_REG_32, true, op->reg, DYN_PARAM_CONST_32, false);"); |
| 190 | } |
| 191 | out(fos32, " data->currentLazyFlags=FLAGS_NONE;"); |
| 192 | out(fos32, " INCREMENT_EIP(op->len);"); |
| 193 | out(fos32, "}"); |
| 194 | |
| 195 | out(fos_init, "INIT_CPU("+enumName+", "+functionName+")"); |
| 196 | |
| 197 | if (!imm) { |
| 198 | bitE32(fos, fos_init, fos32, fosOps_h, fosOps_cpp, functionName.substring(0, functionName.length()-3), enumName.substring(0, enumName.length()-3), op, true); |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | public void bsf(FileOutputStream fos, FileOutputStream fos_init, FileOutputStream fos32, FileOutputStream fosOps_h, FileOutputStream fosOps_cpp, String bits, String functionName, String enumName, String load, boolean eaa) throws IOException { |
| 203 | if (eaa) { |
no test coverage detected