Mercurial > hg-old > index.cgi
annotate lwasm/insn_logicmem.c @ 218:03044871c575
Fixed a stupid regression with forced included library files
author | lost |
---|---|
date | Sat, 25 Apr 2009 02:14:12 +0000 |
parents | bae1e3ecdce1 |
children |
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 | |
212 | 23 #include <config.h> |
34 | 24 #include <ctype.h> |
25 #include <stdio.h> | |
26 #include <string.h> | |
27 | |
28 #include "lwasm.h" | |
29 #include "instab.h" | |
30 #include "expr.h" | |
31 | |
32 extern void insn_gen_aux(asmstate_t *as, lwasm_line_t *l, char **optr, int opnum, int extra); | |
33 | |
34 // for aim, oim, eim, tim | |
80
8929e1ee99cf
Checkpointing deployment of non-constant expression handling
lost
parents:
37
diff
changeset
|
35 // the immediate operand must be constant on pass 2 |
34 | 36 OPFUNC(insn_logicmem) |
37 { | |
38 int rval, v1; | |
39 const char *p2; | |
40 lwasm_expr_stack_t *s; | |
41 | |
42 if (**p == '#') | |
43 (*p)++; | |
44 | |
80
8929e1ee99cf
Checkpointing deployment of non-constant expression handling
lost
parents:
37
diff
changeset
|
45 rval = lwasm_expr_result2(as, l, p, 0, &v1, 1); |
8929e1ee99cf
Checkpointing deployment of non-constant expression handling
lost
parents:
37
diff
changeset
|
46 if (rval != 0) |
8929e1ee99cf
Checkpointing deployment of non-constant expression handling
lost
parents:
37
diff
changeset
|
47 v1 = 0; |
8929e1ee99cf
Checkpointing deployment of non-constant expression handling
lost
parents:
37
diff
changeset
|
48 if (rval == 1 && as -> passnum == 2) |
8929e1ee99cf
Checkpointing deployment of non-constant expression handling
lost
parents:
37
diff
changeset
|
49 register_error(as, l, 2, "Illegal external or intersegment reference"); |
34 | 50 |
51 if (v1 < -128 || v1 > 255) | |
52 register_error(as, l, 2, "Byte overflow"); | |
53 | |
54 if (**p != ',' && **p != ';') | |
55 { | |
56 register_error(as, l, 1, "Bad operand"); | |
57 return; | |
58 } | |
59 | |
60 (*p)++; | |
61 | |
62 // now we have a general addressing mode - call for it | |
63 insn_gen_aux(as, l, p, opnum, v1 & 0xff); | |
64 } |