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,150 of 4,675    |
|    luserdroog to Alexei A. Frounze    |
|    Re: CMP flags going wrong in my emu?    |
|    14 Sep 20 14:31:54    |
      From: luser.droog@nospicedham.gmail.com              On Monday, September 14, 2020 at 3:51:24 AM UTC-5, Alexei A. Frounze wrote:       > 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              Do I also need to swap x and y if the direction is       reversed and z = y - x?       then y = z + x.       sthg like:        ((d?x:y)^z)&(x^y)&...              --- 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