Hi guys, I was wondering if someone could help me on a lab assignment I am working on. I am writting a program that does several things using screen/keyboard processing.

One of the things I have to do is prompt the user to enter a key code combination (i.e. the user must press the Ctrl key and another key such as C). Each key combination will perform differnt tasks.

So if the user presses Ctrl + C the screen should be cleared except for one line at the bottom, which is used for instructions.

The key combinations should do the following tasks:
Ctrl + C clears the screen
Ctrl + A allows user to add ascii character at cursor
Ctrl + E ends program
Ctrl + S user enters x and y coordinates for setting cursor position
Ctrl + P user can chage the attribute and clear the screen color
Ctrl + R user can Repeat the last character entered

Currently I am using INT 16H function AH,02 to test the ctrl key status. If the test returns true I go to another subroutine to see which key was pressed if not I keep testing untill it becomes true.

The way I have the code written know is that it just waits until the ctrl key is pressed, then it will go to the subroutine but at that point I no longer have to hold down the ctrl key.

In other words, the program should work only when I press ctrl and a proper key at the same time; not press ctrl release, then press a proper key.

So my question is, how do I accomplish testing for ctrl and a key at the same time rather than at different times.

I hope this is clear to you all.
If I need to clarify please let me know
Attached is some of the code I have so far. It's pretty rought right now.

Thanks for the help
Posted on 2002-04-07 04:54:19 by freedumb87
if I were you I would test only for CTRL. IF CTRL if found pressed then check the rest if the keys you want.
Posted on 2002-04-07 06:10:37 by dionysus
if I were you I would test only for CTRL. IF CTRL if found pressed then check the rest if the keys you want.


dionysus,
Currently that is what I am doing. I have a test for the pressing of Ctrl. Once it is found to be pressed, I check the other keys. The problem is, once Ctrl is pressed, in order to find the proper key (C,R,E,etc..) Ctrl must be released. What I want is: both keys Ctrl and (C,R,E,etc..) to be pressed at the same time, not Ctrl then the key.
Posted on 2002-04-07 12:04:50 by freedumb87
You might want to read a newsgroup for this http://groups.google.com/groups?hl=en&q=two+keys&meta=group%3Dcomp.lang.asm.x86 :) - there are lots of info you can get from there.
Posted on 2002-04-07 12:43:08 by stryker
Thanks stryker

Looks good, I will check it out.
Posted on 2002-04-07 12:55:53 by freedumb87
ok what I ment was

start a timer, when the timer trigers do this



INVOKE GetAsyncKeyState,VK_CTRL
.IF eax!=0
INVOKE GetAsyncKeyState,(your key)
.IF eax!=0
Do Whatever
.ENDIF
INVOKE GetAsyncKeyState,(NextKey)
.IF eax!=0
Do Whatever
.ENDIF
INVOKE GetAsyncKeyState,(NextKey)
.IF eax!=0
Do Whatever
.ENDIF
etc...
.ENDIF
Posted on 2002-04-07 14:25:19 by dionysus
Would it be possible to make the check for Ctrl+proper key at one time.

For instance, is there a function that will let me check the scancode of the particular letter in addition to the code for the special keys.

I see a scan code chart that shows if a user presses the letter c or C while pressing Ctrl, BIOS delivers 2EH (scancode for c/C) in AH and 03H in AL.

So, is there a function that will allow me to test the key combination without echoing to the screen.

Also, if that would work, do I also need to clear the keyboard buffer each time?

Thanks
Posted on 2002-04-07 15:10:26 by freedumb87
dionysus,

i think freedumb87 is using DOS, though i could be wrong. otherwise, simply using a hot-key would work (in Windows).

you could try using HelpPC or RBIL (Ralph Brown's Interrupt List) to search for what you are looking for.

i think what you might be looking for int 16, subfunction 0 or subfunction 10h.
Posted on 2002-04-07 15:56:58 by jademtech
jademtech:
i think what you might be looking for int 16, subfunction 0 or subfunction 10h.


Thanks, the function 10H works with it. Now if I could get only finish the rest of it....

Thanks

BTW I am using TASM and notepad for editing.
Posted on 2002-04-07 17:05:12 by freedumb87