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