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

STM8 addressing modes

PM0044

 

 

Figure 7. Immediate addressing mode example

Before Completion

 

 

 

 

 

A

 

 

 

 

 

Previous Value

 

 

 

 

 

 

 

 

 

 

 

PC

LD A, #0F8h

A6

 

 

 

 

 

 

 

05BE

05BE

 

 

 

F8

05BF

 

 

 

 

 

05C0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Steps to Determine Effective Address

PC = 05BE

PC = PC + 1 = 05BF EA = PC = 05BF New PC = PC + 1

= 05C0

 

 

After Completion

 

 

A

 

 

F8

A6

05BE

 

F8

05BF

New PC

 

 

 

05C0

05C0

 

 

Instruction Complete

A = (EA) = F8

New PC = 05C0

VR02059A

6.3Direct addressing mode (Short, Long, Extended)

Table 20.

Overview of Direct addressing mode instructions

 

Addressing mode

Syntax

EA formula

Ptr Adr

Ptr Size

Dest adr

 

 

 

 

 

 

 

Short

Direct

shortmem

(shortmem)

op + 1

Byte

00..FF

 

 

 

 

 

 

 

Long

Direct

longmem

(longmem)

op + 1..2

Word

0000..FFFF

 

 

 

 

 

 

 

Extended

Direct

extmem

(extmem)

op + 1..3

Ext word

000000..FFFFFF

 

 

 

 

 

 

 

The data byte required for the operation is found by its memory address, which follows the op-code.

Direct addressing mode is made of three sub-modes:

Table 21. Available Long and Short Direct addressing mode instructions

Instructions

Functions

 

 

LD, LDW

Load

 

 

CP

Compare

 

 

AND, OR, XOR

Logical Operations

 

 

ADC, ADD, SUB, SBC, ADDW, SUBW

Arithmetic Addition/Subtraction operations

 

 

BCP

Bit Compare

 

 

34/162

Doc ID 13590 Rev 3

PM0044

STM8 addressing modes

 

 

 

 

Table 21. Available Long and Short Direct addressing mode instructions

 

 

 

 

Instructions

Functions

 

 

 

 

MOV

Move

 

 

 

 

CLR

Clear

 

 

 

 

INC, DEC

Increment/Decrement

 

 

 

 

TNZ

Test Negative or Zero

 

 

 

 

CPL, NEG

1’s or 2’s Complement

 

 

 

 

SLA, SLL, SRL, SRA, RLC, RRC

Shift and Rotate Operations

 

 

 

 

SWAP

Swap Nibbles

 

 

 

 

CALL, JP

Call or Jump subroutine

 

 

 

Table 22. Available Extended Direct addressing mode instructions

Instructions

Function

 

 

CALLF, JPF

Call or Jump FAR subroutine

 

 

LDF

Far load

 

 

Table 23. Available Long Direct addressing mode instructions

Instructions

Function

 

 

EXG

Exchange

 

 

PUSH, POP

Stack operation

 

 

Doc ID 13590 Rev 3

35/162

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