Page 1 of 2

Tutorial 14: Programming the Kernel 1

Posted: Mon Jan 21, 2008 4:59 am
by Mike
Hey everyone,

Tutorial 14 should hopefully be up within the next week. It basically covers the basic design, developing some basic C++ library routines for us to use, and some HAL code for abstracting some processor information.

The upcoming demo separates the HAL, C++ library, and kernel, all independent projects. Each project outputs to static library files that are linked together. As they are independent of each other, We can more easily support dynamic libraries later if we like.

We will also cover good programming practices, and coding conventions used within the source.

If we have the space, we might also recreate the GDT for use by the Kernel through our HAL and processor interface.

Welcome to the Kernel and HAL! :)

Posted: Mon Jan 21, 2008 2:49 pm
by pathos
Can't wait!

Posted: Sat Jan 26, 2008 6:41 pm
by pathos
Any update on Tutorial 14?

Posted: Sat Jan 26, 2008 7:32 pm
by Mike
pathos wrote:Any update on Tutorial 14?
It is planned to be completed and up today or tomorrow.

Posted: Sat Jan 26, 2008 11:08 pm
by pathos
Mike wrote:
pathos wrote:Any update on Tutorial 14?
It is planned to be completed and up today or tomorrow.
Thank you!

Posted: Sun Jan 27, 2008 6:52 am
by Mike
We wont be able to upload anything until the server problem is resolved. Please see <a href="http://www.brokenthorn.com/forums/viewt ... t=56">this post</a> for more information.

We are working with our server host in resolving the problem, and will upload tutorial 14 as soon as possible.

Until then, we will also start working on Tutorial 15. Perhaps we can get two tutorials up during this time frame... Hopefully it is not that long though.

Posted: Sun Jan 27, 2008 4:58 pm
by Mike
If we are still experiencing problems today with uploading to this web site, then we will upload the tutorial to our previous web site location, and link to it from here.

This way the tutorial will be uploaded whether we are or are not experiencing problems.

Posted: Sun Jan 27, 2008 8:44 pm
by Mike
Tutorial 14 should be up either later today or tomorrow, along with the new demo source.

Posted: Mon Jan 28, 2008 12:30 am
by Andyhhp
Thats good - I cant wait :D

Posted: Mon Jan 28, 2008 3:57 am
by Mike
We have just resolved the server problem. We will now be able to upload the new tutorial to this web site.

After final reviews, we will upload it. It is planned to be on tomorrow.

Posted: Wed Jan 30, 2008 6:42 am
by Mike
Tutorial 15 just been started...its going to be fun :)

inportb

Posted: Wed Feb 06, 2008 4:29 pm
by pathos
I have a quick question regarding the inportb function that was introduced in the last tutorial code. Everytime I use it, I get a value of 255 returned. Is there something I'm doing wrong?

Posted: Thu Feb 07, 2008 8:44 am
by Andyhhp
Can you give a code fragment of where you are using it?

Thanks

Posted: Thu Feb 07, 2008 3:04 pm
by pathos
Andyhhp wrote:Can you give a code fragment of where you are using it?

Thanks
I was just using it trying to read from 0x60 for the scancode for my keyboard driver. When I noticed I was getting 255, I started testing random other ports and always got 255.

This is the keyboard handler I'm using, which is basically the one from Bran's tutorial.

Code: Select all

void keyboard_handler()
{
    unsigned char scancode=0x00;

    scancode = inportb(0x60);

    DebugPrintf ("Key press:  %i\n",scancode);  // Always displays 255, no matter what port I read above

    if (scancode & 0x80)
    {

    }
    else
    {
        DebugPutc(kbdus[scancode]);
    }
}
In case the question comes up, all my IRQs work. I noticed the issue first when I saw my keyboard handler would display the "Key pressed" message, but not a character.

[edit #1]
I just inportb'd to a signed char instead of an unsigned, and it returned -1. That may help in figuring things out.

Posted: Thu Feb 07, 2008 9:16 pm
by Mike
I just inportb'd to a signed char instead of an unsigned, and it returned -1. That may help in figuring things out.
Not quite. 0xff unsignes = -1 signed. It should be kept unsigned.

I will see if I can resolve the problem a little later when I get home :)