[net.micro.pc] Help on MASM/DOS-interrupt-handler q

jrv@siemens.UUCP (04/09/86)

There are two problems with the keyboard program:

	1. Whenever you twiddle interrupt vectors even using the
	   MS-DOS functions bracket the code with 'cli ... sti'.
	   The earlier versions of MS-DOS would not turn off interrupts
	   when changing the vectors!! "DEBUG'ing" through the code for
	   DOS 3.1 this bug seems to be fixed so that interrupts would
	   not have to be turned off.

	2. The problem with your dos_look_keyboard function is that you
	   do not preserve the zero flag from the call to old_keyboard_io.
	   You correctly realized that this must be done, however, the
	   implementation is faulty. Remember that IRET reloads the flag
	   register with the value of the flags at the time of the original
	   INT call. This is not what you want to do.

	   For the dos_look_keyboard request you must provide a separate
	   return operation which does one of two things:

		a. modify the location on the stack where the flags are
		   located prior to the IRET so that the correct
		   flags are popped into the flag register

	   or

		b. do a 'RET 2' instruction to return. This will not pop
		   the flags and will adjust the stack pointer by 2 to
		   effectively throw away the previous flag values.
		   (This is my preference.)

	   The ROM BIOS changes the flags value only for the check keyboard
	   function so it is advised to preserve the original flags for all
	   other requests.

Dean I e-mailed you a copy of your program modified to work correctly.


Jim Vallino
Siemens Research and Technology Lab.
Princeton, NJ
{allegra,ihnp4,seismo,philabs}!princeton!siemens!jrv