Subversion Repositories Kolibri OS

Rev

Rev 109 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 109 Rev 131
1
;
1
;
2
;    NetSend(Server)
2
;    NetSend(Server)
3
;                                
3
;                                
4
;    €¢â®à: Hex
4
;    €¢â®à: Hex
5
;    ‘ ©â: www.mestack.narod.ru
5
;    ‘ ©â: www.mestack.narod.ru
6
;    
6
;    
7
;    Ž¯¨á ­¨¥:
7
;    Ž¯¨á ­¨¥:
8
;    à®£à ¬¬  ¤«ï ®¡¬¥­  á®®¡é¥­¨ï¬¨ ¢ á¥â¨.‘¥à¢¥à­ ï ç áâì.
8
;    à®£à ¬¬  ¤«ï ®¡¬¥­  á®®¡é¥­¨ï¬¨ ¢ á¥â¨.‘¥à¢¥à­ ï ç áâì.
9
;
9
;
10
;    Compile with FASM for Menuet
10
;    Compile with FASM for Menuet
11
;    Š®¬¯¨«¨àã¥âáï FASM'®¬ ¤«ï Œ¥­ãí⠎‘
11
;    Š®¬¯¨«¨àã¥âáï FASM'®¬ ¤«ï Œ¥­ãí⠎‘
12
;
12
;
13
   
13
   
14
use32
14
use32
15
   
15
   
16
                org     0x0
16
                org     0x0
17
   
17
   
18
                db      'MENUET00'              ; 8 byte id
18
                db      'MENUET00'              ; 8 byte id
19
                dd      38                      ; required os
19
                dd      38                      ; required os
20
                dd      START                   ; program start
20
                dd      START                   ; program start
21
                dd      I_END                   ; program image size
21
                dd      I_END                   ; program image size
22
                dd      0x100000                ; required amount of memory
22
                dd      0x100000                ; required amount of memory
23
                dd      0x00000000              ; reserved=no extended header
23
                dd      0x00000000              ; reserved=no extended header
24
   
24
   
25
include 'lang.inc'
25
include 'lang.inc'
26
include 'macros.inc'
26
include 'macros.inc'
27
remote_ip  db  192,168,0,1
27
remote_ip  db  192,168,0,1
28
   
28
   
29
   
29
   
30
START:                      ; start of execution
30
START:                      ; start of execution
31
   
31
   
32
    mov  eax, 53                  ; open receiver socket
32
    mov  eax, 53                  ; open receiver socket
33
    mov  ebx, 0
33
    mov  ebx, 0
34
    mov  ecx, 0x5000              ; local port
34
    mov  ecx, 0x5000              ; local port
35
    mov  edx, 0xffff              ; remote port
35
    mov  edx, 0xffff              ; remote port
36
    mov  esi, dword [remote_ip]   ; remote IP
36
    mov  esi, dword [remote_ip]   ; remote IP
37
    int  0x40
37
    int  0x40
38
    mov  [socketNum],eax
38
    mov  [socketNum],eax
39
    mov  [0],eax                  ; save for remote code
39
    mov  [0],eax                  ; save for remote code
40
   
40
   
41
    call draw_window            ; at first, draw the window
41
    call draw_window            ; at first, draw the window
42
   
42
   
43
still:
43
still:
44
   
44
   
45
    mov  eax,23                 ; wait here for event
45
    mov  eax,23                 ; wait here for event
46
    mov  ebx,1
46
    mov  ebx,1
47
    int  0x40
47
    int  0x40
48
   
48
   
49
    cmp  eax,1                  ; redraw request ?
49
    cmp  eax,1                  ; redraw request ?
50
    jz   red
50
    jz   red
51
    cmp  eax,2                  ; key in buffer ?
51
    cmp  eax,2                  ; key in buffer ?
52
    jz   key
52
    jz   key
53
    cmp  eax,3                  ; button in buffer ?
53
    cmp  eax,3                  ; button in buffer ?
54
    jz   button
54
    jz   button
55
   
55
   
56
    mov  eax,53                 ; data from cluster terminal ?
56
    mov  eax,53                 ; data from cluster terminal ?
57
    mov  ebx,2
57
    mov  ebx,2
58
    mov  ecx,[socketNum]
58
    mov  ecx,[socketNum]
59
    int  0x40
59
    int  0x40
60
   
60
   
61
    cmp  eax,0
61
    cmp  eax,0
62
    jne  data_arrived
62
    jne  data_arrived
63
   
63
   
64
    jmp  still
64
    jmp  still
65
   
65
   
66
red:
66
red:
67
    call draw_window
67
    call draw_window
68
    jmp  still
68
    jmp  still
69
   
69
   
70
key:
70
key:
71
    mov  eax,2
71
    mov  eax,2
72
    int  0x40
72
    int  0x40
73
    jmp  still
73
    jmp  still
74
   
74
   
75
button:
75
button:
76
   
76
   
77
    mov  eax,53
77
    mov  eax,53
78
    mov  ebx,1
78
    mov  ebx,1
79
    mov  ecx,[socketNum]
79
    mov  ecx,[socketNum]
80
    int  0x40
80
    int  0x40
81
    mov  eax,-1
81
    mov  eax,-1
82
    int  0x40
82
    int  0x40
83
   
83
   
84
   
84
   
85
data_arrived:
85
data_arrived:
86
   
86
   
87
    mov  eax,5                 ; wait a second for everything to arrive
87
    mov  eax,5                 ; wait a second for everything to arrive
88
    mov  ebx,10
88
    mov  ebx,10
89
    int  0x40
89
    int  0x40
90
   
90
   
91
    mov  edi,I_END
91
    mov  edi,I_END
92
   
92
   
93
  get_data:
93
  get_data:
94
   
94
   
95
    mov  eax,53
95
    mov  eax,53
96
    mov  ebx,3
96
    mov  ebx,3
97
    mov  ecx,[socketNum]
97
    mov  ecx,[socketNum]
98
    int  0x40
98
    int  0x40
99
   
99
   
100
    mov  [edi],bl
100
    mov  [edi],bl
101
    inc  edi
101
    inc  edi
102
   
102
   
103
    mov  eax,53
103
    mov  eax,53
104
    mov  ebx,2
104
    mov  ebx,2
105
    mov  ecx,[socketNum]
105
    mov  ecx,[socketNum]
106
    int  0x40
106
    int  0x40
107
   
107
   
108
    cmp  eax,0
108
    cmp  eax,0
109
    jne  get_data
109
    jne  get_data
110
   
110
   
111
    mov  eax,4
111
    mov  eax,4
112
    mov  ebx,10*65536+60
112
    mov  ebx,10*65536+60
113
    add  ebx,[y]
113
    add  ebx,[y]
114
    mov  ecx,0x000000
114
    mov  ecx,0x000000
115
    mov  edx,I_END
115
    mov  edx,I_END
116
    mov  esi,100
116
    mov  esi,100
117
    int  0x40
117
    int  0x40
118
   
118
   
119
    add  [y],10
119
    add  [y],10
120
   
120
   
121
    jmp  still
121
    jmp  still
122
   
122
   
123
y   dd   0x10
123
y   dd   0x10
124
   
124
   
125
   
125
   
126
   
126
   
127
;   *********************************************
127
;   *********************************************
128
;   *******  WINDOW DEFINITIONS AND DRAW ********
128
;   *******  WINDOW DEFINITIONS AND DRAW ********
129
;   *********************************************
129
;   *********************************************
130
   
130
   
131
   
131
   
132
draw_window:
132
draw_window:
133
   
133
   
134
    mov  eax,12                    ; function 12:tell os about windowdraw
134
    mov  eax,12                    ; function 12:tell os about windowdraw
135
    mov  ebx,1                     ; 1, start of draw
135
    mov  ebx,1                     ; 1, start of draw
136
    int  0x40
136
    int  0x40
137
   
137
   
138
                                   ; DRAW WINDOW
138
                                   ; DRAW WINDOW
139
    mov  eax,0                     ; function 0 : define and draw window
139
    mov  eax,0                     ; function 0 : define and draw window
140
    mov  ebx,100*65536+300         ; [x start] *65536 + [x size]
140
    mov  ebx,100*65536+300         ; [x start] *65536 + [x size]
141
    mov  ecx,100*65536+330         ; [y start] *65536 + [y size]
141
    mov  ecx,100*65536+330         ; [y start] *65536 + [y size]
142
    mov  edx,0x03ffffff            ; color of work area RRGGBB
142
    mov  edx,0x03ffffff            ; color of work area RRGGBB
143
    mov  esi,0x80aabbcc            ; color of grab bar  RRGGBB,8->color gl
143
    mov  esi,0x80aabbcc            ; color of grab bar  RRGGBB,8->color gl
144
    mov  edi,0x00aabbcc            ; color of frames    RRGGBB
144
    mov  edi,0x00aabbcc            ; color of frames    RRGGBB
145
    int  0x40
145
    int  0x40
146
   
146
   
147
    mov  eax,8
147
    mov  eax,8
148
    mov  ebx,(286-19)*65536+12
148
    mov  ebx,(286-19)*65536+12
149
    mov  ecx,4*65536+12
149
    mov  ecx,4*65536+12
150
    mov  edx,1
150
    mov  edx,1
151
    mov  esi,0xaabbcc
151
    mov  esi,0xaabbcc
152
;    int  0x40
152
;    int  0x40
153
   
153
   
154
                                   ; WINDOW LABEL
154
                                   ; WINDOW LABEL
155
    mov  eax,4                     ; function 4 : write text to window
155
    mov  eax,4                     ; function 4 : write text to window
156
    mov  ebx,8*65536+8             ; [x start] *65536 + [y start]
156
    mov  ebx,8*65536+8             ; [x start] *65536 + [y start]
157
    mov  ecx,0x00ffffff            ; color of text RRGGBB
157
    mov  ecx,0x00ffffff            ; color of text RRGGBB
158
    mov  edx,labeltext             ; pointer to text beginning
158
    mov  edx,labeltext             ; pointer to text beginning
159
    mov  esi,lte-labeltext         ; text length
159
    mov  esi,lte-labeltext         ; text length
160
    int  0x40
160
    int  0x40
161
   
161
   
162
    ; Re-draw the screen text
162
    ; Re-draw the screen text
163
    cld
163
    cld
164
    mov  ebx,10*65536+30           ; draw info text with function 4
164
    mov  ebx,10*65536+30           ; draw info text with function 4
165
    mov  ecx,0x000000
165
    mov  ecx,0x000000
166
    mov  edx,text
166
    mov  edx,text
167
    mov  esi,40
167
    mov  esi,40
168
  newline:
168
  newline:
169
    mov  eax,4
169
    mov  eax,4
170
    int  0x40
170
    int  0x40
171
    add  ebx,16
171
    add  ebx,16
172
    add  edx,40
172
    add  edx,40
173
    cmp  [edx],byte 'x'
173
    cmp  [edx],byte 'x'
174
    jnz  newline
174
    jnz  newline
175
   
175
   
176
   
176
   
177
    mov  eax,12                    ; function 12:tell os about windowdraw
177
    mov  eax,12                    ; function 12:tell os about windowdraw
178
    mov  ebx,2                     ; 2, end of draw
178
    mov  ebx,2                     ; 2, end of draw
179
    int  0x40
179
    int  0x40
180
   
180
   
181
    ret
181
    ret
182
   
182
   
183
   
183
   
184
; DATA AREA
184
; DATA AREA
185
   
185
   
186
   
186
if lang eq ru   
187
text:
187
text:
188
    db '„ ­­ë©  ¤à¥á        : 192.168.0.2       '
188
    db '„ ­­ë©  ¤à¥á        : 192.168.0.2       '
189
    db 'à®á«ã訢 ¥¬ë© ¯®àâ : 0x5000            '
189
    db 'à®á«ã訢 ¥¬ë© ¯®àâ : 0x5000            '
190
    db 'à¨á« ­­ë¥ á®®¡é¥­¨ï:                   '
190
    db 'à¨á« ­­ë¥ á®®¡é¥­¨ï:                   '
191
    db 'x <- END MARKER, DONT DELETE            '
191
    db 'x' ; <- END MARKER, DONT DELETE
192
   
192
else
-
 
193
text:
-
 
194
    db 'This address     : 192.168.0.2          '
-
 
195
    db 'Used port        : 0x5000               '
-
 
196
    db 'Received messages:                      '
-
 
197
    db 'x' ; <- END MARKER, DONT DELETE
-
 
198
end if
193
   
199
   
194
labeltext:  db  'NetSend(Server)'
200
labeltext:  db  'NetSend(Server)'
195
lte:
201
lte:
196
   
202
   
197
socketNum   dd  0x0
203
socketNum   dd  0x0
198
  
204
  
199
 
205
 
200
I_END:
206
I_END:
201
-
 
202
-
 
203
-
 
204
-
 
205
-
 
206
-
 
207
-
 
208
207