Page 1 of 1

developing in win32

Posted: Mon Jan 06, 2003 1:45 pm
by rdragon
hey all... have been lurking the boards heavily for about 2 weeks now... the last 2 days i have started my own kernel... i had a bootsector working, but then it came time to enabling protected mode, and instead of simply learning the code to write, i would rather have a better grasp of the concept before i actually do the code. yeah I could memorize the steps to get into pm but I wont learn anything about how it works, so i decided to throw someone else's bootsector/loader (it supported fat 16 (12?)) on my floppy so i could do some kernel work. so far i have a basic print function working and tonight im going to work on my video driver a little bit more... i am developing on win32 (winxp pro)... I would rather develop on my linux machine, but thats the machine im testing the floppy in :-) I am currently using djgcc and nasm through the dos box, but i am not very fond of the at&t asm syntax that djgcc loves. i was wondering about using other compilers, i saw some people mention MinGW, i will probably take a look at it, also cygwin ive seen you guys talking about.

Also, it seemed djgcc didn't like that i named one of my functions "printf"... hmm... is there a way to disable the builtin libraries so it doesnt care about all that? ;p

anyways, i intended this to be more of a 'hello' message than what it turned out to be... but... hello! ;)

Re:developing in win32

Posted: Mon Jan 06, 2003 4:03 pm
by nullify
anyways, i intended this to be more of a 'hello' message than what it turned out to be... but... hello!
Welcome! :)
Also, it seemed djgcc didn't like that i named one of my functions "printf"... hmm... is there a way to disable the builtin libraries so it doesnt care about all that? ;p
There should be compiler flags like -nostdinc and -fno-builtin, and the linker flag --nostdlib.
I am currently using djgcc and nasm through the dos box, but i am not very fond of the at&t asm syntax that djgcc loves.
Isn't that why you are using nasm? ???
i was wondering about using other compilers, i saw some people mention MinGW, i will probably take a look at it, also cygwin ive seen you guys talking about.
Cygwin, MinGW, and DJGPP are all clones of the gcc compiler that's used on Linux. Since AT&T syntax is the standard in UNIX/Linux, gcc (and therefore Cygwin, MinGW, and DJGPP) all use AT&T syntax assembly. I know, I hate it too :(

I've heard that GAS accepts a ".intel_syntax" directive which causes it to accept valid Intel syntax assembly, but I haven't really experimented with it.

Re:developing in win32

Posted: Mon Jan 06, 2003 4:07 pm
by nullify
Cygwin, MinGW, and DJGPP are all clones of the gcc compiler that's used on Linux.
Ok, Cygwin isn't *just* gcc, its a whole UNIX development environment, and DJGPP can be a whole UNIX environment, too. Just wanted to restate this before the computing gods descend upon me. :)

Re:developing in win32

Posted: Mon Jan 06, 2003 4:45 pm
by mr. xsism
well, nasm is great, and i hate gcc too. Now that that is done, gcc at&t asm isn't that bad,except withvars ie:
asm("mov ax,1 \n",
"mov bx,2 \n",
"mov cx,3 \n");

that works fine, without varsmit is simple. Just other stuff like vars and passing info to gcc is hard.
----
Figure out mode for urself,it's a big hurdle, i know.
----
Batch files also help alot! code a simple one that calls nasm,gcc,and ld to build a main image binary

regards,
mr. xsism

Re:developing in win32

Posted: Mon Jan 06, 2003 4:56 pm
by rdragon
I am currently using djgcc and nasm through the dos box, but i am not very fond of the at&t asm syntax that djgcc loves.
Isn't that why you are using nasm? ???
Actually I was regarding using the inline asm... I guess i just have to look up how to write an asm function, then use it in the C source, and compile it all into one program :-X

Re:developing in win32

Posted: Mon Jan 06, 2003 6:06 pm
by nullify
rdragon:
Actually I was regarding using the inline asm... I guess i just have to look up how to write an asm function, then use it in the C source, and compile it all into one program
See http://www.osdev.org/developers/guide01/index.html

mr. xsism:
Now that that is done, gcc at&t asm isn't that bad,except withvars ie:
asm("mov ax,1 \n",
"mov bx,2 \n",
"mov cx,3 \n");
That looks like Intel assembly to me. You have no $ before constants, and the source/dest operands are supposed to be switched...

Re:developing in win32

Posted: Mon Jan 06, 2003 6:09 pm
by nullify
Oh yeah, and if you already know Intel assembly and want to know the differences between Intel and AT&T assembly, take a look at this link:

http://www.delorie.com/djgpp/doc/brennan/brennan_att_inline_djgpp.html