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

8086 String

This program finds the maximum number in a 16 byte string and stores it in memory location 0510. It initializes registers SI and CX, uses a loop to compare each byte to the accumulator AH and update AH if a larger number is found, and finally stores the maximum in 0510 once the loop finishes. The input string contains numbers from 01-15 and the program correctly identifies 15 as the largest value.

Uploaded by

Koush Rastogi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
164 views

8086 String

This program finds the maximum number in a 16 byte string and stores it in memory location 0510. It initializes registers SI and CX, uses a loop to compare each byte to the accumulator AH and update AH if a larger number is found, and finally stores the maximum in 0510 once the loop finishes. The input string contains numbers from 01-15 and the program correctly identifies 15 as the largest value.

Uploaded by

Koush Rastogi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

MICRPROCESSOR 8086 LAB MANUAL

Object –
Write a program in 8086 assembly language to find the
maximum number in a given string (16 bytes long) and store it
in location 0510.
Apparatus Required –
VMC-8609 8086 Microprocessor training kit, power supply,
keyboard.
Program –
MEMORY OPCODE INSTRUCTION COMMENTS
ADDRESS
0000:0400 BE MOV SI, 0500 Load SI register
0000:0401 00 with starting
0000:0402 05 address of string.
0000:0403 B9 MOV CX, 0010 Initialize counter
0000:0404 10 reg. (with the
0000:0405 00 length of string)
0000:0406 B4 MOV AH, 00 Initialize the 8-bit
0000:0407 00 accumulator
0000:0408 3A CMP AH, [SI] Compare the 1st
0000:0409 24 data byte of string
with ‘00’
0000:040A 73 JAE 040E If both bytes match
0000:040B 02 then branch to
address.
0000:040C 8A MOV AH, [SI] Else, move the
0000:040D 24 contents (of 0500)
into accumulator.
0000:040E 4E INC SI Point at the next
address of string.
0000:040F E0 LOOPNE 0408 Decrement the
0000:0410 F7 counter value, if
not zero, continue
searching for
maximum number
0000:0411 88 MOV [SI], AH Maximum number
0000:0412 24 is moved to 0510
address.
0000:0413 F4 HLT Stop
MICRPROCESSOR 8086 LAB MANUAL

RESULT-
Input:-
Address Data Address Data
0500 01 0508 12
0501 02 0509 08
0502 03 050A 09
0503 04 050B 0A
0504 05 050C 0B
0505 06 050D 0C
0506 15 050E 0E
0507 07 050F 0D

Output:-
0510 15

You might also like