Tutorial 14: Programming the Kernel 1

Announcements, Test requests, Job openings, Updates, or just make your web site known to everyone!

Moderator:Moderators

User avatar
Mike
Site Admin
Posts:465
Joined:Sat Oct 20, 2007 7:58 pm
Contact:
Tutorial 14: Programming the Kernel 1

Post by Mike » Mon Jan 21, 2008 4:59 am

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! :)
Lead Programmer for BrokenThorn Entertainment, Co.
Website: http://www.brokenthorn.com
Email: webmaster@brokenthorn.com

pathos
Moderator
Posts:97
Joined:Thu Jan 10, 2008 6:43 pm
Location:USA

Post by pathos » Mon Jan 21, 2008 2:49 pm

Can't wait!

pathos
Moderator
Posts:97
Joined:Thu Jan 10, 2008 6:43 pm
Location:USA

Post by pathos » Sat Jan 26, 2008 6:41 pm

Any update on Tutorial 14?

User avatar
Mike
Site Admin
Posts:465
Joined:Sat Oct 20, 2007 7:58 pm
Contact:

Post by Mike » Sat Jan 26, 2008 7:32 pm

pathos wrote:Any update on Tutorial 14?
It is planned to be completed and up today or tomorrow.
Lead Programmer for BrokenThorn Entertainment, Co.
Website: http://www.brokenthorn.com
Email: webmaster@brokenthorn.com

pathos
Moderator
Posts:97
Joined:Thu Jan 10, 2008 6:43 pm
Location:USA

Post by pathos » Sat Jan 26, 2008 11:08 pm

Mike wrote:
pathos wrote:Any update on Tutorial 14?
It is planned to be completed and up today or tomorrow.
Thank you!

User avatar
Mike
Site Admin
Posts:465
Joined:Sat Oct 20, 2007 7:58 pm
Contact:

Post by Mike » Sun Jan 27, 2008 6:52 am

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.
Lead Programmer for BrokenThorn Entertainment, Co.
Website: http://www.brokenthorn.com
Email: webmaster@brokenthorn.com

User avatar
Mike
Site Admin
Posts:465
Joined:Sat Oct 20, 2007 7:58 pm
Contact:

Post by Mike » Sun Jan 27, 2008 4:58 pm

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.
Lead Programmer for BrokenThorn Entertainment, Co.
Website: http://www.brokenthorn.com
Email: webmaster@brokenthorn.com

User avatar
Mike
Site Admin
Posts:465
Joined:Sat Oct 20, 2007 7:58 pm
Contact:

Post by Mike » Sun Jan 27, 2008 8:44 pm

Tutorial 14 should be up either later today or tomorrow, along with the new demo source.
Lead Programmer for BrokenThorn Entertainment, Co.
Website: http://www.brokenthorn.com
Email: webmaster@brokenthorn.com

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

Post by Andyhhp » Mon Jan 28, 2008 12:30 am

Thats good - I cant wait :D
Image

User avatar
Mike
Site Admin
Posts:465
Joined:Sat Oct 20, 2007 7:58 pm
Contact:

Post by Mike » Mon Jan 28, 2008 3:57 am

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.
Lead Programmer for BrokenThorn Entertainment, Co.
Website: http://www.brokenthorn.com
Email: webmaster@brokenthorn.com

User avatar
Mike
Site Admin
Posts:465
Joined:Sat Oct 20, 2007 7:58 pm
Contact:

Post by Mike » Wed Jan 30, 2008 6:42 am

Tutorial 15 just been started...its going to be fun :)
Lead Programmer for BrokenThorn Entertainment, Co.
Website: http://www.brokenthorn.com
Email: webmaster@brokenthorn.com

pathos
Moderator
Posts:97
Joined:Thu Jan 10, 2008 6:43 pm
Location:USA

inportb

Post by pathos » Wed Feb 06, 2008 4:29 pm

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?

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

Post by Andyhhp » Thu Feb 07, 2008 8:44 am

Can you give a code fragment of where you are using it?

Thanks
Image

pathos
Moderator
Posts:97
Joined:Thu Jan 10, 2008 6:43 pm
Location:USA

Post by pathos » Thu Feb 07, 2008 3:04 pm

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.

User avatar
Mike
Site Admin
Posts:465
Joined:Sat Oct 20, 2007 7:58 pm
Contact:

Post by Mike » Thu Feb 07, 2008 9:16 pm

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 :)
Lead Programmer for BrokenThorn Entertainment, Co.
Website: http://www.brokenthorn.com
Email: webmaster@brokenthorn.com

Post Reply