nkeck720 / nos

A command-line based OS written in FASM syntax for i386 and above.
GNU General Public License v2.0
9 stars 5 forks source link

FASM board issue 32 #33

Closed nkeck720 closed 8 years ago

nkeck720 commented 8 years ago

To have the carry flag set (or cleared) when returning from an interrupt you can't just write:

Code:

stc 
iret 

The IRET instruction overwrites the flags with the copy that was pushed on the stack when the interrupt started! Use any of the following:

Code:

or  [esp+4],1           ;Sets CF prior to exiting an interrupt 
iret 
... 
and [esp+4], -2         ;Clears the CF prior to exiting an interrupt 
iret