Disassembly, I2L Code Dump and Data

Top  Previous  Next

The IDE gives you the option of viewing the raw I2L instructions and data. This is an advanced debugging feature that is probably only relevant to people working on EXPL itself. In some instances it may be useful for debugging a program or at least understanding what the compiler is doing and how it is doing it. To view this feature, select the Debug -> I2L/Disassembly option from the menu bar. The dialog displays detailed information about the I2L codes that make up the program. (Click here for a detailed description of I2L Opcodes.)

 

I2LDialog

 

Before you can view the disassembly and all other information associated with the disassembly, you must press the Disassemble button.

 

The I2L dialog consists of a side panel and three pages. Here is a detailed description of each component:

 

1. Side Panel. Here is a description of the components on the side panel:

 

a. Disassemble Button. Pressing the Disassemble button compiles the code and then disassembles it, extracting various aspects of the program and displaying the result as described below.

 

b. Show Source w/ I2L. When this option is enabled, the source code for the program is inserted into the I2L disassembly so you can see which lines of code generate which instructions. There are examples shown below.

 

d. Show Code-Data Map. When this option is enabled, a map showing the positions of the code and data is displayed. This option is explained in detail below.

 

2. Disassembly Page. The Disassembly Page shows the I2L code in assembly language format, which breaks the code into its component parts. (Note: A dynamic I2L opcode disassembly is also displayed in the Debugger.) This includes the hex values for the addresses, I2L opcodes and operands; as well as the mnemonics for the opcodes and descriptive labels for the operands. This helps you understand the program flow and operations of the program on a very low-level basis. (A complete description of the I2L opcodes is beyond the scope of this document.)

 

Here is an example of an I2L disassembly showing just the I2L opcodes:

 

0000: 00                      EXIT

0001: 09 0E00                 HPI (14)

0004: 21 00 0800              ADDR

0008: 21 00 0A00              ADDR

000C: 21 00 0C00              ADDR

0010: 0C 69                   CML (105)

0012: 24 00                   SIMM ($00)

0014: 24 00                   SIMM ($00)

0016: 0C 17                   CML (23)

0018: 24 00                   SIMM ($00)

001A: 8C                      GLOB ($0C)

001B: 0C 1B                   CML (27)

001D: 0C 21                   CML (33)

001F: 08 2500                 JPC

0022: 07 2800                 JMP ($0028)

0025: 07 0400                 JMP ($0004)

0028: 06                      RET

 

Here is an example of an I2L disassembly that includes both source code and the I2L opcodes:

 

SetVid($03);                                \restore normal text display

 

02FF: 24 03                   SIMM ($03)

0301: 0C 2D                   CML (45)

 

DeallocBitmap(FontBM);                        \clean up

 

0303: 8A                      GLOB ($0A)

0304: 0C 6F                   CML (111)

 

DeallocBitmap(Image);

 

0306: 88                      GLOB ($08)

0307: 0C 6F                   CML (111)

 

end;        \Main

 

0309: 06                      RET

 

2. I2L Page. This page displays the raw I2L data in its hex loader format. This is only useful to low-level programmers designing the XPL0 language. A complete description of the hex loader format is beyond the scope of this document. Here is a sample of the I2L code:

 

;000007*000007*0000

;00032707*000007*000007*000007*0000

;000D0902002400010800000C0B24000C09882400100300080006

^000B090200010600000A010508*000D06

^0008090200010400000A010506*000A06

^0005247B0A010504*000706

^0001090A000502*000424050300080006$

 

3. Code/Data Map. The Code/Data Map page displays a list of every byte in the program and indicates whether the byte is code or data. This is only useful to low-level programmers designing the XPL0 language. The option is very CPU intensive and can take several seconds to produce for a long program. For this reason the Code/Data Map is only displayed when the program is compiled with the Code-Data Map check box at the top of the dialog enabled. Here is a sample Code-Data Map:

 

0228: 00 - Code

0229: 07 - Code

022A: AC - Code

022B: 02 - Code

022C: 27 - Data

022D: 00 - Data

022E: 3B - Data

022F: 00 - Data

0230: 00 - Data

0231: 00 - Data