Talk:QBasic

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Moved from main article[edit]

Does anyone know for sure whether QBASIC or QB 4.5 came first, or have a QB timeline? (question by anon)

Yes, I do. QB 4.5 came first. I have adjusted the article to make this clear. -- Derek Ross

This is not an "important" question about the language, but a question about the history... and I love those questions. You can learn a lot at Download QB*, which let's you download QBasic compilers, GW-BASIC interpreters, and Visual Basic Compilers, as well as reading about the history of these languages. QuickBasic came before any of the QBasic things, which came with DOS and didn't compile (in the help file they encourage users to buy VB-DOS in order to compile QBasic programs - I remember reading that for the first time, even before I had internet access, and thinking "How crummy!"). QBasic was, basically, QuickBasic without the compiler and some other helpful features. It has the library built in, which let's you run machine language code (QuickBasic has the library in an external file, and in order to use it you have to start QB.EXE with the switch "/l" from the commandline).

  • Broken Link --Cricket Boy 00:19, 14 October 2006 (UTC)

please can you explain how to write an algorithm on Qbasic language.please explain it in detail because we're new in it. thanks


I think the correct capitalization is QBasic, but I'll have to check on this.


i suggest moving this page into QuickBASIC as QBASIC and QuickBASIC are the same things. 68.221.220.63 (talk) 02:51, 11 August 2009 (UTC)[reply]

Bkell 06:04, 15 Dec 2003 (UTC)

Okay, I finally got tired of the incorrect "QBASIC," so I went ahead and moved the page. Hope no one complains too much. --Bkell 06:24, 11 Mar 2004 (UTC)
You're right. Thanks :-) --cprompt 23:29, Jun 12, 2004 (UTC)
From the manual "...the QuickBASIC Extended (QBX)..." therefore it should be QBASIC, (all capitals =) In most places the manual refers to the short form QBX.
QuickBASIC is not QBasic, although the IDEs look pretty similar. Whether or not QBX is a different product from QuickBASIC or just a different version, that's still up to debate. --coldacid 18:12, 11 October 2005 (UTC)[reply]

Say, I noticed on special keys that CTRL-PAUSE is listed. I always thought of it as CTRL-BREAK (pause and break are on the same key usually). Could someone check QBasic and see what the help refers to? --cprompt 23:29, Jun 12, 2004 (UTC)

Yes, you're right. It is usually CTRL-BREAK, even in the manual and help. And someone should change that, although it isn't important - as you say, they are the same!

External links[edit]

This article is starting to accumulate too many external links. I've seen this before in Mozilla and Firefox -- a clear case of fan syndrome. The solution is to remove all 'non-notable external links, but what links are considered notable are an open question. I haven't programmed in QBasic in years, so I haven't been following the scene closely. --Ardonik.talk() 03:30, Sep 18, 2004 (UTC)

I checked the sites for activity and got rid of hype in their descriptions. I didn't remove any site as I do not follow QBasic (I guess some sites will disappear over time). Pavel Vozenilek
This is becoming a problem again -- people just keep adding external links to their favorite QBasic tutorial/example/game site. The purpose of external links is to support the article, not necessarily direct people to other resources. I suggest they be trimmed (I may do so when I have the time). --Chris (talk) 17:20, 11 April 2006 (UTC)[reply]
I had a look at all the linked sites. I removed all external links, none of them pointed to any valuable information, just tutorials, forums, code downloads and the like. These do not belong in an enclyclopedic article. --85.83.121.6 22:58, 14 April 2007 (UTC)[reply]

QB community[edit]

An IP addressed user added the following, which I removed because it is non-encyclopedic in style. Perhaps someone could turn this into a sentence or two, if it is accurate (are there enough people still using QBasic to be called a "comunity"?):

QBasic has grown and developed a culture and community around it (yes, the phrase "the qbasic community" is an actual phrase, and has a lot of meaning to it!) You can't write a professional program in it, with everyone using Windows and Linux and Mac, although at one time there was such a thing as professional and, yes, even commercial, programs written in QB. QB is still a very popular programming language, because it is easy to use, and is very user friendly, and because there is such a community for it people are happier to learn to program in QB than to program in a language with only a very small community, such as Python. Yes, the QB community has grown quite large! And QB has become more than a programming language. It has a history, a culture, and is quite well-known. Critics scoff, but QB is truly a great language!

--Fastfission 03:51, 10 Nov 2004 (UTC)

Yes, there are enough people using it. There is a HUGE online community. Take a look at some of the sites listed as external links. http://www.neozones.com/, http://www.qbasicnews.com/, and others. I personally do not use QBasic except for simple programs that are un-important but would take too long to write in other languages. But I like to point out that QBasic has a huge community, partly because it's where I got my start.

Other BASICs or just closely related?[edit]

I added a See Also section, but couldn't decide if I should include other popular BASICs or just the closely related ones - I went the second route, any comments on this for my future reference?

Code example: Renew occasionally?[edit]

I tried adding this, but the enters got messed up. Anyone feel like posting it with lines correctly returned?


The following code asks the user for their name and age. It then shows them a number of dots equal to their age.

'Code start CLS: SCREEN 12 LINE (0,0)-(639,479), 2, B LINE (2,2)-(637,477), 2, B INPUT "Enter your name:", name$ INPUT "Enter your age:", age PLAY "cdedl4c" PRINT "Hello, " + name$ + "!" PRINT "Your age is:"; age FOR x = 320 - (age * 2) TO 320 + (age * 2) STEP 4 PSET (x, 240), 4 NEXT LOCATE 20, 10: PRINT "Number of dots equals your age." 'Code end —Preceding unsigned comment added by 64.30.36.100 (talkcontribs) , 15 November 2005

I see some issues with this code...

CLS: SCREEN 12
LINE (0,0)-(639,479), 2, B
LINE (2,2)-(637,477), 2, B
'LOCATE 2, 2 'should move the caret inside the box
INPUT "Enter your name:", name$
'LOCATE 3, 2 'should move the caret away from the side
INPUT "Enter your age:", age
PLAY "cdedl4c" 'actually, i'd play the notes after the output...
PRINT "Hello, " + name$ + "!"
PRINT "Your age is:"; age
'and the following loop draws too many points, since it does age*2/4 negatives, 1 zero, and age*2/4 positives, totalling age+1...
FOR x = 320 - (age * 2) TO 320 + (age * 2) STEP 4 'possible fix: 322- TO 318+
PSET (x, 240), 4
NEXT
LOCATE 20, 10: PRINT "Number of dots equals your age."

But, personally, i don't know if this really belongs in an encyclopedic article... -- Jokes Free4Me (talk) 09:23, 15 September 2008 (UTC)[reply]

History[edit]

I removed the following stuff from the History section, because: 1. It's not history. 2. It is confusingly written. 3. It is imprecise. The % suffix does not indicate a "number"; it indicates a 16-bit signed integer. There are other suffixes for 32-bit integers and single and double precision floats.


Variables can be declared with % to represent a number, or $ to represent a string.
j%=5
r%=9.1
text$="Hello."
go$="Wassup."
Strings are always surrounded in quotes, cannot be numbers (unless in quotes), and numbers (%) cannot be surrounded in quotes.


Equalpants 04:00, 15 December 2005 (UTC)[reply]

Easter Egg[edit]

I learned of this trick years ago from http://www.eeggs.com (currently down?). It does indeed work, but it seems impossible on really fast computers. If anyone wants, I've got a text screen capture of it. Should I post it here or let everyone try the key combo themselves?

Armslurp 22:53, 15 December 2005 (UTC)[reply]

DOSBox Not Needed for NT-Line[edit]

I can run QBASIC 1.1 on XP. Doesn't seem to need DOXBox, at least not to just open it up and have it running. Anyone else?

MSTCrow 01:39, 1 January 2006 (UTC)[reply]
I run QuickBasic 4.5 without using DOSBox inside Windows 2000. The article doesn't specify that one needs to use DOSBox on NT-based Windows platforms in order to run QBasic - only that, by using DOSBox, it can be run under those platforms. I'll rephrase it to make it clearer. Someone42 05:59, 1 January 2006 (UTC)[reply]

Hello World Code Example[edit]

Does anyone think a simple "Hello, World!" program should be included in the Code Example section? (RCX 22:26, 20 January 2006 (UTC))[reply]

There's a whole article on Hello World program. QBasic's entry is PRINT "Hello World!". Hardly seems worth it to repeat it here. Camillus (talk) 23:21, 20 January 2006 (UTC)[reply]
Technically, the ENTIRE program of Hello World for QBasic in a well-written (proper, not necessary) form would be
REM Hello World
CLS
PRINT "Hello World!"
END

Just saying here JONJONAUG 22:05, 21 February 2006 (UTC)[reply]

Most other Hello, world! programs do not clear the screen. Also, CPMcE/Camillus, I did not see QBASIC's entry... Michael 19:51, 23 February 2006 (UTC)[reply]
The article has moved to List of hello world programs (which is up for deletion). Although QBasic is not mentioned specifically, it describes "variants of Microsoft BASIC", which includes QBasic - see List of hello world programs#General. Camillus (talk) 22:17, 23 February 2006 (UTC)[reply]


I think the Hello World code example seems out of place here. Although an example of code is interesting, it doesn't add anything to the encyclopedic value of the article. An explanation of the internal workings of the qbasic compiler describing how qbasic handles the commands would make it more encyclopedic, but would also be overboard. I would prefer to see an external link pointing to code examples including commentary and sample output. A2Z 06:24, 13 July 2007 (UTC)[reply]

Regarding "Games"[edit]

Regarding the text: "QBasic came complete with a couple of pre-written example games. These were Nibbles (a variant of the Snake game), Gorilla, an explosive-banana throwing game and RemLine, a GW-BASIC code line number removing program." Why not change "games" to "programs", and add reference to money.bas. Besides, remline.bas isn't a game either. Also, does anyone want to say anything about msherc.com? It seemed to be specifically for QBASIC, although I'm not sure if it was for both versions. Also, the original MS-DOS Editor (not the one with Win95) relied on qbasic.exe, as did MS-DOS 6.22's Help system, if I remember right. You would want to verify this before adding it. MCalkins 18:26, 2 February 2006 (UTC)[reply]

In MS-DOS 5, there are four sample QBASIC programs, Gorilla, Nibbles, Money and RemLines. The first two are games, the last two are utilities, for managing money, and removing line numbers from GWBasic code. MSHerc is a utility to be loaded before QBASIC to allow QBasic to write to the screen. See for example, COMMANDS.TXT in any of the supplemental disks. Wendy.krieger (talk) 12:25, 15 December 2020 (UTC)[reply]

ARticle sucks[edit]

I love QBasic, but, no offense, this article sucks. Someone needs to fix it.

Non-article comments removed[edit]

I moved some /Non-article discussion (about QBASIC programming) off this page, since it didn't disucss the article itself. Discussion pages are not a bulletin board.-Bdoserror 08:28, 13 February 2007 (UTC)[reply]

Major Overhaul[edit]

I've been really ashamed of this article for a long time. Many times, some crazed QBasic fan would come along and add their own stuff to the article and generaly made it look like crap (links to their own worthless QBasic pages and whatnot). I figured that it would work itself out overtime, but I was wrong. So today, I decided to make some major changes. Most notably, I removed the unescessarilly large example programs, they don't really look like encyclopedia material to me, but more like something out of a tutorial, so I hope someone can fit them into the QBasic Wikibook or something. I also added some information about QBasic and MS-DOS edit which I thought was important. Nick Warren 05:51, 19 April 2007 (UTC)[reply]


Greetings Nick ...

Regarding your edits to the TRIVIA section, the previously displayed information about QBASIC's compatibility with versions of MS-DOS prior to 5.00 was my lone contribution to the QBASIC page. More than that, anyone in possession of computers running MS-DOS from version 3.20 (if not lower) thru version 4.01/4.10 can easily verify such compatibilty.

For your reference »» A previous QBASIC page with my trivia information.

Incidentally, I agree that the overall QBASIC page did look a little out of sorts!

Something Else - The Wikipedia link for PowerBASIC should be included in the "See Also" section.

Thanx-A-Lot, Frank Fgf2007 18:48, 19 April 2007 (UTC)[reply]


Don't worry, I noticed the trivia section and realized that it is relevant information, so I moved it to a different place. Your stuff is still in the article, so don't worry. Nick Warren 09:00, 20 April 2007 (UTC)[reply]

Greetings Once More ...

Ah, Yes! Now I see!

Thanx-A-Lot, Frank Fgf2007 11:11, 20 April 2007 (UTC)[reply]

References please[edit]

Please provide some references and citations. Otherwise I might have to add {{unreferenced}} to the article, which I'd rather not do. Shinobu 15:37, 22 May 2007 (UTC)[reply]

QBasic Versions[edit]

QBasic 1.0 was included in MS-DOS 5.0, and in Windows NT 3.x and 4.0. These are three different compiles of the same: 5.00, 5.00a and WNT use different versions of QBASIC.

IBM recompiled QBasic and included it in their IBMDOS 5.x, as well as OS/2 2.0 onwards. eComstation includes OS/2, and includes QBasic 1.0. There are four versions of this. The sequencing can be derived from the various PC-DOS fix levels and releases. The first version to run on a clone appeared in DOS5EIU.EXE, and is used in every version of OS/2 2.0 and later. The second version appears in DOS 5.00.1 and 5.02, the third version appears in the final CSD 37387 from IBM.

QBasic 1.1 is included with MS-DOS 6.x, and, without EDIT, with Windows 9x. The edit.hlp files from v 1.0 and 1.1 have different linking codes, so requesting context-sensitve help where qbasic and edit.hlp are different versions will lead to incorrect pages.

The help system is Quickhelp, a precursor to Winhelp. (Winhelp will recognise Quickhelp as a "DOS help file". One compiles quickhelp with helpmake.

The sample files are identical for both versions, are included in DOS 5.x, Windows NT 3.x. They are available for download for MS-DOS 6.x (on the supplemental disks).

EDIT.COM or EDIT.HLP is not included with the Windows 9x version, nor with any version of OS/2.

Wendy.krieger 08:21, 13 September 2007 (UTC)[reply]

Thanks! That's some great information. I'll have to work it into the article. However, I'd like to find out where you got that info from. It seems we're being pressed to provide references and citations now (which is a good idea anyway), so we'll have to know where it came from eventually. Nick Warren 08:32, 19 September 2007 (UTC)[reply]

All of this information comes from the actual operating system distributions.
I learnt quickhelp by decompiling the help from MS-DOS 5,x and 6.x, and writing my own notes in this form. QH was very popular in the early OS/2 days. There is still an INF2QH program available, for converting OS/2 help source to quickhelp.
Ralph Walden wrote both Quickhelp + Winhelp 1.0 (appeared with Windows 3.0) see http://helpware.net/htmlhelp/hh_info.htm

--Wendy.krieger (talk) 09:25, 25 November 2007 (UTC)[reply]

You know what I don't get?[edit]

Why is it that like, 80% of the vandalism on this page is directed at the hello world example? Don't you vandals have other ways to waste my time? Nick Warren 02:44, 20 October 2007 (UTC)[reply]

4 examples (header only)[edit]

Here are the header of the 4 example programs of Qbasic.

GORILLA.BAS
'                         Q B a s i c   G o r i l l a s
'
'                   Copyright (C) Microsoft Corporation 1990
'
' Your mission is to hit your opponent with the exploding banana
' by varying the angle and power of your throw, taking into account
' wind speed, gravity, and the city skyline.
'
' Speed of this game is determined by the constant SPEEDCONST.  If the
' program is too slow or too fast adjust the "CONST SPEEDCONST = 500" line
' below.  The larger the number the faster the game will go.
'
' To run this game, press Shift+F5.
'
' To exit QBasic, press Alt, F, X.
'
' To get help on a BASIC keyword, move the cursor to the keyword and press
' F1 or click the right mouse button.
'
NIBBLES.BAS
'
'                         Q B a s i c   N i b b l e s
'
'                   Copyright (C) Microsoft Corporation 1990
'
' Nibbles is a game for one or two players.  Navigate your snakes
' around the game board trying to eat up numbers while avoiding
' running into walls or other snakes.  The more numbers you eat up,
' the more points you gain and the longer your snake becomes.
'
' To run this game, press Shift+F5.
'
' To exit QBasic, press Alt, F, X.
'
' To get help on a BASIC keyword, move the cursor to the keyword and press
' F1 or click the right mouse button.
'
MONEY.BAS
'
'                    Q B a s i c   M O N E Y   M A N A G E R
'
'                   Copyright (C) Microsoft Corporation 1990
'
' The Money Manager is a personal finance manager that allows you
' to enter account transactions while tracking your account balances
' and net worth.
'
' To run this program, press Shift+F5.
'
' To exit QBasic, press Alt, F, X.
'
' To get help on a BASIC keyword, move the cursor to the keyword and press
' F1 or click the right mouse button.
'
REMLINE.BAS
'
'   Microsoft RemLine - Line Number Removal Utility
'   Copyright (C) Microsoft Corporation 1985-1990
'
'   REMLINE.BAS is a program to remove line numbers from Microsoft Basic
'   Programs. It removes only those line numbers that are not the object
'   of one of the following statements: GOSUB, RETURN, GOTO, THEN, ELSE,
'   RESUME, RESTORE, or RUN.
'
'   When REMLINE is run, it will ask for the name of the file to be
'   processed and the name of the file or device to receive the
'   reformatted output. If no extension is given, .BAS is assumed (except
'   for output devices). If filenames are not given, REMLINE prompts for
'   file names. If both filenames are the same, REMLINE saves the original
'   file with the extension .BAK.
'
'   REMLINE makes several assumptions about the program:
'
'     1. It must be correct syntactically, and must run in BASICA or
'        GW-BASIC interpreter.
'     2. There is a 400 line limit. To process larger files, change
'        MaxLines constant.
'     3. The first number encountered on a line is considered a line
'        number; thus some continuation lines (in a compiler-specific
'        construction) may not be handled correctly.
'     4. REMLINE can handle simple statements that test the ERL function
'        using  relational operators such as =, <, and >. For example,
'        the following statement is handled correctly:
'
'             IF ERL = 100 THEN END
'
'        Line 100 is not removed from the source code. However, more
'        complex expressions that contain the +, -, AND, OR, XOR, EQV,
'        MOD, or IMP operators may not be handled correctly. For example,
'        in the following statement REMLINE does not recognize line 105
'        as a referenced line number and removes it from the source code:
'
'             IF ERL + 5 = 105 THEN END
'
'   If you do not like the way REMLINE formats its output, you can modify
'   the output lines in SUB GenOutFile. An example is shown in comments.

-- LeeSI (talk) 03:00, 26 January 2008 (UTC)[reply]

Game code[edit]

There was a problem with the game code.

IF choice$ <> "YES" OR choice$<>"Y" THEN

The answer cannot be "YES" and "Y" at the same time, so it will always be not YES", or not "Y". I've changed this to an AND statement, so that it won't trip as a no on only one condition.

Forgot to sign. Joetheodd (talk) 01:25, 3 August 2008 (UTC)[reply]

There's another problem with the game code.
IF choice$ <> "YES" AND choice$ <> "Y" THEN ' and decides whether or not they want to play:
END IF
This statement does nothing. If they user enters YES or Y, the statement is false, and the game continues. If the answer is anything else, nothing happens, and the game continues. There ought to be an 'END' statement between IF and END IF. An even more graceful solution would be to wrap the IF ... END IF around the entire game.
However, when I altered this, it was reverted. It's a pretty basic (ha ha) mistake. --taras (talk) 21:37, 13 May 2011 (UTC)[reply]
Personally, I'd rather test for a positive condition then a negative one, far easier to see exactly what your code will act on:
IF choice$ = "YES" OR choice$ = "Y" THEN ' and decides whether or not they want to play:
END IF
One could even take out the input line, and use something like:
while choice$=""                         ' Simple loop to
 choice$ = ucase$(inkey$)                ' take a single upper case character typed on the keyboard
wend                                     ' (end of loop)
IF choice$ = "Y" THEN                    ' Then test if you pressed 'Y' to play
 ... rest of code
END IF

MrZoolook (talk) 01:44, 11 November 2012 (UTC)[reply]

Some old page history[edit]

Some old page history that used to be at the title "QBasic" can now be found at Talk:QBasic/Merge. Graham87 04:57, 23 July 2009 (UTC)[reply]

See Also list could be pruned[edit]

Only some of the basics mention Qbasic in their article page. Those without such a mention could be removed, as the See Also list should not be just a list of any basics. 92.15.25.92 (talk) 12:37, 21 January 2011 (UTC)[reply]

Additional END statement[edit]

I don't believe the additional END statement is necessary, running the program as written runs fine. - SudoGhost (talk) 21:37, 13 May 2011 (UTC)[reply]

Not if you enter anything other than Y or YES when asked if you want to play... (see above under 'Game Code') -taras (talk) 21:39, 13 May 2011 (UTC)[reply]
I just ran it both ways, you're right. My apologizes.. - SudoGhost (talk) 21:48, 13 May 2011 (UTC)[reply]
No worries, I am fixing it in a better way anyway (having just tested it in QBasic :) ) -taras (talk) 21:51, 13 May 2011 (UTC)[reply]
I took out the un-needed code that changes the user input to upper-case, as the test immediately below it was converting it to lower-case as part of the actual 'if' test loop anyway. Simply testing for the lower-case of the input has exactly the same result in one less line of code. MrZoolook (talk) 01:16, 11 November 2012 (UTC)[reply]

To input your name and school name, display them on the screen[edit]

103.166.172.228 (talk) 13:46, 4 April 2024 (UTC)[reply]