QB64: Difference between revisions
No edit summary |
m Fixing the location of periods / full stops |
||
Line 19: | Line 19: | ||
== History == |
== History == |
||
QB64 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<ref>https://www.tapatalk.com/groups/qbasic/more-bugs-please-seriously-t36524.html#p165571</ref> |
QB64 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.<ref>https://www.tapatalk.com/groups/qbasic/more-bugs-please-seriously-t36524.html#p165571</ref> After version 0.63, QB64 was [[Self-hosting (compilers)|able to compile itself]] so the [[conventional memory]] limitations no longer applied. |
||
In the words of Galleon, ''I began to see the need for QB64 when it was clear that the introduction of VISTA would cripple QBASIC, relegating it to an ancient language only runnable on emulators which allow little/no chance of taking advantage of modern features on computers. The actual coding of QB64 began at the beginning of this year and QB64 has made steady progress since. I have had experience writing programming languages before so I knew in advance the challenges that awaited.''<ref>{{Cite web|url=https://www.tapatalk.com/groups/qbasic/welcome-to-the-qb64-forum-t36432.html|title=Welcome to the QB64 Forum!|website=THE QBASIC FORUM|language=en-gb|access-date=2020-01-28}}</ref> |
In the words of Galleon, ''I began to see the need for QB64 when it was clear that the introduction of VISTA would cripple QBASIC, relegating it to an ancient language only runnable on emulators which allow little/no chance of taking advantage of modern features on computers. The actual coding of QB64 began at the beginning of this year and QB64 has made steady progress since. I have had experience writing programming languages before so I knew in advance the challenges that awaited.''<ref>{{Cite web|url=https://www.tapatalk.com/groups/qbasic/welcome-to-the-qb64-forum-t36432.html|title=Welcome to the QB64 Forum!|website=THE QBASIC FORUM|language=en-gb|access-date=2020-01-28}}</ref> |
||
Line 86: | Line 86: | ||
== Extensions to QBASIC == |
== Extensions to QBASIC == |
||
QB64'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'''<ref>https://www.qb64.org/portal/changelog-of-v1-4/</ref> |
QB64'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'''.<ref>https://www.qb64.org/portal/changelog-of-v1-4/</ref> |
||
QB64 extends the QuickBASIC language in several ways. It adds the new [[data type]]s including <code>_BIT</code>, <code>_BYTE</code>, <code>_INTEGER64</code> and <code>_FLOAT</code> as well as [[Signedness|unsigned]] data types. The new data types have [[Sigil (computer programming)|suffixes]] just like the traditional BASIC data types. QB64 also includes an audio [[Library (computing)|library]] which allows playing most common audio formats including [[MP3]], [[Ogg Vorbis]], and [[WAV]] files as well as libraries allowing users to use higher resolution graphics than the 640×480 offered by QuickBASIC,<ref>{{cite web|url=http://www.qbasicnews.com/qboho/qckadvr.m111213.shtml|title=QB Advisor: Screen Modes 11, 12, and 13|year=1988|accessdate=2008-07-25|author=|publisher=Microsoft Corporation}}</ref> use different fonts, and plot images in [[BMP file format|BMP]], [[Portable Network Graphics|PNG]], and [[JPEG]] format. It also allows the use of 32-bit colors as opposed to the limited 256 (or 16, depending) colors originally offered. |
QB64 extends the QuickBASIC language in several ways. It adds the new [[data type]]s including <code>_BIT</code>, <code>_BYTE</code>, <code>_INTEGER64</code> and <code>_FLOAT</code> as well as [[Signedness|unsigned]] data types. The new data types have [[Sigil (computer programming)|suffixes]] just like the traditional BASIC data types. QB64 also includes an audio [[Library (computing)|library]] which allows playing most common audio formats including [[MP3]], [[Ogg Vorbis]], and [[WAV]] files as well as libraries allowing users to use higher resolution graphics than the 640×480 offered by QuickBASIC,<ref>{{cite web|url=http://www.qbasicnews.com/qboho/qckadvr.m111213.shtml|title=QB Advisor: Screen Modes 11, 12, and 13|year=1988|accessdate=2008-07-25|author=|publisher=Microsoft Corporation}}</ref> use different fonts, and plot images in [[BMP file format|BMP]], [[Portable Network Graphics|PNG]], and [[JPEG]] format. It also allows the use of 32-bit colors as opposed to the limited 256 (or 16, depending) colors originally offered. |
||
The programmer also does not have to specify which programming libraries to include since QB64 does it automatically. The programmer has the option to include a library of their own through the $INCLUDE command just as [[QuickBASIC]] did. |
The programmer also does not have to specify which programming libraries to include since QB64 does it automatically. The programmer has the option to include a library of their own through the $INCLUDE command just as [[QuickBASIC]] did. |
Revision as of 00:29, 16 April 2020
Developer | Rob Galleon, QB64Team |
---|---|
First appeared | 2007 |
Stable release | 1.4
/ February 13, 2020 |
OS | Microsoft Windows, Linux, macOS |
License | MIT |
Website | www |
Influenced by | |
QuickBASIC, QBASIC |
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 C++ emitter, 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.
History
QB64 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.[4] After version 0.63, QB64 was able to compile itself so the conventional memory limitations no longer applied.
In the words of Galleon, I began to see the need for QB64 when it was clear that the introduction of VISTA would cripple QBASIC, relegating it to an ancient language only runnable on emulators which allow little/no chance of taking advantage of modern features on computers. The actual coding of QB64 began at the beginning of this year and QB64 has made steady progress since. I have had experience writing programming languages before so I knew in advance the challenges that awaited.[5]
Syntax
QB64'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 QBASIC
QB64'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.[6]
QB64 extends the QuickBASIC language in several ways. It adds the new data types including _BIT
, _BYTE
, _INTEGER64
and _FLOAT
as well as unsigned data types. The new data types have suffixes just like the traditional BASIC data types. QB64 also includes an audio library which allows playing most common audio formats including MP3, Ogg Vorbis, and WAV files as well as libraries allowing users to use higher resolution graphics than the 640×480 offered by QuickBASIC,[7] use different fonts, and plot images in BMP, PNG, and JPEG format. It also allows the use of 32-bit colors as opposed to the limited 256 (or 16, depending) colors originally offered.
The programmer also does not have to specify which programming libraries to include since QB64 does it automatically. The programmer has the option to include a library of their own through the $INCLUDE command just as QuickBASIC did.
Advantages of QB64
- It supports different file formats and also provides clipboard access.
- QB64 gives instant access to 32bit graphics files (most popular formats).
- QB64 gives instant access to several audio formats.
- It's supported on most modern operating systems, so that no emulation is required.
Libraries
As of version 0.954, the SDL version of QB64 has been discontinued. The current (and future) versions of QB64 integrate 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, C++ and SDL functions and statements with a DECLARE LIBRARY block. Users can also access C header files to run C functions.
References
- ^ Stephane Richard (2007-11-16). "In The News". PCOPY! Issue #50. Basic Programming. Archived from the original on 2009-12-21. Retrieved 2008-08-17.
- ^ E.K.Virtanen (2008-05-26). "Interview With Galleon". PCOPY! Issue #70. Basic Programming. Archived from the original on 2008-08-21. Retrieved 2008-07-14.
- ^ "QB64 Screenshots - QB64/QBASIC Gorillas in QB64". Archived from the original on 2013-05-12. Retrieved 2010-07-27.
- ^ https://www.tapatalk.com/groups/qbasic/more-bugs-please-seriously-t36524.html#p165571
- ^ "Welcome to the QB64 Forum!". THE QBASIC FORUM. Retrieved 2020-01-28.
- ^ https://www.qb64.org/portal/changelog-of-v1-4/
- ^ "QB Advisor: Screen Modes 11, 12, and 13". Microsoft Corporation. 1988. Retrieved 2008-07-25.
External links
- Official website
- qb64 on GitHub
- programmingbasic - Advantages of QB64