Wiki source for FaqPgrtlib


Show raw source

{{fbdoc item="title" value="Frequently Asked FB Runtime Library Questions"}}----

{{anchor name="item0"}}
**""FreeBASIC"" Runtime Library questions:**

==- {{anchor name="item1|How do I play sound?"}}==
==- {{anchor name="item2|How do I access the serial ports?"}}==
==- {{anchor name="item3|How do I print?"}}==
==- {{anchor name="item4|How do I access the hardware ports?"}}==

{{fbdoc item="back" value="DocToc|Table of Contents"}}

----

@@**""FreeBASIC"" Runtime Library questions**@@

{{anchor name="item1"}}== How do 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 required is to play .wav or .mp3 files thru a soundcard, external libraries as FMOD or BASS can be used in Linux and Windows. For DOS see the [[FaqDOS|DOS FAQ section]].

{{anchor name="item0|Back to top"}}

{{anchor name="item2"}}==How do I access the serial ports?==

**DOS**
See [[FaqDOS|DOS FAQ section]].

**Windows and Linux**
See [[KeyPgOpenCom|Open Com]].

{{anchor name="item0|Back to top"}}

{{anchor name="item3"}}==How do I print?==
Since version 0.15 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 [[http://en.wikipedia.org/wiki/ESC/P|wikipedia.org/wiki/ESC/P]]). This is OS-portable but depends on the printer model. The only way for DOS, see also [[FaqDOS|DOS FAQ section]].
- In Windows and Linux there are specific API calls. This is not OS-portable but the OS's printer driver makes it printer-independent.

{{anchor name="item0|Back to top"}}

{{anchor name="item4"}}==How do I access the hardware ports?==

INP, OUT and WAIT known from QB are implemented since version 0.15 of FB.
The GfxLib intercepts the calls to some VGA ports to emulate the widely used QB's palette manipulation and vsync methods. So ports &H3DA, &H3C7, &H3C8 and &H3C9 can't be accessed it GfxLib is used. All other ports are accessible.
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.

{{anchor name="item0|Back to top"}}

{{fbdoc item="see"}}
- [[CompilerFAQ|Compiler FAQ]]
- [[FaqPggfxlib2|Frequently Asked FreeBASIC Graphics Library Questions]]
and
- [[FaqPgWin32|Win32 related FAQ]]
- [[FaqDOS|DOS related FAQ]]

{{fbdoc item="back" value="DocToc|Table of Contents"}}
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode