Solved

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

Posted on 2004-03-29
4
399 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 3

Accepted Solution

by:
Dancie earned 63 total points
ID: 10711161
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
ID: 10721511
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

717 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