Page 1 of 1

Help on the development of a kernel

Posted: Sun Dec 06, 2015 7:50 am
by alex00
Hi guys

It's just a little time that I'm working on my Operating System(I would like to make my "own" DOS), I've already done a simple Bootloader but now I'm stuck with the developing of the kernel. I know what a kernel does and I know some basically things like the programming of the int21h or other basic operation (I forgot to say that I would like to do a 16-bit DOS to avoid problems with the drivers for the VGA, devices...) and at the moment I've programmed 4-5 functions of the int21h like the output and input of chars and strings. Now I want to work on the devices and then on the FAT, directories, files etc. etc. Where should I start? I saw a thing named Drive Parameter Block thanks to I should know some informations about the devices on my computer. This DPB is important for the 32h function of the int21h that I should write, is this function really important? Must I write this function to read a floppy or a cd? Or is it better to program the other functions and overcome this one?

Thanks everybody :D

Re: Help on the development of a kernel

Posted: Sun Dec 06, 2015 8:32 am
by Octocontrabass
Do any of the programs you want to run use that function?

If not, you don't need to implement it.

Re: Help on the development of a kernel

Posted: Sun Dec 06, 2015 9:34 am
by alex00
I don't know because I'm planning to implement all the most common programs that other DOS have(MS-DOS, FreeDOS...). For example to read from an external device do I need that function? If it's important how can I program it?(I'm talking about the ah=32h funct of the int21h) Because if it's not important it would be fantastic!

Re: Help on the development of a kernel

Posted: Sun Dec 06, 2015 11:29 am
by Octocontrabass
You must implement all functions used by a program in order to run that program.

If you write the program, you get to decide which functions it uses.
alex00 wrote:For example to read from an external device do I need that function?
If you want to read from a USB device, you will need to stop using the BIOS, so you should probably consider that before you continue working on your kernel.

Re: Help on the development of a kernel

Posted: Mon Dec 07, 2015 1:28 pm
by alex00
Mhh...anyway at the moment I'm programming this function because I've read that when I will use an external device like a USB pen I can use some parameters from this table instead of getting them every time. Also because I want my kernel to load .com programs and generaly programs written in C/C++ so this interrupts are basically I think. Aren't them?

Re: Help on the development of a kernel

Posted: Mon Dec 07, 2015 1:37 pm
by osdever
alex00 wrote:Hi guys

It's just a little time that I'm working on my Operating System(I would like to make my "own" DOS), I've already done a simple Bootloader but now I'm stuck with the developing of the kernel. I know what a kernel does and I know some basically things like the programming of the int21h or other basic operation (I forgot to say that I would like to do a 16-bit DOS to avoid problems with the drivers for the VGA, devices...) and at the moment I've programmed 4-5 functions of the int21h like the output and input of chars and strings. Now I want to work on the devices and then on the FAT, directories, files etc. etc. Where should I start? I saw a thing named Drive Parameter Block thanks to I should know some informations about the devices on my computer. This DPB is important for the 32h function of the int21h that I should write, is this function really important? Must I write this function to read a floppy or a cd? Or is it better to program the other functions and overcome this one?

Thanks everybody :D
Are you registered in any IM services? Facebook etc. If yes, write to the private messages.
And, for your OS:
1) RM is obsolete.
2) Use GRUB2, do not do the dirty work, it'll do it for you.
3) Implement the VM8086 (I can help) and use it. Why? See №1.
4) Do not, just do not use BIOS interrupts for screen and KBD I/O. It's slow.
5) About 32h function - I don't know.

Re: Help on the development of a kernel

Posted: Mon Dec 07, 2015 3:51 pm
by alex00
catnikita255 wrote: Are you registered in any IM services? Facebook etc. If yes, write to the private messages.
And, for your OS:
1) RM is obsolete.
2) Use GRUB2, do not do the dirty work, it'll do it for you.
3) Implement the VM8086 (I can help) and use it. Why? See №1.
4) Do not, just do not use BIOS interrupts for screen and KBD I/O. It's slow.
5) About 32h function - I don't know.
About the bootloader I've already done all the dirty work so it's done
About the RM and the VM8086, can I use interrupts in VM8086? I want to do a simple DOS in real mode and interrupts are just to make my work less hard. And my goal is to make a DOS which supports MS-DOS programs so I have to run it in real mode (I think).

Re: Help on the development of a kernel

Posted: Tue Dec 08, 2015 7:55 am
by osdever
alex00 wrote:
catnikita255 wrote: Are you registered in any IM services? Facebook etc. If yes, write to the private messages.
And, for your OS:
1) RM is obsolete.
2) Use GRUB2, do not do the dirty work, it'll do it for you.
3) Implement the VM8086 (I can help) and use it. Why? See №1.
4) Do not, just do not use BIOS interrupts for screen and KBD I/O. It's slow.
5) About 32h function - I don't know.
About the bootloader I've already done all the dirty work so it's done
About the RM and the VM8086, can I use interrupts in VM8086? I want to do a simple DOS in real mode and interrupts are just to make my work less hard. And my goal is to make a DOS which supports MS-DOS programs so I have to run it in real mode (I think).
OK. And I'll repeat: Are you registered in any IM services?

Re: Help on the development of a kernel

Posted: Tue Dec 08, 2015 10:55 am
by onlyonemac
catnikita255 wrote:And, for your OS:
1) RM is obsolete.
2) Use GRUB2, do not do the dirty work, it'll do it for you.
3) Implement the VM8086 (I can help) and use it. Why? See №1.
4) Do not, just do not use BIOS interrupts for screen and KBD I/O. It's slow.
5) About 32h function - I don't know.
As he is trying to make a DOS clone, it doesn't seem too unreasonable to use real mode. That'll be much simpler than trying to run everything in V86 mode, unless he's wanting to "improve" on DOS such as by implementing multitasking or whatever.

Re: Help on the development of a kernel

Posted: Wed Dec 09, 2015 1:27 am
by alex00
onlyonemac wrote:As he is trying to make a DOS clone, it doesn't seem too unreasonable to use real mode. That'll be much simpler than trying to run everything in V86 mode, unless he's wanting to "improve" on DOS such as by implementing multitasking or whatever.
Yes, at the moment I'm trying to make a sort of DOS clone (but with some personal feature obviusly). I'll try things like multitasking when I will do a 32 bit OS, but first I want to finish the 16 bit one so I can use part of that code for the 32 bit OS (putting the drivers instead of the interrupts).

Re: Help on the development of a kernel

Posted: Wed Dec 09, 2015 1:42 am
by iansjack
Just a personal opinion, but if you are planning a Protected Mode OS I think that almost everything that you now do in Real Mode will be a waste of time. And you will end up having to unlearn a lot that you learn now. Unless you are going to rely on BIOS interrupts to do all the interesting bits for you, Real Mode programming is harder than Protected Mode.

A DOS clone is of no interest to me, so I can't comment further on your current problems.

Re: Help on the development of a kernel

Posted: Wed Dec 09, 2015 2:56 am
by Brendan
Hi,
iansjack wrote:Just a personal opinion, but if you are planning a Protected Mode OS I think that almost everything that you now do in Real Mode will be a waste of time. And you will end up having to unlearn a lot that you learn now. Unless you are going to rely on BIOS interrupts to do all the interesting bits for you, Real Mode programming is harder than Protected Mode.
In my opinion; it'd make far more sense to use long mode - e.g. identity map the physical address space, and provide an API that 64-bit applications can use to read/write files, allocate/free memory, get/set the time, do (unicode) console text output, set graphics video modes, etc.

The beautiful part of this idea is that the entire "OS" can be implemented in less than 30 seconds (assuming modern hardware). All you need to do is create a text file with a single sentence: This "OS" requires UEFI. :roll:


Cheers,

Brendan

Re: Help on the development of a kernel

Posted: Wed Dec 09, 2015 4:39 am
by iansjack
The one objection I would have to going straight to Long Mode is that it requires paging, which is an additional complication for a novice. Most lessons learnt in Protected Mode are applicable to Long Mode, so it is a useful intermediary. Targeting very modern hardware only seems a little overrestrictive.

Re: Help on the development of a kernel

Posted: Wed Dec 09, 2015 3:33 pm
by alex00
iansjack wrote:Just a personal opinion, but if you are planning a Protected Mode OS I think that almost everything that you now do in Real Mode will be a waste of time. And you will end up having to unlearn a lot that you learn now. Unless you are going to rely on BIOS interrupts to do all the interesting bits for you, Real Mode programming is harder than Protected Mode.

A DOS clone is of no interest to me, so I can't comment further on your current problems.
My project consists in making a DOS which supports MS-DOS executable and I will start to build a version which uses BIOS interrupts and then I will write my own drivers. Then I will modify these drivers and implement them in the 32 bit OS (drivers are the same in Real Mode and Protected Mode). I think that it's a good way to learn all the steps and to do everything starting from the bottom.

Re: Help on the development of a kernel

Posted: Wed Dec 09, 2015 4:15 pm
by iansjack
drivers are the same in Real Mode and Protected Mode
That's not quite true, but I wouldn't want to discourage you from your chosen path.