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

  • SEARCH
  • Home
  • 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 8370399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:54:10+00:00 2026-06-09T13:54:10+00:00

I am trying to learn assembly language. Can someone explain and/or give an example

  • 0

I am trying to learn assembly language. Can someone explain and/or give an example of how to use addressing modes to access elements in each of the following array types?

  1. array of DWORD

  2. array of structures, where each structure contains two DWORDs

  3. array of arrays, where each array has 10 DWORDs

  • 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-06-09T13:54:11+00:00Added an answer on June 9, 2026 at 1:54 pm

    You don’t mention which processor specifically you are targeting, but in 386+ this would work. I don’t have MASM, but MASM uses Intel syntax.

    1. Let’s assume that ebx is the base register and esi is the index register of the element. Standard 32-bit registers (eax, ebx, ecx, edx, ebp, esi, edi) are valid for the addressing mode used here. esp can be used as base register but not as index register. The value of index register can be optionally scaled with 2, 4 or 8. In this example we can use a scaling factor 4 for a dword array (in 386 legal scaling factors are 1, 2, 4 and 8).

      to read the value from array into eax: mov eax, [ebx+4*esi]
      to store the value of eax into array: mov [ebx+4*esi], eax

    2. Let’s keep still ebx as the base address. We can use a scaling factor 8 for esi for a struct array in which each struct consists of 2 dwords.

      to read the value of the first dword into eax: mov eax, [ebx+8*esi]
      to store the value of eax into first dword: mov [ebx+8*esi], eax

      to read the value of the second dword into eax: mov eax, [ebx+8*esi+4]
      to store the value of eax into second dword: mov [ebx+8*esi+4], eax

      If the index can’t be hardcoded, you can just add 4 to ebx (or whatever registers you use to store the base address). And if you have hardcoded base-address, then you could use eg. esi to address the struct and eg. ebx to address the dword you want. Note that in 386+ you can’t scale more than one register (the index register) in indirect addressing.

    3. Let’s still assume you don’t know the base address of your array beforehand, and you’ll have it in ebx, in esi you have the index of the struct and in edx you have the index of the dword.

      To get the address of the struct you can use lea multiplication optimization (10 = 8 + 2):

      Edit: Fix: lea esi,[4*esi] (dword is 4 bytes)

      lea edi,[ebx+8*esi]

      lea edi,[edi+2*esi]

      Now you have the address of the struct in edi. You just need to add the index of the dword (stored in edx in this example) multiplied by 4 (because each dword is 4 bytes).

      To read value of dword to eax: mov eax,[edi+4*edx].

      To store value of eax into dword: mov [edi+4*edx],eax.

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

Sidebar

Related Questions

I am trying to learn assembly language and I need clarification on something. Please
I am trying to learn writing assembly language for 64 bit Mac OS. I
I am trying to learn assembly language. I have searched and found how to
I'm trying to learn MIPS Assembly by learning MIPS Assembly Language Programming . In
I am trying to learn assembly my self, and I have been reading different
I am trying learn the use of lambda expressions and hence still struggling to
Trying to learn Sencha Touch 2 and I can't seem to find out how
I have been trying to learn assembly for a few years now. I get
I am trying to learn inline assembly programming in Delphi, and to this end
I've been trying to learn 32-bit Intel x86 nasm syntax assembly on my Linux

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.