[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2004-03-29
4
Medium Priority
?
412 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 252 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 248 total points
ID: 10721511
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

While there are many new features for iOS 11, these are the five that can improve your digital lifestyle.
If something goes wrong with Exchange, your IT resources are in trouble.All Exchange server migration processes are not designed to be identical and though migrating email from on-premises Exchange mailbox to Cloud’s Office 365 is relatively simple…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

649 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