Qbasicnews.com

Full Version: Bload/Bsave/Millisecond Timer/Get/Put
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I know those things have probaly been discused many times. I couldn't find what I was looking for in the Docs.

How do you do those above. ie. array size for get/put, file size for Bsave/Bload (and any varseg/varptr stuff), do the milisec timer thing I heard of in FB. Oh ya I'm using screen mode 19, and 32 bit color depth.
For a true millisecond timer, do a SUB using TIME, aS now it has a "better than" microsecond accuracy. SLEEP works in "Windows cycle time" increments (15 ms for XP and 50 ms for 9x).

GET and PUT size= (width *height *pixelsize) + 4 bytes

BLOAD size will be width*height*pixelsize

pixelsize is 1 byte for modes from 4 to 256 colors, 2 bytes for 15 and 16 bits modes and 4 bytes for 24 and 32 bits modes.
Both SLEEP and TIMER work using the Performance Counter.. which is extremely highres.

If Performance Counter is unavailable (it only exist on Pentium Pro and better, or something..) both routines fallback to the kernel cycle counter, which is, just like you said: 50ms on 9x, and 15ms on NT/XP


A good example of GET/PUT Size:
Dim buffer(xsize*ysize+1) As uinteger

Which is just what Antoni said.

BLOAD and BSAVE have the same byte info as GET/PUT
so SLEEP has been fixed too... Trying... You taught me a new thing, Z!re, now I can go bed. Big Grin

I wonder how someone else than developers can make a true documentation for FB....
thx.
So you guys are saying that I should use sleep? or Timer? If either how do make it count in the same incements on all computers?
use SLEEP as it is a single instruction, it has a millisecond resolution with any PC having a Pentium Pro or better. With Pentiums or 486 it will fall back to 50 ms accuracy (I suppose no one is running XP in a 486Smile) .

TIMER will keep its accuracy in the same renge of mP's, but it would require you to write a SUB looping until the timeout is elapsed. However TIMER would be the choice if you needed to go BELOW 1 ms.
So on Timer you would do:
Code:
Timei=Timer
Do: Loop While Timer-Timei < 1000
If you wanted it to pause for a sec?

Also:
I have:
Code:
Screen 19, 32
Size%= (32*34 * 4) +4
Dim Mar(Size%) As UInteger
Get (1,1)-(32,34), Mar
Bsave "Mar.mit", Mar, Size%
But when I quick run it it says that on the Bsave line it found ',' and is expecting a '('. Error code 6. Whats wrong?
For the millisecond, that's ok. I would do a sub of it, but that's my opinion.

For BSAVE you should add an index to the array name
Ok, I got it all. Many thnx for your help guys. Big Grin
New prob.
I have all above in the code with an index on the Bsave line. (Bsave "Mar.mit", Mar(0), Size%)

But now when it excecutes that line a window pops up and says that it has to close tempexe thing (you know that windows error report window?) Whats wrong now?
Pages: 1 2