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,153 of 4,675   
   wolfgang kern to luserdroog   
   Re: CMP flags going wrong in my emu?   
   15 Sep 20 10:27:31   
   
   From: nowhere@nospicedham.never.at   
      
   On 14.09.2020 19:15, luserdroog wrote:   
   ...   
   >>> CMP(,R,BX,CX)   
      
   3b d9  CMP bx,cx   ;does a faked SUB (bx-cx)   
   flags affected: CY,PAR,AUX,Z,S,O   
   usable conditional instructions after this:   
   Jcc(short or long)/SETcc/CMOVcc/(FCMOVcc is a bit different)   
      
   x86 Conditions:   
   O                            code 70/40/80/90  if OF=0   
   NO                           code 71 41/81/91  if OF=1   
   C   aka  B   aka NAE aka <   code 72/42/82/92  if CF=1 if below/if carry   
   NC  aka  NB  aka AE  aka >=  code 73/43/83/93  if CF=0 if not below/if   
   above or equal   
      
   Z   aka E    aka =           code 74/44/84/94  if ZF=1 if zero/if equal   
   NZ  aka NE   aka <>          code 75 and so on if ZF=0 if not zero/if   
   not equal   
      
   NA  aka BE   aka <=          code 76           if CF=1 or ZF=1 if not   
   above/if below or equal   
      
   A   aka NBE  aka >  aka NCNZ code 77           if CF=0 and ZF=0 if not   
   below or equal/if above   
      
   S   aka SM   aka -           code 78           if SF=1 (usable after   
   unsigned cmp/sub/add...)   
      
   NS  aka SP   aka +           code 79           if SF=0   
   P   aka PE                   code 7A           if PE=1 parity even   
   (works on low byte only)   
      
   NP  aka PO                   code 7B           if PE=0 prity odd   ("-")   
   L   aka NGE  aka <0          code 7C           if SF<>OF if less/if not   
   greater or equal **   
      
   NL  aka GE   aka >=0         code 7D           if SF=OF  if not less/ if   
   greater or equal **   
      
   NG  aka LE   aka <=0         code 7E           if SF<>OF or ZF=1 if less   
   or equal/if not greater **   
      
   G   aka NLE  aka >0          code 7F/4F/9F/9F  if ZF=0 and SF=OF if not   
   less or equal/if greater **   
      
   ** this four are made for signed compare...   
   ie:   
     70 xx       JO xx   
     0f 80 xx xx JO xxxx   
     0f 40/r     CMOVO r   
     0f 90/0/rm  SETO r/rm   
   ...   
   > I said this wrong. These are "to" forms, not "from". The first   
   > argument to my CMP macro can be F to create a "from" opcode or blank   
   > (as above) to create a "to" opcode. Elsethread I mentioned the   
   > expanded operator function listed in my codegolf answer, that should   
   > be "addbf" (the "from" form) not "addbt". Sigh. addbf (add byte from)   
   > being opcode 0x00.   
      
   Why easy when you can make it complicated ?   
   what's wrong with the assembler syntax used by NASM,FASM,..(long list)   
   and also AMD and Intel in their docs ?   
      
   sorry if the lines wrap   
   __   
   wolfgang   
      
   --- 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