Hello Programmers
This Is My Question & the answer
But .. The out put not exist
i don't know what is the wrong with it
Write a program that will take as an input 5 Capital Letters and then display on next line in small letters and in reverse order.
• Use Logical operator to convert the capital letters to small letters.
• Save the input capital letters in an array named LETTERS.
• Use only indexed addressing mode.
My Answer :
.MODEL SMALL
.STACK 100H
.DATA
CR EQU 0DH ;Carriage Return
LF EQU 0AH ;Line Feed
MSG1 DB CR,LF,'Please Enter Capital letters: $'
MSG2 DB CR,LF,'Small Letters in reverse order: $'
LETTERS DB ?
.CODE
MAIN PROC
MOV AX,@DATA ;get data segment
MOV DS,AX ;initialize DS
;Display MSG1
LEA DX,MSG1 ;load address of MSG1 message
MOV AH,9 ;select string output
INT 21H ;output MSG
;Read the input from the user
AND LETTERS,0H
MOV AH,1
MOV CL,5
WHILE_:
INT 21H
MOV LETTERS,AL
DEC CL
JCXZ PRO_
CMP AL,0DH
JNE WHILE_
PRO_:
XOR SI,SI
ARR:
CMP LETTERS[SI],' '
JE NEXT
XOR LETTERS[SI],0DFH
NEXT:
DEC SI
LOOP ARR
;Display MSG2
LEA DX,MSG2 ;load address of MSG2 message
MOV AH,9 ;select string output
INT 21H ;output MSG
MOV AH,9
LEA SI,LETTERS
READ:
INT 21H
ADD SI,2 ; IN CASE IT IS 2
LOOP READ
EXIT:
MOV AH,4CH ;DOS exit
INT 21H
MAIN ENDP ;ENDP ends a procedure
END MAIN ;END ends the source program
Correct it please , & that is very Kind of you