0% found this document useful (0 votes)
6 views

Assembly Language Programs

The document contains a series of 8086 assembly language programs prepared by Dr. T. Abdul Razak, covering various operations including addition, subtraction, multiplication, division, and string manipulation. Each program is designed to perform specific tasks such as finding the biggest or smallest number in an array, sorting bytes, and counting character occurrences. The programs utilize basic assembly instructions and memory addressing techniques.

Uploaded by

kamleshkc191
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Assembly Language Programs

The document contains a series of 8086 assembly language programs prepared by Dr. T. Abdul Razak, covering various operations including addition, subtraction, multiplication, division, and string manipulation. Each program is designed to perform specific tasks such as finding the biggest or smallest number in an array, sorting bytes, and counting character occurrences. The programs utilize basic assembly instructions and memory addressing techniques.

Uploaded by

kamleshkc191
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

JAMAL MOHAMED COLLEGE (AUTONOMOUS)

Accredited (3rd Cycle) with ‘A’ Grade by NAAC


Affiliated to Bharathidasan University
TIRUCHIRAPPALLI – 620 020

DEPARTMENT OF COMPUTER SCIENCE

8086 ASSEMBLY LANGUAGE PROGRAMS

Prepared By: Dr. T. Abdul Razak


1. Program for 16-bit addition

MOV SI, 2000


MOV AX, [SI]
INC SI
INC SI
MOV BX, [SI]
ADD AX, BX
INC SI
INC SI
MOV [SI], AX
HLT

2. Program for 16-bit subtraction

MOV SI, 2000


MOV AX, [SI]
INC SI
INC SI
MOV BX, [SI]
SUB AX, BX
INC SI
INC SI
MOV [SI], AX
HLT

3. Program for multiplication

MOV SI, 2000


MOV AX, [SI]
INC SI
INC SI
MOV BX, [SI]
MUL BX
INC SI
INC SI
MOV [SI], AX
INC SI
INC SI
MOV [SI], DX
HLT

1
4. Program for division

MOV SI, 2000


MOV AX, [SI]
INC SI
INC SI
MOV BL, [SI]
DIV BL
INC SI
MOV [SI], AX
HLT

5. Program for multibyte addition

CLC
MOV SI, 2000
MOV DI, 3000
MOV CL, 05
NEXT: MOV AL, [SI]
ADC [DI], AL
INC SI
INC DI
DEC CL
JNZ NEXT
JNC LAST
MOV [DI], 01
LAST: HLT

6. Program for multibyte subtraction

CLC
MOV SI, 2000
MOV DI, 3000
MOV CL, 05
NEXT: MOV AL, [SI]
SBB [DI], AL
INC SI
INC DI
DEC CL
JNZ NEXT
HLT

2
7. Program to find 1’s complement of a number

MOV SI, 2000


MOV AX, [SI]
NOT AX
INC SI
INC SI
MOV [SI], AX
HLT

8. Program to find 2’s complement of a number

MOV SI, 2000


MOV AX, [SI]
NEG AX
INC SI
INC SI
MOV [SI], AX
HLT

9. Program to illustrate shifting and masking (Assembly of a number)

MOV SI, 2000


MOV BL, [SI]
INC SI
MOV AL, [SI]
MOV CL, 04
RCL AL, CL
ADD AL, BL
INC SI
MOV [SI], AL
HLT

10. Program to find the sum of a series of bytes

MOV SI, 2000


MOV CL, 05
SUB AL, AL
NEXT: ADD AL, [SI]
INC SI
DEC CL
JNZ NEXT
MOV [SI], AL
HLT

3
11. Program to block data transfer

MOV SI, 2000


MOV DI, 3000
MOV CL, 05
NEXT: MOV AL, [SI]
MOV [DI], AL
INC SI
INC DI
DEC CL
JNZ NEXT
HLT

12. Program to find the biggest number in a given array

MOV SI, 2000


MOV CL, 04
MOV AL, [SI]
GO: INC SI
CMP AL, [SI]
JNC NEXT
MOV AL, [SI]
NEXT: DEC CL
JNZ GO
INC SI
MOV [SI], AL
HLT

13. Program to find the smallest number in a given array

MOV SI, 2000


MOV CL, 04
MOV AL, [SI]
GO: INC SI
CMP AL, [SI]
JC NEXT
MOV AL, [SI]
NEXT: DEC CL
JNZ GO
INC SI
MOV [SI], AL
HLT

4
14. Program to sort a given set of bytes in ascending order

MOV DL, 04
AGAIN: MOV SI, 2000
MOV CL, 04
GO: MOV AL, [SI]
INC SI
MOV BL, [SI]
CMP AL, BL
JC NEXT
MOV [SI], AL
DEC SI
MOV [SI], BL
INC SI
NEXT: DEC CL
JNZ GO
DEC DL
JNZ AGAIN
HLT

15. Program to sort a given set of bytes in descending order

MOV DL, 04
AGAIN: MOV SI, 2000
MOV CL, 04
GO: MOV AL, [SI]
INC SI
MOV BL, [SI]
CMP AL, BL
JNC NEXT
MOV [SI], AL
DEC SI
MOV [SI], BL
INC SI
NEXT: DEC CL
JNZ GO
DEC DL
JNZ AGAIN
HLT

5
16. Program to find the length of a given string of bytes

MOV CL, 00
MOV SI, 2000
NEXT: LODSB
CMP AL, ‘.’
JZ LAST
INC CL
JMP NEXT
INC SI
MOV [SI], CL
HLT

17. Program to find the number of occurrences of a character in a given string

MOV SI, 2000


MOV CL, 0A
MOV DL, 00
NEXT: LODSB
CMP AL, ‘E’
JNZ GO
INC DL
GO: DEC CL
JNZ NEXT
MOV [SI], DL
HLT

18. Program to compare two strings

MOV SI, 2000


MOV DI, 3000
MOV CL, 0A
NEXT: CMPSB
JNZ NE
DEC CL
JNZ NEXT
MOV [200B], 01
JMP LAST
NE: MOV [200B], 00
LAST: HLT

You might also like