Subject: Re: [stella] Death Derby, new build From: "B. Watson" <atari@xxxxxxxxxxxxxx> Date: Sun, 7 Oct 2001 03:43:05 -0400 (EDT) |
On Sat, 6 Oct 2001, Glenn Saunders wrote: > > In this build a lot of the stuff is laid out in memory, the sprites et. al. > > I actually have a car showing up, but I don't like the routines that handle > the logic. Too much RAM and cycles. > > I tried to use indirect addressing to set up pointers to the start of car > sprite ROM in order to handle the rotations but I don't think I understand > how to do this properly. I had to go back to hardcoding it to one car shape. > > Please assist :) > You're trying to use LDA (addr,X)... you should be using LDA (addr),Y The difference is, LDA (addr,X) adds X to addr, then uses that value as a pointer. LDA (addr),y uses addr for a pointer, and adds Y to that pointer, after dereferencing it. Say I have this in memory: Location Value addr f0 addr+1 a1 addr+2 f2 addr+3 a3 Now if I do this: ldx #1 lda (addr,x) ...then A ends up containing whatever was in $F2A1. (addr,x) is called `Pre-indexed indirect' mode, meaning X gets added to the address *before* it gets used as a pointer. whereas if I do this: ldy #1 lda (addr),y ...then A gets whatever was in $A1F1. (addr),y is `Post-Indexed indirect' mode, meaning Y gets added to the effective address pointed to by the pointer (addr), after is has been calculated. There are no (addr),x or (addr,y) modes, either... X is always pre-indexed and Y is always post-indexed. Swap the roles of the X and Y registers in the section of code where you want to use indirect addressing, and use (addr),y and your problem should go away... B. --- If a trainstation is the place where trains stop, what is a workstation? - Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[stella] Death Derby, new build, Glenn Saunders | Thread | Re: [stella] Death Derby, new build, Thomas Jentzsch |
[stella] Death Derby, new build, Glenn Saunders | Date | Re: [stella] Death Derby, new build, Thomas Jentzsch |
Month |