comparison lwasm/insn_indexed.c @ 283:210d261a614d

Make byte overflow detection for indexing work better There are *two* places where indexed addressing is calculated - lea style instructions and general addressing instructions. Actually check for byte overflows in both places. Also, extend byte overflow checking to all 8 bit offsets from index registers, not just PCR.
author William Astle <lost@l-w.ca>
date Mon, 02 Sep 2013 10:49:57 -0600
parents 3c421f24c9b8
children b7e4992c12e7
comparison
equal deleted inserted replaced
282:3c421f24c9b8 283:210d261a614d
579 579
580 void insn_emit_indexed_aux(asmstate_t *as, line_t *l) 580 void insn_emit_indexed_aux(asmstate_t *as, line_t *l)
581 { 581 {
582 lw_expr_t e; 582 lw_expr_t e;
583 583
584 if (l -> lint == 1 && (l -> pb == 0x9c || l -> pb == 0x8c)) 584 if (l -> lint == 1)
585 { 585 {
586 int i; 586 int i;
587 e = lwasm_fetch_expr(l, 0); 587 e = lwasm_fetch_expr(l, 0);
588 i = lw_expr_intval(e); 588 i = lw_expr_intval(e);
589 if (i < -128 || i > 127) 589 if (i < -128 || i > 127)