A251: USING DRK REGISTERS WITH IMMEDIATE VALUES
Information in this article applies to:
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) END
When assembled, this gives the following output.
000000 1 CSEG AT 0 2 3 000000 BE081234 4 CMP DR0, #00001234H 000004 BE0C1234 5 CMP DR0, #0FFFF1234H 6 7 000008 7E181234 8 MOV DR4, #00001234H 00000C 7E1C1234 9 MOV DR4, #0FFFF1234H 10 11 12 END 13
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: Sunday, June 12, 2005