Jump to content



0

Bouncing


3 replies to this topic

#1 Unsurreal OFFLINE  

Unsurreal

    Space Invader

  • 11 posts
  • Location:Brazil

Posted Thu May 13, 2004 8:42 PM

Somebody, please help me!!!

I'm still getting used to Atari programming, actually, I have been learning asm for about one week, and I started a little simple project already.
It's just a game based on classics like Pong and Arkanoid.

But I am having headaches with the boucing thing.

Here's a piece from my code that should do it:
(it's positioned rigth below the end of Vblank routine)

lda #%10000000
bit CXP1FB
beq nobnp

sta CXCLR

lda HMP1
eor #%11100000
sta HMP1
nobnp
(here goes the rest of the code....)

I'm pretty sure that most of you understood what I meant there.
The HMP1 data is changing from the one that moves right and left each time the collision happens.

But there's a terrible bug somewhere, that makes the ball bounce normally at one side (the left side, because of it's first movement is toward left), and then it gets madly fast going to the right and don't bonce anymore, just "flying" around the screen... :?

I hope someone can help me before I get crazy. ;)

#2 Ze_ro OFFLINE  

Ze_ro

    Quadrunner

  • 8,511 posts
  • Welcome Back!

Posted Thu May 13, 2004 9:55 PM

Unsurreal said:

lda HMP1

You can't actually do this... the HMxx registers (along with most other TIA registers, unfortunately) are write-only. Attempting to read from it will probably just give you garbage data.

What you'll probably have to do is use a "shadow" variable in RAM to keep track of the value.

--Zero

#3 Nukey Shay ONLINE  

Nukey Shay

    Sheik Yerbouti

  • 20,458 posts
  • Location:The land of Gorch

Posted Thu May 13, 2004 10:39 PM

Yup...the same goes for many of the 2600's registers.

Though it's unclear from that small snippet how exactly it's coded to function, that is the main problem.

#4 Unsurreal OFFLINE  

Unsurreal

    Space Invader

  • 11 posts
  • Location:Brazil

Posted Fri May 14, 2004 7:52 AM

Tanx a lot.
See if is that what you meant:

lda #%10000000
bit CXP1FB
beq nobnp

lda move ;read from move variable, that has the same initial·
;value of HMP1, in this case: 00010000·

eor #%11100000 ;Execute eor and the result go to A·

sta move ;write the A in move variable·
sta HMP1 ;write the A in HMP1·

nobnp

sta CXCLR

(here the code continues...)

Well, anyway, it seems that it worked very well. As I said I'm new to this and even after your advice I still getting problems with "#" before the datas/adresses, but I think now I've finally learned. :P




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users