Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #1852

Re: "Best practices" for animating sprites in Apple II Assembly? (HGR/HGR2)

From mmphosis <mmphosis@macgui.com>
Newsgroups comp.sys.apple2.programmer
Subject Re: "Best practices" for animating sprites in Apple II Assembly? (HGR/HGR2)
Date 2015-10-16 07:01 +0000
Organization Mac GUI
Message-ID <mmphosis-1444979010@macgui.com> (permalink)
References <3dfeb2b4-f124-40fe-afe1-cfde8912151d@googlegroups.com>

Show all headers | View raw


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.


Back to comp.sys.apple2.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

"Best practices" for animating sprites in Apple II Assembly? (HGR/HGR2) jamesiwalker77@gmail.com - 2015-10-15 19:15 -0700
  Re: "Best practices" for animating sprites in Apple II Assembly? (HGR/HGR2) Michael J. Mahon <mjmahon@aol.com> - 2015-10-16 01:58 -0500
    Re: "Best practices" for animating sprites in Apple II Assembly? (HGR/HGR2) jamesiwalker77@gmail.com - 2015-10-16 08:38 -0700
  Re: "Best practices" for animating sprites in Apple II Assembly? (HGR/HGR2) mmphosis <mmphosis@macgui.com> - 2015-10-16 07:01 +0000
    Re: "Best practices" for animating sprites in Apple II Assembly? (HGR/HGR2) jamesiwalker77@gmail.com - 2015-10-16 08:49 -0700
  Re: "Best practices" for animating sprites in Apple II Assembly? (HGR/HGR2) "Anton Treuenfels" <teamtempest@yahoo.com> - 2015-10-16 08:32 -0500
  Re: "Best practices" for animating sprites in Apple II Assembly? (HGR/HGR2) John Brooks <jbrooks@blueshiftinc.com> - 2015-10-16 08:08 -0700
  Re: "Best practices" for animating sprites in Apple II Assembly? (HGR/HGR2) jamesiwalker77@gmail.com - 2015-10-16 08:34 -0700

csiph-web