Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: mmphosis Newsgroups: comp.sys.apple2.programmer Subject: Re: "Best practices" for animating sprites in Apple II =?UTF-8?B?QXNzZW1ibHk/IChIR1IvSEdSMik=?= Date: Fri, 16 Oct 2015 07:01:26 +0000 (UTC) Organization: Mac GUI Lines: 37 Message-ID: References: <3dfeb2b4-f124-40fe-afe1-cfde8912151d@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Fri, 16 Oct 2015 07:01:26 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="ac9e0e4d7dd3957fb97803ee6801bab8"; logging-data="30686"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Y5dV7RRu73MwFftwtZP30" User-Agent: Mac GUI Usenet In-Reply-To: <3dfeb2b4-f124-40fe-afe1-cfde8912151d@googlegroups.com> Cancel-Lock: sha1:XO5ws6XDyxNXjfSpYLx25++tfnI= Xref: csiph.com comp.sys.apple2.programmer:1852 Lots of hoops and unrolled loops. You only need an offset of 40 bytes to span the screen horizontally so this can be accomplished using an 8-bit index register. You can use a look up table, like you created with C#, to span the screen vertically 192 lines. > So, is there an assembly language instruction that I am not aware of that > allows 2 byte variability? You can usually only modify one byte at a time with the 8-bit 6502, although the JSR instruction pushes two bytes at a time onto the stack. The 16-bit 65816 allows 2 byte variability. If you want to modify two bytes using the 8-bit 6502, use two store instructions. Indirect addressing might also be helpful, although absolute addressing is faster. LDY horizontal LDX vertical LDA lo,X ; lo is the lo order address of the lookup table STA zp LDA hi,X ; hi is the hi order address of the lookup table STA zp+1 LDA (zp),Y AND mask ORA shape STA (zp),Y Only redraw the parts of the background that need to be "undrawn." Redraw each animated sprite at it's new location. Flip the page during the Vertical Blanking Interval. There are many techniques depending on what type of animation is being done: sprite animation, tiling, scrolling, color animation, rotoscoping, etc... Some of Bill Budge's work was mentioned recently. The source code for Prince of Persia is available.