comparison lwasm/insn_logicmem.c @ 136:b78b2f1e011e

Fixed additional instruction length problems with logic/memory operations
author lost@l-w.ca
date Wed, 17 Aug 2011 21:04:33 -0600
parents 7317fbe024af
children 8764142b3192
comparison
equal deleted inserted replaced
135:fe117454a1e7 136:b78b2f1e011e
27 #include <lw_expr.h> 27 #include <lw_expr.h>
28 28
29 #include "lwasm.h" 29 #include "lwasm.h"
30 #include "instab.h" 30 #include "instab.h"
31 31
32 extern void insn_parse_gen_aux(asmstate_t *as, line_t *l, char **optr); 32 extern void insn_parse_gen_aux(asmstate_t *as, line_t *l, char **optr, int elen);
33 extern void insn_resolve_gen_aux(asmstate_t *as, line_t *l, int force, int elen); 33 extern void insn_resolve_gen_aux(asmstate_t *as, line_t *l, int force, int elen);
34 extern void insn_emit_gen_aux(asmstate_t *as, line_t *l, int extra); 34 extern void insn_emit_gen_aux(asmstate_t *as, line_t *l, int extra);
35 35
36 // for aim, oim, eim, tim 36 // for aim, oim, eim, tim
37 PARSEFUNC(insn_parse_logicmem) 37 PARSEFUNC(insn_parse_logicmem)
57 } 57 }
58 58
59 (*p)++; 59 (*p)++;
60 60
61 // now we have a general addressing mode - call for it 61 // now we have a general addressing mode - call for it
62 insn_parse_gen_aux(as, l, p); 62 insn_parse_gen_aux(as, l, p, 1);
63 } 63 }
64 64
65 RESOLVEFUNC(insn_resolve_logicmem) 65 RESOLVEFUNC(insn_resolve_logicmem)
66 { 66 {
67 if (l -> len != -1) 67 if (l -> len != -1)
81 lwasm_register_error(as, l, "Immediate byte must be fully resolved"); 81 lwasm_register_error(as, l, "Immediate byte must be fully resolved");
82 return; 82 return;
83 } 83 }
84 84
85 v = lw_expr_intval(e); 85 v = lw_expr_intval(e);
86 if (v < -128 || v > 255) 86 /* if (v < -128 || v > 255)
87 { 87 {
88 fprintf(stderr, "BYTE: %d\n", v);
88 lwasm_register_error(as, l, "Byte overflow"); 89 lwasm_register_error(as, l, "Byte overflow");
89 return; 90 return;
90 } 91 }
91 92 */
92 insn_emit_gen_aux(as, l, v); 93 insn_emit_gen_aux(as, l, v & 0xff);
93 } 94 }