'=========================================================================== ' Subject: REAL-TIME COLOUR-MIX-COPPER Date: 06-12-96 (10:56) ' Author: The ABC Programmer Code: QB, QBasic, PDS ' Origin: Convert from PASCAL Code Packet: GRAPHICS.ABC '=========================================================================== '===================================================================== ' Real-time color-mix-copper ' by Bas van Gaalen, Holland, PD ' ' Converted to BASIC by William Yu (06-12-96) ' Compile for best performace. '--------------------------------------------------------------------- DEFINT A-Z DECLARE SUB CreateTab () DECLARE SUB MoveBars () DECLARE SUB CopperBars () CONST Size = 300 CONST Steps = 25 CONST Bars = 3 CONST Pi = 3.14 DIM SHARED Pal(0 TO 3 * Size - 1) AS INTEGER DIM SHARED Stab(0 TO 255) AS INTEGER DIM SHARED BarTab(0 TO Bars - 1) AS INTEGER FOR I = 0 TO Bars - 1: BarTab(I) = Steps * I: NEXT I CreateTab DO MoveBars CopperBars LOOP UNTIL INKEY$ <> "" END SUB CopperBars WAIT &H3DA, 8 ' Wait for vertical retrace cc = 0 FOR l = 0 TO Size - 1 OUT &H3C8, 0 OUT &H3C9, Pal(cc) OUT &H3C9, Pal(cc + 1) 'WAIT &H3DA, 1 ' Uncomment this to make bigger copper bars ' Compile with this uncommented OUT &H3C9, Pal(cc + 2) cc = cc + 3 NEXT l END SUB SUB CreateTab FOR I = 0 TO 255 Stab(I) = INT(SIN(2 * Pi * I / 255) * 86) + 86 NEXT I END SUB SUB MoveBars FOR N = 0 TO Bars - 1 FOR I = 0 TO 63 'Pal(N MOD 3 + 3 * Stab(BarTab(N)) + 3 * I) = I A = N MOD 3 B = 3 * Stab(BarTab(N)) Pal(A + B + (3 * I)) = I NEXT I FOR I = 0 TO 63 'Pal(N MOD 3 + 3 * Stab(BarTab(N)) + 3 * 64 + 3 * I) = 63 - I A = N MOD 3 B = 3 * Stab(BarTab(N)) Pal(A + B + (3 * 64) + (3 * I)) = 63 - I NEXT I BarTab(N) = 1 + BarTab(N) MOD 255 NEXT N END SUB