views:

90

answers:

2

Hi,

I'm working on a project in x86 assembly on Windows (MASM), and I need to somehow catch tab presses, but I'm not sure how to do that in assembly (I'm new to it).

I can get get user input with int 21h, but as far as I can tell that only works if the users types the data, then presses enter.

What I need is a way so that if the user presses the tab key, it will run a proc, and then from that proc I can handle what needs to happen. Is there a way to do this?

+1  A: 

http://spike.scu.edu.au/~barry/interrupts.html#ah01

DOS INT 21h - DOS Function Codes

AH = 01h - READ CHARACTER FROM STANDARD INPUT, WITH ECHO

Return: AL = character read

Notes:

^C/^Break are checked
^P toggles the DOS-internal echo-to-printer flag
^Z is not interpreted, thus not causing an EOF if input is redirected character is echoed to standard output

See Also: AH=06h, AH=07h, AH=08h, AH=0Ah

Robert Harvey
+1  A: 

If I understand correctly you can use:

mov ah,1 ; get char from keyboard

int 21h

cmp al, 9 ; 9 is ascii of tab

jnz Dont_Call

Call Proc_Name

Dont_Call:

(REST OF CODE)

Bob
That's perfect! Thanks a bunch.
Tyler Smith