'Program: Swirly 'Author: Jesse Regier aka... ' ' É͸ Ö· Ö ·Ö ɸ ' ÈÍ» ºº º ºº È» ' ÖÄÄĺÄӽĽÄÓ½ÄÔ¼Ä ' ÈÍÍͼ ' 'E-mail: s_o_l_u_s@hotmail.com 'ICQ: 37962076 'Website: Darkle - http://homepage.usask.ca/jlr353/ ' 'Notes: This is what happens when a second year ' computer science student gets sick of programming ' bullshit assignments again and again... ' The code isn't really optimized, not fully at least ' I took advantage of fixed point integer math for trig ' but wasted a lot of cycles in the main loop (ie. a circle ' is mirrored top to bottom, left to right, etc. but I ' ignored that fact out of laziness) ' ' The program attempts to load ffix.com, which fixes ' microsoft's floating point bug, making all floating point ' operations considerably faster. Cheers to v1ctor for ffix! ' CONST cx = 159 CONST cy = 99 CONST radius = 79 revstep! = .1 '$DYNAMIC DEFINT A-Z DIM buffer(32001) DIM sine(-256 TO 256) DIM cosine(-256 TO 256) SHELL "ffix" FOR i = -256 TO 256 sine(i) = SIN(i / 40.76) * 256 cosine(i) = COS(i / 40.76) * 256 NEXT SCREEN 13 FOR x = 0 TO 319 FOR y = 0 TO 199 PSET (x, y), (y - x) NEXT NEXT GET (0, 0)-(319, 199), buffer(0) DEF SEG = VARSEG(buffer(0)) time# = TIMER DO f& = f& + 1 rev! = rev! + revstep! IF ABS(rev!) >= 1 THEN revstep! = -revstep! FOR y = -radius TO radius FOR x = -radius TO radius d = SQR(x * x + y * y) IF d <= radius THEN 'original floating point routines '============================================== 'rad! = 6.28 * rev! * ((radius - d) / (radius)) 's! = SIN(rad!) 'c! = COS(rad!) 'sx = x * c! - y * s! 'sy = x * s! + y * c! 'equivalent fixed point routines (little messier 'than the floating point ones) '============================================== rad = 256 * rev! * ((radius - d) / (radius)) s = sine(rad) c = cosine(rad) sx = (x * c - y * s) \ 256 sy = (x * s + y * c) \ 256 c = PEEK(4& + cx + sx + 320& * (cy + sy)) 'could have just done this instead but I used to 'have an actual image so I used the above '============================================== 'c = (cy + sy) - (cx + sx) PSET (cx + x, cy + y), c END IF NEXT NEXT LOOP UNTIL INKEY$ <> "" time# = TIMER - time# PRINT f& / time# SLEEP SHELL "ffix /u"