The document contains 19 programs written in Intel 8086 assembly language. The programs demonstrate various operations like addition, subtraction, multiplication, and division of 8-bit and 16-bit numbers. Other programs show finding square, factorial, largest number in array, string display, block data transfer, and counting occurrences of a character in a string. All programs initialize data, perform the desired operation, and exit by returning to DOS.
Software Programs: Part A 1. Design and Develop An Assembly Language Program To Search A Key Element "X" in A List of N' 16-Bit Numbers. Adopt Binary Search Algorithm in Your Program For Searching
The document contains 19 programs written in Intel 8086 assembly language. The programs demonstrate various operations like addition, subtraction, multiplication, and division of 8-bit and 16-bit numbers. Other programs show finding square, factorial, largest number in array, string display, block data transfer, and counting occurrences of a character in a string. All programs initialize data, perform the desired operation, and exit by returning to DOS.
The document contains 19 programs written in Intel 8086 assembly language. The programs demonstrate various operations like addition, subtraction, multiplication, and division of 8-bit and 16-bit numbers. Other programs show finding square, factorial, largest number in array, string display, block data transfer, and counting occurrences of a character in a string. All programs initialize data, perform the desired operation, and exit by returning to DOS.
The document contains 19 programs written in Intel 8086 assembly language. The programs demonstrate various operations like addition, subtraction, multiplication, and division of 8-bit and 16-bit numbers. Other programs show finding square, factorial, largest number in array, string display, block data transfer, and counting occurrences of a character in a string. All programs initialize data, perform the desired operation, and exit by returning to DOS.
UNIVERSITY Department of Electrical & Electronics Engineering
MICROPROCESSOR- SAMPLE PROGRAMS FOR INTEL 8086 Shailendra Kumar Jha, Associate Professor, Department of Electrical & Electronics Engineering
1. Program to add two 8bit numbers
title add two numbers
dosseg .model small .stack 100h .data value1 db 12h value2 db 34h result db ? .code main proc mov ax, @data mov ds, ax mov al, value1 add al, value2 mov result, al mov ax, 4C00h int 21h main endp end main
2. Program to subtract two 8 bit numbers
title subtract two numbers
dosseg .model small .stack 100h .data value1 db 34h value2 db 12h result db ? .code main proc mov ax, @data mov ds, ax mov al, value1 sub al, value2 mov result, al mov ax, 4C00h int 21h main endp end main Page | 1 3. Program to add two 16 bit numbers
title add two numbers
dosseg .model small .stack 100h .data value1 dw 1200h value2 dw 3400h result dw ? .code main proc mov ax, @data mov ds, ax mov ax, value1 add ax, value2 mov result, ax mov ax, 4C00h int 21h main endp end main
4. Program to subtract two 16 bit numbers
title subtract two numbers
dosseg .model small .stack 100h .data value1 dw 3400h value2 dw 1200h result db ? .code main proc mov ax, @data mov ds, ax mov ax, value1 sub ax, value2 mov result, ax mov ax, 4C00h int 21h main endp end main
5. Program to multiply two 8bit numbers
title multiply two numbers
dosseg .model small Page | 2 .stack 100h .data value1 db 03h value2 db 02h result db ? .code main proc mov ax, @data mov ds, ax mov al, value1 mul value2 mov result, al mov ax, 4C00h int 21h main endp end main
6. Program to divide two 8 bit numbers
title divide two numbers
dosseg .model small .stack 100h .data value1 db 06h value2 db 02h result db ? .code main proc mov ax, @data mov ds, ax mov ah, 00h mov al, value1 div value2 mov result, al mov ax, 4C00h int 21h main endp end main
7. Program to multiply two 16bit numbers
title multiply two numbers
dosseg .model small .stack 100h .data value1 dw 0300h value2 dw 0002h Page | 3 result dw ? .code main proc mov ax, @data mov ds, ax mov ax, value1 mul value2 mov result, ax mov ax, 4C00h int 21h main endp end main
8. Program to divide two 16 bit numbers
title divide two numbers
dosseg .model small .stack 100h .data value1 dw 0600h value2 dw 0002h result dw ? .code main proc mov ax, @data mov ds, ax mov dx, 0000h mov ax, value1 div value2 mov result, ax mov ax, 4C00h int 21h main endp end main
9. Program to find the square of a number without using multiplication
title find square of a numbers
dosseg .model small .stack 100h .data value1 db 03h result db ? .code main proc mov ax, @data mov ds, ax Page | 4 mov bl, value1 mov cl, bl mov al,00h label: add al,bl dec cl jnz label mov result, al mov ax, 4C00h int 21h main endp end main
10. Program to find the square of a number using multiplication
title find square of a numbers
dosseg .model small .stack 100h .data value1 db 03h result db ? .code main proc mov ax, @data mov ds, ax mov al, value1 mov bl, al mul bl mov result, al mov ax, 4C00h int 21h main endp end main
11. Program to find the square of a number using multiplication
title find square of a number using lookup table
dosseg .model small .stack 100h .data table db 00h,01h,04h,09h,10h,19h,24h,31h,40h,51h,64h value1 db 05h result db ? .code main proc mov ax, @data mov ds, ax mov si, offset table Page | 5 mov bh, 00h mov bl,value1 add si,bx mov al, [si] mov result, al mov ax, 4C00h int 21h main endp end main
12. Program to find the factorial of a number
title find factorial of a numbers
dosseg .model small .stack 100h .data value1 db 04h result db ? .code main proc mov ax, @data mov ds, ax mov al, 01h mov bl, value1 label: mul bl dec bl jnz label mov result, al mov ax, 4C00h int 21h main endp end main
13. Program to multiply two 8bit signed numbers
title multiply two signed number
dosseg .model small .stack 100h .data value1 db 03h value2 db 82h result db ? .code main proc mov ax, @data mov ds, ax mov al,value1 Page | 6 imul value2 mov result, al mov ax, 4C00h int 21h main endp end main
14. Program to divide two 8bit signed numbers
title divide two signed number
dosseg .model small .stack 100h .data value1 dw 0006h value2 db 82h result db ? .code main proc mov ax, @data mov ds, ax mov ax,value1 idiv value2 mov result, al mov ax, 4C00h int 21h main endp end main
15. Program to get the sum of a series of data
title sum of series of ten numbers
dosseg .model small .stack 100h .data array1 db 04,05,05,07,08,09,12,03,01,04 total db ? .code main proc mov ax, @data mov ds, ax mov cx,0ah mov si, offset array1 mov ax,00h label: add al,[si] inc si loop label mov total,al Page | 7 mov ax, 4C00h int 21h main endp end main
16. Program to display a string on console
title Display a string
dosseg .model small .stack 100h .data string1 db "Microprocessor",'$' .code main proc mov ax, @data mov ds, ax mov ah, 09h mov dx, offset string1 int 21h mov ax, 4C00h int 21h main endp end main
17. Program to find the largest number in an array
title find the largest number in an array
dosseg .model small .stack 100h .data array1 db 04,05,05,07,08,09,12,03,01,04 result db ? .code main proc mov ax, @data mov ds, ax mov cx,0ah mov si, offset array1 mov al, 00h label1: cmp al,[si] jnc label2 mov al, [si] label2: inc si loop label1 mov result, al Page | 8 mov ax, 4C00h int 21h main endp end main
18. Program to transfer a block of data from one location to another
title transfer of a block of data
dosseg .model small .stack 100h .data array1 db 04,05,05,07,08,09,12,03,01,04 array2 db 10 dup(?) .code main proc mov ax, @data mov ds, ax mov cx,0ah mov si, offset array1 mov di, offset array2 label: mov al,[si] mov [di], al inc si inc di loop label mov ax, 4C00h int 21h main endp end main
19. Program to find the number of times a letter ‘r’ exists in the string ‘microprocessor’.
title number of times 'r'exists in a string
dosseg .model small .stack 100h .data string1 db 'microprocessor' len dw 14 result db ? .code main proc mov ax, @data mov ds, ax mov al, 00h mov si, offset string1 mov cx, len label1: cmp [si], 'r' Page | 9 jnz label2 inc al label2: inc si loop label1 mov result,al mov ax, 4C00h int 21h main endp end main
20. Program for one character password check.
title To check the password
dosseg .model small .stack 100h .data string1 db 'welcome','$' string2 db 'try again','$' .code main proc mov ax, @data mov ds, ax mov ah, 01h int 21h cmp al,'*' jz label1 mov ah, 09h mov dx, offset string2 int 21h jmp end label1: mov ah,09h mov dx, offset string1 int 21h end: mov ax, 4c00h int 21h main endp end main
21. Program for password check.
title password check
dosseg .model small .stack 100h .data string1 db 'welcome','$' string2 db 'try again','$' array1 db 'n','e','p','a','l' Page | 10 .code main proc mov ax, @data mov ds, ax mov cx,05h mov bl,00h mov si, offset array1 back: mov ah, 01h int 21h cmp al,[si] jnz label1 inc bl label1: inc si loop back cmp bl,05h jnz label2 mov ah, 09h mov dx, offset string1 int 21h jmp end label2: mov ah,09h mov dx, offset string2 int 21h end: mov ax, 4c00h int 21h main endp end main
Software Programs: Part A 1. Design and Develop An Assembly Language Program To Search A Key Element "X" in A List of N' 16-Bit Numbers. Adopt Binary Search Algorithm in Your Program For Searching