Porting QuickBASIC programs to FreeBASIC
Although FreeBASIC has extremely similar syntax to QuickBASIC, there are subtle differences, so some legacy code may not compile right away.
Some important things to note right away:
- FreeBASIC is written for 32-bit operating systems, and cannot utilize code which depends on 16-bit DOS.
- DEF SEG is no longer neccessary, and will not work.
- Since DEF SEG no longer functions, any code which POKEs to video memory will no longer function.
- A scalar variable and an array can no longer share the same name. Trying to compile code where var(1 to 10) is dimensioned in the same space where a is used in a FOR loop will not work.
- Variables with the same name but with or without a suffix are no longer the same. If you use A!, you must keep calling it A!, rather than A, unless A is declared explicitly as a single precision floating point (DIM a AS SINGLE).
- PC Speaker commands no longer function.
- Any references to SOUND or PLAY statements will result in an error message. There is a third party library available to emulate this functionality, but it's not included with FreeBASIC.
If one keeps these differences in mind, it's quite simple to port QB code to FB in a matter of hours.