News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Why String not show

Started by vasant, April 24, 2006, 12:06:19 PM

Previous topic - Next topic

vasant



.model small
.Data
File_name db 20 Dup('$')
.Code
        mov ax,@data
        mov ds,ax
        mov bx,offset File_name
        mov ah,1
L_:
        int 21h
        mov [bx],al
        inc bx
        cmp al,0dh
        je ex_
        jmp L_
ex_:    mov ah,9
        Lea dx,File_name
        int 21h
        mov ah,4ch
        INT 21h
        End

Goal is input char form keyborad to File_name and view String.
Problem is String not show.
Help me please!
Thank you.



MichaelW

The string is showing. The problem is that the Read Keyboard with Echo function sends the carriage-return character (0Dh) to standard output, but the function does not send a line-feed character (0Ah). So the carriage-return character is returning the cursor to the start of the current line, and the Display String function is displaying the string at the same location as the Read Keyboard with Echo function displayed it.

You can correct the problem by sending a line-feed character to standard output before you display the string, so the string will display on the next line. One method of doing this would be to call the Display Character function (interrupt 21h, function 2) with DL = 0Ah.


eschew obfuscation