1 /*\
2  *  dxa v0.1.1 -- symbolic 65xx disassembler
3  *
4  *  Copyright (C) 1993, 1994 Marko M\"akel\"a
5  *  Changes for dxa (C) 2005, 2006 Cameron Kaiser
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with this program; if not, write to the Free Software
19  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  *
21  *  Marko does not maintain dxa, so questions specific to dxa should be
22  *  sent to me at ckaiser@floodgap.com . Otherwise,
23  *
24  *  Contacting the author:
25  *
26  *   Via Internet E-mail:
27  *      <Marko.Makela@FTP.FUNET.FI>
28  *
29  *   Via Snail Mail:
30  *      Marko M\"akel\"a
31  *      Sillitie 10 A
32  *      FIN-01480 VANTAA
33  *      Finland
34 \*/
35 
36 /* options.h - constant definitions for program options */
37 #ifndef _OPTIONS_H_
38 #define _OPTIONS_H_
39 
40 /************** USER DEFINED SETTINGS ... you may change these **************/
41 
42 /* #define LONG_OPTIONS	*//* turn on if you want them -- needs getopt_long() */
43 
44 /******************* WHITE HATS ONLY BELOW THIS POINT !! ********************/
45 
46 #ifndef _MAIN_C_
47 extern
48 #endif
49 unsigned int Options;
50 
51 /****************\
52 * OUTPUT OPTIONS *
53 \****************/
54 
55 #define M_ADDRESSES   12 /* ADDRESS INFORMATION PRODUCTION */
56 #define O_ADR_NOTHING 0  /* do not include addresses in the output */
57 #define O_ADR_ADRPFIX 8  /* begin each line with its assembling address */
58 #define O_ADR_ADR_DMP 12 /* begin each line with a hexadecimal dump of
59                             its address and the bytes it contains */
60 
61                          /* LABEL INFORMATION PRODUCTION */
62 #define B_LBL_NO_EXT  0  /* do not produce labels for referred
63                             addresses outside the program's area */
64 #define B_LBL_ALWAYS  16 /* substitute all found address references
65                             with label references */
66 
67 #define M_ADR_TABLES  96 /* ADDRESS TABLE DETECTION */
68 #define O_TBL_IGNORE  0  /* do not detect any address tables */
69 #define O_TBL_DETECT  32 /* detect address tables and provide them
70                             with label statements */
71 #define O_TBL_NOEXT   64 /* detect only addresses that belong to
72                             the program file */
73 
74                          /* ADDRESS STATEMENT INTERPRETATION */
75 #define B_STM_IGNORE  0  /* do not detect or interpret statements
76                             like lda #<label */
77 #define B_STM_DETECT  128 /* provide load instructions with label
78                             statements when possible*/
79 
80 			/* TAB OR COLON */
81 #define B_LABTAB	0 /* use tabs to separate labels from text */
82 #define B_LABCOL	262144 /* use colon and newline */
83 
84 /********************\
85 * PROCESSING OPTIONS *
86 \********************/
87 
88 			  /* STARTING ADDRESS */
89 #define B_SA_WORD     65536 /* write the starting address as .word to file */
90 #define B_SA_NO_WORD  0   /* ... or don't */
91 #define B_GET_SA	131072 /* read the first 2 bytes as starting address */
92 #define B_NO_GET_SA	0	/* ... or expect them on the command line */
93 
94                           /* CUSTOM STACK HANDLING COMPATIBILITY */
95 #define B_STK_SUSPECT 0   /* assume that a JSR might not return to the
96                              following address; mark the routines
97                              following a JSR as "potential". */
98 #define B_STK_BALANCE 256 /* expect the rest of the routine following
99                              a JSR to be valid */
100 
101                           /* ROUTINE DETECTION */
102 #define B_RSC_LOUSE   0   /* all routines that consist of plain single-byte
103                              instruction (e.g. RTI or RTS) are valid */
104 #define B_RSC_STRICT  512 /* routines found by scanning remaining
105                              unprocessed bytes must consist of more
106                              than one instruction to be valid */
107 
108 #define M_DATA_BLOCKS 3072 /* DATA BLOCK DETECTION */
109 #define O_DBL_IGNORE  0    /* list the whole file as a program; dump hex
110                               only if the area is marked as a data block */
111 #define O_DBL_DETECT  1024 /* if a "suspected" routine contains invalid
112                               code or jumps to any routine that leads to
113                               any routine containing invalid code, the
114                               start byte of it is marked to be data */
115 #define O_DBL_NOSCAN  2048 /* skip the scanning in the fourth phase (3.4):
116                               list as data all the bytes that have remained
117                               unprocessed in the previous phases */
118 #define O_DBL_STRICT  3072 /* if a "sure" routine contains illegal code,
119                               exit the unassembling process immediately */
120 #define B_DETECT_BASIC	524288 /* if SA = $0801, define $0801-... as data */
121 #define B_NO_DETECT_BASIC 0    /* ... or don't */
122 
123                            /* IMPROVED DATA BLOCK DETECTION */
124 #define B_JMP_LOUSE   0    /* `stupid' jumps cause only warnings to the
125                               output listing */
126 #define B_JMP_STRICT  4096 /* valid routines may not contain unreasonable
127                               branches or jumps like `BNE *' (D0 FE),
128                               `JMP *' or `JSR *' */
129 #define B_BRK_ACCEPT  0    /* a BRK or STP is considered to mark the end of
130                               a routine */
131 #define B_BRK_REJECT  8192 /* any routine that contains a BRK or an STP is
132                                invalid */
133 
134 #define B_SCEPTIC    16384 /* determines if the program should suspect also
135                               the target addresses of relative branches */
136 
137 #define B_CROSSREF   32768 /* determines if a cross-reference should
138                               be created */
139 
140 #endif /* _OPTIONS_H_ */
141