flat assembler
Message board for the users of flat assembler.

Index > Projects and Ideas > fasm 2 as a set of scripts and headers for fasmg

Goto page Previous  1, 2, 3
Author
Thread Post new topic Reply to topic
vityacv



Joined: 27 Oct 2012
Posts: 20
vityacv 26 Jul 2026, 07:46
Code:
format pe64

push 1.0
    

getting error:
flat assembler version g.l8vn
Custom error: the number of copies must be positive.

There is workaround in nasm push __float32__(1.0), is there a way to do it in fasm 2?
Post 26 Jul 2026, 07:46
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8550
Location: Kraków, Poland
Tomasz Grysztar 26 Jul 2026, 08:41
vityacv wrote:
Code:
format pe64

push 1.0
    

getting error:
flat assembler version g.l8vn
Custom error: the number of copies must be positive.
This is not the right error to quote. It results from no sections being generated, in turn because the instruction generated no bytes due to another error. To see the underlying error, look down the list (some time ago I updated the command line fasm2 scripts to show up to 100 errors by default, fasmgw can show even more):
Code:
push? [29] x86.push_instruction [105]
Custom error: immediate value out of signed range.    
And you would get a similar error with fasm 1, because it does convert the floating-point value into a 64-bit representation by default here.

With fasm you could define a constant with a different representation, like here:
Code:
F = dword 1.0
push F    
This syntax is not supported by fasm2 (I could add it, but it would clash with some fasmg-specific statements that are valid but mean something different), but the following one works the same in both:
Code:
virtual
        dd 1.0
        load F dword from $$
end virtual

push F    
And then, of course, you have fasmg's repertoire of emulating other syntaxes, like with inline macro package:
Code:
format PE64

include 'macro/inline.inc'

inlinemacro __float32__(value*)
        virtual
                dd float (value)
                load return: dword from $$
        end virtual
end inlinemacro


push __float32__(1.0)    
Post 26 Jul 2026, 08:41
View user's profile Send private message Visit poster's website Reply with quote
vityacv



Joined: 27 Oct 2012
Posts: 20
vityacv 04 Aug 2026, 11:51
What about using it directly for cleaner approach?
Code:
db 0x68 ;push
dd 1.0
    


also there is issue with fixups, they are filled with 0's (fasm 1 handles it correctly)

Code:
format pe64 at 0x1000000000000000
entry Main

Main:
jmp Test1

align 8
data fixups
end data

align 4096
Test1:
mov rax,Main
ret
    
Post 04 Aug 2026, 11:51
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8550
Location: Kraków, Poland
Tomasz Grysztar 04 Aug 2026, 14:37
vityacv wrote:
also there is issue with fixups, they are filled with 0's (fasm 1 handles it correctly)
Thank you for the report! I forgot to properly test this case (forward-referenced fixups).
Post 04 Aug 2026, 14:37
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2026, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.