⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 objasm.doc

📁 把obj文件变成汇编代码的源程序
💻 DOC
📖 第 1 页 / 共 2 页
字号:
        70h       REGINT        Register Initialization Record
        72h       REDATA        Relocatable Enumerated Data Record
        74h       RIDATA        Relocatable Iterated Data Record
        76h       OVLDEF        Overlay Definition Record
        78h       ENDREC        End Record
        7Ah       BLKDEF        Block Definition Record
        7Ch       BLKEND        Block End Record
        7Eh       DEBSYM        Debug Symbols Record
        82h       LHEADR        L-Module Header Record
        84h       PEDATA        Physically Enumerated Data Record
        86h       PIDATA        Physically Iterated Data Record
        8Eh       TYPDEF        Type Definition Record
        92h       LOCSYM        Line Numbers Record
        94h       LINNUM        Line Number Record
        A4h       LIBHED        Library Header Record
        A6h       LIBNAM        Library Module Names Record
        A8h       LIBLOC        Library Module Locations Record
        AAh       LIBDIC        Library Value Dictionary

    MICROSOFT documents an obsolete method for generating communal records
using the TYPDEF record.  This obsolete method is not handled by OBJASM.


    The dis-assembler portion of OBJASM is a two pass process.  The first
determines where local labels and symbols need to be placed, and the second
outputs the dis-assembled instructions (with the labels and symbols).

    To determine whether to dis-assemble instructions or data, OBJASM performs
a look ahead operation on each byte of the data records.  If the byte is a
printable character, then successive bytes are checked as well.  The main 
module has a two variables called 'code_string' and 'data_string' which are
used to specify the minimum length of a string.  The 'code_string' value
is used in code segments while the 'data_string' value is used in data
segments.  If this minimum length of printable characters is exceeded, then
the bytes will be output as a string.  OBJASM is shipped with a value of 20
for 'code_string' and 3 for 'data_string'.  They work well for most .OBJ files.

    Bytes which are not contained in strings are checked against an instruction
lookup and processing routine.  If it is determined that this byte will 
generate a valid instruction, then it is output as an instruction.  All other
bytes are output as simple data bytes.

    Some assemblers and compilers will generate .OBJ records which contain
a portion of a string or instruction in one record and the remainder in the
next .OBJ record.  OBJASM does not handle this very well.  Strings spanning
more than one record will be divided. Instructions spanning more than one
record will not be recognized.  Output would look this this:

String:
    db  'This is all o'       it should be      db  'This is all one string'
    db  'ne string'

Instruction:
    db  0BBh                  it should be      mov bx,MYSYMBOL

    dw  MYSYMBOL

    OBJASM attempts to accomodates for this by keeping a 16 byte overlap
area.  This overlap area is checked before processing the end of a record.
This helps alleviate the problem for objects which are smaller that 16 bytes,
something which is true for all normal instructions.

    For some other interesting quirks in OBJASM, please read the sections
titled "Differences in .OBJ files which cannot be detected" and "Features
allowable in .OBJ format which are not translatable into MASMable code".

ADDITIONAL INFORMATION FILE
---------------------------
    The additional information file, specified with the -f option, is another
method of specifying information to OBJASM.  Lines in this file take one of
the following formats:

    Format:                         Example:
      SEG segname segtype               SEG DRIVER CODE

    This specifies that the segment named "segname" should be considered
either data or code.  The segtype should be either CODE or DATA indicating
which type is desired. Normally OBJASM determines the segment using the
segment's name, but specifying the segment name and segment type in this
way allows overiding this determination.

    Format:                         Example:
      var = segname : offset            TableY = DRIVER : 128
                                        TableX = DRIVER : 200h

    This specifies that a label should be placed within the segment "segname"
at the offset "offset".  This can be used to add labels to the dis-assembled
code, and can also be used to overide the internal labels generated by OBJASM.

    Format:                         Example:
      segname : offset : datatype       DRIVER : 200h : DW
                                        DRIVER : 202h : DD

    This directs OBJASM to avoid the instruction/string look-ahead process
and output data of a specified type.  OBJASM outputs a data directive within
the specified segment named "segname", at the offset "offset".  The "datatype"
can be any of these values: DB, DW, DD, DF, DQ, or DT.  These correspond to
the MASM base data types.

    Although this last format allows direct control of how OBJASM outputs
data, care must be taken to put OBJASM into a state where it can actually
use this information.   If OBJASM is processing data as an instuction, it
cannot be directed to output a data directive in the middle of that
instruction.  For example:

    Additional information:           .OBJ FILE:
        SOME_SEGMENT: 1 : DW             8B360200   MOV SI,[0002]

this would direct OBJASM to output a word in the middle of the MOV instruction.
In-order to accomplish this, the addtional information file would have to
direct that the first byte of the MOV instruction was also a data byte.
To get it to work, you would have to have this:

    Additional information:           .OBJ FILE:
        SOME_SEGMENT: 0 : DB             8B         db  08Bh
        SOME_SEGMENT: 1 : DW             3602       dw  0236h
                                         00         ...

Other
-----

    Yes, there always is a section which defies categorization...
The OBJASM program being continually refined.  If you have any comments about
its execution, wish to add features to it, or need to report a bug(s), please
contact:

        Robert F. Day
        19906 Filbert Drive
        Bothell, WA 98012
        (206) 481-8431

    The following section is a list of bugs that could not be fixed before
shipping OBJASM.  Please read the bug and problems lists to familiarize
yourself with the known bugs and problem situations.  The design notes are
included to help you help me in refining OBJASM.  If you need (or want) to
add features to OBJASM, please contact me.  We may be working on a similar
addition and we may be able to save you some time.

-------------------
Bugs to Dec 14 1990
-------------------

1.  TYPDEF records are ingored (I had some Digital Research Libraries which
    used TYPDEF records, but Microsoft doesn't use them).

2.  Some languages generate segment names which are the same as the names
    of labels within the segment.  MASM won't allow this.  Please rename
    the segment, if possible.

--------------------------------------------------
Differences in .OBJ files which cannot be detected
--------------------------------------------------

(1) if label2 = label1 + 010h

        MOV     AX,label1 + 0010h           ; Might have been like this

                    and

        MOV     AX,label2                   ; OBJASM will generate this
                                            ; (Evaluates to equivalent address)

      Reason: Public labels are resolved in local code before being sent to
              the linker.  Although the .OBJ specifications allow two places
              to store symbol addition information (above, the 0010h), MASM 
              only uses one of them. This is a probable source of some other
              .OBJ differences.  MASM automatically computes the offset of
              the public symbol and creates a fixup record indicating that
              the offset of the segment added to the offset of the public
              within the segment should be used (rather than just a fixup
              indicating that the offset of the public should be used).

    Handling: When resolving a reference to an address which is not equal to a
              public symbol, a new local symbol is created.


-------------------------------------------------------------------------------
Features allowable in .OBJ format which are not translatable into MASMable code
-------------------------------------------------------------------------------

(1)   A piece of code like:

        DW      _labeln - $             ; Relative (data form of local jmp/call)

    Reason:  MASM will not compile the above line.  It is an equivalent data
             representations for relative 'JMP's and 'CALL's
             where _labeln is the label to jump or call to.

    Handling: If OBJASM detects this type of code (almost all .OBJ files have
              it) then the data output function will substitute an
              actual value for the $ operator.  This will be noted by a nasty
              comment. The dis-assembly output function will still work if
              they are truly 'JMP's or 'CALL's (Relative addressing is
              proceeded by the jump short or call short opcodes).

-----------------
End of OBJASM.DOC

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -