How do I detect cursor arrows...?

This is a very simple question, really (sorry for that)...

After scanning a key, I know AL contains 0 if the character is in extended ASCII (case in point: cursor keys), the question is: How do I detect WHICH key it was...? Do I use another 16h interrupt, or does the scancode in AH serve a purpose here...

Thanks for the input... :)

Comments

  • [b][red]This message was edited by xkgdiam at 2003-12-2 17:14:24[/red][/b][hr]
    : This is a very simple question, really (sorry for that)...
    :
    : After scanning a key, I know AL contains 0 if the character is in extended ASCII (case in point: cursor keys), the question is: How do I detect WHICH key it was...? Do I use another 16h interrupt, or does the scancode in AH serve a purpose here...
    :
    : Thanks for the input... :)
    :
    [code]
    all you need is in AH, but ,
    when you press arrows AL==0xE0 not 0,
    when you press F1,...,F12 then AL=0

    try this if you use C too, and watch the keypad keys too:

    #include "stdio.h"
    int main(){
    int uk=0;
    while(27!=(char)uk){
    asm{;mov ax,1000h;int 16h;mov uk,ax}
    printf("
    you press : 0x%04x == %c",uk,(char)uk);
    }
    }


    [/code]


  • Hello Xkgdiam, thanks much for the Win RegEdit help on the Win board,
    it worked real well & fixed problems that had plauged me for years.


    Here's some AH=0 INT 16h stuff for the original poster.
    You might look into AH=10h & AH=11h for INT 16h enhanced keys.
    [code]
    TTOPP: ;untested Nasm code
    XOR AH,AH ;Ask for keyboard read function
    INT 16h ;Read character/scan code from keyboard
    CMP AL,27 ;ESC key pressed ?
    JZ BYE
    OR AL,AL ;is AL 0 ?
    JZ EXTENDED ;jmp if AL=0
    ;process AL as a regular key here
    JMP TTOP ;loop to top
    EXTENDED:
    CMP AH,SOME_key_value ;or print the values fer learning
    JZ SOME_where
    JMP TTOP ;loop to top
    BYE:
    [/code]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories