flat assembler
Message board for the users of flat assembler.
Index
> Main > label namespace difference in fasmg |
Author |
|
Tomasz Grysztar 23 Oct 2018, 14:28
The starting dot in fasmg is defined as referring to a child of the most recent label in the current namespace. The "getNextItemMatch" is a label in "list" namespace, so it does not become a parent for labels starting with dot unless you switch to "list" namespace. In this case this would look like:
Code: namespace list label .heapAddress qword at rbp-8 label .handleAllocatedMemory qword at rbp-16 label .list qword at rbp-24 label .item qword at rbp-32 label .prevItem qword at rbp-40 label .prevItemIndex qword at rbp-48 label .itemMatch qword at rbp-56 label .listItemMatch qword at rbp-64 end namespace However, to make the code more clear it would probably be better to define it like: Code: namespace list getNextItemMatch: push rbp mov rbp, rsp sub rsp, (8*8) label .heapAddress qword at rbp-8 label .handleAllocatedMemory qword at rbp-16 label .list qword at rbp-24 label .item qword at rbp-32 label .prevItem qword at rbp-40 label .prevItemIndex qword at rbp-48 label .itemMatch qword at rbp-56 label .listItemMatch qword at rbp-64 end namespace Code: namespace list getNextItemMatch: namespace getNextItemMatch push rbp mov rbp, rsp sub rsp, (8*8) label heapAddress qword at rbp-8 label handleAllocatedMemory qword at rbp-16 label list qword at rbp-24 label item qword at rbp-32 label prevItem qword at rbp-40 label prevItemIndex qword at rbp-48 label itemMatch qword at rbp-56 label listItemMatch qword at rbp-64 end namespace end namespace |
|||
23 Oct 2018, 14:28 |
|
donn 23 Oct 2018, 15:06
Perfect, the second one seems to make the most logical sense:
Code: namespace list getNextItemMatch: push rbp … label .heapAddress qword at rbp-8 label .handleAllocatedMemory qword at rbp-16 label .list qword at rbp-24 label .item qword at rbp-32 ... .noMatch: add rsp, 8 pop r15 pop r14 pop r13 pop r12 pop rsp pop rsi pop rdi pop rbp pop rbx mov rsp, rbp pop rbp retn 0 end namespace and assembles. It would also allow me to use old fasm1 files with few changes. The last example without the dot is cool, may look into that soon. Really liking the namespace keyword. Copy and pasting long namespace names can really slow down productivity. |
|||
23 Oct 2018, 15:06 |
|
Tomasz Grysztar 12 Mar 2019, 14:40
Important note: I later decided to change the starting-dot rules to be more compatible with fasm 1 and now even the approach that did not work for you (described in the initial post here) would behave as you originally expected.
|
|||
12 Mar 2019, 14:40 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.