Welcome to Dream.In.Code
Getting Help is Easy!

Join 136,174 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,932 people online right now. Registration is fast and FREE... Join Now!




Help in assembly

 
Reply to this topicStart new topic

Help in assembly, doing a simple Pacman

$ @ l^l^l @ R
26 Dec, 2007 - 10:26 AM
Post #1

New D.I.C Head
*

Joined: 25 Dec, 2007
Posts: 3

hi . . .

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

it needs a 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

I put a variable
counter dw 00,'$'
and every time Pacman eats a dot the counter is incremented and
it worked
but the display wasn't as numbers, it was as I mentioned before :S

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

Thank you . . .
User is offlineProfile CardPM
+Quote Post

no2pencil
RE: Help In Assembly
26 Dec, 2007 - 10:50 AM
Post #2

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 6,450



Thanked: 66 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
Can you use anything from here? http://www.web-source.net/symbols.htm
Just send the ascii value to a string, rather than using integers.
User is online!Profile CardPM
+Quote Post

$ @ l^l^l @ R
RE: Help In Assembly
26 Dec, 2007 - 11:12 AM
Post #3

New D.I.C Head
*

Joined: 25 Dec, 2007
Posts: 3

QUOTE(no2pencil @ 26 Dec, 2007 - 11:50 AM) *

Can you use anything from here? http://www.web-source.net/symbols.htm
Just send the ascii value to a string, rather than using integers.



mmmm
I read what the is in the link
but it didn't help me :S

mmm
can help me how can i send the ascii value to a string in assembly 386 ?
User is offlineProfile CardPM
+Quote Post

born2c0de
RE: Help In Assembly
27 Dec, 2007 - 11:35 PM
Post #4

printf("I'm a %XR",195936478);
Group Icon

Joined: 26 Nov, 2004
Posts: 3,906



Thanked: 34 times
Dream Kudos: 2800
Expert In: 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions
A String is internally stored in it's ASCII Form.
The problem with the 9H function of Interrupt 21h is that it outputs a string; which means that even if 41h (the number) was passed, it would print 'A'.

You'll need to convert the ASCII Value of each character in each string into ASCII Values of numbers like this:

Let's consider 'A':
A = 65
units = 48 + (a MOD 10)
tenths = 48 + (a-units) divided by 10
hundredths = 48 + ( (a - (a MOD 100) ) divided by 100)

Maintain a number like this:
ascii_val DB hundredths, tenths, units, 00h

And finally print ascii_val normally using Assembly.
Repeat this procedure for every character in the string.

I'd write this in a procedure if I were you.

I'm pretty sure that such a function has already been written by someone before. I'll try to look for it and get back to you.

Don't unnecessarily write something that has already been written before. That would simply waste your time.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 12:50AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month