Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!cbmvax!chrisg From: chrisg@cbmvax.commodore.com (Chris Green) Newsgroups: comp.sys.amiga.programmer Subject: Re: 3D stuff & quick line drawing Message-ID: <21106@cbmvax.commodore.com> Date: 1 May 91 14:05:45 GMT References: <1991Apr22.122442.25505@cs.umu.se> <20884@cbmvax.commodore.com> <00672624939@elgamy.RAIDERNET.COM> <1991Apr29.110534.10198@cs.umu.se> Reply-To: chrisg@cbmvax.commodore.com (Chris Green) Organization: Commodore, West Chester, PA Lines: 41 In article <1991Apr29.110534.10198@cs.umu.se> dvljrt@cs.umu.se (Joakim Rosqvist) writes: >Here is my inner loop: > BSET d7,(a0) ;Plot pixel. 12 cycles > ADD d6,a0 ;Go to the next scanline. 8 cycles > SUB d3,d5 ;This routine always goes one pixel down and sometimes > ;(every second time for 292 deg) one pixels right. > ;d3 is MIN(dx,dy) that is dx in this case. 4 cycles > BPL.S over ;See if it is time to go right. 9 cycles > ;(8 or 10 depending on wheter it branches) > ADD d4,d5 ;d4 is MAX(dx,dy)=dy in this case. 4/2=2 cycles > SUBQ #1,d7 ;One pixel right 4/2=2 cycles > BPL.S over ;If 0 MOVEQ #7,d7 ;restart from bit 7. 4/2/8=0.25 cycles > ADDQ #1,a0 ;go to next byte. 8/2/8=0.5 cycles >over: Another good optimization for CPU driven lines is to do further examination of the slope. For instance, suppose you are drawing a near vertical line. If DX