answersLogoWhite

0

Binary search program for 8085

Updated: 8/10/2023
User Avatar

Wiki User

11y ago

Best Answer

Res db " position",13,10,"$"

msg2 db 'key not found!!!!!!!!!!!!!. $'

.code

mov ax,@data

mov ds,ax

mov bx,00

mov dx,len

mov cx,key

again:cmp bx,dx

ja fail

mov ax,bx

add ax,dx

shr ax,1

mov si,ax

add si,si

cmp cx,arr[si]

jae big

dec ax

mov dx,ax

jmp again

big:je success

inc ax

mov bx,ax

jmp again

success:add al,01

add al,'0'

mov res,al

lea dx,msg1

jmp disp

fail:lea dx,msg2

disp:mov ah,09h

int 21h

mov ah,4ch

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

To do a binary search on a list of numbers, the algorithm is

  1. Initialize two pointers, low and high, to point to the first (low) and last (high) elements of the list. (The list must be in ascending order.)
  2. Start of loop, loop until low is greater than high...
  3. Initialize pointer, mid, to be (low + high) / 2.
  4. If mid points to item desired, stop - you have found the item.
  5. If mid points to item above search term, set high to mid - 1 and loop.
  6. otherwise set low to mid + 1 and loop.
  7. At this point, you know the search term is not found. You also know that low points to where it would need to be inserted into the list.
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Binary search program for 8085
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Program for interfacing of relay with 8085?

we want relay interface with 8085 and also attech the program


Best first search program in c?

The best search programs to attempt writing in C are the following: Linear search (simplest), Binary search (faster) Hash search (fastest).


Program to count the number of numbers in an array using 8085 microprocessor?

A program which is used to count the number of numbers in an array using a 8085 microprocessor is known as a assembly language program.


Prime numbers between 1 to 10 in microprocessor 8085?

program to find prime number in 8085 microprocessor


How you can run a c program in Linux 2.4?

if it is n already compiled binary program: ./program-name if it is a code, gcc program-code.c -o program-name if gcc is not installed, on debian: search for a deb package and install it, or, apt-get install gcc on redhat: search for an rpm package and install it.


What assumption about the list is made when binary search is conducted?

Binary search requires that the list be in search key order.


Implementation of binary search algorithm using ASM assembler in 8086?

Hi, I hope this is useful http://www.indiastudychannel.com/projects/2748-Assembly-language-program-for-Binary-search.aspx good luck!


Program to convert hex to decimal in 8085?

jump,b


2x2 matrix multiplication program in 8085 processor?

how to write a program for matrix multiplication in microprocesspr


What is the use of binary?

Binary trees are commonly used to implement binary search tree and binary heaps.


A binary search of an orderd set of elements in an array or a sequential search of the elements.Which one is faster?

A binary search is much faster.


What is the binary number for decimal 191?

It is 10111111 in binary. Try a search for '191 to binary'.