10 REM
20 REM  AUTHOR - JIM BRACKING
30 REM  DATE   - 11/27/83
40 REM  DISCRIPTION  -  SELECT A FOREGROUND,BACKGROUNG AND BORDER COLOR
50 REM                  AND CREATE A DEBUG SCRIPT FOR MODIFING THE "CLS"
60 REM                  COMMAND IN COMMAND.COM TO USE THESE COLORS.
70 REM
80 FOR I=0 TO 3:SCREEN 0,,I,I:CLS:NEXT I
90 KEY OFF:FOR I=1 TO 10
100 KEY I,""
110 NEXT I
120 SCREEN 0,,2,2:COLOR 7,0,0:CLS:KEY OFF
130 COLOR 7,0,0
140 CLS
150 DIM CTBL$(16)
160 CTBL$(0)="BLACK "
170 CTBL$(1)="BLUE  "
180 CTBL$(2)="GREEN "
190 CTBL$(3)="CYAN  "
200 CTBL$(4)="RED   "
210 CTBL$(5)="PURPLE"
220 CTBL$(6)="BROWN "
230 CTBL$(7)="WHITE "
240 CTBL$(8)="GRAY  "
250 CTBL$(9)="LT BLU"
260 CTBL$(10)="LT GRN"
270 CTBL$(11)="L CYAN"
280 CTBL$(12)="LT RED"
290 CTBL$(13)="VIOLET"
300 CTBL$(14)="YELLOW"
310 CTBL$(15)="HI WTE"
320  TITLE$="C O L O R    S E L E C T I O N"
330 ROW=1:GOSUB 1630
340 TITLE$="BACKGROUND COLOR"
350 ROW=3:GOSUB 1630
360 COL=12
370 FOR BG=0 TO 7
380 LOCATE 4,COL+1
390 IF BG=0 THEN COLOR 15 ELSE COLOR BG
400 PRINT CTBL$(BG);
410 COL=COL+8
420 NEXT BG
430 ROW=6:COL=1:TITLE$="FOREGROUND COLOR"
440 GOSUB 1750
450 FOR FG=0 TO 15
460 ROW=FG+6:COL=4
470 LOCATE ROW,COL
480 C=FG:IF C=0 THEN C=15
490 COLOR C,0
500 PRINT CTBL$(FG);
510 COL=COL+8
520 FOR BG=0 TO 7
530 C=BG
540 LOCATE ROW,COL
550 COLOR FG,BG
560 PRINT CTBL$(FG);
570 COL=COL+8
580 NEXT BG
590 NEXT FG
600 COLOR ,,0
610 COLOR 7,0,0:LOCATE 23,27
620 PRINT "PRESS THE F1 KEY FOR HELP"
630 SCREEN 0,,1,2:COLOR 7,0,0:CLS:KEY OFF
640 LOCATE 2,10:PRINT "FROM THE MAIN SCREEN"
650 LOCATE 3,18:PRINT "      F1    -  HELP SCREEN"
660 LOCATE 4,18:PRINT "      F10   -  CREATE DEBUG UPDATE FILE USING THE"
670 LOCATE 5,18:PRINT "               CURRENT COLORS AND EXIT"
680 LOCATE 6,18:PRINT "      PGUP  -  INCREMENT THE BORDER COLOR"
690 LOCATE 7,18:PRINT "      PGDN  -  DECREMENT THE BORDER COLOR"
700 LOCATE 8,18:PRINT "      ENTER -  WILL DISPLAY A SAMPLE SCREEN WITH"
710 LOCATE 9,18:PRINT "               THE SELECTED COLORS"
720 LOCATE 11,10:PRINT "FROM THE TEXT SCREEN"
730 LOCATE 12,18:PRINT "      ESC   -  RETURN TO MAIN SCREEN"
740 LOCATE 13,18:PRINT "      PGDN  -  INCREMENT THE BORDER COLOR"
750 LOCATE 14,18:PRINT "      PGDN  -  DECREMENT THE BORDER COLOR"
760 LOCATE 16,10:PRINT "FROM THE HELP SCREEN"
770 LOCATE 17,18:PRINT "      ESC   -  RETURN TO MAIN SCREEN"
780 SCREEN 0,,2,2
790 RPOS=0:CPOS=0:LOCATE RPOS+6,(CPOS*8)+11,1:BD=0
800 LOCATE ,,1,6,8
810 GOTO 1070
820 XKEY$=INKEY$:IF XKEY$="" THEN GOTO 820
830 IF ASC(XKEY$)=13 THEN GOTO 1170
840 IF LEN(XKEY$)<>2 THEN GOTO 930  'BAD KEY
850 IF ASC(MID$(XKEY$,2,1))=59 THEN GOTO 940
860 IF ASC(MID$(XKEY$,2,1))=68 THEN GOTO 1500
870  IF ASC(MID$(XKEY$,2,1))=73 THEN GOTO 1030
880  IF ASC(MID$(XKEY$,2,1))=81 THEN GOTO 1050
890 IF ASC(MID$(XKEY$,2,1))=72 THEN GOTO 980
900 IF ASC(MID$(XKEY$,2,1))=80 THEN GOTO 990
910 IF ASC(MID$(XKEY$,2,1))=75 THEN GOTO 1000
920 IF ASC(MID$(XKEY$,2,1))=77 THEN GOTO 1010
930 SOUND 100,6:GOTO 820
940 LOCATE ,,0:SCREEN 0,,1,1
950 XKEY$=INKEY$:IF XKEY$="" THEN GOTO 950
960 IF ASC(XKEY$)<>27 THEN GOTO 950
970 SCREEN 0,,2,2:GOTO 1070
980 IF RPOS=0 THEN GOTO 930 ELSE RPOS=RPOS-1:GOTO 1070
990 IF RPOS=15   THEN GOTO 930 ELSE RPOS=RPOS+1:GOTO 1070
1000 IF CPOS=0 THEN GOTO 930 ELSE CPOS=CPOS-1:GOTO 1070
1010 IF CPOS=7 THEN GOTO 930 ELSE CPOS=CPOS+1:GOTO 1070
1020 LOCATE RPOS+6,(CPOS*8)+11,1:GOTO 820
1030 BD=BD+1:IF BD>15 THEN BD=0
1040 COLOR ,,BD:GOTO 1070
1050 BD=BD-1:IF BD<0 THEN BD=15
1060 COLOR ,,BD
1070 CBD=BD:CFG=RPOS:CBG=CPOS
1080 LOCATE 25,33:COLOR 15,0
1090 PRINT "COLOR ";
1100 IF CFG<10 THEN PRINT USING "#";CFG; ELSE PRINT USING "##";CFG;
1110 PRINT ",";
1120 IF CBG<10 THEN PRINT USING "#";CBG; ELSE PRINT USING "##";CBG;
1130 PRINT ",";
1140 IF CBD<10 THEN PRINT USING "#";CBD; ELSE PRINT USING "##";CBD;
1150 PRINT "  ";
1160 GOTO 1020
1170 SCREEN 0,,3,3
1180 COLOR CFG,CBG,CBD:CLS
1190 LOCATE 1,1
1200 PRINT "                   ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1210 PRINT "                   abcdefghijklmnopqrstuvwxyz"
1220 PRINT "                   0123456789!@#$%^&*()_+}{:~"
1230 PRINT "                          \,./;'`[]-="
1240 PRINT "       NOW YOU CAN ENTER SOMETHING. PRESS THE ESCAPE KEY TO RETURN"
1250 LOCATE 25,33
1260 PRINT "COLOR ";
1270 IF CFG<10 THEN PRINT USING "#";CFG; ELSE PRINT USING "##";CFG;
1280 PRINT ",";
1290 IF CBG<10 THEN PRINT USING "#";CBG; ELSE PRINT USING "##";CBG;
1300 PRINT ",";
1310 IF CBD<10 THEN PRINT USING "#";CBD; ELSE PRINT USING "##";CBD;
1320 PRINT "  ";
1330 XXROW=7:XXCOL=1:LOCATE XXROW,XXCOL,1,6,7
1340 XKEY$=INKEY$:IF XKEY$="" THEN GOTO 1340
1350 IF LEN(XKEY$)<>2 THEN GOTO 1380
1360 IF ASC(MID$(XKEY$,2,1))=73 THEN GOTO 1460
1370 IF ASC(MID$(XKEY$,2,1))=81 THEN GOTO 1480
1380 IF ASC(XKEY$)=13 THEN XXCOL=1:GOTO 1430
1390 IF ASC(XKEY$)=27 THEN SCREEN 0,,2,2:LOCATE ,,1,6,8:GOTO 1020
1400 PRINT XKEY$;
1410 XXCOL=XXCOL+1
1420 IF XXCOL>80 THEN XXCOL=1 ELSE GOTO 1340
1430 XXROW=XXROW+1
1440 IF XXROW<24 THEN LOCATE XXROW,XXCOL,1:GOTO 1340
1450 PRINT " ":XXROW=24:XXCOL=1:GOTO 1340
1460 BD=BD+1:IF BD>15 THEN BD=0
1470 CBD=BD:COLOR ,,CBD:GOTO 1250
1480 BD=BD-1:IF BD<0 THEN BD=15
1490 CBD=BD:COLOR ,,CBD:GOTO 1250
1500 OPEN "DEBUG.TXT" FOR OUTPUT AS #1
1510 PRINT #1,"A 2331"
1520 PRINT #1,"MOV AL,";HEX$(CBD)
1530 PRINT #1,"MOV DX,03D9"
1540 PRINT #1,"OUT DX,AL"
1550 PRINT #1,""
1560 PRINT #1,"A 2345"
1570 PRINT #1,"MOV BH,";HEX$((CBG*16)+CFG)
1580 PRINT #1,""
1590 PRINT #1,"W"
1600 PRINT #1,"Q"
1610 CLOSE #1
1620 SCREEN 0,,0,0:COLOR 7,0,0:CLS:LOCATE ,,1,6,7:SYSTEM
1630 L=LEN(TITLE$)
1640 COL=(80-L)/2:C=1
1650 FOR II=1 TO L
1660 LOCATE ROW,COL
1670 IF MID$(TITLE$,II,1)=" " THEN GOTO 1720
1680 COLOR C
1690 PRINT MID$(TITLE$,II,1);
1700 C=C+1:IF C=16 THEN C=1
1710 IF C=8 THEN C=9
1720 COL=COL+1
1730 NEXT II
1740 RETURN
1750 L=LEN(TITLE$)
1760 FOR II=1 TO L
1770 LOCATE ROW,COL
1780 IF MID$(TITLE$,II,1)=" " THEN GOTO 1830
1790 COLOR C
1800 PRINT MID$(TITLE$,II,1);
1810 C=C+1:IF C=16 THEN C=1
1820 IF C=8 THEN C=9
1830 ROW=ROW+1
1840 NEXT II
1850 RETURN