Monday, 6 February 2012

Masm program to sort n numbers

printmsg macro msg mov ah,09h lea dx,msg int 21h endm printnum macro reg mov dl,reg add dl,30h mov ah,02h int 21h endm calcnum macro regx mov ax,regx mov dh,100 div dh mov n,ah aam mov dh,al printnum ah printnum dh mov al,n aam mov dh,al printnum ah printnum dh endm data segment num db 0 array db 50 dup(0) n db 0 cr equ 0dh msg0 db "Enter a limit(Ex:05)$" msg1 db "Enter the nos(Ex:06)$" msg2 db 0ah,0dh,"After sorting$" msg4 db 0ah,"$" msg5 db 0ah,0dh,"Before sorting$" data ends code segment assume cs:code,ds:data start: mov ax,data mov...

Count number of words in a sentence-Masm program

printmsg macro msg mov ah,09h lea dx,msg int 21h endm printnum macro reg mov dl,reg add dl,30h mov ah,02h int 21h endm data segment str db 40 dup(0) cr equ 0dh lf equ 0ah msg1 db "Enter a string:$" msg4 db 0ah,0dh,"$" msg5 db 0ah,0dh,"No: of words$" data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax lea si,str mov cl,00 printmsg msg1 printmsg msg4 mov ch,'$' mov [si],ch l1: mov ah,01h int 21h cmp al,32 je v1 jmp v2 v1:inc cl jmp v2 v2:cmp al,cr je p3 sub al,30h mov [si],al inc si mov [si],ch jmp l1 p3: mov si,offset...

Friday, 3 February 2012

Masm program-Palindrome checking

printmsg macro msg mov ah,09h lea dx,msg int 21h endm data segment n db 0 array db 40 dup(0) revarray db 40 dup(0) cr equ 0dh msg1 db "Enter a string:$" msg2 db 0ah,0dh,"Palindrome$" msg3 db 0ah,0dh,"Not Palindrome$" msg4 db 0ah,0dh,"$" msg5 db 0ah,0dh,"Reversed string$" data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax lea si,array mov cl,00 printmsg msg1 printmsg msg4 l1: mov ah,01h int 21h cmp al,cr je p2 sub al,30h mov [si],al inc si inc cl jmp l1 p2: mov n,cl mov ch,'$' mov [si],ch printmsg msg4 dec si lea...

Binary to Hexadecimal converter-Masm program

printmsg macro msg mov ah,09h lea dx,msg int 21h endm printnum macro reg mov dl,reg add dl,30h mov ah,02h int 21h endm calcnum macro regx mov ax,regx mov dh,100 div dh mov num,ah aam mov dh,al printnum ah printnum dh mov al,num aam mov dh,al printnum ah printnum dh endm multiply macro num1 mov ax,0001 mov dh,02 mov dl,00 l10: cmp dl,num1 jz l9 mul dh inc dl jmp l10 l9: endm data segment num dw ? num1 db 0 array db 10 dup(0) cr equ 0dh msg1 db "Enter a binary number$" msg2 db 0ah,0dh,"Hex Equivalant$" a db "A$" b db "B$" c db "C$" d db "D$" e...

Binary to Decimal converter- Masm program

printmsg macro msg mov ah,09h lea dx,msg int 21h endm printnum macro reg mov dl,reg add dl,30h mov ah,02h int 21h endm calcnum macro regx mov ax,regx mov dh,100 div dh mov num,ah aam mov dh,al printnum ah printnum dh mov al,num aam mov dh,al printnum ah printnum dh endm multiply macro num1 mov ax,0001 mov dh,02 mov dl,00 l10: cmp dl,num1 jz l9 mul dh inc dl jmp l10 l9: endm data segment num dw ? num1 db 0 array db 10 dup(0) cr equ 0dh msg1 db "Enter a binary number$" msg2 db 0ah,0dh,"Decimal Equivalant$" msg4 db 0ah,"$" data ends code...

Thursday, 2 February 2012

Fibonacci series-Masm program

printmsg macro msg mov ah,09h lea dx,msg int 21h endm printnum macro reg mov dl,reg add dl,30h mov ah,02h int 21h endm calcnum macro regx mov ax,regx mov dh,100 div dh mov num,ah aam mov dh,al printnum ah printnum dh mov al,num aam mov dh,al printnum ah printnum dh endm data segment num dw 0 a dw 0000 b dw ? regx dw ? msg1 db "Enter a non zero limit(Ex: 05)$" msg2 db 0ah,0dh,"Fibnocci series $" msg3 db 0ah,"$" msg5 db 0ah,0dh,"Try again$" data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax printmsg msg1 mov ah,01h int...

Page 1 of 2712345Next
Twitter Delicious Facebook Digg Stumbleupon Favorites More