Jump to content
potatohead

How much is BCD mode used on VCS games?

Recommended Posts

I'd say 90% or better of the titles that feature at least one 2-digit onscreen counter do...it's just more efficient. The best-known example of a game that doesn't use decimal mode at all is River Raid, I suppose (neither does Pesco for a more-recent example).

Share this post


Link to post
Share on other sites
I'd say 90% or better of the titles that feature at least one 2-digit onscreen counter do...it's just more efficient. The best-known example of a game that doesn't use decimal mode at all is River Raid, I suppose (neither does Pesco for a more-recent example).

 

If one is trying to save RAM by storing two digits per byte, BCD mode is the only practical way to go. If one isn't trying to save RAM in such a fashion, other approaches may be better. For example, if one can spare 12 bytes to keep pointers to digit shapes "full time", and if one were always adding a multiple of a power of ten points at a time, one could do something like:

AddScore:; Assume X points to the digit to be bumped, and accumulator holds 7*value to add.
; The LSB of each digit pointer is are 186+7*digit
 clc
AddScore_lp:
 adc score,x
 bcc done_adding
 sbc #70
 sta score,x
 lda #7
 dex
 dex
 bpl AddScore_lp
; Score is over 999,999 so do something with that...
done_adding:
 sta score,x
 rts

Note that this approach is easily adaptable for any size score digit, unlike BCD approaches which usually require that digit shapes be stored at 8-byte intervals.

Share this post


Link to post
Share on other sites

You don't need 12 bytes. One particularly thrifty method is to store the sole indirect vector as the end of the bitmap of zero...which is placed on a page break. When displaying the score, pull the y value for each digit (which would be the start of the bitmap for that number), then lda (vector),y. The LSB of the vector can serve double-duty here, both as a means to grab bitmap data, and also to count down the number of displayed lines (just DEC the LSB of the vector until it falls negative). FOX liked to used that method in it's games.

 

Of course, it's only thrifty in the sense that 12 bytes of temp ram could not be utilized someplace else. That blank gap between score and game screen is often shuffling screen data into these...or otherwise using it for stack ram. So you end up with 3 bytes of BCD score, which are passed only temporarily into six 2-byte vectors (and which can be reused for other things when not drawing the score). In that sense, squeezing 6 sprites into 3 bytes of ram is pretty tough to beat ;)

Share this post


Link to post
Share on other sites

Medieval Mayhem doesn't use BCD. The digits are 7 scanlines, so each time you score a point 7 is added to the player's Score variable.

 

I allocated 2 bytes per player's score (so 8 total). The high bytes are used as "scratch" variables throughout the game. They get set to the page the Digit graphics are stored on just before the scores are drawn.

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