how to declare 1024 nodes of 4 bytes each in assembly language?

Recommended Answers

All 9 Replies

did you try something like this?

data db 1024 * size node

but what is " size node" and "*" operator is perhaps not applicable in assembly

Here is a good tutorial about structures in assembly programs

the problem is that i haven't studied structures in assembly
i am supposed to deal with linked lists

Before we go further, can you tell us which assembler you're working in? There are significant differences in how different assemblers handles structures.

Also, if you're working in linked lists, we'll also need to know the operating system, as you'll need to use the system calls for memory allocation and deleting.

This thread may help you understand how structures in assembly work, though it uses a specific assembler/emulator (SPIM, a MIPS emulator) for its examples; more advanced assemblers such as MASM and Netwide Assembler have built-in support for structures that is comparable to languages such as C.

the problem is that i haven't studied structures in assembly
i am supposed to deal with linked lists

Well you had better get to studying them because that's what linked lists use. In assembly language structures may be also called records.

i am working in MASM

OK, then. Assuming that we're talking about 16-bit code, a simple linked list node in MASM might look like this:

node STRUCT
    data WORD ?
    next WORD ?
node ENDS

Of course, the structure itself isn't the only important factor; it's how you use it that counts. The structure is more or less a template or pattern for a particular interpretation of a block of memory. In the case of a linked list, generally speaking this memory will be allocated at run time from the operating system.

thanks a lot :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.