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
Develop a list of privacy protection features that should be present if a website is serious about protecting privacy. Then, vis
dusya [7]

Answer:

The features that required to protect the privacy should be:

  1. Protection of User name and Password
  2. Protection of Finger print and other bio metric information if collected from user.
  3. Protection of Personnel Information such as contact information, Identity information if collected.
  4. Protection of data shared such as pictures and videos.

Explanation:

Privacy protection is required to different websites that are involved in collection of different information from users such as user name, password, contact information, account information and messengers. These websites could be website of some bank, online mailing platforms, online shopping platform and social media platforms. These all are used to share and gather our personnel information for different purposes. To ensure the protection of user data they signed a document with users at the time of making account.

The above mentioned are the features that should be included in privacy protection of the website. As all mentioned features are personnel for every user and should be protected from hackers.

3 0
3 years ago
How are texting and instant messaging alike?
Arlecino [84]

Well first u have to know what Instant messaging is .When you instant message a person, you usually find a friend at your school or work who also have the same messenger system. Then you download either yahoo messenger or aol messenger which are both free of cost and viruses.Texting is just the same Only difference is data and how u have to pay to text. I hoped i helped

8 0
3 years ago
Read 2 more answers
The internet maybe best compared to what
attashe74 [19]
The internet can be compared to many stuff, such as a world wide web, or a huge box with stuff and you put in what you want and it comes out! 
6 0
3 years ago
When saving a memo you created in Word, which one of the following extensions is automatically assigned to the document?
VMariaS [17]
What are the options and if it's meaning like when you save something it has .pdf .jpg or .doc after the title then it would be ".doc"
8 0
3 years ago
¿Qué diferencia existe entre un virus biológico y virus informático?
ddd [48]

Answer:

i dont know spanish but i am gussing that you want to find differnce in virus information?

Explanation:

6 0
3 years ago
Other questions:
  • NEED ASWERS FAST
    12·1 answer
  • 1) The program reads an integer, that must be changed to read a floating point. 2) You will need to move that number into a floa
    6·1 answer
  • Which security control is most helpful in protecting against eavesdropping on wireless LAN (WLAN) data transmissions that would
    6·1 answer
  • To filter a list with the Filter function, on an Excel spreadsheet, you need to perform the following steps: (1) click in any ce
    9·1 answer
  • The operating system provides a ____, which is the means with which you interact with the computer
    5·1 answer
  • Can you please help me with the AP Computer Science Fill in the blank. What goes on number 5 8 and 18. I don’t understand this I
    8·1 answer
  • In the context of computer and network security, a security system is said to possess _____ when it does not allow data to be co
    13·1 answer
  • Write a python program that will read a number (num) and display all the numbers divisible by 3 or 5
    15·1 answer
  • Do you guys answer questions about cyber security?
    10·1 answer
  • Is there an air flow through the house? if so, does the air flow in the window and out the chimney, or in the chimney and out th
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!