Jump to content
IGNORED

Score not displaying


Recommended Posts

Hi,

 

I am working on getting the score to display, but am having an issue.? I just added the following code to my main loop:

GameLoop
	jsr VerticalSync						; perform vertical sync
	jsr CheckJoystick						; check for joystick input
	jsr ClampObjects						; move and clamp objects
	jsr PositionObjects						; position the objects
	jsr GetDigitPointers					; New
	jsr DrawDigits							; New
; ********************************
; Experimental (Is this correct?)
; ********************************
	jmp Jump_Display_Bank

Return_Display_Bank

	jsr OverScan							; (3 13) jump to OverScan Routine
	jmp GameLoop

However when i test the game the score isn't being displayed at all. ? Here is the code for those 2 functions:

GetDigitPointers
	ldx #0									; leftmost bitmap
	ldy #2									; start from most-sigificant BCD value
.DigitPointerLoop
	lda Score,y								; get BCD value of players score
	and #$f0								; isolate high nibble (* 16)
	lsr										; shift right 1 bit (* 8)
	sta Digit0,x							; store pointer lo byte
	lda #>DigitsFont
	sta Digit0+1,x							; store pointer hi byte
	inx
	inx										; next bitmap pointer
	lda Score,y								; get BCD value (again)
	and #$f									; isolate low nibble
	asl
	asl
	asl										; * 8
	sta Digit0,x							; store pointer lo byte
	lda #>DigitsFont
	sta Digit0+1,x							; store pointer hi byte
	inx
	inx										; next bitmap pointer
	dey										; next BCD value
	bpl .DigitPointerLoop					; repeat until < 0
	rts
 
; Display the resulting 48x8 bitmap
; using the Digit0-5 pointers.
DrawDigits
	lda #%00000011
	sta NUSIZ0								; player0 three copies - close
	sta NUSIZ1								; player1 three copies - close
	sta WSYNC								; wait for sync
	lda #7
	sta DrawDigitsLoopCounter
.DrawDigitsLoop
    ;                           Cycles  Pixel    GRP0   GRP0A   GRP1   GRP1A
    ; --------------------------------------------------------------------
	ldy  DrawDigitsLoopCounter  ; +3  64  192
	lda  (Digit0),y             ; +5  69  207
	sta  GRP0                   ; +3  72  216      D1     --      --     --
	sta  WSYNC                  ; +3  75  225
    ; --------------------------------------------------------------------
	lda  (Digit0+2),y           ; +5   5   15
	sta  GRP1                   ; +3   8   24      D1     D1      D2     --
	lda  (Digit0+4),y           ; +5  13   39
	sta  GRP0                   ; +3  16   48      D3     D1      D2     D2
	lda  (Digit0+6),y           ; +5  21   63
	sta  Temp                   ; +3  24   72
	lda  (Digit0+8),y           ; +5  29   87
	tax                         ; +2  31   93
	lda  (Digit0+10),y          ; +5  36  108
	tay                         ; +2  38  114
	lda  Temp                   ; +3  41  123              !
	sta  GRP1                   ; +3  44  132      D3     D3      D4     D2!
	stx  GRP0                   ; +3  47  141      D5     D3!     D4     D4
	sty  GRP1                   ; +3  50  150      D5     D5      D6     D4!
	sta  GRP0                   ; +3  53  159      D4*    D5!     D6     D6
	dec  DrawDigitsLoopCounter  ; +5  58  174                             !
	bpl  .DrawDigitsLoop        ; +3  61  183
    ; --------------------------------------------------------------------
    ; At the *, the value written to GRP0 does not matter. What does matter is
    ; that this write triggers GRP1A to receive new contents from GRP1.  A "!"
    ; indicates that that register is being used for displaying at that moment.

	lda #0									; clear the sprite registers
	sta GRP0								; clear player0 sprite
	sta GRP1								; clear player1 sprite
	sta GRP0
	sta GRP1
	lda #%00000000
	sta NUSIZ0								; player0 one copy
	sta NUSIZ1								; player1 one copy
	rts

Source: https://www.dropbox.com/s/3fgdex1wvhj183z/source.asm?dl=1

Binary: https://www.dropbox.com/s/vyakffargbdi8ap/duckgame.bin?dl=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...