on 8/5/03 9:28 PM, Brian Crawford at nastybuttr@xxxxxxxxxxx wrote:
> Hi, I'm not big on programming the VCS, but I do program in other assembly
> languages. I am working on a game right now, and I am interested in how 2600
> programmers display the player's score. If someone coud give me a small
> routine or something like that, it would be greatly appreciated. Thanks.
>
The basic concept on the 2600 for scores is this. Using the BCD mode on the
6507, you store your score in a "hex" mode and use the upper 4 bits as the
first digit and the lower 4 bits as the second digit. Makes converting from
hex to decimal a matter of 4 LSR instrutions or an AND #$0F.
Here is some code.
Score DB 1 ;Current score
SED ;Use BCD math
CLC
LDA Score
ADC #$10 ;Add 10 points
ADC #$22 ;Add 22 points
ADC #$01 ;Add 1 point
STA Score
CLD ;Use binary math from now on
To draw...
LDA Score
LSR
LSR
LSR
LSR
; At this point A = 0 through 9 to display the score digit for the leftmost
number
LDA Score
AND #$0F
;Now you have 0 through 9 for the rightmost digit.
How you display the digit? That's another topic.
Burger
----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/