Logo 
Search:

Assembly Language Articles

Submit Article
Home » Articles » Assembly Language » Homework HelpRSS Feeds

Program to swap the cases of a given String

Posted By: Emily Brown     Category: Assembly Language     Views: 3334

Program to swap the cases of a given String.

Code for Program to swap the cases of a given String in Assembly Language

Data Segment
  str1 db 'StRiNg CaSe CoNvErSiOn','$'
  strlen1 dw $-str1
Data Ends

Code Segment
  Assume cs:code, ds:data
  Begin:   
    mov ax, data
    mov ds, ax
    mov es, ax
    mov cx, strlen1
    add cx, -1
    lea bx, str1
    L1:
       mov ah, [bx]
       cmp ah, 41h
       jb L2
       cmp ah, 5Ah
       ja Upper_Check

    Lower_Case:
       XOR ah, 00100000B
       mov [bx], ah

    L2:
       inc bx
       loop L1

    Upper_Check:
       cmp ah, 61h
       ja Upper_Case

    Upper_Case:
       AND ah, 11011111B
       mov [bx], ah
       inc bx
       loop L1

    Print:
       mov ah, 09h
       lea dx, str1
       int 21h
    Exit:
       mov ax, 4c00h
       int 21h
Code Ends
End Begin
    
  
Share: 


Didn't find what you were looking for? Find more on Program to swap the cases of a given String Or get search suggestion and latest updates.

Emily Brown
Emily Brown author of Program to swap the cases of a given String is from London, United Kingdom.
 
View All Articles

 

Other Interesting Articles in Assembly Language:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!