flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > [fasmg] experiments with PE.INC |
Author |
|
VEG 22 May 2017, 12:08
I'm experimenting with pe.inc. I've tried to rename the PE address space and encountered a strange error, and I can't understand what's wrong.
How to reproduce (or you can get premodified pe.inc): 1. Open pe.inc 2. Replace PE:: to XXX:: 3. Replace PE: to XXX: everywhere (but don't replace where it is not a whole word, like here: load TYPE:word). 4. Replace "define CheckSumBlocks XXX,0,HeadersEnd" to "define CheckSumBlocks PE,0,HeadersEnd". 5. Try to compile win32.asm example. Error: Quote: win32.asm [25]: Trying to debug it... 1. Replace: Code: if DEFINED_SECTION | SECTION_SIZE > 0 SECTION_INDEX = SECTION_INDEX + 1 end if Code: if DEFINED_SECTION | SECTION_SIZE > 0 SECTION_INDEX = SECTION_INDEX + 1 repeat 1, n:SECTION_INDEX display 'section: ', `n, 0x0A end repeat end if 2. Replace: Code: NUMBER_OF_SECTIONS := SECTION_INDEX Code: NUMBER_OF_SECTIONS := SECTION_INDEX repeat 1, n:SECTION_INDEX display 'postpone: ', `n, 0x0A end repeat Code: section: 1 section: 2 section: 3 section: 1 postpone: 1 What's wrong? Why SECTION_INDEX resets to the 0 before the last section?
Last edited by VEG on 22 May 2017, 13:31; edited 2 times in total |
|||||||||||
22 May 2017, 12:08 |
|
Tomasz Grysztar 22 May 2017, 13:30
VEG wrote: What's wrong? Why SECTION_INDEX resets to the 0 before the last section? The "PE::" label has an additional function there of defining a global "PE" symbol which serves a role of a base for global namespace (this still can be fooled if you define a local "PE" symbol somewhere and there are better ways to make macros that are foolproof against that, but that is another story). So to make them work correctly when you replace "PE::" with "XXX::" you need to ensure that "PE" is a global symbol in some other way: Code: XXX:: PE := 1 |
|||
22 May 2017, 13:30 |
|
Tomasz Grysztar 22 May 2017, 13:45
This not a bad idea. The PE.INC was one the first sets of formatting macros I made for fasmg and at the time I wanted to write something simple and compact to include in the examples. But then the x86 examples became much more complex anyway. I think that I could in the future fork PE.INC into a basic version included in the examples and a more "advanced" version in the Windows headers package.
|
|||
22 May 2017, 13:45 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.