Subversion Repositories Kolibri OS

Rev

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

Rev 132 Rev 485
1
;
1
;
2
;    Remote Control Center(Server)
2
;    Remote Control Center(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
;
10
;
11
;    Compile with FASM for Menuet
11
;    Compile with FASM for Menuet
12
;    Š®¬¯¨«¨àã¥âáï FASM'®¬ ¤«ï Œ¥­ãí⠎‘
12
;    Š®¬¯¨«¨àã¥âáï FASM'®¬ ¤«ï Œ¥­ãí⠎‘
13
;
13
;
14
   
14
   
15
use32
15
use32
16
   
16
   
17
                org     0x0
17
                org     0x0
18
   
18
   
19
 	        db     'MENUET01'      ; 8 byte id
19
 	        db     'MENUET01'      ; 8 byte id
20
  	        dd     0x01            ; header version
20
  	        dd     0x01            ; header version
21
 	        dd     START           ; start of code
21
 	        dd     START           ; start of code
22
  	        dd     I_END           ; size of image
22
  	        dd     I_END           ; size of image
23
  	        dd     0x5000          ; memory for app
23
  	        dd     0x5000          ; memory for app
24
  	        dd     0x5000          ; esp
24
  	        dd     0x5000          ; esp
25
  	        dd     0x0 , 0x0       ; I_Param , I_Icon
25
  	        dd     0x0 , 0x0       ; I_Param , I_Icon
26
   
26
   
27
include 'lang.inc'
27
include 'lang.inc'
28
include 'macros.inc'
28
include '..\..\..\macros.inc'
29
remote_ip  db  192,168,0,1
29
remote_ip  db  192,168,0,1
30
   
30
   
31
   
31
   
32
START:                      ; start of execution
32
START:                      ; start of execution
33
   
33
   
34
    mov  eax, 53                  ; open receiver socket
34
    mov  eax, 53                  ; open receiver socket
35
    mov  ebx, 0
35
    mov  ebx, 0
36
    mov  ecx, 0x6100              ; local port
36
    mov  ecx, 0x6100              ; local port
37
    mov  edx, 0x6000              ; remote port
37
    mov  edx, 0x6000              ; remote port
38
    mov  esi, dword [remote_ip]   ; remote IP
38
    mov  esi, dword [remote_ip]   ; remote IP
39
    int  0x40
39
    mcall
40
    mov  [socket],eax
40
    mov  [socket],eax
41
    mov  [0],eax                  ; save for remote code
41
    mov  [0],eax                  ; save for remote code
-
 
42
 
42
   
43
red:   
43
    call draw_window            ; at first, draw the window
44
    call draw_window            ; at first, draw the window
44
   
45
   
45
still:
46
still:
46
   
47
   
47
    mov  eax,23                 ; wait here for event
48
    mov  eax,23                 ; wait here for event
48
    mov  ebx,1
49
    mov  ebx,1
49
    int  0x40
50
    mcall
50
   
51
   
51
    cmp  eax,1                  ; redraw request ?
52
    cmp  eax,1                  ; redraw request ?
52
    jz   red
53
    jz   red
53
    cmp  eax,2                  ; key in buffer ?
54
    cmp  eax,2                  ; key in buffer ?
54
    jz   key
55
    jz   key
55
    cmp  eax,3                  ; button in buffer ?
56
    cmp  eax,3                  ; button in buffer ?
56
    jz   button
57
    jz   button
57
   
58
   
58
    mov  eax,53                 ; data from cluster terminal ?
59
    mov  eax,53                 ; data from cluster terminal ?
59
    mov  ebx,2
60
    mov  ebx,2
60
    mov  ecx,[socket]
61
    mov  ecx,[socket]
61
    int  0x40
62
    mcall
62
   
63
   
63
    cmp  eax,0
64
    cmp  eax,0
64
    jne  data_arrived
65
    jne  data_arrived
65
   
66
   
66
    jmp  still
67
    jmp  still
67
   
-
 
68
red:
-
 
69
    call draw_window
-
 
70
    jmp  still
-
 
71
   
68
   
72
key:
69
key:
73
    mov  eax,2
70
    mov  eax,2
74
    int  0x40
71
    mcall
75
    jmp  still
72
    jmp  still
76
   
73
   
77
button:
74
button:
78
   
75
   
79
    mov  eax,53
76
    mov  eax,53
80
    mov  ebx,1
77
    mov  ebx,1
81
    mov  ecx,[socket]
78
    mov  ecx,[socket]
82
    int  0x40
79
    mcall
83
    mov  eax,-1
80
    or  eax,-1
84
    int  0x40
81
    mcall
85
   
82
   
86
   
83
   
87
data_arrived:
84
data_arrived:
88
   
85
   
89
    mov  eax,5                 ; wait a second for everything to arrive
86
    mov  eax,5                 ; wait a second for everything to arrive
90
    mov  ebx,10
87
    mov  ebx,10
91
    int  0x40
88
    mcall
92
   
89
   
93
    mov  edi,I_END
90
    mov  edi,I_END
94
   
91
   
95
  get_data:
92
  get_data:
96
   
93
   
97
    mov  eax,53
94
    mov  eax,53
98
    mov  ebx,3
95
    mov  ebx,3
99
    mov  ecx,[socket]
96
    mov  ecx,[socket]
100
    int  0x40
97
    mcall
101
   
98
   
102
    mov  [edi],bl
99
    mov  [edi],bl
103
    inc  edi
100
    inc  edi
104
   
101
   
105
    mov  eax,53
102
    mov  eax,53
106
    mov  ebx,2
103
    mov  ebx,2
107
    mov  ecx,[socket]
104
    mov  ecx,[socket]
108
    int  0x40
105
    mcall
109
   
106
   
110
    cmp  eax,0
107
    cmp  eax,0
111
    jne  get_data
108
    jne  get_data
112
   
109
   
113
    cmp  byte [I_END],'C'   ;Connect ?
110
    cmp  byte [I_END],'C'   ;Connect ?
114
    jne  no_con
111
    jne  no_con
115
    mov  eax,4
112
    mov  eax,4
116
    mov  ebx,10*65536+60
113
    mov  ebx,10*65536+60
117
    add  ebx,[y]
114
    add  ebx,[y]
118
    mov  ecx,0x000000
115
    mov  ecx,0x000000
119
    mov  edx,inp_con
116
    mov  edx,inp_con
120
    mov  esi,inp_con.len
117
    mov  esi,inp_con.len
121
    int  0x40
118
    mcall
122
    add  [y],10
119
    add  [y],10
123
 
120
 
124
    jmp  still
121
    jmp  still
125
 
122
 
126
no_con:
123
no_con:
127
    cmp  byte [I_END],'S'   ; Shutdown ?
124
    cmp  byte [I_END],'S'   ; Shutdown ?
128
    jne  no_shut
125
    jne  no_shut
129
    mov  eax,4
126
    mov  eax,4
130
    mov  ebx,10*65536+60
127
    mov  ebx,10*65536+60
131
    add  ebx,[y]
128
    add  ebx,[y]
132
    mov  ecx,0x000000
129
    mov  ecx,0x000000
133
    mov  edx,inp_shut
130
    mov  edx,inp_shut
134
    mov  esi,inp_shut.len
131
    mov  esi,inp_shut.len
135
    int  0x40
132
    mcall
136
    add  [y],10
133
    add  [y],10
137
 
134
 
138
    mov  eax,18
135
    mov  eax,18
139
    mov  ebx,9
136
    mov  ebx,9
140
    mov  ecx,2
137
    mov  ecx,2
141
    int  0x40
138
    mcall
142
 
139
 
143
    jmp  still
140
    jmp  still
144
 
141
 
145
no_shut:
142
no_shut:
146
    cmp  byte [I_END],'R'   ; Reboot ?
143
    cmp  byte [I_END],'R'   ; Reboot ?
147
    jne  no_reb
144
    jne  no_reb
148
    mov  eax,4
145
    mov  eax,4
149
    mov  ebx,10*65536+60
146
    mov  ebx,10*65536+60
150
    add  ebx,[y]
147
    add  ebx,[y]
151
    mov  ecx,0x000000
148
    mov  ecx,0x000000
152
    mov  edx,inp_reb
149
    mov  edx,inp_reb
153
    mov  esi,inp_reb.len
150
    mov  esi,inp_reb.len
154
    int  0x40
151
    mcall
155
    add  [y],10
152
    add  [y],10
156
 
153
 
157
    mov  eax,18
154
    mov  eax,18
158
    mov  ebx,9
155
    mov  ebx,9
159
    mov  ecx,3
156
    mov  ecx,3
160
    int  0x40
157
    mcall
161
    jmp  still
158
    jmp  still
162
 
159
 
163
no_reb:
160
no_reb:
164
    cmp  byte [I_END],'F'   ; Save image on floppi ?
161
    cmp  byte [I_END],'F'   ; Save image on floppi ?
165
    jne  no_savefi
162
    jne  no_savefi
166
    mov  eax,4
163
    mov  eax,4
167
    mov  ebx,10*65536+60
164
    mov  ebx,10*65536+60
168
    add  ebx,[y]
165
    add  ebx,[y]
169
    mov  ecx,0x000000
166
    mov  ecx,0x000000
170
    mov  edx,inp_savefi
167
    mov  edx,inp_savefi
171
    mov  esi,inp_savefi.len
168
    mov  esi,inp_savefi.len
172
    int  0x40
169
    mcall
173
    add  [y],10
170
    add  [y],10
174
 
171
 
175
    mov  eax,18
172
    mov  eax,18
176
    mov  ebx,9
173
    mov  ebx,9
177
    mov  ecx,1
174
    mov  ecx,1
178
    int  0x40
175
    mcall
179
    jmp  still
176
    jmp  still
180
 
177
 
181
no_savefi:
178
no_savefi:
182
    cmp  byte [I_END],'H'   ; Save image on hard disk ?
179
    cmp  byte [I_END],'H'   ; Save image on hard disk ?
183
    jne  no_savehi
180
    jne  no_savehi
184
    mov  eax,4
181
    mov  eax,4
185
    mov  ebx,10*65536+60
182
    mov  ebx,10*65536+60
186
    add  ebx,[y]
183
    add  ebx,[y]
187
    mov  ecx,0x000000
184
    mov  ecx,0x000000
188
    mov  edx,inp_savehi
185
    mov  edx,inp_savehi
189
    mov  esi,inp_savehi.len
186
    mov  esi,inp_savehi.len
190
    int  0x40
187
    mcall
191
    add  [y],10
188
    add  [y],10
192
 
189
 
193
    mov  eax,18
190
    mov  eax,18
194
    mov  ebx,6
191
    mov  ebx,6
195
    mov  ecx,2
192
    mov  ecx,2
196
    int  0x40
193
    mcall
197
 
194
 
198
    jmp  still
195
    jmp  still
199
 
196
 
200
no_savehi:
197
no_savehi:
201
    cmp  byte [I_END],'O'   ; Hot reboot ?
198
    cmp  byte [I_END],'O'   ; Hot reboot ?
202
    jne  no_hotreb
199
    jne  no_hotreb
203
    mov  eax,4
200
    mov  eax,4
204
    mov  ebx,10*65536+60
201
    mov  ebx,10*65536+60
205
    add  ebx,[y]
202
    add  ebx,[y]
206
    mov  ecx,0x000000
203
    mov  ecx,0x000000
207
    mov  edx,inp_hotreb
204
    mov  edx,inp_hotreb
208
    mov  esi,inp_hotreb.len
205
    mov  esi,inp_hotreb.len
209
    int  0x40
206
    mcall
210
    add  [y],10
207
    add  [y],10
211
 
208
 
212
    mov  eax,18
209
    mov  eax,18
213
    mov  ebx,9
210
    mov  ebx,9
214
    mov  ecx,4
211
    mov  ecx,4
215
    int  0x40
212
    mcall
216
    jmp  still
213
    jmp  still
217
 
214
 
218
no_hotreb:
215
no_hotreb:
219
    cmp  byte [I_END],'E'   ; Unload server ?
216
    cmp  byte [I_END],'E'   ; Unload server ?
220
    jne  no_com
217
    jne  no_com
221
    mov  eax,4
218
    mov  eax,4
222
    mov  ebx,10*65536+60
219
    mov  ebx,10*65536+60
223
    add  ebx,[y]
220
    add  ebx,[y]
224
    mov  ecx,0x000000
221
    mov  ecx,0x000000
225
    mov  edx,inp_exit
222
    mov  edx,inp_exit
226
    mov  esi,inp_exit.len
223
    mov  esi,inp_exit.len
227
    int  0x40
224
    mcall
228
    add  [y],10
225
    add  [y],10
229
    
226
    
230
    call button
227
    call button
231
    jmp  still
228
    jmp  still
232
 
229
 
233
no_com:
230
no_com:
234
    mov  eax,4
231
    mov  eax,4
235
    mov  ebx,10*65536+60
232
    mov  ebx,10*65536+60
236
    add  ebx,[y]
233
    add  ebx,[y]
237
    mov  ecx,0x000000
234
    mov  ecx,0x000000
238
    mov  edx,inp_com
235
    mov  edx,inp_com
239
    mov  esi,inp_com.len
236
    mov  esi,inp_com.len
240
    int  0x40
237
    mcall
241
    add  [y],10
238
    add  [y],10
242
 
239
 
243
    jmp  still
240
    jmp  still
244
   
241
   
245
;   *********************************************
242
;   *********************************************
246
;   *******  WINDOW DEFINITIONS AND DRAW ********
243
;   *******  WINDOW DEFINITIONS AND DRAW ********
247
;   *********************************************
244
;   *********************************************
248
   
245
   
249
   
246
   
250
draw_window:
247
draw_window:
251
   
248
   
252
    mov  eax,12                    ; function 12:tell os about windowdraw
249
    mov  eax,12                    ; function 12:tell os about windowdraw
253
    mov  ebx,1                     ; 1, start of draw
250
    mov  ebx,1                     ; 1, start of draw
254
    int  0x40
251
    mcall
255
   
252
   
256
                                   ; DRAW WINDOW
253
                                   ; DRAW WINDOW
257
    mov  eax,0                     ; function 0 : define and draw window
254
    mov  eax,0                     ; function 0 : define and draw window
258
    mov  ebx,100*65536+300         ; [x start] *65536 + [x size]
255
    mov  ebx,100*65536+300         ; [x start] *65536 + [x size]
259
    mov  ecx,100*65536+330         ; [y start] *65536 + [y size]
256
    mov  ecx,100*65536+330         ; [y start] *65536 + [y size]
260
    mov  edx,0x03ffffff            ; color of work area RRGGBB
257
    mov  edx,0x13ffffff            ; color of work area RRGGBB
261
    mov  esi,0x80aabbcc            ; color of grab bar  RRGGBB,8->color gl
-
 
262
    mov  edi,0x00aabbcc            ; color of frames    RRGGBB
258
    mov  edi,title                 ; WINDOW LABEL
263
    int  0x40
-
 
264
   
-
 
265
    mov  eax,8
259
    mcall
266
    mov  ebx,(286-19)*65536+12
-
 
267
    mov  ecx,4*65536+12
-
 
268
    mov  edx,1
-
 
269
    mov  esi,0xaabbcc
-
 
270
;    int  0x40
-
 
271
   
260
   
272
                                   ; WINDOW LABEL
-
 
273
    mov  eax,4                     ; function 4 : write text to window
-
 
274
    mov  ebx,8*65536+8             ; [x start] *65536 + [y start]
-
 
275
    mov  ecx,0x00ffffff            ; color of text RRGGBB
-
 
276
    mov  edx,labeltext             ; pointer to text beginning
-
 
277
    mov  esi,lte-labeltext         ; text length
-
 
278
    int  0x40
-
 
279
   
261
   
280
    ; Re-draw the screen text
262
    ; Re-draw the screen text
281
    cld
263
    cld
-
 
264
    mov  eax,4
282
    mov  ebx,10*65536+30           ; draw info text with function 4
265
    mov  ebx,10*65536+30           ; draw info text with function 4
283
    mov  ecx,0x000000
266
    mov  ecx,0x000000
284
    mov  edx,text
267
    mov  edx,text
285
    mov  esi,40
268
    mov  esi,40
286
  newline:
269
  newline:
287
    mov  eax,4
270
    mcall
288
    int  0x40
-
 
289
    add  ebx,16
271
    add  ebx,16
290
    add  edx,40
272
    add  edx,40
291
    cmp  [edx],byte 'x'
273
    cmp  [edx],byte 'x'
292
    jnz  newline
274
    jnz  newline
293
   
275
   
294
   
276
   
295
    mov  eax,12                    ; function 12:tell os about windowdraw
277
    mov  eax,12                    ; function 12:tell os about windowdraw
296
    mov  ebx,2                     ; 2, end of draw
278
    mov  ebx,2                     ; 2, end of draw
297
    int  0x40
279
    mcall
298
   
280
   
299
    ret
281
    ret
300
   
282
   
301
   
283
   
302
; DATA AREA
284
; DATA AREA
303
   
285
   
304
   
286
   
305
text:
287
text:
306
if lang eq ru
288
if lang eq ru
307
    db '„ ­­ë©  ¤à¥á        : 192.168.0.2       '
289
    db '„ ­­ë©  ¤à¥á        : 192.168.0.2       '
308
    db 'à®á«ã訢 ¥¬ë© ¯®àâ : 0x6100            '
290
    db 'à®á«ã訢 ¥¬ë© ¯®àâ : 0x6100            '
309
    db '‘®áâ®ï­¨¥:                              '
291
    db '‘®áâ®ï­¨¥:                              '
310
    db 'x' ; <- END MARKER, DONT DELETE
292
    db 'x' ; <- END MARKER, DONT DELETE
311
else
293
else
312
    db 'This address        : 192.168.0.2       '
294
    db 'This address        : 192.168.0.2       '
313
    db 'Used port           : 0x6100            '
295
    db 'Used port           : 0x6100            '
314
    db 'Status:                                 '
296
    db 'Status:                                 '
315
    db 'x' ; <- END MARKER, DONT DELETE
297
    db 'x' ; <- END MARKER, DONT DELETE
316
end if
298
end if
317
   
299
   
318
labeltext:  db  'Remote Control Center(Server)'
-
 
319
lte:
300
title  db  'Remote Control Center(Server)',0
320
   
301
   
321
socket   dd  0x0
302
socket   dd  0x0
322
y   dd   0x10
303
y   dd   0x10
323
sysclock dd 0x0
304
sysclock dd 0x0
324
 
305
 
325
if lang eq ru
306
if lang eq ru
326
inp_con db '‚­¨¬ ­¨¥, ¯®¤ª«î稫áï ª«¨¥­â!'
307
inp_con db '‚­¨¬ ­¨¥, ¯®¤ª«î稫áï ª«¨¥­â!'
327
.len = $-inp_con
308
.len = $-inp_con
328
inp_shut db 'ˆ¤ñ⠮⪫î祭¨¥ á¨á⥬ë...'
309
inp_shut db 'ˆ¤ñ⠮⪫î祭¨¥ á¨á⥬ë...'
329
.len = $-inp_shut
310
.len = $-inp_shut
330
inp_reb db 'ˆ¤ñâ ¯¥à¥§ £à㧪 ...'
311
inp_reb db 'ˆ¤ñâ ¯¥à¥§ £à㧪 ...'
331
.len = $-inp_reb
312
.len = $-inp_reb
332
inp_savefi db '‘®å࠭塞 ¨¬¥¤¦ ­  ¤¨áª¥âã...'
313
inp_savefi db '‘®å࠭塞 ¨¬¥¤¦ ­  ¤¨áª¥âã...'
333
.len = $-inp_savefi
314
.len = $-inp_savefi
334
inp_savehi db '‘®å࠭塞 ¨¬¥¤¦ ­  †. ¤¨áª...'
315
inp_savehi db '‘®å࠭塞 ¨¬¥¤¦ ­  †. ¤¨áª...'
335
.len = $-inp_savehi
316
.len = $-inp_savehi
336
inp_hotreb db 'ˆ¤ñâ £®àï稩 à¥áâ àâ ï¤à ...'
317
inp_hotreb db 'ˆ¤ñâ £®àï稩 à¥áâ àâ ï¤à ...'
337
.len = $-inp_hotreb
318
.len = $-inp_hotreb
338
inp_exit db '‚ë室 ¨§ ¯à®£à ¬¬ë...'
319
inp_exit db '‚ë室 ¨§ ¯à®£à ¬¬ë...'
339
.len = $-inp_exit
320
.len = $-inp_exit
340
inp_com db '¥®¯®§­ ­­ ï ª®¬¬ ­¤ !'
321
inp_com db '¥®¯®§­ ­­ ï ª®¬¬ ­¤ !'
341
.len = $-inp_com
322
.len = $-inp_com
342
else
323
else
343
inp_con db 'Note, client has been connected!'
324
inp_con db 'Note, client has been connected!'
344
.len = $-inp_con
325
.len = $-inp_con
345
inp_shut db 'Turn off in progress...'
326
inp_shut db 'Turn off in progress...'
346
.len = $-inp_shut
327
.len = $-inp_shut
347
inp_reb db 'Reboot in progress...'
328
inp_reb db 'Reboot in progress...'
348
.len = $-inp_reb
329
.len = $-inp_reb
349
inp_savefi db 'Saving image to floppy...'
330
inp_savefi db 'Saving image to floppy...'
350
.len = $-inp_savefi
331
.len = $-inp_savefi
351
inp_savehi db 'Saving image to hard disk...'
332
inp_savehi db 'Saving image to hard disk...'
352
.len = $-inp_savehi
333
.len = $-inp_savehi
353
inp_hotreb db 'Kernel restart in progress...'
334
inp_hotreb db 'Kernel restart in progress...'
354
.len = $-inp_hotreb
335
.len = $-inp_hotreb
355
inp_exit db 'Exiting from program...'
336
inp_exit db 'Exiting from program...'
356
.len = $-inp_exit
337
.len = $-inp_exit
357
inp_com db 'Unknown command!'
338
inp_com db 'Unknown command!'
358
.len = $-inp_com
339
.len = $-inp_com
359
end if
340
end if
360
I_END:
341
I_END: