LOWTEST.BAS

10 DEFINT A-Z
20 ON ERROR GOTO 690
30 A=0:B=0:X=0:Y=0:XY=0:LX=0:LY=0:LXY=0:SV=0:KOLOR=15:I=0:J=0
40 H=0:V=0:LDRAW=0:C$=""
50 PRINT "LOWTEST- Low resolution demo":PRINT
60 PRINT " This program demonstrates low resolution graphics as described"
70 PRINT "by Sid Nolte of the North Texas users group.":PRINT
80 PRINT " A white square serves as the cursor and can be moved using the"
90 PRINT "arrow keys. The number keys 0-7 choose the active color. The 9 key"
100 PRINT "toggles the number keys to represent colors 0-7 or 8-15. The D key"
110 PRINT "toggles between drawing and not drawing.":PRINT
120 PRINT " The S key will save the drawing currently on the screen to a "
130 PRINT "file called lowtest.pic. The L key will load this file back.":PRINT
140 PRINT " If you are using a screen saver routine the program may not"
150 PRINT "disable the blink bit when you return to the screen. The 8 key will"
160 PRINT "send the command to disable the blink bit.":PRINT
170 PRINT " This program leaves much to be desired however it demonstrates"
180 PRINT "16 color low resolution on the PC. The technique is described in"
190 PRINT "detail in the March '85 issue of EXCHANGE.":PRINT
200 PRINT "Press any key to begin drawing in low resolution (160x100)..."
210 PRINT "Use the Esc key to end the program or abort now."
220 C$=INPUT$(1):IF C$=CHR$(27) THEN 690
230 WIDTH "SCRN:",80
240 SCREEN 0,1,0,0
250 OUT &H3D8,9
260 DEF SEG=&HB800
270 FOR I=0 TO 16000 STEP 2
280 POKE I,222:POKE I+1,0
290 NEXT I
300 OUT &H3D4,4:OUT &H3D5,124
310 OUT &H3D4,6:OUT &H3D5,100
320 OUT &H3D4,7:OUT &H3D5,112
330 OUT &H3D4,9:OUT &H3D5,1
340 X=1:Y=0:LXY=1:SV=0:GOTO 620
350 C$="":WHILE C$="":C$=INKEY$:WEND
360 IF C$=CHR$(0)+"H" THEN Y=Y-1:IF Y<0 THEN Y=0
370 IF C$=CHR$(0)+"P" THEN Y=Y+1:IF Y>99 THEN Y=99
380 IF C$=CHR$(0)+"M" THEN X=X+1:IF X>160 THEN X=160
390 IF C$=CHR$(0)+"K" THEN X=X-1:IF X<1 THEN X=1
400 IF C$="9" THEN 480
410 IF C$="8" THEN 740
420 IF C$="S" OR C$="s" THEN 700
430 IF C$="L" OR C$="l" THEN 720
440 IF C$="D" OR C$="d" THEN 500
450 IF C$=CHR$(27) THEN 690
460 IF C$>=CHR$(48) AND C$ 470 GOTO 550
480 IF PALLET=0 THEN PALLET=1 ELSE PALLET=0
490 GOTO 350
500 IF LDRAW=0 THEN LDRAW=1 ELSE LDRAW=0
510 GOTO 350
520 KOLOR=ASC(C$)-48
530 IF PALLET=1 THEN KOLOR=KOLOR+8
540 GOTO 350
550 POKE LXY,SV
560 IF LDRAW=0 THEN 620
570 V=Y*160+1:IF X MOD 2=0 THEN H=X-2 ELSE H=X-1
580 XY=V+H:A=PEEK(XY):LX=X:LXY=XY
590 IF X MOD 2=0 THEN 610
600 B=A AND &HF:SV=B OR KOLOR*16:GOTO 670
610 B=A AND &HF0:SV=B OR KOLOR:GOTO 680
620 REM Just move white cursor
630 REM
640 V=Y*160+1:IF X MOD 2=0 THEN H=X-2 ELSE H=X-1
650 XY=V+H:A=PEEK(XY):LX=X:LXY=XY:SV=A
660 IF X MOD 2=0 THEN 680
670 B=A AND &HF:POKE XY,B OR 15*16:GOTO 350
680 B=A AND &HF0:POKE XY,B OR 15:GOTO 350
690 SCREEN 2:SCREEN 0:END
700 BSAVE "LOWTEST.PIC",0,&H4000
710 GOTO 330
720 BLOAD "LOWTEST.PIC",0
730 GOTO 330
740 OUT &H3D8,9:GOTO 330