delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/07/18/21:57:22

From: fox AT pt0204 DOT pto DOT ford DOT com (Ken Fox)
Subject: custom keyboard interrupt handler?
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Date: Sun, 18 Jul 1993 21:43:28 -0400 (EDT)
Cc: fox AT pt0204 DOT pto DOT ford DOT com (Ken Fox)

begin net plea:  8-)

	I've recently started using the djgcc set of tools/libraries to
develop PC applications using the GCC 2.4.3 cross compiler (i386-net2 target
on a sun-sparc host).  DJ Delorie has produced an excellent environment:
most of the things that I have needed to port went without a hitch.

	Currently I'm trying to port over applications using a custom 2D
graphics library that we have.  This library was written about 25 years ago.
I converted it to C (using ftoc) and got it working on the Sun.  Once that
was done I implemented the few graphics primitives it needs with Csaba
Biegl's excellent GRX library.  Our graphics programs now run fine on the PC
(on a variety of graphics adaptors too...)

	In spite of all this success, I have a problem because the programs
believe that they have text and graphics available simultaneously, the
graphics in one window and the text in another.  When the graphics initialize
the PC goes into VGA mode (for example) which breaks printf (for example).
What I want to do is delay switching into graphics mode until the user
explicitly requests it with a function key.  Then the program can stop
whatever it's doing, switch into graphics mode and refresh the display.
When the user wants to continue, they press the same function key and get
back into text mode.  Normal program execution continues.  A program function
to toggle the display is already done.  What I need is a way to hook that
toggle to a function key.

	I'm good on Unix, but pretty naive on MS-DOS.  It looked like all I
had to do was to supply a keyboard interrupt handler, register it with the
BIOS in interrupt vector postion 9h, and make sure and restore it when the
program ends.  This is turning out to be a lot harder than I thought it
would be (if not impossible).  If I've understood the source for go32
correctly, it is running in real mode (with the processor emulating an 8086?)
and my code is running in protected mode (with the processor in the native
instruction mode?).  This allows it access to DOS/BIOS interrupts and
prevents me from gaining the same access.  If I could register a hook with
go32 to be called from _ev_keybdhandler(), then I think that I could call my
mode toggle from there.  I don't know for sure what is going on because
there are some DOS/BIOS interface routines used in go32 that I can't find.
Things like use of _AL, _AH, _AX, and geninterrupt().  These look
important.  Where are they???

	So:  How do I get a function registered as a keyboard interrupt
hook?  If that's impossible, how would I get the functionality I described?

	One last thing, the recent release of djgcc 1.10 seems to have
broken libgrx.  Since I'm running the cross compiler I don't really know
whether it's a bug, or simply is a change that breaks my cross compiler.  I
offer to be a test site for future releases of djgcc if that would help
anyone.

Thanks in advance...

-- 
Ken Fox (fox AT pt0204 DOT pto DOT ford DOT com)  | My opinions or statements do not
                                   | represent those of, nor are endorsed by,
                                   | Ford Motor Company.
CAD/CAM Technology Section         |
CAD/CAM/CAE Process Integration    | "Is this some sort of trick question
Ford Motor Company                 |  or what?" -- Calvin

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019