Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Help in assembly

  1. Dec 25, 2007 #1
    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 any one knows how can I let it counts and displays numbers !

    Thank you . . .
     
  2. jcsd
  3. Dec 26, 2007 #2

    CRGreathouse

    User Avatar
    Science Advisor
    Homework Helper

    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.
     
  4. Dec 26, 2007 #3
    thank 4 your reply

    but the counter is working properly
    except that it doesn't displaying numbers
    it displays ascii charachters :S
     
  5. Dec 26, 2007 #4

    jim mcnamara

    User Avatar
    Science Advisor
    Gold Member

    You have to convert an integer into ASCII numbers: 48= character "0" for example.
     
  6. Dec 26, 2007 #5
    i added 30h to convert ascii to decimal
    but started counting from 1 then b then symbols
    :S
     
  7. Dec 26, 2007 #6

    Hurkyl

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    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?
     
  8. Dec 26, 2007 #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 :)
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Help in assembly
  1. Assembly help (Replies: 2)

Loading...