flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
IceStudent 10 Oct 2006, 07:41
Hi!
I creating image_debug_directory, it needs file pointer to raw data. How I can get it? |
|||
![]() |
|
IceStudent 10 Oct 2006, 07:58
It seems to impossible. File offsets knows only formatter, so at the assembly-level I can't get it.
|
|||
![]() |
|
vid 10 Oct 2006, 09:48
it is more complicated.
you for example need to know number of sections preceding that computations. For that you can overload "section" directive with macro |
|||
![]() |
|
IceStudent 10 Oct 2006, 12:16
Thanks, I was tested it only in one section.
|
|||
![]() |
|
IceStudent 10 Oct 2006, 15:56
Now, I wrote this macroses. Big thanks to vid for solution.
Code: macro section attrs { local secnum,rawsize,secsize,filesize,heresec section_align = 0x1000 file_align = 0x200 if defined heresec | ~ defined _secnum heresec: secnum = 1 filesize = $-$$ if filesize > 0 ; previosly defined data, default section was created secnum = 2 filesize = (filesize + file_align) and not (file_align-1) end if filesize = file_align + filesize else secnum = _secnum rawsize = $ - _secbase secsize = (rawsize + section_align) and not (section_align-1) filesize= (rawsize + file_align) and not (file_align-1) filesize=_filesize + filesize end if section attrs _secnum = secnum + 1 _secbase = $$ _filesize = filesize } macro get_fo addr { local off section_align = 0x1000 file_align = 0x200 if ~ addr eq off = addr else off = $ end if if ~defined _secnum ; simple formula for default single section _fileoffset = off - $$ + file_align else ; calculated from sections statistics if $$ <> _secbase display 'current base is different from the section base' __err end if _fileoffset = off - $$ + _filesize end if } |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.