ON ERROR GOTO ETrap 'set an error trap SCREEN 12 'set the screen mode PALETTE 1, 0 'assign black to color attribute #1 to use as the default w% = 100: x% = 50 'set the viewport boundry coordinate var's y% = 540: z% = 300 VIEW SCREEN (w%, x%)-(y%, z%), 0, 15 'define a viewport w/ border LINE (w%, x%)-(y%, z%), 1, BF 'draw a box, fill w/ color 1 COLOR 15 'put options on the screen LOCATE 3, 14: PRINT "PALETTE VALUE:" LOCATE 21, 14: PRINT "R = More red Red intensity:" LOCATE 22, 14: PRINT "r = Less red" LOCATE 24, 14: PRINT "G = More green Green intensity:" LOCATE 25, 14: PRINT "g = Less green" LOCATE 27, 14: PRINT "B = More blue Blue intensity:" LOCATE 28, 14: PRINT "b = Less blue" LOCATE 30, 35: PRINT "Esc = Quit"; DO 'loop here and update the palette and data w/ each key hit a& = (65536 * blue%) + (256 * green%) + red% 'calc the new palette PALETTE 1, a& 'display the new palette LOCATE 3, 28: PRINT a&; " " 'update the screen data LOCATE 21, 65: PRINT red% LOCATE 24, 65: PRINT green% LOCATE 27, 65: PRINT blue% DO: k$ = INKEY$ 'wait for a user key LOOP WHILE k$ = "" SELECT CASE k$ 'process the key CASE "R" IF red% < 63 THEN 'increment red intensity red% = red% + 1 ELSE SOUND 200, .1 END IF CASE "r" IF red% > 0 THEN 'decrement red intensity red% = red% - 1 ELSE SOUND 200, .1 END IF CASE "G" IF green% < 63 THEN 'increment green intensity green% = green% + 1 ELSE SOUND 200, .1 END IF CASE "g" IF green% > 0 THEN 'decrement green intensity green% = green% - 1 ELSE SOUND 200, .1 END IF CASE "B" IF blue% < 63 THEN 'increment blue intensity blue% = blue% + 1 ELSE SOUND 200, .1 END IF CASE "b" IF blue% > 0 THEN 'decrement blue intensity blue% = blue% - 1 ELSE SOUND 200, .1 END IF CASE CHR$(27) CASE ELSE SOUND 200, .1 END SELECT LOOP UNTIL k$ = CHR$(27) 'exit if escape is hit VIEW 'close the viewport CLS PALETTE 'reset the palette to default SCREEN 0 'print the final palette data PRINT "FINAL PALETTE VALUE :"; a& PRINT "RED INTENSITY :"; red% PRINT "GREEN INTENSITY :"; green% PRINT "BLUE INTENSITY :"; blue% Done: END ETrap: CLS 'display the error code and exit program PRINT "BASIC RUNTIME ERROR #"; ERR RESUME Done