The direct addressing mode is used to address operands in the direct page of the memory (location $0000 to $00FF).
For most of the direct instructions, only two bytes are required: the first byte is the opcode and the second byte is the operand address located in page zero. See the following listing for an example of the direct addressing mode.
XDEF Entry initStack: EQU $0400 MyData: SECTION SHORT data: DS.B 1 MyCode: SECTION Entry: LDHX #initStack ; init Stack Pointer TXS ; with value $400 - 1 = $03FF main: LDA #$55 STA data BRA main
In this example, the value $55 is stored in the variable data, which is located on the direct page. The MyData section must be defined in the direct page in the linker parameter file. The opcode generated for the STA data instruction is two bytes long.