Using Operators

An __asm block cannot use C-specific operators, such as the << operator. However, operators shared by QuickC and MASM, such as the * operator, are interpreted as assembly-language operators. For instance, outside an __asm block, square brackets ( [] ) are interpreted as enclosing array subscripts, which C automatically scales to the size of an element in the array. Inside an __asm block, they are seen as the MASM index operator, which yields an unscaled byte offset from any data object or label (not just an array). The following code illustrates the difference:

int array[10];

__asm mov array[6], bx ; Store BX at array+6 (not scaled)

array[6] = 0; /* Store 0 at array+12 (scaled) */

The first reference to array is not scaled, but the second is. Note that you can use the TYPE operator to achieve scaling based on a constant. For instance, the following statements are equivalent:

__asm mov array[6 * TYPE int], 0 ; Store 0 at array + 12

array[6] = 0; /* Store 0 at array + 12 */