![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
Microcontrollers ApNote AP0827 : Additional file AP082701.EXE available ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family ADIS51 allows the analysis of program code for the microcontrollers of the 8051/C500 family. Program code in different formats can be loaded and displayed in Hex-dump or Disassembler format. Single instructions can be input using the built-in Assembler. Program code flow and instructions can be analysed and written into a Log-file in a list or assembler source format. SFR and bit symbol operation is provided using a symbol definition file. Richard Schmid, Microcontroller Product Definition, Siemens HL Munich Semiconductor Group 10.97, Rel. 01 ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family Contents 1 2 3 4 5 6 6.1 6.2 6.3 6.4 7 7.1 7.2 7.3 8 9 A B C Page Starting of ADIS51 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Main Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Basic Function Basic Function AP0827 ApNote - Revision History Actual Revision : 10.97 Rel. 01 Previous Revision : none (Original Version) Page of Page of actual Rev. prev.Rel. Subjects (changes since last release) Semiconductor Group 2 of 22 AP0827 10.97 ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family 1 Starting of ADIS51 The program ADIS51.EXE is an MS-DOS program. It can be started under MS-DOS or in an MSDOS window of a Windows operating system. If no parameter is added, ADIS51 comes up in a 25line/80-columns text mode. It is also possible to initiate the program using a 43- or 50-line text mode. This mode is selected calling the program by ADIS51 /43 . After ADIS51 has been started the title screen is displayed. Pressing any further key will turn on the main menu screen. When ADIS51 is loaded, the program searches for a file called ADIS51.SYM, which contains the device, the special function register, and the bit symbol definitions. If this file is not present in the directory where ADIS51 is located and started, ADIS51 will operate without any microcontroller specific register or bit symbol. This capability of symbol definitions in an external file allows a very flexible adaption of ADIS51 to all types of the 8051/C500 family microcontrollers with their different SFR and bit symbols. The syntax of the symbol definition file is shown in appendix C of this ApNote. Semiconductor Group 3 of 22 AP0827 10.97 ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family 2 Main Menu Figure 1 shows the main menu in 25-line mode. Figure 1 : Main Menu Screen of ADIS51 The main menu screen of ADIS51 is divided into three sections : - The upper area of the screen (3 lines), the help area, shows the actual available basic functions of the program and the related key which is used to select these basic functions. - The middle area of the screen, the display area, is used to display the content of the 64K byte memory buffer in the Disassembler or Hex-dump menu. The number of text lines of this area depends on the text mode, in which ADIS51 is started (16, 34, or 41 lines). - The lower area of the screen (2 lines), the status area, is used to display status information and error messages (see Appendix A). File names and addresses are also input in this screen area. The right part of the status area shows the actual selected type of microcontroller, as defined in the symbol definition file, and the state of the Log-File (closed or open). The seven basic functions of ADIS51 can be selected from the main menu. These basic functions are assigned to the function keys F1 to F7 as follows : Pressing Semiconductor Group 4 of 22 AP0827 10.97 ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family 3 Basic Function ADIS51 provides a 64K byte memory buffer which is assigned to be used as program memory buffer for instructions or data, which are generated by assembler and compiler programs. These instructions and data are normally stored with absolute addresses in data files using different formats. Figure 2 shows the types of data formats which can be loaded by ADIS51. HEX- and OBJfile formats are the Intel type of format. Figure 2 : Data File Load Selection Window Pressing Semiconductor Group 5 of 22 AP0827 10.97 ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family 4 Basic Function This function allows to generate data files with the content of the memory buffer. It is invoked by pressing Semiconductor Group 6 of 22 AP0827 10.97 ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family 5 Basic Function This function allows to select a microcontroller device with its related SFR- and bit symbols. This function is only available, if the device with its symbols has been defined in the symbol definition file ADIS51.SYM. In the example of figure 3 five devices have been defined. Figure 3 : Microcontroller Type Selection Window After the selection of the microcontroller type the name of the microcontroller is displayed in the right corner of the status area. Also all SFR and bit symbols, which are defined for the selected type of MCU in the symbol definition file ADIS51.SYM, are activated. Semiconductor Group 7 of 22 AP0827 10.97 ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family 6 6.1 Basic Function After pressing It is not possible to move the scrollbar in the screen area directly to an address which is less than the start address. For this operation a new start address must be defined (using Figure 4 : Disassembler/One-Line Assembler Menu of ADIS51 Semiconductor Group 8 of 22 AP0827 10.97 ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family The one-line assembler capability accepts opcodes and operands as input of instructions as they are defined in Appendix B. For the one-line assembler 8- and 16-bit values of an instruction can be input either in decimal or hexadecimal notation, but they are always output as hexadecimal values. If SFRs and bit symbols are defined for the active microcontroller device (see chapter 5), the disassembler displays SFR addresses and bit addresses with its symbol. The one-line assembler also accepts symbol names as an input for an operand. SFR and bit symbol output/input can be switched off by an option (see chapter 9). After an instruction has been modified or input by using the cursor left/right keys and the Memory Buffer Code Analysis When a data file is loaded into the memory buffer, sometimes its content is unknown but wants to be analysed and or changed and reassembled. This capability is supported with ADIS51 too in the disassembler menu. One of the main difficulties in the analysis of a 8051 program code is to seperate code and data which is placed together in the 64K program memory area. The code analysis capability provides a half-automatical tracing of instructions. The analysis is started at the instruction which is just indicated with the scrollbar. The program code is analysed sequentially and each instruction which has been analysed is marked. Also destination addresses of jump and call instruction are marked and sequentially analysed. Figure 5 shows the code analyse option window which is opened when Figure 5 : Code Analysis Options Semiconductor Group 9 of 22 AP0827 10.97 ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family Two functions are provided in the code analysis capability of ADIS51, which cannot be solved automatically by a sequential instruction tracing : - Manually marking of instruction placed at interrupt start adresses as a subroutine - Manually marking of instructions after a JMP @A+DPTR instruction as a jump destination Interrupt procedures are normally not reached by a sequential tracing of the program code. Therefore, instructions at possible interrupt addresses in the memory buffer must be marked manually as the first address of a subroutine. After this interrupt address marking, the code must be analysed again (normally from address 0000H). As a second problem, sequential tracing stops when it detects a JMP @A+DPTR instruction and outputs a warning as shown in figure 6. All addresses of JMP @A+DPTR instructions should be noted. After the end of the analysing procedure, the instructions around the JMP @A+DPTR instruction must be checked manually. Thereafter, instructions following the JMP @A+DPTR instruction can be marked as a jump destination and the code must be re-analysed again. Figure 6 : JMP @A+DPTR Instruction Warning Message If a data file has been loaded into the memory buffer, the data bytes which have been loaded are displayed in yellow colour. When the analysing procedure is started, start and end address of the memory buffer area where data has been loaded into is always detected. Memory buffer bytes, which have been analysed already, are displayed in cyan colour. This colour marking allows easy checking of the analysing result. After the termination of a code analysis run a status message with an analysing summary is displayed in the status area (see figure 7). This summary informes the total block size and the number of analysed bytes as well as the number of jump and call labels which have been detected. Figure 7 : Code Analysis Status Result The analysing result is also stored in a result file ADIS51.TXT. This result file includes additionally the addresses of the jump and call locations which have been detected during the analysis run. The jump and call locations are numbered with Jxxx and Cxxx. Note: When pressing Semiconductor Group 10 of 22 AP0827 10.97 ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family Example of a Code Analysis Result File : ;========================================================================== ; ADIS51 V4.0 - Code Analysis Result ;========================================================================== ; Bytes analysed from 0000H to 1037H Total code bytes analysed : 042BH Jumps detected : 46 Calls detected : 26 List of all jump addresses : J001: J002: .. .. .. J046: 008FH 00F5H 06DEH List of all call addresses : C001: C002: .. .. .. C026: 0066H 0073H 06D6H 6.3 Input of a New Address Pressing the Semiconductor Group 11 of 22 AP0827 10.97 ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family 6.4 Generation of a Log-File The Log-file generation capability in the disassembler menu allows to write disassembler data from the memory buffer into an ASCII file. Two formats for disassembler data can be choosen : - Listing format or - Assembler format The listing format includes instruction addresses as well as the data bytes followed by the instruction mnemonics. When the assembler format is used for Log-File generation, the Log-file itself can be used as an input source file for an 8051 assembler program. If the memory buffer has been already analysed, jump and call addresses as well as instruction labels and subroutine labels are replaced by the symbolic names (Jxxx and Cxxx) which have been detected during the code analysis run. The absolute addresses are inserted as a comment in the lines where the Jxxx and Cxxx labels occur. Sometimes there are some gaps in the data of the memory buffer (bytes displayed in white colour). These bytes have not been written into the memory buffer by loading of a data file before. After a code analysis run has been executed, these "white" bytes are skipped and no more written into the Log-file. After pressing Semiconductor Group 12 of 22 AP0827 10.97 ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family Log-File Example Part 1 : Listing Format ;========================================================================== ; ADIS51 V4.0 - LOG-File ;========================================================================== ; 0000 : 02 00 8F LJMP J007 ;008FH 0003 : 02 00 5A C001: LJMP J004 ;005AH 000B : 02 00 2E 001B : 02 00 3E 0023 : 02 00 5D 002B 002E 0030 0033 0036 0038 003A 003D 003E 0040 .... .... 0080 0083 0086 0089 008A 008B 008C 008D 008E 008F 0092 .... .... : : : : : : : : : : : : : : : : : : : : : 02 C2 75 75 B2 D2 12 32 C2 75 53 75 75 22 C2 9F C2 9E 22 75 C2 00 8C 8A 8C 02 8C 02 4D 00 D8 63 J002: C002: C003: C004: C005: J001: LJMP LJMP LJMP LJMP CLR MOV MOV CPL SETB LCALL RETI CLR MOV ANL MOV MOV RET J001 J002 J005 J003 TR0 TL0,#00H TH0,#0D8H 02H TR0 C012 TR1 TH1,#0FAH 0C8H,#0C0H 0CAH,#00H 0CBH,#00H ;002EH ;003EH ;005DH ;004DH ;0263H 8E 8D FA C8 C0 CA 00 CB 00 C008: 81 20 B5 J007: MOV CLR SP,#20H P3.5 Comment : Up to address 002BH there are some gaps in the data of the memory buffer. After address 0040H the Log-file is truncated up to address 0080H. The bytes at addresses 8AH to 8EH have not been detected as valid instructions during the analysis and therefore they are displayed as memory bytes only. Semiconductor Group 13 of 22 AP0827 10.97 ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family Log-File Example Part 2 : Assembler Format ;========================================================================== ; ADIS51 V4.0 - LOG-File ;========================================================================== ; CSEG AT 00000H LJMP J007 ;008FH C001: LJMP J004 ;005AH CSEG C002: LJMP CSEG C003: LJMP CSEG C004: LJMP CSEG C005: LJMP J001: CLR MOV MOV CPL SETB LCALL RETI J002: CLR MOV .... .... C008: ANL MOV MOV RET DB DB DB DB DB J007: MOV CLR AT J001 AT J002 AT J005 0000BH ;002EH 0001BH ;003EH 00023H ;005DH ;004DH AT 0002BH J003 TR0 TL0,#00H TH0,#0D8H 02H TR0 C012 TR1 TH1,#0FAH 0C8H,#0C0H 0CAH,#00H 0CBH,#00H 0C2H 09FH 0C2H 09EH 022H SP,#20H P3.5 ;0263H Comment : When using the assembler format for a Log-file generation absolute code segment definitions (CSEG) are inserted into the Log-file. The bytes 8AH to 8EH (4. line below label C008:)), which have not been detected as valid instructions during the analysis, are included using the "DB" ("define byte") directive. Semiconductor Group 14 of 22 AP0827 10.97 ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family The Log-file example 3 below shows the Log-file content when SFR and bit symbols are written into a Log-file. Log-File Example Part 3 : SFR and Bit Symbols Format ADIS51 V4.0 - List of SFR Symbols for MCU 8051 (in Listing Format) 80: P0 81: SP .. .. F0: B ADIS51 V4.0 - List of SFB Symbols for MCU 8051 80: P0.0 81: P0.1 .. .. F7: B.7 ; ADIS51 V4.0 - List of SFR Symbols for MCU 8051 (in Assembler Format) P0 SP .. .. B ; DATA DATA DATA 80H 81H 0F0H ADIS51 V4.0 - List of SFB Symbols for MCU 8051 IT0 IE0 .. .. CY BIT BIT BIT 88H 89H 0D7H Semiconductor Group 15 of 22 AP0827 10.97 ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family 7 7.1 Basic Function Pressing Figure 8 shows an example of a Hex-dump screen. Bytes in yellow colour have been loaded from a data file before. White coloured bytes are spare memory bytes. After a execution of a code analysis, cyan coloured bytes indicate bytes, which have been already analysed. Figure 8 : Hex-Dump Function of ADIS51 Semiconductor Group 16 of 22 AP0827 10.97 ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family The Hex-dump function is left by pressing Pressing the The Log-file generation capability in the Hex-dump menu allows to write data from the memory buffer in hex notation into an ASCII file. Two formats for hex data can be choosen : - Listing format or - Assembler format The listing format for hex data includes memory buffer addresses and hex data with 16 bytes in one row, as hexadecimal and ASCII characters. When using the assembler format for a Log-file generation an absolute code segment definition (CSEG) is inserted into the Log-file. The data bytes are written into the Log-file using the "DB" ("define byte") directive. The example below shows both types of Hex-dump data written into one Log-file. Log-File Example Part 4 : Hex-Dump Format ;========================================================================== ; ADIS51 V4.0 - LOG-File ;========================================================================== ; 0000 : 02 00 8F 02 00 5A 00 00 00 00 00 02 00 2E 00 00 .._..Z.......... 0010 : 00 00 00 00 00 00 00 00 00 00 00 02 00 3E 00 00 .............>.. 0020 : 00 00 00 02 00 5D 00 00 00 00 00 02 00 4D C2 8C .....].......MAOE 0030 : 75 8A 00 75 8C D8 B2 02 D2 8C 12 02 63 32 C2 8E uS.uOEO.OOE..c2A* CSEG AT 00000H DB 002H,000H,08FH,002H,000H,05AH,000H,000H,000H,000H,000H,002H,000H,02EH,000H,000H DB 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,002H,000H,03EH,000H,000H DB 000H,000H,000H,002H,000H,05DH,000H,000H,000H,000H,000H,002H,000H,04DH,0C2H,08CH DB 075H,08AH,000H,075H,08CH,0D8H,0B2H,002H,0D2H,08CH,012H,002H,063H,032H,0C2H,08EH DB 075H,08DH,0FAH,075H,08BH,0FFH,005H,00CH,0B2H,003H,0D2H,08EH,032H,0C2H,0CAH,0C2H If data shall be written into a Log-file by pressing Semiconductor Group 17 of 22 AP0827 10.97 ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family 8 Basic Function This function can be used to get an information about the usage of the memory buffer after a data file has been loaded into the memory buffer (basic function Figure 9 : Memory Buffer Usage Window Semiconductor Group 18 of 22 AP0827 10.97 ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family 9 Basic Function With this function three options can be selected. Pressing the keys <1> to <3> always toggles the related option. The displayed value is always active (see figure 10). Pressing another key closes the options window again. Figure 10 : Options Window The first option can be used to enable/disable SFR- and bit-symbols in disassembler outputs and one-line ssembler inputs. The symbols must be defined in an external symbol definition file (ADIS51.SYM). If the second option is enabled, every load of a data file is preceeded by a memory buffer clear operation (64K memory buffer is loaded with 00H). This memory buffer clear operation can be disabled. The third option allows to select the Log-file format. The Log-file can be generated in a type of listing format or in an assember input format, which can be directly used by the standard 8051/C500 assembler programs as an input source file. More details about the format of a Log-file is given in chapter 6 and 7. Semiconductor Group 19 of 22 AP0827 10.97 ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family Appendix A Error and Status Messages Cause Input of an invalid file name or file does not exist. During loading of a data file a checksum error has been detected. The data file load operation is aborted. During the reading of a data file no absolute located code/data information has been detected and loaded into the memory buffer. Probably the data file has a wrong format. During loading of a data file a wrong file format has been detected. The load operation has been aborted. The character which has been input is invald and was not accepted. Invalid address (only hexadecimal values allowed). An invalid instruction has been input; the one-line assembler cannot disassemble the instruction (instruction format see Appendix B) For further disassembling of the memory buffer a new start address must be input (using Error-/Status Message File access error Checksum error No absolute code/data has been loaded Invalid file format Invalid OBJ-file format Invalid input Invalid address Invalid instruction Display buffer exceeded or Code memory limit reached End of code memory - input lower address Disassembler start address reached Start address is greater than end address xxx-File name is loaded File name is created Log-File is created Symbol definition file: not available or invalid format MCU selection is not available - no MCU-type defined File exists ! Overwrite/Append/Cancel ? A file (data or log file) to be written already exyists or is open. The file can be closed, overwritten, appended or the action can be cancelled. Semiconductor Group 20 of 22 AP0827 10.97 ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family B One-Line Assembler Conventions Instruction Format : Opcodes Operands MOV A,Rn A,direct A,@Ri A,#data Rn.A Rn,direct Rn,#data direct,A direct,Rn direct,direct direct,@Ri direct,#data @Ri,A @Ri,direct @Ri,#data DPTR,#data16 A,@A+DPTR A,@A+PC A,@Ri A,@DPTR @Ri,A @DPTR,A A,Rn A,direct A,@Ri A,@Ri direct A,Rn A,direct A,@Ri A,#data XCHD ACALL AJMP LCALL LJMP Opcodes Operands ANL ORL XRL A,Rn A,direct A,@Ri A,#data direct,A direct,#data A Rn direct @Ri DPTR AB A Opcodes Operands JMP SJMP JZ JNZ JC JNC JB JNB JBC CJNE @A+DPTR rel INC DEC bit,rel INC MUL DIV CLR CPLRL RLC RR RRC DA SWAP PUSH POP XCH A,direct,rel A,#data,rel Rn,#data,rel @Ri,#data,rel Rn,rel direct,rel bit DJNZ CLR CPL SETB C MOVC MOVX direct A,Rn A,direct A,@Ri A,@Ri addr11 addr16 XCH ANL ORL MOV ANL ORL MOV RET RETI NOP C,bit C,/bit bit,C - XCHD PUSH POP ADD ADDC SUBB The operands shown in table are abbreviations for the following inputs : Rn Rii direct data data16, addr16, rel addrr11 bit R0-R7 R0, R1 0-255 or 00H-0FFH or SFR symbol 0-255 or 00H-0FFH 0-65535 or 0000H-0FFFFH 0-2047 or 000H-07FH 0-255 or 00H-0FFH or bit symbol or SFR.x (x=0-7) Generally, numbers can be input as decimal or hexadecimal values. For hexadecimal values the standard convention is valid : a "0" must preceed the value if the hexadecimal value begins with a letter ("A" - "F"); the hexadecimal value ends with a "H". Inputs for the assembler are not case sensitive. Semiconductor Group 21 of 22 AP0827 10.97 ADIS51 - Disassembler with One-Line Assembler for the 8051 and C500 8-Bit Microcontroller Family C Definition of the Symbol Definition File ;============================================================================== ; Symbol Definition File for ADIS51 V4.0 - Rules ;============================================================================== ; ; The symbol definition file for the ADIS51 V4.0 Disassembler allows to ; define symbols for SFR's and bits of the SFR's for up to 15 different ; 8051 compatible microcontrollers. Such a symbol definition file is build ; up according the following rules : ; ; 1. Comment lines have a ";" in the first row of a line. All following ; characters in this line are ignored. ; ; 2. Empty lines (with 0DH, 0AH) can be inserted everywhere. ; ; 3. The definition file has 3 sections. Each section is validated by ; a keyword. The keywords of these sections are : ; Keyword "[MCU]" --> MCU-Section: defines the names of the MCUs ; Keyword "[SFR]" --> SFR-Section: defines the names of the Special ; Function Registers ; Keyword "[SFB]" --> SFB-Section: defines the names of the bits of the ; Special Function Registers. ; The keywords must be placed in the first row of a line. ; ; 4. Definitions in the MCU-Section : ; "xxxxxxx hhhh" : "xxxxxxx" starts in the first row of a column and ; is the (short-)name of the microcontroller; ; (max. 7 ASCII characters) ; "hhhh" is a 4-digit hexword, coded with a "1" in one ; of the 15 bit positions, starting with bit position ; 0; this hexword is separated from the name with ex; actly one blank character; ; The lines in the MCU-Section shall be ordered by ascending bit ; positions of "hhhh". ; ; 5. Definitions in the SFR-/SFB-Sections : ; Lines of the SFR-/SFB-Sections have exactly 3 parts, separated each ; by one blank character. ; "aa xxxxxxx hhhh" : "aa" is a 2-digit hexbyte value, which defines ; the 8-bit address of a SFR or SFB and starts in ; the first row of a column; ; "xxxxxxx" is the name of the SFR/SFB with the ; address "aa"; (max. 7 ASCII characters); ; "hhhh" is a 4-digit hexword; a "1" in a dedicated ; bit position defines, that the symbol 'xxxxxxx' ; is valid for the MCU, which has also a "1" de; fined at the same bit position in the MCU-Section ; ;============================================================================== ; Note : The file AP082701.EXE includes an example for a symbol definition file. Semiconductor Group 22 of 22 AP0827 10.97 |
Price & Availability of AP082701
![]() |
|
|
All Rights Reserved © IC-ON-LINE 2003 - 2022 |
[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy] |
Mirror Sites : [www.datasheet.hk]
[www.maxim4u.com] [www.ic-on-line.cn]
[www.ic-on-line.com] [www.ic-on-line.net]
[www.alldatasheet.com.cn]
[www.gdcy.com]
[www.gdcy.net] |