SAX

From C64-Wiki
Jump to navigationJump to search

SAX (short for "Store Accumulator AND X") is the mnemonic for the illegal opcode machine language instruction which stores the bitwise AND of the accumulator and the X index register at the RAM or I/O address specified. The contents of the both the accumulator and the X index register remains unchanged through the operation.

This illegal opcode is a combination of two operations with the same addressing mode: STA, STX

Function: {addr} = A & X

Addressing modes[edit]

Opcode Addressing
mode
Assembler
format
Length
in bytes
Number of
cycles
Dec Hex
143 8F Absolute SAX nnnn 3 4
135 87 Zeropage SAX nn 2 3
151 97 Zeropage,Y SAX nn,Y 2 4
131 83 Indexed-indirect SAX (nn,X) 2 6

SAX supports the 4 different addressing modes shown in the table at right. In the assembler formats listed, nn represents a single-byte (8-bit) figure, and nnnn is a two-byte (16-bit) address.

CPU flags[edit]

SAX does not affect any of the CPU's status flags.

Links[edit]