Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
59
Добавлен:
14.04.2015
Размер:
2.03 Mб
Скачать

Keil Software — A51/AX51/A251 Macro Assembler and Utilities

415

 

 

Appendix C. Listing File Format

This appendix describes the format of the listing file generated by the assembler.

Assembler Listing File Format

The Ax51 assembler, unless overridden by controls, outputs two files: an object file and a listing file. The object file contains the machine code. The listing file contains a formatted copy of your source code with page headers and, if

requested through controls (SYMBOL or XREF), a symbol table.

C

Sample Ax51 Listing

 

A251

MACRO

ASSEMBLER

ASAMPLE1

25/01/2001 15:02:23 PAGE

1

A251

MACRO

ASSEMBLER

V1.40

 

 

OBJECT MODULE PLACED

IN ASAMPLE1.OBJ

 

ASSEMBLER INVOKED BY: F:\RK\ZX\ASM\A251.EXE ASAMPLE1.A51 XREF

 

LOC

OBJ

 

LINE

SOURCE

 

1$NOMOD51

2$INCLUDE (REG52.INC) +1 3 +1 $SAVE

+1 106 +1 $RESTORE

 

 

 

108

NAME

SAMPLE

 

 

 

 

 

 

109

 

 

 

 

 

 

 

 

110

EXTRN

CODE

(PUT_CRLF, PUTSTRING)

 

 

 

111

PUBLIC

TXTBIT

 

 

 

 

 

 

112

 

 

 

 

 

------

 

 

113

PROG

SEGMENT CODE

 

------

 

 

114

PCONST

SEGMENT CODE

 

------

 

 

115

VAR1

SEGMENT DATA

 

------

 

 

116

BITVAR

SEGMENT BIT

 

 

------

 

 

117

STACK

SEGMENT IDATA

 

 

 

 

118

 

 

 

 

 

------

 

 

119

 

RSEG

STACK

 

 

000000

 

 

120

 

DS

10H

; 16 Bytes Stack

 

 

 

121

 

 

 

 

 

000000

 

 

122

 

CSEG

AT

0

 

 

 

 

123

 

USING

0

; Register-Bank 0

 

 

 

124

; Execution starts at address 0 on power-up.

000000

020000

F

125

 

JMP

START

 

 

 

 

 

126

 

 

 

 

 

------

 

 

127

 

RSEG

PROG

 

 

 

 

 

128

; first

set Stack Pointer

 

000000

758100

F

129

START:

MOV

SP,#STACK-1

 

 

 

 

130

 

 

 

 

 

 

 

 

131

; Initialize serial interface

 

 

 

 

132

; Using

TIMER

1 to Generate Baud Rates

 

 

 

133

; Oscillator frequency = 11.059 MHz

000003

758920

 

134

 

MOV

TMOD,#00100000B

;C/T = 0, Mode = 2

000006

758DFD

 

135

 

MOV

TH1,#0FDH

 

000009

D28E

 

136

 

SETB

TR1

 

 

00000B

759852

 

137

 

MOV

SCON,#01010010B

 

 

 

 

138

 

 

 

 

 

416

Appendix C. Listing File Format

 

 

 

 

 

 

139

 

00000E

C200

F

140

 

 

 

 

141

 

 

 

 

142

 

 

 

 

143

 

000010

 

 

144

 

 

 

 

145

 

000010

900000

F

146

 

000013

120000

E

147

 

000016

120000

E

148

 

 

 

 

149

 

000019

8000

F

150

 

 

 

 

151

 

------

 

 

152

 

000000

54455354

 

153

 

000004

2050524F

 

 

 

000008

4752414D

 

 

 

00000C

00

 

 

 

 

 

 

154

 

 

 

 

C

 

 

 

155

------

 

 

156

000000

 

 

157

 

 

 

158

 

 

 

159

 

 

 

 

160

 

------

 

 

161

 

 

 

 

0000.0

 

 

162

 

 

 

 

163

 

 

 

 

164

; clear TXTBIT to read form CODE-Memory CLR TXTBIT

;This is the main program. It is a loop,

;which displays the a text on the console. REPEAT:

;type message

MOV DPTR,#TXT

CALL PUTSTRING

CALL PUT_CRLF

; repeat

 

SJMP

REPEAT

;

 

 

 

 

RSEG

PCONST

TXT:

DB

 

'TEST PROGRAM',00H

; only for

demonstration

 

RSEG

VAR1

DUMMY:

DS

 

21H

; TXTBIT =

0 read text from CODE Memory

; TXTBIT =

1 read text from XDATA Memory

 

RSEG

BITVAR

TXTBIT: DBIT

1

END

XREF SYMBOL TABLE LISTING

---- ------ ----- -------

N A M E

T Y P E

V A L U E

ATTRIBUTES / REFERENCES

BITVAR . . . . . .

B

SEG

000001H

 

REL=UNIT, ALN=BIT

116# 161

DUMMY. . . . . . .

D

ADDR

000000H

R

SEG=VAR1

157#

 

PCONST . . . . . .

C

SEG

00000DH

 

REL=UNIT, ALN=BYTE

114# 152

PROG . . . . . . .

C

SEG

00001BH

 

REL=UNIT, ALN=BYTE

113# 127

PUTSTRING. . . . .

C

ADDR

-------

 

EXT

110#

147

 

PUT_CRLF . . . . .

C

ADDR

-------

 

EXT

110#

148

 

REPEAT . . . . . .

C

ADDR

000010H

R

SEG=PROG

144# 150

 

SAMPLE . . . . . .

 

108

 

 

 

 

 

 

STACK. . . . . . .

I

SEG

000010H

 

REL=UNIT, ALN=BYTE

117# 119 129

START. . . . . . .

C

ADDR

000000H

R

SEG=PROG

125 129#

 

TXT. . . . . . . .

C

ADDR

000000H

R

SEG=PCONST

146 153#

TXTBIT . . . . . .

B

ADDR

0000H.0

R

SEG=BITVAR

111 140 162#

VAR1 . . . . . . .

D

SEG

000021H

 

REL=UNIT, ALN=BYTE

115# 156

REGISTER BANK(S) USED: 0

ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S)

Keil Software — A51/AX51/A251 Macro Assembler and Utilities

417

 

 

Listing File Heading

Every page has a header on the first line. It contains the words Ax51 MACRO ASSEMBLER followed by the title, if specified. If the title is not specified, then the module name is used. It is derived from the NAME directive (if specified), or from the root of the source filename. On the extreme right side of the header, the date (if specified) and the page number are printed.

In addition to the normal header, the first page of listing includes the Ax51 listing file header. This header shows the assembler version number, the file name of the object file, if any, and the entire invocation line.

C

418

Appendix C. Listing File Format

 

 

Source Listing

The main body of the listing file is the formatted source listing. A section of formatted source is shown in the following.

Sample Source Listing

 

LOC

OBJ

LINE

SOURCE

 

000006 758DFD

135

MOV TH1,#0FDH

 

The format for each line in the listing file depends on the source line that appears

C

on it. Instruction lines contain 4 fields. The name of each field and its meanings

is shown in the list below:

 

 

LOC shows the location relative or absolute (code address) of the first byte of

the instruction. The value is displayed in hexadecimal.

OBJ shows the actual machine code produced by the instruction, displayed in

hexadecimal. If the object that corresponds to the printed line is to be fixed up (it contains external references or is relocatable), an F or E is printed after the OBJ field. The object fields to be fixed up contain zeros.

LINE shows the INCLUDE nesting level, if any, the number of source lines

from the top of the program, and the macro nesting level, if any. All values in this field are displayed in decimal numbers.

SOURCE shows the source line as it appears in the file. This line may be

extended onto the subsequent lines in the listing file.

DB, DW, and DD directives are formatted similarly to instruction lines, except the OBJ field shows the data values placed in memory. All data values are shown. If the expression list is long, then it may take several lines in the listing file to display all of the values placed in memory. The extra lines will only contain the LOC and OBJ fields.

The directives that affect the location counter without initializing memory (e.g. ORG, DBIT, or DS) do not use the OBJ field, but the new value of the location counter is shown in the LOC field.

The SET and EQU directives do not have a LOC or OBJ field. In their place the assembler lists the value that the symbol is set to. If the symbol is defined to equal one of the registers, then REG is placed in this field. The remainder of the directive line is formatted in the same way as the other directives.

Соседние файлы в папке HLP