Solved

Assembly code for converting a string into a number and vice versa

Posted on 2004-03-29
4
391 Views
Last Modified: 2008-03-17
I am making a program that will prompt the user for a number and display it in binary. I am not allowed to use _GetStr but I must take the number that they enter as a string. Then convert it into a binary number. Then I have to convert that binary number back into a string to display it on the screen. I need to use an interrupt for getting the string but I am lost on how to do this. Please help with all of the above! I am completely lost!
0
Comment
Question by:MHDragon17
4 Comments
 
LVL 3

Accepted Solution

by:
Dancie earned 63 total points
Comment Utility
The easiest is to use ah = 0ah int 21h: buffered input until a carrage return
DS:DX -> buffer
Format of DOS input buffer:
Offset      Size      Description      
 00h      BYTE      maximum characters buffer can hold
 01h      BYTE      (call) number of chars from last input which may be recalled
            (ret) number of characters actually read, excluding CR
 02h  N BYTEs      actual characters read, including the final carriage return

byte 0 and 1 must be filled in before using the interrupt.
0 is the size of the buffer and 1 is maximum number of input characters
You then have the input string with a terminating CR.
Find the carrage return in the string ( 0dh) and start going backwards until you count the number
of characters which is given in byte 2.
The next question is :
    Is the input decimal,hex,or binary ( "01010101b);
Give me an answer and I can tell more


0
 
LVL 8

Assisted Solution

by:manish_regmi
manish_regmi earned 62 total points
Comment Utility
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Wondows Handles 4 404
Binary Bomb/GDB Questions 10 1,881
Convert from Binary to Hexadecimal 15 685
How to do these things in assembly !? 1 425
This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now