Newsgroups: comp.sys.apple2 Path: news.weeg.uiowa.edu!news.uiowa.edu!hobbes.physics.uiowa.edu!news.iastate.edu!destroyer!gatech!emory!sol.ctr.columbia.edu!news.columbia.edu!cunixb.cc.columbia.edu!stc7 From: stc7@cunixb.cc.columbia.edu (Steven T Chiang) Subject: Re: ANIMATION AND SCANLINES Message-ID: <1993Feb11.011220.8858@news.columbia.edu> Sender: usenet@news.columbia.edu (The Network News) Nntp-Posting-Host: cunixb.cc.columbia.edu Reply-To: stc7@cunixb.cc.columbia.edu (Steven T Chiang) Organization: Columbia University References: <8549.61.uupcb@uttsbbs.uucp> Date: Thu, 11 Feb 1993 01:12:20 GMT Lines: 56 In article <8549.61.uupcb@uttsbbs.uucp> paul.parkhurst@uttsbbs.uucp (Paul Parkhurst) writes: >-> Does anybody out there have the code to detect where the current >-> scanline on the GS screen is at so I could draw an image to the >-> screen without scanline flicker. Currently, the C/asm code I have >-> waits until a vertical blank before it draws to the screen, but that >-> slows it down. I guess I missed this post the first time around. Syncing, by nature means that you are waiting for the beam to hit a certain line or vblank. It doesn't matter which way you sync, you'll end up waiting for a certain amount of time. However, if the problem is you don't have enough time to update the area, there are better ways of syncing, see below. > What you can do is set the scanline interrupt bit for a particular >line (usually, a line after what it is you want to draw). When you hit >the interrupt, draw what needs to be drawn. Since the interrupt occured >on the line after what you are drawing, you should have plenty of time >to update the upper part of the screen before its redrawn. > > I did this in a long-lost project of mine and it worked fine. No >flicker in the animation at all. I suppose this would work. However, scanline interrupts aren't the highest priority in the interrupt manager's chain. In DG, we patch the interrupt manager to make it the highest priority. Also, there might be reasons why you wouldn't want interrupts enabled. Here is a sync routine that will exit when beam has refreshed the line # stored in location (word loc). (16 bit mode) lup ldal $e1c02e and #$80ff dec xba asl cmp location ;(line number bne lup If you check the docs on c02e and c02f, you'll find that the LSB of the counter is stored in c02f, which is why you AND off the unimportant bits, and do the xba asl. Basically, if the upper corner of your sprite is at line 30, you could monitor the beam until it reaches line 30 and start drawing at that point. By doing this, you gain about 170 * amt of time to scan one line worth of time. Steven Chiang Order - DreamGrafix: The ONLY 16/256/3200 stc7@cunixb.cc.columbia.edu color paint program for the Apple IIGS. America On_Line: DWS Steve Genie: S.Chiang4 Apple IIGS Forever!