Page 3 of 4
Posted: Sat Jan 26, 2008 2:06 pm
by inflater
Alboin wrote:Note, however, that by 'output', I meant assembly language output. So, I don't see why a fasm back end wouldn't be possible.
FASM builds right on the application, depending on command line parameters and source content, say elf, bin, exe, com etc.
You could translate e.g. COM to Microsoft OMF (.OBJ) but that would be pretty useless since FASM doesn't support the extrn keyword like NASM (plus C/C++) does
Posted: Sat Jan 26, 2008 2:07 pm
by bloodhound23
djtrickdog wrote:better yet, you should make a C/C++/ASM based programming tool that bundles important codes together to make OS development Super fast. Example is to use one line of code say "Set_Pmode(parimeters)" would set your os into protected mode. That would all be front end but behind the scene they are actually writing the actual "long" code.
With this OS development would fly
Only problem with this is that different people want to do different things when entering pmode. Plus the fact that the actual code for just entering pmode is 3 lines of asm.
after this do what ever you wan't GDT etc.
Posted: Sat Jan 26, 2008 2:14 pm
by bloodhound23
what I'm doing now: creating multiboot system: kubuntu,NetBSD
Posted: Sat Jan 26, 2008 4:03 pm
by djtrickdog
bloodhound23 wrote:djtrickdog wrote:better yet, you should make a C/C++/ASM based programming tool that bundles important codes together to make OS development Super fast. Example is to use one line of code say "Set_Pmode(parimeters)" would set your os into protected mode. That would all be front end but behind the scene they are actually writing the actual "long" code.
With this OS development would fly
Only problem with this is that different people want to do different things when entering pmode. Plus the fact that the actual code for just entering pmode is 3 lines of asm.
after this do what ever you wan't GDT etc.
thats why making a frontend like that isnt easy. You gotta make it VERY customizable yet stable. Every procedure with multiple lines can go into one line and that would Make editing so much faster and easier to maintain.
Posted: Sat Jan 26, 2008 4:45 pm
by bloodhound23
I don't know about you but it only took me a couple seconds or less to write those three lines.
Posted: Sat Jan 26, 2008 5:35 pm
by djtrickdog
yes but a whole woppin OS isnt 3 lines. alot of important functions require alot more than 3 lines. you would easily cut down the amount of code you type plus you can make it MUCH easier to remember.
Posted: Sat Jan 26, 2008 6:09 pm
by bloodhound23
that doesn't cut down the code for me, I still have to put those features in.
Might take me even longer.
Posted: Sat Jan 26, 2008 10:23 pm
by AndrewAPrice
Like an unsafe C#-style language that compiles to native code with a internal stuff wrapped in a library (e.g. load page directory, class wrappers for page library, atomic operations, etc).
I was thinking you could have simple things such as wrappers for implementing processes and file systems, but this would be limit OS's from implementing their own forms of abstraction.
Posted: Sun Jan 27, 2008 4:24 am
by Jef
maybe is useful but if you don't know what "SetPMode" does (or whatever function does), maybe this creates "unknown" future bugs, except if this new language is full documented and tested.
Thats why i use only asm.
Posted: Sun Jan 27, 2008 8:03 am
by bloodhound23
I may add some minimal things like structures though.
Posted: Sun Jan 27, 2008 8:07 am
by bloodhound23
maybe something like asm with functions.
Code: Select all
func entpm()
{
mov eax,cr0
or eax,1
mov cr0,eax
}
entpm();
Posted: Sun Jan 27, 2008 6:30 pm
by bloodhound23
I have decided to go with fasm after realizing it would be faster than writing a new tool to write an OS.
Posted: Mon Jan 28, 2008 10:22 am
by inflater
This is just plain stupid.
As far as I know, GCC doesn't generate 16bit real mode code... (and that's the mode where a ordinary x86 CPU is after boot-up).
Plus you would need to set up GDT, IDT and jmp far to your 32bit code after the mov cr0,eax. And I can pretend how your "entpm" function would react if it would reach the ending bracket " } "... There, it restores the registers and stuff. I see a triple fault
... if the processor would even GET there.
Anywho, setting up protected mode in a GCC stack-framed inline assembly code block is a great idea, really
Your silly code wouldn't work. You would need to switch to pmode in assembly. If you show me a working C/C++ bootloader with a "set_pmode" INLINE assembly function (not the in the ASM stub),... which is impossible,... then i would have respect to you. Of course, your code. Good luck
Posted: Mon Jan 28, 2008 2:42 pm
by bloodhound23
If I wrote the assembler myself I'm talking about, not using gas or some other thing.
I'm not talking about writing the bootloader in C, maybe you haven't read this entire post?
Posted: Mon Jan 28, 2008 6:58 pm
by Jef
Alboin wrote:Jef wrote:btw, is there a C compiler that not uses windows libraries and outputs a native executable (like old .com files) ?
I mean like compiling with nasm assembler.
Nwcc can produce output for various assemblers. (fasm, nasm, yasm.)
Yes but this runs only in linux/unix
Is there something like this in windows?