Subversion Repositories Kolibri OS

Rev

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

  1. ;
  2. ;    NetSend(Client)
  3. ;                                
  4. ;    €¢â®à: Hex
  5. ;    ‘ ©â: www.mestack.narod.ru
  6. ;    
  7. ;    Ž¯¨á ­¨¥:
  8. ;    à®£à ¬¬  ¤«ï ®¡¬¥­  á®®¡é¥­¨ï¬¨ ¢ á¥â¨.Š«¨¥­â᪠ï ç áâì.
  9. ;
  10. ;    Compile with FASM for Menuet
  11. ;    Š®¬¯¨«¨àã¥âáï FASM'®¬ ¤«ï Œ¥­ãí⠎‘
  12. ;
  13.    
  14.    
  15. use32
  16.    
  17.                 org     0x0
  18.    
  19.                 db      'MENUET01'              ; 8 byte id
  20.                 dd      1                       ; header version
  21.                 dd      START                   ; program start
  22.                 dd      I_END                   ; program image size
  23.                 dd      mem                     ; required amount of memory
  24.                 dd      mem                     ; stack pointer
  25.                 dd      0, 0                    ; param, icon
  26.    
  27. include 'lang.inc'
  28. include 'macros.inc'
  29.    
  30. START:                                  ; start of execution
  31.    
  32.     mov  eax,53                ; open socket
  33.     mov  ebx,0
  34.     mov  ecx,0x4000            ; local port
  35.     mov  edx,0x5000            ; remote port
  36.     mov  esi,dword [remote_ip]   ; node IP
  37.     int  0x40
  38.    
  39.     mov  [socketNum], eax
  40.  
  41. red:
  42.     call draw_window            ; at first, draw the window
  43.    
  44. still:
  45.    
  46.     mov  eax,10                 ; wait here for event
  47.     int  0x40
  48.  
  49.     dec  eax
  50.     jz   red
  51.     dec  eax
  52.     jnz  button
  53.  
  54. key:
  55.     mov  al,2
  56.     int  0x40
  57.     jmp  still
  58.    
  59. button:
  60.     mov  al,17
  61.     int  0x40
  62.    
  63.     dec  ah                    ; button id=1 ?
  64.     jnz  noclose
  65.     mov  eax, 53
  66.     mov  ebx, 1
  67.     mov  ecx, [socketNum]
  68.     int  0x40
  69.     mov  eax,-1
  70.     int  0x40
  71.   noclose:
  72. ; it was not close button, so it must be send code button
  73.  
  74. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  75. ;;                                              ;;
  76. ;;           SEND CODE TO REMOTE                ;;
  77. ;;                                              ;;
  78. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  79.    
  80. send_xcode:
  81.  
  82.   mov  eax,53                     ; SEND CODE TO REMOTE
  83.   mov  ebx,4
  84.   mov  ecx,[socketNum]
  85.   mov  edx,end_message-send_data
  86.   mov  esi,send_data
  87.   int  0x40
  88.  
  89.   jmp  still
  90.    
  91.    
  92. ;   *********************************************
  93. ;   *******  WINDOW DEFINITIONS AND DRAW ********
  94. ;   *********************************************
  95.    
  96.    
  97. draw_window:
  98.    
  99.     mov  eax,12                    ; function 12:tell os about windowdraw
  100.     mov  ebx,1                     ; 1, start of draw
  101.     int  0x40
  102.    
  103.                                    ; DRAW WINDOW
  104.     mov  eax,0                     ; function 0 : define and draw window
  105.     mov  ebx,100*65536+250         ; [x start] *65536 + [x size]
  106.     mov  ecx,60*65536+150          ; [y start] *65536 + [y size]
  107.     mov  edx,0x03ffffff            ; color of work area RRGGBB
  108.     int  0x40
  109.    
  110.                                    ; WINDOW LABEL
  111.     mov  eax,4                     ; function 4 : write text to window
  112.     mov  ebx,8*65536+8             ; [x start] *65536 + [y start]
  113.     mov  ecx,0x00ffffff            ; color of text RRGGBB
  114.     mov  edx,labeltext             ; pointer to text beginning
  115.     mov  esi,lte-labeltext         ; text length
  116.     int  0x40
  117.    
  118.     mov  eax,8                     ; SEND MESSAGE
  119.     mov  ebx,50*65536+145
  120.     mov  ecx,47*65536+13
  121.     mov  edx,2
  122.     mov  esi,0x667788
  123.     int  0x40
  124.    
  125.     mov  ebx,25*65536+50           ; draw info text with function 4
  126.     mov  ecx,0x000000
  127.     mov  edx,text
  128.     mov  esi,40
  129.   newline:
  130.     mov  eax,4
  131.     int  0x40
  132.     add  ebx,16
  133.     add  edx,esi
  134.     cmp  [edx],byte 'x'
  135.     jnz  newline
  136.    
  137.     mov  eax,12                    ; function 12:tell os about windowdraw
  138.     mov  ebx,2                     ; 2, end of draw
  139.     int  0x40
  140.    
  141.     ret
  142.    
  143.    
  144. ; DATA AREA
  145.    
  146. if lang eq ru  
  147. text:
  148.     db '        ®á« âì á®®¡é¥­¨¥               '
  149.     db '                                        '
  150.     db ' ‹®ª «ì­ë©  ¤à¥á : 192.168.0.1          '
  151.     db ' “¤ «ñ­­ë©  ¤à¥á : 192.168.0.2          '
  152.     db '’¥ªáâ ¨  ¤à¥á ¢ ª®­æ¥ ¨á室­¨ª          '
  153.     db 'x' ; <- END MARKER, DONT DELETE
  154. else
  155. text:
  156.     db '          Send message                  '
  157.     db '                                        '
  158.     db ' Local  address : 192.168.0.1           '
  159.     db ' Remote address : 192.168.0.2           '
  160.     db 'Text and address in end of source       '
  161.     db 'x' ; <- END MARKER, DONT DELETE
  162. end if  
  163.    
  164. labeltext:  db  'NetSend(Client)'  ;
  165. lte:
  166.    
  167. remote_ip  db  192,168,1,2
  168.    
  169. send_data   db  'à¨¢¥â,íâ® â¥áâ!Hello,this is a test!'
  170. end_message:
  171.  
  172.    
  173. I_END:
  174. align 4
  175. socketNum dd ?
  176.  
  177. rb 32 ; this is for stack
  178.  
  179. mem:
  180.  
  181.