home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 5 / ctrom5b.zip / ctrom5b / PROGRAM / ASM / ALIB30B / MKEY13.ASM < prev    next >
Assembly Source File  |  1994-10-15  |  1KB  |  48 lines

  1.     page    66,132
  2. ;******************************** MKEY13.ASM *********************************
  3.  
  4. LIBSEG           segment byte public "LIB"
  5.         assume cs:LIBSEG , ds:nothing
  6.  
  7. ;----------------------------------------------------------------------------
  8. .xlist
  9.     include  mac.inc
  10.     include  common.inc
  11. .list
  12. ;----------------------------------------------------------------------------
  13.     extrn    key_if_ready:far
  14. comment 
  15. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
  16. KEY_OR_MOUSE - waits for first keypress or mouse button click
  17. ;
  18. ; inputs:    none
  19. ;
  20. ; output:    AX = keycode, BX = mouse button
  21. ;
  22. ; note:  If a keycode is found it is returned and the mouse status
  23. ;        is not checked.
  24. ;* * * * * * * * * * * * * *
  25. 
  26.     PUBLIC    KEY_OR_MOUSE
  27. KEY_OR_MOUSE    PROC    FAR
  28.    CALL    KEY_IF_READY        ;return ax=0(none) 1(key waiting)
  29.    XOR     BX,BX
  30.    OR      AX,AX
  31.    JNZ     KOM_EXIT        ;jmp if key waiting
  32.    MOV     AX,0003
  33.    PUSH    CX
  34.    PUSH    DX
  35.    XOR     BX,BX
  36.    INT     33h        ;returns cx=column dx=row bx=button pressed (left=0001)
  37.    POP     DX
  38.    POP     CX
  39.    AND     BX,+07
  40.    JZ      KEY_OR_MOUSE        ;jmp if no mouse clicks
  41.    XOR     AX,AX
  42. KOM_EXIT:
  43.    RETF
  44. KEY_OR_MOUSE    ENDP
  45.  
  46. LIBSEG    ENDS
  47.     end
  48.