The address of the operand is the sum of the 8-bit offset added to the value in register HX.
The operand is addressed, then the HX register is incremented.
This addressing mode is useful for searches in tables. It is only used with the CBEQ instruction. See the following listing for an example of the indexed (8-bit offset) with post-increment addressing mode.
XDEF Entry ORG $F000 data: DCB.B $40,$00 DC.B 1,11,21,31,$C0,12 ; $C0 is located at $F000+$40+4 CodeSCT: SECTION Entry: LDHX #$00FF TXS main: LDA #$C0 LDHX #data LOOP: CBEQ $30,X+,IS_EQUAL BRA LOOP IS_EQUAL: ...
Using this addressing mode, it is possible to scan the memory to find a location containing a specific value starting at a specified location to which is added an offset.
The value located at memory location pointed to by HX + $30 is compared to the value in the A register. If the two values match, program branch to IS_EQUAL. HX points to memory location next to the one containing the searched value.
In this example, the value $C0 is searched starting at memory location $F000+$30=$F030. This value is found at memory location $F044, the program branches to IS_EQUAL. The HX register contains the memory location of the searched value minus the offset, incremented by one: $F044-$30+1=$F015.