ARM Technical Support Knowledge Articles

DEFINING NEW INSTRUCTIONS WITH MACROS

Applies to: A51 Macro Assembler

Answer


Information in this article applies to:


QUESTION

I am using the M8051TBO from Virtual IP Group. This CPU has an additional instruction, DEC DPTR. The opcode is 0A5h but the Keil assembler does not directly support it.

Other IP cores like the Mentor M8051EW have additional instructions, too (Mentor uses opcode 0A5h for a MOVC @DPTR++,A instruction).

How can I use such instructions in my assembler programs?

ANSWER

To use chip-specific instructions, you may define a Macro that expands to the appropriate opcode. For example:

DEC_DPTR  MACRO      ; DEC DPTR instruction on M8051TBO
          DB   0A5H  ; op-code
          ENDM

MOVCI     MACRO      ; MOVC @DPTR++,A instruction on M8051EW
          DB   0A5H  ; op-code
          ENDM

These macros may be used as if they were assembler instructions. For example:

          DEC_DPTR
          MOVCI

MORE INFORMATION

SEE ALSO

Article last edited on: 2006-10-29 19:07:45

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential