Memory-to-memory direct-to-indexed with post- increment

This addressing mode is generally used to fill tables addressed by the index register from registers in page zero.

The operand in the direct page location addressed by the byte following the opcode is stored in the memory location pointed to by the HX index register. The HX index register is automatically incremented. The A register is not affected. See the following listing for an example of using the memory-to-memory direct-to-indexed with post-increment addressing mode.

Listing: Memory-to-memory direct-to-indirect with post-increment addressing mode
          XDEF  entry
MyData:   SECTION SHORT

MyReg1:   DS.B  1

MyReg2:   DS.B  1

MyCode:   SECTION

entry:

          LDA   #$02

          STA   MyReg1

          INCA

          STA   MyReg2

          LDHX   #$1000

          MOV   MyReg1,X+

          MOV   MyReg2,X+

main:     BRA   main

The page-zero memory locations MyReg1 and MyReg2 are first respectively initialized with $02 and $03. The contents of those data are then written in memory location $1000 and $1001. The HX register points to memory location $1002.