The problem is, that when i hit a key, nothing happens.
When i call the interrupt via 'int 0x21' it is called properly, so the problem must be something about the PIC or the Keyboard itsself.
Here are the important Parts of my code:
Code: Select all
void kmain(void)
{
InitPIC(0x20,0x28);//IRQ0=Int20h, IRQ8=Int28h
enable_irq(1);
for (;;);
};
Code: Select all
void irqstd()
{
kprint("Hardware-Interrupt!",RED);
for(;;);
};
Code: Select all
#define PIC1 0x20
#define PIC2 0xA0
#define ICW1 0x11
#define ICW4 0x01
void InitPIC(int pic1, int pic2)
{
//ICW1
outportb(PIC1,ICW1);
outportb(PIC2,ICW1);
//ICW2--> Remap
outportb(PIC1+1,pic1);
outportb(PIC2+1,pic2);
//ICW3
outportb(PIC1+1,4);
outportb(PIC2+1,2);
//ICW4
outportb(PIC1+1,ICW4);
outportb(PIC2+1,ICW4);
//Disable all irqs
outportb(PIC1+1,0xFF);
};
unsigned int irq_mask = 0xFFFF;
//enable IRQ
void enable_irq(unsigned short irq_no)
{
irq_mask &= ~(1 << irq_no);
if(irq_no >= 8)
irq_mask &= ~(1 << 2);
outportb(PIC1+1, irq_mask & 0xFF);
outportb(PIC2+1, (irq_mask >> 8) & 0xFF);
}
Code: Select all
inline void outportb(unsigned int port,unsigned char value)
{
asm volatile ("outb %%al,%%dx"::"d" (port), "a" (value));
}