1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vesna [10]
3 years ago
5

write an assembly language procedure that also performs the binary search. The C program will time multiple searches performed b

y both the C code and your assembly language procedure and compare the result. If all goes as expected, your assembly language procedure should be faster than the C code.

Computers and Technology
1 answer:
laiz [17]3 years ago
6 0

Answer:

Let’s identify variables needed for this program.

First variables will be the one which will hold the values present in the Given Numbers in Array list and key of 16-bit and it will be array ARR and KEY. variables will be holding the Messages MSG1 “KEY IS FOUND AT “, RES ”  POSITION”, 13, 10,” $” and MSG2 ‘KEY NOT FOUND!!!.$’ to be printed for the User. Other variables will be holding Length of the Array and it will be LEN, So in all Six variables.

The identified variables are ARR, KEY, LEN, RES, MSG1 and MSG2.

DATA SEGMENT

    ARR DW 0000H,1111H,2222H,3333H,4444H,5555H,6666H,7777H,8888H,9999H

    LEN DW ($-ARR)/2

    KEY EQU 7777H

    MSG1 DB "KEY IS FOUND AT "

    RES DB "  POSITION",13,10," $"

    MSG2 DB 'KEY NOT FOUND!!!.$'

DATA ENDS

CODE SEGMENT  

   ASSUME DS:DATA CS:CODE

START:

     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

     INT 21H      

CODE ENDS

END START

In this Assembly Language Programming, A single program is divided into four Segments which are 1. Data Segment, 2. Code Segment, 3. Stack Segment, and 4. Extra  Segment. Now, from these one is compulsory i.e. Code Segment if at all you don’t need variable(s) for your program.if you need variable(s) for your program you will need two Segments i.e. Code Segment and Data Segment.

Explanation:

The attached Logic is a C like Program to conduct a binary search we need small Algorithm Shown above in a very simple way, So Just we will covert the logic into Assembly There are many things uncommon in the programing Language. There are No While Loops or Modules but this things are to be implemented in different ways.

You might be interested in
Create a class called Circle, which has (i) an attribute radius, (ii) a method that returns the current radius of a circle objec
nadya68 [22]

Answer:

Explanation:

The following class is written in Java. I created the entire Circle class with each of the methods and constructor as requested. I also created a tester class to create a circle object and call some of the methods. The output can be seen in the attached picture below for the tester class.

class Circle {

   double radius;

   public Circle(double radius) {

       this.radius = radius;

   }

   public double getRadius() {

       return radius;

   }

   public void resetRadius() {

       radius = 0;

   }

   public double calculateArea() {

       double square = Math.pow((Math.PI * radius), 2);

       return square;

   }

}

8 0
2 years ago
The small, touch-sensitive area at the base of the keyboard on a notebook computer is known as a ________.
USPshnik [31]
Trackpad.

(Sheep sheep mr sheep meep)
8 0
3 years ago
Read 2 more answers
What is the difference between a 13 column abacus and 5 column abacus?
Pepsi [2]

Answer:  The difference between these two types of abaci are the number the beads.

Explanation:

have a great day or night

4 0
3 years ago
You are running cable for a temporary network in a large auditorium. What is the maximum length you can have for the Ethernet ca
mote1985 [20]

It would be about 1K yards because it is a, as you stated<em> and</em> not to be rude, a large auditorium and 1K yards is the biggest number there.

4 0
3 years ago
Which of the following tools enables users to connect to a remote computer, including servers with no interaction required from
musickatia [10]

Answer:

Option (A) i.e., Remote Desktop is the correct answer to the following question.

Explanation:

The following option is correct because the remote desktop is an application or software which connects your computer to another system through the internet from anywhere and we can also connect with each other without the internet but in a range.

<u>Steps to connect in Windows 10</u>:

Step-1: Firstly, start your window and click on the start button.

Step-2: Then, type remote setting in search box.

Step-3: Then, you have to allow the remote access to the system.

Step-4: Then, you have select the Remote Tab which appears in System Properties.

Step-5: Then, you have to click and select the to Allow the Remote Connection.

7 0
3 years ago
Other questions:
  • For some brand-name computers, the hard drive contains a partition that can be used to reinstall windows. what is the name for t
    6·1 answer
  • What is the utility of a lever?
    11·2 answers
  • How do I persuade my parents to allow me to have social media? I will be 15 in a week or so, so I am old enough. I'm pulling my
    5·1 answer
  • According to the government, employees have a right to understand the risks associated with the materials they work with.
    15·1 answer
  • Which page in a web site do viewers usually see first?
    15·1 answer
  • Edhesive 3.4 practice 1
    9·1 answer
  • Arrange the Jumbled letters 1.eilf ngrihsa ________________ 2.cersityu ourreecs ________________ 3. ngrihsa ________________ 4.
    12·1 answer
  • WHAT ACTIONS CAUSE SPAM ON LINKEDIN?
    5·1 answer
  • Nearly all social software systems include a(n) ________, which helps control your information flow.
    6·2 answers
  • associate true with the variable has_dups if the list list1 has any duplicate elements (that is if any element appears more than
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!