Jump to content
IGNORED

How to set initial score using this kernel?


IuriNery

Recommended Posts

Hello everyone,

 

I'm making a software to build atari games, I already managed to make the players show in the screen with the help of some people on this other thread (http://atariage.com/forums/topic/291513-loop-through-table-every-x-lines/), and now I'm trying to implement a 6 digit kernel I found on the internet.

 

I've managed to show the score on the screen, but I'm not being able to change the numbers of the score.

 

post-59407-0-37267500-1559326164_thumb.jpg

 

I tried changing the "score" variable but no success. I also tried changing the "score+1" and "score+2", but when I load a value into it like: "LDA #8", I have to store this value on both pointers to be able to show a different number on the score, and the result is still wrong, it shows something like this: "080808" instead of "000008".

 

Here is the score kernel I found:

DrawScore

 lax score+0
 jsr miniscorepointerset
 sty scorepointers+8 
 stx scorepointers+0
 lax score+1
 jsr miniscorepointerset
 sty scorepointers+4
 stx scorepointers+6
 lax score+2
 jsr miniscorepointerset
 sty scorepointers+10
 stx scorepointers+2 

 sta HMCLR
 tsx
 stx stack1 
 ldx #$B0
 stx HMP0

 ldx #0
 sta WSYNC 		; 0
 STx GRP0 		; 3
 STx GRP1 ; seems to be needed because of vdel ; 6

 sleep 5		; 13

 lda #>ScoreGfx
 sta scorepointers+1
 sta scorepointers+3		; 22
 sta scorepointers+5,x
 sta scorepointers+7,x
 sta scorepointers+9,x
 sta scorepointers+11,x		; 38


                LDY #7		; 41
                sleep 2
                STA RESP0	; 44
                STA RESP1	; 47


        LDA #$03
        STA NUSIZ0
        STA NUSIZ1
        STA VDELP0
        STA VDELP1
        ;LDA #$20
        LDA #$C0
        STA HMP1				; 68
hmovebreak
               LDA #SCORE_COLOR 	; 71
               sleep 3
                STA HMOVE ; cycle 73 ?
 ifconst score_kernel_fade
	and score_kernel_fade
 endif

                STA COLUP0
                STA COLUP1

 lda  (scorepointers),y
 sta  GRP0
 lda  (scorepointers+,y
 sleep 54
; sta WSYNC
; sleep 2				; 2
 jmp beginscoreloop		; 5

 if ((<*)>$28)
 align 256 ; kludge that potentially wastes space!  should be fixed!
 endif

scoreloop2
         lda (scorepointers),y ;+5 68 204
         sta GRP0 ;+3 71 213 D1 -- -- --
         ifconst pfscore
             lda.w pfscore1
             sta PF1
         else
             sleep 7
         endif
         ; cycle 0
beginscoreloop
         lda (scorepointers+$,y ;+5 5 15
         sta GRP1 ;+3 8 24 D1 D1 D2 --
         lda (scorepointers+$6),y ;+5 13 39
         sta GRP0 ;+3 16 48 D3 D1 D2 D2
         lax (scorepointers+$2),y ;+5 29 87
         txs
         lax (scorepointers+$4),y ;+5 36 108

         sleep 3

         ifconst pfscore
             lda pfscore2
             sta PF1
         else
             ifconst scorefade
                 sta COLUP0
                 sta COLUP1
             else
                 sleep 6
             endif
         endif

         lda (scorepointers+$A),y ;+5 21 63
         stx GRP1 ;+3 44 132 D3 D3 D4 D2!
         tsx
         stx GRP0 ;+3 47 141 D5 D3! D4 D4
         sta GRP1 ;+3 50 150 D5 D5 D6 D4!
         sty GRP0 ;+3 53 159 D4* D5! D6 D6
         dey
 bpl  scoreloop2           ;+2  60  180
scoreloop2end	; 53

 ;echo "critical size: ",(scoreloop2end-scoreloop2)


 ldx stack1 
 txs

        LDA #0   
        sta PF1
        STA GRP0
        STA GRP1
        STA VDELP0
        STA VDELP1
        STA NUSIZ0
        STA NUSIZ1

 ; clear out the score pointers in case they're stolen DPC variables...
 ldx #11
clearscoreploop
 sta scorepointers,x
 dex
 bpl clearscoreploop

 
 ;;ldy temp3
; ldy scorepointers+8
; sty scorepointers+3

 ;;ldy temp5
; ldy scorepointers+10
; sty scorepointers+5
 rts

miniscorepointerset
 and #$0F
 asl
 asl
 asl
 adc #<ScoreGfx
 tay
 txa
 and #$F0
 lsr
 adc #<ScoreGfx
 tax
 rts

I'm also going to attach the SOURCE and BIN files for the project if someone wants to take a look.

 

If someone can help me showing where is the problem I would appreciate that.

 

test_project.zip

test_project.bin

Link to comment
Share on other sites

That looks familiar. It's the score mini-kernel for the bB titlescreen kernel (based on the bB score code), except some of the values have been tweaked to change the score position without changing the timing of the 6 digit kernel itself. This is why you're having trouble changing the digits.

 

Grab the working copy from this thread and you'll be able to adjust scores like...

 

; add 10 to the score...
 sed ; enable decimal mode for addition of BCD digits
 clc
 lda score+2 ; add 10 to the right-most score digit pair...
 adc #$10
 sta score+2
 lda score+1 ; add any carry to the middle score digit pair...
 adc #0
 sta score+1
 lda score+0 ; add any carry to the left-most score digit pair...
 adc #0
 sta score+0
 cld ; turn off decimal mode


; set the score to 123456...
 lda #$12
 sta score+0
 lda #$34
 sta score+1
 lda #$56
 sta score+2
Link to comment
Share on other sites

Hey RevEng, thanks for helping me out.

Good job on the TitleScreen kernel, looks awesome, but I assume it doesn't work for 4kb games because of rom space?

 

 

About the Score Kernel, I downloaded the latest one from the link you provided, and it seems to work, but the first digit has some glitch, please take a look:

 

post-59407-0-00454000-1559400377_thumb.png

 

I tried changing the digit from "LDA #$12" to "LDA #$22" to check if the problem is with the "1" sprite, but the same glitch happens. Do you know what could be the cause?

 

Thanks!

 

EDIT: Ok, I tried changing this line: "sleep 7" to "sleep 6" and it worked!

Edited by IuriNery
Link to comment
Share on other sites

Yeah I do... We recently updated timing in that code for compatibility with some oddball TIAs. Looks like an unintended consequence.

 

The change of graphic for the first digit to the third is happening a bit early, according to the emulator. Which emulator and version are you running?

Link to comment
Share on other sites

Hi,

 

I'm using the z26 emulator for my software, but I've tested on both z26 & Stella, and they both reproduce the same thing.

 

I also tested in the original hardware using the Harmony cartridge, and the glitch happens on both situations (using sleep 6 and 7), but it seems like it's worst using the original value:

 

Using Sleep 7 (Original):

post-59407-0-14679100-1559404798.jpg

 

Using Sleep 6:

post-59407-0-97577400-1559404787.jpg

 

 

I'm also attaching the .BIN files below.

PAC_ATARI_SLEEP6.bin

PAC_ATARI_SLEEP7.bin

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