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
Author
Thread Post new topic Reply to topic
vityacv



Joined: 27 Oct 2012
Posts: 14
vityacv 20 Aug 2025, 18:56
Having issue with this sample on FASM 2 - Custom error: operand sizes do not match.
Code:
include 'win64w.inc'
format pe64

struct Test2
a1 rd 1
ends

struct Test3
a1 rd 1
a2 rd 1
a3 rd 1
a4 rd 1
a5 rd 1
ends

struct Test1
a1 rd 1
a2 Test2
a3 Test3
ends

struct Test4
a1 rd 1
a2 rd 1
ends

virtual at 0
V1 Test4
V2 Test4
end virtual

mov esi,[rax+rax+Test1.a3+V1.a1]
ret
    

FASM 1 compiles without error
Post 20 Aug 2025, 18:56
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8489
Location: Kraków, Poland
Tomasz Grysztar 20 Aug 2025, 19:11
vityacv wrote:
Having issue with this sample on FASM 2 - Custom error: operand sizes do not match.
Code:
include 'win64w.inc'
format pe64

struct Test2
a1 rd 1
ends

struct Test3
a1 rd 1
a2 rd 1
a3 rd 1
a4 rd 1
a5 rd 1
ends

struct Test1
a1 rd 1
a2 Test2
a3 Test3
ends

struct Test4
a1 rd 1
a2 rd 1
ends

virtual at 0
V1 Test4
V2 Test4
end virtual

mov esi,[rax+rax+Test1.a3+V1.a1]
ret
    

FASM 1 compiles without error
The "Test1.a3" has associated size (20 bytes), as the STRUCT macro in fasm2 has an added feature of sizing all these labels properly. This was missing in fasm's implementation, because it was not really possible to implement there except for a small set of supported sizes.

If you'd prefer to not have this feature, comment out the portion of "instantiate" macro:
Code:
                arrange tmp, =label instance; : sname.=__size__    
Another workaround is to rearrange the expression so that the intended size comes first.
Post 20 Aug 2025, 19:11
View user's profile Send private message Visit poster's website Reply with quote
vityacv



Joined: 27 Oct 2012
Posts: 14
vityacv 04 Dec 2025, 17:24
Code:
format binary
use64

ret
align 16

flat assembler  version g.l04h
1 pass, 1 byte.    


Getting 1 byte output instead of 16, fasm 1 have same result. Also fasm 1 creates output file with .bin extension, should fasm 2 do the same?
Post 04 Dec 2025, 17:24
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8489
Location: Kraków, Poland
Tomasz Grysztar 04 Dec 2025, 18:13
vityacv wrote:
Getting 1 byte output instead of 16, fasm 1 have same result.
It's compatible then, isn't it?

But with fasm2 you can also do this:
Code:
align 16, 90h    
See the comments in the package.
vityacv wrote:
Also fasm 1 creates output file with .bin extension, should fasm 2 do the same?
This small difference is actually handy when testing one against the other. Of course adding a simple AS in the headers could bridge this gap, too.
Post 04 Dec 2025, 18:13
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

< 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.