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,285 of 4,675   
   Tavis Ormandy to paul   
   Re: beginner assembler for windows?   
   20 Jan 21 15:38:24   
   
   From: taviso@nospicedham.gmail.com   
      
   On 2021-01-20, paul  wrote:   
   > Which, seems odd to me that a boolean operation that always returns FALSE   
   > would be the result, but hey, I didn't write the code explorer - I'm just   
   > testing it (someone is going to have to explain that one to me!). :)   
      
   To make different pieces of code work together, all the code has to   
   follow certain rules - called calling conventions. You don't *have* to   
   follow those rules, but it means your code will work well with others.   
      
   One of those conventions is to put the return code (the result) in the   
   eax register. So in this case, that's just letting other code know   
   everything was okay.   
      
   > Which returns, surprise!   
   >   main:   
   >    xor eax, eax   
   >    ret   
   >   
   > There is no "compilation error", but it says "Compiler returned: 0",   
   > which, I guess, maybe, perhaps, I dunno, is that an error or did it work?   
      
   It worked, but compilers are smart - it knew that you didn't use the   
   result of the computation, and so it didn't matter if it did it or not.   
   That means it can generate a program that does exactly the same thing   
   but *faster* by not doing it at all.   
      
   There are a ton of these you'll notice, some are really confusing when   
   you first run into them. I think I was fascinated by that, understanding   
   things like strength reduction (that's where the compiler replaces   
   expensive operations like multiplication with equivalent cheaper ones   
   like shifts and adds) - but if you think you'll be frustrated by it,   
   maybe this won't work.   
      
   > It's what everyone would want who is a noob who just wants a working set of   
   > examples (aka a tutorial) on the most common computer platform there ever   
   > was.   
      
   I don't know if there is a good answer. If you want to skip the   
   introductory classes, you can't complain that you have to work harder to   
   catch up :)   
      
   Tavis.   
      
   --   
    _o)            $ lynx lock.cmpxchg8b.com   
    /\\  _o)  _o)  $ finger taviso@sdf.org   
   _\_V _( ) _( )  @taviso   
      
   --- 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