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
dlinn [17]
3 years ago
8

Suppose you are given three data items that indicate a starting index in a list, an array of characters, and an array of link in

dex. You are to write a program that traverses the links and locates the characters in their correct sequence. For each characters you locate, copy it to a new array. Suppose you used the following sample data, and assumed the arrays use zero-based indexes:
start = 1
chars: H A C E B D F G
links: 0 4 5 6 2 3 7 0
Then the values copied (in order) to the output array would be A,B,C,D,E,F,G,H. Declare the chraracter array are a type BYTE, and to make the problem more interesting, declare the links array type DWORD.
Computers and Technology
1 answer:
Artemon [7]3 years ago
7 0

Answer:

see explaination

Explanation:

INCLUDE Irvine32.inc

;declare the variables

SPACE = 32

startIndex = 1

.data

statement BYTE "The correct sequence of array: ",0

; declare the chars('H','A','C','E','B','D','F','G')

chars BYTE 48h,41h,43h,45h,42h,44h,46h,47h

sizeOfArray = ($ - chars)

links DWORD 0,4,5,6,2,3,7,0

outputArray BYTE sizeOfArray DUP(?)

.code

main PROC

; assign starting index

mov eax,startIndex

; assign offset of array chars

mov ebx,OFFSET chars

; assign the size of the array

mov ecx, sizeOfArray

; assign the offset of array links

mov edi,OFFSET links

; assign the offset of new array

mov esi,OFFSET outputArray

; call the traverseLink procedure

call traverseLink

; display the characters of new array

mov edx,OFFSET statement

call writeString

; assign the offset of new array

mov esi,OFFSET outputArray

; assign the size of the array

mov ecx, sizeOfArray

; call the procedure printArray to print the ordered array

call printArray

exit

main ENDP

traverseLink PROC

forLoop:

; get the character at index eax

mov dl,[ebx+eax]

; assign it to new array

mov [esi] , dl

; get the value at the next index

mov eax,[edi+eax*4]

; goto next location of new array

inc esi

; repeat until ecx=0

loop forLoop

ret

traverseLink ENDP

printArray PROC

forLoop:

; get the character at index eax

mov al,[esi]

; print the character

call WriteChar

; increament esi to get next character

inc esi

; print the space character

mov al,SPACE

call WriteChar

loop forLoop

call Crlf

ret

printArray ENDP

END main

You might be interested in
If (accountBalance < 1000.00):
andreyandreev [35.5K]

Answer:

See explanation

Explanation:

Given

The code segment

Required

The output

The code segment is incomplete, as the value of accountBalance is not given.

However, I will explain the given segment using few illustrations.

The following will be executed if accountBalance is less than 1000.00

<em>if (accountBalance < 1000.00): </em>

<em>    print(“SAVINGS3”)</em>

Take for instance:

accountBalance = 500.0; "SAVINGS3" will be printed

The following will be executed if accountBalance is less than 2000.00 but more than or equal to 1000.00

<em>elif (accountBalance < 2000.00): </em>

<em>    print(“SAVINGS2”)  </em>

Take for instance:

accountBalance = 1500.0; "SAVINGS2" will be printed

The following will be executed if accountBalance is less than 3000.00 but more than or equal to 2000.00

<em>elif (accountBalance < 3000.00): </em>

<em>     print(“SAVINGS1”) </em>

Take for instance:

accountBalance = 2500.0; "SAVINGS3" will be printed

Lastly, if accountBalance is 3000.00 or greater, the following will be executed

<em>else: </em>

<em>    print(“SAVINGS”)</em>

Take for instance:

accountBalance = 3500.0; "SAVINGS" will be printed

7 0
3 years ago
All of the 802. 11 standards for wireless networking support which type of communication path sharing technology?.
Tom [10]

Answer:

CSMA/CA. It stands for Carrier Sense Multiple Access/Collision Avoidance.

6 0
3 years ago
What is it about Pinterest that makes it a good platform for ecommerce sites?
Inga [223]
With the large variance of items on the site it is easy to invest in an idea
5 0
4 years ago
Read 2 more answers
Which of the following people is responsible for providing worker training on the safe use of the equipment on a construction si
LiRa [457]
A.
Designated competent person
7 0
3 years ago
Read 2 more answers
1. a part of a larger whole (the CPU and hard drive, for instance, can be referred to as computer components; so can much smalle
Leokris [45]

Answer:

1. Hardware components.

2. Hard disk drive HDD RPM 7200.

3. Data.

4. Bluetooth.

Explanation:

The computer system is an electronic device, made of software components and hardware components. The software components are the operating system and application software and other software utilities. The hardware components are the input, output, CPU and memory and storage unit.

The storage unit like the hard disk drive HDD and solid state drive SSD, are used to store data permanently. The HDD RPM 7200, stores data at a resolution of the disk per minutes speed RPM of 7200.

Bluetooth is a wireless information technology medium that allows for communication between computers within a maximum distance of 10 meters.

3 0
3 years ago
Other questions:
  • LDAP is an industry standard employed by Microsoft, which enables IT departments to use a(n) __________ structure when creating
    7·1 answer
  • A number of related records that are treated as a unit is called
    6·1 answer
  • Which of the following statements is used to terminate the program when closing the frame?
    5·1 answer
  • Intellectual property piracy has gotten a small boost from the increasing availability of counterfeit goods through Internet cha
    14·1 answer
  • Rachael has been posting negative comments on several of her peers' social media pages. Which of the six Ps is Rachael abusing?
    15·1 answer
  • Paano mo maipapamalas na ikaw ay may malusog na kaisipan​
    10·1 answer
  • Which of the following are input devices? Check all that apply.
    9·2 answers
  • What is the binary for O?​
    5·2 answers
  • An example of documentary evidence that might be presented at trial for a cyber crime is:
    9·1 answer
  • Which of the following is true about main and secondary memory?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!