Help with Assembly: Pacman Game Counter Not Counting Numbers

  • Thread starter Thread starter $ @ l^l^l @ R
  • Start date Start date
  • Tags Tags
    Assembly
AI Thread Summary
The discussion revolves around programming a Pacman game using assembly language, specifically focusing on creating a counter for the dots earned by Pacman. The initial issue was that the counter displayed ASCII characters instead of numerical digits. The solution involved converting integers to ASCII by adding 30h to the values, allowing the display of numbers. The user initially worked with a single-digit counter, which functioned correctly for values 1 to 9 but then reverted to symbols for higher values. After adjusting the code to accommodate multiple digits, the counter now works perfectly, successfully displaying the correct numerical output.
$ @ l^l^l @ R
Messages
4
Reaction score
0
hi . . .

I have been working on a project
it's to program Pacman Game using assembly

it needs al counter for the number of dots earned by Pacman
I have done a counter but it doesn't counting numbers
it displays charachters like smily face, heart, and all these whose ASCII code starts from 00H to FFH

please if anyone knows how can I let it counts and displays numbers !

Thank you . . .
 
Technology news on Phys.org
Determine how many decimal digits you will show.

Let's say you want to do three digits. For the first, take the number of dots, divide by 100 (= 10^(3-1)), mod 10, using the appropriate operations for the size of the number stored. Then add '0' to get the digit. (reverse Polish notation: N 0x64 / 0x0A % 0x30 +)

Just vary the number you divide by each time to get different digits.
 
thank 4 your reply

but the counter is working properly
except that it doesn't displaying numbers
it displays ascii charachters :S
 
You have to convert an integer into ASCII numbers: 48= character "0" for example.
 
i added 30h to convert ascii to decimal
but started counting from 1 then b then symbols
:S
 
Er, I'm just guessing since you haven't been entirely clear about what precisely you are doing that's failing...

Did you instruct the computer to print a single character when, in fact, you are trying to print a double-digit number?
 
thank u all . . . i did it

Hurkyl ;
ya i was working only on one digit
but when it counted properly from 1 to 9 then gave symbols
i added the other digits
so the counter is perfect
thank u :)
 

Similar threads

Back
Top