Mina Fouad
Mina Fouad

Reputation: 79

How to check the value of Auxiliary Flag in 8086

I want to know if the Auxiliary Flag is set or not ? How I can do it in Assembly. Any help will be appreciated.

Upvotes: 2

Views: 2723

Answers (3)

Fabian Giesen
Fabian Giesen

Reputation: 3311

Use lahf (load AH from flags) followed by test (to check the value):

lahf
test   ah, 10h
jnz    .aux_nonzero

Upvotes: 7

t0mm13b
t0mm13b

Reputation: 34592

Have a look at this site which details comprehensive assembly instruction sets for the x86 architecture.

dang gregh you beat me to it... oh well....

It's the fourth bit that represents the Auxiliary Flag (AF)... as shown here

Upvotes: 1

Greg Hewgill
Greg Hewgill

Reputation: 993095

One way to do this is to push the flags register onto the stack (pushf), then pop it off into a general purpose register (pop ax for example), and inspect the bits in ax.

Upvotes: 2

Related Questions