# Remove 2nd digit from score?

batari score manipulation

12 replies to this topic

### #1 salzmafia.comOFFLINE

salzmafia.com

Star Raider

• 54 posts

Posted Wed Feb 7, 2018 5:09 PM

Hi,

I'm looking for a simple way to remove the 2nd digit from the score in Batari Basic.  So instead of having "000000" it will look like "0 0000".  Any help or pointers in the right direction would be most appreciated!

Thanks!

### #2 SignGuy81OFFLINE

SignGuy81

Stargunner

• 1,685 posts
• Location:Bassett, VA

Posted Wed Feb 7, 2018 5:45 PM

I've never programmed for the Atari 2600 so going about this may be completely different than what I would be thinking.  But I would think if I have a 6 digit number I would want to divide the number by 100,000 and that without the remainder would be the digit to the left that a variable would be assigned to for use with that one digit by itself.  Then for the other I would take the the total score and subtract the (that variable times 100,000) and what would be left would be the the 5 digit number, then divide that by 10,000 and that gives you the value for digit 5 and store it as a variable, so then you could take the 5 digit number and subtract the (that variable times 10,000), which will leave you with the 4 digit number that you can then display next.  Like I said though I've never programmed on the 2600 and there are other ways to do that also but I was trying to do it thinking of an easy to understand way to do it, if it can even be done like that on it I have no clue.

### #3 salzmafia.comOFFLINE

salzmafia.com

Star Raider

• Topic Starter
• 54 posts

Posted Wed Feb 7, 2018 5:48 PM

I've never programmed for the Atari 2600 so going about this may be completely different than what I would be thinking.  But I would think if I have a 6 digit number I would want to divide the number by 100,000 and that without the remainder would be the digit to the left that a variable would be assigned to for use with that one digit by itself.  Then for the other I would take the the total score and subtract the (that variable times 100,000) and what would be left would be the the 5 digit number, then divide that by 10,000 and that gives you the value for digit 5 and store it as a variable, so then you could take the 5 digit number and subtract the (that variable times 10,000), which will leave you with the 4 digit number that you can then display next.  Like I said though I've never programmed on the 2600 and there are other ways to do that also but I was trying to do it thinking of an easy to understand way to do it, if it can even be done like that on it I have no clue.

Thanks for the reply.  I have no concerns with the values of the score, I just need that 2nd digit to not be on the screen.  Even better - to have the 2nd and 3rd digit removed.

### #4 Lewis2907OFFLINE

Lewis2907

Moonsweeper

• 303 posts
• Location:Senatobia, MS

Posted Wed Feb 7, 2018 6:17 PM

Take a look at this and it should work.

http://atariage.com/...p/?fromsearch=1

### #5 SignGuy81OFFLINE

SignGuy81

Stargunner

• 1,685 posts
• Location:Bassett, VA

Posted Wed Feb 7, 2018 6:27 PM

I just wanted to show what I was trying to explain.

<?php
\$score = 728437;
echo "Example score is \$score<br>";
\$leftdigit = \$score / 100000;
\$leftdigitnoremainder = (floor(\$leftdigit));
\$fivedigits = \$score - (\$leftdigitnoremainder * 100000);
\$fifthdigit = \$fivedigits / 10000;
\$fifthdigitnoremainder =(floor(\$fifthdigit));
\$fourdigits = \$fivedigits - (\$fifthdigitnoremainder * 10000);
echo "\$leftdigitnoremainder \$fourdigits";

?>

You can put this in at http://phptester.net/ if you want to test it out.  I know it will be different programming I just wanted to explain the logic behind it.

Edited by SignGuy81, Wed Feb 7, 2018 6:29 PM.

### #6 Lewis2907OFFLINE

Lewis2907

Moonsweeper

• 303 posts
• Location:Senatobia, MS

Posted Wed Feb 7, 2018 6:43 PM

SignGuy,

Batari will also accept ASM, but I don't know how to program in it.

### #7 salzmafia.comOFFLINE

salzmafia.com

Star Raider

• Topic Starter
• 54 posts

Posted Wed Feb 7, 2018 6:51 PM

Thanks for the replies thus far.  Perhaps I'm not explaining myself well (which I often do :-) )   All i want to do is make the 2nd (or 2nd and 3rd digit) of the score not show.  I don't want to change the numbers into an inventory system - I need the number sprites to remain as they are.  In 2013 years ago I had posted a similar question about removing the center two numbers, and someone provided some ASM to do this and it worked great.  Unfortunately I don't have that code anymore, I can't find the thread, and even if I did I don't know if would help in this situation.

### #8 Karl GOFFLINE

Karl G

Dragonstomper

• 650 posts

Posted Wed Feb 7, 2018 8:20 PM

I recommend using RevEng's custom score_graphics.asm.  I've done this to have blank spaces at certain points in my project.  Let me know if you need any usage examples that aren't explained in this thread:

http://atariage.com/...re-graphicsasm/

### #9 SignGuy81OFFLINE

SignGuy81

Stargunner

• 1,685 posts
• Location:Bassett, VA

Posted Wed Feb 7, 2018 9:47 PM

I just wanted to show what I was trying to explain.

<?php
\$score = 728437;
echo "Example score is \$score<br>";
\$leftdigit = \$score / 100000;
\$leftdigitnoremainder = (floor(\$leftdigit));
\$fivedigits = \$score - (\$leftdigitnoremainder * 100000);
\$fifthdigit = \$fivedigits / 10000;
\$fifthdigitnoremainder =(floor(\$fifthdigit));
\$fourdigits = \$fivedigits - (\$fifthdigitnoremainder * 10000);
echo "\$leftdigitnoremainder \$fourdigits";

?>

You can put this in at http://phptester.net/ if you want to test it out.  I know it will be different programming I just wanted to explain the logic behind it.

I know it doesn't matter now because it is different but I thought either way I should correct my mistake I didn't think of earlier which is that in my code above I completely overlooked if any digit was a zero(oops) so I made some changes which work now

<?php
\$score = 192387; //any number up to six digits, don't put zeros in front like 023455, instead do 23455
echo "Example score is \$score<br>";

\$leftdigit = \$score / 100000;

\$leftdigitnoremainder = (floor(\$leftdigit));

\$fivedigits = \$score - (\$leftdigitnoremainder * 100000);
\$fifthdigit = \$fivedigits / 10000;
\$fifthdigitnoremainder =(floor(\$fifthdigit));
\$fourdigits = \$fivedigits - (\$fifthdigitnoremainder * 10000);

\$fourthdigit = \$fourdigits / 1000;
\$fourthdigitnoremainder =(floor(\$fourthdigit));
\$threedigits = \$fourdigits - (\$fourthdigitnoremainder * 1000);

\$thirddigit = \$threedigits / 100;
\$thirddigitnoremainder =(floor(\$thirddigit));
\$twodigits = \$threedigits - (\$thirddigitnoremainder * 100);

\$seconddigit = \$twodigits / 10;
\$seconddigitnoremainder = (floor(\$seconddigit));
\$onedigit = \$twodigits - (\$seconddigitnoremainder * 10);

\$firstdigit = \$onedigit / 1;
\$firstdigitnoremainder = (floor(\$firstdigit));

echo "\$leftdigitnoremainder \$fourthdigitnoremainder\$thirddigitnoremainder\$seconddigitnoremainder\$firstdigitnoremainder";

?>

Now any number you put for the first line for example \$score will come out in the format 0 0000, for example 845932 will provide 8 5932 as did with my first post but now 004056(put it in as 4056 though no zeroes in front) will come out correctly as 0 4056

edit:

Took me a bit but came up with a shorter version does same thing

<?php
\$score = 987693;// Example score
\$numdigits = strlen(\$score);
if(\$numdigits < 6){
}else{
}
do{
\$array[] = 0;
}
\$newarray = str_split(\$score);
\$place = 0;
do{

\$array[] = \$newarray[\$place];
\$numdigits --;
\$place ++;
}while (\$numdigits > 0);
echo "\$array[0] \$array[2]\$array[3]\$array[4]\$array[5]";

?>

Edited by SignGuy81, Wed Feb 7, 2018 11:48 PM.

### #10 salzmafia.comOFFLINE

salzmafia.com

Star Raider

• Topic Starter
• 54 posts

Posted Wed Feb 7, 2018 11:30 PM

I recommend using RevEng's custom score_graphics.asm.  I've done this to have blank spaces at certain points in my project.  Let me know if you need any usage examples that aren't explained in this thread:

http://atariage.com/...re-graphicsasm/

Not looking to change the font, or artificially "remove it" as a sprite.  I just don't want the 2nd digit drawn.  I found the original thread I was referring to here. http://atariage.com/...cs#entry2804136

### #11 salzmafia.comOFFLINE

salzmafia.com

Star Raider

• Topic Starter
• 54 posts

Posted Thu Feb 8, 2018 12:19 AM

Using that previous thread I figured it out.  Thank you everyone!

### #12 vidakOFFLINE

vidak

Moonsweeper

• 458 posts
• Location:Sydney, Australia

Posted Thu Feb 8, 2018 3:37 AM

You should explain how you did it!

### #13 Nukey ShayOFFLINE

Nukey Shay

Sheik Yerbouti

• 21,807 posts
• Location:The land of Gorch

Posted Thu Feb 8, 2018 5:37 AM

The thread reveals it.  Setting NUSIZ registers to 2 for 4 digits (0000), setting them to 4 for 2 pairs of digits (00  00).  Setting NUSIZ0 to 2 and NUSIZ1 to 3 would produce 0000 0.

#### 0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users