Keil Logo

A251: Using DRK Registers with Immediate Values

Information in this article applies to:

  • C251 Version 2.14


I can't seem to move or compare 32-bit immediate values with a double register (DR0, DR4, etc.). What's going on?


The 251 supports the MOV and the CMP instructions for double registers and sign-extended 16-bit values. 32-bit values are not supported.


The A251 manual is misleading in its description of the syntax of these instructions. The following is a small example assembly file that demonstrates the use of each of the four instructions:

CSEG    AT      0

CMP DR0, #00001234H   ; Compare DR0 with 0x00001234 (zero extended data)
CMP DR0, #0FFFF1234H   ; Compare DR0 with 0xFFFF1234 (one extended data)

MOV DR4, #00001234H   ; Move 0x00001234 into DR4 (zero extended data)
MOV DR4, #0FFFF1234H   ; Move 0xFFFF1234 into DR4 (one extended data)


When assembled, this gives the following output.

000000                    1     CSEG    AT      0
000000 BE081234           4             CMP DR0, #00001234H
000004 BE0C1234           5             CMP DR0, #0FFFF1234H
000008 7E181234           8             MOV DR4, #00001234H
00000C 7E1C1234           9             MOV DR4, #0FFFF1234H
                         12     END

Looking at the opcodes and operands generated you can see that the initial '0000' or 'FFFF' (extended data) is only used to distinguish between two different opcodes, and the data used is actually only 1234H.

Last Reviewed: Wednesday, September 21, 2016

Did this article provide the answer you needed?
Not Sure
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.