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

PM0044

STM8 addressing modes

 

 

6.13Bit Direct (Long) addressing mode

Table 37.

Overview of Bit Direct addressing mode instruction

 

 

Addressing mode

Syntax

EA formula

Ptr Adr

 

Ptr Size

Dest adr

 

 

 

 

 

 

 

 

Bit

Long Direct

longmem, #pos

(longmem)

op + 1..2

 

Word

0000..FFFF

 

 

 

 

 

 

 

 

The data byte required for the operation is found by its memory address, which follows the op-code. The bit used for the operation is selected by the bit selector which is encoded in the instruction op-code.

Table 38. Available Bit Direct instructions

Instructions

Functions

 

 

BRES

Bit Reset

 

 

BSET

Bit Set

 

 

BCPL

Bit Complement

 

 

BCCM

Copy Carry Bit to Memory

 

 

The address is a word, thus allowing 0000 to FFFF addressing space, but requires 2 bytes after the op-code. The bit selector #n (n=0 to 7) selects the nth bit from the byte pointed to by the address.

Example:

 

 

 

0408

721006E5

BCPL

coeff, #0

06E5

40

coeff dc.b

$ 40

Action:

 

 

 

(coeff) = ($06E5) XOR 2**0 = $40 XOR $01 = $41

Doc ID 13590 Rev 3

57/162

STM8 addressing modes

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PM0044

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure 22. Bit Long Direct addressing mode example

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Before c ompletion

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PC

Steps to d etermine

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

effective address

 

BCPL Coeff,#0

 

 

90

0408

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0408

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

10

0409

 

 

 

 

 

 

 

 

 

 

PC = 0408

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

06

040A

 

 

 

 

06E5

 

 

 

PC = PC + 2 = 040A

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

EA = (PC ) :(PC+1) = 06E5

 

 

 

 

 

 

E5

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

040B

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

040C

 

 

 

 

 

 

 

 

 

 

 

 

Coeff .byte 040h

 

 

 

 

 

 

 

 

 

EA

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

40

06E5

 

 

06E5

EA = (PC ): (PC+1) = 06E5

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

After c ompletion

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

BCPL Coeff,#0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0408

 

 

 

 

 

 

 

 

 

 

 

 

 

 

90

 

 

 

 

 

 

 

 

 

 

Instruction c omplete

 

 

 

 

 

 

10

0409

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(EA) = (EA) | 2**0 = 40 | 01 = 41

 

 

 

 

 

 

06

040A

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

New PC = PC + 2 = 040C

 

 

 

 

 

 

E5

040B

 

 

 

 

 

New PC

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

040C

 

 

 

 

 

040C

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Coeff .byte 040h

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

41

06E5

 

 

 

 

 

 

40 XOR 01

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

58/162

Doc ID 13590 Rev 3

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