Sie sind auf Seite 1von 5

Q.Sum of series of 10 numbers and store result in memory location total. Title Sum of series Dosseg .

model small .stack 100h .data List db 12,34,56,78,98,01,13,78,18,36 Total dw ? .code Main proc MOV AX, @data MOV DS, AX MOV AX, 0000H MOV CX, 0AH ; counter MOV BL, 00H ; to count carry MOV SI, offset List Back: ADD AL, [SI] JC Label Back1: INC SI LOOP Back MOV Total, AX MOV Total+2, BL MOV AH, 4CH INT 21H Label: INC BL JMP Back1 Main endp End Main

Q.Write a program to find Largest No. in a block of data. Length of block is 0A. Store the maximum in location result. Title maximum in given series Dosseg .model small .stack 100h .data List db 80, 81, 78, 65, 23, 45, 89, 90, 10, 99 Result db ? .code Main proc MOV AX, @data MOV DS, AX MOV SI, offset List MOV AL, 00H MOV CX, 0AH Back: CMP AL, [SI] JNC Ahead MOV AL, [SI] Ahead: INC SI LOOP Back MOV Result, AL MOV AH, 4CH INT 21H Main endp End Main

Q.Find number of times letter .e. exist in the string .exercise., Store the count at memory Title string operation Dosseg .model small .stack 100h .data String db .exercise., $ Ans db ? Length db $-String .code Main proc MOV AX, @data MOV DS, AX MOV AL,00H MOV SI, offset String MOV CX, Length Back: MOV BH, [SI] CMP BH, .e. JNZ Label INC AL Label: INC SI LOOP Back MOV Ans, AL MOV AH, 4CH INT 21H Main endp End Main

Q.Write an assembly language program to count number of vowels in a given string. Title to count number of vowels in given line of a text Dosseg .model small .stack 100h .code Main proc MOV AX, @data MOV DS, AX MOV SI, offset String ;initialize p MOV CX, Len ;length in CX register MOV BL, 00 ;vowel count=0 Back: MOV AL, [SI] CMP AL, .a. JB VOW CMP AL, .z. ;Convert the character to upper case JA VOW SUB AL, 20H VOW: CMP AL, .A. JNZ a3 INC BL JMP a2 a3: CMP AL, .E. JNZ a4 INC BL JMP a2 a4: CMP AL, .I. JNZ a5 INC BL JMP a2 a5: CMP AL, .O. JNZ a6 INC BL JMP a2 a6: CMP AL, .U. JNZ a2 INC BL

a2: INC SI LOOP Back MOV Vowel, BL MOV AX, 4C00H INT 21H Main endp .data String db .The quick brown fox jumped over lazy sleeping dog., $ Len dw $-string Vowel db ? End Main

Das könnte Ihnen auch gefallen