Solved

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

Posted on 2004-03-29
4
393 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
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Huffman Compression and decompression code on assembly language 7 1,433
IT Help Desk Summit 4 248
ASM problem 2 31 346
FSM's, Flow Charts or Something else 5 371
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
This article outlines why you need to choose a backup solution that protects your entire environment – including your VMware ESXi and Microsoft Hyper-V virtualization hosts – not just your virtual machines.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

803 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