-
Notifications
You must be signed in to change notification settings - Fork 0
BASCOMP programming examples
tt1542 edited this page Jun 2, 2026
·
6 revisions
Since you are here, you will probably know the basics about BASIC. BASCOMP implements a subset of statements and functions found in GW-BASIC, MS QuickBASIC and other dialects.
In a nutshell: Many easy traditional and QB BASIC programs should "just work", while larger and/or more specific programs will need smaller or larger modifications. If you are looking for some inspiration, this page is designed to give you bits and pieces of code showing what BASCOMP can do.
This program will need BASCOMP 2.0 and a suitable 256 colors display (VGA), showing of the graphical abilities (and some math functions) of BASCOMP. The execution speed will depend on your (physical/emulated) cpu.
10 REM ============================================
20 REM BASCOMP GRAPHICS DEMO: FULL 320x200 MANDELBROT
30 REM Requires SCREEN and PSET support
40 REM SCREEN 13 = 320x200, 256 colors
50 REM ESC aborts after each completed row
60 REM Fixed-point integer arithmetic, scale S=48
70 REM ============================================
80 SCREEN 13
90 S = 48: LIM = 192: MAXIT = 32
100 FOR PY = 0 TO 199
110 CY = (PY - 100) * 12 / 25
120 FOR PX = 0 TO 319
130 CX = PX * 9 / 20 - 96
140 ZX = 0: ZY = 0: I = 0
150 IF ABS(ZX) > 95 THEN GOTO 270
160 IF ABS(ZY) > 95 THEN GOTO 270
170 ZX2 = ZX * ZX / S
180 ZY2 = ZY * ZY / S
190 IF ZX2 + ZY2 > LIM THEN GOTO 270
200 IF I >= MAXIT THEN GOTO 270
210 NZX = ZX2 - ZY2 + CX
220 NZY = 2 * ZX * ZY / S + CY
230 ZX = NZX
240 ZY = NZY
250 I = I + 1
260 GOTO 150
270 CLR = I + 1
280 IF I < MAXIT THEN GOTO 300
290 CLR = 0
300 PSET PX, PY, CLR
310 NEXT PX
320 K$ = INKEY$
330 IF K$ = CHR$(27) THEN GOTO 380
340 NEXT PY
350 REM Wait for any key before returning to text mode
360 K$ = INKEY$
370 IF K$ = "" THEN GOTO 360
380 SCREEN 0
390 COLOR 7, 0
400 CLS
410 PRINT "DONE."
420 END