New programming lang.

Programming, for all ages and all languages.
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Post 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 :)
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
User avatar
bloodhound23
Member
Member
Posts: 115
Joined: Wed Jan 23, 2008 7:13 pm
Contact:

Post 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.

Code: Select all

mov cr0,eax
or eax,1
mov cr0,eax
after this do what ever you wan't GDT etc.
I thought I wasn't thinking, I thought wrong.
User avatar
bloodhound23
Member
Member
Posts: 115
Joined: Wed Jan 23, 2008 7:13 pm
Contact:

Post by bloodhound23 »

what I'm doing now: creating multiboot system: kubuntu,NetBSD
I thought I wasn't thinking, I thought wrong.
User avatar
djtrickdog
Member
Member
Posts: 39
Joined: Sat Dec 15, 2007 7:36 pm

Post 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.

Code: Select all

mov cr0,eax
or eax,1
mov cr0,eax
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.
User avatar
bloodhound23
Member
Member
Posts: 115
Joined: Wed Jan 23, 2008 7:13 pm
Contact:

Post by bloodhound23 »

I don't know about you but it only took me a couple seconds or less to write those three lines.
I thought I wasn't thinking, I thought wrong.
User avatar
djtrickdog
Member
Member
Posts: 39
Joined: Sat Dec 15, 2007 7:36 pm

Post 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.
User avatar
bloodhound23
Member
Member
Posts: 115
Joined: Wed Jan 23, 2008 7:13 pm
Contact:

Post by bloodhound23 »

that doesn't cut down the code for me, I still have to put those features in.
Might take me even longer.
I thought I wasn't thinking, I thought wrong.
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post 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.
My OS is Perception.
User avatar
Jef
Member
Member
Posts: 112
Joined: Tue Jan 08, 2008 7:25 am
Location: Greece
Contact:

Post 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.
Keep coding...
...the sky is the limit

AsteriOS project: http://www.mindfields.gr/main/index.php ... &Itemid=27
User avatar
bloodhound23
Member
Member
Posts: 115
Joined: Wed Jan 23, 2008 7:13 pm
Contact:

Post by bloodhound23 »

I may add some minimal things like structures though.
I thought I wasn't thinking, I thought wrong.
User avatar
bloodhound23
Member
Member
Posts: 115
Joined: Wed Jan 23, 2008 7:13 pm
Contact:

Post by bloodhound23 »

maybe something like asm with functions.

Code: Select all

func entpm()
{
  mov eax,cr0
  or eax,1
  mov cr0,eax
}
entpm();
I thought I wasn't thinking, I thought wrong.
User avatar
bloodhound23
Member
Member
Posts: 115
Joined: Wed Jan 23, 2008 7:13 pm
Contact:

Post by bloodhound23 »

I have decided to go with fasm after realizing it would be faster than writing a new tool to write an OS.
I thought I wasn't thinking, I thought wrong.
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Post by inflater »

Code: Select all

func entpm()
This is just plain stupid. :roll: 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 :lol:... if the processor would even GET there. :lol:

Anywho, setting up protected mode in a GCC stack-framed inline assembly code block is a great idea, really :roll:

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 :lol:
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
User avatar
bloodhound23
Member
Member
Posts: 115
Joined: Wed Jan 23, 2008 7:13 pm
Contact:

Post 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?
I thought I wasn't thinking, I thought wrong.
User avatar
Jef
Member
Member
Posts: 112
Joined: Tue Jan 08, 2008 7:25 am
Location: Greece
Contact:

Post 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?
Keep coding...
...the sky is the limit

AsteriOS project: http://www.mindfields.gr/main/index.php ... &Itemid=27
Post Reply