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
How to change the indent of the list item "regular" on slide 2 to .5 inches in powerpoint?
galina1969 [7]
<span>You can change the identation of text in Powerpoint by right clicking on the list item and selecting, "Format Text". On the paragraph tab, you can adjust the indentation before text as given in inches.</span>
4 0
3 years ago
Which one of the following devices would you choose to meet those requirements?
tensa zangetsu [6.8K]
What are the requirements
5 0
2 years ago
Read 2 more answers
PLEASE HELP
Schach [20]

Answer:

Here

Explanation:

If you use a single user account on your computer, everyone will share the same application settings, files, and system permissions. Application Settings: When you use a single user account, everyone using the computer will use the same browser. Most programs will use different settings for each user account.User accounts also serve as a means for granting permissions, applying logon scripts, assigning profiles and home directories, and linking other working-environment properties to a user.

hope it helps ;P

7 0
3 years ago
Engineers perform a(n) blank to compare the possible negative effects of making a decision involving technology with the possibl
Bumek [7]

Answer: Experiment.

Explanation:

4 0
3 years ago
Read 2 more answers
Which option to find green computing
larisa86 [58]

Explanation:

  • "Study and practice" of environmental sustainable computing
  • It is the study which is analyzing the use of IT peripherals such as keyboard, mouse, printer, scanner, etc to be used without burdening the environment.
  • As we all aware that even the usage of Air conditioner, Refrigerator, mobile phones and any other gadgets pollute environment and mainly affects ozone layer.
  • Now we cannot live or be productive without gadgets at the same time we shouldn't burden the environment. Study about this particular approach is termed as Green computing or green technology.
5 0
3 years ago
Read 2 more answers
Other questions:
  • What does pagination mean in Microsoft Word?
    10·2 answers
  • A general rule for adding text to a slide is ____.
    8·2 answers
  • True or false A ClassB fire involves live electrical equipment
    5·1 answer
  • In a natural-language processing (NLP) system, the__________activity involves using the computer to read large amounts of text a
    9·1 answer
  • Which of the following is the core of an operating system that maintains the computer’s clock, starts applications, and assigns
    5·1 answer
  • The default (preset slide layouts are set up in ____ orientation.
    15·1 answer
  • Given the function definition void something ( int a, int&amp; b ) { int c; c = a + 2; a = a* 3; b = c + a; } what is the output
    6·1 answer
  • The network team has well established procedures to follow for creating new rules on the firewall. This includes having approval
    15·1 answer
  • Exodia<br>Principle of Computer Operation​
    13·1 answer
  • The _____________computer function accepts data from input devices and sends it to the computer processor.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!