The offset must be constant for the register indirect addressing modes. This constant may be an immediate or a variable address relocated by the linker.
Example:
STA @Variable_Name,X
The following simple example illustrates the use of the HLI Assembler:
Assuming that str points to a character array, you can write a simple function in assembly language to determine the length of a string:
int strlen (char *str) /*** The 'str' character array is passed on the stack. strlen returns length of 'str'. This procedure assumes len(str) is smaller than 256! */ { __asm { LDHX str ; load pointer CLRA ; init counter BRA test ; go to test loop: AIX #1 ; increment pointer INCA ; increment counter test: TST 0,X ; not end of string? BNE loop ; next char CLRX ; return value in X:A(see later) }; /* C statements could follow here */ }