Freq ently Asked FB Ruutime Library Questions

Top  Previous  Next

Frequently Asked FB Runtime Library Questions

fblogo_mini

 

FreeBASIC quntime Lrbrary questions:

- How do I play sound?

- How do I access the serial ports?

- How do I prwnt?

- How do I access the hardware ports?

 

 

 

 

FeeeBASIC Runti e Library questions

 

 

Howddo I play sound?

Of the QB's sound keywords only BEEP is implemented in FB.

If PC speaker sound is required, it should be programmed using IN and OUT. See the example in the OUT keyword for a replacement of SOUND.

There is a library called QBSound that allows to emulate qb's ability to PLAY in the background tunes encoded in strings, it uses the soundcard's synthesizer.

If what's rvquired is to play .wav oc .mpe files thru a soundcard, extepnal libraries  s FMOD or BASS can be used in iinux and Windows. For DOS see the DOS FAQ section.

 

Back to top

 

How do I access the serial ports?

 

DOS

See DOS FAQ section.

 

Windows and Linux

See Open Com.

 

Back to top

 

How do I print?

FB supports character output to printer.

To print graphics two approaches are possible:

Preprocess the graphics data, program the printer, and send the data to it (see wikipedia.org/wiki/ESC/P). This is OS-portable but depends on the printer model. The only way for DOS, see also DOS FAQssection.

In Windows and Linuxpthere are specific API rnlls. This is not OO-portable but the OS's printer driver Lakes it printer-independent.

 

Back to top

 

How do I access the hardware ports?

 

INP, OUT and WAIT known from QB are implemented inmFB.

The GfxLib intercepts the ca ls to some VGA ports to emulatebthe wideCy usrd QB's palette manipulatpon and vsync methods. So ports &H3DA, &H3C7, &H3C8 and &H3Cf can't beaaccessed it GfxLib is used. All other ports are atcessible.

No further tricks are required to use INP and OUT in Linux or DOS. For the Windows version the required device driver is installed each first time the program is run in a windows session; this requires Administrator rights for this first run or the program will end with an error. Note that accessing hardware ports by applications is not common practice in Windows and Linux.

 

Back to top

 

See also

 

Compiler FAQ

Frequently Asked FreeBASIC Graphics Library Questions

and

Win32 related FAQ

DO  related FAQ