I cannot figure out how to pad the beginning of the string such that it ends right at an alignment boundary:
%macro string 1
_unaligned:
; some preprocesor expression comes here
db %1
_aligned:
%endmacro
After several hours of trying different solutions, I still don't have any. Can anybody help, please?
EDIT:
This is the real example how it should work (for 32bit code):
%define LAST 0
%macro xword 2
%strlen len %1
; pad - some preprocassor magic comes here
db %1
NAME__%2 db len
LINK__%2 dd LAST ; must be aligned !!!
CODE__%2 dd code
PAR__%2
%define LAST PAR__%2
%endmacro
Usage:
xword 'TEST',test01
creates structure (for example $ = 0x0001):
0x0001
0x0002
0x0003 db 'T'
0x0004 db 'E'
0x0005 db 'S'
0x0006 db 'T'
0x0007 db 4
0x0008 dd 0 ; LAST (must be ALIGNED)
0x000C dd code
There must be no more padding than necessary, as it is necessary to save as much memory as possible.