Page 1 of 3
Advice/Support requested at OS Development
Posted: Mon Mar 23, 2009 6:45 am
by ehenkes
I started a tutorial (German language) regarding OS Development on base of tools working in MS Windows. I would be glad to get feedback to my source code. Up to now only tiny bootloader, kernel with a command line interpreter in Real Mode, and after entering the instruction 'pm' activating A20 gate and switching to PM.
http://www.henkessoft.de/OS_Dev/OS_Dev1.htm (tutorial)
http://www.henkessoft.de/OS_Dev/OS_Dev1 ... TocId80121 (bootloader, gdt, kernel, makefile)
Your support would be highly appreciated.
Re: Advice/Support requested at OS Development
Posted: Mon Mar 23, 2009 7:50 am
by Solar
A quick skipping over the text... awesome work, the presentation is excellent. I hope all the pictures are your original work, or you have permission to use them?
Re: Advice/Support requested at OS Development
Posted: Mon Mar 23, 2009 8:01 am
by ehenkes
Solar wrote:I hope all the pictures are your original work ...?
The pictures are produced by myself with screenshots, MS Paint and MS Excel.
Any thoughts about the code?
Re: Advice/Support requested at OS Development
Posted: Mon Mar 23, 2009 8:31 am
by Solar
Can't read ASM much, sorry. It's all hieroglyphs for me.
Re: Advice/Support requested at OS Development
Posted: Mon Mar 23, 2009 9:31 am
by Creature
Like Solar said, the images and all look great. One question though: Why exactly aren't you doing this in English?
Re: Advice/Support requested at OS Development
Posted: Mon Mar 23, 2009 9:52 am
by Solar
Because there's an internet beyond the English language, and not every German is so comfortable with the English language that he's willing to write technical texts in it?
The
best HTML / webdesign source around isn't available in English, either.
We keep the best things for ourselves.
Re: Advice/Support requested at OS Development
Posted: Mon Mar 23, 2009 9:54 am
by ehenkes
Why exactly aren't you doing this in English?
Good question. All my tutorials are in German. But English would be no big challenge for me.
The sources are in Assembler (NASM) so far, and the comments are in English.
Re: Advice/Support requested at OS Development
Posted: Mon Mar 23, 2009 11:34 am
by Hyperdrive
One thing that caught my eye is this:
Code: Select all
xor ax, ax
[...]
mov ss, ax
mov sp, ax
[...]
call print_string
You zero SS and SP and then you use the stack (implicitly by CALL). That looked strange first. It's not broken, but it is not very intuitive. Maybe you want to consider to note this in your text (I didn't see anything about that, maybe I just missed it) and explain why and how that works.
--TS
Re: Advice/Support requested at OS Development
Posted: Mon Mar 23, 2009 5:04 pm
by ehenkes
Thanks. Yes, you are right. I have to explain this "wrap around" of SP.
Re: Advice/Support requested at OS Development
Posted: Mon Mar 23, 2009 7:17 pm
by Troy Martin
Hey, thanks for linking to and using my real mode bare bones kernel
Good luck with your tutorial, hope it works out great!
Re: Advice/Support requested at OS Development
Posted: Tue Mar 24, 2009 2:32 am
by ehenkes
Hey, thanks for linking to and using my real mode bare bones kernel
Good luck with your tutorial, hope it works out great!
Thank you very much for this wonderful mini kernel without bootloader! I looked for an very easy starter doing more than finishing in an endless loop or printing 'hello world'. Hence, I found your really great mini kernel. It has been a helpful basis for my project. My target is to introduce OS Development to people using MS Windows which are not very skilled to work with assembler, hexeditor, partcopy or bochs.
In this chapter we start to modify your code:
http://www.henkessoft.de/OS_Dev/OS_Dev1 ... ocId146145
We add the '?' to 'help' and an instruction 'exit'. You can add this exit function to your RM barebone kernel, if you like:
Code: Select all
.exit:
mov si, msg_exit
call print_string
xor ax, ax
int 0x16 ; Wait for keystroke
jmp 0xffff:0x0000 ; Reboot
Your great subroutine 'strcmp' is simplified to:
Code: Select all
strcmp:
.loop_start:
mov al, [si] ; grab a byte from SI
cmp al, [di] ; are SI and DI equal?
jne .done ; no, we're done.
test al, al ; zero?
jz .done ; yes, we're done.
inc di ; increment DI
inc si ; increment SI
jmp .loop_start ; loop!
.done:
ret
People told me that I should not use an opcode like 'loop' as a label. Thus, we use loop_start. We use DI directly, test on zero (needs no clc & stc), and need only label .done. Hope you like it.
We use the recommended "xor ah, ah" instead of "mov ah, 0", because it saves room in memory (important for a bootloader or mini kernel which has to fit into 512 byte).
Re: Advice/Support requested at OS Development
Posted: Tue Mar 24, 2009 6:26 am
by Kevin
Looks like it will become a very nice tutorial for beginners.
I think you should have real beginners read it and comment on it. I understand perfectly what you're talking about, but I suspect that there are some points which are not immediately clear. For example, you explain the A20 only long after you reference it for the first time. And I think I completely missed an explanation what the GDT really is.
Have you considered mentioning qemu as an alternative to bochs or Virtual PC? The former is open but slow, the latter closed and not very helpful in debugging. qemu is open and provides both acceptable performance and debugging interfaces.
Oh, and... would you care to contribute parts of your tutorial to the respective articles in the Lowlevel wiki? It would be a nice complement to what exists today, and I think having a central place for OS-Dev in German is a good thing.
Re: Advice/Support requested at OS Development
Posted: Tue Mar 24, 2009 8:48 am
by Troy Martin
ehenkes wrote:We use DI directly, test on zero (needs no clc & stc), and need only label .done. Hope you like it.
I think you misunderstood what the strcmp call does. It sets the carry flag (stc, jc works for jumping) if the strings are equal and clears it (clc, jnc works for jumping) if the strings are not equal. You appear to have taken out the entire functionality of the kernel's shell.
We use the recommended "xor ah, ah" instead of "mov ah, 0", because it saves room in memory (important for a bootloader or mini kernel which has to fit into 512 byte).
No difference in size at all. I did a test using NASM and a scratchpad file I use for testing code and xor ah,ah == mov ah,0 in size. xor ax,ax however, I believe, is only one byte.
Fix a few bugs and your tutorial will be great!
--Troy
Re: Advice/Support requested at OS Development
Posted: Tue Mar 24, 2009 9:17 am
by Creature
ehenkes wrote:Why exactly aren't you doing this in English?
Good question. All my tutorials are in German. But English would be no big challenge for me.
The sources are in Assembler (NASM) so far, and the comments are in English.
Not that's it a real problem, I can mostly understand German (Belgian Multi-languaging, anyone?
). Still, English is IMHO the most native tutorial language
.
Re: Advice/Support requested at OS Development
Posted: Tue Mar 24, 2009 10:26 am
by Kevin
Well, so there are already enough tutorials in English, no?
Hm, Belgium... I've never seen a tutorial in Dutch or French - probably I wouldn't understand too much of the latter, but I might have chances with the former. I like languages, and that doesn't only include English.