1. For this problem, suppose that you are working with the partial data segment
ID: 3788535 • Letter: 1
Question
1. For this problem, suppose that you are working with the partial data segment given below. Assume that the memory address of balance is 0x44. What hexadecimal address belongs to the first item in history?
HISTLIMIT = 100
.data
balance DWORD 0
account WORD ?
history WORD HISTLIMIT DUP(?)
isValid BYTE 0
2. For this problem, suppose that you are working with the partial data segment given below. Assume that the memory address of balance is 0x44. What hexadecimal address belongs to the last item in history?
HISTLIMIT = 100
.data
balance DWORD 0
account WORD ?
history WORD HISTLIMIT DUP(?)
isValid BYTE 0
Please help understand how you git the result. Thanks
Explanation / Answer
.data size in hex size in bytes
balance dword (0x04) 4 bytes
account word? (0x02) 2 bytes
history word histlimit dup(?) (0xC8) 2x100=200 bytes
1.
hexadecimal address of firstitem in history=address of balance+size of balance+size of account
=0x44+0x04+0X02
=0x4A
2.
hexadecimal address of lastitem in history=address of balance+size of balance+size of account
+size of history-1bytesize (to get address of last item, we remove its size)
=0x44+0x04+0X02+0xC8-0x01
=0x4a+0xC7
=0x111
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.