Advice/Support requested at OS Development

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.
User avatar
ehenkes
Member
Member
Posts: 124
Joined: Mon Mar 23, 2009 3:15 am
Location: Germany
Contact:

Advice/Support requested at OS Development

Post 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.
Last edited by ehenkes on Mon Mar 23, 2009 7:58 am, edited 1 time in total.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Advice/Support requested at OS Development

Post 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?
Every good solution is obvious once you've found it.
User avatar
ehenkes
Member
Member
Posts: 124
Joined: Mon Mar 23, 2009 3:15 am
Location: Germany
Contact:

Re: Advice/Support requested at OS Development

Post 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?
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Advice/Support requested at OS Development

Post by Solar »

Can't read ASM much, sorry. It's all hieroglyphs for me. ;-)
Every good solution is obvious once you've found it.
User avatar
Creature
Member
Member
Posts: 548
Joined: Sat Dec 27, 2008 2:34 pm
Location: Belgium

Re: Advice/Support requested at OS Development

Post by Creature »

Like Solar said, the images and all look great. One question though: Why exactly aren't you doing this in English? :P
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Advice/Support requested at OS Development

Post 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? 8)

The best HTML / webdesign source around isn't available in English, either. :twisted:

We keep the best things for ourselves. 8)
Every good solution is obvious once you've found it.
User avatar
ehenkes
Member
Member
Posts: 124
Joined: Mon Mar 23, 2009 3:15 am
Location: Germany
Contact:

Re: Advice/Support requested at OS Development

Post 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. :)
Hyperdrive
Member
Member
Posts: 93
Joined: Mon Nov 24, 2008 9:13 am

Re: Advice/Support requested at OS Development

Post by Hyperdrive »

ehenkes wrote:I would be glad to get feedback to my source code.
http://www.henkessoft.de/OS_Dev/OS_Dev1 ... TocId80121 (bootloader, gdt, kernel, makefile)
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
User avatar
ehenkes
Member
Member
Posts: 124
Joined: Mon Mar 23, 2009 3:15 am
Location: Germany
Contact:

Re: Advice/Support requested at OS Development

Post by ehenkes »

Thanks. Yes, you are right. I have to explain this "wrap around" of SP. :D
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: Advice/Support requested at OS Development

Post 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!
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
User avatar
ehenkes
Member
Member
Posts: 124
Joined: Mon Mar 23, 2009 3:15 am
Location: Germany
Contact:

Re: Advice/Support requested at OS Development

Post 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).
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: Advice/Support requested at OS Development

Post 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.
Developer of tyndur - community OS of Lowlevel (German)
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: Advice/Support requested at OS Development

Post 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
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
User avatar
Creature
Member
Member
Posts: 548
Joined: Sat Dec 27, 2008 2:34 pm
Location: Belgium

Re: Advice/Support requested at OS Development

Post 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? :P). Still, English is IMHO the most native tutorial language :P.
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: Advice/Support requested at OS Development

Post 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. :)
Developer of tyndur - community OS of Lowlevel (German)
Post Reply