110 likes | 265 Views
Instruction System - CPU Control Instruction. 计算机学院 李征 Tel : 13882153765 Email : lizheng@cs.scu.edu.cn OICQ: 1340915. CPU Control Instruction. These instructions are mainly used to change CPU processing mode, and change the response mode of CPU for some special events.
E N D
Instruction System -CPU Control Instruction 计算机学院 李征 Tel:13882153765 Email:lizheng@cs.scu.edu.cn OICQ: 1340915
CPU Control Instruction • These instructions are mainly used to change CPU processing mode, • and change the response mode of CPU for some special events.
1) Flag Operation Instruction • CLC • ;clear CF • STC • ;set CF to 1 • CMC • ;Complement CF
CLC • Example: 48-bit addition • CLC • ADC AX,BX • ADC DX,CX • ADC SI, DI • Function:(SI,DX,AX)+(DI,CX,BX) • If cycle structure is used, only one ‘ADC’ instruction is needed.
1) Flag Operation Instruction • CLD ; clear DF • STD ; set DF to 1 • CLI ; clear IF • STI ;set IF to 1
1) Flag Operation Instruction • Flag operation instructions only affect the implied flag of instruction, not affect other flags.
2) Synchronization Instruction • HLT ;Halt, cut off clock for CPU • When this instruction is executed, CPU will stop any operation. • Only when ‘RESET’ signal is received, CPU will not obtain clock again.
2) Synchronization Instruction • ESC • ; prefix for 8087 instructions • When 8086/8088 CPU recognizes this prefix from instruction queue, it send this instruction to 8087.
2) Synchronization Instruction • WAIT • ; In program design, if a 8087 instruction is used, it must be followed by a ‘WAIT’ instruction. • When 8086/8088 executes ‘WAIT’, it waits the operation completion signal from 8087. • Only if the operation completion signal is received, 8088 will execute the following instructions.
2) Synchronization Instruction • LOCK • ; prefix of instructions • When ‘LOCK’ prefix is used to an instruction, the system bus is locked when it is being executed. • DMA request can not break an instruction execution with ‘LOCK’ prefix.
2) Synchronization Instruction • NOP ; No operation • ; can be used for delay. • ; can be used for program debugging.