?
Solved

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

Posted on 2004-03-29
4
Medium Priority
?
406 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

Introducing Priority Question

Increase expert visibility of your issues by participating in Priority Question, our latest feature for Premium and Team Account holders. Adjust the priority of your question to get emergent issues in front of subject-matter experts for help when you need it most.

Question has a verified solution.

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

We are witnesses that everyone is saying that our children shouldn't "play" with a technology because it is dangerous. This article is going to prove that they are wrong.
What's worse than having your data encrypted by ransomware? Getting attacked by a so-called "wiper," which simply destroys the data and offers you no hope of ever seeing it again.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

771 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