Jump to content
IGNORED

6 digit score


Recommended Posts

I think the most common approach would be to have 6 pointers, one for each digit, and set each pointer to the digit graphics for that digit. After doing that, it would be a standard 48-pixel routine to display all of the digits. Here's my attempt at explaining how to do the 48-pixel routine:

 

http://www.taswegian.com/WoodgrainWizard/tiki-index.php?page=48-pixel-Image-Routine

 

Link to comment
Share on other sites

The code in the link @Karl G provided uses "absolute,y" memory accesses; whereas, you switched them to (indirect),y accesses which take one more cycle each.  You need to move the score display kernel code around a bit to compensate for this AND you'll need to adjust your positioning also.

 

Fixed code:

Score_Code:		
        sta WSYNC
        lda #0
        sta COLUBK
        inx		
        cpx #100
        bne Score_Code

        sta WSYNC
        ldx #1              ; 2  2
        stx VDELP0          ; 3  5  turn off vertical delay
        stx VDELP1          ; 3  8  turn off vertical delay

        ldx #0              ; 2 10
        stx GRP0            ; 3 13  make sure player0 is off
        stx GRP1            ; 3 16  make sure player1 is off
        stx ENABL           ; 3 19  make sure ball is off
        stx ENAM0           ; 3 22  make sure Missile1 is off
        stx ENAM1           ; 3 25  make sure Missile0 is off     
        stx REFP0           ; 3 28  make sure reflect is off
        stx REFP1           ; 3 31  make sure reflect is off

        ldx #0              ; 2 33  ; +0 for HMP1
        stx HMP1            ; 3 36  ; fine positioning for player1

        ldx #$FF            ; 2 38  ; +1 for HMP0
        stx RESP0           ; 3 41  ; player0 at X=60 = ((41 * 3) - 68)+5
        stx RESP1           ; 3 44  ; player1 at X=69 = ((44 * 3) - 68)+5
        stx HMP0            ; 3 47  ; fine positioning for player1

        ldx #3              ; 2 49  ; X now 1
        stx NUSIZ0          ; 3 52  ; player0 - 2 copies, close
        stx NUSIZ1          ; 3 55  ; player1 - 2 copies, close

        lda ScoreColor      ; 3 58
        sta COLUP0          ; 3 61
        sta COLUP1          ; 3 64

        sta WSYNC
        sta HMOVE           ; sets player0 X=62, player1 X=72

;---------------------------------
;--- now draw score

        ldy #7
        sty ImageHeight
		
        ; 80 - 8 - 8 - 64
ScoreLoop       
        lda (DigitLivesTens),y  ; 5     (70)
        sta WSYNC
        sta GRP0                ; 3     (3)     hello0->[GRP0]    

        lda (DigitLivesOnes),y  ; 5     (8)
        sta GRP1                ; 3     (11)    hello1->[GRP1], hello0->GRP0
        lda (DigitThousands),y  ; 5     (16)
        sta GRP0                ; 3     (19)    hello2->[GRP0], hello1->GRP1
        lda (DigitHundreds),y   ; 5     (24)   
        tax                     ; 2     (26)    hello3->X
        lda (DigitTens),y       ; 5     (31)
        sta Temp2               ; 3     (34)
        lda (DigitOnes),y       ; 5     (39)    hello5->A
        ldy Temp2               ; 3     (42)

        stx GRP1                ; 3     (45)    hello3->[GRP1], hello2->GRP0
        sty GRP0                ; 3     (48)    hello4->[GRP0], hello3->GRP1
        sta GRP1                ; 3     (51)    hello5->[GRP1], hello4->GRP0
        sta GRP0                ; 3     (54)    hello5->GRP1    
        dec ImageHeight         ; 5     (59)
        ldy ImageHeight         ; 3     (62)
        bpl ScoreLoop           ; 2/3   (65)

        sta WSYNC           ; extra blank line to keep it 262 scanlines
        lda #0

        sta NUSIZ0
        sta NUSIZ1
        sta COLUBK

        rts

 

Link to comment
Share on other sites

Hmmm, crap... Just checked, off by 5 pixels.  Don't know why I didn't check to make sure it was centered.

 

Fixed:

 

Score_Code:		
        sta WSYNC
        lda #0
        sta COLUBK
        inx		
        cpx #100
        bne Score_Code

        sta WSYNC
        ldx #1              ; 2  2
        stx VDELP0          ; 3  5  turn off vertical delay
        stx VDELP1          ; 3  8  turn off vertical delay

        ldx #0              ; 2 10
        stx GRP0            ; 3 13  make sure player0 is off
        stx GRP1            ; 3 16  make sure player1 is off
        stx ENABL           ; 3 19  make sure ball is off
        stx ENAM0           ; 3 22  make sure Missile1 is off
        stx ENAM1           ; 3 25  make sure Missile0 is off     
        stx REFP0           ; 3 28  make sure reflect is off
        stx REFP1           ; 3 31  make sure reflect is off

        ldx #$E0            ; 2 33  ; +2 for HMP0
        stx HMP0            ; 3 36  ; fine positioning for player1
        stx RESP0           ; 3 39  ; player0 at X=56 = ((39 * 3) - 68)+5  +2
        stx RESP1           ; 3 42  ; player1 at X=64 = ((42 * 3) - 68)+5  +1

        ldx #$F0            ; 2 44  ; +1 for HMP1
        stx HMP1            ; 3 47  ; fine positioning for player1
        
        ldx #3              ; 2 49
        stx NUSIZ0          ; 3 52  ; player0 - 2 copies, close
        stx NUSIZ1          ; 3 55  ; player1 - 2 copies, close

        lda ScoreColor      ; 3 58
        sta COLUP0          ; 3 61
        sta COLUP1          ; 3 64

        sta WSYNC
        sta HMOVE           ; sets player0 X=56, player1 X=64

 

Link to comment
Share on other sites

Here is Spiceware's solution. I guess there is more than one way to do this after all.

Thanks for everyone's help - I really appreciate it. Now I can move forward with this project.

 

I still don't get how we can choose where the score x's position is. Does it have to do with how many cycles we are using?

 

burger8e.asm

Link to comment
Share on other sites

18 hours ago, atari2600land said:

I still don't get how we can choose where the score x's position is. Does it have to do with how many cycles we are using?

 

It has to do with:

  • the cycles the RESP0 and RESP1 occur on, which set the coarse X position
  • the values put into HMP0 and HMP1, which take effect when HMOVE is written to.

 

I put comments in my solution, the 5 lines I've highlighted here with ------> are the lines that set the X positions for the players.

        sta WSYNC
        ldx #1              ; 2  2
        stx VDELP0          ; 3  5  turn on vertical delay
        stx VDELP1          ; 3  8  turn on vertical delay
		
        ldx #0              ; 2 10
        stx GRP0            ; 3 13  make sure player0 is off
        stx GRP1            ; 3 16  make sure player1 is off
        stx ENABL           ; 3 19  make sure ball is off
        stx ENAM0           ; 3 22  make sure Missile1 is off
        stx ENAM1           ; 3 25  make sure Missile0 is off     
        stx REFP0           ; 3 28  make sure reflect is off
        stx REFP1           ; 3 31  make sure reflect is off

        ldx #3              ; 2 33  3 copies close
        stx NUSIZ0          ; 3 36 		
------> stx RESP0           ; 3 39  player0 at X=54
        ldx #1              ; 2 41  2 copies close
        stx NUSIZ1          ; 3 44  player1 - 2 copies, close
------> stx RESP1           ; 3 47  player1 at X=78
        ldx #$E0            ; 2 49  +2 for fine positioning
------> stx HMP0            ; 3 52  fine positioning for player0, X = 56
------> stx HMP1            ; 3 55  fine positioning for player1, X = 80
        lda ScoreColor      ; 3 58
        sta COLUP0          ; 3 61
        sta COLUP1          ; 3 64		
        sta WSYNC
------> sta HMOVE           ; sets player0 X=56, player1 X=80

 

Link to comment
Share on other sites

here is my two bits for what its worth. I'm very visual when it comes to kernel coding and I have to draw out my code visually to the screen alignment. This seems to almost always get cycle exact code as long as it doesn't cross any page boundaries. It may not make much sense to some people, but it works for me. Just thought I would share this version. It only runs absolute addressing for a 48 pixel static image but also allows PF1 to get loaded too for the first copy and blanked for the second copy. 

6 digit routine absolute graphics with 1 PF update.png

Edited by grafixbmp
  • Like 1
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...