Announcement

Collapse

New Sub-Forum

In an effort to help make sure there are appropriate categories for topics of discussion that are happening, there is now a sub-forum for databases and database programming under Special Interest groups. Please direct questions, etc., about this topic to that sub-forum moving forward. Thank you.
See more
See less

keyboard INT9 under windows

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • keyboard INT9 under windows

    I have some problems whidt INTERUPT 9 i hope
    somewane can help me out its works fine under dos
    but windows is messing up everefing take a lock
    at this code. (it's made for $include file)

    DECLARE SUB SetUevent()
    DECLARE SUB Kbscan()
    dim SGxx as shared word
    dim PRxx as shared word
    dim OSGxx as shared word 'dim some memory
    dim OPRxx as shared word
    dim kbcode(255) as shared byte

    SGxx=CODESEG(INT9) 'get the new segment addr
    PRxx=CODEPTR(INT9) 'get the new pointer addr
    CALL GetInterruptVector(&H9,OSGxx,OPRxx) 'save the old addr

    ON UEVENT GOSUB KeyPress 'set uevent action
    goto skip4it 'skip the interupt proces by startup


    KeyPress:
    call kbscan
    RETURN

    INT9:
    ! PUSH AX 'save the ganeral registers
    ! PUSH BX
    ! PUSH CX
    ! PUSH DX
    ! PUSH SI
    ! PUSH DI
    ! PUSH BP
    ! PUSH DS
    ! PUSH ES
    ! PUSHF 'save the flags register
    ! CLI 'suspend all maskable interupts
    ! CALL far ptr setuevent 'call uevent
    ! POPF 'restore flags
    ! POP ES 'restore registers
    ! POP DS
    ! POP BP
    ! POP DI
    ! POP SI
    ! POP DX
    ! POP CX
    ! POP BX
    ! POP AX
    ! STI 're-enable all maskable interupts processing
    ! iret 'return from interupt

    sub kbscan
    local acode?
    local kbscancode%
    kbscancode%=inp(&h60) 'read scancode

    acode?=inp(&h61) '!!keyboard controlle interupt!!
    out &h61,(acode? or &h80) ' its a mistery
    out &h61,(acode? and &h7F)
    out &h20,&h20

    if (kbscancode% and 128) then 'save
    kbcode(kbscancode% and 127)=0
    else
    kbcode(kbscancode% and 127)=1
    end if
    kbcode(0)=kbscancode%
    '--turn off by pressing Ctrl+Alt+Del--
    if kbcode(29)=1 and kbcode(56)=1 and kbcode(83)=1 then kbcode.off:beep:end
    end sub

    sub kbcode.on
    CALL SetInterruptVector(&H9,SGxx,PRxx) 'set new addr
    for i = 0 to 15 'clean key buffers
    dumy$=inkey$
    next
    uevent on
    end sub

    sub kbcode.off
    CALL SetInterruptVector(&H9,OSGxx,OPRxx) 'restore old addr
    uevent off
    for i = 0 to 127 'clean scancode buffers
    kbcode(i)=0
    next
    end sub

    SUB SetInterruptVector(Intr%,Segment??,Offset??) 'works good
    REG 1,&H2500 + Intr%
    REG 4,Offset??
    REG 8,Segment??
    CALL INTERRUPT &H21
    END SUB

    SUB GetInterruptVector(Intr%,S??,O??) 'works good
    REG 1,&H3500 + Intr%
    CALL INTERRUPT &H21
    S??=REG(9)
    O??=REG(2)
    END SUB

    skip4it: 'skip point
    ----------------END------------------------------------
    If i run under windows it go's wrong
    by pressing the cursor-key whats hapening
    pleas help me, fanks


    ------------------

  • #2
    I'm not quite sure what you are trying to accomplish. It seem
    to me that all you want is to get a key scan into a variable.
    If that's the case, you may want to take a look at Int16h,
    Functions 11h and 10h. Function 11h checks the keyboard buffer
    but does not remove any characters. Function 10h does. The
    trouble with using function 10h alone is that if a character is
    not in the buffer, it will stay there and wait for one. (It
    hangs the program).

    This will return most all keyscans, including F-11 and F-12.
    If I am misunderstanding your intentions, please accept my
    appologies.


    ------------------


    [This message has been edited by Mel Bishop (edited November 18, 2000).]
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.

    Comment

    Working...
    X