QB64
QB64 (originally QB32)[1] is a self-hosting BASIC compiler for Microsoft Windows, Linux and Mac OS X, designed to be compatible with Microsoft QBasic and QuickBASIC. QB64 is a transpiler to C++, which is integrated with a C++ compiler to provide compilation via C++ code and GCC optimization.[2] QB64 implements most QBasic statements, and can run many QBasic programs, including Microsoft's QBasic Gorillas and Nibbles games.[3] Furthermore, QB64 has been designed to contain an IDE resembling the QBASIC IDE. QB64 also extends the QBASIC programming language to include 64-bit data types, as well as better sound and graphics support. It can also emulate some DOS/x86 specific features such as INT 33h mouse access, and multiple timers. Since version 2.0, QB64 now offers debugging abilities, with the new $DEBUG metacommand.[4] HistoryQB64 was originally compiled with QuickBASIC 4.5. After significant development, Rob Galleon, the developer, became hindered by QuickBASIC's memory limitations and switched to Microsoft Basic PDS 7.1, which solved these problems for a short time.[5] After version 0.63, QB64 was able to compile itself so the conventional memory limitations no longer applied. Regarding the impetus for QB64, Galleon said:[6]
Starting in 2016, work began on a graphical user interface builder and event driven integrated development environment called InForm, giving features similar to Visual Basic.[7] SyntaxQB64's syntax is designed to be completely backwards compatible with QuickBASIC. Line numbers are not required, and statements are terminated by newlines or separated by colons ( An example "Hello, World!" program is: PRINT "Hello, World!"
An example of QB64's emulation of VGA memory for compatibility: CLS
S$ = "Hello, World!"
DEF SEG = &HB800 'sets the segment to video memory
FOR I = 1 TO LEN(S$)
POKE 160 + (I - 1) * 2, ASC(MID$(S$, I, 1))'character
NEXT
DEF SEG 'reset the segment to default
An example of how QB64 allows audio files: sound_effect& = _SNDOPEN("sound.wav") 'WAV, OGG or MP3
_SNDPLAY sound_effect&
An example of how QB64 allows picture files: SCREEN _NEWIMAGE(800, 600, 32) 'creates a 32-bit screen
imagename& = _LOADIMAGE("image__name.png") 'BMP, JPG, PNG, etc.
_PUTIMAGE (0, 0), imagename&
_FREEIMAGE imagename& 'release assigned memory
An example of how QB64 uses multiple timers: t1 = _FREETIMER
t2 = _FREETIMER
ON TIMER(t1, 1) GOSUB Timer.Trap 'the code following the Timer.Trap label will be run every 1 second
ON TIMER(t2, .5) mySub 'QB64 can also trigger a SUB procedure with TIMER;
' in this case mySUB will be triggered every 500 milliseconds
'activate timers:
TIMER(t1) ON
TIMER(t2) ON
DO 'go into an infinite loop until the window is closed
_LIMIT 1 'run the main loop at 1 cycle per second, to show how timers are independent from main program flow
LOOP
Timer.Trap:
PRINT "1s; ";
RETURN
SUB mySub
PRINT "500ms; ";
END SUB
Extensions to QBASICQB64's extended commands begin with an underscore in order to avoid conflicts with any names that may be used in a QuickBASIC program. Beginning with version 1.4, the underscore prefix can be dropped by using the metacommand $NOPREFIX.[8]
QB64 extends the QuickBASIC language in several ways. It adds the new data types including Another significant feature that has been added is networking. Initially this allowed the opening of a TCP/IP stream that could be read and written using Input#/Print# instructions. This mode has its own proprietary packet encapsulation format which, whilst being easy to use with QBasic, meant that it could only be used to communicate with other QB64 programs or server backends with custom interfaces created specifically for the application. Later versions add GET# and PUT# to read and write raw bytes from the stream. This allows native implementations of standard protocols such as smtp and http. Advantages of QB64
LibrariesQB64 integrates FreeGLUT for its graphics and text. A development branch of the repository hosted on GitHub is frequently updated with fixes and improvements, which will eventually become the next stable release. The development builds are also offered via the official website for users to beta test. QB64 can also use DLL libraries for Windows and C++ headers with a DECLARE LIBRARY block. Users can also access C header files to run C functions. ForksDue to a shakeup in the community in 2022, there are now at least two forks of the QB64 project.[10] The "QB64 Team" Github repository is no longer active, and all new development is being done in new forks:
References
External links |