This one can be extremely usefull for coding fast action games, and the likes. It's less suitable
for normal input operations, since it's just *too* fast ;)
It takes some effort to analize the returned data, but it's extremely usefull. The input is as fast as
it gets and there are absolutely *NO* delays between repeating, or different keys. Since it won't
empty the keyboard buffer, it's still advisable to do this yourself once in a while. (Otherwise you'll
get that irritating beeping) You can drain it with:
while len(inkey$)<>0
wend
With Bin$, Oct$ and Hex$ it's possible to translate 'normal', decimal numbers into other
systems. Although there isn't a standard function to do the oposite, it's not that difficult.
The following statements will do convert Bin/Oct/Hex to Dec.
val("&H"+Hexstring$)
val("&B"+Binstring$)
val("&O"+Octstring$)
For instance: If Hexstring$="FFFFFF" the function would return 5.
Idea by
To prevent the screen to flicker while playing animations, or drawing graphics on the screen,
you can check for the vertical sync. This way, Graphics aren't drawn 'half', since the beam is
somewhere in the middle of the screen, and the image won't flicker. It can also be used to
make sure that a program runs with the same speed at faster computers as well. After all,
the interval between the screenupdates haven't changed on faster systems.
WAIT &H3DA, 8
WAIT &H3DA, 8, 8
The ordinary TIMER returns the amount of seconds that have passed since midnight, 1/18 of a
second precise. Sometimes you need a more detailed timer. This high-resolution timer supplies
you with 2^24 (6) ticks an hour - 4660 ticks a second, instead of the ordinary 18 ones.
FUNCTION HiResTimer&
DEF SEG = 0
ticks& = 255 - INP(&H40)
lo& = PEEK(&H46C)
hi& = PEEK(&H46D)
count& = lo& + 256 * hi&
hours& = PEEK(&H46E)
DEF SEG
HiResTimer& = ticks& + (256 * (count& + (65536 * hours&)))
END FUNCTION
Posted on Usenet by
Okay, okay. It's a bit outdated already, but perhaps some people still want to check
whether or not they've got a faulty pentium processor. For those precious few:
IF -(/)* = 0 then
ELSE
END IF
It's not difficult to retrieve the baseaddress of COM-ports.
Sometimes, it can be usefull to know these addresses. One of the possibilities is to retrieve
data from the mouse, without the need to have a mousedriver loaded in memory.
Address = (ComPort * 2) -2 'ComPort = 1 to 4
DEF SEG &H40
BasePort = (PEEK(Address) + (PEEK(Address + 1) * 256))
DEF SEG
Trapping ctrl-alt-del can be very usefull sometimes. There are several rountines around, but
very few of those actually seem to work. This one works for me.
KEY 15, CHR$(&h0C, &h53, &h73)
ON KEY(15) GOSUB NoBoot
KEY(15) ON
This routine jumps to another part of the program, labeled NoBoot. This part of the program
will be executed, instead of the usual warm reset.
Source: PowerBASIC FAQ v0.65, http://www.snafu.de/~pbsound/