Keil™, An ARM® Company

Technical Support

A51: GETTING DEFINED VALUE FROM THE COMMAND LINE


Information in this article applies to:

  • C51 All Versions

QUESTION

Using the A51 Assembler, I need to define a value via the command line. Is this possible?

ANSWER

No. The symbols you define on the command are defined with the SET keyword and it is not possible to use these as values for a DB or DW.

You may, however, use the #define directive and #include directive to define and include values from a C-style header file. For example, the following include file (ARGS.INC):

#define value 123

may be included in an assembly file.

#include "args.inc"

cseg at 30h

junk:   db      value

end

The resulting listing file shows the assembler output:


                       1     ;#include "args.inc"
                +1     2
                       3
                       4
----                   5     cseg at 30h
                       6
0030 7B                7     junk:   db      123
                       8
                       9     end

Another solution is to use multiple $IF statements to create constants that may be used in your assembler programs. For example:

$IF (VALUE = 230)
CURRENT_BOARD SET 230
$ELSEIF (VALUE = 220)
CURRENT_BOARD SET 220
$ELSEIF (VALUE = 212)
CURRENT_BOARD SET 212
$ELSE
__ERROR__ "Unrecognized value for VALUE in A51 command line."
CURRENT_BOARD SET 0
$ENDIF

SEE ALSO

Last Reviewed: Monday, June 07, 2004


Did this article provide the answer you needed?
 
Yes
No
Not Sure