auto ?Circle_End-Circle\ lea.l Chunky,a0 moveq.l #110,d0 moveq.l #120,d1 moveq.l #100,d2 moveq.l #42,d3 Circle: ; Contribution to the #amycoders fastest and shortest ; circledrawing-compo by Blueberry of Efreet. ; It's optimized for speed, but I had no brilliant ideas of ; how to make a short one, so it takes part in both compos. ; A0 = Screen ; D0 = X ; D1 = Y ; D2 = Radius ; D3 = Color .lscrw = 8 ; log2(ScreenWidth) lsl.l #.lscrw,d1 add.l d0,d1 add.l d1,a0 ; Center move.l d2,d0 ; Nice rounding (r = d2+0.5) move.l d2,d1 move.l d2,d4 lsl.l #.lscrw,d2 move.l a0,a2 move.l a0,a4 sub.l d2,a2 ; Top add.l d2,a4 ; Bottom lea.l 1(a2),a3 lea.l 1(a4),a5 sub.l d4,a0 ; Left edge add.l d4,d4 ; Right-Left = 2r move.l a0,a1 add.l d1,d1 addq.l #1,d1 ; r2-(r-1)2+2 = 2r+1 moveq.l #-1,d2 ; 12-02-2 = -1 moveq.l #1,d6 lsl.l #.lscrw,d6 .loop: move.b d3,(a0) ; Upper left move.b d3,(a0,d4.l) ; Upper right move.b d3,(a1) ; Lower left move.b d3,(a1,d4.l) ; Lower right move.b d3,(a2)+ ; Right top sub.l d6,a0 move.b d3,-(a3) ; Left top addq.l #2,d2 move.b d3,(a4)+ ; Right bottom add.l d6,a1 move.b d3,-(a5) ; Left bottom sub.l d2,d0 ; r2-x2-y2 bgt.b .loop ; Loop if r2 < x2+y2 addq.l #1,a0 subq.l #2,d1 addq.l #1,a1 add.l d1,d0 ; Decrese x subq.l #2,d4 add.l d6,a2 add.l d6,a3 sub.l d6,a4 sub.l d6,a5 cmp.l a1,a5 ; Lower left passed Left bottom? bge.b .loop rts Circle_End: Chunky: dcb.b 256*256 .