Jump to content
IGNORED

7 Digit Full Sized Score Display


Recommended Posts

A few years ago I wrote a 7 byte score display for a game I was working on. Time went by and the game got forgotten, but recent thoughts on using TIM1T as a storage container reminded me of where I first used the trick. I decided to strip score display out of my game and make it available to everyone.

 

 

The motivation behind the display is that I always wanted to have a score go from 0 to 9,999,999 on the Atari. I wanted to have no flicker in the score, any background color, and regular sized digits. This routine accomplishes all these things, and has a small library of different fonts you can choose from for the digits. You can also custom build your own fonts and add them to the library with an included excel sheet.

 

 

The program uses a lot of rom because it doesn't loop... It could easily be made to loop with DPC+, but I don't have the time to take that on. Looping would cause some incompatibilities with a couple of the fonts in the library (two for digit 2, and one for digit 7). Still DPC+ would be good for handling this routine.

 

 

Please feel free to use code in any shape or form, modify it, make it better, and so forth. I hope you enjoy my little demo!

 

Cheers,

Jeff

 

 

 

post-7074-0-87325400-1337568704_thumb.png

 

SevenFullSizedDigits.zip

  • Like 7
  • Thanks 2
Link to comment
Share on other sites

Nice!

 

I'd just posted a blog entry for score kernel suggestions, think this might be a way to get what I'm after. By using narrower digits (say 4or 5 pixels with 1 pixel spacing) I should be able to get a decent sized score, plus have some room to graphically showing lives remaining for both players.

Link to comment
Share on other sites

Speaking of the score, I always wanted to have commas in the score. Has anyone ever done that?

 

Hmm. For a 6 digit score, do this:

  1. design the digit graphics with just 5 or 6 pixels across (instead of the usual 7)
  2. position the ball to draw the comma
  3. turn on the ball when there's just 2 scanlines left of the score to draw
  4. HMOVE the comma 1 pixel left after the last line of the score is drawn
  5. show the ball just 1 additional scanline to get a single pixel offset from the previous 2.

Using this 7 digit score you'd need an extra comma, so do this:

  1. do 1-5 as above, but using a missile as well as the ball
  2. draw a playfield on both sides of the score
  3. color the playfield same as the screen
  4. give playfield priority over other objects to hide the extra copies of the missile.

If you're doing leading zero blanking then an easy way to blank the commas would be to use the playfield to hide them - that would simplify the enable ball/missile logic as you'd just always enabled them when there's 2 scanlines left.

 

Another variation (for the 6 digit score) might be to use the usual 7-pixel digit graphics, but put the 1 pixel spacing on the right side of the left 3 digits and on the left side of the right 3 digits. This would create a 2 pixel gap, between the two groups of three digits, to put the comma in.

Edited by SpiceWare
  • Like 1
Link to comment
Share on other sites

Nice!

 

I'd just posted a blog entry for score kernel suggestions, think this might be a way to get what I'm after. By using narrower digits (say 4or 5 pixels with 1 pixel spacing) I should be able to get a decent sized score, plus have some room to graphically showing lives remaining for both players.

 

Have you considered doing some RESxx bashing, and then masking portions of the digits with the playfield? Thomas did this in his Sudoku Kernel. I think Supercat was the creator of this technique, but I couldn't find his "score16" routine anywhere. If someone could post a link I would love to see it. I think the idea of drawing the full digit and then masking it is absolutely brilliant. It's like a seven segment display. :D

 

Michael also had some great ideas for positioning GRPx objects here.

 

 

I wrote a small demo based off of these ideas. I'm not doing any of the masking, just trying to find some alignment... I'm off by two pixels on the right side, but it might not be too noticable. The ball and missiles are still free. Anyhow this might give you some ideas for building your routine without using any flicker.

 

 

post-7074-0-35875300-1337657994_thumb.png

Two Scores.zip

Link to comment
Share on other sites

Ooh - that's slick. :thumbsup:

 

Doesn't look like there's time to change color between scores as you have to use that time to update the playfield. A way to help reinforce which score belongs to which player would be to draw a lines above and/or below each score using the playfield and and color them via SCORE mode.

Edited by SpiceWare
Link to comment
Share on other sites

Ooh - that's slick. :thumbsup:

 

Doesn't look like there's time to change color between scores as you have to use that time to update the playfield. A way to help reinforce which score belongs to which player would be to draw a lines above and/or below each score using the playfield and and color them via SCORE mode.

There is a possibility. Switch philosophies. Use both players and and Playfield as masks, I.e. inverted player graphics. Use score mode, but not priority. Make both player colors the same, and it colors the Playfield too. Then just update color for background. I tried to update background color last night. It was a few cycles too earlier. With score you could use the ball, have ball same color as left side digits. Might just make it by placing ball on last digit on left side. Leave ball enabled all the time. Cover up rest of background with Playfield.

 

I only had the last week for Atari. No more time left for me to program for next two months or so. I will enjoy the development of Space rocks though. :)

Link to comment
Share on other sites

There is a possibility. Switch philosophies. Use both players and and Playfield as masks, I.e. inverted player graphics.

Hmm - I've been reviewing the code to see exactly what's going on. Very clever use of the missiles (and player/missile overlap) to create the "lives" digit. I really want to show lives but, unless I'm missing something, I don't think the inverted technique is would be compatible with using the missiles.

 

I only had the last week for Atari. No more time left for me to program for next two months or so. I will enjoy the development of Space rocks though. :)

Thanks!

Link to comment
Share on other sites

Hmm - I've been reviewing the code to see exactly what's going on. Very clever use of the missiles (and player/missile overlap) to create the "lives" digit. I really want to show lives but, unless I'm missing something, I don't think the inverted technique is would be compatible with using the missiles.

 

No, you're right. I was thinking and typing real quick, and the more I thought about it today the more problems appeared (no to mention time to do all the updates!). To build inverted digits with the missiles you'll need three parts... left side, middle (this also is 3 pixels wide!), right side. This doesn't work well. Also there would be gaps around the sides of the end digits of the players gfx, and gaps in between them. This is too bad, because the ball would have nicely covered that last digit on the left side, and you wouldn't have to mess with the ball at all during the routine.

 

 

That routine was thrown together quickly this morning as I woke up with it in my head, and it was all clear. It was a real rush job of sloppy nops, Ha Ha, but the concept is there. ;) I like the solution because in never uses HMOVE, thus no comb lines, thus any background color looks nice. It does use a bit more time as one of the missiles has to be re-sized, and the other enabled/disabled but the covering up of them is basically free since you have to update the playfield registers anyhow, and like you said the third copy overlaps one of the other digits so it hides itself.

 

 

I hope I gave you some decent ideas for Space Rocks Darrell! Looking forward to it!!

Cheers,

Jeff

Link to comment
Share on other sites

That routine was thrown together quickly this morning as I woke up with it in my head, and it was all clear. It was a real rush job of sloppy nops, Ha Ha, but the concept is there. ;) I like the solution because in never uses HMOVE, thus no comb lines, thus any background color looks nice. It does use a bit more time as one of the missiles has to be re-sized, and the other enabled/disabled but the covering up of them is basically free since you have to update the playfield registers anyhow, and like you said the third copy overlaps one of the other digits so it hides itself.

 

 

I hope I gave you some decent ideas for Space Rocks Darrell! Looking forward to it!!

 

I love all of this brainstorming and cooperation.

 

 

New band name:

 

Rush Job of Sloppy Nops

  • Like 1
Link to comment
Share on other sites

very promising. Main issue is it's taller than the original score routine, so the screen's now 271 scanlines instead of 262.

post-3056-0-87511500-1337738803_thumb.png

 

I can resize the side segments, if I bring it down to 263 scanlines the digits look too squished.

post-3056-0-63549600-1337738870_thumb.png

 

265 and 267 don't look too bad.

post-3056-0-61116000-1337738979_thumb.png post-3056-0-20008300-1337738940_thumb.png

 

And here's 269, just for grins

post-3056-0-33700300-1337739597_thumb.png

 

Any preferences?

 

I'll need to decide how to compensate for that - shrink the playing area and/or shrink the Vertical Blank and Overscan areas. I could also drop the lower colored line, though I really like how that turned out. The upper colored line will stay no matter what as that's when the prep to display the score occurs.

 

After that I'll have to revise the routine to not use LDA #<SHAPE_DASH and LDA #<SHAPE_SIDES as that conflicts with the use of Fast Fetch mode (I've disabled Fast Fetch mode to get the initial routines working). Easy fix will be to put the figure 8 graphics into a data stream.

 

And finally I'll have to add some datastreams to control the playfields.

Edited by SpiceWare
Link to comment
Share on other sites

Finally got the score routine working, new builds are in my blog. 2 player routines aren't finished yet, so player 1's information is shown on both sides for testing. Left Difficulty set to A will display test digits instead. Score is not wiped out though, so switch back to B to show your current score.

 

I also changed the ship to Purple as it contrasts better with the green.

post-3056-0-72390700-1337909265_thumb.png

 

I tried to set it up as a loop, but was short 3 cycles.

		lax DS_PF0L_ENAM1   ; 4 62
	sta PF0			 ; 3 65
	ldy DS_NUSIZ0	   ; 4 69
	lda #<DS_SCORE8	 ; 2 71
loop:
	sta GRP0			; 3 74
	asl				 ; 2 76/0
	sta GRP1			; 3  3
	sty NUSIZ0		  ; 3  6
	stx ENAM1		   ; 3  9
	lda #<DS_PF1L	   ; 2 11
	sta PF1			 ; 3 14 - must be before 28 or after 65
	lda #<DS_PF2L	   ; 2 16
	sta PF2			 ; 3 19 - must be before 38
	sta RESP0		   ; 3 22 - must be at 22
	sta RESP1		   ; 3 25 - must be at 25
	sta RESP0		   ; 3 28 - must be at 28
	sta RESP1		   ; 3 31 - must be at 31
	lda #<DS_PF0R	   ; 2 33
	sta PF0			 ; 3 36
	lda #<DS_PF1R	   ; 2 38
	sta PF1			 ; 3 41
	lda #<DS_PF2R	   ; 2 43
	sta RESP0		   ; 3 46 - must be 46
	sta RESP1		   ; 3 49 - must be 49
	sta RESP0		   ; 3 52 - must be 52
	sta RESP1		   ; 3 55 - must be 55
	sta PF2			 ; 3 58
	lax DS_PF0L_ENAM1   ; 4 62
	sta PF0			 ; 3 65
	ldy DS_NUSIZ0	   ; 4 69
	lda #<DS_SCORE8	 ; 2 71
			bne loop  ; 3 74 - drat, don't have the 3 cycles for the branch  

 

For the moment I just repeat the section 11 times:

		repeat 11
	lax DS_PF0L_ENAM1   ; 4 62
	sta PF0			 ; 3 65
	ldy DS_NUSIZ0	   ; 4 69
	lda #<DS_SCORE8	 ; 2 71
	sta GRP0			; 3 74
	asl				 ; 2 76/0
	sta GRP1			; 3  3
	sty NUSIZ0		  ; 3  6
	stx ENAM1		   ; 3  9
	lda #<DS_PF1L	   ; 2 11
	sta PF1			 ; 3 14 - must be before 28 or after 65
	lda #<DS_PF2L	   ; 2 16
	sta PF2			 ; 3 19 - must be before 38
	sta RESP0		   ; 3 22 - must be at 22
	sta RESP1		   ; 3 25 - must be at 25
	sta RESP0		   ; 3 28 - must be at 28
	sta RESP1		   ; 3 31 - must be at 31
	lda #<DS_PF0R	   ; 2 33
	sta PF0			 ; 3 36
	lda #<DS_PF1R	   ; 2 38
	sta PF1			 ; 3 41
	lda #<DS_PF2R	   ; 2 43
	sta RESP0		   ; 3 46 - must be 46
	sta RESP1		   ; 3 49 - must be 49
	sta RESP0		   ; 3 52 - must be 52
	sta RESP1		   ; 3 55 - must be 55
	sta PF2			 ; 3 58
	repend

Edited by SpiceWare
Link to comment
Share on other sites

Darrell, do you have a Fast Fetch register available? I think you can store to NUSIZ0 earlier (I haven't tried). So, no need to use Y, use A and then load the graphics. Then you can do the loop and have a free cycle left too.

 

 

 

;old

#@58
 lax DS_PF0L_ENAM1 #4 62
 sta PF0		   #3 65
 ldy DS_NUSIZ0	 #4 69
 lda #<DS_SCORE8   #2 71
 sta GRP0		  #3 74
 asl			   #2 76/0
 sta GRP1		  #3  3
 sty NUSIZ0		#3  6

;new
#@61
 lax DS_PF0L_ENAM1 #4 65
 sta PF0		   #3 68
 lda <#DS_NUSIZ0   #2 70
 sta NUSIZ0		#3 73
 lda #<DS_SCORE8   #2 75
 sta GRP0		  #3 2
 sta.w GRP1		#4 6   1 free cycle

 

 

I'm using '#' to keep the spacing aligned in the code box.

 

 

Edit: # still didn't work. The forum software really screws the code box up.

Edited by Omegamatrix
Link to comment
Share on other sites

So down to 1 cycle now.

 

Saved 2 more - getting rid of that ASL allowed me to use LDA #< instead of preloading with Y. This change is already in place and confirmed to work :D

 

		lax DS_PF0L_ENAM1   ; 4 65
	sta PF0			 ; 3 68
	lda #<DS_SCORE8	 ; 2 70
ScoreLoop:		
	sta.w GRP0		  ; 4 74
	sta GRP1			; 3 77/1
	lda #<DS_NUSIZ0	 ; 2  3
	sta NUSIZ0		  ; 3  6
	stx ENAM1		   ; 3  9
	lda #<DS_PF1L	   ; 2 11
	sta PF1			 ; 3 14 - must be before 28 or after 65
	lda #<DS_PF2L	   ; 2 16
	sta PF2			 ; 3 19 - must be before 38
	sta RESP0		   ; 3 22 - must be at 22
	sta RESP1		   ; 3 25 - must be at 25
	sta RESP0		   ; 3 28 - must be at 28
	sta RESP1		   ; 3 31 - must be at 31
	lda #<DS_PF0R	   ; 2 33
	sta PF0			 ; 3 36
	lda #<DS_PF1R	   ; 2 38
	sta PF1			 ; 3 41
	lda #<DS_PF2R	   ; 2 43
	sta RESP0		   ; 3 46 - must be 46
	sta RESP1		   ; 3 49 - must be 49
	sta RESP0		   ; 3 52 - must be 52
	sta RESP1		   ; 3 55 - must be 55
	sta PF2			 ; 3 58
	lax DS_PF0L_ENAM1   ; 4 62
	sta PF0			 ; 3 65
	lda #<DS_SCORE8	 ; 2 67
	bne ScoreLoop	   ; 3 70

Link to comment
Share on other sites

Darrell, do you have a Fast Fetch register available?

Yep - we had the same idea, this reply popped up while I was typing in mine with the new loop code :D

 

Edit: # still didn't work. The forum software really screws the code box up.

Yeah, it's aggravating at times.

Link to comment
Share on other sites

I haven't tested your rom yet, but chopping off the left edge of the bars seems like a good idea. If you do get rid of hmoves then maybe that's where the left boundary should start (4 pixels in)?

 

 

Since you are in score mode while drawing the bars you could further create the illusion of symmetry by adjusting where each color starts. Chop out the middle PF blocks, have the background color the same as the left side, and have the ball colored the same as the right side and align it 2 pixels off center.

 

 

I also notice on a real TV that games which use score have a bright middle pixel where the color changes. This might fix that too.

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