0
MYDATA SEGMENT

ARRAY DD 30 DUP(?)
MESSAGE DB 'Hello World$'
BA DD MESSAGETWO

MYDATA ENDS


DATASECOND SEGMENT

HELLO DB 20 DUP(?)
MESSAGETWO 'I AM ASSEMBLY$'

DATASECOND ENDS

The Physical address of MYDATA is 19AC0h

What is the offset of MESSAGE ? what is the offset of MESSAGETWO ?

I don't know how to do it, do I just count the array (30) + count the letters in MESSAGE ? (11) = 41 ?

And what about MESSAGETWO ? Does it matter it is not the same segment?

Thank you!

CodeCop
  • 1
  • 2
  • 15
  • 37
  • 1
    Please tag this MASM and/or x86-16 if that's what you're asking about. – Peter Cordes May 10 '20 at 01:40
  • @PeterCordes I will sir. – CodeCop May 10 '20 at 01:41
  • 1
    It should be pretty much how you say it is. I am not super familiar with MASM and it could be that that assembler adds some implicit padding or something, so I don't feel confident writing an answer. But I do think you have the right idea. But do note that since the array is an array of dwords, each entry is 4 bytes long. Same for `BA`. – fuz May 10 '20 at 02:00
  • @fuz Thank you! The thing is, I need to find the offset not its address so is the information about the physical address of MYDATA segment is redundant ? because offset is just how 'deep' things inside the segment, no? and also about the Dword array- does it mean ARRAY DD 30 takes up 30*4 bytes? thank you! – CodeCop May 10 '20 at 02:03
  • 1
    @StackOMeow I can't tell you about your first question. And yes, if each element of the array occupies 4 bytes, then the whole array occupies 120 bytes. – fuz May 10 '20 at 02:11

0 Answers0