assembly language programs

assembly language programs - ; a program to add three...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ; a program to add three numbers using memory variables .model small .stack 100h .data num1 dw 1 num2 dw 2 num3 dw 3 sum dw ? .code main proc ;Initializing Accumualtor mov ax,@data mov ds,ax mov ax,[num1] add ax,[num2] add ax,[num3] mov [sum],ax ;Printing Result mov dx,[sum] mov ah,02h add dl,30h int 21h ;Ending Program mov ah,4ch int 21h main endp end main ; a program to add three numbers accessed using a single label (using dw) .model small .stack 100h .data num dw 2,3,4 .code main proc mov ax,@data mov ds,ax mov ax,[num] add ax,[num+2] add ax,[num+4] mov dx,ax mov ah,02h add dl,30h int 21h mov ah,4ch int 21h main endp end main ; a program to add three numbers accessed using a single label (using dw) .model small .stack 100h .data num dw 2,10,7 .code main proc mov ax,@data mov ds,ax mov ax,[num] add ax,[num+2] add ax,[num+4] mov dx,ax mov ah,02h add dl,30h int 21h mov ah,4ch int 21h main endp end main ; a program to add three numbers accessed using a single label (using db) .model small .stack 100h .data num db 2,3,4 .code main proc mov ax,@data mov ds,ax mov al,[num] add al,[num+1] add al,[num+2] mov ah,02 add al,30h mov dl,al int 21h mov ah,4ch int 21h main endp end main ; a program to add three numbers accessed using a single label (using dw)(2-Digit Number) .model small .stack 100h .data num1 dw 5,4,6,10 total dw 0 .code main proc mov ax,@data mov ds,ax mov bx,0 mov ax,0 add ax,[num1] add ax,[num1+2] add ax,[num1+4] add ax,[num1+6] mov bl,10 div bl mov cl,al mov bl,ah mov ah,02 add cl,30h mov dl,cl int 21h mov ah,02 add bl,30h mov dl,bl int 21h ;mov dx,ax ;mov ah,02h ;add dl,30h ;int 21h mov ah,4ch int 21h main endp end main .model small .stack 100h .data a dw 2 b dw 2 .code main proc mov ax,@data mov ds,ax mov ax,a add ax,b mov dx,ax mov ah,02h add dl,30h int 21h mov ax,4c00h int 21h main endp end main ;Reverse a series of Numbers .model small .stack 100h .data num1 dw 2,4,6,2,6,5,9,1 .code main proc mov ax,@data mov ds,ax mov bx,0 mov ax,0 loop1: add ax,[num1+bx] add bx,2 cmp bx,16 jne loop1 mov bl,10 div bl mov cl,ah ;saving remainder mov bl,al ;saving Quotient mov ah,02 add bl,30h mov dl,bl int 21h mov ah,02 add cl,30h mov dl,cl int 21h ;mov ah,02 ;add [num1+bx],30h ;mov dl, [num1+bx] ;int 21h ;dec bx ;dec cl mov ah,4ch int 21h main endp end main .model small .stack 100h .data multiplicand db 3 multiplier db 2 result db 0 .code main proc mov ax,@data mov ds,ax mov cl,4 mov bl,[multiplicand] mov dl,[multiplier] checkbit: shr dl,1 jnc skip add [result],bl skip: shl bl,1 dec cl jnz checkbit mov dl,[result] mov ah,02 add dl,30h int 21h mov ah,4ch int 21h main endp end main .model medium .stack 100h .data multiplicand dd 1300 multiplier dw 500 result dd 0 .code main proc mov ax,@data mov ds,ax mov cl,16 mov dx,[multiplier] checkbit: shr dx,1 jnc skip mov ax,[multiplicand] add [result],ax mov ax,]multiplicand+2] adc [result+2],ax skip: shl [multiplicand],1 rcl [multiplicand+2],1 jnz checkbit mov ah,4ch int 21h main endp end main .model small .stack 100h....
View Full Document

This note was uploaded on 11/06/2010 for the course UBIT 411 taught by Professor Saleemelahi during the Spring '10 term at University of Karachi.

Page1 / 32

assembly language programs - ; a program to add three...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online