Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. mouse:
  2.  
  3.  
  4.     mov  eax,37                       ; get mouse position                        ; EXPERIMENTAL !!!
  5.     mov  ebx,1                        ; window relative                           ;
  6.     int  0x40                         ;                                           ;
  7.     shr  eax,16                       ; we only need to know the x position       ;
  8.     sub  eax,X_LOCATION                                                           ;
  9.                                                                                   ;
  10.     cmp  eax,ADOBE_SIZE*(LEN_X-2)     ; check to see if mouse is in field         ;
  11.     jg   no_mouse                     ;                                           ;
  12.     cmp  eax,0                        ;                                           ;
  13.     jl   no_mouse                     ;                                           ;
  14.                                                                                   ;
  15.     mov  ebx,0                                                                    ;
  16.                                                                                   ;
  17.    mouseloop:                                                                     ;
  18.     cmp  eax,ADOBE_SIZE                                                           ;
  19.     jl   yes_mouse                                                                ;
  20.     sub  eax,ADOBE_SIZE                                                           ;
  21.     inc  ebx                                                                      ;
  22.     jmp  mouseloop                                                                ;
  23.                                                                                   ;
  24.    yes_mouse:                                                                     ;
  25.     cmp  ebx,[current_block_x]
  26.     jg   go_right
  27.     jl   go_left
  28. ;    mov  dword[current_block_x],ebx                                               ;
  29.  
  30.     mov  eax,37                       ; get mouse position                        ;
  31.     mov  ebx,2                        ; buttons pressed (1=left, 2=right, 3=both) ;
  32.     int  0x40                                                                     ;
  33.                                                                                   ;
  34.     cmp  eax,0                                                                    ;
  35.     jne  yes_mouse_button                                                         ;
  36.     mov  byte[lastmousebutton],0                                                  ;
  37.     jmp  no_mouse                                                                 ;
  38.    yes_mouse_button:                                                              ;
  39.                                                                                   ;
  40.     cmp  eax,2                                                                    ;
  41.     jne  no_left_mouse                                                            ;
  42.     cmp  byte[status],'1'                                                         ;
  43.     jne  no_left_mouse                                                            ;
  44.     mov  byte[lastmousebutton],2                                                  ;
  45.     inc  dword [current_block_y]                                                  ;
  46.     call check_crash                                                              ;
  47.     jne  block_crash                                                              ;
  48.     jmp  no_mouse                                                                 ;
  49.                                                                                   ;
  50.    no_left_mouse:                                                                 ;
  51.                                                                                   ;
  52.                                                                                   ;
  53.     cmp  eax,1                                                                    ;
  54.     jne  no_right_mouse                                                           ;
  55.     cmp  byte[status],'1'                                                         ;
  56.     jne  no_right_mouse                                                           ;
  57.     cmp  byte[lastmousebutton],1                                                  ;
  58.     mov  byte[lastmousebutton],1                                                  ;
  59.     je   no_right_mouse                                                           ;
  60.     call rotate_block                                                             ;
  61.     call check_crash                                                              ;
  62.     jne  block_crash                                                              ;
  63.     call draw_block                                                               ;
  64.     jmp  scendi                                                                   ;
  65.                                                                                   ;
  66.    no_right_mouse:                                                                ;
  67.                                                                                   ;
  68.                                                                                   ;
  69.     cmp  eax,3                                                                    ;
  70.     jne  no_mouse                                                                 ;
  71.     cmp  byte[lastmousebutton],3                                                  ;
  72.     mov  byte[lastmousebutton],3                                                  ;
  73.     je   no_mouse                                                                 ;
  74.     cmp  byte[status],'2'                                                         ;
  75.     je   unpause                                                                  ;
  76.     mov  byte[status],'2'                                                         ;
  77.     call draw_window                                                              ;
  78.     jmp  attesa                                                                   ;
  79. ;   unpause:                                                                       ;
  80. ;    mov  byte[status],'1'                                                         ;
  81. ;    call draw_window                                                              ;
  82. ;    jmp  still                                                                    ;
  83.                                                                                   ;
  84.    ;                                                                              ;
  85.    no_mouse:                                                                      ;
  86.  
  87. ret