3
* Main function for Dis51.
5
* Copyright 2001 - 2003 by David Sullins
7
* This file is part of Dis51.
9
* Dis51 is free software; you can redistribute it and/or modify it under the
10
* terms of the GNU General Public License as published by the Free Software
11
* Foundation, version 2 of the License.
13
* Dis51 is distributed in the hope that it will be useful, but WITHOUT ANY
14
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18
* You should have received a copy of the GNU General Public License along with
19
* Dis51; if not, write to the Free Software Foundation, Inc., 59 Temple
20
* Place, Suite 330, Boston, MA 02111-1307 USA
22
* You may contact the author at davesullins@earthlink.net.
25
* 0.4, 3 Nov 2003: Only documentation changes.
26
* 0.3, 14 Feb 2003: Updated for newer libhexfile.
27
* 0.2: first numbered version, updated for new libhexfile.
38
int main(int argc, char **argv)
49
memset(lbl, 0, 65536*2);
51
/* read hex file from stdin */
52
if (init_hexfile(&hf, 65536, stdin, NULL)) {
53
fprintf(stderr, "Error opening hex file.\n");
57
fprintf(stderr, "Error reading hex file.\n");
63
/* Set listing mode */
64
if(!strcmp(argv[i],"-l")) {
67
/* use entry point 0 if none given on command line */
72
/* use entry points from command line */
73
for (; i < argc; ++i) {
75
sscanf(argv[i], "%d", &entry);
79
fprintf(stderr, "Warning: NULL argument on command line.\n");
82
ul = strtoul(p, &q, 0);
84
fprintf(stderr, "Error: Bad address '%s'. Abort\n", argv[i]);
93
/* use entry point 0 if none given on command line */
96
/* disassemble to stdout */