简体   繁体   中英

How to get input onto a new line with Assembly Language (Intel 8086)

I'm asking a user to input a uppercase and it converts it to lowercase. I need the lowercase to be displayed on a new line. Here is my code:

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 

The output should be like:

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

Current Result:

-> Enter a upper case character
-> Aa

How do I get the lowercase a to the new line?

The sequence for a new line is 0Dh 0Ah . You can print this sequence with int 10h / 0Eh as if it were characters:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM