简体   繁体   中英

what is the absolute address for data segment variable in assembly?

.data

len dw 10
msg db "1234567890"

.code
....

Address for segments DS= 0ACA CS =0AC7

What is the absolute address for string msg?

What I understand is effective address for msg is 21 in dec which 15H, then I do DS:0015 which is ACB5 but it's not working..

The answers available are:

0ACA2

0ACC0

0ACC

0ACA0

Given your curent assumptions, you are making a sound calculation for the linear address.

(0ACAh << 4) + 0015h does indeed produce the linear address 0000ACB5h.

However, why do you understand that the msg label is at offset 21 (15h)?

Making the acceptable assumption that the DS segment register is pointing at the .data section and seeing next code snippet

.data
len dw 10
msg db "1234567890"

where the len variable occupies 2 bytes because that is what dw (DefineWord) does, the offset to msg will rather be 2 .

If you redo your calculation, you'll see that the correct answer in on the provided list...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM