machine 68020 ;Optimize for 020 * I hope you can cope with this :) * Size of routine: 72-80 bytes * (or 74 if I remove 2 instructions but get less * accuracy. Set the REMASL to 1 to enable it. If * it's allowed, PLEASE use that routine. If it isn't, * leave the REMASL untouched. With no asl's within the * calculation, it wraps in x when size is larger than * 125.) * CORRECTION adjusts the offsets so that radius 127 doesn't * get outside the buffer. Set this to zero if not needed. * Also choose of which of the ACCURACY modes you think * fits best. With ACCURACY disabled the routine will become * 2 bytes smaller (76/72). * Speed: On my 030/50 I can render approx. 7100 random * circles per second. * // ChiP ^ PowerLine FASTEST = 0 CLEAR = 1 REMASL = 0 ACCURACY = 1 CORRECTION = 1 prg_DrawCircle *** CUT HERE * d0.l/d1.l - x/y * d2.l - radius (1-n(?)) * d3.b - color * a0 - cbuffer * set initial positions add.l d0,a0 ;2 asl.l #8,d1 ;6 add.l d1,a0 ;2 moveq.l #0,d4 ;2 move.l d2,d5 ;2 moveq.l #1,d6 ;2 IFNE ACCURACY asl.l #1,d2 ;6 ENDIF sub.l d2,d6 ;2 .CircleLoop * calculate and set pixel position move.l a0,a1 ;2 move.l d5,d7 ;2 asl.l #8,d7 ;6 sub.l d7,a1 ;2 move.l a1,a2 ;2 sub.l d4,a1 ;2 add.l d4,a2 ;2 * plot chunky pixels IFNE CORRECTION move.b d3,(1,a1) ;4 move.b d3,(a2) ;4 move.b d3,(1,a1,d7*2) ;9 move.b d3,(a2,d7*2) ;9 ELSE move.b d3,(a1) ;4 move.b d3,(a2) ;4 move.b d3,(a1,d7*2) ;9 move.b d3,(a2,d7*2) ;9 ENDIF * calculate new positions move.l d5,d7 ;2 add.l d6,d7 ;2 bmi.s .nofix_y ;8/4 subq.l #1,d5 ;2 bmi.s .EndCircleLoop ;8/4 move.l d5,d7 ;2 IFEQ REMASL asl.l #2,d7 ;6 ENDIF sub.l d7,d6 ;2 subq.l #1,d6 ;2 .nofix_y move.l d4,d7 ;2 sub.l d6,d7 ;2 bmi.s .nofix_x ;8/4 addq.l #1,d4 ;2 move.l d4,d7 ;2 IFEQ REMASL asl.l #2,d7 ;6 ENDIF add.l d7,d6 ;2 subq.l #1,d6 ;2 .nofix_x bra.s .CircleLoop ;8 .EndCircleLoop *** CUT HERE rts ;11 .