B.G
B.G

Reputation: 1

User input string and print in Assembly

Required to get the user to input a string though it does not need to prompt the user in any for just expects for them to to type it in.

Here's what I have so far:

                    mov ah, 3fh     ;3fh Reads the string and moves it to ah
                    int 21H         ;Calls MS-DOS to input string
                    mov ah,9    ;Store interrupt code in ah to display string stored in dx
                    int 21h         ;interrupt code

This is the output first line user entered hello, second line it repeats what user entered, then random symbols

Not sure why there is all of those symbols after it

Require for a school work sheet, though I don't really understand what I am doing.

Upvotes: 0

Views: 926

Answers (1)

0xrgb
0xrgb

Reputation: 94

Random symbols are printed because int 21, 9 prints strings up to $.

So you need to add $ to [DS:DX + AX], where the inputed string ends.
(Why it is [DS:DX + AX]? Because int 21, 3F returns number of bytes to AX)

Upvotes: 1

Related Questions