Hello! I am creating an assembly program that accepts a single character and displays the alphabet in reverse. The requirements are (1) The input character should be displayed (2) The alphabet should be displayed vertically and (3) Only the letter 'Z' should be accepted as input.
I have managed to let my program input a character and display the alphabet in reverse however, it is displayed horizontally. I made a proc named nlcr for new line and carriage return but when I call it inside the loop, some weird characters appear. Also, I have not yet made a validation process for the character input but my idea is that I should use conditional jumps and labels, am I right? Can somebody enlighten me on this topic? I'm pretty much new to assembly language. Thank You!
.model small
.stack
.data
string db "ODD EVEN$"
string2 db "Input:$"
.code
org 100h
start:
main proc
mov ax,03
int 10h
mov ax,@data
mov ds,ax
mov ah,9
lea dx,string
int 21h
call nlcr
mov ah,9
lea dx,string2
int 21h
mov ah,1
int 21h
mov dl,al
mov ah,2
add dl,20h
int 21h
mov cx,25
y:
mov ah,2
dec dl
int 21h
loop y
mov ah,4ch
int 21h
main endp
nlcr proc
mov ah,2
mov dl,13
int 21h
mov dl,10
int 21h
ret
nlcr endp
end start
The output should be like this:
ODD EVEN
Input: Z
z
y
x
.
.
.
a