flat assembler
Message board for the users of flat assembler.

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

Author
Thread Post new topic Reply to topic
alorent



Joined: 05 Dec 2005
Posts: 221
alorent 04 Oct 2010, 19:30
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.

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



Joined: 20 Feb 2006
Posts: 4334
Location: Now
edfed 04 Oct 2010, 19:52
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:
Code:
Template:
.x=20
.y=40
.xl=250
.yl=100
.tyl=20
.c1=Blue
.c2=Silver
.c3=Green
.c4=Teal
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        Gnode .x,.y,.xl,.yl,\
        .frm,\
        .titlebar,\
        .workspace,\
        grabber
.frm:   Frame 0,0,.xl,.yl,.c4
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.titlebar:
        Gnode 1,1,.xl-2,.tyl,\
        .xbut,@f,.box
@@:     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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.workspace:
        Gnode 1,.tyl+1,.xl-2,.yl-.tyl-2,\
        .app,.back
.back:  Box 0,0,.xl-2,.yl-.tyl-2,.c1-20
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.app:   Gnode 0,0,.xl-2,.yl-.tyl-2,\
        .txt,\
        .hex
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.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
Code:
List elem1,elem2,elem3,elem4,elem5,elem6
    


the macro for list
Code:
macro List [element] {
 common
  local .a
        dd .a-$-4
 forward
        dd element
 common
  .a:
}
    
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.