Logo 
Search:

Assembly Language Articles

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

An application which swaps the case of the given string

Posted By: Rachel Fischer     Category: Assembly Language     Views: 1868

Write an application which swaps the case of the given string.

Code for An application which swaps the case of the given string in Assembly Language

data segment
    value db 'SanjaY', '$'
    v_size dw $-value
    val db 7 dup (?)

    upper db 40h
    lower db 60h

data ends

code segment
    assume cs:code, ds:data
begin:
    mov ax, data
    mov ds, ax
    mov es, ax

    lea si, value
    lea di, val
    mov cx, v_size
    dec cx

    mov ah, 09h
    lea dx, valueint 21h

counter:
    mov al, [si]
    cmp al, lower
    jg ltou_case
    jmp utol_case    

ltou_case:
    sub al, 20h
    mov [di], al
    inc si
    inc di
    dec cx
    jnz counter
    jmp exit

utol_case:
    add al, 20h
    mov [di], al
    inc si
    inc di
    dec cx
    jnz counter


exit:
    mov [di], '$'
    mov ah, 09h
    lea dx, val
    int 21h

    mov ax, 4c00h
    int 21h

code ends
end begin
  
Share: 


Didn't find what you were looking for? Find more on An application which swaps the case of the given string Or get search suggestion and latest updates.

Rachel Fischer
Rachel Fischer author of An application which swaps the case of the given string is from Frankfurt, Germany.
 
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!