[net.micro.pc] Control-Break

"GlasserAlan"@LLL-MFE.ARPA@sri-unix.UUCP (08/17/83)

Can anyone offer me advice about a problem I'm having with BIOS and
DOS interrupts?  I've written a Tektronix emulation program in assembly
language.  It works fine except for one minor problem.  If a plot is
cut off with a CTRL-BREAK, the program remains in graphics mode and
doesn't return to alpha.

I thought I could overcome this by replacing BIOS interrupt 1B by my
own interrupt routine, which would reset to alpha mode and then exit
to the original interrupt.  In fact, this is what I did with BIOS
interrupt 10 and DOS interrupt 21 function 9 to get the Tektronix
emulation working.  For some reason, it doesn't work with 1B and 23.
Any ideas why?  Also, how can I enable a CTRL-BREAK in an arbitrary
program?

                      Alan Glasser (glasser@lll-mfe)

SHOSTAK%SRI-CSL@sri-unix.UUCP (08/18/83)

When a control-break is entered, the keyboard interrupt handler in the
bios clears the keyboard queue, then enters scan code 0 and character
code 0 into the queue; if the keyboard input bios call to inquire as
to whether the queue is empty is then called, it will report that the
queue is nonempty.  Moreover, if the call that does keyboard input is
issued, it will return 0 in both halves of the AX.  Control-break may
thus be viewed as extended code 0.  All of this is quite independent
of DOS, and occurs whether or not DOS notices the control-break.

If it is desired to detect control-break through the DOS interrupt
rather than by checking the keyboard queue, you can indeed place the
address of your interrupt service routine into location 1b.  Be
careful, however, to save all the registers in your routine and to end
it with an IRET rather than an ordinary return.