Rev 3704 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3704 | Rev 4376 | ||
---|---|---|---|
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2010-2013. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2010-2013. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;; Synergyc.asm - Synergy client for KolibriOS ;; |
6 | ;; Synergyc.asm - Synergy client for KolibriOS ;; |
7 | ;; ;; |
7 | ;; ;; |
8 | ;; Written by hidnplayr@kolibrios.org ;; |
8 | ;; Written by hidnplayr@kolibrios.org ;; |
9 | ;; ;; |
9 | ;; ;; |
10 | ;; GNU GENERAL PUBLIC LICENSE ;; |
10 | ;; GNU GENERAL PUBLIC LICENSE ;; |
11 | ;; Version 2, June 1991 ;; |
11 | ;; Version 2, June 1991 ;; |
12 | ;; ;; |
12 | ;; ;; |
13 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
13 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
14 | 14 | ||
15 | format binary as "" |
15 | format binary as "" |
16 | 16 | ||
17 | BUFFERSIZE = 1024 |
17 | BUFFERSIZE = 1024 |
18 | DEFAULTPORT = 24800 |
18 | DEFAULTPORT = 24800 |
19 | 19 | ||
20 | use32 |
20 | use32 |
21 | org 0x0 |
21 | org 0x0 |
22 | 22 | ||
23 | db 'MENUET01' ; signature |
23 | db 'MENUET01' ; signature |
24 | dd 1 ; header version |
24 | dd 1 ; header version |
25 | dd start ; entry point |
25 | dd start ; entry point |
26 | dd i_end ; initialized size |
26 | dd i_end ; initialized size |
27 | dd mem+0x1000 ; required memory |
27 | dd mem+0x1000 ; required memory |
28 | dd mem+0x1000 ; stack pointer |
28 | dd mem+0x1000 ; stack pointer |
29 | dd 0 ; parameters |
29 | dd 0 ; parameters |
30 | dd path ; path |
30 | dd path ; path |
31 | 31 | ||
32 | include '../../macros.inc' |
32 | include '../../macros.inc' |
33 | purge mov,add,sub |
33 | purge mov,add,sub |
34 | include '../../proc32.inc' |
34 | include '../../proc32.inc' |
35 | include '../../dll.inc' |
35 | include '../../dll.inc' |
36 | 36 | ||
37 | include '../../network.inc' |
37 | include '../../network.inc' |
38 | 38 | ||
39 | start: |
39 | start: |
40 | - | ||
41 | cld |
40 | |
42 | mov edi, path ; Calculate the length of zero-terminated string |
41 | mov edi, path ; Calculate the length of zero-terminated string |
43 | xor al, al |
42 | xor al, al |
44 | mov ecx, 1024 |
43 | mov ecx, 1024 |
45 | repne scasb |
44 | repne scasb |
46 | dec edi |
45 | dec edi |
47 | mov esi, filename ; append the path with '.ini' |
46 | mov esi, filename ; append the path with '.ini' |
48 | movsd |
47 | movsd |
49 | movsb |
48 | movsb |
50 | 49 | ||
51 | mcall 68, 11 |
50 | mcall 68, 11 |
- | 51 | mcall 66, 1, 1 |
|
52 | 52 | ||
53 | stdcall dll.Load, @IMPORT |
53 | stdcall dll.Load, @IMPORT |
54 | test eax, eax |
54 | test eax, eax |
55 | jnz exit |
55 | jnz exit |
56 | 56 | ||
57 | push 1 |
57 | push 1 |
58 | call [con_start] |
58 | call [con_start] |
59 | 59 | ||
60 | push title |
60 | push title |
61 | push 25 |
61 | push 25 |
62 | push 80 |
62 | push 80 |
63 | push 25 |
63 | push 25 |
64 | push 80 |
64 | push 80 |
65 | call [con_init] |
65 | call [con_init] |
66 | 66 | ||
67 | push str0 |
67 | push str0 |
68 | call [con_write_asciiz] |
68 | call [con_write_asciiz] |
69 | 69 | ||
70 | invoke ini.get_str, path, str_remote, str_ip, buffer_ptr, 16, 0 |
70 | invoke ini.get_str, path, str_remote, str_ip, buffer_ptr, 16, 0 |
71 | test eax, eax |
71 | test eax, eax |
72 | jnz error |
72 | jnz error |
73 | 73 | ||
74 | invoke ini.get_int, path, str_remote, str_port, DEFAULTPORT |
74 | invoke ini.get_int, path, str_remote, str_port, DEFAULTPORT |
75 | xchg al, ah |
75 | xchg al, ah |
76 | mov [sockaddr1.port], ax |
76 | mov [sockaddr1.port], ax |
77 | 77 | ||
78 | push str1 |
78 | push str1 |
79 | call [con_write_asciiz] |
79 | call [con_write_asciiz] |
80 | 80 | ||
81 | push buffer_ptr |
81 | push buffer_ptr |
82 | call [con_write_asciiz] |
82 | call [con_write_asciiz] |
83 | 83 | ||
84 | push newline |
84 | push newline |
85 | call [con_write_asciiz] |
85 | call [con_write_asciiz] |
86 | 86 | ||
87 | mcall socket, AF_INET4, SOCK_STREAM, 0 |
87 | mcall socket, AF_INET4, SOCK_STREAM, 0 |
88 | cmp eax, -1 |
88 | cmp eax, -1 |
89 | je error |
89 | je error |
90 | mov [socketnum], eax |
90 | mov [socketnum], eax |
91 | 91 | ||
92 | ; resolve name |
92 | ; resolve name |
93 | push esp ; reserve stack place |
93 | push esp ; reserve stack place |
94 | push esp ; ptr to result |
94 | push esp ; ptr to result |
95 | push 0 ; addrinfo hints |
95 | push 0 ; addrinfo hints |
96 | push 0 ; servname |
96 | push 0 ; servname |
97 | push buffer_ptr ; hostname |
97 | push buffer_ptr ; hostname |
98 | call [getaddrinfo] |
98 | call [getaddrinfo] |
99 | pop esi |
99 | pop esi |
100 | ; test for error |
100 | ; test for error |
101 | test eax, eax |
101 | test eax, eax |
102 | jnz error |
102 | jnz error |
103 | 103 | ||
104 | mov eax, [esi+addrinfo.ai_addr] |
104 | mov eax, [esi+addrinfo.ai_addr] |
105 | mov eax, [eax+sockaddr_in.sin_addr] |
105 | mov eax, [eax+sockaddr_in.sin_addr] |
106 | mov [sockaddr1.ip], eax |
106 | mov [sockaddr1.ip], eax |
107 | 107 | ||
108 | mcall connect, [socketnum], sockaddr1, 18 |
108 | mcall connect, [socketnum], sockaddr1, 18 |
109 | 109 | ||
110 | push str7 |
110 | push str7 |
111 | call [con_write_asciiz] |
111 | call [con_write_asciiz] |
112 | 112 | ||
113 | mcall 40, EVM_STACK |
113 | mcall 40, EVM_STACK |
- | 114 | mcall 10 |
|
114 | 115 | ||
115 | login: |
116 | login: |
116 | call wait_for_data |
117 | call wait_for_data |
117 | 118 | ||
118 | push buffer_ptr + 4 |
119 | push buffer_ptr + 4 |
119 | call [con_write_asciiz] |
120 | call [con_write_asciiz] |
120 | 121 | ||
121 | cmp dword [buffer_ptr], 11 shl 24 |
122 | cmp dword [buffer_ptr], 11 shl 24 ; length of string |
122 | jne login |
123 | jne error |
123 | cmp dword [buffer_ptr + 4], 'Syne' |
124 | cmp dword [buffer_ptr + 4], 'Syne' |
124 | jne login |
125 | jne error |
125 | cmp word [buffer_ptr + 8], 'rg' |
126 | cmp word [buffer_ptr + 8], 'rg' |
126 | jne login |
127 | jne error |
127 | cmp byte [buffer_ptr + 10], 'y' |
128 | cmp byte [buffer_ptr + 10], 'y' |
128 | jne login |
129 | jne error |
129 | 130 | ||
130 | push str2 |
131 | push str2 |
131 | call [con_write_asciiz] |
132 | call [con_write_asciiz] |
132 | 133 | ||
133 | lea edi, [buffer_ptr + 11 + 4 + 4] |
134 | lea edi, [buffer_ptr + 11 + 4 + 4] |
134 | invoke ini.get_str, path, str_local, str_name, edi, 255, 0 |
135 | invoke ini.get_str, path, str_local, str_name, edi, 255, 0 |
135 | xor al , al |
136 | xor al , al |
136 | mov ecx, 256 |
137 | mov ecx, 256 |
137 | repne scasb |
138 | repne scasb |
138 | sub edi, buffer_ptr + 1 + 4 |
139 | sub edi, buffer_ptr + 1 + 4 |
139 | mov esi, edi |
140 | mov esi, edi |
140 | bswap edi |
141 | bswap edi |
141 | mov dword [buffer_ptr], edi |
142 | mov dword [buffer_ptr], edi |
142 | mov edi, esi |
143 | mov edi, esi |
143 | sub edi, 11 + 4 |
144 | sub edi, 11 + 4 |
144 | bswap edi |
145 | bswap edi |
145 | mov dword [buffer_ptr + 11 + 4], edi |
146 | mov dword [buffer_ptr + 11 + 4], edi |
146 | add esi, 4 |
147 | add esi, 4 |
147 | 148 | ||
148 | mcall send, [socketnum], buffer_ptr, , 0 |
149 | mcall send, [socketnum], buffer_ptr, , 0 |
149 | 150 | ||
150 | mainloop: |
151 | mainloop: |
151 | call wait_for_data |
152 | call wait_for_data |
152 | mov edi, buffer_ptr |
153 | mov edi, buffer_ptr |
153 | 154 | ||
154 | .command: |
155 | .command: |
155 | push eax edi |
156 | push eax edi |
156 | 157 | ||
157 | cmp dword [edi + 4], 'QINF' ; query screen info |
158 | cmp dword [edi + 4], 'QINF' ; query screen info |
158 | je .qinf |
159 | je .qinf |
159 | 160 | ||
160 | cmp dword [edi + 4], 'CALV' ; alive ? |
161 | cmp dword [edi + 4], 'CALV' ; alive ? |
161 | je .calv |
162 | je .calv |
162 | 163 | ||
163 | cmp dword [edi + 4], 'CINN' ; mouse moved into screen |
164 | cmp dword [edi + 4], 'CINN' ; mouse moved into screen |
164 | je .cinn |
165 | je .cinn |
165 | 166 | ||
166 | cmp dword [edi + 4], 'DCLP' ; Clipboard event |
167 | cmp dword [edi + 4], 'DCLP' ; Clipboard event |
167 | je .dclp |
168 | je .dclp |
168 | 169 | ||
169 | cmp dword [edi + 4], 'DMMV' ; Mouse moved |
170 | cmp dword [edi + 4], 'DMMV' ; Mouse moved |
170 | je .dmmv |
171 | je .dmmv |
171 | 172 | ||
172 | cmp dword [edi + 4], 'COUT' ; leave screen |
173 | cmp dword [edi + 4], 'COUT' ; leave screen |
173 | je .cout |
174 | je .cout |
174 | 175 | ||
175 | cmp dword [edi + 4], 'DMDN' ; mouse button down |
176 | cmp dword [edi + 4], 'DMDN' ; mouse button down |
176 | je .dmdn |
177 | je .dmdn |
177 | 178 | ||
178 | cmp dword [edi + 4], 'DMUP' ; mouse button released |
179 | cmp dword [edi + 4], 'DMUP' ; mouse button released |
179 | je .dmup |
180 | je .dmup |
180 | 181 | ||
181 | cmp dword [edi + 4], 'CNOP' ; no operation |
182 | cmp dword [edi + 4], 'CNOP' ; no operation |
182 | je .next |
183 | je .next |
183 | 184 | ||
184 | cmp dword [edi + 4], 'CIAK' ; resolution changed? |
185 | cmp dword [edi + 4], 'CIAK' ; resolution changed? |
185 | je .ciak |
186 | je .ciak |
- | 187 | ||
- | 188 | ; cmp dword [edi + 4], 'DMWM' ; mouse wheel moved |
|
- | 189 | ; je .dmwm |
|
- | 190 | ||
- | 191 | cmp dword [edi + 4], 'DKDN' ; Key pressed |
|
- | 192 | je .dkdn |
|
- | 193 | ||
- | 194 | cmp dword [edi + 4], 'DKUP' ; key up |
|
- | 195 | je .dkup |
|
- | 196 | ||
- | 197 | cmp dword [edi + 4], 'DKRP' ; key auto repeat |
|
- | 198 | je .dkrp |
|
186 | 199 | ||
187 | push str3 |
200 | push str3 |
188 | call [con_write_asciiz] |
201 | call [con_write_asciiz] |
189 | 202 | ||
190 | mov byte[edi+8],0 |
203 | mov byte[edi+8],0 |
191 | add edi, 4 |
204 | add edi, 4 |
192 | push edi |
205 | push edi |
193 | call [con_write_asciiz] |
206 | call [con_write_asciiz] |
194 | 207 | ||
195 | push newline |
208 | push newline |
196 | call [con_write_asciiz] |
209 | call [con_write_asciiz] |
197 | 210 | ||
198 | .next: |
211 | .next: |
199 | pop edi eax |
212 | pop edi eax |
200 | 213 | ||
201 | mov ecx, dword [edi] |
214 | mov ecx, dword [edi] |
202 | bswap ecx |
215 | bswap ecx |
203 | add ecx, 4 |
216 | add ecx, 4 |
204 | sub eax, ecx |
217 | sub eax, ecx |
205 | jle mainloop |
218 | jle mainloop |
206 | add edi, ecx |
219 | add edi, ecx |
207 | jmp .command |
220 | jmp .command |
208 | 221 | ||
209 | 222 | ||
210 | .qinf: |
223 | .qinf: |
211 | mcall 14 ; get screen info |
224 | mcall 14 ; get screen info |
212 | add eax, 0x00010001 |
225 | add eax, 0x00010001 |
213 | bswap eax |
226 | bswap eax |
214 | mov dword [screeninfo.size], eax |
227 | mov dword [screeninfo.size], eax |
215 | mcall send, [socketnum], screeninfo, screeninfo.length, 0 ; send client name |
228 | mcall send, [socketnum], screeninfo, screeninfo.length, 0 ; send client name |
216 | jmp .next |
229 | jmp .next |
217 | 230 | ||
218 | 231 | ||
219 | .calv: |
232 | .calv: |
220 | mcall send, [socketnum], calv, calv.length, 0 ; looks like ping-pong event |
233 | mcall send, [socketnum], calv, calv.length, 0 ; keepalive |
- | 234 | ||
221 | jmp .next |
235 | jmp .next |
222 | 236 | ||
223 | 237 | ||
224 | .cinn: |
238 | .cinn: |
225 | mov edx, [edi + 8] |
239 | mov edx, [edi + 8] |
226 | bswap edx |
240 | bswap edx |
227 | mcall 18, 19, 4 |
241 | mcall 18, 19, 4 |
228 | ; ignore sequence number and modify key mask for now |
242 | ; ignore sequence number and modify key mask for now |
229 | push str6 |
243 | push str6 |
230 | call [con_write_asciiz] |
244 | call [con_write_asciiz] |
231 | jmp .next |
245 | jmp .next |
232 | 246 | ||
233 | .dclp: |
247 | .dclp: |
234 | 248 | ||
235 | jmp .next |
249 | jmp .next |
236 | 250 | ||
237 | .dmmv: |
251 | .dmmv: |
238 | mov edx, [edi + 8] |
252 | mov edx, [edi + 8] |
239 | bswap edx |
253 | bswap edx |
240 | mcall 18, 19, 4 |
254 | mcall 18, 19, 4 |
241 | mcall send, [socketnum], cnop, cnop.length, 0 ; reply with NOP |
255 | mcall send, [socketnum], cnop, cnop.length, 0 ; reply with NOP |
242 | push str4 |
- | |
243 | call [con_write_asciiz] |
- | |
244 | jmp .next |
256 | jmp .next |
245 | 257 | ||
246 | .cout: |
258 | .cout: |
- | 259 | ; TODO: hide cursor |
|
- | 260 | push str8 |
|
- | 261 | call [con_write_asciiz] |
|
247 | jmp .next |
262 | jmp .next |
248 | 263 | ||
249 | .dmdn: |
264 | .dmdn: |
250 | movzx eax, byte [edi + 8] |
265 | movzx eax, byte [edi + 8] |
251 | or [mousestate], eax |
266 | or [mousestate], eax |
252 | mcall 18, 19, 5, [mousestate] |
267 | mcall 18, 19, 5, [mousestate] |
253 | mcall send, [socketnum], cnop, cnop.length, 0 ; reply with NOP |
268 | mcall send, [socketnum], cnop, cnop.length, 0 ; reply with NOP |
254 | push str5 |
- | |
255 | call [con_write_asciiz] |
- | |
256 | jmp .next |
269 | jmp .next |
257 | 270 | ||
258 | .dmup: |
271 | .dmup: |
259 | movzx eax, byte [edi + 8] |
272 | movzx eax, byte [edi + 8] |
260 | not eax |
273 | not eax |
261 | and [mousestate], eax |
274 | and [mousestate], eax |
262 | mcall 18, 19, 5, [mousestate] |
275 | mcall 18, 19, 5, [mousestate] |
263 | mcall send, [socketnum], cnop, cnop.length, 0 ; reply with NOP |
276 | mcall send, [socketnum], cnop, cnop.length, 0 ; reply with NOP |
264 | push str5 |
- | |
265 | call [con_write_asciiz] |
- | |
266 | jmp .next |
277 | jmp .next |
267 | 278 | ||
268 | .ciak: |
279 | .ciak: |
269 | jmp .next |
280 | jmp .next |
- | 281 | ||
- | 282 | ; .dmwm: |
|
- | 283 | ; jmp .next |
|
- | 284 | ||
- | 285 | .dkdn: |
|
- | 286 | movzx edx, word[edi + 8 + 4] ; key button |
|
- | 287 | rol dx, 8 |
|
- | 288 | mcall 72, 1, 2 ; send key |
|
- | 289 | jmp .next |
|
- | 290 | ||
- | 291 | .dkrp: |
|
- | 292 | movzx edx, word[edi + 8 + 6] |
|
- | 293 | rol dx, 8 |
|
- | 294 | mcall 72, 1, 2 ; send key |
|
- | 295 | jmp .next |
|
- | 296 | ||
- | 297 | .dkup: |
|
- | 298 | movzx edx, word[edi + 8 + 4] |
|
- | 299 | rol dx, 8 |
|
- | 300 | add edx, 128 |
|
- | 301 | mcall 72, 1, 2 ; send key |
|
- | 302 | ||
- | 303 | jmp .next |
|
270 | 304 | ||
271 | error: |
305 | error: |
272 | push str_err |
306 | push str_err |
273 | call [con_write_asciiz] |
307 | call [con_write_asciiz] |
274 | 308 | ||
275 | ; call [con_gets] |
- | |
276 | 309 | wait_for_key: |
|
277 | call [con_getch2] |
310 | call [con_getch2] |
278 | 311 | ||
279 | mcall close, [socketnum] |
312 | mcall close, [socketnum] |
280 | 313 | ||
281 | push 1 |
314 | push 1 |
282 | call [con_exit] |
315 | call [con_exit] |
283 | exit: |
316 | exit: |
284 | 317 | ||
285 | mcall -1 |
318 | mcall -1 |
286 | 319 | ||
287 | 320 | ||
288 | wait_for_data: |
321 | wait_for_data: |
289 | mcall recv, [socketnum], buffer_ptr, BUFFERSIZE, 0 |
322 | mcall recv, [socketnum], buffer_ptr, BUFFERSIZE, 0 |
- | 323 | inc eax |
|
- | 324 | jz error |
|
290 | cmp eax, -1 |
325 | dec eax |
291 | je wait_for_data |
326 | jz closed |
292 | 327 | ||
293 | cmp eax, 8 |
328 | cmp eax, 8 |
294 | jb wait_for_data ; FIXME |
329 | jb wait_for_data ; FIXME |
295 | 330 | ||
296 | ret |
331 | ret |
- | 332 | ||
- | 333 | closed: |
|
- | 334 | ||
- | 335 | push str_cls |
|
- | 336 | call [con_write_asciiz] |
|
- | 337 | ||
- | 338 | jmp wait_for_key |
|
297 | 339 | ||
298 | 340 | ||
299 | 341 | ||
300 | ; data |
342 | ; data |
301 | title db 'Synergy client',0 |
343 | title db 'Synergy client',0 |
302 | str0 db 'Welcome to the software KM switch for KolibriOS.',10,10,0 |
344 | str0 db 'Welcome to the software KM switch for KolibriOS.',10,10,0 |
303 | str1 db 'Connecting to: ',0 |
345 | str1 db 'Connecting to: ',0 |
304 | str7 db 'Connected!',10,0 |
346 | str7 db 'Connected!',10,0 |
305 | str2 db 10,'Handshake received',10,0 |
347 | str2 db 10,'Handshake received',10,0 |
306 | str3 db 'Unsupported command: ',0 |
348 | str3 db 'Unsupported command: ',0 |
307 | newline db 10,0 |
349 | newline db 10,0 |
308 | str4 db 'mouse moved',10,0 |
350 | str6 db 'Entering screen',10,0 |
309 | str5 db 'mouse buttons changed',10,0 |
- | |
310 | str6 db 'Enter screen',10,0 |
351 | str8 db 'Leaving screen',10,0 |
311 | str_err db 'Uh-Oh.. some error occured !',10,'Press any key to quit.',0 |
352 | str_err db 'Uh-Oh.. some error occured !',10,'Press any key to quit.',0 |
- | 353 | str_cls db 'Server disconnected',10,0 |
|
312 | 354 | ||
313 | screeninfo: |
355 | screeninfo: |
314 | dd (screeninfo.length - 4) shl 24 |
356 | dd (screeninfo.length - 4) shl 24 |
315 | db 'DINF' |
357 | db 'DINF' |
316 | dw 0 ; coordinate of leftmost pixel |
358 | dw 0 ; coordinate of leftmost pixel |
317 | dw 0 ; coordiante of topmost pixel |
359 | dw 0 ; coordiante of topmost pixel |
318 | .size: |
360 | .size: |
319 | dw 0 ; width |
361 | dw 0 ; width |
320 | dw 0 ; height |
362 | dw 0 ; height |
321 | 363 | ||
322 | dw 0 ; size of warp zone |
364 | dw 0 ; size of warp zone |
323 | 365 | ||
324 | dw 0xb88b ; x position of the mouse on the secondary screen (no idea what it means) |
366 | dw 0xb88b ; x position of the mouse on the secondary screen (no idea what it means) |
325 | dw 0xbcfb ; y position of the mouse on the secondary screen |
367 | dw 0xbcfb ; y position of the mouse on the secondary screen |
326 | .length = $ - screeninfo |
368 | .length = $ - screeninfo |
327 | 369 | ||
328 | calv: |
370 | calv: |
329 | dd (4) shl 24 |
371 | dd (4) shl 24 |
330 | db 'CALV' |
372 | db 'CALV' |
331 | .length = $ - calv + 8 ; also send cnop |
373 | .length = $ - calv + 8 ; also send cnop |
332 | 374 | ||
333 | cnop: |
375 | cnop: |
334 | dd (4) shl 24 |
376 | dd (4) shl 24 |
335 | db 'CNOP' |
377 | db 'CNOP' |
336 | .length = $ - cnop |
378 | .length = $ - cnop |
337 | 379 | ||
338 | mousestate dd 0 |
380 | mousestate dd 0 |
339 | 381 | ||
340 | 382 | ||
341 | sockaddr1: |
383 | sockaddr1: |
342 | dw AF_INET4 |
384 | dw AF_INET4 |
343 | .port dw 0 |
385 | .port dw 0 |
344 | .ip dd 192 + 168 shl 8 + 1 shl 16 + 115 shl 24 |
386 | .ip dd 0 |
345 | rb 10 |
387 | rb 10 |
346 | 388 | ||
347 | filename db '.ini', 0 |
389 | filename db '.ini', 0 |
348 | str_local db 'local', 0 |
390 | str_local db 'local', 0 |
349 | str_name db 'name', 0 |
391 | str_name db 'name', 0 |
350 | str_remote db 'remote', 0 |
392 | str_remote db 'remote', 0 |
351 | str_port db 'port', 0 |
393 | str_port db 'port', 0 |
352 | str_ip db 'ip', 0 |
394 | str_ip db 'ip', 0 |
353 | 395 | ||
354 | ; import |
396 | ; import |
355 | align 16 |
397 | align 16 |
356 | @IMPORT: |
398 | @IMPORT: |
357 | 399 | ||
358 | library console, 'console.obj',\ |
400 | library console, 'console.obj',\ |
359 | network, 'network.obj',\ |
401 | network, 'network.obj',\ |
360 | libini, 'libini.obj' |
402 | libini, 'libini.obj' |
361 | 403 | ||
362 | import network,\ |
404 | import network,\ |
363 | getaddrinfo, 'getaddrinfo' |
405 | getaddrinfo, 'getaddrinfo' |
364 | 406 | ||
365 | import console, \ |
407 | import console, \ |
366 | con_start, 'START',\ |
408 | con_start, 'START',\ |
367 | con_init, 'con_init',\ |
409 | con_init, 'con_init',\ |
368 | con_write_asciiz, 'con_write_asciiz',\ |
410 | con_write_asciiz, 'con_write_asciiz',\ |
369 | con_exit, 'con_exit',\ |
411 | con_exit, 'con_exit',\ |
370 | con_gets, 'con_gets',\ |
412 | con_gets, 'con_gets',\ |
371 | con_cls, 'con_cls',\ |
413 | con_cls, 'con_cls',\ |
372 | con_getch2, 'con_getch2',\ |
414 | con_getch2, 'con_getch2',\ |
373 | con_set_cursor_pos, 'con_set_cursor_pos' |
415 | con_set_cursor_pos, 'con_set_cursor_pos' |
374 | 416 | ||
375 | import libini,\ |
417 | import libini,\ |
376 | ini.get_str, 'ini_get_str',\ |
418 | ini.get_str, 'ini_get_str',\ |
377 | ini.get_int, 'ini_get_int' |
419 | ini.get_int, 'ini_get_int' |
378 | 420 | ||
379 | align 4 |
421 | align 4 |
380 | i_end: |
422 | i_end: |
381 | socketnum dd ? |
423 | socketnum dd ? |
382 | buffer_ptr rb BUFFERSIZE |
424 | buffer_ptr rb BUFFERSIZE |
383 | path rb 4096 ; stack |
425 | path rb 4096 ; stack |
384 | mem: |
426 | mem: |