Subversion Repositories Kolibri OS

Rev

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

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