flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 30 Dec 2008, 09:00
I think this is a good suggestion.
However this may be missed by Tomasz in this thread. Perhaps a mod can move and sticky it into Compiler Internals? |
|||
![]() |
|
baldr 30 Dec 2008, 09:55
asmfan,
times 1 - ($ and 1) nop instead of align 2 nop, may be? _________________ "Don't belong. Never join. Think for yourself. Peace." – Victor Stone. |
|||
![]() |
|
asmfan 30 Dec 2008, 11:41
baldr confirm, this is better.
|
|||
![]() |
|
CoolCmd 27 Feb 2024, 19:31
With "ms coff" format this line
Code: times 1 - ($ and 1) nop generates "error: invalid use of symbol". This line works: Code: times 1 - (($ - $$) and 1) nop |
|||
![]() |
|
revolution 27 Feb 2024, 19:43
Make sure that $$ is aligned accordingly.
Code: ; ... org 0xff ; $$ = 0xff times 1 - (($ - $$) and 1) nop ; here the alignment might not be what you wanted ;... |
|||
![]() |
|
revolution 28 Feb 2024, 01:27
If you want to avoid redundant nops a macro can help:
Code: ~ cat wac.asm ; fasm wac.asm && hd wac.exe | tail macro word_aligned_call destination { local ..even_alignment, ..have_nop if ..even_alignment nop ..have_nop = 1 else ..have_nop = 0 end if call destination virtual align 2 ..even_alignment = ($ - $$) xor ..have_nop end virtual } format pe section '' code word_aligned_call thing du 'text',0 word_aligned_call thing du 'text',0 db -1 ; make odd alignment test word_aligned_call thing du 'text',0 word_aligned_call thing du 'text',0 ;... thing: ;... ret flat assembler version 1.73.31 (16384 kilobytes memory) 6 passes, 1024 bytes. 000001a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000200 90 e8 3a 00 00 00 74 00 65 00 78 00 74 00 00 00 |..:...t.e.x.t...| 00000210 90 e8 2a 00 00 00 74 00 65 00 78 00 74 00 00 00 |..*...t.e.x.t...| 00000220 ff e8 1a 00 00 00 74 00 65 00 78 00 74 00 00 00 |......t.e.x.t...| 00000230 90 e8 0a 00 00 00 74 00 65 00 78 00 74 00 00 00 |......t.e.x.t...| 00000240 c3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000250 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000400 |
|||
![]() |
|
CoolCmd 29 Feb 2024, 07:52
Quote:
i do not use ORG in code. Quote:
why is it better than "times 1 - (($ - $$) and 1) nop" ? |
|||
![]() |
|
revolution 29 Feb 2024, 13:46
CoolCmd wrote:
CoolCmd wrote:
Code: word_aligned_call dword[thing] ; 6 byte call du 'text',0 word_aligned_call dword[fs:thing] ; 7 byte call du 'text',0 word_aligned_call eax ; 2 byte call du 'text',0 |
|||
![]() |
|
CoolCmd 06 Mar 2024, 16:43
I see, but in this thread we are talking about "invoke" macro which always uses "call labelname". I hope WIN32WX.INC will be updated... someday.
|
|||
![]() |
|
Tomasz Grysztar 06 Mar 2024, 17:09
CoolCmd wrote: I hope WIN32WX.INC will be updated... someday. |
|||
![]() |
|
revolution 06 Mar 2024, 18:43
CoolCmd wrote: I see, but in this thread we are talking about "invoke" macro which always uses "call labelname". |
|||
![]() |
|
CoolCmd 06 Mar 2024, 19:10
Tomasz Grysztar wrote: The alignment for embedded strings had been added there years ago. You undug a thread from 2008. As i said above, this "added years ago" alignment does not work with "ms coff" format. Try to assemble this code: Code: format ms coff include "win32wx.inc" include "encoding\win1251.inc" stdcall eax, "1" Are you happy that the basic functionality (stdcall, invoke) doesn’t work? revolution wrote: Still applies. "labelname" can be "eax", "dword[thing]", etc. No, always 5 bytes: Code: local ..continue times 1 - (rva $ and 1) nop call ..continue du value,0 ..continue: |
|||
![]() |
|
Tomasz Grysztar 06 Mar 2024, 19:22
CoolCmd wrote: As i said above, this "added years ago" alignment does not work with "ms coff" format. CoolCmd wrote: Try to assemble this code: |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.