MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / dshift

Method dshift

tools/x86/src/x86/Shift.java:102–143  ·  view source on GitHub ↗
(FileOutputStream fos, FileOutputStream fos_init, FileOutputStream fos32, String func, String name, String ename, boolean eaa, boolean cl)

Source from the content-addressed store, hash-verified

100 }
101
102 public void dshift(FileOutputStream fos, FileOutputStream fos_init, FileOutputStream fos32, String func, String name, String ename, boolean eaa, boolean cl) throws IOException {
103 String source;
104
105 if (eaa) {
106 if (cl) {
107 source = "op->reg, eaa(cpu, op)";
108 } else {
109 source = "op->reg, eaa(cpu, op), op->imm";
110 }
111 } else {
112 if (cl) {
113 source = "op->reg, op->rm";
114 } else {
115 source = "op->reg, op->rm, op->imm";
116 }
117 }
118 out(fos, "void OPCALL normal_"+name+"(CPU* cpu, DecodedOp* op) {");
119 out(fos, " START_OP(cpu, op);");
120 out(fos, " "+func+"(cpu, "+source+");");
121 out(fos, " NEXT();");
122 out(fos, "}");
123
124 out(fos_init, "INIT_CPU("+ename+", "+name+")");
125
126 out(fos32, "void dynamic_"+name+"(DynamicData* data, DecodedOp* op) {");
127 if (eaa) {
128 out(fos32, " calculateEaa(op, DYN_ADDRESS);");
129 if (cl) {
130 out(fos32, " callHostFunction(" + name + ", false, 3, 0, DYN_PARAM_CPU, false, op->reg, DYN_PARAM_CONST_32, false, DYN_ADDRESS, DYN_PARAM_REG_32, true);");
131 } else {
132 out(fos32, " callHostFunction(" + name + ", false, 4, 0, DYN_PARAM_CPU, false, op->reg, DYN_PARAM_CONST_32, false, DYN_ADDRESS, DYN_PARAM_REG_32, true, op->imm, DYN_PARAM_CONST_32, false);");
133 }
134 } else {
135 if (cl) {
136 out(fos32, " callHostFunction(" + name + ", false, 3, 0, DYN_PARAM_CPU, false, op->reg, DYN_PARAM_CONST_32, false, op->rm, DYN_PARAM_CONST_32, false);");
137 } else {
138 out(fos32, " callHostFunction(" + name + ", false, 4, 0, DYN_PARAM_CPU, false, op->reg, DYN_PARAM_CONST_32, false, op->rm, DYN_PARAM_CONST_32, false, op->imm, DYN_PARAM_CONST_32, false);");
139 }
140 }
141 out(fos32, " INCREMENT_EIP(op->len);");
142 out(fos32, "}");
143 }
144
145 static public String rol8 = "cpu->fillFlagsNoCFOF();\r\n result = (var1 << var2) | (var1 >> (8 - var2));\r\n cpu->setCF(result & 1);\r\n cpu->setOF((result & 1) ^ (result >> 7));";
146 static public String rol8_mem =

Callers 1

generateMethod · 0.95

Calls 1

outMethod · 0.45

Tested by

no test coverage detected