prob about 8259A reprog , pls come in

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
user4

prob about 8259A reprog , pls come in

Post by user4 »

Codes about 8259A are :(from Christopher Giese,a bit changed)
   mov al,0x11  ; icw1-->11:icw4 is needed
   out 0x20,al
   out 0xa0,al
   mov al,0x20  ; icw2:vector for IRQs begining
   out 0x21,al        ; IRQ0-IRQ7 -> interrupts 0x20-0x27
   add al,8
   out 0xa1,al
   mov al,4     ; icw3
   out 0x21,al
   mov al,2
   out 0xa1,al
   mov al,1fh   ; icw4
   out 0x21,al
   mov al,1bh
   out 0xa1,al
   mov al,0xFc  ;ocw
   out 0x21,al
and Codes for INT 21:
 int_21:
   mov si,msg_int20  ; 'Pressed key...'
   inc dh     ;dh->row for display
   call Print ;routine for video output,param with dx & si.
   in al,60h
   iretd
when I press a key, it display the message twice, like this:
Pressed key...

                                    Pressed key...
and it was no responds when press again.

thanks.
user4
df_at_home_in_melbourne

Re: prob about 8259A reprog , pls come in

Post by df_at_home_in_melbourne »

you get two messages because key down + key release each generate one.

so

a) press key down -> msg1
b) release the key -> msg2
df_again

Re: prob about 8259A reprog , pls come in

Post by df_again »

and you need to signal EOI, which your interrupt handler does not do.
user4

Re: prob about 8259A reprog , pls come in

Post by user4 »

thanks.

>a) press key down -> msg1
>b) release the key -> msg2
but the message is in wrong position,why?

>and you need to signal EOI, which your interrupt handler does not do.
I think ICW4 above which equal 1fh means Automatic EOI.
When I add codes to signal EOI to the end of INT21,and change ICW4 to manual EOI,things are not changed. It always display the message twice,and no responds after that.

Merry Christmas for all.
Post Reply