Mercurial > hg > index.cgi
annotate lwasm/lwasm.h @ 484:469a130e7029
Add option to suppress output file
Add --no-output to suppress creation of the output file altogether. Useful
when the assembler is used for other features without needing the assembled
object.
author | William Astle <lost@l-w.ca> |
---|---|
date | Tue, 19 Mar 2019 14:45:53 -0600 |
parents | 74d0c394666e |
children | 7fbf3171ca15 |
rev | line source |
---|---|
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
1 /* |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
2 lwasm.h |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
3 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
4 Copyright © 2010 William Astle |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
5 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
6 This file is part of LWTOOLS. |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
7 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
8 LWTOOLS is free software: you can redistribute it and/or modify it under the |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
9 terms of the GNU General Public License as published by the Free Software |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
10 Foundation, either version 3 of the License, or (at your option) any later |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
11 version. |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
12 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
13 This program is distributed in the hope that it will be useful, but WITHOUT |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
16 more details. |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
17 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
18 You should have received a copy of the GNU General Public License along with |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
19 this program. If not, see <http://www.gnu.org/licenses/>. |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
20 */ |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
21 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
22 #ifndef ___lwasm_h_seen___ |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
23 #define ___lwasm_h_seen___ |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
24 |
361
4130ffdeb5c8
Add contributed support for building with Microsoft's compiler
William Astle <lost@l-w.ca>
parents:
343
diff
changeset
|
25 #ifdef _MSC_VER |
386
221b5f58d8ad
Port remainder of tools to Windows
William Astle <lost@l-w.ca>
parents:
385
diff
changeset
|
26 #include <lw_win.h> // windows build |
361
4130ffdeb5c8
Add contributed support for building with Microsoft's compiler
William Astle <lost@l-w.ca>
parents:
343
diff
changeset
|
27 #endif |
4130ffdeb5c8
Add contributed support for building with Microsoft's compiler
William Astle <lost@l-w.ca>
parents:
343
diff
changeset
|
28 |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
29 #include <lw_expr.h> |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
30 #include <lw_stringlist.h> |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
31 #include <lw_stack.h> |
467
a6c9129e5948
Move version header into a common direction to better reflect what it is.
William Astle <lost@l-w.ca>
parents:
455
diff
changeset
|
32 |
a6c9129e5948
Move version header into a common direction to better reflect what it is.
William Astle <lost@l-w.ca>
parents:
455
diff
changeset
|
33 #include <version.h> |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
34 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
35 // these are allowed chars BELOW 0x80 for symbols |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
36 // first is symbol start chars, second is anywhere in symbol |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
37 #define SSYMCHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_@$" |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
38 #define SYMCHARS SSYMCHARS ".?0123456789" |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
39 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
40 typedef struct asmstate_s asmstate_t; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
41 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
42 enum |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
43 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
44 lwasm_expr_linelen = 1, // length of ref'd line |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
45 lwasm_expr_lineaddr = 2, // addr of ref'd line |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
46 lwasm_expr_nextbp = 3, // next branch point |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
47 lwasm_expr_prevbp = 4, // previous branch point |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
48 lwasm_expr_syment = 5, // symbol table entry |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
49 lwasm_expr_import = 6, // symbol import entry |
142
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
115
diff
changeset
|
50 lwasm_expr_secbase = 7, // section base address |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
115
diff
changeset
|
51 lwasm_expr_linedaddr = 8, // data address of the line |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
115
diff
changeset
|
52 lwasm_expr_linedlen = 9 // data length of the line |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
53 }; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
54 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
55 enum lwasm_output_e |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
56 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
57 OUTPUT_DECB = 0, // DECB multirecord format |
406 | 58 OUTPUT_BASIC, // Color BASIC program |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
59 OUTPUT_RAW, // raw sequence of bytes |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
60 OUTPUT_OBJ, // proprietary object file format |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
61 OUTPUT_RAWREL, // raw bytes where ORG causes a SEEK in the file |
321
d4ac484d0ec6
Add support for Motorola SREC and Intel Hex output formats to lwasm.
Tom LeMense <tlemense@yahoo.com>
parents:
241
diff
changeset
|
62 OUTPUT_OS9, // os9 module target |
d4ac484d0ec6
Add support for Motorola SREC and Intel Hex output formats to lwasm.
Tom LeMense <tlemense@yahoo.com>
parents:
241
diff
changeset
|
63 OUTPUT_SREC, // motorola SREC format |
d4ac484d0ec6
Add support for Motorola SREC and Intel Hex output formats to lwasm.
Tom LeMense <tlemense@yahoo.com>
parents:
241
diff
changeset
|
64 OUTPUT_IHEX, // intel hex format |
432
58cafa61ab40
Add support for undocumented custom module format (for LW)
William Astle <lost@l-w.ca>
parents:
406
diff
changeset
|
65 OUTPUT_HEX, // generic hexadecimal format |
58cafa61ab40
Add support for undocumented custom module format (for LW)
William Astle <lost@l-w.ca>
parents:
406
diff
changeset
|
66 OUTPUT_LWMOD // special module format for LW |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
67 }; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
68 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
69 enum lwasm_flags_e |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
70 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
71 FLAG_LIST = 0x0001, |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
72 FLAG_DEPEND = 0x0002, |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
73 FLAG_SYMBOLS = 0x004, |
73
1f77ae5c3590
Added --dependnoerr flag to list dependencies on non-existent files without bailing out; also suppress error reports during dependency generation
lost@l-w.ca
parents:
70
diff
changeset
|
74 FLAG_DEPENDNOERR = 0x0008, |
222
03f7192fcd20
Add --unicorns option for IDE integration
William Astle <lost@l-w.ca>
parents:
219
diff
changeset
|
75 FLAG_UNICORNS = 0x0010, |
484
469a130e7029
Add option to suppress output file
William Astle <lost@l-w.ca>
parents:
474
diff
changeset
|
76 FLAG_MAP = 0x0020, |
469a130e7029
Add option to suppress output file
William Astle <lost@l-w.ca>
parents:
474
diff
changeset
|
77 FLAG_SYMBOLS_NOLOCALS = 0x0040, |
469a130e7029
Add option to suppress output file
William Astle <lost@l-w.ca>
parents:
474
diff
changeset
|
78 FLAG_NOOUT = 0x80, |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
79 FLAG_NONE = 0 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
80 }; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
81 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
82 enum lwasm_pragmas_e |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
83 { |
375 | 84 PRAGMA_NONE = 0, // no pragmas in effect |
85 PRAGMA_DOLLARNOTLOCAL = 1 << 0, // dollar sign does not make a symbol local | |
86 PRAGMA_NOINDEX0TONONE = 1 << 1, // do not change implicit 0,R to ,R | |
87 PRAGMA_UNDEFEXTERN = 1 << 2, // undefined symbols are considered to be external | |
88 PRAGMA_CESCAPES = 1 << 3, // allow C style escapes in fcc, fcs, fcn, etc. | |
89 PRAGMA_IMPORTUNDEFEXPORT = 1 << 4, // imports symbol if undefined upon export | |
90 PRAGMA_PCASPCR = 1 << 5, // treats ,PC as ,PCR instead of constant offset | |
91 PRAGMA_SHADOW = 1 << 6, // allow macros to shadow builtin operations | |
92 PRAGMA_NOLIST = 1 << 7, // don't show line in listing | |
93 PRAGMA_AUTOBRANCHLENGTH = 1 << 8, // automatically select proper length for relative branches | |
94 PRAGMA_EXPORT = 1 << 9, // export symbols by default, unless local | |
95 PRAGMA_SYMBOLNOCASE = 1 << 10, // symbols defined under this pragma are matched case insensitively | |
96 PRAGMA_CONDUNDEFZERO = 1 << 11, // treat undefined symbols as zero in conditionals during pass 1 | |
97 PRAGMA_6800COMPAT = 1 << 12, // enable 6800 compatibility opcodes | |
98 PRAGMA_FORWARDREFMAX = 1 << 13, // force incomplete references on pass 1 to maximum mode | |
99 PRAGMA_6809 = 1 << 14, // 6809/6309 assembly mode | |
376 | 100 PRAGMA_TESTMODE = 1 << 15, // enable test mode (for internal unit testing) |
101 PRAGMA_C = 1 << 16, // enable cycle counts | |
102 PRAGMA_CD = 1 << 17, // enable detailed cycle count | |
103 PRAGMA_CT = 1 << 18, // enable cycle count running total | |
377
67373a053c49
Add ?rts target for branch instructions
William Astle <lost@l-w.ca>
parents:
376
diff
changeset
|
104 PRAGMA_CC = 1 << 19, // clear cycle count running total |
379
d791d47afc48
Add m80ext pragma for Macro-80C compatibility and ignore END in includes
William Astle <lost@l-w.ca>
parents:
377
diff
changeset
|
105 PRAGMA_QRTS = 1 << 20, // enable BRA ?RTS support |
384
6ee9c67a0f8d
Add conditional for testing if a pragma is in effect
William Astle <lost@l-w.ca>
parents:
382
diff
changeset
|
106 PRAGMA_M80EXT = 1 << 21, // enable Macro-80C assembler extensions |
385 | 107 PRAGMA_6809CONV = 1 << 22, // enable 6809 convenience ops |
108 PRAGMA_6309CONV = 1 << 23, // enable 6309 convenience ops | |
399
6153cb49403c
Initial commit of pragma newsource
William Astle <lost@l-w.ca>
parents:
390
diff
changeset
|
109 PRAGMA_NEWSOURCE = 1 << 24, // don't use compatibility source format |
455 | 110 PRAGMA_OPERANDSIZE = 1 << 25, // warn if operand size is bigger than required |
472
e97f9a302c6a
Add emuext pragma and associated instructions.
William Astle <lost@l-w.ca>
parents:
470
diff
changeset
|
111 PRAGMA_EMUEXT = 1 << 26, // enable emulator extensions |
473 | 112 PRAGMA_NOOUTPUT = 1 << 27, // disable object code output |
474
74d0c394666e
Add "noexpandcond" pragma (cleans up listings)
William Astle <lost@l-w.ca>
parents:
473
diff
changeset
|
113 PRAGMA_NOEXPANDCOND = 1 << 28, // hide conditionals and skipped output in listings |
384
6ee9c67a0f8d
Add conditional for testing if a pragma is in effect
William Astle <lost@l-w.ca>
parents:
382
diff
changeset
|
114 PRAGMA_CLEARBIT = 1 << 31 // reserved to indicate negated pragma flag status |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
115 }; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
116 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
117 enum |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
118 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
119 section_flag_bss = 1, // BSS section |
156
fc8386b13399
Added 'constant' sections to object file handling for lwasm and lwlink
lost@l-w.ca
parents:
142
diff
changeset
|
120 section_flag_constant = 2, // constants - no base offset |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
121 section_flag_none = 0 // no flags |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
122 }; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
123 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
124 typedef struct reloctab_s reloctab_t; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
125 struct reloctab_s |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
126 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
127 lw_expr_t offset; // offset of relocation |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
128 int size; // size of relocation |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
129 lw_expr_t expr; // relocation expression |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
130 reloctab_t *next; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
131 }; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
132 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
133 typedef struct sectiontab_s sectiontab_t; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
134 struct sectiontab_s |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
135 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
136 char *name; // section name |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
137 int flags; // section flags; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
138 lw_expr_t offset; // offset for next instance |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
139 int oblen; // size of section output |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
140 int obsize; // size of output buffer |
432
58cafa61ab40
Add support for undocumented custom module format (for LW)
William Astle <lost@l-w.ca>
parents:
406
diff
changeset
|
141 int tbase; // temporary base value for resolution |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
142 unsigned char *obytes; // output buffer |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
143 reloctab_t *reloctab; // table of relocations |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
144 sectiontab_t *next; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
145 }; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
146 |
375 | 147 typedef enum |
148 { | |
149 TF_EMIT = 1, | |
150 TF_ERROR = 2 | |
151 } lwasm_testflags_t; | |
152 | |
370
8764142b3192
Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents:
367
diff
changeset
|
153 typedef enum |
8764142b3192
Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents:
367
diff
changeset
|
154 { |
375 | 155 E_6309_INVALID = 1, |
156 E_6809_INVALID = 2, | |
157 E_ALIGNMENT_INVALID = 3, | |
158 E_BITNUMBER_UNRESOLVED = 4, | |
159 E_BITNUMBER_INVALID = 5, | |
160 E_BYTE_OVERFLOW = 6, | |
161 E_CONDITION_P1 = 7, | |
162 E_DIRECTIVE_OS9_ONLY = 8, | |
163 E_DIV0 = 9, | |
164 E_EXEC_ADDRESS = 10, | |
165 E_FILL_INVALID = 11, | |
166 E_IMMEDIATE_INVALID = 12, | |
167 E_IMMEDIATE_UNRESOLVED = 13, | |
168 E_EXPRESSION_BAD = 14, | |
169 E_EXPRESSION_NOT_CONST = 15, | |
170 E_EXPRESSION_NOT_RESOLVED = 16, | |
171 E_FILE_OPEN = 17, | |
172 E_FILENAME_MISSING = 18, | |
173 E_INSTRUCTION_FAILED = 19, | |
174 E_INSTRUCTION_SECTION = 20, | |
175 E_LINE_ADDRESS = 21, | |
176 E_LINED_ADDRESS = 22, | |
177 E_MACRO_DUPE = 23, | |
178 E_MACRO_ENDM = 24, | |
179 E_MACRO_NONAME = 25, | |
180 E_MACRO_RECURSE = 26, | |
181 E_MODULE_IN = 27, | |
182 E_MODULE_NOTIN = 28, | |
183 E_NEGATIVE_BLOCKSIZE = 29, | |
184 E_NEGATIVE_RESERVATION = 30, | |
185 E_NW_8 = 31, | |
186 E_OPCODE_BAD = 32, | |
187 E_OPERAND_BAD = 33, | |
188 E_OBJTARGET_ONLY = 34, | |
189 E_PADDING_BAD = 35, | |
190 E_PRAGMA_UNRECOGNIZED = 36, | |
191 E_REGISTER_BAD = 37, | |
192 E_SECTION_END = 38, | |
193 E_SECTION_EXTDEP = 39, | |
194 E_SECTION_FLAG = 40, | |
195 E_SECTION_NAME = 41, | |
196 E_SECTION_TARGET = 42, | |
197 E_SETDP_INVALID = 43, | |
198 E_SETDP_NOT_CONST = 44, | |
199 E_STRING_BAD = 45, | |
200 E_STRUCT_DUPE = 46, | |
201 E_STRUCT_NONAME = 47, | |
202 E_STRUCT_NOSYMBOL = 48, | |
203 E_STRUCT_RECURSE = 49, | |
204 E_SYMBOL_BAD = 50, | |
205 E_SYMBOL_DUPE = 51, | |
206 E_SYMBOL_MISSING = 52, | |
207 E_SYMBOL_UNDEFINED = 53, | |
208 E_SYMBOL_UNDEFINED_EXPORT = 54, | |
209 E_UNKNOWN_OPERATION = 55, | |
210 E_USER_SPECIFIED = 56, | |
382 | 211 E_ORG_NOT_FOUND = 57, |
432
58cafa61ab40
Add support for undocumented custom module format (for LW)
William Astle <lost@l-w.ca>
parents:
406
diff
changeset
|
212 E_COMPLEX_INCOMPLETE = 58, |
470
2c1c5dd84024
Add << prefix to force 5 bit offsets in indexed modes
William Astle <lost@l-w.ca>
parents:
467
diff
changeset
|
213 E_ILL5 = 59, |
432
58cafa61ab40
Add support for undocumented custom module format (for LW)
William Astle <lost@l-w.ca>
parents:
406
diff
changeset
|
214 |
370
8764142b3192
Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents:
367
diff
changeset
|
215 /* warnings must be 1000 or greater */ |
8764142b3192
Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents:
367
diff
changeset
|
216 |
375 | 217 W_DUPLICATE_SECTION = 1000, |
218 W_ENDSTRUCT_WITHOUT = 1001, | |
219 W_NOT_SUPPORTED = 1002, | |
455 | 220 W_USER_SPECIFIED = 1003, |
221 W_OPERAND_SIZE = 1004 | |
370
8764142b3192
Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents:
367
diff
changeset
|
222 } lwasm_errorcode_t; |
8764142b3192
Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents:
367
diff
changeset
|
223 |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
224 typedef struct lwasm_error_s lwasm_error_t; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
225 struct lwasm_error_s |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
226 { |
370
8764142b3192
Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents:
367
diff
changeset
|
227 lwasm_errorcode_t code; // error code |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
228 char *mess; // actual error message |
226
7c2c2239ec9c
Make unicorns grok errors and warnings.
William Astle <lost@l-w.ca>
parents:
223
diff
changeset
|
229 int charpos; // character position on line where parsing stopped |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
230 lwasm_error_t *next; // ptr to next error |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
231 }; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
232 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
233 struct line_expr_s |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
234 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
235 lw_expr_t expr; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
236 int id; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
237 struct line_expr_s *next; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
238 }; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
239 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
240 typedef struct line_s line_t; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
241 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
242 typedef struct exportlist_s exportlist_t; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
243 struct exportlist_s |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
244 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
245 char *symbol; // symbol to export |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
246 struct symtabe *se; // symbol table entry |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
247 line_t *line; // line the export is on |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
248 exportlist_t *next; // next in the export list |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
249 }; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
250 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
251 typedef struct importlist_s importlist_t; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
252 struct importlist_s |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
253 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
254 char *symbol; // symbol to import |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
255 importlist_t *next; // next in the import list |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
256 }; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
257 |
376 | 258 typedef enum |
259 { | |
260 CYCLE_ADJ = 1, | |
261 CYCLE_ESTIMATED = 2 | |
262 } cycle_flags; | |
263 | |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
264 struct line_s |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
265 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
266 lw_expr_t addr; // assembly address of the line |
142
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
115
diff
changeset
|
267 lw_expr_t daddr; // data address of the line (os9 only) |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
268 int len; // the "size" this line occupies (address space wise) (-1 if unknown) |
142
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
115
diff
changeset
|
269 int dlen; // the data "size" this line occupies (-1 if unknown) |
241
d0e9dbe9afbe
Add new heuristic for resolving instruction sizes.
William Astle <lost@l-w.ca>
parents:
226
diff
changeset
|
270 int minlen; // minimum length |
d0e9dbe9afbe
Add new heuristic for resolving instruction sizes.
William Astle <lost@l-w.ca>
parents:
226
diff
changeset
|
271 int maxlen; // maximum length |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
272 int insn; // number of insn in insn table |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
273 int symset; // set if the line symbol was consumed by the instruction |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
274 char *sym; // symbol, if any, on the line |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
275 unsigned char *output; // output bytes |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
276 int outputl; // size of output |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
277 int outputbl; // size of output buffer |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
278 int dpval; // direct page value |
376 | 279 int cycle_base; // base instruction cycle count |
280 int cycle_adj; // cycle adjustment | |
281 int cycle_flags; // cycle flags | |
380
17fcd0c3ee45
Allow multibyte ascii constants in m80ext mode
William Astle <lost@l-w.ca>
parents:
379
diff
changeset
|
282 int genmode; // generation mode (insn_parse_gen0/8/16) |
381
e3f4aaa2a4e8
Allow FCB-like syntax after constant in FCC under m80ext
William Astle <lost@l-w.ca>
parents:
380
diff
changeset
|
283 int fcc_extras; // fcc extra bytes |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
284 lwasm_error_t *err; // list of errors |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
285 lwasm_error_t *warn; // list of errors |
375 | 286 lwasm_errorcode_t err_testmode; // error code in testmode |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
287 line_t *prev; // previous line |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
288 line_t *next; // next line |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
289 int inmod; // inside a module? |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
290 sectiontab_t *csect; // which section are we in? |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
291 struct line_expr_s *exprs; // expressions used during parsing |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
292 char *lstr; // string passed forward |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
293 int pb; // pass forward post byte |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
294 int lint; // pass forward integer |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
295 int lint2; // another pass forward integer |
377
67373a053c49
Add ?rts target for branch instructions
William Astle <lost@l-w.ca>
parents:
376
diff
changeset
|
296 int conditional_return; // for ?RTS handling (1 if RTS follows) |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
297 asmstate_t *as; // assembler state data ptr |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
298 int pragmas; // pragmas in effect for the line |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
299 int context; // the symbol context number |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
300 char *ltext; // line number |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
301 char *linespec; // line spec |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
302 int lineno; // line number |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
303 int soff; // struct offset (for listings) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
304 int dshow; // data value to show (for listings) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
305 int dsize; // set to 1 for 8 bit dshow value |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
306 int isbrpt; // set to 1 if this line is a branch point |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
307 struct symtabe *dptr; // symbol value to display |
49
bd8b3fbd1e28
Added ability to flag macros as "noexpand" so they are not expanded in the listing
lost@l-w.ca
parents:
2
diff
changeset
|
308 |
bd8b3fbd1e28
Added ability to flag macros as "noexpand" so they are not expanded in the listing
lost@l-w.ca
parents:
2
diff
changeset
|
309 int noexpand_start; // start of a no-expand block |
bd8b3fbd1e28
Added ability to flag macros as "noexpand" so they are not expanded in the listing
lost@l-w.ca
parents:
2
diff
changeset
|
310 int noexpand_end; // end of a no-expand block |
219 | 311 int hideline; // set if we're going to hide this line on output |
474
74d0c394666e
Add "noexpandcond" pragma (cleans up listings)
William Astle <lost@l-w.ca>
parents:
473
diff
changeset
|
312 int hidecond; // set if we're going to hide this line due to condition hiding |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
313 }; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
314 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
315 enum |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
316 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
317 symbol_flag_set = 1, // symbol was used with "set" |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
318 symbol_flag_nocheck = 2, // do not check symbol characters |
81
428068681cbf
Added nolist pragma to suppress listing output of non-code generating lines
Lost Wizard (lost@starbug3)
parents:
73
diff
changeset
|
319 symbol_flag_nolist = 4, // no not show symbol in symbol table |
207
07e1fac76321
Added pragma to allow non case sensitive symbols
William Astle <lost@l-w.ca>
parents:
206
diff
changeset
|
320 symbol_flag_nocase = 8, // do not match case of symbol |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
321 symbol_flag_none = 0 // no flags |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
322 }; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
323 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
324 struct symtabe |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
325 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
326 char *symbol; // the name of the symbol |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
327 int context; // symbol context (-1 for global) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
328 int version; // version of the symbol (for "set") |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
329 int flags; // flags for the symbol |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
330 sectiontab_t *section; // section the symbol is defined in |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
331 lw_expr_t value; // symbol value |
195
17bd59f045af
Changed symbol table to use a binary tree.
William Astle <lost@l-w.ca>
parents:
156
diff
changeset
|
332 struct symtabe *left; // left subtree pointer |
17bd59f045af
Changed symbol table to use a binary tree.
William Astle <lost@l-w.ca>
parents:
156
diff
changeset
|
333 struct symtabe *right; // right subtree pointer |
17bd59f045af
Changed symbol table to use a binary tree.
William Astle <lost@l-w.ca>
parents:
156
diff
changeset
|
334 struct symtabe *nextver; // next lower version |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
335 }; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
336 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
337 typedef struct |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
338 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
339 struct symtabe *head; // start of symbol table |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
340 } symtab_t; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
341 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
342 typedef struct macrotab_s macrotab_t; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
343 struct macrotab_s |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
344 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
345 char *name; // name of macro |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
346 char **lines; // macro lines |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
347 int numlines; // number lines in macro |
49
bd8b3fbd1e28
Added ability to flag macros as "noexpand" so they are not expanded in the listing
lost@l-w.ca
parents:
2
diff
changeset
|
348 int flags; // flags for the macro |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
349 macrotab_t *next; // next macro in list |
222
03f7192fcd20
Add --unicorns option for IDE integration
William Astle <lost@l-w.ca>
parents:
219
diff
changeset
|
350 line_t *definedat; // the line where the macro definition starts |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
351 }; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
352 |
49
bd8b3fbd1e28
Added ability to flag macros as "noexpand" so they are not expanded in the listing
lost@l-w.ca
parents:
2
diff
changeset
|
353 enum |
bd8b3fbd1e28
Added ability to flag macros as "noexpand" so they are not expanded in the listing
lost@l-w.ca
parents:
2
diff
changeset
|
354 { |
bd8b3fbd1e28
Added ability to flag macros as "noexpand" so they are not expanded in the listing
lost@l-w.ca
parents:
2
diff
changeset
|
355 macro_noexpand = 1 // set to not expland the macro by default in listing |
bd8b3fbd1e28
Added ability to flag macros as "noexpand" so they are not expanded in the listing
lost@l-w.ca
parents:
2
diff
changeset
|
356 }; |
bd8b3fbd1e28
Added ability to flag macros as "noexpand" so they are not expanded in the listing
lost@l-w.ca
parents:
2
diff
changeset
|
357 |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
358 typedef struct structtab_s structtab_t; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
359 typedef struct structtab_field_s structtab_field_t; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
360 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
361 struct structtab_field_s |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
362 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
363 char *name; // structure field name - NULL for anonymous |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
364 int size; // structure field size |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
365 structtab_t *substruct; // sub structure if there is one |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
366 structtab_field_t *next; // next field entry |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
367 }; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
368 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
369 struct structtab_s |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
370 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
371 char *name; // name of structure |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
372 int size; // number of bytes taken by struct |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
373 structtab_field_t *fields; // fields in the structure |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
374 structtab_t *next; // next structure |
223
211fc8038b8d
More unicorn stuff - structs and macros
William Astle <lost@l-w.ca>
parents:
222
diff
changeset
|
375 line_t *definedat; // line where structure is defined |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
376 }; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
377 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
378 struct asmstate_s |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
379 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
380 int output_format; // output format |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
381 int debug_level; // level of debugging requested |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
382 FILE *debug_file; // FILE * to output debug messages to |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
383 int flags; // assembly flags |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
384 int pragmas; // pragmas currently in effect |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
385 int errorcount; // number of errors encountered |
209 | 386 int warningcount; // number of warnings issued |
375 | 387 int testmode_errorcount; // number of errors in testmode |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
388 int inmacro; // are we in a macro? |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
389 int instruct; // are w in a structure? |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
390 int skipcond; // skipping a condition? |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
391 int skipcount; // depth of "skipping" |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
392 int skipmacro; // are we skipping in a macro? |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
393 int endseen; // have we seen an "end" pseudo? |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
394 int execaddr; // address from "end" |
432
58cafa61ab40
Add support for undocumented custom module format (for LW)
William Astle <lost@l-w.ca>
parents:
406
diff
changeset
|
395 lw_expr_t execaddr_expr; // address from "end" but as an expression |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
396 int inmod; // inside an os9 module? |
210 | 397 int undefzero; // used for handling "condundefzero" |
211
6f2e18f1fe67
Improve autobranchlength pragma
William Astle <lost@l-w.ca>
parents:
210
diff
changeset
|
398 int pretendmax; // set if we need to pretend the instruction is max length |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
399 unsigned char crc[3]; // crc accumulator |
376 | 400 int cycle_total; // cycle count accumulator |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
401 int badsymerr; // throw error on undef sym if set |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
402 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
403 line_t *line_head; // start of lines list |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
404 line_t *line_tail; // tail of lines list |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
405 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
406 line_t *cl; // current line pointer |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
407 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
408 sectiontab_t *csect; // current section |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
409 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
410 int context; // the current "context" |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
411 int nextcontext; // the next available context |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
412 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
413 symtab_t symtab; // meta data for the symbol table |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
414 macrotab_t *macros; // macro table |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
415 sectiontab_t *sections; // section table |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
416 exportlist_t *exportlist; // list of exported symbols |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
417 importlist_t *importlist; // list of imported symbols |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
418 char *list_file; // name of file to list to |
390
1ebb5a0b2874
Add option to specify tab width in listing
William Astle <lost@l-w.ca>
parents:
386
diff
changeset
|
419 int tabwidth; // tab width in list file |
365
3f8abaac214c
Add map file output and option to suppress local symbols in listings
William Astle <lost@l-w.ca>
parents:
361
diff
changeset
|
420 char *map_file; // name of map file |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
421 char *output_file; // output file name |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
422 lw_stringlist_t input_files; // files to assemble |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
423 void *input_data; // opaque data used by the input system |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
424 lw_stringlist_t include_list; // include paths |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
425 lw_stack_t file_dir; // stack of the "current file" dir |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
426 lw_stack_t includelist; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
427 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
428 structtab_t *structs; // defined structures |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
429 structtab_t *cstruct; // current structure |
61
ccaecdff3fc2
Make structure definitions not affect current assembly address and fix up cosmetic offset display in listings
lost@l-w.ca
parents:
53
diff
changeset
|
430 lw_expr_t savedaddr; // old address counter before struct started |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
431 int exportcheck; // set if we need to collapse out the section base to 0 |
70
ceab04fd2969
Fixed premature installation of external reference under UNDEFEXTERN pragma; should not resolve to external references until after the initial parsing pass
lost@l-w.ca
parents:
61
diff
changeset
|
432 int passno; // set to the current pass number |
219 | 433 int preprocess; // set if we are prepocessing |
434 int fileerr; // flags error opening file | |
366
433dbc18fb41
Make byte overflow detection for 8 bit immediate not fail with COM operator
William Astle <lost@l-w.ca>
parents:
365
diff
changeset
|
435 int exprwidth; // the bit width of the expression being evaluated |
442
61580fc48f98
Add option to omit file names from lwasm listings
William Astle <lost@l-w.ca>
parents:
432
diff
changeset
|
436 int listnofile; // nonzero to suppress printing file name in listings |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
437 }; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
438 |
374 | 439 struct symtabe *register_symbol(asmstate_t *as, line_t *cl, char *sym, lw_expr_t value, int flags); |
440 struct symtabe *lookup_symbol(asmstate_t *as, line_t *cl, char *sym); | |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
441 |
384
6ee9c67a0f8d
Add conditional for testing if a pragma is in effect
William Astle <lost@l-w.ca>
parents:
382
diff
changeset
|
442 int parse_pragma_helper(char *p); |
6ee9c67a0f8d
Add conditional for testing if a pragma is in effect
William Astle <lost@l-w.ca>
parents:
382
diff
changeset
|
443 |
376 | 444 int lwasm_cycle_calc_ind(line_t *cl); |
445 int lwasm_cycle_calc_rlist(line_t *cl); | |
446 void lwasm_cycle_update_count(line_t *cl, int opc); | |
447 | |
375 | 448 void lwasm_parse_testmode_comment(line_t *cl, lwasm_testflags_t *flags, lwasm_errorcode_t *err, int *len, char **buf); |
449 void lwasm_error_testmode(line_t *cl, const char* msg, int fatal); | |
450 | |
370
8764142b3192
Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents:
367
diff
changeset
|
451 void lwasm_register_error(asmstate_t *as, line_t *cl, lwasm_errorcode_t err); |
8764142b3192
Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents:
367
diff
changeset
|
452 void lwasm_register_error2(asmstate_t *as, line_t *cl, lwasm_errorcode_t err, const char* fmt, ...); |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
453 |
374 | 454 int lwasm_next_context(asmstate_t *as); |
455 void lwasm_emit(line_t *cl, int byte); | |
456 void lwasm_emitop(line_t *cl, int opc); | |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
457 |
374 | 458 void lwasm_save_expr(line_t *cl, int id, lw_expr_t expr); |
459 lw_expr_t lwasm_fetch_expr(line_t *cl, int id); | |
460 lw_expr_t lwasm_parse_expr(asmstate_t *as, char **p); | |
461 int lwasm_emitexpr(line_t *cl, lw_expr_t expr, int s); | |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
462 |
399
6153cb49403c
Initial commit of pragma newsource
William Astle <lost@l-w.ca>
parents:
390
diff
changeset
|
463 void skip_operand_real(line_t *l, char **p); |
6153cb49403c
Initial commit of pragma newsource
William Astle <lost@l-w.ca>
parents:
390
diff
changeset
|
464 /* this macro can only be used where "l" is the current line pointer */ |
6153cb49403c
Initial commit of pragma newsource
William Astle <lost@l-w.ca>
parents:
390
diff
changeset
|
465 #define skip_operand(p) skip_operand_real(l, p) |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
466 |
374 | 467 int lwasm_lookupreg2(const char *rlist, char **p); |
468 int lwasm_lookupreg3(const char *rlist, char **p); | |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
469 |
374 | 470 void lwasm_show_errors(asmstate_t *as); |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
471 |
374 | 472 int lwasm_reduce_expr(asmstate_t *as, lw_expr_t expr); |
2
7317fbe024af
Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents:
0
diff
changeset
|
473 |
374 | 474 lw_expr_t lwasm_parse_cond(asmstate_t *as, char **p); |
241
d0e9dbe9afbe
Add new heuristic for resolving instruction sizes.
William Astle <lost@l-w.ca>
parents:
226
diff
changeset
|
475 |
374 | 476 int lwasm_calculate_range(asmstate_t *as, lw_expr_t expr, int *min, int *max); |
336
30b2bad9b5eb
Factor some code for simplifying lines so it can be reused
William Astle <lost@l-w.ca>
parents:
333
diff
changeset
|
477 |
374 | 478 void lwasm_reduce_line_exprs(line_t *cl); |
2
7317fbe024af
Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents:
0
diff
changeset
|
479 |
338
5d401d1eb3e9
Allow disabling debugging messages.
William Astle <lost@l-w.ca>
parents:
336
diff
changeset
|
480 #ifdef LWASM_NODEBUG |
5d401d1eb3e9
Allow disabling debugging messages.
William Astle <lost@l-w.ca>
parents:
336
diff
changeset
|
481 #define debug_message(...) |
5d401d1eb3e9
Allow disabling debugging messages.
William Astle <lost@l-w.ca>
parents:
336
diff
changeset
|
482 #define dump_state(...) |
5d401d1eb3e9
Allow disabling debugging messages.
William Astle <lost@l-w.ca>
parents:
336
diff
changeset
|
483 #else |
374 | 484 void real_debug_message(asmstate_t *as, int level, const char *fmt, ...); |
485 void dump_state(asmstate_t *as); | |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
486 |
338
5d401d1eb3e9
Allow disabling debugging messages.
William Astle <lost@l-w.ca>
parents:
336
diff
changeset
|
487 #define debug_message(as,level,...) do { asmstate_t *ras = (as); int rlevel = (level); if (ras->debug_level >= rlevel) { real_debug_message(ras, rlevel, __VA_ARGS__); } } while (0) |
5d401d1eb3e9
Allow disabling debugging messages.
William Astle <lost@l-w.ca>
parents:
336
diff
changeset
|
488 #endif |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
489 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
490 #define OPLEN(op) (((op)>0xFF)?2:1) |
101
ed7f970f3688
Added --define= option to predfine a symbol for assembly
lost@l-w.ca
parents:
81
diff
changeset
|
491 #define CURPRAGMA(l,p) (((l) && ((l)->pragmas & (p))) ? 1 : 0) |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
492 |
399
6153cb49403c
Initial commit of pragma newsource
William Astle <lost@l-w.ca>
parents:
390
diff
changeset
|
493 /* some functions for parsing */ |
6153cb49403c
Initial commit of pragma newsource
William Astle <lost@l-w.ca>
parents:
390
diff
changeset
|
494 /* skip to the start of the next token if the current parsing mode allows it */ |
6153cb49403c
Initial commit of pragma newsource
William Astle <lost@l-w.ca>
parents:
390
diff
changeset
|
495 void lwasm_skip_to_next_token(line_t *cl, char **p); |
6153cb49403c
Initial commit of pragma newsource
William Astle <lost@l-w.ca>
parents:
390
diff
changeset
|
496 |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
497 #endif /* ___lwasm_h_seen___ */ |