flat assembler
Message board for the users of flat assembler.

Index > High Level Languages > flat c :)

Author
Thread Post new topic Reply to topic
9.9



Joined: 23 Feb 2007
Posts: 4
9.9 23 Feb 2007, 18:15
Good day
Help me to find a windows C compiler/linker (not GCC port!) that can compile/link 32-bit raw binary for my OS developing purposes Smile
I ve already try:
*LCC (i've read that it's linker lcclnk can create binary, but i've not fing this kind of stuff Sad)
*MACC/ACC Smile I can't start it in WinXP (error interrupt handling problem)

Thanx
Post 23 Feb 2007, 18:15
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
yumka



Joined: 09 Feb 2007
Posts: 38
Location: Tenochtitlan
yumka 24 Feb 2007, 23:49
Post 24 Feb 2007, 23:49
View user's profile Send private message Visit poster's website Reply with quote
hckr83



Joined: 12 Nov 2006
Posts: 86
Location: usa
hckr83 25 Feb 2007, 01:23
pelles C can't do raw binary though can it? plus I read the liscense and it has some very nice, restrictive clauses..

guess you could do VC...

why not a gcc port?
Post 25 Feb 2007, 01:23
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger Reply with quote
9.9



Joined: 23 Feb 2007
Posts: 4
9.9 25 Feb 2007, 14:26
hckr83 wrote:
plus I read the liscense and it has some very nice, restrictive clauses..
why not a gcc port?

+1
coz i know that gcc can do it Smile But i wanna find another 'brilliant thing' Smile
Post 25 Feb 2007, 14:26
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 26 Feb 2007, 00:35
MACC/ACC (David Ashley)? Run them under DOSBox 0.65. But, yes, there are probably better compilers for what you want. (Sorry, I have no idea, personally. OctaOS uses normal GCC but AS-ELF on the resulting .s for its assembler to read for its OS. )
Post 26 Feb 2007, 00:35
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 26 Feb 2007, 07:02
Instead of doing raw binary and having all the hassle of finding a compiler that supports this, do yourself a favour and have your kernel in either PE or ELF format and use standard tools. You don't need full PE support (the main kernel isn't likely to have things like imports anyway Wink ), and if you don't even need relocations, you only need something like 9 instructions (including error checks) more to handle a PE kernel than binary kernel.

Code:
        mov             edi, KERNEL_DEST                ; kernel load address

        cmp             word [edi], 0x5A4D              ; Do we have a MZ header?
        jne             crash_and_burn_1

        add             edi, [edi + 0x3C]               ; e_lfanew pointer in MZ header

        cmp             dword [edi], 0x4550             ; Do we have a PE header?
        jne             crash_and_burn_2

        mov             edi, [edi + 0x28]               ; OptionalHeader.AddressOfEntryPoint (RVA)
        add             edi, KERNEL_DEST                ; Add imagebase to go from RVA to VA
        jmp             edi                                             ; enter kernel!
    
Post 26 Feb 2007, 07:02
View user's profile Send private message Visit poster's website Reply with quote
Japheth



Joined: 26 Oct 2004
Posts: 151
Japheth 26 Feb 2007, 08:43
f0dder wrote:
Instead of doing raw binary and having all the hassle of finding a compiler that supports this, do yourself a favour and have your kernel in either PE or ELF format and use standard tools.


I fully agree. Another option is: you can make the linker to merge all your COFF sections and then use a simple tool which extracts the section content to a file. An example of such a tool is attached.

I did exactly this for a program of mine (a PE binary included as BLOB in a DOS MZ binary).


Description:
Download
Filename: extrsect.zip
Filesize: 8.06 KB
Downloaded: 1013 Time(s)

Post 26 Feb 2007, 08:43
View user's profile Send private message Reply with quote
9.9



Joined: 23 Feb 2007
Posts: 4
9.9 26 Feb 2007, 09:00
rugxulo, Japheth, f0dder
THANKS 4 ur ideas, i'll really better create my own PE loader :]
Post 26 Feb 2007, 09:00
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 26 Feb 2007, 18:51
BTW, is it just me or is everybody and their brother creating their own OS? That would make my head explode if I tried. Shocked

Anyways, good luck! Wink
Post 26 Feb 2007, 18:51
View user's profile Send private message Visit poster's website Reply with quote
9.9



Joined: 23 Feb 2007
Posts: 4
9.9 27 Feb 2007, 19:43
Quote:

Anyways, good luck!



U too Smile
Post 27 Feb 2007, 19:43
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Filter



Joined: 08 Oct 2006
Posts: 67
Filter 27 Feb 2007, 20:22
rugxulo wrote:
BTW, is it just me or is everybody and their brother creating their own OS? That would make my head explode if I tried. Shocked

Anyways, good luck! Wink


What would be cool is if they combined their efforts and created a single OS that was small, fast and could handle many of the things that larger operating systems like Windows and Linux can.
Post 27 Feb 2007, 20:22
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 28 Feb 2007, 01:55
Filter wrote:
rugxulo wrote:
BTW, is it just me or is everybody and their brother creating their own OS? That would make my head explode if I tried. Shocked

Anyways, good luck! Wink


What would be cool is if they combined their efforts and created a single OS that was small, fast and could handle many of the things that larger operating systems like Windows and Linux can.


Will never happen, though.

People have different (and conflicting) ideas, and even large efforts like linux and BSD (and heck, to some extent, big commercial things like OS X) have problems with drivers for hardware...

_________________
Image - carpe noctem
Post 28 Feb 2007, 01:55
View user's profile Send private message Visit poster's website Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 01 Mar 2007, 01:35
No sense in combining anything when virtualization exists. (Heck, Parallels for Mac now claims to be able to seamlessly run Win XP or Vista, including transferring all your stuff b/w 'em.)
Post 01 Mar 2007, 01:35
View user's profile Send private message Visit poster's website Reply with quote
masonswanson



Joined: 17 Aug 2010
Posts: 51
masonswanson 01 Nov 2010, 06:16
Yea what everybody should work on together is educating the masses about operating system development, that way everybody could just trade4 code instead of working 40 hours a week for months before they can afford commercial software
Post 01 Nov 2010, 06:16
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 01 Nov 2010, 08:22
I have recently tried some OSDev with C myself.
What i found easiest is to make object files (coff in my case)
then let the linker strip and merge them into a flat binary.

Assembler: NASM
C-Compiler: djgpp
Linker: ld
Builder: Make

What i found is that writing an x86 kernel is easyest in ASM.
Then to write the shell and other stuff in C language.

If people are interested, i can provide a simple demo
to show the basics of using these tools on Win32 to get the job done.
Post 01 Nov 2010, 08:22
View user's profile Send private message Reply with quote
guignol



Joined: 06 Dec 2008
Posts: 763
guignol 01 Nov 2010, 11:00
bitshifter
I'm sure noone will mind.


P.S. Are you, like, from MIT?
Post 01 Nov 2010, 11:00
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 01 Nov 2010, 17:24
guignol wrote:
Are you, like, from MIT?

Nope, never had been educated, only self taught...

_________________
Coding a 3D game engine with fasm is like trying to eat an elephant,
you just have to keep focused and take it one 'byte' at a time.
Post 01 Nov 2010, 17:24
View user's profile Send private message Reply with quote
DarkAlchemist



Joined: 08 Oct 2010
Posts: 108
DarkAlchemist 01 Nov 2010, 18:28
bitshifter wrote:
guignol wrote:
Are you, like, from MIT?

Nope, never had been educated, only self taught...
Formal education can very often lead to one way thinking and dumbness overall.

So, self taught can be a very good thing.
Post 01 Nov 2010, 18:28
View user's profile Send private message Send e-mail 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.