Hi Muratohyes,
It isn't clear what you propose to do with this list once you've got it, which might make a difference. Perhaps something like...
struc listnode
.pnext resq 1
.pstr resq 1
; .pprev resq 1 :?
endstruc
section .bss
listhead resq 1
section .text
; ...
addnode:
; ummm parameters listhead and pointer to string?
; returns... address of new node? or just success (or not)
; traverse to current end of list
; (listnode + listnode.pnext = 0)
; move it to... say... rbx?
mov rdi, listnode_size
call malloc ; yours or library?
mov [rbx + listnode.pnext], rax
mov [rax + listnode.pnext], 0
mov [rax + listnode.pstr], rsi ; passed in parameter
ret ;? are we done?
That obviously isn't intended to run, but "something like that"? If I haven't screwed it up too badly?
You haven't given us much of a clue what we're up against. What OS? What bitness? What parts can you do? Where do you get stuck? The more you give us, the more we can/will give you!
Best,
Frank