From:	CSBVAX::CSBVAX::MRGATE::"SMTP::VAXMFG.TECH.NWU.EDU::CHOJNACKI"  2-MAR-1989 16:39
To:	MRGATE::"ARISIA::EVERHART"
Subj:	March 2 UNMACRO source 8/8


Received: from vaxmfg.tech.nwu.edu by accuvax.nwu.edu id aa13700;
          2 Mar 89 12:48 CST
Date: Thu, 2 Mar 89 13:01 CST
From: Bob Chojnacki <CHOJNACKI@vaxmfg.tech.nwu.edu>
Subject: March 2 UNMACRO source 8/8
To: EVERHART%ARISIA.decnet@ge-crd.arpa
X-VMS-To: IN%"EVERHART%ARISIA.decnet@ge-crd.arpa"
Message-ID:  <8903021248.aa13700@accuvax.nwu.edu>

+-+-+-+ Beginning of part 8 +-+-+-+
X    o SEARCH is a little goofy (does not quite work correctly)
$ GOSUB UNPACK_FILE
$ FILE_IS = "UNMACRO.H"
$ CHECKSUM_IS = 946412171
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X/*
X  UNMACRO common data
X
X  Copyright (c) 1988 By Robert Thomas Chojnacki, All rights reserved.
X*/
X#ifdef`009mainfile
Xint limit;
Xint base=0;
Xint top=0;
Xchar *image;
Xchar *bytetype;
Xint pc=0;
Xint opcode;
Xchar in_file[64];
Xchar out_file[] = "UNMACRO$OUT";
Xint lastliteral;
X#else
Xextern int limit;
Xextern int base;
Xextern int top;
Xextern char *image;
Xextern char *bytetype;
Xextern int pc;
Xextern int opcode;
Xextern char in_file[64];
Xextern char *out_file;
Xextern int lastliteral;
X#endif
$ GOSUB UNPACK_FILE
$ FILE_IS = "UNMACRO.HLP"
$ CHECKSUM_IS = 1798114771
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X1 UNMACRO
X  Unmacro is a tool for picking apart those programs you compiled and
Xassembled but forgot where you put the source code.
X
X    $ UNMACRO imagefile[.exe]
X
X2 Introduction
X  Not finished yet
X
X2 DISASSEMBLE
X  Disassembles an instruction or data value
X
X  Format:
X
X    DISASSEMBLE entity
X
X  where entity is either a mask-type, UNTIL, or ALL
X3 UNTIL
X  Disassmebles until the program counter (pc):
X
X    END  - reaches the end of the image
X    PC   - is greater than or equal to a value
X    DATA - reaches a non-instruction byte
X4 Examples
X  Disassemble starting at the current pc and going to the end of the image:
X
X    DISASSEMBLE UNTIL END
X
X  Disassemble starting at the current pc and going to a specified pc:
X
X    DISASSEMBLE UNTIL PC 120FF
X
X  Disassemble starting at the current pc and going until a byte is specified
X  as non-data:
X
X    DISASSEMBLE UNTIL DATA
X3 ALL
X  Disassemble starting at the base of the image and going until the end.
X
X3 Examples
X  Disassemble the next value as an ASCII value:
X
X    DISASSEMBLE ASCII
X2 DUMP
X  Display the next 256 byte in a dump format
X2 HEADER
X  Display the image header in a dump format
X2 GOTO
X  Set the pc to a new value
X
X    GOTO address
X2 QUIT
X  Exit the program
X2 SAVE-UNSAVE
X  Store and recall the image mask.  The image mask is a byte array the same
X  size as the image that specifies whether the byte it corresponds to is an
X  instruction or a data value of some sort.
X
X  Format:
X
X    SAVE mask-file
X    UNSAVE mask-file
X2 SEARCH
X  Search the image, starting at the current pc and going until the string is
X  found or until the end of the image is reached.
X2 SET-SHOW
X
X3 BYTE
X  Force the next byte to be interpreted as the mask-type given.
X
X  Format:
X
X    SET BYTE mask-type
X3 CASE
X  Not used
X4 LOWER
X
X4 UPPER
X
X3 MODE
X  Not used
X4 BINARY
X
X4 OCTAL
X
X4 DECIMAL
X
X4 HEXADECIMAL
X
X3 WORD
X  Force the next 2 bytes to be interpreted as the mask-type given.
X
X  Format:
X
X    SET WORD mask-type
X3 LONG
X  Force the next 4 bytes to be interpreted as the mask-type given.
X
X  Format:
X
X    SET LONG mask-type
X3 QUAD
X  Force the next 8 bytes to be interpreted as the mask-type given.
X
X  Format:
X
X    SET QUAD mask-type
X3 OCTA
X  Force the next 16 bytes to be interpreted as the mask-type given.
X
X  Format:
X
X    SET OCTA mask-type
X3 RANGE
X  Force the next n bytes to be interpreted as the mask-type given.
X
X  Format:
X
X    SET RANGE mask-type count
X
X  Where count is the number of bytes to force to be interpreted as the
X  mask-type specifies.  Note: count is a hexadecimal number.
X3 LABEL
X  When the byte is disassembled, there will be a label preceding it of
X  the form:
X
X   laddress:
X
X  For example: if the byte at pc 200 was labeled, then, when it is
X  disassembled, it would appear as follows:
X
X    l200:`009.byte`009x`094025
X3 UNLABEL
X  Removes a label set by SET LABEL.
X2 STATS
X  Displays important information such as transfer addresses, image base,
X  etc.
X2 Mask-Types
X   These are the different types of masks that may be placed on top of
X the image to force how it will be disassembled
X
X3 UNDEFINED
X  The byte will not be interpreted.
X3 INSTRUCTION
X  The byte will be interpreted as an instruction.
X3 BYTE
X  The byte will be interpreted as a .BYTE directive.
X3 WORD
X  The byte will be interpreted as a .WORD directive.
X3 LONG
X  The byte will be interpreted as a .LONG directive.
X3 QUAD
X  The byte will be interpreted as a .QUAD directive.
X3 OCTA
X  The byte will be interpreted as a .OCTA directive.
X3 F_FLOATING
X  The byte will be interpreted as a .F_FLOATING directive.
X3 D_FLOATING
X  The byte will be interpreted as a .D_FLOATING directive.
X3 G_FLOATING
X  The byte will be interpreted as a .G_FLOATING directive.
X3 H_FLOATING
X  The byte will be interpreted as a .H_FLOATING directive.
X3 ASCII
X  The byte will be interpreted as a .ASCII directive.
X3 ASCIC
X  The byte will be interpreted as a .ASCIC directive.
X3 ASCID
X  The byte will be interpreted as a .ASCID directive.
X3 ASCIZ
X  The byte will be interpreted as a .ASCIZ directive.
X3 BLKB
X  The byte will be interpreted as a .BLKB directive.
X3 BLKW
X  The byte will be interpreted as a .BLKW directive.
X3 BLKL
X  The byte will be interpreted as a .BLKL directive.
X3 BLKQ
X  The byte will be interpreted as a .BLKQ directive.
X3 BLKO
X  The byte will be interpreted as a .BLKO directive.
X3 ADDRESS
X  The byte will be interpreted as a .ADDRESS directive.
X3 MASK
X  The byte will be interpreted as a .MASK directive.
X3 ENTRY
X  The byte will be interpreted as a .ENTRY directive.
X2 WRITE
X  Disassembles the entire image and sends the output to a file.
X
X  Format:
X
X    WRITE listing-file
X2 SYMBOL
X  Lets you define symbols
X3 DEFINE
X  Define a symbol name.
X3 LIST
X  Lists all symbols in the symbol table.
X3 REMOVE
X  Removes a symbol from the symbol table.
$ GOSUB UNPACK_FILE
$ EXIT
-+-+-+-+-+ End of part 8 +-+-+-+-+-
