The Compiler allows LDHX with any reasonable argument and does not restrict it to DIRECT page and IMMEDIATE arguments. In the native HC08, LDHX instructions represent code patterns which translate automatically into an appropriate code sequence, unless the option -cs08 is active. Consider the following example (assume local is a variable on the stack).
| Inline Assembly | Expansion |
|---|---|
| LDHX local | LDX local:0 PSHX PULH LDX local:1 |
| LDHX @local | TSX AIX #<local-offset> |