Re: [stella] Confused newbie...

Subject: Re: [stella] Confused newbie...
From: "Thomas Jentzsch" <tjentzsch@xxxxxx>
Date: Wed, 06 Oct 2004 09:21:19 +0200
Kevin Lipe wrote:
> What would be the best way to position sprites and such in a kernel
> for the game concept I was talking about in the above thread? Attached
> is the code I've got right now, which just makes a really pretty
> playfield and nothing else.

I suppose you want to reposition your sprites *inside* the kernel, right?

The most simple code for this would look like this:
  ldx   index    ; the current sprite index
  lda   posLst,x ; a list containing all horizontal positions (0..159)
  sta   WSYNC
----------------
  sec            ; 2
.wait:      
  sbc   #15      ; 2
  bcs   .wait    ; 2/3
  eor   #$07     ; 2
  asl            ; 2
  asl            ; 2
  asl            ; 2
  asl            ; 2
  sta   HMP0     ; 3
  sta.w RESP0    ; 4  @23+n*5 
  sta   WSYNC    ; 3
----------------
  sta   HMOVE

This is however a general solution, which allows positioning sprite 0 across
the whole screen and uses one whole scanline

For your kernel you may need something more specialized, e.g. 
- objects cannot move accross the whole screen, so you can free some
  cycles for other kernel stuff
- you don't have that much free time inside your kernel, then you should
  calculate the fine and coarse positioning values outside the kernel. This
  saves a few cycles and allows additional tricks (e.g. two different codes
  for positioning objects on the left and right, giving you more free cycles 
  for other stuff)
- ...

So this can get quite complicated later, but for a start I suppose using 
something like the code above.

Have fun!
Thomas
_______________________________________________________
Thomas Jentzsch         | *** Every bit is sacred ! ***
tjentzsch at web dot de |
_______________________________________________________
WEB.DE Video-Mail - Sagen Sie mehr mit bewegten Bildern
Informationen unter: http://freemail.web.de/?mc=021199


Current Thread