Replacement int 0x9 or 0x8

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
cybek
Posts: 11
Joined: Tue Dec 27, 2011 4:41 pm

Replacement int 0x9 or 0x8

Post 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?
Nable
Member
Member
Posts: 453
Joined: Tue Nov 08, 2011 11:35 am

Re: Replacement int 0x9 or 0x8

Post by Nable »

What about sending EOI (End Of Interrupt) to interrupt controller?
cybek
Posts: 11
Joined: Tue Dec 27, 2011 4:41 pm

Re: Replacement int 0x9 or 0x8

Post by cybek »

Hah, works. Thank you very much :) I didn't know that IRQs need special care.
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: Replacement int 0x9 or 0x8

Post by bluemoon »

note that you trash es in the interrupt handler.
cybek
Posts: 11
Joined: Tue Dec 27, 2011 4:41 pm

Re: Replacement int 0x9 or 0x8

Post 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 :)
Post Reply