Page 1 of 1

Replacement int 0x9 or 0x8

Posted: Wed Aug 15, 2012 10:47 am
by cybek
Hi.
I have problem with replacing interrupt 0x8 and 0x9. After my changes to IVT and enabling interrupts (sti), my functions are called only once. Int 0x8 should be called 18.2 times per second, but it isn't. I'm using qemu.
Here's my code:

Code: Select all

; Interrupt handler
INT_0x8:
	pusha
	call	Test	
	popa
	iret

[...]

; Install 0x8 IRQ0
	mov	bx, 0x8*4
	mov	word [es:bx], INT_0x8
	mov	word [es:bx+2], 0

[...]

; My loop
	sti	
_Test:
	call	Test
	hlt
	jmp	_Test
	
	hlt
	jmp	$
	
LastKey db '<'
TestID dw 0
Test:
	mov	bx, 0xB800
	mov	es, bx
	mov	bx, [TestID]
	mov	al, [LastKey]
	mov	byte [es:bx], al
	mov	byte [es:bx+1], 0xA0
	add	word [TestID], 2
	ret
Anyone can help me?

Re: Replacement int 0x9 or 0x8

Posted: Wed Aug 15, 2012 11:30 am
by Nable
What about sending EOI (End Of Interrupt) to interrupt controller?

Re: Replacement int 0x9 or 0x8

Posted: Wed Aug 15, 2012 11:52 am
by cybek
Hah, works. Thank you very much :) I didn't know that IRQs need special care.

Re: Replacement int 0x9 or 0x8

Posted: Wed Aug 15, 2012 12:12 pm
by bluemoon
note that you trash es in the interrupt handler.

Re: Replacement int 0x9 or 0x8

Posted: Mon Aug 19, 2019 4:50 pm
by cybek
bluemoon wrote:note that you trash es in the interrupt handler.
I know that it was many years ago, but I have never said thank you. I've read this post and fixed this, but I didn't manage to write to you. And it was bad, because you spent time reading my code. Sorry and thank you :)