Jump to content
salzmafia.com

Three - two digit scores

Recommended Posts

Hi, I've searched and searched, and I found a thread that had a couple different score kernels/modules to separate the score into two - 3 digit scores, but I need the opposite, I need 3 two digit scores. Right now, in my code the left two digits represent player one, the two in the middle are a timer, and the two on the right are player 2's score. If I can separate all three sets that would be awesome! I.E From 129912 to 12 99 12 something like that would be perfect! Any help would be appreciated!

Share this post


Link to post
Share on other sites

The kernel would need minor adjustments, namely:

  • set NUSIZ0 and NUSIZ1 to 6 instead of 3
  • hit RESP0 and RESP1 a little earlier in the scanline to shift the digits left
  • adjust the timing of the updates to GRP0 and GRP1

I just took a look and the main issue would be which kernel are you using as they each have their own copy of the score display code.

  • Like 1

Share this post


Link to post
Share on other sites

Hi, I've searched and searched, and I found a thread that had a couple different score kernels/modules to separate the score into two - 3 digit scores

Just for reference, would you mind linking to those mini-kernels you mentioned?

Share this post


Link to post
Share on other sites

Spreading the score digits is easy, and you don't need to use VDELPx anymore, as there is already enough time to update the digits. I made a small assembly demo. Yellow digits are drawn with P0, Green digits are P1.

 

 

post-7074-0-12669000-1375415883_thumb.png

 

SixScoreSpread.zip

  • Like 1

Share this post


Link to post
Share on other sites

Is it a simple matter to display the score anywhere? That is, if we wanted the score at the top rather than the bottom?

 

Great to hear it's simple, though it makes sense, really, since spreading them apart just means wasting some time between them getting drawn.

Share this post


Link to post
Share on other sites

Not simple - if the score's moved to the top then all the sprite prep your bB code does (color, size, reflection, position, etc) would get blown away by the routine that displays the score.

  • Like 1

Share this post


Link to post
Share on other sites

Okay, here you go. If you open score_graphics.asm, you will see all I did was made it drop down 8 bytes in the rom, say from $FF94 to $FF8C. Next I added in a blank digit right at the end, so now the graphics go 0-9 and then a blank digit appears.

 

 

The tricky part was getting BB to blank a digit. It would not compile a blank digit with the score command, probably it gets garbled as it is expecting a value of 0-9 for each digit.

 

 

In the end I fell back on what I know, so a little assembly. :) I only tested this with the multisprite, and it works... but depending on how you are adding values and stuff you might want to place zeros into the middle two digits before performing operations and then convert back to blanks afterwards. That theory is untested, and I'm just anticipating a problem before I've looked to see if it's there.

 

 

score_graphics.zip

 

 

Example for blanking the middle two digits (3 and 4), with the multisprite kernel:

(score lies in $D1, $D2, and $D3 in ram)

main
 score = 123456

 asm
 lda #$AA ; blank digits three and four
 sta $D2
end

 

 

Example for blanking the middle two digits (3 and 4), with the standard kernel:

(score lies in $93, $94, and $95 in ram)

 

main
 score = 123456

 asm
 lda #$AA ; blank digits three and four
 sta $94
end

 

Example for blanking the digit 5 only, with the standard kernel:

 

main
 score = 123456

 asm
 lda $95
 and #$0F ; keep digit six
 ora #$A0 ; and blank digit five
 sta $95
end

 

 

And finally what I was talking about with the zeros:

 

main

 rem make score valid BCD again...

 asm
 lda #$00 ; zero digits three and four
 sta $94
 end

 rem increment digits one and six

 score = score + 100001

 rem score is updated, now screw with it by blanking middle digits

 asm
 lda #$AA ; blank digits three and four
 sta $94
end

  • Like 1

Share this post


Link to post
Share on other sites

I figured out how to use a more BB way to modify the digits. I dim'ed some variables and made some constants for the standard kernel. Note that you still need to use the modified score_graphics.asm file I made in the last post.

 

 

 dim scrDigit1and2 = $93
 dim scrDigit3and4 = $94
 dim scrDigit5and6 = $95

 const ZERO_RIGHT_DIGIT = 0
 const BLANK_RIGHT_DIGIT = $0A
 const KEEP_RIGHT_DIGIT = $0F

 const KEEP_LEFT_DIGIT = $F0
 const ZERO_LEFT_DIGIT = 0
 const BLANK_LEFT_DIGIT = $A0

 const BLANK_BOTH_DIGITS = $AA

 

Then inside the code I modified the score. For example, if I wanted to blank digit five only:

 

 scrDigit3and4 = BLANK_LEFT_DIGIT | (scrDigit3and4 & KEEP_RIGHT_DIGIT)

 

However, if I want to do some math with score, then I have to first change digit 5 back to a zero:

 

 scrDigit3and4 = ZERO_LEFT_DIGIT | (scrDigit3and4 & KEEP_RIGHT_DIGIT)

 

Blanking digits 5 and 6 together:

 scrDigit3and4 = BLANK_BOTH_DIGITS

 

Zeroing digits 5 and 6 together:

 scrDigit3and4 = 0

  • Like 1

Share this post


Link to post
Share on other sites

I figured out how to use a more BB way to modify the digits. I dim'ed some variables and made some constants for the standard kernel. Note that you still need to use the modified score_graphics.asm file I made in the last post.

 

 

This worked perfectly! Thanks! At first I kept having digit 4 flicker a 9, but then moved the code just before drawscreen and it solved it.

Share this post


Link to post
Share on other sites

I woke up this morning wondering why I did this:

 

 scrDigit3and4 = ZERO_LEFT_DIGIT | (scrDigit3and4 & KEEP_RIGHT_DIGIT)

 

When you should be able to just do this, and save bytes:

 

 scrDigit3and4 = (scrDigit3and4 & KEEP_RIGHT_DIGIT)

 

 

Alot of games have a routine which blanks preceding zeros for their score. Essentially it is just a loop that goes through each digit (starting with the highest value), and if it finds a zero it makes it a blank. At the first non-zero, or if the final digit is a zero, it breaks. This routine is done on the pointers to the digit graphics, after the digit graphic pointers have be found.

Share this post


Link to post
Share on other sites

This worked perfectly! Thanks! At first I kept having digit 4 flicker a 9, but then moved the code just before drawscreen and it solved it.

 

I spoke to soon... once a digit (lets say 5 and 6) get between 10 - 15 the score graphics get scrambled then correct themselves at 16. What could I be doing wrong?

Share this post


Link to post
Share on other sites

I spoke to soon... once a digit (lets say 5 and 6) get between 10 - 15 the score graphics get scrambled then correct themselves at 16. What could I be doing wrong?

 

You probably aren't setting the digits you made blank back to zero before operating on the score. BCD is valid from 0-9, so the blank value is scrambling the routine.

Share this post


Link to post
Share on other sites

There has now been a change in direction, how about just hiding the two center digits?

 

Question - are you ALWAYS hiding the 2 center digits?

 

If so then there's no reason to draw them, and thus no need to blank them out. To do this set NUSIZ0 and NUSIZ1 to 4.

  • Like 1

Share this post


Link to post
Share on other sites

You probably aren't setting the digits you made blank back to zero before operating on the score. BCD is valid from 0-9, so the blank value is scrambling the routine.

 

Yeah, it was something like that.. Problem solved! Thanks again for everyone's help!

Share this post


Link to post
Share on other sites

Question - are you ALWAYS hiding the 2 center digits?

 

If so then there's no reason to draw them, and thus no need to blank them out. To do this set NUSIZ0 and NUSIZ1 to 4.

 

This is the best solution, and requires the least intrusion and bytes. You don't need to use the modified score_graphics.asm file, and you don't need to do anything special in the code.

 

However, to keep the score centered (as is) use set NUSIZ0 and NUSIZ1 to 2 (two copies medium). Using 4 sets the values for NUSIZx to two copies wide, which would require more alterations in the kernel to center it.

 

 

In the standard kernel change search for "NUSIZ0", and change this:

 

 LDA #$03
 STA NUSIZ0
 STA NUSIZ1
 STA VDELP1

 

To this:

 LDA #$02
 STA NUSIZ0 ; set to 2 copies medium
 STA NUSIZ1
 STY VDELP1 ; Y=7, use delay

Share this post


Link to post
Share on other sites

Played some Time Warp for the HSC last night and noticed their 6 digit score routine doesn't use VDEL.

post-3056-0-76090400-1375634117_thumb.jpg

 

post-3056-0-85497100-1375634136_thumb.png

 

Don't recall seeing any other games using this method. One benefit I can think of is you can use all 8 pixels when designing the font as there's no longer a need for a blank spacing pixel.

Share this post


Link to post
Share on other sites

Played some Time Warp for the HSC last night and noticed their 6 digit score routine doesn't use VDEL.

Don't recall seeing any other games using this method. One benefit I can think of is you can use all 8 pixels when designing the font as there's no longer a need for a blank spacing pixel.

Time Warp is one of my favorite games, and not just because it was also released by Zellers, lol. I never noticed the spread score myself. I don't remember a blank spacing pixel ever being needed for six byte score routines, and the 48 bit maps all seem to have no blank space pixel required. What routine do you need the blank spacing pixel for?

Share this post


Link to post
Share on other sites

What routine do you need the blank spacing pixel for?

 

 

With a spacing pixel you get this:

post-3056-0-69059600-1375635547_thumb.png

 

If you use all 8 pixels without a spacing pixel the digits run together:

post-3056-0-38504300-1375635674_thumb.png

Share this post


Link to post
Share on other sites

With a spacing pixel you get this:

post-3056-0-69059600-1375635547_thumb.png

 

If you use all 8 pixels without a spacing pixel the digits run together:

post-3056-0-38504300-1375635674_thumb.png

 

Ah, I gotcha now. Sorry for the confusion. At first I thought the implication was that a blanking pixel was needed or the graphics would be corrupted when the next copies graphics was loaded. Now I understand what you mean.

Share this post


Link to post
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.

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