annotate lwdisasm/lwdisasm.h @ 408:2a94b2e64621

Started creation of lwdisasm
author lost@l-w.ca
date Mon, 02 Aug 2010 13:24:07 -0600
parents
children cba03436c720
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
408
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
1 /*
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
2 lwdisasm.h
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
3
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
4 Copyright © 2010 William Astle
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
5
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
6 This file is part of LWTOOLS.
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
7
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
8 LWTOOLS is free software: you can redistribute it and/or modify it under the
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
9 terms of the GNU General Public License as published by the Free Software
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
10 Foundation, either version 3 of the License, or (at your option) any later
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
11 version.
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
12
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
13 This program is distributed in the hope that it will be useful, but WITHOUT
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
16 more details.
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
17
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
18 You should have received a copy of the GNU General Public License along with
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
19 this program. If not, see <http://www.gnu.org/licenses/>.
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
20 */
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
21
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
22 #ifndef ____lwdisasm_h_seen____
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
23 #define ____lwdisasm_h_seen____
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
24
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
25 #include <stdint.h>
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
26
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
27 enum
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
28 {
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
29 INPUT_RAW = 0,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
30 INPUT_DECB,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
31 INPUT_OBJ,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
32 INPUT_OS9
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
33 };
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
34
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
35 enum
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
36 {
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
37 TARGET_6809 = 0,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
38 TARGET_6309
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
39 };
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
40
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
41 enum
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
42 {
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
43 ADDR_DIR = 0,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
44 ADDR_EXT,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
45 ADDR_IND,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
46 ADDR_IMM8,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
47 ADDR_IMM16,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
48 ADDR_IMM32,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
49 ADDR_INH,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
50 ADDR_RTOR,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
51 ADDR_PSHPUL,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
52 ADDR_IMM8DIR,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
53 ADDR_IMM8IND,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
54 ADDR_IMM8EXT,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
55 ADDR_BITBIT,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
56 ADDR_REL8,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
57 ADDR_REL16,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
58 ADDR_PAGE1,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
59 ADDR_PAGE2,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
60 ADDR_TFMPP,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
61 ADDR_TFMMM,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
62 ADDR_TFMPC,
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
63 ADDR_TFMCP
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
64 };
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
65
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
66 typedef struct disasmstate_s
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
67 {
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
68 int input_type;
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
69 int debug_level;
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
70 char *output_file;
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
71 char *input_file;
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
72 int target;
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
73 uint8_t *filedata; // the file data
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
74 long filelen; // length of the file data
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
75 int base; // base address (raw)
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
76 int entry; // entry address
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
77 } disasmstate_t;
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
78
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
79
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
80
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
81 typedef struct instab_s
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
82 {
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
83 char *op; // mneumonic
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
84 int addrmode; // addressing mode
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
85 } instab_t;
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
86
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
87 extern instab_t page0_6809[];
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
88 extern instab_t page1_6809[];
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
89 extern instab_t page2_6809[];
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
90
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
91 extern instab_t page0_6309[];
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
92 extern instab_t page1_6309[];
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
93 extern instab_t page2_6309[];
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
94
2a94b2e64621 Started creation of lwdisasm
lost@l-w.ca
parents:
diff changeset
95 #endif // ____lwdisasm_h_seen____