Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6927033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:59:44+00:00 2026-05-27T10:59:44+00:00

I want to check the Status Flag after a command but it gives wrong

  • 0

I want to check the Status Flag after a command but it gives wrong values! For example:
After adding 126 with 127 Status Flag would be FFBA(initial SF value is FFFF), BUT…
when i run this code, it gives 7112:

mov ax, 126
mov bx, 127
PUSHF
MOV dx, 0FFFFh
PUSH dx
POPF
add ax, bx
PUSHF
POP ax
POPF
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:59:45+00:00Added an answer on May 27, 2026 at 10:59 am

    Elimantas,

    As GJ answered you, you cannot directly pop back to the register flag since some of these flags are READ-ONLY flags, but instead use instructions targeting some of these flags individually.

    CLC – Clear Carry Flag

    STC – Set Carry Flag

    CLD – Clear Direction Flag

    STD – Set Direction Flag

    CLI – Clear Interrupt Flag

    STI – Set Interrupt Flag

    CMC – Complement Carry flag. Inverts value of CF.

    LAHF – Load AH with low 8bits of Register Flags:

    AH bit: 7 6 5 4 3 2 1 0

        [SF] [ZF] [0] [AF] [0] [PF] [1] [CF]
    

    SAHF – Store AH into low 8bits of Register Flags:

    AH bit: 7 6 5 4 3 2 1 0

        [SF] [ZF] [0] [AF] [0] [PF] [1] [CF]
    

    Now if you want to check the flags and take appropriate action in response to status of these flags, it is better to use “Conditional jump”, like:

    JNZ, JZ, : Jump if Zero Flags is Clear or Set respectively.

    JNC, JC : Jump if Carry Flags is Clear or Set respectively.

    JNO, JO : Jump if Overflow Flags is Clear or Set respectively.

    JPE, JPO: Jump if Parity Flags is Even or Odd respectively.

    And other conditional jumps exist, just check the 8086 instruction reference.

    Another thing you should look for is the set of instructions that affect the Flags Register, not only the ADD instruction, many others affect this register, you will find it on the instruction reference manual.

    Lastely, if you want to check the flags directly from the Flags Register, just:

    PUSHF

    POP AX; AX will contain the status of Flags register

    Hope this was helpful to you.

    Khilo – ALGERIA

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have used checkbox column in gridview. I want to check status of that
I want to check the login status of a user through an ajax request.
I want to download a file and need to check the response status code
I want to check for duplicated words right next to each other, but even
I want to check the status of the extended permissions for a user of
I want to check if an image exists using jquery. For example how do
I am using Reachability Code to check the network status of ip but currently
I have a very long loop, and I would like to check the status
i have comments function,i have status field in comments table ..i want to check
I want to check the status of Facebook like button on my web page.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.