Jump to content
IGNORED

Drawing the playfield


Recommended Posts

I am wanting to expand my knowledge of assembly, so I'm beginning work on a second game. It took at least a few hours to start a new game from scratch. I want to draw a different playfield though, just stars since this game is set in outer space (yes, another one.) I am wanting to draw the constellation Ursa Major and call the game that as well since we need more 2600 games that start with the letter U. So my question is, how does one go about figuring out what the values in PF0, 1, and 2 do? I mean, for example, I used the playfield in Dodgeball just to see if I could. Its PF values are in lines 344-399 in my code. The problem is, I don't know why those specific values produce exactly what's on the screen.

 

ursa1.zip

Link to comment
Share on other sites

OK, I have an idea for this game. It's called "Alien Jail." (Not to be confused with "Alien Greed.") You play the role of Zybort, a space cop patrolling Area 4751 of the Lllarbignil Galaxy. It's like a gated community, only in space, and with no gates. But apparently some aliens refuse to listen or don't know any better, and make their way into the area. Your job is to take them to the Alien Jail (the box-like structure in the center of the screen). While avoiding the nasty moving stars. (I'll make them easy to distinguish from the stars on the screen now. They will be colored differently, bigger, and perhaps blinking.)

Missile 0, missile 1 = stars

Player 0 = Zybort's ship

Player 1 = alien to haul off to jail.

Your patrol ship doubles as a tow truck. To tow the alien, touch it with your ship and it will follow you. Then, drag it into the Alien Jail.

All I have got so far are the stars, the alien jail, and a 0000 score.

Sound fun?

alienjail1.zip

Link to comment
Share on other sites

Trying to work on the other alien's movement. I want him to go randomly around the stars and if he hits the playfield, change direction. What it does now is if he hits the playfield, the screen goes black. Sometimes it starts with a frozen black screen. Help would be appreciated.

alienjailthree.zip

Link to comment
Share on other sites

Question time. I put missile0 in the game and it's supposed to move diagonally and bounce around the edges of the screen (and not the playfield), but instead it moves in conjunction with player1 (the purple ship.) Why? I also spent an hour and a half trying to disable diagonal movement since it was making the scanline 264 instead of 262, until I realized that by switching the SWCHA test value from 127 to 63, it didn't bump up the scanline count to 264. Most of that hour and a half was spent trying to get everything an even 262. I think I did it here.

alienjail4.zip

Link to comment
Share on other sites

You got errors. :(

 

 

Look at your ram:

PlayerX0:	ds 1
PlayerX1:	ds 1
PlayerX1S: 	ds 1
PlayerY1S: 	ds 1
PlayerX0S: 	ds 1
PlayerY0S: 	ds 1

Look at your loop for positioning:

	;;
	;; Apply X motion vectors.
	;; 
	ldx #$00
	
ApplyMotion:	
	lda PlayerX0,x
	jsr PosObject
	inx
	cpx #$06
	bne ApplyMotion

Look at what X does in the "PosObject" Subroutine:

        sta.wx HMP0,X  ; 5 19 - store fine tuning of X
        sta RESP0,X    ; 4 23 - set coarse X position of object

In other words, the value of X will be used to index which registers get written to:

X=0  HMP0, RESP0
X=1  HMP1, RESP1
X=2  HMM0, RESM0
X=3  HMM1, RESM1
X=4  HMBL, RESBL

Putting it all together with your current ram layout:

PlayerX0   ----> X position for P0
PlayerX1   ----> X position for P1
PlayerX1S  ----> X position for M0
PlayerY1S  ----> X position for M1
PlayerX0S  ----> X position for BL
PlayerY0S  ----> THIS is also being called by your loop, and ultimately writes to VDELP0 and AUDC0!!

That should help you a bit.

Link to comment
Share on other sites

I would suggest at this point you look at renaming your variables and searching where they are being used in your file, because:

 

1) BallX0 is actually not the ball (confusing!), but M0 X-position.

2) Several places in the code have comments indicating BallX0 is a Y variable, not and X variable.

 

You could do better by naming BallX0 something like m0_Xpos, or whatever floats your boat.

 

It looks like you got the positioning loop straightened out. As you can see it positions P0,P1,M0,M1, and the BL each time it runs. Make sure all the variables are set up correctly in ram so that they can be indexed as lda PlayerX0,X

 

 

BTW, your loop is more efficient if it counts down. This is because you can DEX and skip the compare. Just change the branch to BPL. When X goes from 0 to $FF the branch will not be taken.

    ;;
    ;; OLD
    ;;
    ldx #$00

ApplyMotion:
    lda PlayerX0,x
    jsr PosObject
    inx
    cpx #$04
    bne ApplyMotion



    ;;
    ;; NEW
    ;;
    ldx #4

ApplyMotion:
    lda PlayerX0,x
    jsr PosObject
    dex
    bpl ApplyMotion
Link to comment
Share on other sites

 

I would suggest at this point you look at renaming your variables and searching where they are being used in your file, because:

 

1) BallX0 is actually not the ball (confusing!), but M0 X-position.

2) Several places in the code have comments indicating BallX0 is a Y variable, not and X variable.

 

You could do better by naming BallX0 something like m0_Xpos, or whatever floats your boat.

 

It looks like you got the positioning loop straightened out. As you can see it positions P0,P1,M0,M1, and the BL each time it runs. Make sure all the variables are set up correctly in ram so that they can be indexed as lda PlayerX0,X

 

 

BTW, your loop is more efficient if it counts down. This is because you can DEX and skip the compare. Just change the branch to BPL. When X goes from 0 to $FF the branch will not be taken.

    ;;
    ;; OLD
    ;;
    ldx #$00

ApplyMotion:
    lda PlayerX0,x
    jsr PosObject
    inx
    cpx #$04
    bne ApplyMotion



    ;;
    ;; NEW
    ;;
    ldx #4

ApplyMotion:
    lda PlayerX0,x
    jsr PosObject
    dex
    bpl ApplyMotion

 

OmegaMatrix: This is because he's using parts of one of my iterations of the Dodgeball kernel and vblank code.

 

-Thom

Link to comment
Share on other sites

So my question is, how does one go about figuring out what the values in PF0, 1, and 2 do? I mean, for example, I used the playfield in Dodgeball just to see if I could. Its PF values are in lines 344-399 in my code. The problem is, I don't know why those specific values produce exactly what's on the screen.

 

 

Now that you understand how they work, here's a tool I threw together to make it easier to design playfields. May or may not be helpful, but thought I'd mention it just in case.

Link to comment
Share on other sites

 

Now that you understand how they work, here's a tool I threw together to make it easier to design playfields. May or may not be helpful, but thought I'd mention it just in case.

 

Nice tool!

 

I played around a bit with it!

This is very useful to understand the messy bits of the playfield registers (different left-to-right order).

 

Wouldn't it be a nice idea to collect this and even more tools in a different blog/thread or whatever here at atariage.com?

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