DumpObj/DumpOBJ.cc

1 line
68 KiB
C++
Raw Normal View History

/************************************************************** * * DumpOBJ 2.0 * * By Phil Montoya * Translation to ORCA/C & 2.0 enhancements by Mike Westerfield. * * DumpOBJ 1.1 Copyright November 1986-88 * By the Byte Works, Inc. * * DumpOBJ 2.0 Copyright 1991 * Byte Works, Inc. * **************************************************************** * * Version 2.0.1, 7 July 94 * Mike Westerfield * * 1. Added resource fork. * ****************************************************************/ #pragma keep "DumpOBJ" #pragma optimize 9 /* GS specific declarations */ /*--------------------------*/ extern pascal void PDosInt(); int toolerror(void); #define WRITE_CONSOLE(parm) (PDosInt(0x015A,parm)) #define GetFileInfoGS(pBlockPtr) PDosInt(0x2006,pBlockPtr) #pragma lint -1 /* Standard C Libraries */ /*----------------------*/ #include <stdlib.h> #include <ctype.h> #include <stdio.h> #include <string.h> /* Constants */ /*-----------*/ #define BOOLEAN int /* boolean variables */ #define TRUE 1 #define FALSE 0 #define FILEMAX 1024 /* max length of file name */ #define NAMEMAX 512 /* maximum size of variable len name */ #define NAMESIZE 11 /* size of label name */ #define OBJFL 177 /* minimum object file type */ #define MAXFL 190 /* maximum object file type */ #define LIBFL 178 /* library file type */ #define BLKSIZE 512 /* size of block */ #define COP 2 /* COP opcode */ #define REP 194 /* REP opcode */ #define SEP 226 /* SEP opcode */ /* Object File Opcodes */ /*---------------------*/ #define OPALIGN 224 /* align to a boundry */ #define OPORG 225 /* set code origin */ #define OPRELOC 226 /* relocation entry */ #define OPINTSEG 227 /* inserseg record */ #define OPUSING 228 /* use data area */ #define OPSTRONG 229 /* force segment inclusion */ #define OPGLOBAL 230 /* define global label */ #define OPGEQU 231 /* define global constant */ #define OPMEM 232 /* reserve absolute memory */ #define OPEXPR 235 /* computed value */ #define OPZEXPR 236 /* computed zero page value */ #define OPBEXPR 237 /* computed local bank value */ #define OPRELEXPR 238 /* computed relative ofset */ #define OPLOCAL 239 /* define local label */ #define OPEQU 240 /* define local constant */ #define OPDS 241 /* define storage */ #define OPLONG 242 /* long constant > $DF bytes */ #define OPLEXPR 243 /* outer segment expression */ #define OPENTRY 244 /* run time lib entry dictionary */ #define OPSRELOC 245 /* short relocation entry */ #define OPSINTSEG 246 /* short interseg entry */ #define OPSUPER 247 /* super compressed records */ /* Program variables */ /*-------------------*/ char fname[FILEMAX]; /* input file name buffer */ char nlist[NAMEMAX]; /* names list */ char symbol[NAMEMAX]; /* symbol name buffer */ BOOLEAN names; /* names list flag */ BOOLEAN sTable; /* found a COP symbol table? */ int act_lablen; /* actual length of label read */ int status; /* shell return status */ int namc; /* name argument counter */ int ftype; /* current file type */ long blocks; /* used to get to next segment */ long constant; /* constant byte counter and flag */ long opcode; /* opcode storage */ long segmark; /* start of segment marker */ long count; /* file counter */ long number; /* number read variable */ long pc; /* segment program counter */ long tkind; /* type of node for tree */ long *root; /* root pointer for expression tree */ FILE *input; /* input file */ /* Output Control Settings */ /*-------------------------*/ int format; /* format of output 0 opcode dump 1 dissassembly dump 2 hex dump */ BOOLEAN shorth; /* print short headers? */ BOOLEAN ireg; /* long index registers? */ BOOLEAN mreg; /* long accumulator? */ BOOLEAN longc; /* print long constants? */ BOOLEAN header; /* print segment headers? */ BOOLEAN body; /* print segment bodies? */ BOOLEAN checkf; /* check file types? */ BOOLEAN colf; /* print displacement numbers? */ /* Object Module Header */ /*