Instruction Set
4-130
LAHF
LAHF
This example prevents an intervening instruction from modifying the Carry Flag (CF), which
is used to indicate the status of a hardware device.
Tips
LAHF is provided for compatibility with the 8080 microprocessor. It is now customary to
use PUSHF instead.
Related Instructions
If you want to
See
Pop the top component from the stack into the Processor Status Flags register
POPF
Push the Processor Status Flags register onto the stack
PUSHF
Copy AH to the low byte of the Processor Status Flags register
SAHF
SMINUEND
DW
-6726
SSUBTRAHEND
DW
22531
; prevent subtraction from modifying CF, which is used
; as a device status indicator
; check to see if device is on or off
; return result in CF: 1 = on, 0 = off
CALL
CHECK_DEVICE
; set up registers
MOV
CX,SMINUEND
; CX = 1A46h
MOV
BX,SSUBTRAHEND
; BX = BD93h
; save lower five flags in AH
LAHF
; unsigned subtraction: CX = CX - BX
SUB
CX,BX
; CF = 1
; restore saved flags from AH
SAHF
; CF = outcome of CHECK_DEVICE
; if device is on, then perform next action
; else, alert user to turn on device
JC
OKAY
JMP
ALERT_USER
OKAY:
...
ALERT_USER:
...
Содержание Am186 Series
Страница 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Страница 10: ...Table of Contents x...
Страница 18: ...Programming 1 8...
Страница 40: ...Instruction Set Listing 3 14...