Subversion Repositories Kolibri OS

Rev

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

  1. ;*****************************************************************************
  2. ; Read the data from the clipboard
  3. ; Copyright (c) 2013, Marat Zakiyanov aka Mario79, aka Mario
  4. ; All rights reserved.
  5. ;
  6. ; Redistribution and use in source and binary forms, with or without
  7. ; modification, are permitted provided that the following conditions are met:
  8. ;        * Redistributions of source code must retain the above copyright
  9. ;          notice, this list of conditions and the following disclaimer.
  10. ;        * Redistributions in binary form must reproduce the above copyright
  11. ;          notice, this list of conditions and the following disclaimer in the
  12. ;          documentation and/or other materials provided with the distribution.
  13. ;        * Neither the name of the <organization> nor the
  14. ;          names of its contributors may be used to endorse or promote products
  15. ;          derived from this software without specific prior written permission.
  16. ;
  17. ; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
  18. ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19. ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20. ; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
  21. ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22. ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23. ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24. ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26. ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. ;******************************************************************************
  28.         use32
  29.         org 0x0
  30.  
  31.         db 'MENUET01'
  32.         dd 0x01
  33.         dd START
  34.         dd IM_END
  35.         dd I_END
  36.         dd stacktop
  37.         dd 0x0
  38.         dd 0x0
  39. ;---------------------------------------------------------------------
  40. include '../../../macros.inc'
  41. ;---------------------------------------------------------------------
  42. START:
  43.         mcall   68,11
  44. red:
  45.         call    draw_window
  46. still:
  47.         mcall   10
  48.  
  49.         cmp     eax,1
  50.         je      red
  51.         cmp     eax,2
  52.         je      key
  53.         cmp     eax,3
  54.         je      button
  55.  
  56.         jmp     still
  57. ;---------------------------------------------------------------------
  58. key:
  59.         mcall   2
  60.         jmp     still
  61. ;---------------------------------------------------------------------
  62. button:
  63.         mcall   17
  64.         cmp     ah,2
  65.         je      .read_button
  66.         cmp     ah,1
  67.         jne     still
  68. .exit:
  69.         mcall   -1
  70. ;--------------------------------------
  71. .read_button:
  72.         call    draw_clipboard
  73.         jmp     still
  74. ;---------------------------------------------------------------------
  75. draw_window:
  76.         mcall   12,1
  77.         xor     esi,esi
  78.         mcall   0,<0,600>,<0,400>,0x13FFFFFF,,title
  79.         mcall   8,<20,150>,<40,20>,2,0xCCCCCC
  80.         mcall   4,<25,47>,0x90000000,read_button_text
  81.         mcall   12,2
  82.         ret
  83. ;---------------------------------------------------------------------
  84. draw_clipboard:
  85.         mcall   54,0
  86.         cmp     eax,-1
  87.         je      .exit
  88.        
  89.         test    eax,eax
  90.         jz      .exit
  91.        
  92.         mov     [slots_number],eax
  93.        
  94.         xor     eax,eax
  95.         mov     [current_slot],eax
  96.        
  97.         mov     [text_coordinates],dword 10 shl 16+70
  98. .start:
  99.         xor     eax,eax
  100.         mov     [current_slot_data],eax
  101.         mcall   54,1,[current_slot]
  102.  
  103.         cmp     eax,-1
  104.         je      .no_relevant_data
  105.        
  106.         cmp     eax,1
  107.         jne     @f
  108.        
  109. .no_relevant_data:
  110.         mov     edx,no_relevant_data_text
  111.         mov     esi,no_relevant_data_text.end-no_relevant_data_text
  112.         jmp     .print
  113. .no_relevant_data_1:
  114.         mov     edx,no_relevant_data_text_1
  115.         mov     esi,no_relevant_data_text_1.end-no_relevant_data_text_1
  116.         jmp     .print
  117. .no_relevant_data_2:
  118.         mov     edx,no_relevant_data_text_2
  119.         mov     esi,no_relevant_data_text_2.end-no_relevant_data_text_2
  120.         jmp     .print
  121. @@:
  122.         mov     [current_slot_data],eax
  123.         mov     eax,[current_slot_data]
  124.         mov     esi,[eax]
  125.         sub     esi,12
  126.         add     eax,4
  127.         cmp     [eax],dword 0
  128.         jne     .no_relevant_data_1
  129.         add     eax,4  
  130.         cmp     [eax],dword 866
  131.         jne     .no_relevant_data_2
  132.        
  133.         add     eax,4
  134.         mov     edx,eax
  135.  
  136. .print:
  137.         mcall   4,[text_coordinates],0x0
  138.        
  139.         mov     ecx,[current_slot_data]
  140.         test    ecx,ecx
  141.         jz      @f
  142.         mcall   68,13
  143. @@:
  144.         add     [text_coordinates],dword 15
  145.         inc     dword [current_slot]
  146.         mov     eax,[slots_number]
  147.         dec     eax
  148.         mov     [slots_number],eax
  149.         jnz     .start
  150. .exit:
  151.         ret
  152. ;---------------------------------------------------------------------
  153. title:
  154.         db 'Read the data from the clipboard',0
  155. read_button_text:
  156.         db 'Read from clipboard',0
  157. no_relevant_data_text: 
  158.         db '<NO RELEVANT DATA>',0
  159. .end:
  160. no_relevant_data_text_1:       
  161.         db '<NO TEXT>',0
  162. .end:
  163. no_relevant_data_text_2:       
  164.         db '<NO 866>',0
  165. .end:
  166. ;---------------------------------------------------------------------
  167. IM_END:
  168. slots_number:
  169.         rd 1
  170. text_coordinates:
  171.         rd 1
  172. current_slot:
  173.         rd 1
  174. current_slot_data:
  175.         rd 1
  176. ;--------------------------------------
  177.         rb 1024
  178. stacktop:
  179.         rb 4
  180. ;---------------------------------------------------------------------
  181. I_END:
  182. ;---------------------------------------------------------------------