Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

hot dos (Developers)

posted by kerravon E-mail, Sydney, Free World South, 12.05.2025, 23:02

> > And during those (some instructions) the keyboard
> > may have been hit, the interrupt processed, the
> > key is now in the buffer, ready for next time I
> > call the "is keyboard hit?" bios interrupt.
>
> Interesting problem, from what I read here:
> https://wiki.osdev.org/Interrupts#From_the_keyboard's_perspective

That article says what the OS should do.

In the case of DOS 4.0, the "OS" is actually
the BIOS. ie it is the BIOS that is doing those
instructions.

> It seems that PIC is blocked to send more IRQs during handling it until you
> explicitly finish the handling by:
>
> When the CPU finishes handling the interrupt, it tells the PIC that it's
> OK to resume sending interrupts:
> mov al,20h
> out 20h,al

>
> So if some key is hit in meantime, KBC should hold it in the internal queue
> and it will generate new interrupt just after you exit your ISR and do HLT
> it should fire IRQ again to wake you up. Am I right?

And those instructions may not even be done in this
situation, as the BIOS call is probably just looking
to see if there is a buffer already in the keyboard
buffer and reporting "no". It's not actually waiting
for the key - that's a different interrupt to call
(and since it goes into a hard loop, I was
contemplating avoiding it).

Even if it was doing those instructions, those
instructions are unlikely to be the last instructions,
as the routine needs to set the return registers
correctly.

And even after the return, I still need to see if a
keystroke was pressed, before choosing to go into a
HLT. So that's non-zero instructions too.

 

Complete thread:

Back to the forum
Board view  Mix view
22552 Postings in 2097 Threads, 401 registered users, 47 users online (0 registered, 47 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum