Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
[Ton_Marks]_Assembler_Tutorial(BookFi.org).doc
Скачиваний:
3
Добавлен:
11.11.2019
Размер:
216.06 Кб
Скачать

4.8 Counting instructions

They are used to decrease or increase the content of the counters.

DEC

INC

DEC INSTRUCTION

Purpose: To decrease the operator.

Syntax:

DEC destiny

This operation subtracts 1 from the destiny operator and stores the new

value in the same operator.

Inc instruction

Purpose: To increase the operator.

Syntax:

INC destiny The instruction adds 1 to the destiny operator and keeps the

result in the same destiny operator.

4.9 Comparison instructions

They are used to compare operators, and they affect the content of the

flags.

CMP

CMPS (CMPSB) (CMPSW)

CMP INSTRUCTION

Purpose: To compare the operators.

Syntax:

CMP destiny, source

This instruction subtracts the source operator from the destiny operator but without this one storing the result of the operation, and it only affects the state of the flags.

CMPS (CMPSB) (CMPSW) INSTRUCTION

Purpose: To compare chains of a byte or a word.

Syntax:

CMP destiny, source

With this instruction the chain of source characters is subtracted from the destiny chain.

DI is used as an index for the extra segment of the source chain, and SI as an index of the destiny chain.

It only affects the content of the flags and DI as well as SI are incremented.

4.10 Flag instructions

They directly affect the content of the flags.

CLC

CLD

CLI

CMC

STC

STD

STI

CLC INSTRUCTION

Purpose: To clean the cartage flag.

Syntax:

CLC

This instruction turns off the bit corresponding to the cartage flag, or in other words it puts it on zero.

CLD INSTRUCTION

Purpose: To clean the address flag.

Syntax:

CLD

This instruction turns off the corresponding bit to the address flag.

CLI INSTRUCTION

Purpose: To clean the interruption flag.

Syntax:

CLI

This instruction turns off the interruptions flag, disabling this way those maskarable interruptions.

A maskarable interruptions is that one whose functions are deactivated when IF=0.

CMC INSTRUCTION

Purpose: To complement the cartage flag.

Syntax:

CMC

This instruction complements the state of the CF flag, if CF = 0 the instructions equals it to 1, and if the instruction is 1 it equals it to 0.

We could say that it only "inverts" the value of the flag.

STC INSTRUCTION

Purpose: To activate the cartage flag.

Syntax:

STC

This instruction puts the CF flag in 1.

STD INSTRUCTION

Purpose: To activate the address flag.

Syntax:

STD

The STD instruction puts the DF flag in 1.

STI INSTRUCTION

Purpose: To activate the interruption flag.

Syntax:

STI

The instruction activates the IF flag, and this enables the maskarable external interruptions ( the ones which only function when IF = 1).

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]