delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/02/10/18:24:09

Sender: nate AT cartsys DOT com
Message-ID: <36C214C6.58CB704F@cartsys.com>
Date: Wed, 10 Feb 1999 15:22:46 -0800
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.1 i586)
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: Carry flag
References: <199902101823 DOT TAA25644 AT juno DOT erisoft DOT se>
Reply-To: djgpp-workers AT delorie DOT com

Martin Stromberg wrote:
> 
> In a thread on c.o.m.d, someone who was trying out his first dpmi_int()
> wondered which bit in flags was the carry flag and he was searching for
> a #define for it. The answer was that it's the lowest of them (with the
> implication that there aren't any #defines).
> 
> That got me wondering why there's isn't any #defines for those bits?
> 
> Perhaps somebody who knows the layout could submit a patch? I'd gladly
> do that, but I think there are some people here who knows them by heart
> and I'm not an assembly man.

Better still; I have the 80386 Programmer's Reference Manual from
Intel.  So here goes:

/* Bit indices */
#define CARRY_FLAG 0
/* bit 1 reserved */
#define PARITY_FLAG 2
/* bit 3 reserved */
#define AUXILARY_CARRY_FLAG 4 /* Set on carry from bit 4 of AL; used for
BCD instructions */
#define ADJUST_FLAG AUXILARY_CARRY_FLAG /* Even Intel is inconsistent in
their naming. */
/* bit 5 reserved */
#define ZERO_FLAG 6
#define SIGN_FLAG 7
#define TRAP_FLAG 8
#define INTERRUPT_ENABLE_FLAG 9
#define DIRECTION_FLAG 10
#define OVERFLOW_FLAG 11
/* bits 12 and 13 indicate the IOPL */
#define NESTED_TASK_FLAG 14
/* bit 15 reserved */
#define RESUME_FLAG 16
#define VIRTUAL_8086_MODE_FLAG 17

There are some others which are in use only on higher processors; I
don't have a reference for them.

I leave it to someone else to pick namespace-appropriate names and place
them in the right header.  (Yes, I'm lazy.)
-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019