flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Tomasz Grysztar 03 Jan 2023, 09:54
It's one of the old GTK examples that are on the (deprecated) page, isn't it?
The CDECL.INC is mostly the same as macros used in Windows headers, except that it marks procedure as "C" by default. Using standard compatibility macros, this assembles to exactly the same output file as with fasm 1: Code: include 'format/format.inc' format ELF include 'macro/proc32.inc' include 'gtk.inc' public main ; extrn blah extrn gtk_init extrn gtk_window_new extrn gtk_widget_show extrn gtk_main ; section '.data' writeable section '.bss' writeable hWindow dd ? section '.text' executable proc main C argc, argv ; note the added marking lea eax, [argc] lea ebx, [argv] ccall gtk_init, eax, ebx ccall gtk_window_new, GTK_WINDOW_TOPLEVEL mov [hWindow], eax ccall gtk_widget_show, [hWindow] call gtk_main ret endp |
|||
![]() |
|
TheSage 03 Jan 2023, 15:48
Thanks for such a prompt reply! I wasn't expecting that.
That won't compile because the program can't find proc32.inc. Actually, I can't find it either. Bummer. "It's one of the old GTK examples that are on the (deprecated) page, isn't it" If only I were that stupid because that would be an improvement! Actually I found it in the link on the front page called "Examples". I saw nothing about being "deprecated" or "depreciated". PS - I found proc32.inc in the source file for FASMg-master. I found quite a few other .incs with it too, like @@.inc, import64.inc, struct.inc, and so on. Are those supposed to be built-in macros that I need to "activate" instead of include or should I just copy them to my root dir for FASMg? Last edited by TheSage on 03 Jan 2023, 18:32; edited 1 time in total |
|||
![]() |
|
Tomasz Grysztar 03 Jan 2023, 18:30
TheSage wrote: That won't compile because the program can't find proc32.inc. Actually, I can't find it either. Bummer. See also the thread about migration from fasm to fasmg. It does not have a Linux-dedicated section (yet), but as demonstrated by this example, the same headers can be helpful. TheSage wrote: Actually I found it in the link on the front page called "Examples". I saw nothing about being "deprecated" or "depreciated". |
|||
![]() |
|
TheSage 03 Jan 2023, 18:55
Tomasz Grysztar wrote:
Yes, I already downloaded FASMg-master. Shouldn't something that critical be included in the FASMg package? I also converted your linked page into a PDF for reference purposes. Tomasz Grysztar wrote: It does not have a Linux-dedicated section (yet), but as demonstrated by this example, the same headers can be helpful. In hindsight I can see that. Tomasz Grysztar wrote:
My interpretation of that is that new examples doesn't mean that the old examples may or may not work anymore. PS -- It compiles. Thanks. New problem: it won't link. I'm using "GoLink /entry:main coff window.obj", which typically works for me on GoAsm and NASM, but GoLink reports "An object file was given to GoLink whose format was not supported (window.obj)". What is the format? |
|||
![]() |
|
Tomasz Grysztar 03 Jan 2023, 19:55
TheSage wrote: Yes, I already downloaded FASMg-master. Shouldn't something that critical be included in the FASMg package? TheSage wrote: New problem: it won't link. TheSage wrote: What is the format? |
|||
![]() |
|
TheSage 04 Jan 2023, 01:58
Tomasz Grysztar wrote:
If everyone wanting to learn FASMg must first become a FASM 1 expert, put that in the documentation so everyone can know from the start the prerequisites. The advertisement for FASMg implies that it is a mature standalone product not requiring FASM 1 experience. TheSage wrote: New problem: it won't link. See what I mean? If that is what you want then put that in the documentation on page one. As for me, I don't want to learn FASM 1, I want to learn FASMg. Is that not possible? If I were a beginning programmer, I would have already given up. TheSage wrote: What is the format? Oops! That's due to an old typing habit I have because I haven't fully switched over from Windows to Linux yet so I'm writing Linux programs on a computer only setup for Windows development (and most asm programs use the linker to specify the format). ***NOTICE*** This issue has been resolved to my satisfaction so it can be closed out, but remember this for our next discussion: 1) If you have to spell it out in a forum post, it belongs in the documentation 2) My next step is to convert that simple program to a 64-bit ELF (cdecl.inc needs the most work). I would ask for helpful examples to shorten the learning curve but I know there are none because you just confessed there are none. So expect feedback 3) That shouldn't be too hard too do, but maybe that can't be done until I learn FASM 1 first for a few months, then switch over to FASMg? ![]() |
|||
![]() |
|
revolution 04 Jan 2023, 02:25
fasmg is more like an HLL than an assembler. Perhaps this is what has misled some. It needs many support files before it can become an assembler.
fasm is an assembler at heart. It can be used stand-alone with just the executable file. You don't need to become an expert in either to use them. As long as the distinction is understood, that fasmg is nothing like an assembler by itself, then I think that can prime one's thought process to realise how to use them. |
|||
![]() |
|
Tomasz Grysztar 04 Jan 2023, 07:41
TheSage wrote: If everyone wanting to learn FASMg must first become a FASM 1 expert, put that in the documentation so everyone can know from the start the prerequisites. The advertisement for FASMg implies that it is a mature standalone product not requiring FASM 1 experience. TheSage wrote: See what I mean? If that is what you want then put that in the documentation on page one. As for me, I don't want to learn FASM 1, I want to learn FASMg. Is that not possible? If I were a beginning programmer, I would have already given up. |
|||
![]() |
|
TheSage 04 Jan 2023, 12:53
Tomasz Grysztar wrote: As already mentioned, fasmg can be used as a base for different assemblers, not necessarily x86, and even for x86 it could implement syntaxes different than fasm 1. But if you choose to use "fasm compatibility package" then it's emulating the syntax of fasm 1, obviously. Tomasz Grysztar wrote: You have taken an example written for fasm 1, from the page that mentions that explicitly. You mean the page with nothing but depreciated examples that say nothing about fasmg. Tomasz Grysztar wrote: Normally you would have even less luck trying to take an example for one language and feeding it to compiler of another one (and fasmg by itself is just a bare "data assembly language", not even an x86 assembler), but here it was possible, because fasmg can be extended with specialized headers to become an assembler for an architecture and syntax variant of choice. So with "fasm compatibility package" it becomes possible to assemble sources written in fasm 1 syntax. This is what I provided. If in order for fasmg to be able to assemble object files for Linux I must install fasm1 first, then I don't need fasmg to do that. If I need to know how fasm1 works to assemble files but I do not need to know how fasmg works to assemble files, I don't need fasmg to do that. Currently, because fasm1 and fasmg cannot co-exist on top of each other, if I want to use fasmg to develop for Linux or Windows, I need to install and then create two sets of environment variables: one for fasm1 and one for fasmg. If I want to simplify things and merge fasm1 with fasmg into something common, it won't be easy to update the fasm1 files because the fasm1 files will no longer be where they belong. Therefore the way you are presenting fasmg, makes it appear to be a macro compiler only good for developers wanting to create a new and custom assembler, otherwise stick to fasm1. SUGGESTION: Since fasmg is allegedly a successor to fasm1, take all the macros, incs, and docs for fasm1 and put them into the fasmg package because that is what fasm1 is: fasmg plus all the macs and incs. Then you will actually have the successor to fasm1 instead of bits and pieces of something else. And then your examples page will apply to both fasm1 and fasmg. |
|||
![]() |
|
Tomasz Grysztar 04 Jan 2023, 13:17
TheSage wrote:
Quote: This section contains programs created with the flat assembler and contributed by users as sample material for others to learn from. Most of them were submitted in the early days of this website, and they all have been designed for flat assembler 1. TheSage wrote: If in order for fasmg to be able to assemble object files for Linux I must install fasm1 first, then I don't need fasmg to do that. TheSage wrote: SUGGESTION: Since fasmg is allegedly a successor to fasm1, take all the macros, incs, and docs for fasm1 and put them into the fasmg package because that is what fasm1 is: fasmg plus all the macs and incs. Quote: It is an assembly engine designed as a successor of the one used in flat assembler 1, one of the recognized assemblers for x86 processors. If fasmg was fasm 2, I would publish it as such, and it would then likely replace fasm 1 on the pages. But it is not fasm 2 and fasm 1 is already good enough at what it is. |
|||
![]() |
|
revolution 04 Jan 2023, 13:38
TheSage:
If you just want an assembler to make x86 stuff then use fasm. If what you really want is to make your own custom syntax and/or try out a new assembler for some exotic chip then fasmg might be a good starting point for testing before committing to writing low level code for the final product. Each tool is different, targeted to a different job. |
|||
![]() |
|
TheSage 04 Jan 2023, 17:01
Tomasz Grysztar wrote:
That is not what forums are for. They are for people to find help, get into pissing contests, or find (since older posts are never deleted) misleading information. Forums are helter skelter places not meant to conduct serious research. That's what official documentation is supposed to be used for. Tomasz Grysztar wrote:
You thought this was a concern of migrating from one program (fasm1) to another one (fasmg), a program that allegedly wasn't meant to be a replacement for fasm1? I'm just now learning fasm and I didn't want to learn something that would be succeeded by something else and become obsolete. Do you secretly work for Microsoft? ![]() Tomasz Grysztar wrote:
"The flat assembler g (abbreviated to fasmg) is a new assembly engine designed as a successor of the one used by flat assembler 1. Instead of having a built-in support for x86 instructions, it implements them through additional packages and in the same way it can be adapted to assemble for different architectures and purposes. With the included example packages it is capable of generating all the output formats that flat assembler 1 could and additional ones, like Mach-O or Intel HEX" (https://flatassembler.net/download.php) fasmg is not an assembly engine, it is a macro interpreter. It has no "additional packages" because it wasn't meant to be used outside of fasm1 but inside of fasm1, as it's "SUCCESSOR" for it's frontend. Since no useful x86-64 Linux examples were given ("Hello World" doesn't count), it was no wonder I couldn't generate any and had to go to the forum and ask for help. You need to go back and fix your mistakes. Now that you have clarified the purpose of fasmg, I clearly understand what fasmg is good for (for creating other standalone assembly programs using macros and nothing else), so I will be abandoning fasmg and using fasm1 for Linux instead. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.