Jump to content
IGNORED

Is It Possible to Draw p0 In The Center of the Screen?


gagebair

Recommended Posts

I want to place my player 0 sprite in the very center of the screen AND have it be stationary. So far, I've been able to center it vertically, but from what I've been reading, it seems like it is impossible to place a static player 0 sprite centered horizontally without having it move first, due to only being able to place sprites every 15 color clocks. Is there anyway at all to do what I want to do? Any help at all would be greatly appreciated!

Link to comment
Share on other sites

Check out a tutorial on sprite positioning. You can only gross-position to about every 15 pixels using RESP0, then you fine-position using HMP0 and HMOVE. That's usually one of the first chapters in any Atari 2600 tutorial series, including the ones pinned in this forum.

  • Like 1
Link to comment
Share on other sites

For something stationary you can set the gross-position to every 3rd pixel, which might be close enough.

 

If the RESP0 ends on cycle 46 you'll end up with player0 at X position 75.  Truly centered would be X position 76.

 

I set the score positions in Medieval Mayhem by doing RESP0 and RESP1 on the same scanline. I don't use HMOVE, just use the course 3-pixel positioning as is.

 

1849287219_MedievalMayhem(NTSC)_dbg_4adef6a8.thumb.png.140b260a701c3efbe8bf11fc538af041.png

 

        sta ENAM0          ; 3    turn off missile 0
        sta ENAM1          ; 3  6 turn off missle 1
        lda #%100          ; 2  8 set both players to 2 copies far
        sta NUSIZ0         ; 3 11 so we can display score
        sta NUSIZ1         ; 3 14
        lda #>Digits       ; 2 16 +-----
        sta Score1+1       ; 3 19 | reset score high pointers
        sta Score2+1       ; 3 22 | as they're used as Temp Variables
        sta Score3+1       ; 3 25 | during the rest of the program
        sta Score4+1       ; 3 28 +-----
        sta RESP0          ; 3 31               <---------- set player0 X = 30
        nop                ; 2 33
        nop                ; 2 35
        nop                ; 2 37
        sta RESP1          ; 3 40               <---------- set player1 X = 57

ScoreKernel
        sta WSYNC
        lda #ShieldColor1  ; 2
        sta COLUP0         ; 3  5
        lda (Score1),y     ; 5 10
        sta GRP0           ; 3 13
        lda #ShieldColor4  ; 2 15
        sta COLUP1         ; 3 18
        lda (Score4),y     ; 5 23
        sta GRP1           ; 3 26
        lda #ShieldColor2  ; 2 28
        nop
        nop
        nop
        sta COLUP0         ; 3 31
        lda (Score2),y     ; 5 36
        sta GRP0           ; 3 39
        lda #ShieldColor3  ; 2 41
        sta COLUP1         ; 3 44
        lda (Score3),y     ; 5 49
        sta GRP1           ; 3 52
        dey
        bpl ScoreKernel

 

This is from my Early HMOVE demo, the cycle and X columns tell you the resulting position of the object.

 

Cycle position.pdf

 

  • Like 1
Link to comment
Share on other sites

Typically, if you only have one object that will be drawn with P0, you would do the write to RESP0 to set the position (and HMOVE, if desired for fine-tuning position) during the VBlank period before the visible screen generation done in the Kernel code.  If you have multiple things to be drawn with P0, you would need to use RESP0 (and perhaps HMOVE) for each subsequent object during the Kernel code after the prior P0 object is drawn.  

Edited by Sohl
clarity of wording
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...