Howdy, Stranger!

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

Categories

need help in asm.. laptop scancodes wont work..

listed below are the snippets of the asm program...
the program is suppose to check for the scan code of the left and right arrow key of my laptop keys... but it won jump into that label i just couldnt understand what is wrong with my progam...
please help....

;=========with in the main proc
chkIn: call checkKey

cmp ScanCode,4bh
jz min

cmp ScanCode,4dh
jz max

jmp chkIn

min: mov cx,1027h
mov dx,1028h
call displayScreen
jmp chkIn

max: mov cx,1527h
mov dx,1528h
call displayScreen
jmp chkIn
;check for keypress
;==================
.code
checkKey PROC
mov ah,10h
int 16h
mov ScanCode,al
call DumpRegs
checkKey ENDP

Comments

  • IDKIDK Member Posts: 1,784
    : listed below are the snippets of the asm program...
    : the program is suppose to check for the scan code of the left and right arrow key of my laptop keys... but it won jump into that label i just couldnt understand what is wrong with my progam...
    : please help....
    :
    : ;=========with in the main proc
    : chkIn: call checkKey
    :
    : cmp ScanCode,4bh
    : jz min
    :
    : cmp ScanCode,4dh
    : jz max
    :
    : jmp chkIn
    :
    : min: mov cx,1027h
    : mov dx,1028h
    : call displayScreen
    : jmp chkIn
    :
    : max: mov cx,1527h
    : mov dx,1528h
    : call displayScreen
    : jmp chkIn
    : ;check for keypress
    : ;==================
    : .code
    : checkKey PROC
    : mov ah,10h
    : int 16h
    : mov ScanCode,al
    : call DumpRegs
    : checkKey ENDP
    :

    Hmm, this isn't right.
    : mov ScanCode,al
    You can't move al to a constant.
    Should be:
    : mov [ScanCode],al

  • c_aguitc_aguit Member Posts: 9
    : : listed below are the snippets of the asm program...
    : : the program is suppose to check for the scan code of the left and right arrow key of my laptop keys... but it won jump into that label i just couldnt understand what is wrong with my progam...
    : : please help....
    : :
    : : ;=========with in the main proc
    : : chkIn: call checkKey
    : :
    : : cmp ScanCode,4bh
    : : jz min
    : :
    : : cmp ScanCode,4dh
    : : jz max
    : :
    : : jmp chkIn
    : :
    : : min: mov cx,1027h
    : : mov dx,1028h
    : : call displayScreen
    : : jmp chkIn
    : :
    : : max: mov cx,1527h
    : : mov dx,1528h
    : : call displayScreen
    : : jmp chkIn
    : : ;check for keypress
    : : ;==================
    : : .code
    : : checkKey PROC
    : : mov ah,10h
    : : int 16h
    : : mov ScanCode,al
    : : call DumpRegs
    : : checkKey ENDP
    : :
    :
    : Hmm, this isn't right.
    : : mov ScanCode,al
    : You can't move al to a constant.
    : Should be:
    : : mov [ScanCode],al
    :
    :

    thanx... ... i'll give the feedback as soon as i tried it...

  • c_aguitc_aguit Member Posts: 9
    : : listed below are the snippets of the asm program...
    : : the program is suppose to check for the scan code of the left and right arrow key of my laptop keys... but it won jump into that label i just couldnt understand what is wrong with my progam...
    : : please help....
    : :
    : : ;=========with in the main proc
    : : chkIn: call checkKey
    : :
    : : cmp ScanCode,4bh
    : : jz min
    : :
    : : cmp ScanCode,4dh
    : : jz max
    : :
    : : jmp chkIn
    : :
    : : min: mov cx,1027h
    : : mov dx,1028h
    : : call displayScreen
    : : jmp chkIn
    : :
    : : max: mov cx,1527h
    : : mov dx,1528h
    : : call displayScreen
    : : jmp chkIn
    : : ;check for keypress
    : : ;==================
    : : .code
    : : checkKey PROC
    : : mov ah,10h
    : : int 16h
    : : mov ScanCode,al
    : : call DumpRegs
    : : checkKey ENDP
    : :
    :
    : Hmm, this isn't right.
    : : mov ScanCode,al
    : You can't move al to a constant.
    : Should be:
    : : mov [ScanCode],al
    :
    :

    i changed it the way u told me but still it wont work...
    though i declared a variable that holds the scancode... the problem seem to point out that the laptop scancode is diiferent... is this posible?.....

    .data
    string1 DB 'Press the arrow keys ( <- or -> )$'
    string2 DB 'to increase or decrease the tone$'
    left DB 'left$'
    right DB 'right$'
    ScanCode BYTE ?
    TopLeft WORD 0b18h
    LowerRight WORD 0b19h


    ;check for keypress
    ;==================
    .code
    checkKey PROC
    mov ah,10h
    int 16h
    mov [ScanCode],al
    ;call DumpRegs
    checkKey ENDP

  • IDKIDK Member Posts: 1,784
    : : : listed below are the snippets of the asm program...
    : : : the program is suppose to check for the scan code of the left and right arrow key of my laptop keys... but it won jump into that label i just couldnt understand what is wrong with my progam...
    : : : please help....
    : : :
    : : : ;=========with in the main proc
    : : : chkIn: call checkKey
    : : :
    : : : cmp ScanCode,4bh
    : : : jz min
    : : :
    : : : cmp ScanCode,4dh
    : : : jz max
    : : :
    : : : jmp chkIn
    : : :
    : : : min: mov cx,1027h
    : : : mov dx,1028h
    : : : call displayScreen
    : : : jmp chkIn
    : : :
    : : : max: mov cx,1527h
    : : : mov dx,1528h
    : : : call displayScreen
    : : : jmp chkIn
    : : : ;check for keypress
    : : : ;==================
    : : : .code
    : : : checkKey PROC
    : : : mov ah,10h
    : : : int 16h
    : : : mov ScanCode,al
    : : : call DumpRegs
    : : : checkKey ENDP
    : : :
    : :
    : : Hmm, this isn't right.
    : : : mov ScanCode,al
    : : You can't move al to a constant.
    : : Should be:
    : : : mov [ScanCode],al
    : :
    : :
    :
    : i changed it the way u told me but still it wont work...
    : though i declared a variable that holds the scancode... the problem seem to point out that the laptop scancode is diiferent... is this posible?.....
    :
    : .data
    : string1 DB 'Press the arrow keys ( <- or -> )$'
    : string2 DB 'to increase or decrease the tone$'
    : left DB 'left$'
    : right DB 'right$'
    : ScanCode BYTE ?
    : TopLeft WORD 0b18h
    : LowerRight WORD 0b19h
    :
    :
    : ;check for keypress
    : ;==================
    : .code
    : checkKey PROC
    : mov ah,10h
    : int 16h
    : mov [ScanCode],al
    : ;call DumpRegs
    : checkKey ENDP
    :
    :


    ScanCode BYTE ?
    Hmm, I've never seen code like this... But then I have only programmed with fasm asm... And you seem to use some other one...
    I would declare the variable like this:
    ScanCode db ?

    I would recomend that you use a debugger....

    Another thing: According to http://www.ctyme.com/intr/rb-1771.htm you should check if your computer supports extended keyboards.

    If you don't mind using dos funcs int21 06 df=FF is rather good:
    http://www.ctyme.com/intr/rb-2559.htm
Sign In or Register to comment.