92.2k views
4 votes
The following data segment starts at memory address 0x3600 (hexadecimal)

.data
printString BYTE "Do not add decimal to hex",0
someBytes WORD 19 DUP(0)
moreBytes BYTE 10, 20, 30, 40, 50, 60, 70, 80, 90
questionAddr DWORD ?
ignoreMe WORD ?

What is the hexadecimal address of questionAddr?

User Gezim
by
5.2k points

2 Answers

3 votes

Final answer:

To find the hexadecimal address of questionAddr, one adds the sizes of variables declared before it in the data segment starting at 0x3600. After accounting for the bytes used by printString, someBytes, and moreBytes, the address of questionAddr is calculated to be 0x364B.

Step-by-step explanation:

The question asks for the hexadecimal address of the identifier questionAddr within a data segment that starts at memory address 0x3600. To calculate the address of questionAddr, we must determine the size of the variables declared before it and add that to the starting address. Here is how the memory is allocated for each variable:

printString: The BYTE declaration for the string "Do not add decimal to hex", followed by a null terminator, uses 28 bytes (26 characters + 2 for the double quote and null terminator).

someBytes: The WORD declaration with 19 DUP(0) indicates that space for 19 words is reserved, and since a word is 2 bytes, this gives us 38 bytes.

moreBytes: The BYTE declaration specifies 9 individual bytes.

Adding it all up:

Start Address: 0x3600

+ printString: 28 bytes

+ someBytes: 38 bytes

+ moreBytes: 9 bytes

= Total: 75 bytes

To get the address of questionAddr, convert the total number of bytes to hexadecimal and add it to the start address:

0x3600 + 0x004B (75 in hexadecimal) = 0x364B

Therefore, the hexadecimal address of questionAddr is 0x364B.

User Heberda
by
5.0k points
1 vote

Answer:

0×3604

Step-by-step explanation:

Since the first instruction is byte addressable so, it will take 1 hexadecimal address so, 0×3600 is the address of printString.

Second instruction is word addressable so, it will take 2 instructions. So, 0×3601 and 0×3602 will be the address of someBytes.

Third instruction is also in byte so, it will also take 1 instruction. So, 0×3603 will be the address of moreBytes

At the end, when we will come to questionAddr uptil now 4 hexadecimal addresses will already be taken that are from 0×3600 to 0×3603 so, questionAddr will take address 0×3604.

User Andymel
by
5.4k points