Jump to content
IGNORED

Position Player Graphics for 6 digit score


three2em

Recommended Posts

Hey all,

 

I'm new here, and have been getting along well reading through the massive information on this forum. Thanks!

 

I'm building a game for the Atari 2600 and have accomplished quite a lot in one weekend considering I haven't programmed in ASM in over a decade. I'm trying to implement a 6 digit score, and while I've been able to find a lot of information about how to, and I understand the VDELPx method, the only thing I can't figure out is how to position the Players 8 pixels apart. What I'm currently doing is running several NOPs until the P0 sprites work, then doing a call to RESP0, then the very next line of code doing a RESP1. This gets me very close, as I'm able to display all 6 digits, but P0 and P1 are 9 pixels apart rather than 8, so the alignment is just off. All the algorithms I can find online only show the loop to display 6 sprites in a row, but all assume that the Players have been positioned correctly. Any help would be great. Thanks :-D

 

Quick Edit:

 

Figured some code might help:

BeginScore
    ; Wait X cycles then reset P0/P1
    NOP ; 2 (2)
    NOP ; 2 (4)
    NOP ; 2 (6)
    NOP ; 2 (
    NOP ; 2 (10)
    NOP ; 2 (12)
    NOP ; 2 (14)
    NOP ; 2 (16)
    NOP ; 2 (18)
    NOP ; 2 (20)
    NOP ; 2 (22)
    NOP ; 2 (24)
    NOP ; 2 (26)
    NOP ; 2 (28)
    NOP ; 2 (30)
    NOP ; 2 (32)
    STA RESP0
    STA RESP1
    LDY #7
    STY temp
ScoreLoop
    LDY temp
    LDA (scoreDigits+$A),Y     ; 6th
    STA temp2
    STA WSYNC
    LDA (scoreDigits),Y  ; 1st
    STA GRP0
    LDA (scoreDigits+$2),Y  ; 2nd
    STA GRP1
    LDA (scoreDigits+$4),Y  ; 3rd
    STA GRP0
    LDA (scoreDigits+$,Y  ; 5th
    TAX
    LDA (scoreDigits+$6),Y  ; 4th
    LDY temp2
    NOP
    STA GRP1                ; 4th
    STX GRP0                ; 5th
    STY GRP1                ; 6th
    STA GRP0
    DEC temp
    BPL ScoreLoop
Edited by three2em
Link to comment
Share on other sites

You need to do a fine-grain adjustment using HMP1 and HMOVE.

 

Write #$10 into HMP1, and then call HMOVE. So lda #$10, then sta HMP1, then on the next line (after sta WSYNC), call HMOVE.

 

If you need to avoid black bars on the left of the screen, you can write #$90 into HMP1 and call HMOVE starting on cycle 70 or 71.

 

Hope this answers your question.

  • Like 1
Link to comment
Share on other sites

Thanks for the quick response PolygonPizza. I didn't get it at first, but then after I coded what you recommended, it finally clicked in how all this repositioning stuff works. Thanks!

 

Edit:

 

Forgot the code again. This is what works for me, hopefully it will help others.

BeginScore
    ; Wait X cycles then reset P0/P1
    LDA #3      ; 2 (2)
    STA NUSIZ0  ; 3 (5)
    STA NUSIZ1  ; 3 (
    LDA #1      ; 2 (10)
    STA VDELP0  ; 3 (13)
    STA VDELP1  ; 3 (16)
    LDA #0      ; 2 (18)
    STA COLUBK  ; 3 (21)
    LDA #CSCORE ; 2 (23)
    STA COLUP0  ; 3 (26)
    STA COLUP1  ; 3 (29)
    NOP         ; 2 (31)
    NOP         ; 2 (33)
    STA RESP0
    STA RESP1
    LDA #%11110000
    STA HMP1
    LDA #%11100000
    STA HMP0    ; Shift scores slightly to the center of the screen
    STA WSYNC
    STA WSYNC
    STA WSYNC
    STA WSYNC   ; Additional WSYNCs for vertical alignment, only one necessary for HMOVE
    STA WSYNC
    STA HMOVE
    LDY #7
    STY temp
ScoreLoop
    LDY temp
    LDA (scoreDigits+$A),Y      ; 6th
    STA temp2
    STA WSYNC                   ; Twelve Cycles to spare when WSYNC is called
    LDA (scoreDigits),Y         ; 1st
    STA GRP0
    LDA (scoreDigits+$2),Y      ; 2nd
    STA GRP1
    LDA (scoreDigits+$4),Y      ; 3rd
    STA GRP0
    LDA (scoreDigits+$,Y      ; 5th
    TAX
    LDA (scoreDigits+$6),Y      ; 4th
    LDY temp2
    NOP
    STA GRP1                    ; 4th
    STX GRP0                    ; 5th
    STY GRP1                    ; 6th
    STA GRP0
    DEC temp
    BPL ScoreLoop
Edited by three2em
Link to comment
Share on other sites

You are already way beyond my basic programming ability.

Don't you just set P0 and P1 NUSIZ0, NUSIZ1 for 3 copies close, and update the data during display?

Three copies close side-by-side line up to 48 pixels wide.

 

Oh, I see you are doing that.

I first saw reset player and thought you were just starting over without the hardware copy.

Edited by iesposta
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...