ArticleslgStudy

computer science

QB64

QB64 is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand QB64 rather than just read about it. In short: QB64 (originally QB32) 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.

QB64 — main illustration
QB64 — illustration

Key takeaways

  • QB64 belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect QB64 to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of QB64 from memory before moving on to harder problems.

Reference excerpt

QB64 (originally QB32) 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. QB64 implements most QBasic statements, and can run many QBasic programs, including Microsoft's QBasic Gorillas and Nibbles games. 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.

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

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:

An example of QB64's emulation of VGA memory for compatibility:

An example of how QB64 allows audio files:

An example of how QB64 allows picture files:

An example of how QB64 uses multiple timers:

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. 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, 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 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 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 Due to a shakeup in the community in 2022, there are now at least two forks of the QB64 project. The "QB64 Team" GitHub repository is no longer active, and all new development is being done in new forks:

QB64 Team was the authoritative version up to April 2022. QB64 Official A mix of prior and new developers have forked and restarted development. QB64 Phoenix (main site) (Github) The "Phoenix" fork was created to resurrect the project after the 2022 shakeup.

References

External links Official website QB64 (Phoenix) Website QB64 (Phoenix) Community Forum QB64 (Phoenix) Language Wiki QB64 YouTube Channel's channel on YouTube QB64 (Official) Repository on GitHub QB64 (Phoenix) Repository on GitHub

Illustrations

QB64 illustration

Worked examples

Example 1 — a first encounter with QB64

Start with the simplest possible case. Write down what QB64 claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to QB64 before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about QB64 ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of QB64

In research
QB64 appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses QB64 in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
QB64 is common in secondary-school and first-year university syllabi. It links to neighbouring topics 2007 software, BASIC compilers, BASIC programming language family, so understanding it makes those chapters shorter.
In everyday life
Look for QB64 outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “QB64” →

How to study QB64 in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what QB64 means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain QB64 out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is QB64 in simple terms?

QB64 (originally QB32) 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.

Why does QB64 matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study QB64?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on QB64.

Tags

  • 2007 software
  • BASIC compilers
  • BASIC programming language family
  • Free and open source compilers
  • Linux programming tools
  • MacOS programming tools
  • Programming tools for Windows

Keep exploring