home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 4,146 of 4,675   
   Alexei A. Frounze to luserdroog   
   Re: CMP flags going wrong in my emu?   
   14 Sep 20 01:41:35   
   
   From: alexfrunews@nospicedham.gmail.com   
      
   On Sunday, September 13, 2020 at 11:51:13 PM UTC-7, luserdroog wrote:   
   >     // additional flags set by math operators   
   > #define MATHFLAGS *fl |= ( (z&(w?0xffff0000:0xff00))     ?CF:0) \   
   >                        | ( ((z^x)&(z^y)&(w?0x8000:0x80)) ?OF:0) \   
   >                        | ( ((x^y^z)&0x10)                ?AF:0); \   
   >                        SETPF   
   >   
   > I don't know where I came up with that expression for OF.   
   > It's gibberish to me now.   
      
   It's making sure that the result's sign is the same   
   as the signs of x and y. If that isn't true, OF gets set.   
   That works for addition, z = x + y,   
   but not subtraction, z = x - y.   
   Unless you exchange things a bit...   
      
   add: z = x + y   
   (z^x)&(z^y)&...   
      
   sub: z = x - y   
   OR, speaking in terms of addition...   
   sub: x = z + y   
   (x^z)&(x^y)&...   
      
   IOW, for the purposes of OF calculation you need to   
   exchange x and z in that formula of yours.   
      
   Alex   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca