HC08 instruction set

The following table presents an overview of the instructions available for the HC08:

Table 1. HC08 instruction set
Instruction Addressing modes Descriptions
ADC #<expression> <expression> <expression>,X ,X <expression>,SP Add with Carry
ADD #<expression> <expression> <expression>,X ,X <expression>,SP Add without carry
AIS #<expression> Add Immediate value (signed) to Stack Pointer
AIX #<expression> Add Immediate value (signed) to Index register H:X
AND #<expression> <expression> <expression>,X ,X <expression>,SP Logical AND
ASL <expression> <expression>,X ,X <expression>,SP Arithmetic Shift Left
ASLA   Arithmetic Shift Left Accumulator
ASLX   Arithmetic Shift Left register X
ASR <expression> <expression>,X ,X <expression>,SP Arithmetic Shift Right
ASRA   Arithmetic Shift Right Accumulator
ASRX   Arithmetic Shift Right register X
BCC <label> Branch if Carry bit Clear
BCLR BitNumber, <expression> Clear one Bit in memory
BCS <label> Branch if Carry bit Set
BEQ <label> Branch if Equal
BGE <label> Branch if Greater Than or Equal to
BGND   Enter Background Debug Mode. Only available for HCS08 (-CS08 option)
BGT <label> Branch if Greater Than
BHCC <label> Branch if Half Carry bit Clear
BHCS <label> Branch if Half Carry bit Set
BHI <label> Branch if Higher
BHS <label> Branch if Higher or Same
BIH <label> Branch if /IRQ Pin High
BIL <label> Branch if /IRQ Pin Low
BIT #<expression> <expression> <expression>,X ,X <expression>,SP Bit Test
BLE <label> Branch if Less Than or Equal To
BLO <label> Branch if Lower (same as BCS)
BLS <label> Branch if Lower or Same
BLT <label> Branch if Less Than
BMC <label> Branch if interrupt Mask Clear
BMI <label> Branch if Minus
BMS <label> Branch If interrupt Mask Set
BNE <label> Branch if Not Equal
BPL <label> Branch if Plus
BRA <label> Branch Always
BRCLR BitNumber, <expression>, <label> Branch if Bit is Clear
BRN <label> Branch Never
BRSET BitNumber, <expression>, <label> Branch if Bit Set
BSET BitNumber,<expression> Set Bit in memory
BSR <label> Branch to Subroutine
CBEQ <expression>,<label> <expression>,X+,<label> X+,<label> <expression>,SP,<label> Compare and Branch if Equal
CBEQA #<expression>,<label>  
CBEQX #<expression>,<label>  
CLC   Clear Carry bit
CLI   Clear Interrupt mask bit
CLR <expression> <expression>,X ,X <expression>,SP Clear memory
CLRA   Clear Accumulator A
CLRH   Clear index Register H
CLRX   Clear index Register X
CMP #<expression> <expression> <expression>,X ,X <expression>,SP Compare accumulator with memory
COM <expression> <expression>,X ,X <expression>,SP One's complement on memory location
COMA   One's complement on accumulator A
COMX   One's complement on register X
CPHX #<expression> <expression> <expression>,SP Compare index register H:X with memory Stack pointer and Extended addressing modes only available for HCS08 (-CS08 option)
CPX #<expression> <expression> <expression>,X ,X <expression>,SP Compare index register X with memory
DAA   Decimal Adjust Accumulator
DBNZ <expression>,<label> <expression>,X,<label> X,<label> <expression>,SP,<label> Decrement counter and Branch if Not Zero
DBNZA <label>  
DBNZX <label>  
DEC <expression> <expression>,X ,X <expression>,SP Decrement memory location
DECA   Decrement Accumulator
DECX   Decrement Index register
DIV   Divide
EOR #<expression> <expression> <expression>,X ,X <expression>,SP Exclusive OR Memory with accumulator
INC <expression> ,X <expression>,X <expression>,SP Increment memory location
INCA   Increment Accumulator
INCX   Increment register X
JMP <expression> <expression>,X ,X Jump to label
JSR <expression> <expression>,X ,X Jump to Subroutine
LDA #<expression> <expression> <expression>,X ,X <expression>,SP Load Accumulator
LDHX #<expression> <expression> <expression>,X ,X <expression>,SP Load Index register H:X from memory Indexed, Stack pointer and extended addressing modes are only available for HCS08 (-CS08 option).
LDX #<expression> <expression> <expression>,X ,X <expression>,SP Load index Register X from memory
LSL <expression> <expression>,X ,X <expression>,SP Logical Shift Left in memory
LSLA   Logical Shift Left Accumulator
LSLX   Logical Shift Left register X
LSR <expression> <expression>,X ,X <expression>,SP Logical Shift Right in memory
LSRA   Logical Shift Right Accumulator
LSRX   Logical Shift Right register X
MOV <expression>,<expression> <expression>,X+ #<expression>,<expression> X+,<expression> Memory-to-memory byte Move
MUL   Unsigned multiply
NEG <expression> <expression>,X ,X <expression>,SP Two's complement in memory
NEGA   Two's complement on Accumulator
NEGX   Two's complement on register X
NOP   No operation
NSA   Nibble Swap Accumulator
ORA #<expression> <expression> <expression>,X ,X <expression>,SP Inclusive OR between Accumulator and memory
PSHA   Push Accumulator onto stack
PSHH   Push index register H onto stack
PSHX   Push index register X onto stack
PULA   Pull Accumulator from stack
PULH   Pull index register H from stack
PULX   Pull index register X from stack
ROL <expression> <expression>,X ,X <expression>,SP Rotate memory Left
ROLA   Rotate Accumulator Left
ROLX   Rotate register X Left
ROR <expression> <expression>,X ,X <expression>,SP Rotate memory Right
RORA   Rotate Accumulator Right
RORX   Rotate register X Right
RSP   Reset Stack Pointer
RTI   Return from Interrupt
RTS   Return from Subroutine
SBC #<expression> <expression> <expression>,X ,X <expression>,SP Subtract with Carry
SEC   Set Carry bit
SEI   Set Interrupt mask bit
STA <expression> <expression>,X ,X <expression>,SP Store Accumulator in Memory
STHX <expression> <expression>,SP Store Index register H:X Stack pointer and extended addressing modes are only available for HCS08 (-CS08 option)
STOP   Enable IRQ pin and Stop oscillator
STX <expression> <expression>,X ,X <expression>,SP Store index register X in memory
SUB #<expression> <expression> <expression>,X ,X <expression>,SP Subtract
SWI   Software Interrupt
TAP   Transfer Accumulator to CCR
TAX   Transfer Accumulator to index Register X
TPA   Transfer CCR to Accumulator
TST <expression> <expression>,X ,X <expression>,SP Test memory for negative or zero
TSTA   Test Accumulator for negative or zero
TSTX   Test register X for negative or zero
TSX   Transfer SP to index register H:X
TXA   Transfer index register X to Accumulator
TXS   Transfer index register X to SP
WAIT   Enable interrupts; stop processor