On Tuesday, February 4, 2003, at 10:14 PM, John Marshall wrote:
And Sean Charles wrote:
NOTE: I once made the mistake of embedding code in the "g" (), like
this, "g" (pS->member) and it was *late* and *a good while* before I
discovered why that is a no no!
I hope you'll explain why that is.  I do it all the time.  It works
great.  Less filling.  More control where you want it.

Ok, here goes... it *was late*, about midnight and in the run up to the main blitter code I was actually doing things like this,

asm("move.w %0, %%d1" : : "g" (p->width*p->height)... );

and because the compiler had to generate some code to do the multiplication, it *used some registers* that I had already loaded in previous asm() statements, causing the problem. Mostly, I try to do things like pre-calculations, clipping, all the boring stuff, in C as it is quicker to think it out and more readable. I hope this explains what I meant. If you still maintain that this should work I am going to have to take a sanity check! *8-) It *was* late....it gets very cold in the attic late at night so maybe the brain got frostbite. I must buy some more of that fizzy canned anti-freeze.

Seriously though, asm() is very useful. I don't care what anybody else says, I started out in assembler and twenty years on there is *still* a case for it...sometimes you just cannot beat hitting the metal for that maximum tweak. I've had to work with 'talented' grads over the years who are absolutely stumped when they see hex and registers and stuff. "What's all that?" they say. I stand in disbelief. OK, we don't need to know how a car works to drive one, but if it's late at night on a lonely road and you break down and the cell-phone has zero reception and it's raining......Rocky Horror!

I'll stop there, the Zen of computing is about to take me....
Sean Charles.

(News: It's 8:02am in the UK and I just heard that our government has had one of its own documents leaked, top secret, 3 weeks old, saying there is no current link between between SH and AQ, there was something but it foundered due to mistrust and ideological differences. Honour amongst thieves...)


--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to