MODULE››; Tumble 1.0›; Copyright (c) 1985 by Dan Rhea›; Program is in the public domain››; This program uses graphics modes 3›; 5 7 9 10 11 and 15 (users choice) ›; to create a "tumbling" line effect›; The program is at›; most an intresting demo and at the›; very least entertaining for a few›; moments.››DEFINE YES="1", ; Logical true› NO ="0" ; Logical false››INT ARRAY xmax=[0 39 79 159 79 79 79 159],› xmin=[0 0 0 0 0 0 0 0],› ymax=[0 23 47 95 191 191 191 191],› ymin=[0 0 0 0 0 0 0 0],› cmax=[0 4 4 4 16 9 16 4]››INT x1, ; x coord 1› x2, ; x coord 2› x, ; temp x› y1, ; y coord 1› y2, ; y coord 2› y, ; temp y› sx, ; temp stx› sy, ; temp sty› max ; temp max ››CARD cx1, ; card x coord 1› cx2, ; card x coord 2› i ; temp››BYTE mode, ; GR. mode 3 5 7 9 10 11 15› dir1, ; direction 1› dir2, ; direction 2› stx1, ; movement factor x1› stx2, ; movement factor x2› sty1, ; movement factor y1› sty2, ; movement factor y2› new, ; if YES reset› lc, ; last color› d, ; temp dirc› by1, ; byte y coord 1› by2, ; byte y coord 2› glue, ; if YES coords connect› t ; temp› ›CHAR a ; Y/N inputs››PROC Setup ()››; Get run parameters or id START key›; is pressed re-start with current›; parameters›› IF PeekC (53279)<>6 THEN› Graphics (0) ; clear screen››; Get Graphics mode›› DO› Position (2,1) › PrintE ("Tumble 1.0 by Dan Rhea 10/22/85")› PrintE (" ")› PrintE ("1 - Use Graphics mode 3")› PrintE ("2 - Use Graphics mode 5")› PrintE ("3 - Use Graphics mode 7")› PrintE ("4 - Use Graphics mode 9 (GTIA only)")› PrintE ("5 - Use Graphics mode 10 (GTIA only)")› PrintE ("6 - Use Graphics mode 11 (GTIA only)")› PrintE ("7 - Use Graphics mode 15 (xl/xe only)")› PrintE (" ")› PrintE ("Note: ÏÐÔÉÏÎ for this menu")› PrintE (" ÓÅÌÅÃÔ to freeze display")› PrintE (" ÓÔÁÒÔ to re-start drawing") › PrintE (" ")› Print ("Select:")› mode = InputB()› UNTIL mode < 8 AND mode > 0› OD››; See if next pattern starts where›; the last one left off› › glue=99› DO› Position (2,17)› Print ("Connected Segments? (Y/N):")› a = GetD(0)› IF a='Y THEN› glue=YES› ELSEIF a='y THEN› glue=YES› ELSEIF a='N THEN› glue=NO› ELSEIF a='n THEN› glue=NO› ELSE› glue=99› FI› UNTIL glue<>99› OD› FI››; Set up basic run parameters›› x1=Rand(xmax(mode)+1) ; Start x 1› x2=Rand(xmax(mode)+1) ; Start x 2› y1=Rand(ymax(mode)+1) ; Start y 1› y2=Rand(ymax(mode)+1) ; Start y 2› new=NO ; Use inital values› lc=0 ; Set "last" color››; Set up Graphics mode required› › IF mode=1 THEN› Graphics (3+16)› ELSEIF mode=2 THEN› Graphics (5+16)› ELSEIF mode=3 THEN› Graphics (7+16)› ELSEIF mode=4 THEN› Graphics (9) › ELSEIF mode=5 THEN› Graphics (10)› t=$00 Poke(704,t) ;Black (back)› t=$33 Poke(705,t) ;Dark Red› t=$28 Poke(706,t) ;Orange› t=$58 Poke(707,t) ;Purple› t=$74 Poke(708,t) ;Dark Blue› t=$7A Poke(709,t) ;Light Blue› t=$C5 Poke(710,t) ;Green› t=$DA Poke(711,t) ;Almost Yellow› t=$0F Poke(712,t) ;White›; || +------>Color regs›; |+------------->Luminance›; +-------------->Color › ELSEIF mode=6 THEN› Graphics (11) › Setcolor (8,0,0)› ELSEIF mode=7 THEN› Graphics (15+16)› ELSE › Setup()› FI››RETURN››PROC Move ()››; Move the x and y coordinates in the›; desired direction and apply the ›; applicable step value› › IF d=1 THEN ; ne› x=x+sx› y=y-sy› ELSEIF d=2 THEN ; e› x=x+sx› ELSEIF d=3 THEN ; se› x=x+sx› y=y+sy› ELSEIF d=4 THEN ; s› y=y+sy› ELSEIF d=5 THEN ; sw› x=x-sx› y=y+sy› ELSEIF d=6 THEN ; w› x=x-sx› ELSEIF d=7 THEN ; nw› x=x-sx› y=y-sy› ELSEIF d=8 THEN ; n› y=y-sy› ELSE ; nowhere› x=x› y=y› FI› ›RETURN ››PROC Clamp ()››; Make sure we don't try to plot off›; the edge of the screen (this is ›; also why most xy stuff is INT, we›; need to be able to detect negative›; values› › IF xxmax(mode) THEN› x=xmax(mode)› new=YES› FI ›› IF yymax(mode) THEN› y=ymax(mode)› new=YES› FI››RETURN› ›PROC Main()››; Run forever› ›DO› ›; Initialize›› Setup ()› DO ››; Set current color›› DO› color=Rand(cmax(mode))› UNTIL color<>lc› OD› ›; Set last color, directions and›; x y coords if needed›› lc=color › dir1=Rand(8)+1› dir2=Rand(8)+1› IF glue=NO THEN› x1=Rand(xmax(mode)+1)› x2=Rand(xmax(mode)+1)› y1=Rand(ymax(mode)+1)› y2=Rand(ymax(mode)+1)› FI› ›; Set stepping values for each›; coordinate point›› DO› t=0› stx1=Rand(4)› stx2=Rand(4)› sty1=Rand(4)› sty2=Rand(4)› t=stx1+stx2+sty1+sty2› UNTIL t<>0› OD››; Set maximum loop value›› IF xmax(mode) > ymax(mode) THEN› max=Rand(xmax(mode)+1)+1› ELSE› max=Rand(ymax(mode)+1)+1› FI › PokeC (77,1) ; No attract mode››; Loop till max expires, we detect›; a START or OPTION, or we hit the›; edge of the screen›› FOR i=0 TO max› DO ››; Move each coordinate› › x=x1 y=y1› d=dir1› sx=stx1 sy=sty1› Move () ; move set 1› x1=x y1=y›› x=x2 y=y2› d=dir2› sx=stx2 sy=sty2› Move () ; move set 2› x2=x y2=y››; Check edge of screen› › x=x1 y=y1› Clamp () ; clamp coord› x1=x y1=y› › x=x2 y=y2› Clamp () ; clamp coord› x2=x y2=y››; Plot the suckers› › cx1=x1 by1=y1 cx2=x2 by2=y2›› Plot (cx1,by1)› DrawTo (cx2,by2)››; Check for START or OPTION›› IF PeekC(53279)=3 THEN› EXIT› ELSEIF PeekC(53279)=6 THEN› EXIT› ELSEIF PeekC(53279)=5 THEN› DO› UNTIL PeekC(53279)<>5› OD› FI› ›; See if we're up against the›; wall›› IF new=YES THEN› EXIT› FI› OD› new=NO› UNTIL PeekC(53279)=3 OR PeekC(53279)=6› OD›OD›````````````````````````````````