Assignment Help, Cloud Based ERP System, Microsoft NAV Certification
WELCOME !!

Please Register, ask for assignment solutions & post the solutions if you know any.

LETS START POSTING YOUR IDEAS AND THOUGHTS AND BUILD THE COMMUNITY OF EXPERTS.

Assignment Help, Cloud Based ERP System, Microsoft NAV Certification
WELCOME !!

Please Register, ask for assignment solutions & post the solutions if you know any.

LETS START POSTING YOUR IDEAS AND THOUGHTS AND BUILD THE COMMUNITY OF EXPERTS.

Assignment Help, Cloud Based ERP System, Microsoft NAV Certification

Stock Market, Online Tutoring, Cloud Based ERP System, Microsoft Dynamics Reporting, Microsoft Nav Certification


You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

12064 Poush (Reg./Back) Q. N. 5 Empty 2064 Poush (Reg./Back) Q. N. 5 12th April 2009, 10:33 pm

diadem59

diadem59
Administrator
Write down an assembly language program to read a string and count the no. of vowels in the string. Display the no. of vowels in the string and the string without the vowels in it in a clear screen with reverse attribute.

Code:
TITLE VOWEL COUNT AND DISPLAY
;DOSSEG
.MODEL SMALL
.STACK 64H
.DATA   
    REQ    DB 'Enter a string:$'
    MAX    DB 50H
    ACT    DB ? 
    CHAR    DB 50H DUP(?)
    COUNT  DB 0
    VOWELS  DB 'AEIOUaeiou'
    TEMP    DB 4   
    DIVS    DB 0AH

.CODE
    MAIN PROC
        MOV AX,@DATA
        MOV DS,AX
        MOV ES,AX  ;for 13H function of INT 10H
       
        MOV AH,09H
        LEA DX,REQ
        INT 21H 
       
        MOV AH,0AH
        MOV DX,OFFSET MAX
        INT 21H
       
        MOV CH,00H
        MOV CL,ACT
        MOV SI,00
       
Nxtchar: MOV DI,00
       
Nxtvow:  MOV DL,VOWELS[DI]
        CMP DL,CHAR[SI]
        JE Incr
        CMP DL,'u'
        JE NoIncr
        INC DI
        JMP Nxtvow
       
 Incr:  INC COUNT
        MOV CHAR[SI],' '        ;replace vowel with space
 NoIncr: INC SI
        LOOP Nxtchar   
       
        MOV AX,0600H    ;Clear Screen
        MOV BH,07H
        MOV CX,0000H
        MOV DX,184FH
        INT 10H           
       
        CALL DISPCOUNT
       
        MOV CH,00
        MOV CL,ACT
        MOV AX,1301H
        MOV BX,70H    ;reverse attribute
        LEA BP,CHAR
        MOV DX,0100H
        INT 10H
       
        MOV AX,4C00H
        INT 21H
MAIN ENDP
   
     
   
 DISPCOUNT PROC
     
        MOV DX,0000  ; for function 02 of int 10h (cursor position)
               
        MOV BX,0070H  ;PAGE# 0 AND reverse attribute     
        MOV SI,00H
        MOV AH,00H
        MOV AL,COUNT
Rediv:  DIV DIVS
        MOV TEMP[SI],AH
        INC SI
        MOV AH,00H
        TEST AL,0FFH
        JNZ Rediv
                     
        MOV CX,01H   
Nxt:    DEC SI
        MOV AL,TEMP[SI]
        ADD AL,30H
                 
        MOV AH,02H
        INT 10H
        INC DX         
        MOV AH,09H
        INT 10H 
                       
        TEST SI,0FFFFH
        JNZ Nxt

        RET 
    DISPCOUNT ENDP     
   
   
END MAIN

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum