College LAN Only - If you are using the college LAN (local area network), you can run QBasic.

Lots of examples

  1. In Windows 2000/XP, to see your file names with file extensions, go into Tools, Folder Options. Click the View tab. Uncheck "Hide extensions for known file types".
  2. To write programs that control hardware through the parallel port, you must boot the conputer from your Win95/QBasic disk.
  3. The write other programs, you can run QBasic from Windows 2000/XP. This will run fastrer if you copy qbasic.exe and qbasic.hlp from the floppy disk to a Windows folder.

Programming Assignment (LAN Only)

The list below is based on the AQA Specification. It requires the following ...

Statement

Examples

Explanation

PRINT [expression list] [ { ; | , } ]

01−Hello World
02−Arithmetic

Used to print text or numbers to the screen. Expressions are separated by commas or semicolons.

FOR counter = start TO end [STEP increment]
    [statement block]
NEXT counter

DO and FOR

Used to repeat a preset / known number of times.

DIM variable [(subscripts)]

04−Variables

Used to declare variables. This reserves and names a location in RAM.

INKEY$

05 INKEY

This returns a key from the keyboard buffer. If no key has been pressed, it returns an empty string. That is an opening quote followed by a closing quote with no text in between like this "".

DO [{WHILE | UNTIL} condition]
    [statement block]
LOOP

DO and FOR

Used to repeat code ZERO OR MORE times.

DO
    [statement block]
LOOP [{WHILE | UNTIL} condition]

DO and FOR

Used to repeat code ONE OR MORE times.

IF condition THEN
    [statement block 1]
ELSE
    [statement block 2]

IF

Used for true / false decisions. If the condition is true, statement bolck 1 runs. If the condition is false, statement block 2 runs.

GOSUB [label | line number]
SUB
    [statement block]
RETURN

This syntax appears to be invalid with Win95 QBasic

SUB

GOSUB is used to jump to a subroutine.

SUB begins a subroutine.

RETURN ends a subroutine (also END SUB)

INP (port %)

 

Input data from the numbered port.

INPUT [ ; ] ["prompt" {; | , }] variable list

INPUT

Input data from the keyboard. (comma or semicolon separated)

LPRINT [expression list] [ { ; | , }]

LPRINT

Send a line of printing to LPT1 (the printer port). There will be a device error is no printer is connected.

OUT port, data

OUT

Output data too a port. The Parallel Port on addresses &H378, &H379 and &H37A is commonly accessed in this way.

REM remark (the single quote ' sign can be used instead)

 

Used for human readable comments that are not part of the program. These comments should explain what is going on and why. They should not just repeat the code and state the obvious.

N% = N% + 1 ' Add one to N% (stupid brain dead comment)

N% = N% + 1 ' Make N% point to the next data item (OK)