flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Data Structures in FASM (tree, list, stack...)

Thread Post new topic Reply to topic

Joined: 05 Dec 2005
Posts: 201
Hi guys,

Is there any implemented code in FASM to dynamically create common data structures like tree, lists, etc.?

I have seen that revolution has implemented macros for static lists, but what about dynamic lists? So, we can add, delete, find elements in runtime.

Post 04 Oct 2010, 19:30
View user's profile Send private message Reply with quote

Joined: 20 Feb 2006
Posts: 4269
Location: Now
a tree is a succession of lists.
a list is a succession of words

to dynamically create lists and trees (nodes), you should provide two fields:
the datastructure type, a word signifiyng the method to use to expoit the structure.

the size of the structure that can be dynamically changed, but needs a lot more datas at the end in case of expanssion.

personnaly, i code in asm for the methods
and i code in trees for the applications.

it gives this result:
        Gnode .x,.y,.xl,.yl,\
.frm:   Frame 0,0,.xl,.yl,.c4
        Gnode 1,1,.xl-2,.tyl,\
@@:     Txt 20,3,0,0,.c2,.title,1,font85
.box:   Box 0,0,.xl-2,.tyl,.c1-18
.xbut:  But 4,5,11,11,.c4,poussoirx,exit.x
.title: db 'Template',0
        align 4
        Gnode 1,.tyl+1,.xl-2,.yl-.tyl-2,\
.back:  Box 0,0,.xl-2,.yl-.tyl-2,.c1-20
.app:   Gnode 0,0,.xl-2,.yl-.tyl-2,\
.hex    dd f.numhex,.str,0,8
.txt:   Txt 6,15,0,0,.c2,.str,0,led85
.str:   db '00000000',0

Gnode means Graphic Node
Node means Node
the rest are items.

the useage of the macro for lists
List elem1,elem2,elem3,elem4,elem5,elem6

the macro for list
macro List [element] {
  local .a
        dd .a-$-4
        dd element
Post 04 Oct 2010, 19:52
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.