The machine below is an IBM PC XT (Model 5160) with a 4.77Mhz 8088, 640K of memory, a Color Display, two diskette drives, and a 10Mb hard disk, plus a serial mouse on COM2. It boots the BASICDOS-360K-S80 diskette and runs PAINT.BAS. Click the screen to capture the mouse, and hold the left button down to draw; press Esc twice to exit. Since the machine has a hard disk, the boot sector first displays Press a key to start...; press any key (or wait 5 seconds) to boot from the diskette, or press Esc to boot from the hard disk instead.
This demo is also available on an IBM PC, an IBM PC AT, and a COMPAQ DeskPro 386.
These machines have a serial mouse on COM2, which the MOUSE$ driver finds at boot. They boot the BASICDOS-360K-S80 diskette and run PAINT.BAS, which switches the display to SCREEN 2 (640x200) and turns the mouse on with MOUSE ON.
The screen has a banner at the top and a status line at the bottom, and everything between the two lines is a black canvas. Click the screen to capture the mouse, then hold the left button down to draw with white pixels. The mouse’s X,Y position is always displayed in the lower left corner.
To exit, press Esc once to release the mouse, and then press Esc again to end the program; BASIC-DOS restores the original display mode. Type PAINT to run it again.
PAINT.BAS reads the current mouse position and buttons with MOUSE(3), MOUSE(4), and MOUSE(5), and while the left button is down, it draws a line from the previous position to the current one, so that fast mouse movements leave no gaps. It updates the position display only when the mouse moves.
10 REM PAINT.BAS: scribble with the mouse in SCREEN 2 (640x200)
20 REM Hold the left button down to draw, and press ESC to exit
30 DEFINT A-Z:SCREEN 2:MOUSE ON:PX=-1:LX=-1
40 LOCATE 1,29:PRINT "Welcome BASIC-DOS Paint";
50 LINE (0,8)-(639,8):LINE (0,191)-(639,191)
60 X=MOUSE(3):Y=MOUSE(4):B=MOUSE(5)
70 IF X<>LX OR Y<>LY THEN LOCATE 25,1:PRINT MID$(STR$(X),2);",";MID$(STR$(Y),2);" ";:LX=X:LY=Y
80 IF (B AND 1)=0 OR Y<9 OR Y>190 THEN PX=-1:GOTO 110
90 IF PX<0 THEN PSET (X,Y) ELSE LINE (PX,PY)-(X,Y)
100 PX=X:PY=Y
110 IF INKEY$<>CHR$(27) THEN 60
Copyright (c) 2020-2026 Jeff Parsons Released under MIT License