Académique Documents
Professionnel Documents
Culture Documents
Example
Example:
Write an instruction sequence to save the current contents of the 8088’s flags in the
memory location at offset MEM1 of the current data segment and then reload the
flags with the contents of the storage location at offset MEM2.
Solution:
LAHF ; Read from Flag to AH
MOV [MEM1], AH ; Copy to Memory 1
MOV AH, [MEM2] ; Copy from MEM1 to AH
SAHF ; Set the flags from AH
Compare Instructions
TO DETERMINE THE RELATIONSHIP BETWEEN TWO NUMBERS
MOV AL, 7
CMP AL, 5
MOV AL, 99H; -103
CMP AL, 1BH; +27
CMP D,S
Example 1:
MOV AL,5
CMP AL,5 ;Zero flag is set
Example 2:
MOV AL,4
CMP AL,5 ;Carry flag is set
Example:
Describe what happens to the status flags as the sequence of instructions
that follows is executed.All flags initially reset.
MOV AX,1234H
MOV BX.ABCDH
CMP AX,BX
CONTROL FLOW AND THE JUMP INSTRUCTIONS
Jump Instructions
UNCONDITIONAL JUMP
Loop instruction