Page 1 of 1
Newbie in need of help
Posted: Wed Dec 29, 2004 1:40 pm
by crasha
I'm a newbie to OS Development...
I'm currently writing an operating system in netwide assembler (nasm) and, after hours of scratching my head, i've realised that i either need to use C (which i don't know very much of) or i need to learn nasm.
I'm not new to programming, though. I've made tons of programs in DIV (like C, but for games programming), visual basic and C.
Basically, I need to learn nasm (for example what does ax mean? and int 0x0E and jz etc...), i need to learn how to load other "programs" from within my OS, or i need to learn how to write a kernel in C (or C++).
I don't reali know HOW to link header files with C source files and that... and I'm not sure quite how to load a kernel in C from my bootsector in NASM (i think its something to do with LD?).
I know I'm ranting on here, but what I'm trying to say is I'm not very advanced in NASM and I just need help understanding some of the interrupts, calls, stacks, segments and all the other confusing stuff, and how to use them.
I have written a kernel, and am willing to send a disk image with the bootsector and kernel loaded to anyone who asks. I will also supply the source code.
Help!!
Re:Newbie in !!!GREAT!!! need of help
Posted: Wed Dec 29, 2004 1:41 pm
by crasha
If you want to PM or email (
[email protected] ) me, please do!
Re:Newbie in !!!GREAT!!! need of help
Posted: Wed Dec 29, 2004 1:50 pm
by pini
Well, if you want to learn assembly, I would suggest to start by
http://linuxassembly.org/ where many links to tutorial are available.
AL, AH, AX, BL, BH, BX... are registers (small "memories" located inside the processor) and are used to perform computing.
You may also look for help at
http://www.nondot.org/sabre/os/articles and download the Intel official manuals at
http://developer.intel.com/design/Pentium4/documentation.htm#manuals
Docs from Intel are especially useful, as there is one volume to explain basic architectures, two volumes to explain instructions and one last volume about system programming
Anyway, doing your kernel in C (or C++) needs the use of a linker (LD is a good one), so you may search on this forum for previous posts about LD.
Loading your kernel from your own bootloader deals with disk interrupts, but I suggest to start by using GRUB as a bootloader, which works pretty well.
Re:Newbie in !!!GREAT!!! need of help
Posted: Wed Dec 29, 2004 2:19 pm
by crasha
thanks for your advice!!!
i'll read through those websites and see what info i can get
if anyone else can give me help it would still be appreciated though
Re:Newbie in !!!GREAT!!! need of help
Posted: Thu Dec 30, 2004 10:50 am
by bubach
crasha wrote:I'm currently writing an operating system in netwide assembler (nasm) and, after hours of scratching my head, i've realised that i either need to use C (which i don't know very much of) or i need to learn nasm.
hehe, great conclusion..
please visit the fasm (flat assembler) forum at
http://board.flatassembler.net/
fasm is nicer then nasm..
/ Christoffer
Re:Newbie in !!!GREAT!!! need of help
Posted: Thu Dec 30, 2004 11:50 am
by ASHLEY4
bubach is right, fasm is the best assembler for OS dev.
\\\\||////
(@@)
ASHLEY4.
Batteries not included, Some assembly required.
Re:Newbie in !!!GREAT!!! need of help
Posted: Tue Jan 04, 2005 12:44 pm
by Googles
yes fasm is probally the best... if you in the test exclude nasm
Re:Newbie in !!!GREAT!!! need of help
Posted: Tue Jan 04, 2005 1:57 pm
by Schol-R-LEA
How great an issue is it, really? The assemblers may have different syntaces, but they essentially work the same way; it isn't like with HLLs, where the basic structures and models can be radically different from each other. Even a FORTH assembler is essentially still an assembler, no matter how different the particular syntax is from the Intel format.
As for which assembler is 'best', that is a personal choice that can only be determined with experience.
Anyway, if you check the Book Recommendations thread, you'll find a number of x86 assembly books for beginners.
Re:Newbie in need of help
Posted: Fri Jan 07, 2005 8:49 am
by bubach
nasm is written in C! thats a very good reason for any assembly fan not to use it..
and as fasm compiles itself, on a couple of platforms, its better for os dev (easy to port).
other then that, it does not matter much.
Re:Newbie in need of help
Posted: Sun Jan 09, 2005 2:38 pm
by mystran
Schol-R-LEA, if you really mean "Forth as an assembler" and not just "Forth style assembler" then I just HAVE to disagree.
Forth does have another stack after all, so in a sense it offers more than say C, where you only have one stack. In some sense, I think C is more like assembler than Forth is.
Besides, if you had a macro assembler with a Turing complete macro-system then you could write a compiler for any kinds of language semantics with the macro system, even though enforcing the use of only the macro-system needs support from the macro system itself. In any case, assemblers can be different. At least as anything Turing complete can ever be considered "different" since after all they are all computationally equivalent.
In any case, if you want to write a whole OS with assembler, then you probably want a Turing complete macro language in your assembler anyway.
In any case, personally I'd just write in C. It's really nothing but a portable assembler anyway.
Re:Newbie in need of help
Posted: Thu Jan 13, 2005 2:07 pm
by crasha
i tried fasm...
and masm...
and tasm...
and i am finding nasm easier to use:
fasm is VERY different to nasm and I don't have a clue where to start and tasm is kind of like nasm, but it doesn't support any decent file formats.
i guess I'm just more used to nasm
do you know any good fasm tutorials because i'd be happy to learn it
i also need to learn how to make an OS in C but out of every 20 articles i see on OSes in C I normally see 1 that is a tale of success (i hardly know any C/C++ anyway :-[ )
Re:Newbie in need of help
Posted: Thu Jan 13, 2005 7:47 pm
by Schol-R-LEA
mystran wrote:
Schol-R-LEA, if you really mean "Forth as an assembler" and not just "Forth style assembler" then I just HAVE to disagree.
Nope; by Forth Assembler, I was referring to the assembler that comes with most standalone Forth interpreters, and in which the interpreters themselves are implemented. While they often have a Forth-like arguments-followed-by-instructions syntax, and are closely integrated into the Forth system, they are true assemblers, used for creating words which need low-level access tot he hardware.