Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String Input

Status
Not open for further replies.

technot

Programmer
Oct 12, 2002
8
US
I know how to input a character, but how would I input a string? Also if I wanted to read a string from a user such as 34,45,67 as one input, how could I save 34 to ax register then 45 to the bx register and then 67 to the cx register?
 
To input a string you have to monitor these single characters and combine into a string by yourself. Once you can do it, you'll be able to get '34' into AX and so on.
PS. This is the easiest way, but not the only one possible.
 
We talk about DOS, right?
Take a look at INT 16, functions 0 and 1. One of them tells you if a key has been pressed, other puts character info in AX. Well, you have to create a "main loop" where you can monitor the keyboard.
 
Well from what I've learned, create a record in the data segment to hold your string like this:

INVAL LABEL BYTE ;Align all values on a byte for this to
;work
MAXLEN DB 10D; Tell the max input
ACTLEN DB ?
STRVAL DB 10 DUP (' ')


then to actually fill the data slot
MOV AX,0AH
LEA DX,INVAL; INVAL is a label so starts on offset of Maxlen
INT 21H; Call the DOS Interrupt 21

If you aren't using DOS, then I think there is something similiar for a function in BIOS INT 10H, since I have no experience assembly programming on non dos systems.


Then after this, you could parse the STRVAL for your inputs, your own user defined method likely, but it might be very inefficient. I don't know. I'm pretty new to assembly programming. Hope any of that helps anyways.

JavaDude32
 
There is no string input function in BIOS.

If you want an input function more flexible than DOS's, you want to build your own.

If you're using Windows... hey, you probably aren't. "Information has a tendency to be free. Which means someone will always tell you something you don't want to know."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top