I I'm trying to create an application in real mode that uses the flags to store the results of calculations and other stuff. I'm trying to do this to take up less memory. So can someone please give me some example code or tell me how to do this. I hear it has something to do with eflags or something were they are stored. I already know how eflags is formatted but how do I get to it, and modify it?

You don't want to screw around with eflags like that -- you are misusing that flag. What you want to do is declare a variable to hold all the bit-mapped flags then you can set and clear the individual bits to your heart's content.

You don't want to screw around with eflags like that -- you are misusing that flag. What you want to do is declare a variable to hold all the bit-mapped flags then you can set and clear the individual bits to your heart's content.

Ok then how would I do that, like this?
pushf
pop ax
-Modify ax to what I want the flags to be.
push ax
popf

Lets assume all you need are 8 or fewer flags which can be store in one byte of data

flags db 0 ; allocate memory for the 8 flags

; set the 2d bit 
mov al,flags
or al,00000010h
mov flags,al

Lets assume all you need are 8 or fewer flags which can be store in one byte of data

flags db 0 ; allocate memory for the 8 flags

; set the 2d bit 
mov al,flags
or al,00000010h
mov flags,al

Ok, but how does that modify the real flags, that's only modifying your variable.

It doesn't. And you can't.

>>create an application in real mode that uses the flags to store the results of calculations and other stuff.
As I said before, that is a mis-use of the flags. Even if you could change them they won't stay that way very long because the flags are changed when certain operations are performed. The only flag I can think of that you can change yourself is the direction flag using cli instruction.

Edited 5 Years Ago by Ancient Dragon: n/a

It doesn't. And you can't.

>>create an application in real mode that uses the flags to store the results of calculations and other stuff.
As I said before, that is a mis-use of the flags. Even if you could change them they won't stay that way very long because the flags are changed when certain operations are performed. The only flag I can think of that you can change yourself is the direction flag using cli instruction.

O ok thanks.

This question has already been answered. Start a new discussion instead.