Thread View: comp.os.msdos.programmer
3 messages
3 total messages
Started by Bin . Lee
Sun, 25 Feb 1996 15:58
Urg,ent, keyboard buffer overflow
Author: Bin . Lee
Date: Sun, 25 Feb 1996 15:58
Date: Sun, 25 Feb 1996 15:58
38 lines
1629 bytes
1629 bytes
Hi, folks:
I wrote a DOS program in Borland C++, because my interrupt service routine
block OS for 3 millisecond of every 5 millisecond, I think this cause
bios no time to serve and check keyboard buffer, which cause keybord buffer
overflow.
Two questions:
1. related to process of bios handler keyboard buffer, when IRQ1 generate
a interrupt, but has not finished its ISR, can other IRQ, such as IRQ7
generate a interrupt in between ? How can keyboard buffer overflow happen ?
2. cli and sti will disable and enable all IRQ, is there a instruction which
will only disable and enable one specific IRQ, like IRQ7.
structure of my program
int main(void)
{
InstallExternalTimingIRQ7ISR()
while( waitkey() )
{
doKeyboardInput_ScrOutout();
}
ReinstallOldIRQ7ISR();
}
My interrupt happens every 5 ms and program need 3 ms to finish its ISR,
during this time, I use cli and sti to protect its service, how will this
affect keyboard interrupt ? The interrupt I used is external circuit
generate 5 ms interrupt connect to IRQ7.
Thanks folks, this is urgent for me, please send me a mail.
Bin
Re: Urg,ent, keyboard buffer overflow
Author: George C. Lindauer
Date: Mon, 26 Feb 1996 17:22
Date: Mon, 26 Feb 1996 17:22
63 lines
2367 bytes
2367 bytes
"Bin . Lee" <b_lee2@hamlet.uncg.edu> writes:
>Hi, folks:
>I wrote a DOS program in Borland C++, because my interrupt service routine
>block OS for 3 millisecond of every 5 millisecond, I think this cause
>bios no time to serve and check keyboard buffer, which cause keybord buffer
>overflow.
>Two questions:
>1. related to process of bios handler keyboard buffer, when IRQ1 generate
>a interrupt, but has not finished its ISR, can other IRQ, such as IRQ7
>generate a interrupt in between ? How can keyboard buffer overflow happen ?
If you have to have an ISR that takes so long, it is good to issue the EOI
(out 20h, 20h) early in the interrupt so higher interrupts can interrupt you.
In general though if processing takes so long you defer it from the ISR to
a task and just get out of the ISR.
>2. cli and sti will disable and enable all IRQ, is there a instruction which
>will only disable and enable one specific IRQ, like IRQ7.
For the lower 8 IRQs, you can access port 21h. IRQ 7 corresponds to bit 7;
to enable IRQ7 you would do:
in al,21h
and al,07fh
out 21h,al
and to disalbe it you would do:
in al,21h
or al,80h
out 21h,al
This is a PC hardware thing, not something that is built into the x86
processor series.
David
>structure of my program
>int main(void)
>{
> InstallExternalTimingIRQ7ISR()
> while( waitkey() )
> {
> doKeyboardInput_ScrOutout();
> }
>
> ReinstallOldIRQ7ISR();
>}
>My interrupt happens every 5 ms and program need 3 ms to finish its ISR,
>during this time, I use cli and sti to protect its service, how will this
>affect keyboard interrupt ? The interrupt I used is external circuit
>generate 5 ms interrupt connect to IRQ7.
>Thanks folks, this is urgent for me, please send me a mail.
>Bin
Re: Urg,ent, keyboard buffer overflow
Author: John Noland
Date: Tue, 27 Feb 1996 00:17
Date: Tue, 27 Feb 1996 00:17
54 lines
2904 bytes
2904 bytes
In article <Pine.SOL.3.91.960225103721.16366A-100000@hamlet.uncg.edu>, b_lee2@hamlet.uncg.edu says...
>
>
>Hi, folks:
>
>I wrote a DOS program in Borland C++, because my interrupt service routine
>block OS for 3 millisecond of every 5 millisecond, I think this cause
>bios no time to serve and check keyboard buffer, which cause keybord buffer
>overflow.
>
>Two questions:
>1. related to process of bios handler keyboard buffer, when IRQ1 generate
>a interrupt, but has not finished its ISR, can other IRQ, such as IRQ7
>generate a interrupt in between ? How can keyboard buffer overflow happen ?
>
>2. cli and sti will disable and enable all IRQ, is there a instruction which
>will only disable and enable one specific IRQ, like IRQ7.
>
>structure of my program
>
>int main(void)
>{
> InstallExternalTimingIRQ7ISR()
>
> while( waitkey() )
> {
> doKeyboardInput_ScrOutout();
> }
>
> ReinstallOldIRQ7ISR();
>}
>My interrupt happens every 5 ms and program need 3 ms to finish its ISR,
>during this time, I use cli and sti to protect its service, how will this
>affect keyboard interrupt ? The interrupt I used is external circuit
>generate 5 ms interrupt connect to IRQ7.
>
>Thanks folks, this is urgent for me, please send me a mail.
Hardware interrupts are first fielded by the PIC (Intel 8259A Progammable
Interrupt Controller). This thing acts as a sort of receptionist for the
CPU. It accepts up to eight distinct interrupts and can mask (ignore)
interrupts individually. It responds to each unmasked interrupt and
forwards it to the CPU, provided no other interrupt of higher priority
is being serviced at that moment, Basically, the lower the IRQ number,
the higher the priority.Timer - IRQ0, Keyboard - IRQ2, etc...
To answer your question, you can mask individual interrupts on the PIC.
This isn't the correct thing to do. The CPU automatically disables all
interrupts when it transfers control to the service routine for the current
interrupt. During the servicing of the interrupt, the PIC inhibits further
interrupts of the same or lower priority, but higher priority interrupts
are still acknowledged if the interrupt flag is set. To allow this to
function correctly, your ISR *MUST* reenable interrupts with an STI
immediately, before it begins servicing your interrupt. This allows the
other devices to function properly.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads