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
What is a independent variable
katovenus [111]
An independent variable is many things. In math, it is the x axis or something that doesn't depend on anything else, like time. But in an experiment it's the thing that you have control over and can change to see how it effects your results. Hope this helped!
7 0
3 years ago
I need help thanks please!
maw [93]

Answer:

a) to persuade

she is doing this to propose an idea to the boss of the company

6 0
3 years ago
Read 2 more answers
Enlist the various data analysis methods for study of Infrasonic waves, Seismic waves, Earthquake prone areas and how AI can be
snow_tiger [21]

Answer:

Throughout the clarification segment below, the essence including its query is mentioned.

Explanation:

  • The analytical techniques utilize magnetic fields that allow the waves to be analyzed.
  • They sometimes use echolocation strategies.
  • It is possible to be using artificial intelligence to research potential forecasts. Climate, improvements throughout the climate as well as other things.
  • Like toxic waves, this will be capable of predicting tides.
5 0
3 years ago
You have found statistics on the Internet that you would like to use in your speech.
miss Akunina [59]

Answer:

You cite them correctly and that the statistics are real.

Explanation:

5 0
3 years ago
What is the best wi-fi name you have ever seen?
elena-s [515]

Answer:

bill wi the science fi

Explanation:

8 0
3 years ago
Other questions:
  • If you’d like to have multiple italicized words in your document, how would you change the font of each of these words?
    7·2 answers
  • Your assignment is to write an assembly language program which read a string and print it in uppercase. This program asks the us
    15·1 answer
  • Write a Temperature class that will hold a temperature in Fahrenheit and provide methodsto get the temperature in Fahrenheit, Ce
    14·1 answer
  • Please help! 40 points + Brainliest!
    8·1 answer
  • Trace the evaluation of the following expressions, and give their resulting values. Make sure to give a value of the appropriate
    11·1 answer
  • Does digital media play a big role in your life?
    13·1 answer
  • Qr code is more developed than barcode​
    11·1 answer
  • Launa is reviewing several videos from her friends doing the latest dance challenge before they are published on their own
    11·1 answer
  • Write a program to find the principle amount​
    10·1 answer
  • Briefly explain how Riboflavin deficiency lead to disease state.​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!