Mercurial > hg-old > index.cgi
annotate src/insn_logicmem.c @ 112:a567dbb3f1d4
command line options
author | lost |
---|---|
date | Sat, 17 Jan 2009 16:55:53 +0000 |
parents | 8929e1ee99cf |
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 | |
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 | |
80
8929e1ee99cf
Checkpointing deployment of non-constant expression handling
lost
parents:
37
diff
changeset
|
34 // the immediate operand must be constant on pass 2 |
34 | 35 OPFUNC(insn_logicmem) |
36 { | |
37 int rval, v1; | |
38 const char *p2; | |
39 lwasm_expr_stack_t *s; | |
40 | |
41 if (**p == '#') | |
42 (*p)++; | |
43 | |
80
8929e1ee99cf
Checkpointing deployment of non-constant expression handling
lost
parents:
37
diff
changeset
|
44 rval = lwasm_expr_result2(as, l, p, 0, &v1, 1); |
8929e1ee99cf
Checkpointing deployment of non-constant expression handling
lost
parents:
37
diff
changeset
|
45 if (rval != 0) |
8929e1ee99cf
Checkpointing deployment of non-constant expression handling
lost
parents:
37
diff
changeset
|
46 v1 = 0; |
8929e1ee99cf
Checkpointing deployment of non-constant expression handling
lost
parents:
37
diff
changeset
|
47 if (rval == 1 && as -> passnum == 2) |
8929e1ee99cf
Checkpointing deployment of non-constant expression handling
lost
parents:
37
diff
changeset
|
48 register_error(as, l, 2, "Illegal external or intersegment reference"); |
34 | 49 |
50 if (v1 < -128 || v1 > 255) | |
51 register_error(as, l, 2, "Byte overflow"); | |
52 | |
53 if (**p != ',' && **p != ';') | |
54 { | |
55 register_error(as, l, 1, "Bad operand"); | |
56 return; | |
57 } | |
58 | |
59 (*p)++; | |
60 | |
61 // now we have a general addressing mode - call for it | |
62 insn_gen_aux(as, l, p, opnum, v1 & 0xff); | |
63 } |