Write an assembly language program that inputs a single letter and shows the same letter in it’s opposite case in a new line. (Lower-case to Upper-case or vice-versa)

DIS MACRO STR
MOV AH,09H
LEA DX,STR
INT 21H
ENDM
DATA SEGMENT
    MSG1 DB \"ENTER YOUR STRING : $\"
    MSG2 DB \"CONVERTED STRING IS : $\"
    STR1 DB 20 DUP(\'$\')
    LINE DB 10,13,\'$\'
DATA ENDS

CODE SEGMENT
          ASSUME DS:DATA,CS:CODE
START:
        MOV AX,DATA
        MOV DS,AX
        DIS MSG1
        MOV AH,0AH
        LEA DX,STR1
        INT 21H
        DIS LINE
        MOV CH,00
        MOV CL,BYTE PTR[STR1+1]
        LEA SI,STR1+2
    L1: MOV AH,BYTE PTR[SI]
        CMP AH,\'A\'
        JL L4
        CMP AH,\'Z\'
        JG L2
        ADD BYTE PTR[SI],32
        JMP L3
     L2:CMP AH,\'a\'
        JL L4
        CMP AH,\'z\'
        JG L4
        SUB BYTE PTR[SI],32
     L3:INC SI
        LOOP L1
        DIS MSG2
        DIS STR1+2
     L4:MOV AH,4CH
        INT 21H
CODE ENDS
END START

;------
;OUTPUT
;------

    ENTER YOUR STRING : JiNeSh
    CONVERTED STRING IS : jInEsh

Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source