汇编语言:读取(无回显)和写入
我正在编写一个程序来读取和写入字符,将小写字符转换为大写字符。这是我的第一个汇编程序,因此我尝试首先让程序读入字符并将其写出。这是我到目前为止编写的代码:
.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
我是否正确处理了读/写?当我运行这个程序并输入一个字符时,我只看到它的一个实例。不应该是两个吗?一封用于我输入的信件,然后一封用于返回的信件?例如,如果我输入 d,我会看到:
d
但我不应该看到:
d
d
or
dd
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 type d, I see:
d
but shouldn't I see:
d
d
or
dd
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
DOS Int 08h 从 STDIN 读取一个字符并且不回显它。如果要回显该字符,请调用 int 01h。
DOS Int 08h reads a character from STDIN and does not echo it. If you want to echo the character, call int 01h.