Help with Assembly: Pacman Game Counter Not Counting Numbers

  • Thread starter $ @ l^l^l @ R
  • Start date
  • Tags
    Assembly
In summary, the conversation involved a person discussing their project to program a Pacman game using assembly language. They encountered an issue with their counter for the number of dots earned by Pacman, as it was displaying ASCII characters instead of numbers. Another person suggested a method for converting an integer into ASCII numbers, and the original person confirmed that their counter was now functioning properly.
  • #1
$ @ l^l^l @ R
4
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
  • #2
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.
 
  • #3
thank 4 your reply

but the counter is working properly
except that it doesn't displaying numbers
it displays ascii charachters :S
 
  • #4
You have to convert an integer into ASCII numbers: 48= character "0" for example.
 
  • #5
i added 30h to convert ascii to decimal
but started counting from 1 then b then symbols
:S
 
  • #6
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?
 
  • #7
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 :)
 

1. Why is my Pacman game counter not counting numbers?

There could be a few reasons for this. First, check to make sure that the counter is properly initialized and that the logic for updating the counter is correct. Also, double check that the counter is connected to the correct variables or events in your code.

2. How can I fix a bug in my Pacman game counter?

The best way to fix a bug in your counter is to carefully review your code and identify any logical or syntax errors. You may also want to use a debugger or console logs to track the flow of your code and identify any issues.

3. Can I use a different type of counter in my Pacman game?

Yes, you can use different types of counters in your Pacman game as long as they are compatible with the programming language and platform you are using. Some common types of counters include integer counters, floating point counters, and binary counters.

4. How do I make my Pacman game counter count up instead of down?

To make your counter count up instead of down, you will need to adjust the logic in your code. Instead of subtracting from the counter, you will need to add to it. You may also need to change the initial value and the condition for when the counter should stop.

5. Is there a way to reset my Pacman game counter to zero?

Yes, most counters have a reset function or method that you can use to set the counter back to its initial value. You can also manually reset the counter by setting it to zero in your code. Just make sure to adjust the logic in your code accordingly.

Similar threads

  • Programming and Computer Science
Replies
30
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Programming and Computer Science
Replies
4
Views
916
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Programming and Computer Science
Replies
20
Views
5K
  • Programming and Computer Science
Replies
1
Views
2K
  • Programming and Computer Science
Replies
1
Views
3K
  • Computing and Technology
Replies
13
Views
322
  • Programming and Computer Science
Replies
1
Views
2K
  • Programming and Computer Science
Replies
4
Views
1K
Back
Top