data segment
num1 dw 1111h
num2 dw 2222h
prod dw 2 dup (0)
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
mov ax,num1
mul num2
lea si,prod
mov [si],ax
add si,2
mov [si],dx
mov ah,4ch
int 21h
code ends
end start
Thursday, October 29, 2009
8086 Assembly Language Program to add the elements(word) of 2 arrays and store the result(word) in another array
data segment
arr1 dw 10h,20h,30h,40h,50h
arr2 dw 10h,20h,30h,40h,50h
arr3 dw 5 dup (0)
data ends
code segment
assume cs:code , ds:data
start:
mov ax,data
mov ds,ax
lea si,arr1
lea di,arr2
lea bx,arr3
mov cl,5
l1:
mov ax,[si]
add ax,[di]
mov [bx],ax
add si,2
add di,2
add bx,2
dec cl
jnz l1
mov ah,4ch
int 21h
code ends
end start
arr1 dw 10h,20h,30h,40h,50h
arr2 dw 10h,20h,30h,40h,50h
arr3 dw 5 dup (0)
data ends
code segment
assume cs:code , ds:data
start:
mov ax,data
mov ds,ax
lea si,arr1
lea di,arr2
lea bx,arr3
mov cl,5
l1:
mov ax,[si]
add ax,[di]
mov [bx],ax
add si,2
add di,2
add bx,2
dec cl
jnz l1
mov ah,4ch
int 21h
code ends
end start
8086 Assembly Language Program to add the elements(byte) of 2 arrays and store the result(byte) in another array
data segment
arr1 db 10h,20h,30h,40h,50h
arr2 db 10h,20h,30h,40h,50h
arr3 db 5 dup (0)
data ends
code segment
assume cs:code , ds:data
start:
mov ax,data
mov ds,ax
lea si,arr1
lea di,arr2
lea bx,arr3
mov cl,5
l1:
mov al,[si]
add al,[di]
mov [bx],al
inc si
inc di
inc bx
dec cl
jnz l1
mov ah,4ch
int 21h
code ends
end start
arr1 db 10h,20h,30h,40h,50h
arr2 db 10h,20h,30h,40h,50h
arr3 db 5 dup (0)
data ends
code segment
assume cs:code , ds:data
start:
mov ax,data
mov ds,ax
lea si,arr1
lea di,arr2
lea bx,arr3
mov cl,5
l1:
mov al,[si]
add al,[di]
mov [bx],al
inc si
inc di
inc bx
dec cl
jnz l1
mov ah,4ch
int 21h
code ends
end start
Tuesday, October 27, 2009
8086 Assembly Language Program to add elements(word) of an array.Assume result is also a word
data segment
arr dw 10h,20h,30h,40h,50h
res dw 1 dup (0)
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
lea si,arr
mov ax,[si]
mov cl,5
inc si
inc si
dec cl
l1:add ax,[si]
inc si
inc si
dec cl
jnz l1
mov res, ax
mov ah,4ch
int 21h
code ends
end start
arr dw 10h,20h,30h,40h,50h
res dw 1 dup (0)
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
lea si,arr
mov ax,[si]
mov cl,5
inc si
inc si
dec cl
l1:add ax,[si]
inc si
inc si
dec cl
jnz l1
mov res, ax
mov ah,4ch
int 21h
code ends
end start
8086 Assembly Language Program to add the elements(byte) of an array. Assume that the result is also a byte
data segment
arr db 10h, 20h, 30h, 40h, 50h
res db 1 dup (0)
data ends
code segment
assume cs:code, ds:data
start:
mov ax,data
mov ds,ax
lea si, arr
mov cl,5
mov al,[si]
inc si
dec cl
l1:add al,[si]
inc si
dec cl
jnz l1
mov res, al
mov ah, 4ch
int 21h
code ends
end start
arr db 10h, 20h, 30h, 40h, 50h
res db 1 dup (0)
data ends
code segment
assume cs:code, ds:data
start:
mov ax,data
mov ds,ax
lea si, arr
mov cl,5
mov al,[si]
inc si
dec cl
l1:add al,[si]
inc si
dec cl
jnz l1
mov res, al
mov ah, 4ch
int 21h
code ends
end start
Friday, September 25, 2009
8086 Assembly Langauge Program to add two numbers
data segment
num1 dw 10h
num2 dw 20h
res dw 1 dup(0)
data ends
code segment
assume cs:code, ds:data
start:
mov ax,data
mov ds,ax
mov ax,num1
add ax,num2
mov res,ax
mov ah,4ch
int 21h
code ends
end start
num1 dw 10h
num2 dw 20h
res dw 1 dup(0)
data ends
code segment
assume cs:code, ds:data
start:
mov ax,data
mov ds,ax
mov ax,num1
add ax,num2
mov res,ax
mov ah,4ch
int 21h
code ends
end start
Subscribe to:
Posts (Atom)