My guess, and it is only a guess, is that it has something to do with pipelining, strange as it may seem, sometimes adding extra instructions can push others into the other pipe where they can operate quicker.
Everyone feel free to shoot me down in flames if I'm wrong (which is more than likely).
srod wrote:why not simply use the FWAIT command in this case?
It did cross my mind that an FADD was probably not the instruction to use, I also considered that it may have something to do with a 'carry' or 'overflow' which would tie in with your theory about flags.
I think we need someone else to figure it out for sure!
It's not needed, but PB adds it everywhere. I think it's the rests from a trick to allow negative numbers without introducing additional complexity into the compiler.
So, presumably, if you took them all out and if your code was complex enough so that they actually made a difference then you would end up with a faster, leaner exe.
Of course, I don't for one minute think that removing a few FADD's is going to make a speed difference with the sort of programs that PB is used in making, simply because as soon as you require user input all speed issues are gone.
Here's a quote from the 'What's Right With Assembly Language?' section
Saving space saves money. Pure and simple. If a program requires 1.5 megabytes, it will not fit on a 1.44 Mbyte floppy. Likewise, if an application requires 2 megabytes RAM, the user will have to install an extra megabyte if there is only one available in the machine. Even on big machines with 32 or more megabytes, writing gigantic applications isn't excusable. Most users put more than eight megabytes in their machines so they can run multiple programs from memory at one time.
Anyone got a big machine with 32 megabytes or more..