QB64
   HOME

TheInfoList



OR:

QB64 (originally QB32) is a self-hosting BASIC compiler for Microsoft Windows,
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, w ...
and
Mac OS X macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and la ...
, designed to be compatible with Microsoft
QBasic QBasic is an integrated development environment (IDE) and interpreter for a variety of dialects of BASIC which are based on QuickBASIC. Code entered into the IDE is compiled to an intermediate representation (IR), and this IR is immediately e ...
and
QuickBASIC Microsoft QuickBASIC (also QB) is an Integrated Development Environment (or IDE) and compiler for the BASIC programming language that was developed by Microsoft. QuickBASIC runs mainly on DOS, though there was also a short-lived version for the c ...
. QB64 is a
C++ C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
emitter, 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 Gorillas are herbivorous, predominantly ground-dwelling great apes that inhabit the tropical forests of equatorial Africa. The genus ''Gorilla'' is divided into two species: the eastern gorilla and the western gorilla, and either four or fi ...
'' 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 In computer architecture, 64-bit integers, memory addresses, or other data units are those that are 64 bits wide. Also, 64-bit CPUs and ALUs are those that are based on processor registers, address buses, or data buses of that size. A compu ...
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 In DOS memory management, conventional memory, also called base memory, is the first 640 kilobytes of the memory on IBM PC or compatible systems. It is the read-write memory directly addressable by the processor for use by the operating system ...
limitations no longer applied. Regarding the impetus for QB64, Galleon said:


Syntax

QB64's syntax is designed to be completely backwards compatible with QuickBASIC.
Line number In computing, a line number is a method used to specify a particular sequence of characters in a text file. The most common method of assigning numbers to lines is to assign every line a unique number, starting at 1 for the first line, and increme ...
s are not required, and statements are terminated by newlines or separated by colons (:). An example
"Hello, World!" program A "Hello, World!" program is generally a computer program that ignores any input and outputs or displays a message similar to "Hello, World!". A small piece of code in most general-purpose programming languages, this program is used to illustr ...
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 An underscore, ; also called an underline, low line, or low dash; is a line drawn under a segment of text. In proofreading, underscoring is a convention that says "set this text in italic type", traditionally used on manuscript or typescript a ...
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 . 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 In linguistics, a suffix is an affix which is placed after the stem of a word. Common examples are case endings, which indicate the grammatical case of nouns, adjectives, and verb endings, which form the conjugation of verbs. Suffixes can carry g ...
just like the traditional BASIC data types. QB64 also includes an audio
library A library is a collection of materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or digital access (soft copies) materials, and may be a physical location or a vir ...
which allows playing most common audio formats including
MP3 MP3 (formally MPEG-1 Audio Layer III or MPEG-2 Audio Layer III) is a coding format for digital audio developed largely by the Fraunhofer Society in Germany, with support from other digital scientists in the United States and elsewhere. Origin ...
,
Ogg Vorbis Vorbis is a free and open-source software project headed by the Xiph.Org Foundation. The project produces an audio coding format and software reference encoder/decoder (codec) for lossy audio compression. Vorbis is most commonly used in conjun ...
, and
WAV Waveform Audio File Format (WAVE, or WAV due to its filename extension; pronounced "wave") is an audio file format standard, developed by IBM and Microsoft, for storing an audio bitstream on PCs. It is the main format used on Microsoft Wind ...
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 command just as
QuickBASIC Microsoft QuickBASIC (also QB) is an Integrated Development Environment (or IDE) and compiler for the BASIC programming language that was developed by Microsoft. QuickBASIC runs mainly on DOS, though there was also a short-lived version for the c ...
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 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 and 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 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

QB64 integrates
FreeGLUT FreeGLUT is an open-source alternative to the OpenGL Utility Toolkit (GLUT) library. GLUT (and hence FreeGLUT) allows the user to create and manage windows containing OpenGL contexts on a wide range of platforms and also read the mouse, keyboard ...
for its graphics and text. A development branch of the repository hosted on
GitHub GitHub, Inc. () is an Internet hosting service for software development and version control using Git. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, continu ...
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
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

* * * * * * * * {{BASIC BASIC compilers Free compilers and interpreters MacOS programming tools Programming tools for Windows Linux programming tools Articles with example BASIC code 2007 software BASIC programming language family