Jump to content
IGNORED

Bouncing


Recommended Posts

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. ;)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...