Home Archives   Tutorials Join

  Contents
Differences
Screen Grids
Colors
Online Calculator
Visual Commands
Routine control

 

QBasic Games!

Click here to get some cool games for QBasic

Learning QBasic

What is QBasic?

QBasic is a programming language designed for DOS (disk operating system) and is a very good "transitional language" to learn to help you migrate from TI-83 BASIC to modern day languages like Visual Basic, C++, and Java. By learning it, you will learn to deal with more code, commands, and complex routines. Once you have learned these basics, it's easier to learn other more modern languages.

What is required to program in QBASIC:

- Microsoft QBasic (Quick Bssic), version 7.1 with exe compiler is recommended

Command line differences between TI-83 BASIC and QBasic:

Command line changes
TI-83 BASIC QBasic
If a=b If a=b then... [end if]
for(x,a,b,c) for x=a to b step c
while a=b while a=b
repeat n/a
pause sleep [seconds]
Lbl bla bla:
Goto goto
IS>( - DS<( n/a
Menu( n/a
prgm call
return n/a
stop stop
Delvar Erase
GraphStyle n/a
Input Input
Prompt n/a
Disp print
DispGraph n/a
DispTable n/a
Output(x,y,"??") locate y,x:print "??"
getKey->x x$=inkey$
ClrHome cls
ClrTable n/a
GetCalc n/a
Get( n/a
Send( zillions more...
Grid 8 Grid 9
Click to view full size Click to view full size

Grid 12 (QBasic)
Click to view full size

Color Codes:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Calculator
The Pythagorean Theorem

( a2 + b2 = c2 )

2 + 2 =


Computer Science Assignments

Assignment Objective File
#1 NAME To display your name on the graph screen Download (QBasic)
#2 CASH To be able to buy items from a virtual store and calculate totals Download (QBasic)
#3 STAD To build a program which will manage expenses and income of a stadium Download (QBasic)
#4 DEALER To build a program which will bring you through the process of buying a car Download (QBasic)
#5 ARRAY Build a program using a two ar three dimensional array to store data. Air Traffic Control 2001 (QBasic archives)
#6 MOVE Build a program with animation! Chopper Mayhem (QBasic archives)
#7 FINAL Build any game of your choice! Breakout 2002 (QBasic archives)

Editing in Notepad if you're using GWBasic

Do edit in notepad you first must save your basic program as an ascii file. To do this, after your program has been opened in gwbasic, save the program by using the syntax:

SAVE"PROGRAM.BAS",A

The ,a will save it as an ascii file. It is always a good idea to have a back-up file of your work before you try and edit with NotePad. If you make a mistake in notepad, you will not be able to load it in GWBasic. Remember, you must always use the proper line numbers, and be very careful not to mix them up or repeat them. GWBasic does not recognize mixed-up line numbers of an ascii file. Your program just won't work correctly.
To open it in NotePad, run NotePad, the select open, and enter *.* into the filename diologue. Then select the program from the correct folder and click open. Once you have edited the program, you must save it first, then load it in GWBasic by typing LOAD"program.bas .

Visual commands

line(x,y)-(x,y),color,box filled
ex: line(34,68)-(42,174),12,bf

circle(x,y),raduis,color,start(Radian),end(Radian),aspect ratio
ex: circle(320,100),50,1,0,3.142

paint(x,y),color
ex: paint(1,1),2
Note: Paint can only be stopped by it's fill color


Program routine control

For Loops:

Example:

10 for x=0 to 10 step 2
20 print x
30 next x

Program result:

0
2
4
6
8
10

Goto statement

10 print"hello"
20 goto 40
30 This line won't be executed
40 print"bye!"

Program Result:

hi
bye!

Gosub statement

Example:

10 print"Hello!"
20 gosub 50
30 gosub 50
40 goto 70
50 print"How are you?"
60 return
70 print"Bye!"

Program Result:

Hello!
How are you?
How are you?
Bye!

Key loop routine:

10 A$=inkey$
30 IF A$=CHR$(0)+"H" then goto 80
40 IF A$=CHR$(0)+"P" then goto 100
50 IF A$=CHR$(0)+"K" then goto 120
60 IF A$=CHR$(0)+"M" then goto 140
70 goto 10
80 print"You pressed up!"
90 goto 160
100 print"You pressed down!"
110 goto 160
120 print"You pressed left!"
130 goto 160
140 print"You pressed right!"
150 goto 160
160 print"Bye!"

To Restart a your computer or End Task in Windows:

Use the line in your code:
OUT &h64, &hfe


[ Home ]  [ Archives ]  [ Tutorials ]  [ Join ]

Back to top