Logo 
Search:

Assembly Language Articles

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

Program to search for numbers between 0-9, if found replace them with there corresponding special characters on the keyboard

Posted By: Adelgiese Fischer     Category: Assembly Language     Views: 2878

Write an assembly program to search for numbers between 0-9, if found replace them with there corresponding special characters on the keyboard.
(E.g. I/P: (1bc2D3d) ----> O/P(! bc@D#d))

Code for Program to search for numbers between 0-9, if found replace them with there corresponding special characters on the keyboard in Assembly Language

.model small

.data
        encodetable db '0',')'
                    db '1','!'
                    db '2','@'
                    db '3','#'
                    db '4','$'
                    db '5','%'
                    db '6','^'
                    db '7','&'
                    db '8','*'
                    db '9','('

        PARAM LABEL BYTE
        MaxLen db 20
        ActLen db ?
        Input db 20 dup(?)

        CR EQU 13
        LF EQU 10


        msg db 'Enter the string','$'

        display1 db 'The encoded string is : ' ,'$'

        Line db CR,LF,'$'

.code
        Main PROC NEAR
        mov ax,@data
        mov ds,ax
        LEA di,Input
        CALL GetString
        CALL GetEncodedString
        mov ax,4C00h
        int 21h
Main EndP


GetString PROC NEAR
        mov ax,00
        mov ah,09h
        LEA dx,msg
        int 21h

        mov ax,00
        mov ah,0Ah
        LEA dx,PARAM
        int 21h

        mov bh,00
       mov bl,ActLen
        mov Input[BX],'$'
       ret
GetString EndP

GetEncodedString  PROC NEAR
        mov ch,00
        mov cl,ActLen
        mov BX,00
        L1:
                mov al,Input[BX]
                LEA  SI,encodetable
                next:
                        cmp al,BYTE PTR [SI]
                        je exch1
                        cmp al,'0'
                        jl IncBx
                        cmp al,'9'
                        jg IncBx
                        add SI,2
                        mov ah,BYTE PTR [SI]
                        cmp ah,'9'
                        jle next
                        jmp ext
                IncBx:
                        INC BX
                        Loop L1
                        jmp ext
                               
        exch1:
                Inc SI
                mov al,BYTE PTR [SI]
                mov Input[BX],al
                INC BX
                Loop L1

       ext:
               mov bh,00
               mov bl,ActLen
               mov Input[BX],'$'
               mov ax,00
               mov ah,09h
               LEA DX,Line
               int 21h

               mov ax,00
               mov ah,09h
               LEA dx, Line
               int 21h

               mov ax,00
               mov ah, 09H
               LEA dx,display1
               int 21h

               mov ax,00
               mov ah,09h
               LEA dx,Input
               int 21h
               ret

GetEncodedString EndP


end
  
Share: 



Adelgiese Fischer
Adelgiese Fischer author of Program to search for numbers between 0-9, if found replace them with there corresponding special characters on the keyboard is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 

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!