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,148 of 4,675    |
|    luserdroog to Alexei A. Frounze    |
|    Re: CMP flags going wrong in my emu?    |
|    14 Sep 20 09:53:55    |
      From: luser.droog@nospicedham.gmail.com              On Monday, September 14, 2020 at 5:36:43 AM UTC-5, Alexei A. Frounze wrote:       > On Monday, September 14, 2020 at 2:51:34 AM UTC-7, luserdroog wrote:       > > 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       > >       > > Thanks a bunch! It works great now. My forth can now       > > print numbers in any base from 2 to 36.       >       > Sorry, I hit "send" too soon without a clarification.       >       > You need to exchange x with z in MATHFLAGS for sub only.       > I think now you have add broken.       >              Ok. Thanks again. I'm parameterizing it so there's a separate formula       for ADDFLAGS vs SUBFLAGS.              --- 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