hi,
in the masm manual there's this syntax used in one example
mov al, (DATE PTR [bx]).month
they don't seem to mention there anything much about the round brackets usage.
i understand the usual dot referencing of structure elements, & getting the start offset in a reg & accessing the rest of the elements;.. just the round brackets & that whole line don't make sense
by trying it out I can kinda see what it does.. but syntax wise.. the whole thing doesn't make any sense.
Another thing, i tried this example & this line doesn't work movzx eax, (today ptr [ebx]).month , while this line works movzx eax, (date ptr [ebx]).month
thankyou.
date struct
month db 5
day db 2
year dd 1971
date ends
today date <>
.code
start:
mov ebx, offset today
movzx eax, (date ptr [ebx]).month
; movzx eax, (today ptr [ebx]).month ; this line doesn't work
fn MessageBox, 0, ustr$(eax),"Value", MB_OK
exit
to the 2nd question;.. i guess movzx eax, (today ptr [ebx]).month doesn't work because, it just takes a type argument, not a varaible defined as a structure type. - the reason for that part seems clearer now, the 'type' supplies the template.. & the [ebx] part supplies the start offset
And here comes the power of masm:
movzx eax, ((type today) ptr [ebx]).month
In what other assembler can you do this...
drizz, that's great i tried that..& it works!! ; )
- - - - - - -
I seen this in the ml manuals
[register]. field [[. field]]. . .
and i tried this code.. but it doesn't work.. what am i doing wrong.
mov ebx, offset date
movzx eax, [ebx].day
Thankyou
-
Use assume!
assume ebx:ptr date
mov ebx, offset date
movzx eax, [ebx].day
assume ebx:nothing
or
mov ebx, offset date
movzx eax, [ebx].date.day
drizz , thanks a lot for the solutions, & voodoo ; )
I'm just trying to make sense of all the syntax usage, especially the typedef related stuff & accessing the structures in these ways- (if you know any sections of the documentation that, are particularly related to all this kind of usage.. pls, give me a pointer.)