如何使用汇编语言(Intel 8086)将输入输入到新行

时间:2014-10-10 23:50:30

标签: assembly x86-16

我要求用户输入一个大写字母并将其转换为小写。我需要在新行上显示小写字母。这是我的代码:

org 100h
include 'emu8086.inc'   
printn "Enter a upper case character"  
mov ah,1
int 21h ;input a character into AL
mov bl,al
mov ah,0eh
mov al,bl
add al,20h
int 10h ;display lower case 

输出应该是:

-> Enter a upper case character
-> A
-> a

当前结果:

-> Enter a upper case character
-> Aa

如何将小写字母a添加到新行?

1 个答案:

答案 0 :(得分:1)

新行的序列为0Dh 0Ah。您可以使用int 10h / 0Eh打印此序列,就像它是字符一样:

org 100h
include 'emu8086.inc'   
printn "Enter a upper case character"  
mov ah,1
int 21h           ;input a character into AL
mov bl,al

mov ah, 0Eh       ;print new line sequence
mov al, 0Dh
int 10h
mov al, 0Ah
int 10h

mov ah,0eh
mov al,bl
add al,20h
int 10h           ;display lower case 

ret