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

📄 das.doc

📁 一个C style Assembler的source code
💻 DOC
字号:
                 8051 DISASSEMBLER, notes on use.(0) COMMAND LINE, INPUT FORMAT   This is a disassembler for the Intel 8051-family of processors.  It iscurrently set to read up to and including the 8052.   The typical conmmand line for this disassembler is:                     das <asm.hex >asm.sThe input file (read from standard input) is assumed to be in Intel HexFormat.  The output is placed in standard output (or in a file whenredirection is used).  A third file:                          entriesis used to specify a list of entry points for das to use.   Currently, it will only accept input in Intel Hex format located betweenthe addresses 0000 and 4000 (hex).  It will read entry points from a file:"entries" and recursively disassemble all the addresses "reachible" fromthose listed as entry points.  A sample entries file, input file and output fileare provided with the software.  The format of each address in the file is(starting at column 1):HHHH<cr>with the H's representing the digits of the address in hexadecimal.   Typically entry points are assigned to 0000, the starting address, andthe address of each interrupt-handler that is used.(1) OUTPUT FORMAT   The output of the disassembler is not exactly re-assembleable.  When thedisassembler searches for reachible segments of code, it will fail to resolveindirect jumps (jmp @A + DPTR, jmp @A + PC), and will fail to recognizevirtual jumps created by manipulating the stack pointer, e.g.push DPLpush DPHret        ;;; An indirect jump to the address pointed to by DPTR.In addition, if the original program contained data tables, these wouldnormally be passed by untouched.   The disassembler will regard anything in the allocated code space thatwas not accessible as being data.  If necessary, you will have to visuallyinspect the disassembled code for indirect jumps and stack pointermanipulations to determine what addresses are being indirectly referenced.Then you could add these addresses to the entry point list in the file"entries" and disassemble again.  This, in turn, may reveal additionalindirect addresses, so that there is an iterative process implied here tocompletely disassemble code.   For assistance, a list of locations where indirect jumps occur will belisted in the following format:Indirect jump at <Address>   In the sample program provided, there were no indirect jumps.  However,since the assembly-language software implements a multitasking kernel, itheavily manipulates the stack pointer.  Consquently, the addresses listed inthe entries file are not just the starting address (0000), and interrupthandler(s) (0023), but also derived addresses: 0067 (found on the firstiteration). and 0131 (found on the second).   Also, any addresses referenced that lie outside the range of the Intel HexFormat file will be listed as external references.  These are listed in thefollowing form:REF: <Address>   Data segments will be clearly marked as such, beginning with the header:DATA at <Address>following which will be a hexadecimal listing of the "data" in the formatillustrated below:34 aa ef 00 00 00 00 00 34 ee ff 00 00 00 00 00 |4       4      |A list of up to 16 bytes in hexadecimal notation is generated, and then betweenvertical bars is the list of corresponding ASCII characters. Control charactersand meta characters (those ranging from 128 to 255) are "blanked" out.  Thecharacter listing allows you to easily recognize embedded string constantswherever they occur.Labels are generated for SFR's corresponding to the 8052 processor, and Bitlabels are likewise generated.  These are listed in the tables SFRs, and Bitscontained in the disassembler source, and can be modified to suit whateverversion of the 8051 you are using.In the output, addresses are labeled in the format illustrated below:                             C3458The initial letter indicates the number of times this address is referencedwith the following key:             B = 1 reference, C = 2 references, D = 3, E = 4, etc.the next 4 items represent that actual address of the label in hexadecimal.(2) ERRORS   The disassembler will duly note where disassembled instructions overlap,or where it cannot further process input.No entry points listed.Bad hexadecimal digit in input.   The input file "entries" was not found, or contained corrupt data.Address out of range 0 - 4000h in input.   The input file contains a portion of a program lying outside the address   range 0 to 4000 (hex).  The disassembler cannot go beyond 4000h.  This is   a fatal error, disassembly stops.Bad format string, PC = HHHH.   Something's wrong with your compiler or operating system, or the source file   has been corrupted.  Report this promptly to me, if you should see this. :)Bad hexadecimal digit in input.Bad checksum.Unexpected EOF   The input file contained a portion not strictly in Intel Hex Format.Entry into ARG at <Address>.   An entry point is accessing a point that has already been disassembled as   the interior of an instruction.OP into ARG at <Address>.   An attempt was made to disassemble an instruction starting at an address   already contained in the interior of another instriction.  The disassembler   is generating overlapping instructions.ARG into OP at <Address>.   An attempt was made to disassemble an argument to an instruction at an   address already disassembled as the first byte of another instruction.ARG into ARG at <Address>.   An attempt was made to disassemble an argument to an instruction at an   address already disassembled as an argument of another instruction.   The presence of this error indicates that something is wrong with your   compiler or operating system, or the source file has been corrupted.   Report this promptly to me, as well, if you should see this error.Too many entries, PC = <Address>.   The number of pending points for the disassembler to process exceeded its   capacity.(3) USER SUPPORT and GUARANTEE   This software has been rigorously verified with respect to the descriptiongiven above.  It will also conform to the description of the binary codingof the 8051 processor supplied by Intel.   Since this was a hobby project mainly intended for myself and not for awider audience, you will be on your own in using this software.  However, I aminterested in hearing any feedback you have.  Send comments to my e-mailaddress, markh@csd4.csd.uwm.edu.  If you want to make upgrades, I encourageyou to try your hand at it.  That's exactly why I'm distributing this packagefree.

⌨️ 快捷键说明

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