Mercurial > hg-old > index.cgi
annotate src/insn_logicmem.c @ 76:2fe5fd7d65a3
Checkpointing object target implementation
author | lost |
---|---|
date | Thu, 08 Jan 2009 02:57:24 +0000 |
parents | 538e15927776 |
children | 8929e1ee99cf |
rev | line source |
---|---|
34 | 1 /* |
2 insn_logicmem.c | |
3 Copyright © 2009 William Astle | |
4 | |
5 This file is part of LWASM. | |
6 | |
7 LWASM is free software: you can redistribute it and/or modify it under the | |
8 terms of the GNU General Public License as published by the Free Software | |
9 Foundation, either version 3 of the License, or (at your option) any later | |
10 version. | |
11 | |
12 This program is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
15 more details. | |
16 | |
17 You should have received a copy of the GNU General Public License along with | |
18 this program. If not, see <http://www.gnu.org/licenses/>. | |
19 | |
20 Contains code for handling logic/mem instructions | |
21 */ | |
22 | |
23 #include <ctype.h> | |
24 #include <stdio.h> | |
25 #include <string.h> | |
26 | |
27 #include "lwasm.h" | |
28 #include "instab.h" | |
29 #include "expr.h" | |
30 | |
31 extern void insn_gen_aux(asmstate_t *as, lwasm_line_t *l, char **optr, int opnum, int extra); | |
32 | |
33 // for aim, oim, eim, tim | |
34 OPFUNC(insn_logicmem) | |
35 { | |
36 int rval, v1; | |
37 const char *p2; | |
38 lwasm_expr_stack_t *s; | |
39 | |
40 if (**p == '#') | |
41 (*p)++; | |
42 | |
37
538e15927776
Added symbol handling to expression subsystem; adpated instruction handlers to the new scheme; misc fixes
lost
parents:
34
diff
changeset
|
43 s = lwasm_evaluate_expr(as, l, *p, &p2); |
34 | 44 *p = (char *)p2; |
45 | |
46 if (!s) | |
47 { | |
48 register_error(as, l, 1, "Bad expression"); | |
49 return; | |
50 } | |
51 | |
52 if (v1 < -128 || v1 > 255) | |
53 { | |
54 register_error(as, l, 2, "Byte overflow"); | |
55 v1 &= 0xff; | |
56 } | |
57 | |
58 if (**p != ',' && **p != ';') | |
59 { | |
60 register_error(as, l, 1, "Bad operand"); | |
61 return; | |
62 } | |
63 | |
64 (*p)++; | |
65 | |
66 // now we have a general addressing mode - call for it | |
67 insn_gen_aux(as, l, p, opnum, v1 & 0xff); | |
68 } |