Ax51 User's Guide

Examples

The following assembler source file shows the usage of C Macros.

#if !defined (__A51__) || (__A51__ < 700)
#error "This source file requires A51 Assembler V7.00 or higher"
#endif

#pragma NOLIST
#include <REG51.H> // Register file for Intel 8051
#pragma LIST

#define TEST1 10
#define MYTEXT "Hello World"

CSEG    AT      0
        MOV     A,#TEST1 * 10

#if TEST1 == 10
        DB      MYTEXT
#endif

        DB      "GENERATED: ", __DATE__
END

The listing file generated by the assembler shows the text replacements performed by the C preprocessor:

LOC  OBJ            LINE     SOURCE

                       1


                       4
                     100     $LIST
                     101
                     102
                     103
                     104
----                 105     CSEG    AT      0
0000 7464            106             MOV     A,#10 * 10
                     107
                     108
0002 48656C6C        109             DB      "Hello World"
0006 6F20576F
000A 726C64
                     110
                     111
000D 47454E45        112             DB      "GENERATED: ", "Nov 28 2004"
0011 52415445
0015 443A204E
0019 6F762032
001D 38203230
0021 3034
                     113     END