TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: ALL
from: BO SCHREURS
date: 1997-09-03 23:33:00
subject: Array of Structures

 * Crossposted from: comp.lang.asm.x86
Hi,
I've got a question about placing data in a structure array.
In TASM and MASM one can define a structure (i.e. Fields),
One can also define an array (i.e. Array) consisting of
let's say 10 Fields structures.
Each element in the array is such a structure (see code below).
Now I want to fill all the elements within the array with data.
The code below does it for the first element of the array.
But how do I fill the second, third....tenth element?
In this example the size of the structure is known, and
we could work with offsets and such, but
let us assume we don't know the size of the structure upfront...
I read several Assembly books, but found no answer there
Only the Microsoft Macro Assembler Bible told me how to set up
a structure array, but not how to fill it with data.
Can someone tell me how that is accomplished?
Thank you for your attention.
Bo.
ps, the code below compiles and runs ok using Turbo Assembler.
-------------------------------- Code ----------------------------------
        IDEAL
        MODEL   small
        STACK   256
        DATASEG
Struc   Fields
  Field1                DB             7  dup (" ")
  Field2                DB             1  dup (0)
  Field3                DB             1  dup (000h)
ends
Array                   Fields 10 dup ()
        CODESEG
Main:   
        mov     ax, @data
        mov     ds, ax
        mov     [Array.Field1], "A"
        mov     [Array.Field2], 1
        mov     [Array.Field3], 001h
        xor     ax, ax
        mov     ah, 04Ch
        int     21h
        END
------------------------------- End Code ----------------------------------
Programming using Windows calls, is like installing a radio in your
car and say "look I've constructed a car".
If you really want to construct your own "car" use DOS calls.
--- Platinum Xpress/Win/Wildcat5! v2.0
---------------
* Origin: STack bbs, Hertogenbosch, 073-6901425, node (2:284/520)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.