ChipCenter Questlink
SEARCH CHIPCENTER
Search Type:
Search for:




Knowledge Centers
Product Reviews
Data Sheets
Guides & Experts
News
International
Ask Us
Circuit Cellar Online
App Notes
NetSeminars
Careers
Resources
FAQ
EE Times Network
Electronics Group Sites

Answer1


Circuit Cellar Online
THE MAGAZINE FOR COMPUTER APPLICATIONS
Circuit Cellar Online offers articles illustrating creative solutions
and unique applications through complete projects, practical
tutorials, and useful design techniques.

Archive

WHAT'S YOUR ENGINEERING QUOTIENT?

Test Your EQ

Problem 6Write the assembly code to set all the 8086 flags to '1' at one go without using any arithmetic or logical instructions.


Answer:

We normally use instructions like STD/CLD (set/clear direction flag), STI/CLI (set/clear interrupts) and so forth to modify individual control flags. But the conditional flags are modified only indirectly as a result of arithmetic or logical operations.

However, it is possible to set/reset individual flags or all the flags at one go using the following code:


MOV AX, 0FFFFh
PUSH AX
POPF

AX is filled with ones and pushed onto the stack. Then it is popped into the flags register, which sets all of the flags to '1'. To set individual bits of the flags register, just fill AX with the appropriate value and push it onto the stack.

Contributor: Naveen P N

 

5-01 — NEXT Q&A


For questions or comments about
Test Your EQ, e-mail eq@circuitcellar.com
.
Click here to get your listing up.

Copyright © 2003 ChipCenter-QuestLink
About ChipCenter-Questlink  Contact Us  Privacy Statement   Advertising Information  FAQ