1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Doubly Linked List in Assembly Language

Discussion in 'C, C++, C#' started by venom555, Apr 18, 2013.

  1. venom555

    venom555 Power Member

    Joined:
    Apr 21, 2012
    Messages:
    529
    Likes Received:
    16
    Gender:
    Male
    Occupation:
    Website | Software | Application Developer
    Location:
    Online
    Home Page:
    Can someone let me know how to create a program for doubly linked list in assembly language (.asm)
    Because I really dont know, thanks and waiting.
     
    Last edited: Apr 18, 2013
  2. s0ap

    s0ap Executive VIP Jr. VIP Premium Member

    Joined:
    Sep 23, 2008
    Messages:
    230
    Likes Received:
    810
    Occupation:
    :] guess
    Location:
    Congo/DRC
    You have to provide more details if you want someone to help. What platform? What is the data type of the list?

    If this is your first time working with linked lists I would start in C as the memory can be a brain fuzzer, and dereferencing NULL is a non-starter.
     
  3. kellermanrivero

    kellermanrivero Newbie

    Joined:
    Apr 19, 2013
    Messages:
    4
    Likes Received:
    0
    Occupation:
    Software Developer
    Location:
    Venezuela
    I think is better a code double link in C and use GCC to generate Assembly without optimizations. After that study assembly result to make more human coded.
     
  4. JP1016

    JP1016 Junior Member

    Joined:
    Sep 1, 2012
    Messages:
    120
    Likes Received:
    36
    Occupation:
    Student
    Location:
    BHW :-)
    Home Page:
    code it in c and compile it using cc programname.c -s and open programname.s then it will generate the assembly code for the program (unix system)
     
  5. WayneInc

    WayneInc Senior Member

    Joined:
    Sep 20, 2012
    Messages:
    1,178
    Likes Received:
    1,099
    you need to find in google ..if you need ebook regarding this then find in download section
     
  6. adbnews

    adbnews Newbie

    Joined:
    May 23, 2013
    Messages:
    17
    Likes Received:
    1
    Occupation:
    Quantitative Analyst
    Location:
    New York City
    Why would you do that in assembly language? why punish yourself like that.

    It really depends on the architecture of the processor you are deploying it on, are you using MIPS or X86?
    is your processor big endian or little endian?

    I agree with JP1016 compile C++ code to assembly language from the command line and see what the compiler does

    then make your optimizations after the code is compiled.
     
    • Thanks Thanks x 1
  7. sm754

    sm754 Registered Member

    Joined:
    Mar 21, 2012
    Messages:
    93
    Likes Received:
    38
    Occupation:
    Farmer
    Location:
    Azerbaijan
    I haven't used assembly in a while, but in MASM a linked list struct would look something like this (assuming 32-bit):
    Code:
    link STRUCT
        prev DWORD 0   ; pointer to previous link
        next DWORD 0   ; pointer to next link
        ; whatever data you need to store here
    link END
    Then, to use the structure, you'd need to allocate memory from the heap in whatever way is most convenient, and set the "prev" and "next" pointers to the addresses of the respective link structs in the list.
     
  8. nopme88

    nopme88 Registered Member

    Joined:
    Jul 30, 2013
    Messages:
    50
    Likes Received:
    7
    Occupation:
    Freelancer
    linked lists in C is much easier to implement than Assemby..Don't get the reason to use Assembly
     
  9. oozyluce

    oozyluce Regular Member

    Joined:
    Jan 26, 2013
    Messages:
    277
    Likes Received:
    231
    Occupation:
    IT Coordinator, Senior Network Administrator
    Location:
    http://www.gaben.tv/
    Home Page:
    I'm sensing Homework Assitance Thread here... Otherwise why the hell would you hand write a doubly linked list in assembly!!!
     
  10. s0ap

    s0ap Executive VIP Jr. VIP Premium Member

    Joined:
    Sep 23, 2008
    Messages:
    230
    Likes Received:
    810
    Occupation:
    :] guess
    Location:
    Congo/DRC
    I've seen it used for memory managers on embedded targets before.