Compile your own OS with Visual Studio

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Therx

Re:Compile your own OS with Visual Studio

Post by Therx »

If all you want is good colour coding look no further than ConTEXT:-

http://fixedsys.com/context/

This is what I use and it's completely free. It highlights most languages and you can edit the highlighters to your preference. Other useful features are:-
  • You can export the colour coded code to a HTML doc.
  • You can specify functions keys so that it will automatically save, then compile your OS on F9 for example. It also helps because you can look through the whole compile without the first warnings/errors scrolling off the top of the screen.

    Pete
Robert Lee

Re:Compile your own OS with Visual Studio

Post by Robert Lee »

Well personally I prefer IDEAL mode syntax (TASM). Is there any way to get GCC to accept that?

-Robert
mystran

Re:Compile your own OS with Visual Studio

Post by mystran »

@solar: Emacs no good.. but fortunately Vim is ported to Windows too.. ;)
nullify

Re:Compile your own OS with Visual Studio

Post by nullify »

I'm not too concerned about GCC's use of AT&T syntax over Intel syntax... rather, it seems more unproductive that inline assembly code must be within strings.

For example,

Code: Select all

asm
(
"func:              \n"
"     mov %eax, %ebx \n"
"     mov %eax, %ebx \n"
"     mov %eax, %ebx \n"
"     mov %eax, %ebx \n"
);
This makes inline assembly a bit more difficult to write and edit, and its a bit distracting.

Code: Select all

asm
{
func:
     mov %eax, %ebx
     mov %eax, %ebx
     mov %eax, %ebx
     mov %eax, %ebx
};
IMHO if it could be formatted this way, it would render the code a bit easier to read and maintain.

Just a thought.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Compile your own OS with Visual Studio

Post by Pype.Clicker »

err ... imho, the inline asm isn't meant to be "productive" ... it's just there to provide a clean way to create macros that will give the programmer access to resource that aren't available through "normal" instruction set (the one the compiler knows and uses), like in, out, ltr, pginvl, etc.
nullify

Re:Compile your own OS with Visual Studio

Post by nullify »

Hmm, well you'd think that since C was designed to code UNIX, they would make inline assembly somewhat more convenient. For some reason C seems to be getting this whole "for system programming only" reputation these days...

I'd argue that increasing productivity wouldn't be a bad thing, and besides - people wouldn't be complaining about AT&T syntax if they were just as productive with it :-)
Silverhawk

Re:Compile your own OS with Visual Studio

Post by Silverhawk »

Hello, I'm back !

I've tried the following syntax in GCC :

asm(".intel_syntax");
asm("mov ax,0x10");
asm("mov cs,ax");

But I've an error when I try to compile :

c:/djgpp/tmp/ccTpLn5j.s: Assembler messages: c:/djgpp/tmp/ccTpLn5j.s:66: Error: no such instruction: `subl $8,%esp' c:/djgpp/tmp/ccTpLn5j.s:67: Error: no such instruction: `pushl $10' c:/djgpp/tmp/ccTpLn5j.s:68: Error: no such instruction: `pushl $1280' c:/djgpp/tmp/ccTpLn5j.s:70: Error: no such instruction: `addl $16,%esp' c:/djgpp/tmp/ccTpLn5j.s:71: Error: no such instruction: `pushl $LC3' c:/djgpp/tmp/ccTpLn5j.s:72: Error: no such instruction: `pushl $9' c:/djgpp/tmp/ccTpLn5j.s:73: Error: no such instruction: `pushl $24' c:/djgpp/tmp/ccTpLn5j.s:74: Error: no such instruction: `pushl $0' c:/djgpp/tmp/ccTpLn5j.s:76: Error: no such instruction: `addl $16,%esp'


it is DJGPP...

Is it necessary to have a specific version to use
asm(".intel_syntax"); ?

Thanks.
nullify

Re:Compile your own OS with Visual Studio

Post by nullify »

Silverhawk wrote:Hello, I'm back !

I've tried the following syntax in GCC :

asm(".intel_syntax");
asm("mov ax,0x10");
asm("mov cs,ax");

But I've an error when I try to compile :

c:/djgpp/tmp/ccTpLn5j.s: Assembler messages: c:/djgpp/tmp/ccTpLn5j.s:66: Error: no such instruction: `subl $8,%esp' c:/djgpp/tmp/ccTpLn5j.s:67: Error: no such instruction: `pushl $10'
..........
You forgot to switch back to AT&T syntax after you were done writing your Intel syntax code:

asm(".att_syntax");
Silverhawk

Re:Compile your own OS with Visual Studio

Post by Silverhawk »

Thanks to nullify...

It works...
I didn't know it was necessary to come back to the AT&T syntax...
Post Reply