Help needed: QB 4.5 and TSR 
Author Message
 Help needed: QB 4.5 and TSR

I have a program written in QB 4.5 that uses certain function keys
to bring up menus.  Example: I use 'ON KEY(1) GOSUB subroutine' with
'KEY(1) ON' so that when F1 is pressed I do the subroutine. This works fine
with the regular keyboard.  I have a universal 32 key keypad that has the
function keys on it.  The keypad is interfaced to a serial port and uses
a TSR to control it.  Here's the problem: the keypad's function keys do not
work while I run the program either in the QB environment or using an EXE
file. They do work however in the QB environment. F1 brings up the HELP menu,
F5 starts the program, etc. It seems like they should work in the program.
Can anyone help me? PLEASE.
Thanks for your time.




Mon, 24 Nov 1997 03:00:00 GMT  
 Help needed: QB 4.5 and TSR

Quote:

> I have a program written in QB 4.5 that uses certain function keys
> to bring up menus.  Example: I use 'ON KEY(1) GOSUB subroutine' with
> 'KEY(1) ON' so that when F1 is pressed I do the subroutine. This works fine
> with the regular keyboard.  I have a universal 32 key keypad that has the
> function keys on it.  The keypad is interfaced to a serial port and uses
> a TSR to control it.  Here's the problem: the keypad's function keys do not
> work while I run the program either in the QB environment or using an EXE
> file. They do work however in the QB environment. F1 brings up the HELP menu,
> F5 starts the program, etc. It seems like they should work in the program.
> Can anyone help me? PLEASE.

The problem is most likely caused by the way your keypad TSR emulates the
keyboard.  Normally, pressing a key causes a scan code to appear in a I/O
port and triggers hardware Interrupt 9.  The handler for Int 9 reads the
value from the port, translates it into an ASCII code (or pseudocode), and
places that code into the keyboard buffer.

Presumably, your keypad TSR reads values from the com port, translating
them into ASCII/pseudo codes (much the same way the Int 9 handler
translates keyboard scan codes), and places those in the buffer.

The QB IDE sees these "fake" codes because it reads from the keyboard
buffer.  But ON KEY GOSUB intercepts scan codes directly from the hardware
port by hooking in ahead of the Int 9 handler, so ON KEY GOSUB never sees
the codes your keypad TSR stuffs into the buffer.

There's no real easy solution to this.  Since Int 9 is a hradware interrupt,
you can't call it properly from software.  There are ways to hook Int 9 so
that you can *alter* a code coming from the keyboard, but you can't insert
a code when the keyboard didn't generate one.

If you can use INKEY$, or INPUT$(1), or any of the other standard input
functions, they read from the keyboard buffer, so they should work with your
keypad TSR.  But that does mean that you'll have to poll for input
instead of just letting ON KEY interrupt your program whenever a key is
pressed.  This is generally a better method anyway, since it eliminates the
overhead of ON KEY event-checking, and the program is in a known state
rather than being interrupted at unpredictable moments.

---
Glen Blankenship



Tue, 02 Dec 1997 03:00:00 GMT  
 Help needed: QB 4.5 and TSR
<There's no real easy solution to this.  Since Int 9 is a hradware
interrupt,
<you can't call it properly from software.  There are ways to hook Int 9
so
<that you can *alter* a code coming from the keyboard, but you can't
insert
<a code when the keyboard didn't generate one.

I am also having a problem with using interrupts. I want to make my own
drawing program that uses  the mouse to draw pixels of specific colors on
the screen. My problem is that I don't know how to use interrupts. I know
that the interrupt needed is &H33. But I don't know how to set up a
function that calls this interrupt. PLEASE HELP!
Thank You
Sterling Daniels



Mon, 15 Dec 1997 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. QB 4.5 SHELL command in large programme help needed

2. need help: MSCDEX CD-ROM programming in QB 4.5

3. QB 4.0 Docs/QB 4.5 Wanted

4. want QB 4.5 QB 7.1 FOR FREE!!!

5. Where's QB.LIB in QB 4.5?

6. need entry form for qb 4.5

7. Need QB45ADVR.HLP file for QB 4.5!

8. HELP captur Contol-Break in QB 4.5

9. Qb 4.5 Help Question

10. QB 4.5 random Files HELP

11. QB 4.5 COMM help

12. QB 4.5 COMM help

 

 
Powered by phpBB® Forum Software