Simple Kernel

If you are new to OS Development, plan on spending some time here first before going into the other forums.

Moderator: Moderators

Post Reply
fadi_jor
Posts: 11
Joined: Sat Nov 15, 2008 5:33 pm

Simple Kernel

Post by fadi_jor » Sat Nov 15, 2008 6:06 pm

hey; I want to write simple Kernel that just read input from user and then print a response to that input...

plz; help me as quickly as possible.

and if possible give me a full demo!


regards.....

Andyhhp
Moderator
Posts: 387
Joined: Tue Oct 23, 2007 10:05 am
Location: 127.0.0.1
Contact:

Post by Andyhhp » Sun Nov 16, 2008 6:19 am

Keyboard access is going to be covered in the next tutorial so I suggest waiting for that.

There is no 'quick' way to learn to write a kernel. Rushing it prevents you from learning exactly what is going on - something that is critical knowledge at kernel level programming.

To further this, giving a demo (which I dont have) would be useless because as soon as you want to change it, you would have to ask for another demo.

The demo from the next tutorial will have the keyboard enabled so I am sure that you will be able to alter that to suit your needs.

However, my suggestion is to follow the series at a steady pace and learn how to program a kernel. That will leave you in the best sted to alter other kernels to do what you want.

~Andrew
Image

venk
Posts: 14
Joined: Thu Oct 16, 2008 6:49 am
Contact:

Assembly Keyboard routine

Post by venk » Tue Nov 18, 2008 11:40 am

Hey, I am writing a kernel in asm completely. And I just wrote the keyboard routine yesterday, here it is:
Note: The acsii table (scan) is not complete, please coomplete it for all keys, it has all letters, nos. and enter etc.

keyPress:
WaitLoop: in al, 64h ;Check if input is ready
and al, 1
jz WaitLoop ; If no then go into a loop
in al, 60h ;Input is ready, get char into al
mov bl,al
call ScanToAscii ; convert from scancode to ascii
call Putch32 ;Print char
jmp keyPress ; again wait for keypress
Stop:
cli
hlt

scan db 27,"1234567890-=",0,200,9,"qwertyuiop[]",10,0,"asdfghjkl;'",39,0,'\',0,"xcvbnm,./",0,'*',0,' ',0
ScanToAscii:
mov ebp, scan
mov bl, byte[ebp + ebx]
ret
Help Me!!
SOS!!

Andyhhp
Moderator
Posts: 387
Joined: Tue Oct 23, 2007 10:05 am
Location: 127.0.0.1
Contact:

Post by Andyhhp » Tue Nov 18, 2008 5:06 pm

Sadly, writing a keyboard handler is not this easy.
<ul><li>Each different make of keyboard will potentially have a different key mapping</li><li>Some keys will return 2 or even 3 bytes so you have to account for that</li><li>Not every key on a keyboard has an ASCII equivalent - i don't see an ASCII code for 'Print Screen'</li></ul>On top of that, the method you are currently using is known as polling. It is nessesary to enable the A20 line but should be avoided and replaced with an interrupt driven alternative if you intend to do any form on multi-processing.

My suggestion is that you plan exactly what you want your kernel to do before you try implementing things such as this.

~Andrew
Image

venk
Posts: 14
Joined: Thu Oct 16, 2008 6:49 am
Contact:

Post by venk » Fri Dec 12, 2008 10:13 am

I know it is not easy, but without some way of inputting stuff, the OS is terribly boring. Anyway my handler is working perfectly fine (after a few changes), so I am happy with it
Help Me!!
SOS!!

Andyhhp
Moderator
Posts: 387
Joined: Tue Oct 23, 2007 10:05 am
Location: 127.0.0.1
Contact:

Post by Andyhhp » Fri Dec 12, 2008 11:25 am

I am glad to hear it is working.

As for the OS itself, I completely agree that it is boring before any input but that doesn't prevent it from being critically important to do the basics first.

~Andrew
Image

roboman
Posts: 12
Joined: Fri Nov 28, 2008 10:02 pm
Location: usa
Contact:

Post by roboman » Fri Dec 12, 2008 5:06 pm

http://www.emu8086.com/dr/asm2html/asse ... cro-os.zip

does basicly what the first person requested.

Andyhhp:
>My suggestion is that you plan exactly what you want your kernel to do

Was wondering what your design goals are and what specs you were shooting for with your OS. I looked around a little and didn't see that.

""""""""""""NOTE FROM ADMIN""""""""""""
roboman wrote:http://www.emu8086.com/dr/asm2html/assembler_source_code/zip/emu8086_tutorial_make_your_own_micro-os.zip


Note : Please scan file before opening on your computer for precautions. All files listed in forums and downloaded from this site are at your own risk. BrokenThorn will not take any responsibility for the files listed and downloaded by the community. Please notify us if theres a problem with the file so we can take the appropriate steps to remove it from the site and notify poster to fix the file before it is posted.

This is not ment to be a threat or to discourge people from being helpful, but to be a warning that it will not be tolerated here.

Thanks for posting please enjoy your stay on the forums we look foward to seeing you more.

Admin - Andrew

venk
Posts: 14
Joined: Thu Oct 16, 2008 6:49 am
Contact:

Kernel plan

Post by venk » Mon Dec 15, 2008 1:13 pm

I have planned what I want my kernel to do. I want it to provide a high level and fast programming environment in assembly(by the way of interrupts). The interface would be command-line.
What I wish to do is to control real-time systems efficiently
Help Me!!
SOS!!

Post Reply