flat assembler
Message board for the users of flat assembler.
Index
> Main > satisfying feeling of freedom |
Author |
|
macomics 02 Dec 2021, 19:20
The problem with the fasm project is that it consists only of a compiler. Whereas for writing some projects, it would be nice to have a linker that builds a single executable from several binary files. Although at the script level, the fasm compiler can partially do such work on its own. That's just that even as examples, the fasm kit does not include any such solution. (And I don't mean the Linux build that uses the gcc/ld utility.)
And in general, fasm is flexible enough to feel completely free. Simple example: source1 (boot sector code) Code: format binary as "BIN" org 0x7C00 use16 ... source 2 (fasm as linker) Code: format binary as "IMG" org 0 ; Boot sector struc assume base*, type& { if ~ type eq virtual at base . type .sizeof = $ - . end virtual else label . at base .sizeof = $ - . end if } struc bpb_struc { .jump db 3 dup ? .ImgName db 8 dup ? .BytesPerSector dw ? .SectorsPerCluster db ? .ReservedSectors dw ? .NumberOfFATs db ? .RootSize dw ? .TotalSectors dw ? .DiskType db ? .SectorsPerFAT dw ? .SectorsPerTrack dw ? .NumberOfHeads dw ? } bpb assume 0, bpb_struc file "source1.BIN":0,512 load bps word from bpb.BytesPerSector load res word from bpb.ReservedSectors load nfat byte from bpb.NumberOfFATs load spf word from bpb.SectorsPerFAT load root word from bpb.RootSize load spc byte from bpb.SectorsPerCluster load siz word from bpb.TotalSectors nres = res * bps rb ( nres - 1 ) - (( $ + nres - 1 ) mod nres ) ; FAT table macro build_fat12 sfat, clus { while nfat db 0xF0, 0xFF, ( 3 * clus / 2 ) dup 0, ( 2 * ( clus and 1 )) dup 0 rb ( sfat - 1 ) - (( $ - nres + sfat - 1 ) mod sfat ) end while } macro build_fat16 sfat, clus { while nfat db 0xF0, 0xFF, 0xFF, 0xFF, ( 2 * clus ) dup 0 rb ( sfat - 1 ) - (( $ - nres + sfat - 1 ) mod sfat ) end while } build_fat12 ( bps * spf ), ( siz - 2 - res - ( nfat * spf ) - ( 32 * root + bps - 1 ) / bps ) ; root directory rb 32 * root rb ( bps - 1 ) - (( $ + bps - 1 ) mod bps ) ; clusters array cbeg = $ bpc = spc * bpc file "data.bin" rb ( bpc - 1 ) - (( $ - cbeg + bpc - 1 ) mod bpc ) ; create root / directory entry ... ; update FAT tables ... ; image align total = siz * bps rb ( total - 1 ) - (( $ + total - 1 ) mod total ) |
|||
02 Dec 2021, 19:20 |
|
sylware 03 Dec 2021, 15:11
On top of this feeling of freedom, I have also this feeling of enpowerment. The more I "rationally" do remove, the better I feel. I guess those feelings are emergent from my knowledge/experience of the various critical software/hardware components needed to get code actually running.
We all know the current status quo in computer systems is still quite toxic plagued with technical scammers (apple/microsoft/much of GNU/etc), but deep down I feel being on the right "path"/"trajectory". Will it last, no idea. |
|||
03 Dec 2021, 15:11 |
|
AsmGuru62 03 Dec 2021, 16:32
So... what exactly turns you off from GCC/Microsoft compilers? Is it the EXE file size?
You can switch off the libraries and write some functions yourself, like strcpy(),atoi() and such (or you can LoadLibrary("MSVCRT.DLL") and get these functions from there). Is it the "bloated" code? The optimized code from these compilers looks nice in disassembler -- nothing which should not be there. The only thing I do not like is that when Windows API is called -- it goes through a JMP table and FASM does a direct call into IMPORT section -- I was not able to switch that off. Other than that those compilers are OK in my opinion. |
|||
03 Dec 2021, 16:32 |
|
macomics 03 Dec 2021, 18:36
AsmGuru62 wrote: The only thing I do not like is that when Windows API is called -- it goes through a JMP table and FASM does a direct call into IMPORT section -- I was not able to switch that off. ADD: These JMP instructions are not in OBJ files. They appear in LIB files. Last edited by macomics on 03 Dec 2021, 19:39; edited 1 time in total |
|||
03 Dec 2021, 18:36 |
|
sylware 03 Dec 2021, 19:18
gcc and clang 'backdoor injectors for all old/current/future CPUs'(irony?) are insanely and massively complex, and having my code not dependent on those (and their developers loving planned obsolescence), makes me experience the feelings I am talking about. It is objective facts about my emotional state. It is so obvious, I wanted to share it here.
But I know that time erodes anything, wonder how long those strong satisfying feelings will last. As I said, the status quo is still nasty because of the scammers of computer systems, but oh dear!, it feels already so good to have that little part on the right path/trajectory. |
|||
03 Dec 2021, 19:18 |
|
macomics 03 Dec 2021, 19:45
In any case, if there was fair competition between at least large firms (the scammers of computer systems), this would not have happened. The introduction of universal approaches is doomed to degenerate into very inefficient solutions. Thus, the code created by third-party developers will be obviously worse than the one that is optimized for a specific platform.
While Steve Jobs was at the head of Apple, there was at least some competition. And now Apple has been turned into consumer goods, they have been accepted into a club of computer scammers. |
|||
03 Dec 2021, 19:45 |
|
sylware 03 Dec 2021, 20:08
For the story, I remember the time I had nokia first 'mini-tablet about to become a phone' (nokia 770), that with a super lean gnu/linux distro and a more than enough GTK+ based GUI software. It was great, they were about to add a mobile modem and telephony... then everything turned to 'you know what', nobody knew what was happening in nokia and why they were 'destroying' their future... and somewhat a bit later apple was releasing the iphone. A few convenient years later, we discovered that microsoft had been taking control of nokia, and in the end bought them when it was too obvious.
After some similar cases happening in other hightech domains, I understood something about international finance and the world we live in... Last edited by sylware on 03 Dec 2021, 22:08; edited 1 time in total |
|||
03 Dec 2021, 20:08 |
|
sts-q 03 Dec 2021, 20:39
AsmGuru62:
man -P cat gcc | wc -l 20351 lines, that is >300 manual pages my K&R from 1983 is <250 pages |
|||
03 Dec 2021, 20:39 |
|
macomics 03 Dec 2021, 22:56
sylware wrote: For the story, I remember the time I had nokia first 'mini-tablet about to become a phone' (nokia 770) ... But every year a new toy is released to you, which differs from yours only in that it does not slow down and has a couple more functions that you do not need. Because of this, the new device is even more expensive than the previous one. |
|||
03 Dec 2021, 22:56 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.