Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
101
Добавлен:
01.03.2016
Размер:
921.07 Кб
Скачать

PM0044

STM8 instruction set

 

 

7 STM8 instruction set

7.1Introduction

This chapter describes all the STM8 instructions. There are 96 and they are described in alphabetical order. However, they can be classified in 13 main groups as follows:

Table 41. Instruction groups

Load and

LD

LDF

CLR

MOV

EXG

LDW

CLRW

EXGW

 

 

 

Transfer

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Stack

PUSH

POP

PUSH

POPW

 

 

 

 

 

 

 

operation

W

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Increment/

INC

DEC

INCW

DECW

 

 

 

 

 

 

 

Decrement

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Compare and

CP

TNZ

BCP

CPW

TNZW

 

 

 

 

 

 

Tests

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Logical

AND

OR

XOR

CPL

CPLW

 

 

 

 

 

 

operations

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Bit Operation

BSET

BRES

BCPL

BCCM

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Conditional Bit

 

 

 

 

 

 

 

 

 

 

 

Test and

BTJT

BTJF

 

 

 

 

 

 

 

 

 

Branch

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Arithmetic

NEG

ADC

ADD

SUB

SBC

MUL

DIV

DIVW

NEGW

ADDW

SUBW

operations

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Shift and

SLL

SRL

SRA

RLC

RRC

SWAP

SLLW

SRLW

SRAW

RLCW

RRCW

 

 

 

 

 

 

 

 

 

 

 

Rotates

SWAP

RLWA

RRWA

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Unconditional

JRA

JRT

JRF

JP

JPF

CALL

CALLR

CALLF

RET

RETF

NOP

Jump or Call

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Conditional

 

 

 

 

 

 

 

 

 

 

 

Branch/

JRxx

WFE

 

 

 

 

 

 

 

 

 

Execution

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Interrupt

TRAP

WFI

HALT

IRET

 

 

 

 

 

 

 

management

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Condition

 

 

 

 

 

 

 

 

 

 

 

Code Flag

SIM

RIM

SCF

RCF

CCF

RVF

 

 

 

 

 

modification

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Breakpoint/

BREAK

 

 

 

 

 

 

 

 

 

 

software break

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The instructions are described with one to five bytes.

PC-1 End of previous instruction

PC Op-code

PC+1..4 Additional word (0 to 4) according to the number of bytes required to compute the effective address(es)

Doc ID 13590 Rev 3

61/162

STM8 instruction set

PM0044

 

 

Using a pre-code (two-byte op-codes)

In order to extend the number of available op-codes for an 8-bit CPU (256 op-codes), four different pre-code bytes are defined. These pre-codes modify the meaning of the instruction they precede.

The whole instruction becomes:

PC-1 End of previous instruction

PC Pre-code

PC+1 Op-code

PC+2 Additional word (0 to 3) according to the number of bytes required to compute the effective address

These pre-bytes are:

 

0x90

= PDY

Replaces an X based instruction using immediate, direct, indexed or

 

 

inherent addressing mode by a Y one.

 

 

It also provides read/modify/write instructions using Y indexed

 

 

addressing mode with long offset and two bit handling instructions

 

 

(BCPL and BCCM)

0x92

= PIX

Replaces an instruction using direct, direct bit, or direct relative

 

 

addressing mode to an instruction using the corresponding indirect

 

 

addressing mode.

 

 

It also changes an instruction using X indexed addressing mode to

 

 

an instruction using indirect X indexed addressing mode.

0x91

= PIY

Replace an instruction using indirect X indexed addressing mode by

 

 

a Y one.

0x72

= PWSP

Provide long addressing mode for bit handling and read/modify/write

 

 

instructions.

It also provides indirect addressing mode with two byte pointer for read/modify/write and register/memory instructions.

Finally it provides stack pointer indexed addressing mode on register/memory instructions.

62/162

Doc ID 13590 Rev 3

Соседние файлы в папке Минимум документации STM8