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 3,458 of 4,675   
   Rick C. Hodgin to demon.adramelek@gmail.com   
   Re: Fast Fizz Buzz program   
   18 Jul 18 13:05:43   
   
   From: rick.c.hodgin@nospicedham.gmail.com   
      
   On 7/18/2018 8:48 AM, demon.adramelek@gmail.com wrote:   
   > I think that my original code would be faster. I understand it might be   
   harder to read since I use AT&T syntax. I'll try to emphasize actual logic:   
   > [snip]   
   >   
   > I use 5 registers: two bitmask constants, one counter, one bitmask   
   > pointer, and one temporary register. I use 9 commands in loop (inc,   
   > shl, mov, and, jz, cmp, je, and, jnz). Basically all decision making is   
   > two ANDs and one CMP.   
      
   I'll post an updated version of this later.  I've thought of some   
   additional optimizations to my algorithm.   
      
   It's been about 15 years since I did assembly programming on any   
   daily basis.  I'm very rusty.  But, it's coming back to me as I   
   go about my day. :-)   
      
   I enjoy these kinds of mental exercises.  I was hoping Terje would   
   show up and school me on the many points I missed.   
      
   One is I don't need the full constant, just the initial bits to   
   cycle through.  Another is I don't need the reference to funcs   
   consuming esi.  I can probably also free up edx and edi and use   
   direct constants.  Then I can keep everything in registers.  The   
   code to print should be optimized, but I haven't thought of that   
   yet.  Since fizz and buzz are each 4-bytes, it would work as a   
   direct constant move into a memory buffer.  Not sure on the code   
   to generate an arbitrary ASCII representation of an integer value.   
   Will have to think about that.   
      
   --   
   Rick C. Hodgin   
      
   --- 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