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]
4 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]4 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
The inflationary gap occurs when you obtain no increase in output, but only an increase in the Average Price Level from an incre
Dafna11 [192]
<span>B. Second phase of the Keynesian LRAS Curve.</span>
5 0
3 years ago
Digital information is stored using a series of ones and zeros. Computers are digital machines because they can only read inform
ryzh [129]
Is known as the binary system
8 0
3 years ago
Read 2 more answers
Why do we use Boolean Logic operators when searching a topic?
gizmo_the_mogwai [7]
We use Boolean Logic operators because it saves more time when searching a topic. This connects pieces of information in a search allowing you to find exactly what you are looking for.
6 0
3 years ago
“What is an example of the vocabulary word foreshadow?” This question could be a
Yanka [14]

Answer:

D) Both A and C

Explanation:

3 0
3 years ago
Suppose you want to click up- and down-arrows on a "control" to change the value of the product price in cell C7. What form cont
Julli [10]

Answer:

Spin button.

Explanation:

Spread sheet applications are softwares used to analyze and manipulate data for clean and easy data presentation.

It is composed of columns or fields and rows or records to make a worksheet of a workbook in the application. Each box on the worksheet is called a cell.

Data can be inputted directly to a cell or with functions and formulas and with the form control feature.

Form control is use to specify the range of input to use in cells for easy data input. The spin button of the form control is used to input data by pressing the up and down arrow key on the keyboard.

8 0
3 years ago
Other questions:
  • Concept of CPU scheduler?​
    7·1 answer
  • ________ is a password-cracking method wherein the attacker compares passwords to lists of common words.
    12·1 answer
  • Carrie is creating a personal balance sheet. The heading includes the period of time that the balance sheet
    11·1 answer
  • What does the clone tile command do?
    15·2 answers
  • Your organization is planning to deploy wireless access points across their campus network, and you have been tasked with securi
    5·1 answer
  • Which role is delegated to personnel of the IT department and is responsible for maintaining the integrity and security of the d
    10·1 answer
  • Calculate the cash available to retire debt for each of the six months. There is cash available to retire debt if there is a cas
    8·1 answer
  • Write a short essay on the importance of information and communication technology (ICT) in the AFN industry. Add suitable exampl
    11·1 answer
  • Which type of information should never be given out on social media?
    5·2 answers
  • What should you do if a headset plugged into your computer is not working properly.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!