Here is the code for the timer initialization and interrupt routine
Code: Select all
#define PIC1 0x20
#define TIMER_CONTROL 0x43
#define TIMER_DATA 0x40
#define TIMER_INIT 0x36
volatile unsigned int cont_pulsos = 0;
void timer_install(unsigned int frec) {
unsigned int divisor = 1193180/frec;
outb(TIMER_CONTROL,TIMER_INIT);
outb(TIMER_DATA,divisor & 0xFF);
outb(TIMER_DATA,(divisor>>8));
//unmask IRQ0, is this necessary? I haven't modified this register before
outb(PIC1+1,(inb(PIC1+1)&0xFE));
}
void int_timer() {
cont_pulsos++;
printHex(cont_pulsos);
//send EOI
outb(0x20,0x20);
}
Code: Select all
void init() {
idt_install();
PIC_remap();
timer_install(100);
sti();
char wheel[] = {'\\','|','/','-'};
int i = 0;
for (;;) {
__asm__ ("movb %%al, 0xb8000+160*20"::"a"(wheel[i]));
if (i == sizeof wheel)
i = 0;
else
++i;
}
}
As I said before, maybe the counter it's not incrementing
Hope you can help me