annotate lwasm/instab.h @ 448:5cccf90bf838 3.0 tip

Fixed bug with complex external references generating invalid relocations in the object file
author lost@l-w.ca
date Fri, 05 Nov 2010 22:27:00 -0600
parents fbb7bfed8076
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
337
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
1 /*
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
2 instab.h
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
3 Copyright © 2008 William Astle
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
4
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
5 This file is part of LWASM.
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
6
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
7 LWASM is free software: you can redistribute it and/or modify it under the
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
8 terms of the GNU General Public License as published by the Free Software
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
9 Foundation, either version 3 of the License, or (at your option) any later
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
10 version.
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
11
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
12 This program is distributed in the hope that it will be useful, but WITHOUT
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
15 more details.
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
16
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
17 You should have received a copy of the GNU General Public License along with
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
18 this program. If not, see <http://www.gnu.org/licenses/>.
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
19
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
20
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
21 Contains definitions for the instruction table
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
22 */
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
23
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
24 #ifndef __instab_h_seen__
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
25 #define __instab_h_seen__
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
26
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
27 #include "lwasm.h"
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
28
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
29 typedef struct
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
30 {
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
31 char *opcode; /* the mneumonic */
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
32 int ops[4]; /* opcode values for up to four addr modes */
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
33 void (*parse)(asmstate_t *as, line_t *l, char **optr); /* parse operand for insn */
360
7d91ab7ac7d6 Indexed stage 2; set line structure to track pragmas in effect for that line
lost@starbug
parents: 348
diff changeset
34 void (*resolve)(asmstate_t *as, line_t *l, int force); /* resolve instruction to code */
348
11a95c6414b4 Added third func to instab to split resolve and emit logic
lost@starbug
parents: 337
diff changeset
35 void (*emit)(asmstate_t *as, line_t *l); /* resolve instruction to code */
337
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
36 int flags; /* flag for this instruction */
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
37 } instab_t;
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
38
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
39 enum
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
40 {
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
41 lwasm_insn_cond = 1, /* conditional instruction */
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
42 lwasm_insn_endm = 2, /* end of macro */
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
43 lwasm_insn_setsym = 4, /* insn sets symbol address */
389
fbb7bfed8076 Added in structure support and fixed up some warts in the listing code (by adding more warts)
lost@l-w.ca
parents: 360
diff changeset
44 lwasm_insn_is6309 = 8, /* insn is 6309 only */
fbb7bfed8076 Added in structure support and fixed up some warts in the listing code (by adding more warts)
lost@l-w.ca
parents: 360
diff changeset
45 lwasm_insn_struct = 16, /* insn allowed in a struct */
fbb7bfed8076 Added in structure support and fixed up some warts in the listing code (by adding more warts)
lost@l-w.ca
parents: 360
diff changeset
46 lwasm_insn_normal = 0
337
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
47 };
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
48
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
49
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
50 #define PARSEFUNC(fn) void (fn)(asmstate_t *as, line_t *l, char **p)
360
7d91ab7ac7d6 Indexed stage 2; set line structure to track pragmas in effect for that line
lost@starbug
parents: 348
diff changeset
51 #define RESOLVEFUNC(fn) void (fn)(asmstate_t *as, line_t *l, int force)
348
11a95c6414b4 Added third func to instab to split resolve and emit logic
lost@starbug
parents: 337
diff changeset
52 #define EMITFUNC(fn) void (fn)(asmstate_t *as, line_t *l)
337
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
53
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
54 #ifndef __instab_c_seen__
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
55 extern instab_t instab[];
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
56 #endif //__instab_c_seen__
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
57
04c80c51b16a Checkpoint development
lost
parents:
diff changeset
58 #endif //__instab_h_seen__