Constants in SHx Inline Assembly
The SH-3, SH3-DSP, and SH-4 inline assembly language supports only integer constants. SHx assembly does not support character constants.
Express integer constants with a prefix that indicates the radix. The radix prefix indicates the base of the constant. The following table lists integer types and their radix prefix.
Integer | Prefix |
---|---|
Binary Numbers | The radix indicator B' or b' plus a binary constant |
Octal Numbers | The radix indicator Q' or q' or 0 plus an octal constant |
Decimal Numbers | The radix indicator D' or d' plus a decimal constant |
Hexadecimal Numbers | The radix indicator H' or h' or 0x Or OX plus a hexadecimal constant |
The radix indicator and the constant value must be written with no intervening space.
The following examples show how to define integer constants in an __asm block. Comments use the // convention.
__asm("cmp/eq #0xff, r0" ); // Hexadecimal number
__asm("cmp/eq #H'ff, r0" ); // Hexadecimal number
__asm("cmp/eq #255, r0" ); // Decimal number
__asm("cmp/eq #d'255, r0" ); // Decimal number
__asm("cmp/eq #b'10, r0" ); // Binary number
__asm("cmp/eq #B'10, r0" ); // Binary number
__asm("cmp/eq #Q'10, r0" ); // Octal number
__asm("cmp/eq #010, r0" ); // Octal number
See Also
Elements of the SHx __asm Block | The __asm Keyword in SHx Inline Assembly | __asm Restrictions in SHx Inline Assembly | SH-4 Mode Bits | Symbols and Labels in SHx Inline Assembly | SHx Inline Assembly Parameters | Branching in SHx Inline Assembly
Last updated on Thursday, April 08, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.