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.
Hi, i've a question (perhaps no only one). How do i can write a driver for my keyboard? I've heard about the PCI and the IRQ but i haven't understand how do i use them...
P.S As you may have noticed, i'm not english and i cant tell it well...
If I will write some mistakes please forgive me
Keyboard_map_us is an array of unsigned char, US key map is here, for making italian map you'll need to search for it or write yourself the table manually http://www.osdever.net/bkerndev/Sources/kb.c
Cheers,
Gonzalo
ps. you'll need pci for loading list of devices in pci bus, not for this.
well then, you should be able to convert that code,no?
"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 ]
irq1:
cli
pusha ; Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax
mov ax, ds ; Lower 16-bits of eax = ds.
push eax ; save the data segment descriptor
mov ax, 0x10 ; load the kernel data segment descriptor
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
outb 0x20, 0x20 ;send signal to pic
inb 0x60, ax ;read code to ax (?)
;do what you want here with ax
pop ebx ; reload the original data segment descriptor
mov ds, bx
mov es, bx
mov fs, bx
mov gs, bx
popa ; Pops edi,esi,ebp...
sti
iret ; pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP
I don't think that works but I hope you understand the idea.
I assume you have Idt, isrs and irq correctly loaded.
I must write something to use this code? I mean, i don't have understand if i must set the irq lines or no
P.S
Excuse my ignorance, but it's difficult to find italian books about assembly, so I must search them in english web-sites, and i don't always understand all...
Last edited by Karlosoft on Thu Feb 14, 2008 11:52 am, edited 1 time in total.
read the scancode from the keyboard port, then run the scancode value through an array of keyboard characters (unique to each region).
then you can print the returned array value to the screen.
And all is ok, but the problem ist that an italian tutorial about "How to write a simle OS" sayd that I musst set the irq lines, the pci with many commands. Now i don't understand what do...
"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 ]
take a look at the file I posted here
it's in Fasm, and has protected mode, idt & keybord hadndler for ps2 kbd.
Could be good as a template or starting point. Has config file for bochs.