flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Linking C Code with FASM?

Author
Thread Post new topic Reply to topic
me239



Joined: 06 Jan 2011
Posts: 200
me239 21 Aug 2019, 00:47
Hey everyone, I'm just getting back into OS Dev after about a 7 year hiatus... so I thought going into 32 bit PMode would be my new goal! I've written a basic DOS clone before for real mode, but real mode is just so much simpler than 32 bit. I've managed to get my OS to print strings in protected mode, but I've seem to have hit a wall getting beyond that. I'm still clueless as to how to effectively manage virtual memory or get a working IDT. I've been looking at tutorials, but each one seems to use ELF executables written in C and booted by GRUB. Call me old fashioned, but I still prefer booting from a floppy or at least an image of one.

Either way, I see this a good chance to finally learn some C, but I also want to use FASM instead of GAS or GCC. Does anyone know how to seamlessly link FASM code with C like GCC can do? Also, anyone know of any good 'baby step' tutorials I can look at that use FASM (or at least pure assembly) that break down concepts like paging and virtual memory?

Sorry if some questions don't make sense, I'm very new to PMode and programming outside of 16 Bit FASM, BASIC, and dabbling in C.
Post 21 Aug 2019, 00:47
View user's profile Send private message Reply with quote
redsock



Joined: 09 Oct 2009
Posts: 434
Location: Australia
redsock 21 Aug 2019, 09:09
me239 wrote:
Either way, I see this a good chance to finally learn some C, but I also want to use FASM instead of GAS or GCC. Does anyone know how to seamlessly link FASM code with C like GCC can do? Also, anyone know of any good 'baby step' tutorials I can look at that use FASM (or at least pure assembly) that break down concepts like paging and virtual memory?
While I didn't write any of my gcc integration for 32 bit, many of the same principles apply: https://2ton.com.au/rants_and_musings/gcc_integration.html ... Linking with my library is similar/same-as linking with "normal fasm object files" so really, the primary differences with 32 vs 64 will be calling convention, not linking semantics.

HTH Smile

Cheers

_________________
2 Ton Digital - https://2ton.com.au/
Post 21 Aug 2019, 09:09
View user's profile Send private message 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.