Jump to content



1

Session 22: Sprites, Horizontal Positioning Part 1


26 replies to this topic

#26 xucaen OFFLINE  

xucaen

    Star Raider

  • 94 posts
  • Looking for new owner for commodore 64
  • Location:Ma

Posted Mon Jun 26, 2006 1:44 PM

View PostGalaga_Freak, on Sun Jan 18, 2004 5:41 PM, said:

Finally got around to catching up on these.

Anyway here is some code that demos horizontal movement

Hi, I know this post is old, but I was searching for information on calculating missile coordinates and horizontal positioning. I looked at the horizontal-22.asm and I saw something that confused me.

201:		ldx #2 

;code snipped

235:		sta HMP0-1,x

On line 235, does that actually write to HMP1? And is this style of notation used to waste cycles? Or is there some other purpose to this?

Thanks,

Jim

#27 nmoog OFFLINE  

nmoog

    Space Invader

  • 44 posts

Posted Mon Jun 26, 2006 10:40 PM

Hey xucaen,

It looks like that is used in a loop so it moves both player0 and player1 sprites:

ldx #2
PosSP

lda PlayerX-1,x
sta RESP0-1,x
sta HMP0-1,x
...and so on...

dex
bne PosSP

In the debugger it does update HMP0 and HMP1... I don't know why he didn't use ldx#1 and drop the -1s though?




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users