Kumaran S
Kumaran S

Reputation: 131

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?

Upvotes: 0

Views: 14361

Answers (1)

rkhb
rkhb

Reputation: 14399

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

Upvotes: 1

Related Questions