Spotlight › 2BASIC
2BASIC
A BASIC interpreter in a window. Type numbered lines, type RUN, and the program draws, plays sounds, asks questions in dialog boxes or runs a game.
- Program lines
- Up to 288
- Games and examples
- 3 and 5
- Smallest PC tested
- 128KB
01 / What it is
What it is
BASIC is the programming language most home computers of the early 1980s started up in. You typed a line with a number in front of it and the computer kept it. You typed LIST to see the program and RUN to run it. A line typed without a number ran at once.
2BASIC works the same way, in an os8088 window. Its programs use whole numbers, one-dimensional arrays, FOR loops, GOSUB and IF. They can draw lines, boxes, circles and bitmaps, and play notes on the PC speaker or an FM sound card such as the AdLib. They can show a message box or ask for input, and build one form of up to 12 labels, buttons and check boxes that the program waits on for clicks. A program can keep up to 32 small values between runs.
2BRES comes with it. It is an editor for resource packs: files of 16-by-16 sprites, pictures, text and number tables that a program loads by name. The Blackjack game's cards are one such pack.
2BASIC was written by techdistractions for os8088. This release brings it up to date with the current system.
02 / On the screen
On the screen
03 / How it works
How it works
2BASIC is written in 8086 assembly language, like the rest of os8088. The package is 20KB and 2BRES is under 9KB.
A running program does not take over the machine. The interpreter runs it in a background task, one statement at a time, and gives the rest of the system a turn after each one. The window can still be moved, other programs keep running, and Esc or Ctrl+C stops the program.
The window keeps a program's drawing commands, so its picture is drawn again when another window has been dragged over it or the window changes size. DRAWBEGIN and DRAWEND group a batch of drawing into one update.
It draws in colour on VGA and EGA and in black and white on CGA and Hercules. Its own test programs were run on an emulated 4.77 MHz IBM PC, on the 128KB machine os8088's small kernel is made for, and on the protected-mode kernel for the 286 and later.
04 / What it does not do
What it does not do
Whole numbers only. There are no fractions. Numbers are 16-bit signed integers, from -32,768 to 32,767.
Small programs. Up to 288 lines and 4,864 bytes of program text, 512 array elements in all, and one form and one resource pack at a time.
It is not Microsoft's BASIC. The commands are its own, and programs written for GW-BASIC or QBasic need changes to run.
05 / Run 2BASIC
Run 2BASIC
Get the 2BASIC disk from the release zip, in
PROGRAMS/2BASIC/, in the size your drive takes. It is also on the live USB and CD, in a 2BASIC folder, and on The Wire.Boot the system disk, put the 2BASIC disk in drive B and open it.
Double-click
2BASIC.O88. TypeHELPfor the command list.Type
LOAD "\GAMES\BLACKJAK"and thenRUNto play Blackjack. On the live media the path starts\2BASIC\GAMES.