Jump to content

QB64: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
V 2samg (talk | contribs)
m Add "www." to QB64 (Phoenix) Website URL. This opens the QB64 (Phoenix) home page instead of going to the forum.
 
(54 intermediate revisions by 27 users not shown)
Line 1: Line 1:
{{short description|Programming language}}
{{Short description|IDE for the BASIC programming language}}
{{Infobox programming language
{{Infobox programming language
| logo = QB64-1-4-logo-hd-transparency.svg
| logo = QB64-1-4-logo-hd-transparency.svg
| logo_caption = QB64 language logo as of version 1.3
| logo_caption = QB64 language logo as of version 1.3
| logo alt = The QB64 logo
| logo alt = The QB64 logo
| released = {{Start date and age|2007}}
| released = {{Start date and age|2007|09|08}}
| developer = Rob Galleon, QB64Team
| developer = Rob Galleon, QB64Team
| license = [[MIT License|MIT]]
| license = [[MIT License|MIT]]
| website = {{url|www.qb64.org}}
| website = {{url|www.qb64.com}}
| latest_release_version = 1.5
| latest_release_version = 2.0.2
| latest_release_date = {{Start date and age|2021|02|28}}
| latest_release_date = {{Start date and age|2021|11|07}}
| influenced_by = [[QuickBASIC]], [[QBASIC]]
| influenced_by = [[QuickBASIC]], [[QBASIC]]
| operating_system = [[Microsoft Windows]], [[Linux]], [[macOS]]
| operating_system = [[Microsoft Windows]], [[Linux]], [[macOS]]
}}
}}
{{Portal|Free and open-source software}}
{{Portal|Free and open-source software}}
'''QB64''' (originally '''QB32''')<ref>{{cite web|url=http://www.basicprogramming.org/pcopy/issue50/#inthenews|work=PCOPY! Issue #50|title=In The News|date=2007-11-16|access-date=2008-08-17|author=Stephane Richard|publisher=Basic Programming|archive-url=https://web.archive.org/web/20091221084037/http://www.basicprogramming.org/pcopy/issue50/#inthenews|archive-date=2009-12-21}}</ref> is a [[Self-hosting (compilers)|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 [[GNU Compiler Collection|GCC]] optimization.<ref>{{cite web|url=http://www.basicprogramming.org/pcopy/issue70/#galleoninterview|work=PCOPY! Issue #70|title=Interview With Galleon|date=2008-05-26|access-date=2008-07-14|author=E.K.Virtanen|publisher=Basic Programming|archive-url=https://web.archive.org/web/20080821183950/http://www.basicprogramming.org/pcopy/issue70/#galleoninterview|archive-date=2008-08-21}}</ref>
'''QB64''' (originally '''QB32''')<ref>{{cite web|url=http://www.basicprogramming.org/pcopy/issue50/#inthenews|work=PCOPY! Issue #50|title=In The News|date=2007-11-16|access-date=2008-08-17|author=Stephane Richard|publisher=Basic Programming|archive-url=https://web.archive.org/web/20091221084037/http://www.basicprogramming.org/pcopy/issue50/#inthenews|archive-date=2009-12-21}}</ref> is a [[Self-hosting (compilers)|self-hosting]] [[BASIC]] compiler for [[Microsoft Windows]], [[Linux]] and [[Mac OS X]], designed to be compatible with Microsoft [[QBasic]] and [[QuickBASIC]]. QB64 is a [[Source-to-source compiler|transpiler]] to [[C++]], which is integrated with a C++ compiler to provide compilation via C++ code and [[GNU Compiler Collection|GCC]] optimization.<ref>{{cite web|url=http://www.basicprogramming.org/pcopy/issue70/#galleoninterview|work=PCOPY! Issue #70|title=Interview With Galleon|date=2008-05-26|access-date=2008-07-14|author=E.K.Virtanen|publisher=Basic Programming|archive-url=https://web.archive.org/web/20080821183950/http://www.basicprogramming.org/pcopy/issue70/#galleoninterview|archive-date=2008-08-21}}</ref>


QB64 implements most QBasic statements, and can run many QBasic programs, including Microsoft's QBasic [[Gorillas (computer game)|Gorillas]] and [[Nibbles (computer game)|Nibbles]] games.<ref name="Gorillas">{{cite web|url=http://www.qb64.net/gallery/main.php?g2_itemId=15|title=QB64 Screenshots - QB64/QBASIC Gorillas in QB64|access-date=2010-07-27|archive-url=https://web.archive.org/web/20130512110433/http://www.qb64.net/gallery/main.php?g2_itemId=15|archive-date=2013-05-12}}</ref> 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 (x86 instruction)|INT]] 33h mouse access, and multiple timers.
QB64 implements most QBasic statements, and can run many QBasic programs, including Microsoft's QBasic ''[[Gorillas (computer game)|Gorillas]]'' and ''[[Nibbles (computer game)|Nibbles]]'' games.<ref name="Gorillas">{{cite web|url=http://www.qb64.net/gallery/main.php?g2_itemId=15|title=QB64 Screenshots - QB64/QBASIC Gorillas in QB64|access-date=2010-07-27|archive-url=https://web.archive.org/web/20130512110433/http://www.qb64.net/gallery/main.php?g2_itemId=15|archive-date=2013-05-12}}</ref> 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 (x86 instruction)|INT]] 33h mouse access, and multiple timers.

Since version 2.0, QB64 now offers debugging abilities, with the new '''$DEBUG''' metacommand.<ref>{{cite web |url=https://www.qb64.org/portal/changelog-for-v2-0/ |title=Changelog for v2.0 – QB64.org |website=www.qb64.org |url-status=dead |archive-url=https://web.archive.org/web/20211010015640/https://www.qb64.org/portal/changelog-for-v2-0/ |archive-date=2021-10-10}} </ref>


== 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> After version 0.63, QB64 was [[Self-hosting (compilers)|able to compile itself]] so the [[conventional memory]] limitations no longer applied.
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>{{Cite web|url=https://www.tapatalk.com/groups/qbasic/more-bugs-please-seriously-t36524.html#p165571|title = More BUGS please! (Seriously)| date=3 March 2008 }}</ref> After version 0.63, QB64 was [[Self-hosting (compilers)|able to compile itself]] so the [[conventional memory]] limitations no longer applied.

Regarding the impetus for QB64, Galleon said:<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|date=30 September 2007 |language=en-gb|access-date=2020-01-28}}</ref> {{blockquote|text=I began to see the need for QB64 when it was clear that the introduction of [[Windows Vista|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.}}


Starting in 2016, work began on a [[graphical user interface builder]] and [[event driven programming|event driven]] [[integrated development environment]] called InForm, giving features similar to [[Visual Basic]].<ref>{{cite web|url=https://warped3.substack.com/p/blast-from-the-past-qbasic-45|title=Blast from the past - QBasic 4.5|website=Barn Lab|first=Ivan|last=Rogoz|date=2022-04-07|access-date=2023-09-26|quote=''QB64 comes with a WYSIWYG IDE editor called InForm which brings it closer to everyday use as a quick and dirty language for automation for Windows.''}}</ref>
Regarding the impetus for QB64, Galleon said:<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> {{quote|text=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.}}


== Syntax ==
== Syntax ==
Line 86: Line 90:


== 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 {{mono|$NOPREFIX}}.<ref>{{cite web |url=https://www.qb64.org/portal/changelog-of-v1-4/ |title=Changelog for v1.4 – QB64.org |website=www.qb64.org |url-status=dead |archive-url=https://web.archive.org/web/20200213200924/https://www.qb64.org/portal/changelog-of-v1-4/ |archive-date=2020-02-13}} </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|access-date=2008-07-25|publisher=Microsoft Corporation|archive-url=https://web.archive.org/web/20090105235430/http://www.qbasicnews.com/qboho/qckadvr.m111213.shtml|archive-date=2009-01-05|url-status=dead}}</ref> use different fonts, and plot images in [[BMP file format|BMP]], [[Portable Network Graphics|PNG]], and [[JPEG]] formats. 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|access-date=2008-07-25|publisher=Microsoft Corporation|archive-url=https://web.archive.org/web/20090105235430/http://www.qbasicnews.com/qboho/qckadvr.m111213.shtml|archive-date=2009-01-05|url-status=dead}}</ref> use different fonts, and plot images in [[BMP file format|BMP]], [[Portable Network Graphics|PNG]], and [[JPEG]] formats. 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 {{mono|$INCLUDE}} command just as [[QuickBASIC]] did.

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 {{mono|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 {{mono|GET#}} and {{mono|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 ==
== Advantages of QB64 ==


* It supports different file formats and also provides clipboard access.
* 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 32-bit graphics files (most popular formats).
* QB64 gives instant access to several audio formats.
* QB64 gives instant access to several audio formats.
* It's supported on most modern operating systems, so that no emulation is required.
* It's supported on most modern operating systems, so that no emulation is required.
Line 104: Line 110:


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.
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.

== Forks ==

Due to a [https://lunduke.substack.com/p/the-wild-events-that-nearly-took shakeup in the community] in 2022, there are now at least two forks of the QB64 project.<ref>{{cite web|url=https://www.theregister.com/2023/03/28/nostalgic_for_basic/|title=Nostalgic for VB? BASIC is anything but dead|first=Liam|last=Proven|website=[[The Register]]|date=2023-03-28|access-date=2023-10-01|quote=''So does QB64, although the dust has yet to completely settle over a split among its developers. A community called QB64 Phoenix is actively developing a new Phoenix Edition.''}}</ref> The "QB64 Team" Github repository is no longer active, and all new development is being done in new forks:

* [https://github.com/QB64Team/qb64 QB64 Team] was the authoritative version up to April 2022.
* [https://github.com/QB64Official/qb64 QB64 Official] A mix of prior and new developers have forked and restarted development.
* [https://www.qb64phoenix.com/ QB64 Phoenix (main site)] ([https://github.com/QB64-Phoenix-Edition/QB64pe Github]) The "Phoenix" fork was created to resurrect the project after the 2022 shakeup.


== References ==
== References ==
Line 111: Line 125:
== External links ==
== External links ==
* {{official website}}
* {{official website}}
* {{url|https://www.qb64phoenix.com|QB64 (Phoenix) Website}}
* {{github|QB64Team/qb64}}
* {{url|https://qb64phoenix.com/forum|QB64 (Phoenix) Community Forum}}
* {{url|https://qb64phoenix.com/qb64wiki/index.php/Main_Page|QB64 (Phoenix) Language Wiki}}
* {{YouTube|c=UCAisEw_O6wJU7phm3ZTCy7g|QB64 YouTube Channel}}
* {{github|QB64Official/qb64|QB64 (Official) Repository}}
* {{github|QB64-Phoenix-Edition/QB64pe|QB64 (Phoenix) Repository}}


{{BASIC}}
{{BASIC}}


[[Category:BASIC compilers]]
[[Category:BASIC compilers]]
[[Category:Free compilers and interpreters]]
[[Category:Free and open source compilers]]
[[Category:MacOS programming tools]]
[[Category:MacOS programming tools]]
[[Category:Programming tools for Windows]]
[[Category:Programming tools for Windows]]

Latest revision as of 00:46, 14 December 2024

QB64
The QB64 logo
DeveloperRob Galleon, QB64Team
First appearedSeptember 8, 2007; 17 years ago (2007-09-08)
Stable release
2.0.2 / November 7, 2021; 3 years ago (2021-11-07)
OSMicrosoft Windows, Linux, macOS
LicenseMIT
Websitewww.qb64.com
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 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]

History

[edit]

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.[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]

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.

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]

Syntax

[edit]

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

[edit]

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.[8] 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,[9] use different fonts, and plot images in BMP, PNG, and JPEG formats. 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.

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

[edit]
  • It supports different file formats and also provides clipboard access.
  • QB64 gives instant access to 32-bit 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

[edit]

QB64 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.

Forks

[edit]

Due 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

[edit]
  1. ^ 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.
  2. ^ 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.
  3. ^ "QB64 Screenshots - QB64/QBASIC Gorillas in QB64". Archived from the original on 2013-05-12. Retrieved 2010-07-27.
  4. ^ "Changelog for v2.0 – QB64.org". www.qb64.org. Archived from the original on 2021-10-10.
  5. ^ "More BUGS please! (Seriously)". 3 March 2008.
  6. ^ "Welcome to the QB64 Forum!". THE QBASIC FORUM. 30 September 2007. Retrieved 2020-01-28.
  7. ^ Rogoz, Ivan (2022-04-07). "Blast from the past - QBasic 4.5". Barn Lab. Retrieved 2023-09-26. QB64 comes with a WYSIWYG IDE editor called InForm which brings it closer to everyday use as a quick and dirty language for automation for Windows.
  8. ^ "Changelog for v1.4 – QB64.org". www.qb64.org. Archived from the original on 2020-02-13.
  9. ^ "QB Advisor: Screen Modes 11, 12, and 13". Microsoft Corporation. 1988. Archived from the original on 2009-01-05. Retrieved 2008-07-25.
  10. ^ Proven, Liam (2023-03-28). "Nostalgic for VB? BASIC is anything but dead". The Register. Retrieved 2023-10-01. So does QB64, although the dust has yet to completely settle over a split among its developers. A community called QB64 Phoenix is actively developing a new Phoenix Edition.
[edit]