Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!tut.cis.ohio-state.edu!tortoise.cis.ohio-state.edu!meekins From: meekins@tortoise.cis.ohio-state.edu (timothy lee meekins) Newsgroups: comp.sys.apple2 Subject: Re: Animation Keywords: Animation Message-ID: <108928@tut.cis.ohio-state.edu> Date: 17 Apr 91 13:10:35 GMT References: <1991Apr17.061057.22357@cs.uow.edu.au> Sender: news@tut.cis.ohio-state.edu Organization: The Ohio State University, Department of Computer and Information Science Lines: 82 In article <1991Apr17.061057.22357@cs.uow.edu.au> u9050728@cs.uow.edu.au (Shane Kelvin Richards) writes: > > Hello. I am hoping someone can help me. I am developing a set of >animation routines for the //GS. So far its okay, BUT things are becoming >a tad slow when many objects are on the screen. Heres how I am doing it.. > > If I want to put a shape on the screen, I go through a loop pulling >off each background byte (that the shape will be using) anding it with the >shapes mask (using a mask makes it really easy to have "see-through" holes >in the shapes and so that the background moves around the shape if the >background and shape happen to fall in the same byte) then I ora the shape >byte and place this calculated byte back on the screening (and yes I am >using the shadow screen in bank $01 for faster reads). So this is the >basic process. It slows down quite considerably but I can't think of any >other way of doing what am trying to do. This is the place the shape >down on top of the background nicely (so that it doesn't get jaggies if >I had for instance just Stored the shape directly on the screen. > > My question is, is my basic ideas/techniquie correct? Am I using >the wrong method for fast shape manipulation. OR am I using the correct >method and I should just try to improve upon my code and optimise where >I can? > > For simplicity I only let shapes move by 2 pixels so that they >always fall on a byte boundary. Also, I am usin the 320x200 resolution. > > Any ideas, what other techniques are there? > If all your shapes are the same size, then try unrolling all your loops in the shape drawing functions. Something like: ; ; On entry, X points to shape, Y points to screen ; Assume shape (for this example) is 8 bytes by 8 pixels. ; DrawShape phb ;Set to bank 1 pea $0101 plb plb lda $2000+0*160+0,y and >masktbl+0*8+0,x ora >shapetbl+0*8+0,x sta $2000+0*160+0,y lda $2000+0*160+2,y and >masktbl+0*8+2,x ora >shapetbl+0*8+2,x sta $2000+0*160+2,y ... lda $2000+6*160+6,y and >masktbl+6*8+6,x ora >shapetbl+6*8+6,x sta $2000+6*160+6,y plb rts It will take slightly more memory, but the speedup will be very noticable. If you don't re-map the bank, and use long address for the screen instead, you'll have to interchange the functions of the X & Y registers. > >-- >+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- >Shane Richards >u9050728@cs.uow.edu.au >+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- -- +---------------------------S-U-P-P-O-R-T-----------------------------------+ |/ Tim Meekins <<>> Snail Mail: <<>> Apple II \| |> meekins@cis.ohio-state.edu <<>> 8372 Morris Rd. <<>> Forever! <| |\ timm@pro-tcc.cts.com <<>> Hilliard, OH 43026 <<>> /|