comparison src/pseudo.c @ 53:493cb8ea50a0

Added rm[dq], zm[bdq]
author lost
date Sun, 04 Jan 2009 20:28:30 +0000
parents b9856da2674a
children 360d53062bb9
comparison
equal deleted inserted replaced
52:b9856da2674a 53:493cb8ea50a0
146 rval = lwasm_expr_get_value(s); 146 rval = lwasm_expr_get_value(s);
147 lwasm_expr_stack_free(s); 147 lwasm_expr_stack_free(s);
148 l -> nocodelen = rval; 148 l -> nocodelen = rval;
149 as -> addr += rval; 149 as -> addr += rval;
150 } 150 }
151
152 OPFUNC(pseudo_rmd)
153 {
154 int rval;
155 lwasm_expr_stack_t *s;
156
157 s = lwasm_evaluate_expr(as, l, *p, NULL);
158 if (!s)
159 {
160 register_error(as, l, 1, "Bad expression");
161 return;
162 }
163 if (!lwasm_expr_is_constant(s))
164 {
165 register_error(as, l, 1, "Illegal incomplete reference (pass 1)");
166 lwasm_expr_stack_free(s);
167 return;
168 }
169 rval = lwasm_expr_get_value(s) * 2;
170 lwasm_expr_stack_free(s);
171 l -> nocodelen = rval;
172 as -> addr += rval;
173 }
174
175 OPFUNC(pseudo_rmq)
176 {
177 int rval;
178 lwasm_expr_stack_t *s;
179
180 s = lwasm_evaluate_expr(as, l, *p, NULL);
181 if (!s)
182 {
183 register_error(as, l, 1, "Bad expression");
184 return;
185 }
186 if (!lwasm_expr_is_constant(s))
187 {
188 register_error(as, l, 1, "Illegal incomplete reference (pass 1)");
189 lwasm_expr_stack_free(s);
190 return;
191 }
192 rval = lwasm_expr_get_value(s) * 4;
193 lwasm_expr_stack_free(s);
194 l -> nocodelen = rval;
195 as -> addr += rval;
196 }
197
198 OPFUNC(pseudo_zmb)
199 {
200 int rval;
201 lwasm_expr_stack_t *s;
202
203 s = lwasm_evaluate_expr(as, l, *p, NULL);
204 if (!s)
205 {
206 register_error(as, l, 1, "Bad expression");
207 return;
208 }
209 if (!lwasm_expr_is_constant(s))
210 {
211 register_error(as, l, 1, "Illegal incomplete reference (pass 1)");
212 lwasm_expr_stack_free(s);
213 return;
214 }
215 rval = lwasm_expr_get_value(s);
216 lwasm_expr_stack_free(s);
217 while (rval-- > 0)
218 {
219 lwasm_emit(as, l, 0);
220 }
221 }
222
223 OPFUNC(pseudo_zmd)
224 {
225 int rval;
226 lwasm_expr_stack_t *s;
227
228 s = lwasm_evaluate_expr(as, l, *p, NULL);
229 if (!s)
230 {
231 register_error(as, l, 1, "Bad expression");
232 return;
233 }
234 if (!lwasm_expr_is_constant(s))
235 {
236 register_error(as, l, 1, "Illegal incomplete reference (pass 1)");
237 lwasm_expr_stack_free(s);
238 return;
239 }
240 rval = lwasm_expr_get_value(s);
241 lwasm_expr_stack_free(s);
242 while (rval-- > 0)
243 {
244 lwasm_emit(as, l, 0);
245 lwasm_emit(as, l, 0);
246 }
247 }
248
249 OPFUNC(pseudo_zmq)
250 {
251 int rval;
252 lwasm_expr_stack_t *s;
253
254 s = lwasm_evaluate_expr(as, l, *p, NULL);
255 if (!s)
256 {
257 register_error(as, l, 1, "Bad expression");
258 return;
259 }
260 if (!lwasm_expr_is_constant(s))
261 {
262 register_error(as, l, 1, "Illegal incomplete reference (pass 1)");
263 lwasm_expr_stack_free(s);
264 return;
265 }
266 rval = lwasm_expr_get_value(s);
267 lwasm_expr_stack_free(s);
268 while (rval-- > 0)
269 {
270 lwasm_emit(as, l, 0);
271 lwasm_emit(as, l, 0);
272 lwasm_emit(as, l, 0);
273 lwasm_emit(as, l, 0);
274 }
275 }
276
151 /* 277 /*
152 void pseudo_rmd(asmstate_t *as, sourceline_t *cl, char **optr)
153 {
154 int rval, v1;
155
156 rval = eval_expr(as, cl, optr, &v1);
157 if (rval < 0)
158 {
159 errorp1(ERR_FORWARD);
160 return;
161 }
162 if (v1 < 0)
163 {
164 errorp1(ERR_BADOPER);
165 return;
166 }
167 cl -> len = v1 * 2;
168 cl -> nocode = 1;
169 }
170
171 void pseudo_rmq(asmstate_t *as, sourceline_t *cl, char **optr)
172 {
173 int rval, v1;
174
175 rval = eval_expr(as, cl, optr, &v1);
176 if (rval < 0)
177 {
178 errorp1(ERR_FORWARD);
179 return;
180 }
181 if (v1 < 0)
182 {
183 errorp1(ERR_BADOPER);
184 return;
185 }
186 cl -> len = v1 * 4;
187 cl -> nocode = 1;
188 }
189
190 void pseudo_zmb(asmstate_t *as, sourceline_t *cl, char **optr)
191 {
192 int rval, v1;
193
194 rval = eval_expr(as, cl, optr, &v1);
195 if (rval < 0)
196 {
197 errorp1(ERR_FORWARD);
198 return;
199 }
200 if (v1 < 0)
201 {
202 errorp1(ERR_BADOPER);
203 return;
204 }
205 while (v1--)
206 emit(0);
207 }
208
209 void pseudo_zmd(asmstate_t *as, sourceline_t *cl, char **optr)
210 {
211 int rval, v1;
212
213 rval = eval_expr(as, cl, optr, &v1);
214 if (rval < 0)
215 {
216 errorp1(ERR_FORWARD);
217 return;
218 }
219 if (v1 < 0)
220 {
221 errorp1(ERR_BADOPER);
222 return;
223 }
224 while (v1--)
225 {
226 emit(0);
227 emit(0);
228 }
229 }
230
231 void pseudo_zmq(asmstate_t *as, sourceline_t *cl, char **optr)
232 {
233 int rval, v1;
234
235 rval = eval_expr(as, cl, optr, &v1);
236 if (rval < 0)
237 {
238 errorp1(ERR_FORWARD);
239 return;
240 }
241 if (v1 < 0)
242 {
243 errorp1(ERR_BADOPER);
244 return;
245 }
246 while (v1--)
247 {
248 emit(0);
249 emit(0);
250 emit(0);
251 emit(0);
252 }
253 }
254
255 void pseudo_end(asmstate_t *as, sourceline_t *cl, char **optr) 278 void pseudo_end(asmstate_t *as, sourceline_t *cl, char **optr)
256 { 279 {
257 int rval, v1; 280 int rval, v1;
258 281
259 while (**optr && isspace(**optr)) 282 while (**optr && isspace(**optr))