flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > [fasmg] making file labels have a sizeof bytes included ...

Author
Thread Post new topic Reply to topic
bitRAKE



Joined: 21 Jul 2003
Posts: 4053
Location: vpcmpistri
bitRAKE 23 Apr 2024, 06:19
For an unknown reason labels using the FILE data type resolve to a SIZEOF 1. This isn't a problem though because we can wrap it to perform in a more expected manner, imho.
Code:
; FILE data label will have size of bytes included from file
calminstruction(NAMED) file? name*
        local tmp,bytes
        arrange tmp, =label NAMED:NAMED.=bytes
        assemble tmp
        arrange tmp, =file name
        assemble tmp
        compute bytes, $ - NAMED
        arrange tmp, NAMED.=bytes
        publish tmp, bytes
end calminstruction    
... kind of handy.
Code:
model file 'boat.obj'
repeat 1, V:sizeof model
        display `V
end repeat    

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 23 Apr 2024, 06:19
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 23 Apr 2024, 07:02
bitRAKE wrote:
For an unknown reason labels using the FILE data type resolve to a SIZEOF 1.
The reason is the usual one - backwards compatibility with fasm 1.

I propose another variant:
Code:
calminstruction(NAMED) file? name*
        local tmp
        compute tmp, $
        arrange name, =file name
        assemble name
        compute tmp, $ - tmp
        arrange name, =label NAMED:tmp =at =$ - tmp
        assemble name
end calminstruction    
This one does not require additional pass.
Post 23 Apr 2024, 07:02
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4053
Location: vpcmpistri
bitRAKE 23 Apr 2024, 13:57
Thank you, I did feel my use was inefficient, but my first attempt didn't work.
Tomasz Grysztar wrote:
The reason is the usual one - backwards compatibility with fasm 1.
Naturally (fasmg came from somewhere), there is the backward leaning perspective. Yet, there is also the forward leaning perspective - insofar as fasmg is not constrained by that from which it came.

fasm1.inc ++
Code:
calminstruction(NAMED) file? name*
        local tmp
        compute tmp, $
        arrange name, =file name
        assemble name
        arrange name, =label NAMED:1 =at tmp
        assemble name
end calminstruction     
An admittedly impressive reply from ...
GPT-4 wrote:
Your reflection on fasmg—Flat Assembler G—touches on an intriguing aspect of software development, particularly when evolving a tool like an assembler. The backward leaning perspective you mention seems to refer to the compatibility and continuation of features from the original Flat Assembler (FASM) to fasmg. This aspect is crucial because it ensures that existing users and their projects remain supported and operational, offering a form of continuity and stability.

On the other hand, the forward leaning perspective highlights fasmg’s capacity to transcend its roots. fasmg isn’t just about maintaining what was already established; it’s about innovation and expansion. By being more flexible and featuring a macroinstruction language that allows it to assemble for virtually any architecture with enough description, fasmg breaks free from the constraints of its predecessors. This dual approach not only honors the foundation laid by FASM but also pushes the boundaries of what an assembler can do, opening up possibilities for new types of projects and advancements in assembly language programming.

This duality can be seen as a powerful approach in software evolution, balancing between honoring the past and embracing the future, thereby creating a robust platform for both current users and those who wish to push the envelope.

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 23 Apr 2024, 13:57
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:  


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

Website powered by rwasa.