********************************************************************* * * Your init code comes here. * ********************************************************************* _initcode a b rts ********************************************************************* * * Your line routine. * Every time you are given: A0.L : Chunky Screen (256x256x8) * * d0.l/d1.l x/y * d2.l radius * d3.b color * * other registers are in undefined state !! * you may trash all regs except a7 * ********************************************************************* _circle c ;**************************************************************************** ;** ;* Size-optimized chunky circledraw routine ;* ;* This is one of my contributions to #amycoders circledrawing-compo. This ;* routine will participate in size-optimizing competition. This code works ;* with all 0x0 processors, with any cache setup. ;* ;* This is a simple algorithm interpolating all points of chunkybuffer. ;* Does two muls & one divu per chunkybuffer pixel -> slooow. ;* ;* Code size without rts: 38 bytes. ;* Average time (dec): slow:) (030@59.220MHz) ;* ;* Coded by Harry "Piru" Sintonen . ;* This code is copyright C 1997 by Harry Sintonen, and was written 24th- ;* 11th october 1997. ;* ;**************************************************************************** ;* ; IN: d0.l=xc, d1.l=yc, d2.l=radius, d3.b=color ; a0=chunky buffer (256x256x8) ; OUT: circle :) d2/d4-d5/d7 trashed moveq #0,d7 2 init loop counter, also y:x 24:8 .loop moveq #0,d4 2 clear x move.l d7,d5 2 move.b d7,d4 2 x=offs & $00ff lsr.w #8,d5 2 y=offs>>8 sub.w d0,d4 2 x=x-xc sub.w d1,d5 2 y=y-yc muls.w d4,d4 2 x^2 muls.w d5,d5 2 y^2 add.l d5,d4 2 x^2+y^2 divu.w d2,d4 2 (x^2+y^2)/r sub.w d2,d4 2 (x^2+y^2)/r-r bgt.b .nopix 2 (x^2+y^2)/r-r>0 ? addq.w #1,d4 2 (x^2+y^2)/r-r+1 blt.b .nopix 2 (x^2+y^2)/r-r+1<0 ? move.b d3,(a0) 2 put pixel .nopix addq.w #1,d7 2 loop 64k times addq.l #1,a0 2 walk forward in buffer bne.b .loop 2 ; =38 d rts ; Comment this out on Asmone for auto length-output ; printt "Length of your code:" ; printv ((b-a)+(d-c)) ;len dc.l ((b-a)+(d-c)) ********************************************************************** * * Put your tables here * ********************************************************************** section yourbss,bss .