I'm new to Operating System development, and have a very basic understanding of C and a ting bit of ASM. I know that int21h is very important in DOS, but how would I implement it into an Operating System? Thanks in advance.
(P.S. I would be grateful of someone would shed light on driver support)
int21h and OS (plus other things)
- carbonBased
- Member
- Posts: 382
- Joined: Sat Nov 20, 2004 12:00 am
- Location: Wellesley, Ontario, Canada
- Contact:
Unless you were re-implementing DOS, you wouldn't. You would be implementing your own service interrupts, call gates, or whatever mechanism you chose in order to call into the OS.
As far as drivers go, this is a pretty open ended question. Drivers can be parts of the kernel that expose APIs, they can be simple applications that serve up a set of services, they can be loadable modules that link into your kernel at run time, or even applications themselves...
Some of the above approaches make more sense then others, but I'd rather you take a look at your architecture, and think about how you can create a system whereby hardware drivers can be dynamically added, and nicely abstract the hardware (if, indeed, this is something you want).
I'm not trying to be mean, but suggesting that (imo!) a lot of the existing driver systems in place today are all lacking in one way or another. A fresh mind may come up with a great new way of doing things... and THEN... when you think you have something, it might be worth running it past one of the "not so fresh" osdever's on this list to see if there are any holes in the approach.
Cheers,
--Jeff
As far as drivers go, this is a pretty open ended question. Drivers can be parts of the kernel that expose APIs, they can be simple applications that serve up a set of services, they can be loadable modules that link into your kernel at run time, or even applications themselves...
Some of the above approaches make more sense then others, but I'd rather you take a look at your architecture, and think about how you can create a system whereby hardware drivers can be dynamically added, and nicely abstract the hardware (if, indeed, this is something you want).
I'm not trying to be mean, but suggesting that (imo!) a lot of the existing driver systems in place today are all lacking in one way or another. A fresh mind may come up with a great new way of doing things... and THEN... when you think you have something, it might be worth running it past one of the "not so fresh" osdever's on this list to see if there are any holes in the approach.
Cheers,
--Jeff
Thanks carbonBased, and yes I was thinking about reimplementing DOS. I was thinking about adding support for DOS drivers, and adding extra bits after that to have more efficient replacements. I'm going to read some more documentation now, and read on implementing all these DOS ints and things.
Thanks anyway, you've opened my eyes quite a bit! And I'm thinking a litle more 'open' now, so maybe restricting it to JUST DOS is quite limiting? I wanted to have a DOS clone(ish) but have new additions.
But still, you've been a real help anyway to what I should be doing!
Thanks!
Thanks anyway, you've opened my eyes quite a bit! And I'm thinking a litle more 'open' now, so maybe restricting it to JUST DOS is quite limiting? I wanted to have a DOS clone(ish) but have new additions.
But still, you've been a real help anyway to what I should be doing!
Thanks!
- carbonBased
- Member
- Posts: 382
- Joined: Sat Nov 20, 2004 12:00 am
- Location: Wellesley, Ontario, Canada
- Contact:
Would you also be running in real mode? If so, implementing an interrupt is really just a matter of inserting a segment:offset pair into the IDT -- a table of 256 entries at 0x0, by default.gamezguy wrote:Thanks carbonBased, and yes I was thinking about reimplementing DOS. I was thinking about adding support for DOS drivers, and adding extra bits after that to have more efficient replacements. I'm going to read some more documentation now, and read on implementing all these DOS ints and things.
I just didn't expect that you would be building a DOS clone I would suggest you take a look at FreeDOS, as it may be able to give you some pointers.gamezguy wrote: Thanks anyway, you've opened my eyes quite a bit! And I'm thinking a litle more 'open' now, so maybe restricting it to JUST DOS is quite limiting? I wanted to have a DOS clone(ish) but have new additions.
As I now know you intentions, the following might be more relevant:
Drivers in DOS weren't very standardized... a lot of them effectively consisted of a hooked interrupt via a TSR with published/known API. If you continued on the DOS route, it might make sense to create a common driver system that people could use.
--Jeff
Maybe you should look at MiniDos, does what you want in less than 2k.
http://www.osdev.org/phpBB2/viewtopic.php?t=2852
http://www.osdev.org/phpBB2/viewtopic.php?t=2852
If you want to implement a DOS like functions into your OS, then you will need to create an ISR that will be on INT 21. Then, use HelpPC and study the functions in real DOS, for example:
INT 21h, function 9 (AH=9) will put on screen an ASCIIZ text. So you will need to make this function in BIOS.
Reading/writing filesystems is a very hard work I cant understand it, but Dex sure can
inflater
INT 21h, function 9 (AH=9) will put on screen an ASCIIZ text. So you will need to make this function in BIOS.
Reading/writing filesystems is a very hard work I cant understand it, but Dex sure can
inflater