In this blog post, we’ll delve into the world of assembly language programming using the 8086 microprocessors. We’ll explore a practical example: creating an assembly program to determine the largest number from a given set of values.
Continue reading 8086 Assembly Program to Find Largest Number from Given NumbersCategory Archives: 8086
8086 Assembly Program to Find Smallest Number from Given Numbers
In this blog post, we’ll explore how to find the smallest number from a given set of values using an 8086 assembly language program. The following code snippet demonstrates this process:
data segment STRING1 DB 08h,14h,05h,0Fh,09h res db ? data ends code segment assume cs:code, ds:data start: mov ax, data mov ds, ax mov cx, 04h mov bl, 79h LEA SI, STRING1 up: mov al, [SI] cmp al, bl jge nxt mov bl, al nxt: inc si dec cx jnz up mov res,bl int 3 code ends end startContinue reading 8086 Assembly Program to Find Smallest Number from Given Numbers
8086 Assembly Program to Sort Numbers in Descending Order
In this blog post, we will explore an 8086 assembly language program designed to sort a list of numbers in descending order. Sorting is a fundamental operation in computer science, and understanding how to implement it at the assembly level provides valuable insights into low-level programming and processor operations.
The following assembly program sorts an array of numbers in descending order using the bubble sort algorithm:
DATA SEGMENT STRING1 DB 99H,12H,56H,45H,36H DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX MOV CH,04H UP2: MOV CL,04H LEA SI,STRING1 UP1:MOV AL,[SI] MOV BL,[SI+1] CMP AL,BL JNC DOWN MOV DL,[SI+1] XCHG [SI],DL MOV [SI+1],DL DOWN: INC SI DEC CL JNZ UP1 DEC CH JNZ UP2 INT 3 CODE ENDS END STARTContinue reading 8086 Assembly Program to Sort Numbers in Descending Order
8086 Assembly Program to Sort Numbers in Ascending Order
In this blog post, we will explore an 8086 assembly language program designed to sort a list of numbers in ascending order. Sorting is a fundamental operation in computer science, and understanding how to implement it at the assembly level provides valuable insights into low-level programming and processor operations.
The following assembly program sorts an array of numbers in ascending order using the bubble sort algorithm:
DATA SEGMENT STRING1 DB 99H,12H,56H,45H,36H DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX MOV CH,04H UP2: MOV CL,04H LEA SI,STRING1 UP1: MOV AL,[SI] MOV BL,[SI+1] CMP AL,BL JC DOWN MOV DL,[SI+1] XCHG [SI],DL MOV [SI+1],DL DOWN: INC SI DEC CL JNZ UP1 DEC CH JNZ UP2 INT 3 CODE ENDS END STARTContinue reading 8086 Assembly Program to Sort Numbers in Ascending Order
8086 Assembly Program to Count Number of 0’s and 1’s from a String
In this blog post, we’ll explore how to count the number of ‘0’s and ‘1’s in a binary string using an 8086 assembly language program. The following code snippet demonstrates this process:
DATA SEGMENT STR1 DB "00011100" NZ DW ? NO DW ? DATA ENDS CODE SEGMENT ASSUME CS:CODE, DS:DATA START: MOV AX, DATA MOV DS, AX LEA SI, STR1 MOV BX, 00H MOV DX, 00H MOV CX, 08H UP: MOV AX, [SI] ROR AX, 1 JNC ZE INC BX JMP DN ZE: INC DX DN: INC SI DEC CX JNZ UP MOV NZ, DX MOV NO, BX INT 3 CODE ENDS END STARTContinue reading 8086 Assembly Program to Count Number of 0’s and 1’s from a String
8086 Assembly Program to Count Number of 0’s and 1’s from a Number
This blog post presents an 8086 assembly program designed to count the number of 0s and 1s in a given 16-bit number. We’ll explore the bit manipulation techniques used and analyze the program’s execution flow.
Continue reading 8086 Assembly Program to Count Number of 0’s and 1’s from a Number8086 Assembly Program to Convert Binary Number into BCD Format
In this blog post, we will explore an 8086 assembly language program designed to convert a binary number into its Binary-Coded Decimal (BCD) format. This conversion is essential in applications where binary numbers need to be represented in a decimal-like format, such as digital displays or interfaces that require human-readable numbers.
The following assembly program performs the conversion:
DATA SEGMENT NO1 DB "1001000000110110" D1 DW 4 DUP (?) DATA ENDS CODE SEGMENT ASSUME CS:CODE, DS:DATA START: MOV AX, DATA MOV DS, AX LEA SI, NO1 LEA DI, D1 MOV CX, 04H TOP: MOV BX, 00H MOV AX, [SI] ROR AX, 1 JNC P2 ADD BX, 08H P2: INC SI MOV AX, [SI] ROR AX, 1 JNC P3 ADD BX, 04H P3: INC SI MOV AX, [SI] ROR AX, 1 JNC P4 ADD BX, 02H P4: INC SI MOV AX, [SI] ROR AX, 1 JNC P5 ADD BX, 01H P5: MOV [DI], BX INC DI INC SI DEC CX JNZ TOP INT 3 CODE ENDS END STARTContinue reading 8086 Assembly Program to Convert Binary Number into BCD Format