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,118 of 4,675   
   luserdroog to All   
   Comparing to zero   
   27 Aug 20 13:06:13   
   
   From: luser.droog@nospicedham.gmail.com   
      
   Hi everyone,   
      
   I'm working on primitives for my newly working forth interpreter and I'm   
   having difficulty with comparisons 0= 0> and 0> . These each take a   
   number from the stack and push 0 or all-bits-1.   
      
   My code for 0= and 0> appear to be producing results, but I get the wrong   
   result for 0< even though it seems to follow appropriate parallel logic   
   as 0>. Any ideas? Does this suggest a bug in assembly or in my emulator?   
      
   CODE(0=,     zeroeq,    POP(AX),MOVCXI(1,0), CMP(,R,AX,CX), SBB(,R,AX,AX),   
   PUSH(AX))   
   CODE(0>,     zerogt,    POP(AX),MOVCXI(0,0), CMP(,R,AX,CX), JL,3   
   MOVCXI(0xff,0xff), PUSH(CX))   
   CODE(0<,     zerolt,    POP(AX),MOVCXI(0,0), CMP(,R,AX,CX), JG,3   
   MOVCXI(0xff,0xff), PUSH(CX))   
      
   testing:   
   WORD(run,    run,       c_lit,0, c_zeroeq, c_dot,   
                           c_lit,12, c_zerogt, c_dot,   
                           c_lit,minus(50), c_zerolt, c_dot,   
                           c_lit,79,c_emit, c_lit,75,c_emit, c_lit,   
   ,c_double,c_emit, c_bye)   
      
   output:   
   $ ./a8086   
   110OK   
      
   --- 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