I created a structure that held basic information as well as some BYTE strings.. For instance:
EXAMPLESTRUCT STRUCT
somePrompt BYTE 20 DUP (0)
;other fields
EXAMPLESTRUCT ENDS
My intent was to create an array of structures with messages relevant to that specific structure, initializing along the lines of:
ex1 EXAMPLESTRUCT <"Enter first">
ex2 EXAMPLESTRUCT <"Enter second">
Referencing the address of the structure field directly (mov edx, OFFSET ex1.somePrompt) worked fine, but when using indirect addressing I kept getting an OFFSET error:
mov esi,OFFSET ex1
mov edx,OFFSET (EXAMPLESTRUCT PTR [esi]).somePrompt ;Error here
So, is my code wrong, or is this just an illegal use of OFFSET for some reason?
The only work around I've found was making the structure contain pointers and then initializing them to point at message already made:
WORKAROUND STRUCT
somePTR DWORD ?
;...
WORKAROUND ENDS
.data
msg BYTE "Hello World",0
struct1 WORKAROUND <OFFSET msg>
and then displaying a message along the lines of
mov esi,OFFSET struct1
mod edx,(WORKAROUND PTR [esi]).somePTR
Any other solutions/workarounds or should I just stick with pointers?