| ||||||||
Technical Support On-Line Manuals Ax51 User's Guide | Translate and Link ProcessTypically you will use the Ax51 assembler and the tools within the µVision IDE. For more information on using the µVision IDE refer to the User's Guide µVision2: Getting Started for 8051. However, you may invoke the Ax51 assembler also from the command line. Simply type the name of the assembler version that you want to use, for example A51 at the Windows command prompt. On this command line, you must include the name of the assembler source file to be translated, as well as any other necessary control directives required to translate your source file. Example: A51 DEMO.A51 The assembler output for this command line is: A51 MACRO ASSEMBLER V6.00 ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) After assembly of all your program modules, the object modules are linked and all variables and addresses are resolved and located into an executable program by the Lx51 linker. The following example shows a simple command line for the linker: BL51 DEMO.OBJ, PRINT.OBJ The linker generates an absolute object file as well as a map file that contains detailed statistic information and screen messages. The output of the linker is: BL51 LINKER/LOCATER V4.00 LINK/LOCATE RUN COMPLETE. 0 WARNING(S), 0 ERROR(S) Then you might convert the executable program into an Intel HEX file for PROM programming. This is done with the OHx51 hex conversion utility with the following invocation: OH51 DEMO The output of the hex conversion utility is: OBJECT TO HEX FILE CONVERTER OH51 V2.40 GENERATING INTEL HEX FILE: DEMO.HEX OBJECT TO HEX CONVERSION COMPLETED. An example listing file generated by the assembler is:
A51 MACRO ASSEMBLER ASSEMBLER DEMO PROGRAM 07/07/2000 18:32:30 PAGE 1
MACRO ASSEMBLER A51 V6.01
OBJECT MODULE PLACED IN demo.OBJ
ASSEMBLER INVOKED BY: C:\KEIL\C51\BIN\A51.EXE DEMO.A51 DEBUG
LOC OBJ LINE SOURCE
1 $title (ASSEMBLER DEMO PROGRAM)
2 ; A simple Assembler Module for Demonstration
3
4 ; Symbol Definition
000D 5 CR EQU 13 ; Carriage?Return
000A 6 LF EQU 10 ; Line?Feed
7
8 ; Segment Definition
9 ?PR?DEMO SEGMENT CODE ; Program Part
10 ?CO?DEMO SEGMENT CODE ; Constant Part
11
12 ; Extern Definition
13 EXTRN CODE (PRINTS, DEMO)
14
15 ; The Program Start
---- 16 CSEG AT 0 ; Reset Vector
0000 020000 F 17 JMP Start
18
---- 19 RSEG ?PR?DEMO ; Program Part
0000 900000 F 20 START: MOV DPTR,#Txt ; Demo Text
0003 120000 F 21 CALL PRINTS ; Print String
22 ;
0006 020000 F 23 JMP DEMO ; Demo Program
24
25 ; The Text Constants
---- 26 RSEG ?CO?DEMO ; Constant Part
0000 48656C6C 27 Txt: DB 'Hello World',CR,LF,0
0004 6F20576F
0008 726C640D
000C 0A00
28
29 END ; End of Module
SYMBOL TABLE LISTING
------ ----- -------
N A M E T Y P E V A L U E ATTRIBUTES
?CO?DEMO . . . . . C SEG 000EH REL=UNIT
?PR?DEMO . . . . . C SEG 0009H REL=UNIT
CR . . . . . . . . N NUMB 000DH A
DEMO . . . . . . . C ADDR ----- EXT
LF . . . . . . . . N NUMB 000AH A
PRINTS . . . . . . C ADDR ----- EXT
START. . . . . . . C ADDR 0000H R SEG=?PR?DEMO
TXT. . . . . . . . C ADDR 0000H R SEG=?CO?DEMO
REGISTER BANK(S) USED: 0
ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S)
| |||||||
| ||||||||