flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Reading keyboard fast to much? |
Author |
|
edfed 16 Mar 2011, 23:01
isr ends with iret!!!!
and don't forget to disable/enable the keyboard at the end of the isr, with io port 61h. very important, if you don't do that, the keyboard will not send the next scan code. and don't forget too to free the PIC with EOI to io port 20h. not ret and no need of cli, sti, because... no irq handler should block irqs. there is a reason for the priority. less priority interrupts cannot occurs during isr, but high priority interrupt should be supported during lesser isr. |
|||
16 Mar 2011, 23:01 |
|
flash 17 Mar 2011, 01:36
Mmmm... thanks!! A lot. Very interesting things. I am sure i will need that. But, the code I post is not intended to be used as interrupt service routine. The program simply calls ReadKey and it waits for any key to be pressed... As the code shows, the ASCII results in AL and it can be used for PutChar in order to be printed on screen. Te problem is that chars are printed on screen more than one time, really really fast!!!! I have no idea what can be happen...
|
|||
17 Mar 2011, 01:36 |
|
edfed 17 Mar 2011, 15:49
in user code, you don't need to test the flag in port 64h.
the isr still do it. if you don't want to read 2 times the same key, just add a simple routine: Code: in al,60h cmp al,[oldcode] je @f mov al,[oldcode] call keyprocessing @@: ret oldcode db ? oldcode will contain the last entered scancode, and just by compare it with the fresh scancode, you will know if it is a typematic repetition, or a new key. it is very simple. |
|||
17 Mar 2011, 15:49 |
|
flash 19 Mar 2011, 16:53
Oh!! so simple!!! I am wondering how we can keep "some other ideas" in code. After read your post i found the real problem... loopz instruction!!!.
I change KeyPress to: Code: KeyPress: cli @@: in AL,64h test AL,1 jz @b in AL,60h sti ret And It works fine!!!! Beautiful. But now the use is more important. Since i am disabling interrupts its a clear signal to make the code interrupt driven. Which send me back to your first post Thank's!!! |
|||
19 Mar 2011, 16:53 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.