Page 1 of 1

ISRs Don't working properly in VirtualBox

Posted: Mon Dec 06, 2010 1:19 pm
by Partial
Hi! everyone... :)

I'm trying to make a simple game like "Multiboot Invaders"

I want to make Delays using the PIT. I'm using the IRQ0 for this.

Code: Select all

uint64 ticks = 0;

void irq_timer(registers_t regs) {
	++ticks;
}
The next implementation of delay function Don't work...

Code: Select all

void delay(uint64 total_ticks) {
	uint64 limit = ticks + total_ticks;
	while(ticks <= limit);
}
example:
- if i write the next code...

Code: Select all

int main() {
        // ... all initializing code timer, keyboard, irqs handlers and more goes here...

        frequency_timer(100);
        puts("Before Delay");
        delay(50);
        puts("After Delay");
}
the last call puts("After delay"); never execute...

but if i add the modification to Delay Function, It Works properly

Code: Select all

void delay(uint64 total_ticks) {
	uint64 limit = ticks + total_ticks;
	while(ticks <= limit) {
                outb(0x0, 0x0); // Or any Port and data
        }
}
Similar occurrs with the keyborad irq handler...
at the end of the handler function i've to add

Code: Select all

while(inb(0x64) & 2);
I know that these line waits to the keyborad controller process all data...

but in tutorials that i've seen these lines that i add are not necesary.

Anyone know whats happening.
Thanks!!.
I Speak Spanish, not English 8)

Re: IRSs Don't working properly in VirtualBox

Posted: Mon Dec 06, 2010 1:26 pm
by Combuster

Re: IRSs Don't working properly in VirtualBox

Posted: Mon Dec 06, 2010 1:42 pm
by Partial
Thanks a lot...!!!
Now is working.