开发者

Assembly Language: Read (w/o echo) and write

开发者 https://www.devze.com 2023-04-08 00:37 出处:网络
I am writing a program that will read and write characters, converting lowercase characters to uppercase. This is my first assembly program, so I am attempting to first get the program to read in a ch

I am writing a program that will read and write characters, converting lowercase characters to uppercase. This is my first assembly program, so I am attempting to first get the program to read in a character and write it out. This is what I have coded so far:

    .model      small
    .8086


    .data

lower   db      'a'


    .code

start:
        mov     ax,@data
        mov     ds,ax

        mov     ah,8
        int     21h
        mov     dl,al
        mov     ah,2
        int     21h

exit:
        mov     ax,4c00h
        int     21h
        end     start

Have I handled the read/write correctly? When I run this program and enter in a character, I only see one instance of it. Shouldn't it be two? One for the letter I typed, and then one for letter returned? For example, if I typ开发者_开发知识库e d, I see:

d

but shouldn't I see:

d
d
or
dd


DOS Int 08h reads a character from STDIN and does not echo it. If you want to echo the character, call int 01h.

0

精彩评论

暂无评论...
验证码 换一张
取 消