Prerequisites for keyboard input.

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Nick Carlson
Posts: 18
Joined: Fri Feb 29, 2008 6:08 pm

Prerequisites for keyboard input.

Post by Nick Carlson »

Hi again,

I've been trying to read as much beginner material as possible, but I'm still not sure about the following: What are the prerequisites to getting user keyboard input (assuming I'm in Pmode) ?

Do I need to have the following implemented?
  • ISR
  • IDT
  • GDT
Am I leaving anything out? At the moment, I have only 3 source file. Kernel.c, system.h, and loader.asm. The code can be viewed here: http://jottit.com/cqkbg/

Thanks for the help.
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Re: Prerequisites for keyboard input.

Post by piranha »

Bran's tutorial will tell you: http://www.osdever.net/bkerndev/index.php

-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
User avatar
octa
Member
Member
Posts: 50
Joined: Sat Jun 28, 2008 9:15 am

Re: Prerequisites for keyboard input.

Post by octa »

u have a lot of things to do before settin up keyboard..

read Bran's Tutorial or James Tutorial
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Re: Prerequisites for keyboard input.

Post by bewing »

You need a functional GDT in order to enter pmode at all.
Once you are in pmode, for a simple test you can just poll bit 0 (value = 1) of IO port 0x64 (read bytes from the port). Whenever the value is 1, you can read one scancode byte from port 0x60 -- but you will need to have the PIC shut off for this to work.
To do anything even slightly more complex, yes, you will need ISRs for all IRQs that are active on the PIC, and a 32bit functional IDT.
User avatar
Nick Carlson
Posts: 18
Joined: Fri Feb 29, 2008 6:08 pm

Re: Prerequisites for keyboard input.

Post by Nick Carlson »

Thank you for your help.
eax
Member
Member
Posts: 57
Joined: Mon Jun 23, 2008 6:45 am

Re: Prerequisites for keyboard input.

Post by eax »

Hi I just have been going through alot of keyboard stuff, Im new myself but brans tutorial is good because it gets things setup that are absolutly needed and after you have been through it ; it helps you understand what other stuff you need to read. I really took my time on brans tutorial and referanced stuff I didnt understand with other guides.

I also thanks to bewing and the keyboard docs managed to learn much about the keyboard I didnt know and finally managed to get some test code working yesterday thanks to everything Ive mentioned. (Its been frustrating at times but all the help as been invaluable!)

After you have got your GDT and IDT up and running thanks to brans applied style tutorial make sure to read about all the flags and try to see if you can visualise whats happening with certain parts of the code, this is why Ive taken so long with brans guide because I figured I need to be sure as I can be in theory whats going on in every baby step along the way. (I still am not looking forward to a memory manager lol)

Btw the brokenthorn series are an absolutely awesome series of tutorials , I did those last time around but I think they have been updated severly since I was last here, and theres a great theory article on the PIC(Programmable Interrupt Controller) when you get to the point of doing code for that.

Good luck!
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Prerequisites for keyboard input.

Post by Combuster »

You only really need to be able to do port I/O to access the keyboard. The rest is just additional goodies that make life easier. You can just poll it rather than waiting for interrupts.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply