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

  1.     page    66,132
  2. ;******************************** MKEY12.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    move_mouse:far
  14.     extrn    box_the_mouse:far
  15.     extrn    lib_info:byte
  16. comment 
  17. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
  18. SETUP_MOUSE -  initializes mouse driver if mouse present
  19. ;
  20. ; inputs:    none
  21. ; output:    no carry - mouse is initialized
  22. ;               carry - mouse was not found
  23. ;* * * * * * * * * * * * * *
  24. 
  25.     PUBLIC    SETUP_MOUSE
  26. SETUP_MOUSE    PROC    FAR
  27.     APUSH   BX,CX,DX,ES
  28.     XOR     AX,AX
  29.     INT     33h            ;reset mouse & get status
  30.     AND     AX,BX
  31.     JZ        mi_no_mouse        ;jmp if no mouse installed
  32.     MOV     cs:lib_info.mouse_present,al
  33. ;
  34. ; position mouse cursor to left edge
  35. ;
  36.     mov    dx,0101h
  37.     call    move_mouse
  38. ;
  39. ; set range of mouse movement
  40. ;
  41.     mov    dx,0000h    ;upper left corner of box (row/col)
  42.     mov    bx,184fh    ;box size 24 rows, 79 columns
  43.     call    box_the_mouse
  44.     clc
  45.     jmp    mi_exit            
  46. mi_no_mouse:
  47.     stc    
  48. mi_exit:
  49.     APOP    ES,DX,CX,BX
  50.     RETF
  51. SETUP_MOUSE    ENDP
  52. comment 
  53. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
  54. MOUSE_PARMS - determine mouse position & buttons pressed
  55. ;
  56. ; inputs:    none
  57. ; output:    if ZF = 1, no buttons are pressed
  58. ;            if ZF = 0, BX = button code
  59. ;             BX bit 0 if set = left button is down
  60. ;             BX bit 1 if set = right button is down
  61. ;             BX bit 2 if set = center button is down
  62. ;            CX = horizontal (x) coordinate
  63. ;            DX = vertical (y) coordinate
  64. ;            
  65. ; Note that mouse positions are expressed as a pixel location
  66. ;* * * * * * * * * * * * * *
  67. 
  68.     PUBLIC    MOUSE_PARMS
  69. MOUSE_PARMS    PROC    FAR
  70.    PUSH    AX
  71.    PUSH    ES
  72.    MOV     AX,0003        ;return mouse status
  73.    INT     33h            ;return cx=column dx=row bx=button (left=0001)
  74.    AND     BX,+07
  75.    XOR     AX,AX
  76.    MOV     ES,AX
  77.    MOV     AL,BYTE PTR ES:[0449h]    ;get current video mode
  78.    CMP     AL,04
  79.    JB      X_0034            ;
  80.    CMP     AL,05
  81.    JA      X_0034
  82.    SHR     CX,1                ;adjust row if crt mode 5
  83. X_0034:
  84.    POP     ES
  85.    POP     AX
  86.    RETF
  87. MOUSE_PARMS    ENDP
  88.  
  89. LIBSEG    ENDS
  90.     end
  91.