Mercurial > hg-old > index.cgi
comparison lwasm/insn_indexed.c @ 442:a9521955554f 3.0
Added pragma pcaspcr to treat PC as PCR; additional fixes for PCR addressing modes
author | lost@l-w.ca |
---|---|
date | Sat, 30 Oct 2010 12:15:00 -0600 |
parents | 7b8d89435f30 |
children |
comparison
equal
deleted
inserted
replaced
441:7b8d89435f30 | 442:a9521955554f |
---|---|
255 */ | 255 */ |
256 return; | 256 return; |
257 } | 257 } |
258 | 258 |
259 // PCR? then we have PC relative addressing (like B??, LB??) | 259 // PCR? then we have PC relative addressing (like B??, LB??) |
260 if (rn == 5) | 260 if (rn == 5 || (rn == 6 && CURPRAGMA(l, PRAGMA_PCASPCR))) |
261 { | 261 { |
262 lw_expr_t e1, e2; | 262 lw_expr_t e1, e2; |
263 // external references are handled exactly the same as for | 263 // external references are handled exactly the same as for |
264 // relative addressing modes | 264 // relative addressing modes |
265 // on pass 1, adjust the expression for a subtraction of the | 265 // on pass 1, adjust the expression for a subtraction of the |
272 e2 = lw_expr_build(lw_expr_type_oper, lw_expr_oper_minus, e1, l -> addr); | 272 e2 = lw_expr_build(lw_expr_type_oper, lw_expr_oper_minus, e1, l -> addr); |
273 lw_expr_destroy(e1); | 273 lw_expr_destroy(e1); |
274 lwasm_save_expr(l, 0, e2); | 274 lwasm_save_expr(l, 0, e2); |
275 if (l -> lint == 1) | 275 if (l -> lint == 1) |
276 { | 276 { |
277 l -> pb = (indir * 0x80) | 0x8C; | 277 l -> pb = indir ? 0x9C : 0x8C; |
278 return; | 278 return; |
279 } | 279 } |
280 if (l -> lint == 2) | 280 if (l -> lint == 2) |
281 { | 281 { |
282 l -> pb = (indir * 0x80) | 0x8D; | 282 l -> pb = indir ? 0x9D : 0x8D; |
283 return; | |
284 } | |
285 } | |
286 | |
287 if (rn == 6) | |
288 { | |
289 if (l -> lint == 1) | |
290 { | |
291 l -> pb = indir ? 0x9C : 0x8C; | |
292 return; | |
293 } | |
294 if (l -> lint == 2) | |
295 { | |
296 l -> pb = indir ? 0x9D : 0x8D; | |
283 return; | 297 return; |
284 } | 298 } |
285 } | 299 } |
286 | 300 |
287 l -> pb = (indir * 0x80) | rn | (f0 * 0x40); | 301 l -> pb = (indir * 0x80) | rn | (f0 * 0x40); |