root / op_string.h @ cabb4d61
History | View | Annotate | Download (5.1 kB)
1 |
|
---|---|
2 |
void OPPROTO glue(glue(op_movs, SUFFIX), STRING_SUFFIX)(void) |
3 |
{ |
4 |
int v, inc;
|
5 |
inc = (DF << SHIFT); |
6 |
v = glue(ldu, SUFFIX)(SI_ADDR); |
7 |
glue(st, SUFFIX)(DI_ADDR, v); |
8 |
inc = (DF << SHIFT); |
9 |
INC_SI(); |
10 |
INC_DI(); |
11 |
} |
12 |
|
13 |
void OPPROTO glue(glue(op_rep_movs, SUFFIX), STRING_SUFFIX)(void) |
14 |
{ |
15 |
int v, inc;
|
16 |
inc = (DF << SHIFT); |
17 |
while (CX != 0) { |
18 |
v = glue(ldu, SUFFIX)(SI_ADDR); |
19 |
glue(st, SUFFIX)(DI_ADDR, v); |
20 |
INC_SI(); |
21 |
INC_DI(); |
22 |
DEC_CX(); |
23 |
} |
24 |
FORCE_RET(); |
25 |
} |
26 |
|
27 |
void OPPROTO glue(glue(op_stos, SUFFIX), STRING_SUFFIX)(void) |
28 |
{ |
29 |
int inc;
|
30 |
glue(st, SUFFIX)(DI_ADDR, EAX); |
31 |
inc = (DF << SHIFT); |
32 |
INC_DI(); |
33 |
} |
34 |
|
35 |
void OPPROTO glue(glue(op_rep_stos, SUFFIX), STRING_SUFFIX)(void) |
36 |
{ |
37 |
int inc;
|
38 |
inc = (DF << SHIFT); |
39 |
while (CX != 0) { |
40 |
glue(st, SUFFIX)(DI_ADDR, EAX); |
41 |
INC_DI(); |
42 |
DEC_CX(); |
43 |
} |
44 |
FORCE_RET(); |
45 |
} |
46 |
|
47 |
void OPPROTO glue(glue(op_lods, SUFFIX), STRING_SUFFIX)(void) |
48 |
{ |
49 |
int v, inc;
|
50 |
v = glue(ldu, SUFFIX)(SI_ADDR); |
51 |
#if SHIFT == 0 |
52 |
EAX = (EAX & ~0xff) | v;
|
53 |
#elif SHIFT == 1 |
54 |
EAX = (EAX & ~0xffff) | v;
|
55 |
#else
|
56 |
EAX = v; |
57 |
#endif
|
58 |
inc = (DF << SHIFT); |
59 |
INC_SI(); |
60 |
} |
61 |
|
62 |
/* don't know if it is used */
|
63 |
void OPPROTO glue(glue(op_rep_lods, SUFFIX), STRING_SUFFIX)(void) |
64 |
{ |
65 |
int v, inc;
|
66 |
inc = (DF << SHIFT); |
67 |
while (CX != 0) { |
68 |
v = glue(ldu, SUFFIX)(SI_ADDR); |
69 |
#if SHIFT == 0 |
70 |
EAX = (EAX & ~0xff) | v;
|
71 |
#elif SHIFT == 1 |
72 |
EAX = (EAX & ~0xffff) | v;
|
73 |
#else
|
74 |
EAX = v; |
75 |
#endif
|
76 |
INC_SI(); |
77 |
DEC_CX(); |
78 |
} |
79 |
FORCE_RET(); |
80 |
} |
81 |
|
82 |
void OPPROTO glue(glue(op_scas, SUFFIX), STRING_SUFFIX)(void) |
83 |
{ |
84 |
int v, inc;
|
85 |
|
86 |
v = glue(ldu, SUFFIX)(DI_ADDR); |
87 |
inc = (DF << SHIFT); |
88 |
INC_DI(); |
89 |
CC_SRC = EAX; |
90 |
CC_DST = EAX - v; |
91 |
} |
92 |
|
93 |
void OPPROTO glue(glue(op_repz_scas, SUFFIX), STRING_SUFFIX)(void) |
94 |
{ |
95 |
int v1, v2, inc;
|
96 |
|
97 |
if (CX != 0) { |
98 |
/* NOTE: the flags are not modified if CX == 0 */
|
99 |
v1 = EAX & DATA_MASK; |
100 |
inc = (DF << SHIFT); |
101 |
do {
|
102 |
v2 = glue(ldu, SUFFIX)(DI_ADDR); |
103 |
INC_DI(); |
104 |
DEC_CX(); |
105 |
if (v1 != v2)
|
106 |
break;
|
107 |
} while (CX != 0); |
108 |
CC_SRC = v1; |
109 |
CC_DST = v1 - v2; |
110 |
CC_OP = CC_OP_SUBB + SHIFT; |
111 |
} |
112 |
FORCE_RET(); |
113 |
} |
114 |
|
115 |
void OPPROTO glue(glue(op_repnz_scas, SUFFIX), STRING_SUFFIX)(void) |
116 |
{ |
117 |
int v1, v2, inc;
|
118 |
|
119 |
if (CX != 0) { |
120 |
/* NOTE: the flags are not modified if CX == 0 */
|
121 |
v1 = EAX & DATA_MASK; |
122 |
inc = (DF << SHIFT); |
123 |
do {
|
124 |
v2 = glue(ldu, SUFFIX)(DI_ADDR); |
125 |
INC_DI(); |
126 |
DEC_CX(); |
127 |
if (v1 == v2)
|
128 |
break;
|
129 |
} while (CX != 0); |
130 |
CC_SRC = v1; |
131 |
CC_DST = v1 - v2; |
132 |
CC_OP = CC_OP_SUBB + SHIFT; |
133 |
} |
134 |
FORCE_RET(); |
135 |
} |
136 |
|
137 |
void OPPROTO glue(glue(op_cmps, SUFFIX), STRING_SUFFIX)(void) |
138 |
{ |
139 |
int v1, v2, inc;
|
140 |
v1 = glue(ldu, SUFFIX)(SI_ADDR); |
141 |
v2 = glue(ldu, SUFFIX)(DI_ADDR); |
142 |
inc = (DF << SHIFT); |
143 |
INC_SI(); |
144 |
INC_DI(); |
145 |
CC_SRC = v1; |
146 |
CC_DST = v1 - v2; |
147 |
} |
148 |
|
149 |
void OPPROTO glue(glue(op_repz_cmps, SUFFIX), STRING_SUFFIX)(void) |
150 |
{ |
151 |
int v1, v2, inc;
|
152 |
if (CX != 0) { |
153 |
inc = (DF << SHIFT); |
154 |
do {
|
155 |
v1 = glue(ldu, SUFFIX)(SI_ADDR); |
156 |
v2 = glue(ldu, SUFFIX)(DI_ADDR); |
157 |
INC_SI(); |
158 |
INC_DI(); |
159 |
DEC_CX(); |
160 |
if (v1 != v2)
|
161 |
break;
|
162 |
} while (CX != 0); |
163 |
CC_SRC = v1; |
164 |
CC_DST = v1 - v2; |
165 |
CC_OP = CC_OP_SUBB + SHIFT; |
166 |
} |
167 |
FORCE_RET(); |
168 |
} |
169 |
|
170 |
void OPPROTO glue(glue(op_repnz_cmps, SUFFIX), STRING_SUFFIX)(void) |
171 |
{ |
172 |
int v1, v2, inc;
|
173 |
if (CX != 0) { |
174 |
inc = (DF << SHIFT); |
175 |
do {
|
176 |
v1 = glue(ldu, SUFFIX)(SI_ADDR); |
177 |
v2 = glue(ldu, SUFFIX)(DI_ADDR); |
178 |
INC_SI(); |
179 |
INC_DI(); |
180 |
DEC_CX(); |
181 |
if (v1 == v2)
|
182 |
break;
|
183 |
} while (CX != 0); |
184 |
CC_SRC = v1; |
185 |
CC_DST = v1 - v2; |
186 |
CC_OP = CC_OP_SUBB + SHIFT; |
187 |
} |
188 |
FORCE_RET(); |
189 |
} |
190 |
|
191 |
void OPPROTO glue(glue(op_outs, SUFFIX), STRING_SUFFIX)(void) |
192 |
{ |
193 |
int v, dx, inc;
|
194 |
dx = EDX & 0xffff;
|
195 |
v = glue(ldu, SUFFIX)(SI_ADDR); |
196 |
glue(cpu_x86_out, SUFFIX)(env, dx, v); |
197 |
inc = (DF << SHIFT); |
198 |
INC_SI(); |
199 |
} |
200 |
|
201 |
void OPPROTO glue(glue(op_rep_outs, SUFFIX), STRING_SUFFIX)(void) |
202 |
{ |
203 |
int v, dx, inc;
|
204 |
inc = (DF << SHIFT); |
205 |
dx = EDX & 0xffff;
|
206 |
while (CX != 0) { |
207 |
v = glue(ldu, SUFFIX)(SI_ADDR); |
208 |
glue(cpu_x86_out, SUFFIX)(env, dx, v); |
209 |
INC_SI(); |
210 |
DEC_CX(); |
211 |
} |
212 |
FORCE_RET(); |
213 |
} |
214 |
|
215 |
void OPPROTO glue(glue(op_ins, SUFFIX), STRING_SUFFIX)(void) |
216 |
{ |
217 |
int v, dx, inc;
|
218 |
dx = EDX & 0xffff;
|
219 |
v = glue(cpu_x86_in, SUFFIX)(env, dx); |
220 |
glue(st, SUFFIX)(DI_ADDR, v); |
221 |
inc = (DF << SHIFT); |
222 |
INC_DI(); |
223 |
} |
224 |
|
225 |
void OPPROTO glue(glue(op_rep_ins, SUFFIX), STRING_SUFFIX)(void) |
226 |
{ |
227 |
int v, dx, inc;
|
228 |
inc = (DF << SHIFT); |
229 |
dx = EDX & 0xffff;
|
230 |
while (CX != 0) { |
231 |
v = glue(cpu_x86_in, SUFFIX)(env, dx); |
232 |
glue(st, SUFFIX)(DI_ADDR, v); |
233 |
INC_DI(); |
234 |
DEC_CX(); |
235 |
} |
236 |
FORCE_RET(); |
237 |
} |
238 |
|
239 |
#undef STRING_SUFFIX
|
240 |
#undef SI_ADDR
|
241 |
#undef DI_ADDR
|
242 |
#undef INC_SI
|
243 |
#undef INC_DI
|
244 |
#undef CX
|
245 |
#undef DEC_CX
|