I don't know if this is a bug or a feature request ...
Can yasm have sections (in a bin file) with local ORG and $ statements?
What I'd like to do is assemble some bytes, put their addresses
in a data table, and in that table also build some linked list(s).
To build the lists, I need to know where exactly the data is in that
data table.
Below is an example. It won't assemble because AFAIK one can't use $ with %assign.
In MASM I could do this by using the "=" statement to temporarily
store the $ from the code segment (and restore it afterwards). Also, in MASM switching to another segment will have $ report offsets from the base of that segment.
%assign codeptr 100h
%assign dataptr 200h
SECTION .text
ORG codeptr
dq $
dq 1
dq 2
dq $
%assign codeptr $
SECTION .data
ORG dataptr
dq $
dq 11h
dq 22h
dq $
%assign dataptr dataptr+4*8
SECTION .text
ORG codeptr
dq $
dq 3
dq 4
dq $
%assign codeptr $
SECTION .data
ORG dataptr
dq $
dq 33h
dq 44h
dq $
%assign dataptr dataptr+4*8