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
Identify the calculation performed by the following code.
lbvjy [14]

Answer:

48

Explanation:

The function returns length * width

In the function call, the values are legnth: 8 and width: 6 this means the function is returns 8 * 6 wich is 48.

8 0
2 years ago
Why does the randomNumber function only use whole numbers between 0 and 1 (basically, 0 and 1)?
Bogdan [553]

Answer:

The randomNumber function only uses whole numbers between 0 and 1 because those are the unspecified minimum and maximums to get random numbers. If you want a larger range, <em>just specify the minimum and maximum.</em>

Explanation:

<em>Example code on how to specify a larger range, replace max and min with your maximum and minimum integers.</em>

function getRandomArbitrary(min, max) {

 return Math.random() * (max - min) + min;

}

6 0
3 years ago
How does a pond form?
ehidna [41]

Answer:

B

Explanation:

because the other answers dont make sense

6 0
3 years ago
Lin is booting up his computer, and during the boot process, the computer powers down. After several unsuccessful attempts to bo
Alex787 [66]

Answer:

A. Processor.

Explanation:

When a computer system works working or does not boot, it is mostly ask a result of power supply failure.

The system does not come on, that is, the fan and screen does not come up and the caps lock indicator is not blinking. The power supply shows that the power is good.

When the processor is not sitting properly and when the motherboard has failed, the signs mentioned above are observed.

Not to escalate the problem, test for the processor status as a probable cause with another functional and compatible processor before the motherboard.

4 0
3 years ago
Soa contains a lot of benefits, but _________ is not considered one of them.
AysviL [449]

SOA contains a lot of benefits, but been hard to handle is not considered one of them.

<h3> What is Service Oriented Architecture (SOA)? </h3>

The  Service Oriented Architecture  is known to be where all parts are set up to be services.

They are said  to be Easy to handle new version for subset of users and one can easily get back from mistake in one's design.

The SOA characteristics are:

  • Their Services are self-contained and modular.
  • Their Services support interoperability.
  • Their Services are loosely put together.

Learn more about  Service Oriented Architecture from

brainly.com/question/14835966

8 0
3 years ago
Other questions:
  • Write a unit test for addInventory(). Call redSweater.addInventory() with parameter sweaterShipment. Print the shown error if th
    9·2 answers
  • Which syntax error in programming is unlikely to be highlighted by a compiler or an interpreter? a variable name misspelling a m
    6·2 answers
  • Edhesive silly questionsj
    8·1 answer
  • Which quality of service (QoS) mechanism provided by the network does real-time transport protocol (RTP) rely on to guarantee a
    13·1 answer
  • Analog false color in computer graphics
    6·1 answer
  • Can you answer your own question on brainly?
    12·2 answers
  • What actions are considered positive body language?
    12·1 answer
  • You need to provide connectivity between two buildings without running any cables. You decided to use two 802.11ac APs to provid
    14·1 answer
  • If you filmed a clip in 120fps, how many frames are in a seconds of video.
    13·1 answer
  • Which of these is a problem that a computer CANNOT solve? *
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!