flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
ProMiNick 01 Feb 2020, 06:46
in https://board.flatassembler.net/topic.php?t=21339 I already post it
Code: macro align boundary,value:? { db (boundary-1)-($+boundary-1) mod boundary dup value } use case align 2 ; same as "align 2, db ?" i think "db ?" more convinient then "db 0" align 2,0 ; same as "align 2, db 0" align 2,$90 ; same as "align 2, db $90" b.t.w. nice work - https://github.com/alexfru/Win16asm |
|||
![]() |
|
alexfru 01 Feb 2020, 07:30
ProMiNick wrote: in https://board.flatassembler.net/topic.php?t=21339 I already post it Something isn't quite right: Code: format elf macro xyzalign boundary,value:? { db (boundary-1)-($+boundary-1) mod boundary dup value } section ".data" public datum datum: db 0x41 ; align 2 xyzalign 2,0 Code: >fasm align.asm flat assembler version 1.71.64 (16384 kilobytes memory) align.asm [11]: xyzalign 2,0 align.asm [3] xyzalign [0]: macro xyzalign boundary,value:? { db (boundary-1)-($+boundary-1) mod boundary dup value } processed: db(2-1)-($+2-1)mod 2 dup 0 error: invalid use of symbol. or Code: flat assembler version 1.71.22 (1048576 kilobytes memory) align.asm [3]: macro xyzalign boundary,value:? { db (boundary-1)-($+boundary-1) mod boundary dup value } error: invalid macro arguments. ProMiNick wrote: b.t.w. nice work - https://github.com/alexfru/Win16asm Thanks. |
|||
![]() |
|
ProMiNick 01 Feb 2020, 07:40
looks like fasm 1.71 dosn`t know default values for macro parameters ":?".
Use fasm 1.73.21 From educational side unzeroed bytes for alignment is more correct - it separate bytes that are part of some data constructions from realy alignment bytes. |
|||
![]() |
|
Tomasz Grysztar 01 Feb 2020, 07:56
If you use fasmg's formatters, the ALIGN macro supports second argument (filler) as a standard.
Also, please take a look here and here for more advanced ones. But they are all for fasmg - if you need to stick to fasm 1, please look at some old ones. |
|||
![]() |
|
alexfru 01 Feb 2020, 08:01
ProMiNick wrote: looks like fasm 1.71 dosn`t know default values for macro parameters " Well, that didn't help: Code: >fasm align.asm flat assembler version 1.73.21 (1048576 kilobytes memory) align.asm [11]: xyzalign 2,0 align.asm [3] xyzalign [0]: macro xyzalign boundary,value:? { db (boundary-1)-($+boundary-1) mod boundary dup value } processed: db(2-1)-($+2-1)mod 2 dup 0 error: invalid use of symbol. ProMiNick wrote: From educational side unzeroed bytes for alignment is more correct - it separate bytes that are part of some data constructions from realy alignment bytes. The PE format wants imported function names start on 2-byte boundary and have zero bytes as trailing and padding. In theory I could manually add enough zeroes, but I don't want to. |
|||
![]() |
|
alexfru 01 Feb 2020, 08:25
Tomasz Grysztar wrote: if you need to stick to fasm 1, please look at some old ones. At first glance .balign from there seems to be working... |
|||
![]() |
|
ProMiNick 01 Feb 2020, 10:21
alexfru wrote:
Code: C:\Documents and Settings\Administrator>\..\fasmw17321COMFRIENDLY\fasm.exe "C:\fasmw17321COMFRIENDLY\EXAMPLES\WIN16\1.ASM" flat assembler version 1.73.21 (1048576 kilobytes memory) 3 passes, 74356 bytes. C:\Documents and Settings\Administrator>pause Press any key to continue . . . I used same align macro in my sample. _________________ I don`t like to refer by "you" to one person. My soul requires acronim "thou" instead. |
|||
![]() |
|
Tomasz Grysztar 01 Feb 2020, 10:26
ProMiNick wrote: strange |
|||
![]() |
|
ProMiNick 01 Feb 2020, 11:24
for elf: macro xyzalign boundary,value:? { db (boundary-1)-($-$$+boundary-1) mod boundary dup value }
|
|||
![]() |
|
Tomasz Grysztar 01 Feb 2020, 11:37
ProMiNick wrote: for elf: macro xyzalign boundary,value:? { db (boundary-1)-($-$$+boundary-1) mod boundary dup value } |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.