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

The OutPut Should Be :

Please Enter Capital letters: ABCDE
Small Letters in reverse order: edcba

The OutPut Should Be :

Please Enter Capital letters: ABCDE
Small Letters in reverse order: edcba

You know the difference between an upper and lower case character?
20h
You know the difference between the binary of an upper and lower case character?
1 bit.
Consider the following
E - 01000101
e - 01100101

A - 1000001
a - 1100001

I know that , but i dont know how to make the loop in reverse order.

I know that , but i dont know how to make the loop in reverse order.

In an array of chars as such
ABCDEF
You access the 'A' via base address + 0 so you access the F via base address + 5
Then we load up our new array.
so...
new_array+0 = (user_input+5 with altered bit)

Ooooh, Thanks Alot
you are soo kind..
that helps me :)
I will try it now ..

This question has already been answered. Start a new discussion instead.