Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6830893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:40:19+00:00 2026-05-26T22:40:19+00:00

I created a structure that held basic information as well as some BYTE strings..

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:40:20+00:00Added an answer on May 26, 2026 at 10:40 pm

    You want to use the lea instruction.

    lea edx,(EXAMPLESTRUCT PTR [esi]).somePrompt
    

    See What's the purpose of the LEA instruction? for a little more about lea.

    OFFSET is a compile-time construct. When you use the OFFSET directive, the assembler must be able to resolve it to a value at compile time. That’s why you were getting an error–because the assembler can’t know what the value of esi will be.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to merge two file that have the same structure, and some data
I'm trying to find a struct I created earlier that has a specific value.
I need to create a structure that holds a variable number of 'char[2]'s, i.e.
If I have a requirement to create a data structure that has the following
I have created a Structure for my XML to work with JAXB Unmarshalling The
I have created a directory structure with an executable file. Following is the output
I have created the following project structure for my new asp.net mvc project any
I have created a table with the following structure- $sql = CREATE TABLE followers
I have created a procedure with this structure but it doesn't work for datetime
I have created a table on an Oracle 10g database with this structure :

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.