ISRs Don't working properly in VirtualBox
Posted: Mon Dec 06, 2010 1:19 pm
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.
The next implementation of delay function Don't work...
example:
- if i write the next code...
the last call puts("After delay"); never execute...
but if i add the modification to Delay Function, It Works properly
Similar occurrs with the keyborad irq handler...
at the end of the handler function i've to add
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'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;
}
Code: Select all
void delay(uint64 total_ticks) {
uint64 limit = ticks + total_ticks;
while(ticks <= limit);
}
- 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");
}
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
}
}
at the end of the handler function i've to add
Code: Select all
while(inb(0x64) & 2);
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