Rev 205 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 205 | Rev 485 | ||
---|---|---|---|
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ; ; |
2 | ; ; |
3 | ; Stack Configuration Tool ; |
3 | ; Stack Configuration Tool ; |
4 | ; ; |
4 | ; ; |
5 | ; Compile with FASM for Menuet ; |
5 | ; Compile with FASM for Menuet ; |
6 | ; ; |
6 | ; ; |
7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
8 | 8 | ||
9 | 9 | ||
10 | memsize = 100000h |
10 | memsize = 100000h |
11 | org 0 |
11 | org 0 |
12 | PARAMS = memsize - 1024 |
12 | PARAMS = memsize - 1024 |
13 | 13 | ||
14 | use32 |
14 | use32 |
15 | 15 | ||
16 | db 'MENUET01' ; 8 byte id |
16 | db 'MENUET01' ; 8 byte id |
17 | dd 0x01 ; header version |
17 | dd 0x01 ; header version |
18 | dd START ; start of code |
18 | dd START ; start of code |
19 | dd I_END ; size of image |
19 | dd I_END ; size of image |
20 | dd memsize ; memory for app |
20 | dd memsize ; memory for app |
21 | dd memsize - 1024 ; esp |
21 | dd memsize - 1024 ; esp |
22 | dd PARAMS , 0x0 ; I_Param , I_Icon |
22 | dd PARAMS , 0x0 ; I_Param , I_Icon |
23 | 23 | ||
24 | include 'lang.inc' |
24 | include 'lang.inc' |
- | 25 | include '..\..\..\macros.inc' |
|
- | 26 | ||
25 | START: ; start of execution |
27 | START: ; start of execution |
26 | 28 | ||
27 | cmp [PARAMS], byte 0 |
29 | cmp [PARAMS], byte 0 |
28 | jne check_parameters |
30 | jne check_parameters |
29 | 31 | ||
30 | no_params: |
32 | no_params: |
- | 33 | ||
31 | 34 | red: |
|
32 | call draw_window ; at first, draw the window |
35 | call draw_window ; at first, draw the window |
33 | 36 | ||
34 | still: |
37 | still: |
35 | 38 | ||
36 | mov eax,10 ; wait here for event |
39 | mov eax,10 ; wait here for event |
37 | int 0x40 |
40 | mcall |
38 | 41 | ||
39 | cmp eax,1 ; redraw request ? |
42 | cmp eax,1 ; redraw request ? |
40 | je red |
43 | jz red |
41 | cmp eax,2 ; key in buffer ? |
- | |
42 | je key |
- | |
43 | cmp eax,3 ; button in buffer ? |
44 | cmp eax,2 ; key in buffer ? |
44 | je button |
- | |
45 | - | ||
46 | jmp still |
- | |
47 | - | ||
48 | red: ; redraw |
- | |
49 | call draw_window |
- | |
50 | jmp still |
45 | jnz button |
51 | 46 | ||
52 | key: ; key |
47 | key: ; key |
53 | mov eax,2 ; just read it and ignore |
48 | mov al,2 ; just read it and ignore |
54 | int 0x40 |
49 | mcall |
55 | jmp still |
50 | jmp still |
56 | 51 | ||
57 | button: ; button |
52 | button: ; button |
58 | mov eax,17 ; get id |
53 | mov al,17 ; get id |
59 | int 0x40 |
54 | mcall |
60 | 55 | ||
61 | shr eax,8 |
56 | shr eax,8 |
62 | 57 | ||
63 | cmp eax,1 ; button id=1 ? |
58 | cmp eax,1 ; button id=1 ? |
64 | jne noclose |
59 | jne noclose |
65 | mov eax,-1 ; close this program |
60 | or eax,-1 ; close this program |
66 | int 0x40 |
61 | mcall |
67 | noclose: |
62 | noclose: |
68 | 63 | ||
69 | cmp eax,2 |
64 | cmp eax,2 |
70 | je read_stack_setup |
65 | je read_stack_setup |
71 | 66 | ||
72 | cmp eax,3 |
67 | cmp eax,3 |
73 | jne no_apply_stack_setup |
68 | jne no_apply_stack_setup |
74 | call apply_stack_setup |
69 | call apply_stack_setup |
75 | jmp still |
70 | jmp still |
76 | 71 | ||
77 | no_apply_stack_setup: |
72 | no_apply_stack_setup: |
78 | cmp eax,11 |
73 | cmp eax,11 |
79 | jb no_set_interface |
74 | jb no_set_interface |
80 | cmp eax,14 |
75 | cmp eax,14 |
81 | jg no_set_interface |
76 | jg no_set_interface |
82 | sub eax,11 |
77 | sub eax,11 |
83 | mov [interface],eax |
78 | mov [interface],eax |
84 | call draw_window |
79 | call draw_window |
85 | jmp still |
80 | jmp still |
86 | no_set_interface: |
81 | no_set_interface: |
87 | 82 | ||
88 | cmp eax,21 |
83 | cmp eax,21 |
89 | jb no_ip_sf |
84 | jb no_ip_sf |
90 | cmp eax,22 |
85 | cmp eax,22 |
91 | jg no_ip_sf |
86 | jg no_ip_sf |
92 | sub eax,21 |
87 | sub eax,21 |
93 | not eax |
88 | not eax |
94 | and eax,1 |
89 | and eax,1 |
95 | mov [assigned],eax |
90 | mov [assigned],eax |
96 | call draw_window |
91 | call draw_window |
97 | jmp still |
92 | jmp still |
98 | no_ip_sf: |
93 | no_ip_sf: |
99 | 94 | ||
100 | cmp eax,7 ; GET IP |
95 | cmp eax,7 ; GET IP |
101 | jne no_read_ip |
96 | jne no_read_ip |
102 | mov [string_x],205 |
97 | mov [string_x],205 |
103 | mov [string_y],80 |
98 | mov [string_y],80 |
104 | mov [string_length],15 |
99 | mov [string_length],15 |
105 | call read_string |
100 | call read_string |
106 | mov esi,string-1 |
101 | mov esi,string-1 |
107 | mov edi,ip_address |
102 | mov edi,ip_address |
108 | xor eax,eax |
103 | xor eax,eax |
109 | ip1: |
104 | ip1: |
110 | inc esi |
105 | inc esi |
111 | cmp [esi],byte '0' |
106 | cmp [esi],byte '0' |
112 | jb ip2 |
107 | jb ip2 |
113 | cmp [esi],byte '9' |
108 | cmp [esi],byte '9' |
114 | jg ip2 |
109 | jg ip2 |
115 | imul eax,10 |
110 | imul eax,10 |
116 | movzx ebx,byte [esi] |
111 | movzx ebx,byte [esi] |
117 | sub ebx,48 |
112 | sub ebx,48 |
118 | add eax,ebx |
113 | add eax,ebx |
119 | jmp ip1 |
114 | jmp ip1 |
120 | ip2: |
115 | ip2: |
121 | mov [edi],al |
116 | mov [edi],al |
122 | xor eax,eax |
117 | xor eax,eax |
123 | inc edi |
118 | inc edi |
124 | cmp edi,ip_address+3 |
119 | cmp edi,ip_address+3 |
125 | jbe ip1 |
120 | jbe ip1 |
126 | call draw_window |
121 | call draw_window |
127 | jmp still |
122 | jmp still |
128 | no_read_ip: |
123 | no_read_ip: |
129 | 124 | ||
130 | cmp eax,5 ; GET COM PORT |
125 | cmp eax,5 ; GET COM PORT |
131 | jne no_read_comport |
126 | jne no_read_comport |
132 | mov [string_x],272 |
127 | mov [string_x],272 |
133 | mov [string_y],40 |
128 | mov [string_y],40 |
134 | mov [string_length],3 |
129 | mov [string_length],3 |
135 | call read_string |
130 | call read_string |
136 | movzx eax,byte [string] |
131 | movzx eax,byte [string] |
137 | cmp eax,'A' |
132 | cmp eax,'A' |
138 | jb gcp1 |
133 | jb gcp1 |
139 | sub eax,'A'-'9'-1 |
134 | sub eax,'A'-'9'-1 |
140 | gcp1: |
135 | gcp1: |
141 | sub eax,48 |
136 | sub eax,48 |
142 | shl eax,8 |
137 | shl eax,8 |
143 | mov ebx,eax |
138 | mov ebx,eax |
144 | movzx eax,byte [string+1] |
139 | movzx eax,byte [string+1] |
145 | cmp eax,'A' |
140 | cmp eax,'A' |
146 | jb gcp2 |
141 | jb gcp2 |
147 | sub eax,'A'-'9'-1 |
142 | sub eax,'A'-'9'-1 |
148 | gcp2: |
143 | gcp2: |
149 | sub eax,48 |
144 | sub eax,48 |
150 | shl eax,4 |
145 | shl eax,4 |
151 | add ebx,eax |
146 | add ebx,eax |
152 | movzx eax,byte [string+2] |
147 | movzx eax,byte [string+2] |
153 | cmp eax,'A' |
148 | cmp eax,'A' |
154 | jb gcp3 |
149 | jb gcp3 |
155 | sub eax,'A'-'9'-1 |
150 | sub eax,'A'-'9'-1 |
156 | gcp3: |
151 | gcp3: |
157 | sub eax,48 |
152 | sub eax,48 |
158 | add ebx,eax |
153 | add ebx,eax |
159 | mov [com_add],ebx |
154 | mov [com_add],ebx |
160 | call draw_window |
155 | call draw_window |
161 | jmp still |
156 | jmp still |
162 | no_read_comport: |
157 | no_read_comport: |
163 | 158 | ||
164 | cmp eax,6 ; GET COM IRQ |
159 | cmp eax,6 ; GET COM IRQ |
165 | jne no_read_comirq |
160 | jne no_read_comirq |
166 | mov [string_x],284 |
161 | mov [string_x],284 |
167 | mov [string_y],50 |
162 | mov [string_y],50 |
168 | mov [string_length],1 |
163 | mov [string_length],1 |
169 | call read_string |
164 | call read_string |
170 | movzx eax,byte [string] |
165 | movzx eax,byte [string] |
171 | cmp eax,'A' |
166 | cmp eax,'A' |
172 | jb gci1 |
167 | jb gci1 |
173 | sub eax,'A'-'9'-1 |
168 | sub eax,'A'-'9'-1 |
174 | gci1: |
169 | gci1: |
175 | sub eax,48 |
170 | sub eax,48 |
176 | mov [com_irq],eax |
171 | mov [com_irq],eax |
177 | call draw_window |
172 | call draw_window |
178 | jmp still |
173 | jmp still |
179 | no_read_comirq: |
174 | no_read_comirq: |
180 | 175 | ||
181 | cmp eax, 8 ; set gateway ip |
176 | cmp eax, 8 ; set gateway ip |
182 | jne no_set_gateway |
177 | jne no_set_gateway |
183 | 178 | ||
184 | mov [string_x],205 |
179 | mov [string_x],205 |
185 | mov [string_y],90 |
180 | mov [string_y],90 |
186 | mov [string_length],15 |
181 | mov [string_length],15 |
187 | call read_string |
182 | call read_string |
188 | mov esi,string-1 |
183 | mov esi,string-1 |
189 | mov edi,gateway_ip |
184 | mov edi,gateway_ip |
190 | xor eax,eax |
185 | xor eax,eax |
191 | gip1: |
186 | gip1: |
192 | inc esi |
187 | inc esi |
193 | cmp [esi],byte '0' |
188 | cmp [esi],byte '0' |
194 | jb gip2 |
189 | jb gip2 |
195 | cmp [esi],byte '9' |
190 | cmp [esi],byte '9' |
196 | jg gip2 |
191 | jg gip2 |
197 | imul eax,10 |
192 | imul eax,10 |
198 | movzx ebx,byte [esi] |
193 | movzx ebx,byte [esi] |
199 | sub ebx,48 |
194 | sub ebx,48 |
200 | add eax,ebx |
195 | add eax,ebx |
201 | jmp gip1 |
196 | jmp gip1 |
202 | gip2: |
197 | gip2: |
203 | mov [edi],al |
198 | mov [edi],al |
204 | xor eax,eax |
199 | xor eax,eax |
205 | inc edi |
200 | inc edi |
206 | cmp edi,gateway_ip+3 |
201 | cmp edi,gateway_ip+3 |
207 | jbe gip1 |
202 | jbe gip1 |
208 | call draw_window |
203 | call draw_window |
209 | 204 | ||
210 | jmp still |
205 | jmp still |
211 | 206 | ||
212 | no_set_gateway: |
207 | no_set_gateway: |
213 | cmp eax, 9 |
208 | cmp eax, 9 |
214 | jne no_set_subnet |
209 | jne no_set_subnet |
215 | 210 | ||
216 | mov [string_x],205 |
211 | mov [string_x],205 |
217 | mov [string_y],100 |
212 | mov [string_y],100 |
218 | mov [string_length],15 |
213 | mov [string_length],15 |
219 | call read_string |
214 | call read_string |
220 | mov esi,string-1 |
215 | mov esi,string-1 |
221 | mov edi,subnet_mask |
216 | mov edi,subnet_mask |
222 | xor eax,eax |
217 | xor eax,eax |
223 | sip1: |
218 | sip1: |
224 | inc esi |
219 | inc esi |
225 | cmp [esi],byte '0' |
220 | cmp [esi],byte '0' |
226 | jb sip2 |
221 | jb sip2 |
227 | cmp [esi],byte '9' |
222 | cmp [esi],byte '9' |
228 | jg sip2 |
223 | jg sip2 |
229 | imul eax,10 |
224 | imul eax,10 |
230 | movzx ebx,byte [esi] |
225 | movzx ebx,byte [esi] |
231 | sub ebx,48 |
226 | sub ebx,48 |
232 | add eax,ebx |
227 | add eax,ebx |
233 | jmp sip1 |
228 | jmp sip1 |
234 | sip2: |
229 | sip2: |
235 | mov [edi],al |
230 | mov [edi],al |
236 | xor eax,eax |
231 | xor eax,eax |
237 | inc edi |
232 | inc edi |
238 | cmp edi,subnet_mask+3 |
233 | cmp edi,subnet_mask+3 |
239 | jbe sip1 |
234 | jbe sip1 |
240 | call draw_window |
235 | call draw_window |
241 | 236 | ||
242 | jmp still |
237 | jmp still |
243 | 238 | ||
244 | no_set_subnet: |
239 | no_set_subnet: |
245 | cmp eax, 10 |
240 | cmp eax, 10 |
246 | jne no_set_dns |
241 | jne no_set_dns |
247 | 242 | ||
248 | mov [string_x],205 |
243 | mov [string_x],205 |
249 | mov [string_y],110 |
244 | mov [string_y],110 |
250 | mov [string_length],15 |
245 | mov [string_length],15 |
251 | call read_string |
246 | call read_string |
252 | mov esi,string-1 |
247 | mov esi,string-1 |
253 | mov edi,dns_ip |
248 | mov edi,dns_ip |
254 | xor eax,eax |
249 | xor eax,eax |
255 | dip1: |
250 | dip1: |
256 | inc esi |
251 | inc esi |
257 | cmp [esi],byte '0' |
252 | cmp [esi],byte '0' |
258 | jb dip2 |
253 | jb dip2 |
259 | cmp [esi],byte '9' |
254 | cmp [esi],byte '9' |
260 | jg dip2 |
255 | jg dip2 |
261 | imul eax,10 |
256 | imul eax,10 |
262 | movzx ebx,byte [esi] |
257 | movzx ebx,byte [esi] |
263 | sub ebx,48 |
258 | sub ebx,48 |
264 | add eax,ebx |
259 | add eax,ebx |
265 | jmp dip1 |
260 | jmp dip1 |
266 | dip2: |
261 | dip2: |
267 | mov [edi],al |
262 | mov [edi],al |
268 | xor eax,eax |
263 | xor eax,eax |
269 | inc edi |
264 | inc edi |
270 | cmp edi,dns_ip+3 |
265 | cmp edi,dns_ip+3 |
271 | jbe dip1 |
266 | jbe dip1 |
272 | call draw_window |
267 | call draw_window |
273 | 268 | ||
274 | jmp still |
269 | jmp still |
275 | 270 | ||
276 | no_set_dns: |
271 | no_set_dns: |
277 | jmp still |
272 | jmp still |
278 | 273 | ||
279 | 274 | ||
280 | 275 | ||
281 | read_stack_setup: |
276 | read_stack_setup: |
282 | 277 | ||
283 | mov eax,52 |
278 | mov eax,52 |
284 | mov ebx,0 |
279 | mov ebx,0 |
285 | int 0x40 |
280 | mcall |
286 | mov [config],eax |
281 | mov [config],eax |
287 | 282 | ||
288 | mov eax,52 |
283 | mov eax,52 |
289 | mov ebx,1 |
284 | mov ebx,1 |
290 | int 0x40 |
285 | mcall |
291 | mov dword [ip_address],eax |
286 | mov dword [ip_address],eax |
292 | 287 | ||
293 | mov eax,52 |
288 | mov eax,52 |
294 | mov ebx,9 |
289 | mov ebx,9 |
295 | int 0x40 |
290 | mcall |
296 | mov dword [gateway_ip],eax |
291 | mov dword [gateway_ip],eax |
297 | 292 | ||
298 | mov eax,52 |
293 | mov eax,52 |
299 | mov ebx,10 |
294 | mov ebx,10 |
300 | int 0x40 |
295 | mcall |
301 | mov dword [subnet_mask],eax |
296 | mov dword [subnet_mask],eax |
302 | 297 | ||
303 | mov eax,52 |
298 | mov eax,52 |
304 | mov ebx,13 |
299 | mov ebx,13 |
305 | int 0x40 |
300 | mcall |
306 | mov dword [dns_ip],eax |
301 | mov dword [dns_ip],eax |
307 | 302 | ||
308 | mov eax,[config] ; unwrap com IRQ |
303 | mov eax,[config] ; unwrap com IRQ |
309 | shr eax,8 |
304 | shr eax,8 |
310 | and eax,0xf |
305 | and eax,0xf |
311 | mov [com_irq],eax |
306 | mov [com_irq],eax |
312 | 307 | ||
313 | mov eax,[config] ; unwrap com PORT |
308 | mov eax,[config] ; unwrap com PORT |
314 | shr eax,16 |
309 | shr eax,16 |
315 | and eax,0xfff |
310 | and eax,0xfff |
316 | mov [com_add],eax |
311 | mov [com_add],eax |
317 | 312 | ||
318 | mov eax,[config] ; unwrap IRQ |
313 | mov eax,[config] ; unwrap IRQ |
319 | and eax,0xf |
314 | and eax,0xf |
320 | mov [interface],eax |
315 | mov [interface],eax |
321 | 316 | ||
322 | mov eax,[config] ; unwrap com PORT |
317 | mov eax,[config] ; unwrap com PORT |
323 | shr eax,7 |
318 | shr eax,7 |
324 | and eax,1 |
319 | and eax,1 |
325 | mov [assigned],eax |
320 | mov [assigned],eax |
326 | 321 | ||
327 | call draw_window |
322 | call draw_window |
328 | 323 | ||
329 | jmp still |
324 | jmp still |
330 | 325 | ||
331 | 326 | ||
332 | apply_stack_setup: |
327 | apply_stack_setup: |
333 | 328 | ||
334 | mov eax,[com_irq] |
329 | mov eax,[com_irq] |
335 | shl eax,8 |
330 | shl eax,8 |
336 | mov ebx,[com_add] |
331 | mov ebx,[com_add] |
337 | shl ebx,16 |
332 | shl ebx,16 |
338 | add eax,ebx |
333 | add eax,ebx |
339 | add eax,[interface] |
334 | add eax,[interface] |
340 | mov ebx,[assigned] |
335 | mov ebx,[assigned] |
341 | shl ebx,7 |
336 | shl ebx,7 |
342 | add eax,ebx |
337 | add eax,ebx |
343 | mov [config],eax |
338 | mov [config],eax |
344 | 339 | ||
345 | mov eax,52 |
340 | mov eax,52 |
346 | mov ebx,3 |
341 | mov ebx,3 |
347 | mov ecx,dword [ip_address] |
342 | mov ecx,dword [ip_address] |
348 | int 0x40 |
343 | mcall |
349 | 344 | ||
350 | mov eax,52 |
345 | mov eax,52 |
351 | mov ebx,11 |
346 | mov ebx,11 |
352 | mov ecx,dword [gateway_ip] |
347 | mov ecx,dword [gateway_ip] |
353 | int 0x40 |
348 | mcall |
354 | 349 | ||
355 | mov eax,52 |
350 | mov eax,52 |
356 | mov ebx,12 |
351 | mov ebx,12 |
357 | mov ecx,dword [subnet_mask] |
352 | mov ecx,dword [subnet_mask] |
358 | int 0x40 |
353 | mcall |
359 | 354 | ||
360 | mov eax,52 |
355 | mov eax,52 |
361 | mov ebx,14 |
356 | mov ebx,14 |
362 | mov ecx,dword [dns_ip] |
357 | mov ecx,dword [dns_ip] |
363 | int 0x40 |
358 | mcall |
364 | 359 | ||
365 | mov eax,52 |
360 | mov eax,52 |
366 | mov ebx,2 |
361 | mov ebx,2 |
367 | mov ecx,[config] |
362 | mov ecx,[config] |
368 | int 0x40 |
363 | mcall |
369 | 364 | ||
370 | ret |
365 | ret |
371 | jmp still |
366 | jmp still |
372 | 367 | ||
373 | 368 | ||
374 | string_length dd 16 |
369 | string_length dd 16 |
375 | string_x dd 200 |
370 | string_x dd 200 |
376 | string_y dd 60 |
371 | string_y dd 60 |
377 | 372 | ||
378 | string db '________________' |
373 | string db '________________' |
379 | 374 | ||
380 | 375 | ||
381 | read_string: |
376 | read_string: |
382 | 377 | ||
383 | mov edi,string |
378 | mov edi,string |
384 | mov eax,'_' |
379 | mov eax,'_' |
385 | mov ecx,[string_length] |
380 | mov ecx,[string_length] |
386 | cld |
381 | cld |
387 | rep stosb |
382 | rep stosb |
388 | call print_text |
383 | call print_text |
389 | 384 | ||
390 | mov edi,string |
385 | mov edi,string |
391 | f11: |
386 | f11: |
392 | mov eax,10 |
387 | mov eax,10 |
393 | int 0x40 |
388 | mcall |
394 | cmp eax,2 |
389 | cmp eax,2 |
395 | jne read_done |
390 | jne read_done |
396 | mov eax,2 |
391 | mov eax,2 |
397 | int 0x40 |
392 | mcall |
398 | shr eax,8 |
393 | shr eax,8 |
399 | cmp eax,13 |
394 | cmp eax,13 |
400 | je read_done |
395 | je read_done |
401 | cmp eax,8 |
396 | cmp eax,8 |
402 | jnz nobsl |
397 | jnz nobsl |
403 | cmp edi,string |
398 | cmp edi,string |
404 | jz f11 |
399 | jz f11 |
405 | sub edi,1 |
400 | sub edi,1 |
406 | mov [edi],byte '_' |
401 | mov [edi],byte '_' |
407 | call print_text |
402 | call print_text |
408 | jmp f11 |
403 | jmp f11 |
409 | nobsl: |
404 | nobsl: |
410 | cmp eax,dword 31 |
405 | cmp eax,dword 31 |
411 | jbe f11 |
406 | jbe f11 |
412 | cmp eax,dword 95 |
407 | cmp eax,dword 95 |
413 | jb keyok |
408 | jb keyok |
414 | sub eax,32 |
409 | sub eax,32 |
415 | keyok: |
410 | keyok: |
416 | mov [edi],al |
411 | mov [edi],al |
417 | call print_text |
412 | call print_text |
418 | 413 | ||
419 | inc edi |
414 | inc edi |
420 | mov esi,string |
415 | mov esi,string |
421 | add esi,[string_length] |
416 | add esi,[string_length] |
422 | cmp esi,edi |
417 | cmp esi,edi |
423 | jnz f11 |
418 | jnz f11 |
424 | 419 | ||
425 | read_done: |
420 | read_done: |
426 | 421 | ||
427 | call print_text |
422 | call print_text |
428 | 423 | ||
429 | ret |
424 | ret |
430 | 425 | ||
431 | 426 | ||
432 | print_text: |
427 | print_text: |
433 | 428 | ||
434 | pusha |
429 | pusha |
435 | 430 | ||
436 | mov eax,13 |
431 | mov eax,13 |
437 | mov ebx,[string_x] |
432 | mov ebx,[string_x] |
438 | shl ebx,16 |
433 | shl ebx,16 |
439 | add ebx,[string_length] |
434 | add ebx,[string_length] |
440 | imul bx,6 |
435 | imul bx,6 |
441 | mov ecx,[string_y] |
436 | mov ecx,[string_y] |
442 | shl ecx,16 |
437 | shl ecx,16 |
443 | mov cx,8 |
438 | mov cx,8 |
444 | mov edx,0xffffff |
439 | mov edx,0xffffff |
445 | int 0x40 |
440 | mcall |
446 | 441 | ||
447 | mov eax,4 |
442 | mov eax,4 |
448 | mov ebx,[string_x] |
443 | mov ebx,[string_x] |
449 | shl ebx,16 |
444 | shl ebx,16 |
450 | add ebx,[string_y] |
445 | add ebx,[string_y] |
451 | mov ecx,0x000000 |
446 | mov ecx,0x000000 |
452 | mov edx,string |
447 | mov edx,string |
453 | mov esi,[string_length] |
448 | mov esi,[string_length] |
454 | int 0x40 |
449 | mcall |
455 | 450 | ||
456 | popa |
451 | popa |
457 | ret |
452 | ret |
458 | 453 | ||
459 | 454 | ||
460 | 455 | ||
461 | 456 | ||
462 | 457 | ||
463 | 458 | ||
464 | 459 | ||
465 | ; ********************************************* |
460 | ; ********************************************* |
466 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
461 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
467 | ; ********************************************* |
462 | ; ********************************************* |
468 | 463 | ||
469 | 464 | ||
470 | draw_window: |
465 | draw_window: |
471 | 466 | ||
472 | mov eax,12 ; function 12:tell os about windowdraw |
467 | mov eax,12 ; function 12:tell os about windowdraw |
473 | mov ebx,1 ; 1, start of draw |
468 | mov ebx,1 ; 1, start of draw |
474 | int 0x40 |
469 | mcall |
475 | 470 | ||
476 | ; DRAW WINDOW |
471 | ; DRAW WINDOW |
477 | mov eax,0 ; function 0 : define and draw window |
472 | mov eax,0 ; function 0 : define and draw window |
478 | mov ebx,100*65536+330 ; [x start] *65536 + [x size] |
473 | mov ebx,100*65536+330 ; [x start] *65536 + [x size] |
479 | mov ecx,100*65536+157 ; [y start] *65536 + [y size] |
474 | mov ecx,100*65536+157 ; [y start] *65536 + [y size] |
480 | mov edx,0x13ffffff ; color of work area RRGGBB,8->color gl |
475 | mov edx,0x13ffffff ; color of work area RRGGBB,8->color gl |
481 | mov edi,header ; WINDOW LABEL |
476 | mov edi,title ; WINDOW LABEL |
482 | int 0x40 |
477 | mcall |
483 | 478 | ||
484 | 479 | ||
485 | mov eax,8 ; BUTTON : READ SETUP |
480 | mov eax,8 ; BUTTON : READ SETUP |
486 | mov ebx,90*65536+65 |
481 | mov ebx,90*65536+65 |
487 | mov ecx,127*65536+12 |
482 | mov ecx,127*65536+12 |
488 | mov edx,2 |
483 | mov edx,2 |
489 | mov esi,[button_color] |
484 | mov esi,[button_color] |
490 | int 0x40 |
485 | mcall |
491 | 486 | ||
492 | ;mov eax,8 ; BUTTON : APPLY SETUP |
487 | ;mov eax,8 ; BUTTON : APPLY SETUP |
493 | mov ebx,163*65536+65 |
488 | mov ebx,163*65536+65 |
494 | mov ecx,127*65536+12 |
489 | mov ecx,127*65536+12 |
495 | mov edx,3 |
490 | mov edx,3 |
496 | int 0x40 |
491 | mcall |
497 | 492 | ||
498 | ;mov eax,8 ; BUTTONS 11-14 : SELECT INTERFACE |
493 | ;mov eax,8 ; BUTTONS 11-14 : SELECT INTERFACE |
499 | mov ebx,29*65536+8 |
494 | mov ebx,29*65536+8 |
500 | mov ecx,39*65536+8 |
495 | mov ecx,39*65536+8 |
501 | mov edx,11 |
496 | mov edx,11 |
502 | interface_select: |
497 | interface_select: |
503 | int 0x40 |
498 | mcall |
504 | add ecx,10*65536 |
499 | add ecx,10*65536 |
505 | inc edx |
500 | inc edx |
506 | cmp edx,11+4 |
501 | cmp edx,11+4 |
507 | jb interface_select |
502 | jb interface_select |
508 | 503 | ||
509 | mov ebx,[interface] ; PRINT SELECTED INTERFACE 'X' |
504 | mov ebx,[interface] ; PRINT SELECTED INTERFACE 'X' |
510 | imul ebx,10 |
505 | imul ebx,10 |
511 | add ebx,31*65536+39 |
506 | add ebx,31*65536+39 |
512 | mov eax,4 |
507 | mov eax,4 |
513 | mov ecx,0xffffff |
508 | mov ecx,0xffffff |
514 | mov edx,xx |
509 | mov edx,xx |
515 | mov esi,1 |
510 | mov esi,1 |
516 | int 0x40 |
511 | mcall |
517 | 512 | ||
518 | mov eax,8 ; BUTTONS 21-22 : SERVER / MANUAL IP |
513 | mov eax,8 ; BUTTONS 21-22 : SERVER / MANUAL IP |
519 | mov ebx,143*65536+8 |
514 | mov ebx,143*65536+8 |
520 | mov ecx,69*65536+8 |
515 | mov ecx,69*65536+8 |
521 | mov edx,21 |
516 | mov edx,21 |
522 | mov esi,[button_color] |
517 | mov esi,[button_color] |
523 | int 0x40 |
518 | mcall |
524 | ;mov eax,8 |
519 | ;mov eax,8 |
525 | mov ebx,143*65536+8 |
520 | mov ebx,143*65536+8 |
526 | mov ecx,79*65536+8 |
521 | mov ecx,79*65536+8 |
527 | mov edx,22 |
522 | mov edx,22 |
528 | int 0x40 |
523 | mcall |
529 | mov ebx,[assigned] ; PRINT SELECTED SERVER/MANUAL 'X' |
524 | mov ebx,[assigned] ; PRINT SELECTED SERVER/MANUAL 'X' |
530 | not ebx |
525 | not ebx |
531 | and ebx,1 |
526 | and ebx,1 |
532 | imul ebx,10 |
527 | imul ebx,10 |
533 | add ebx,145*65536+69 |
528 | add ebx,145*65536+69 |
534 | mov eax,4 |
529 | mov eax,4 |
535 | mov ecx,0xffffff |
530 | mov ecx,0xffffff |
536 | mov edx,xx |
531 | mov edx,xx |
537 | mov esi,1 |
532 | mov esi,1 |
538 | int 0x40 |
533 | mcall |
539 | 534 | ||
540 | mov eax,47 ; COM ADDRESS |
535 | mov eax,47 ; COM ADDRESS |
541 | mov ebx,3*65536+1*256 |
536 | mov ebx,3*65536+1*256 |
542 | mov ecx,[com_add] |
537 | mov ecx,[com_add] |
543 | mov edx,272*65536+40 |
538 | mov edx,272*65536+40 |
544 | mov esi,0x000000 |
539 | mov esi,0x000000 |
545 | int 0x40 |
540 | mcall |
546 | 541 | ||
547 | ;mov eax,47 ; COM IRQ |
542 | ;mov eax,47 ; COM IRQ |
548 | mov ebx,1*65536+1*256 |
543 | mov ebx,1*65536+1*256 |
549 | mov ecx,[com_irq] |
544 | mov ecx,[com_irq] |
550 | mov edx,(266+3*6)*65536+50 |
545 | mov edx,(266+3*6)*65536+50 |
551 | mov esi,0x000000 |
546 | mov esi,0x000000 |
552 | int 0x40 |
547 | mcall |
553 | 548 | ||
554 | mov edi,ip_address |
549 | mov edi,ip_address |
555 | mov edx,205*65536+80 |
550 | mov edx,205*65536+80 |
556 | mov esi,0x000000 |
551 | mov esi,0x000000 |
557 | mov ebx,3*65536 |
552 | mov ebx,3*65536 |
558 | ipdisplay: |
553 | ipdisplay: |
559 | ;mov eax,47 |
554 | ;mov eax,47 |
560 | movzx ecx,byte [edi] |
555 | movzx ecx,byte [edi] |
561 | int 0x40 |
556 | mcall |
562 | add edx,6*4*65536 |
557 | add edx,6*4*65536 |
563 | inc edi |
558 | inc edi |
564 | cmp edi,ip_address+4 |
559 | cmp edi,ip_address+4 |
565 | jb ipdisplay |
560 | jb ipdisplay |
566 | 561 | ||
567 | mov edi,gateway_ip |
562 | mov edi,gateway_ip |
568 | mov edx,205*65536+90 |
563 | mov edx,205*65536+90 |
569 | mov esi,0x000000 |
564 | mov esi,0x000000 |
570 | mov ebx,3*65536 |
565 | mov ebx,3*65536 |
571 | gipdisplay: |
566 | gipdisplay: |
572 | ;mov eax,47 |
567 | ;mov eax,47 |
573 | movzx ecx,byte [edi] |
568 | movzx ecx,byte [edi] |
574 | int 0x40 |
569 | mcall |
575 | add edx,6*4*65536 |
570 | add edx,6*4*65536 |
576 | inc edi |
571 | inc edi |
577 | cmp edi,gateway_ip+4 |
572 | cmp edi,gateway_ip+4 |
578 | jb gipdisplay |
573 | jb gipdisplay |
579 | 574 | ||
580 | mov edi,subnet_mask |
575 | mov edi,subnet_mask |
581 | mov edx,205*65536+100 |
576 | mov edx,205*65536+100 |
582 | mov esi,0x000000 |
577 | mov esi,0x000000 |
583 | mov ebx,3*65536 |
578 | mov ebx,3*65536 |
584 | sipdisplay: |
579 | sipdisplay: |
585 | ;mov eax,47 |
580 | ;mov eax,47 |
586 | movzx ecx,byte [edi] |
581 | movzx ecx,byte [edi] |
587 | int 0x40 |
582 | mcall |
588 | add edx,6*4*65536 |
583 | add edx,6*4*65536 |
589 | inc edi |
584 | inc edi |
590 | cmp edi,subnet_mask+4 |
585 | cmp edi,subnet_mask+4 |
591 | jb sipdisplay |
586 | jb sipdisplay |
592 | 587 | ||
593 | mov edi,dns_ip |
588 | mov edi,dns_ip |
594 | mov edx,205*65536+110 |
589 | mov edx,205*65536+110 |
595 | mov esi,0x000000 |
590 | mov esi,0x000000 |
596 | mov ebx,3*65536 |
591 | mov ebx,3*65536 |
597 | dipdisplay: |
592 | dipdisplay: |
598 | ;mov eax,47 |
593 | ;mov eax,47 |
599 | movzx ecx,byte [edi] |
594 | movzx ecx,byte [edi] |
600 | int 0x40 |
595 | mcall |
601 | add edx,6*4*65536 |
596 | add edx,6*4*65536 |
602 | inc edi |
597 | inc edi |
603 | cmp edi,dns_ip+4 |
598 | cmp edi,dns_ip+4 |
604 | jb dipdisplay |
599 | jb dipdisplay |
605 | 600 | ||
606 | 601 | ||
607 | mov eax,8 ; BUTTON 5 : SET PORT |
602 | mov eax,8 ; BUTTON 5 : SET PORT |
608 | mov ebx,299*65536+8 |
603 | mov ebx,299*65536+8 |
609 | mov ecx,39*65536+8 |
604 | mov ecx,39*65536+8 |
610 | mov edx,5 |
605 | mov edx,5 |
611 | mov esi,[button_color] |
606 | mov esi,[button_color] |
612 | int 0x40 |
607 | mcall |
613 | ;mov eax,8 ; BUTTON 6 : SET IRQ |
608 | ;mov eax,8 ; BUTTON 6 : SET IRQ |
614 | mov ebx,299*65536+8 |
- | |
615 | mov ecx,49*65536+8 |
609 | mov ecx,49*65536+8 |
616 | mov edx,6 |
610 | mov edx,6 |
617 | int 0x40 |
611 | mcall |
618 | ;mov eax,8 ; BUTTON 7 : SET IP |
612 | ;mov eax,8 ; BUTTON 7 : SET IP |
619 | mov ebx,299*65536+8 |
- | |
620 | mov ecx,79*65536+8 |
613 | mov ecx,79*65536+8 |
621 | mov edx,7 |
614 | mov edx,7 |
622 | int 0x40 |
615 | mcall |
623 | 616 | ||
624 | ;mov eax,8 ; BUTTON 8 : SET gateway IP |
617 | ;mov eax,8 ; BUTTON 8 : SET gateway IP |
625 | mov ebx,299*65536+8 |
618 | mov ebx,299*65536+8 |
626 | mov ecx,89*65536+8 |
619 | mov ecx,89*65536+8 |
627 | mov edx,8 |
620 | mov edx,8 |
628 | int 0x40 |
621 | mcall |
629 | 622 | ||
630 | ;mov eax,8 ; BUTTON 9 : SET subnet |
- | |
631 | mov ebx,299*65536+8 |
623 | ;mov eax,8 ; BUTTON 9 : SET subnet |
632 | mov ecx,99*65536+8 |
624 | mov ecx,99*65536+8 |
633 | mov edx,9 |
625 | mov edx,9 |
634 | int 0x40 |
626 | mcall |
635 | - | ||
636 | ;mov eax,8 ; BUTTON 10 : SET dns ip |
627 | |
637 | mov ebx,299*65536+8 |
628 | ;mov eax,8 ; BUTTON 10 : SET dns ip |
638 | mov ecx,109*65536+8 |
629 | mov ecx,109*65536+8 |
639 | mov edx,10 |
630 | mov edx,10 |
640 | int 0x40 |
631 | mcall |
641 | 632 | ||
642 | mov ebx,31*65536+40 ; draw info text with function 4 |
633 | mov ebx,31*65536+40 ; draw info text with function 4 |
643 | mov edx,text |
634 | mov edx,text |
644 | mov esi,49 |
635 | mov esi,49 |
645 | mov eax,4 |
636 | mov eax,4 |
646 | newline: |
637 | newline: |
647 | mov ecx,0x224466 |
638 | mov ecx,0x224466 |
648 | cmp [edx],byte 'w' |
639 | cmp [edx],byte 'w' |
649 | jne nowhite |
640 | jne nowhite |
650 | mov ecx,0xeeeeee |
641 | mov ecx,0xeeeeee |
651 | nowhite: |
642 | nowhite: |
652 | inc edx |
643 | inc edx |
653 | int 0x40 |
644 | mcall |
654 | add ebx,10 |
645 | add ebx,10 |
655 | add edx,49 |
646 | add edx,49 |
656 | cmp [edx],byte 'x' |
647 | cmp [edx],byte 'x' |
657 | jne newline |
648 | jne newline |
658 | 649 | ||
659 | mov eax,12 ; function 12:tell os about windowdraw |
650 | mov eax,12 ; function 12:tell os about windowdraw |
660 | mov ebx,2 ; 2, end of draw |
651 | mov ebx,2 ; 2, end of draw |
661 | int 0x40 |
652 | mcall |
662 | 653 | ||
663 | ret |
654 | ret |
664 | 655 | ||
665 | ;****************************************************************************** |
656 | ;****************************************************************************** |
666 | 657 | ||
667 | check_parameters: |
658 | check_parameters: |
668 | cmp [PARAMS], dword "BOOT" ; received BOOT parameter -> goto handler |
659 | cmp [PARAMS], dword "BOOT" ; received BOOT parameter -> goto handler |
669 | je boot_set_settings |
660 | je boot_set_settings |
670 | jmp no_params |
661 | jmp no_params |
671 | 662 | ||
672 | ;****************************************************************************** |
663 | ;****************************************************************************** |
673 | 664 | ||
674 | boot_set_settings: |
665 | boot_set_settings: |
675 | 666 | ||
676 | mov eax,52 |
667 | mov eax,52 |
677 | mov ebx,0 |
668 | mov ebx,0 |
678 | int 0x40 |
669 | mcall |
679 | mov [config],eax |
670 | mov [config],eax |
680 | 671 | ||
681 | shr eax,8 ; unwrap com IRQ |
672 | shr eax,8 ; unwrap com IRQ |
682 | and eax,0xf |
673 | and eax,0xf |
683 | mov [com_irq],eax |
674 | mov [com_irq],eax |
684 | 675 | ||
685 | mov eax,[config] ; unwrap com PORT |
676 | mov eax,[config] ; unwrap com PORT |
686 | shr eax,16 |
677 | shr eax,16 |
687 | and eax,0xfff |
678 | and eax,0xfff |
688 | mov [com_add],eax |
679 | mov [com_add],eax |
689 | 680 | ||
690 | call apply_stack_setup |
681 | call apply_stack_setup |
691 | 682 | ||
692 | mov eax,-1 ; close this program |
683 | mov eax,-1 ; close this program |
693 | int 0x40 |
684 | mcall |
694 | 685 | ||
695 | ;****************************************************************************** |
686 | ;****************************************************************************** |
696 | 687 | ||
697 | 688 | ||
698 | ; DATA AREA |
689 | ; DATA AREA |
699 | 690 | ||
700 | text: |
691 | text: |
701 | db ' Not active Modem Com Port: 0x < ' |
692 | db ' Not active Modem Com Port: 0x < ' |
702 | db ' Slip Modem Com Irq: 0x < ' |
693 | db ' Slip Modem Com Irq: 0x < ' |
703 | db ' PPP ' |
694 | db ' PPP ' |
704 | db ' Packet Driver IP server assigned ' |
695 | db ' Packet Driver IP server assigned ' |
705 | db ' Fixed: . . . < ' |
696 | db ' Fixed: . . . < ' |
706 | db ' Gateway: . . . < ' |
697 | db ' Gateway: . . . < ' |
707 | db ' Subnet: . . . < ' |
698 | db ' Subnet: . . . < ' |
708 | db ' DNS IP: . . . < ' |
699 | db ' DNS IP: . . . < ' |
709 | db ' ' |
700 | db ' ' |
710 | db 'w READ APPLY ' |
701 | db 'w READ APPLY ' |
711 | 702 | ||
712 | xx: db 'x' ;<- END MARKER, DONT DELETE |
703 | xx: db 'x' ;<- END MARKER, DONT DELETE |
713 | 704 | ||
714 | button_color dd 0x2254b9 |
705 | button_color dd 0x2254b9 |
715 | 706 | ||
716 | header db 'STACK CONFIGURATION',0 |
707 | title db 'STACK CONFIGURATION',0 |
717 | 708 | ||
718 | 709 | ||
719 | ;ENTER YOUR SETTINGS HERE: |
710 | ;ENTER YOUR SETTINGS HERE: |
720 | 711 | ||
721 | ip_address db 010,005,004,175 |
712 | ip_address db 010,005,004,175 |
722 | gateway_ip db 010,005,000,001 |
713 | gateway_ip db 010,005,000,001 |
723 | subnet_mask db 255,255,000,000 |
714 | subnet_mask db 255,255,000,000 |
724 | dns_ip db 213,184,238,006 |
715 | dns_ip db 213,184,238,006 |
725 | 716 | ||
726 | 717 | ||
727 | com_irq dd 0 ; irq for slip/ppp |
718 | com_irq dd 0 ; irq for slip/ppp |
728 | com_add dd 0 ; com port address for slip/ppp |
719 | com_add dd 0 ; com port address for slip/ppp |
729 | interface dd 3 ; not active,slip,ppp,packet driver |
720 | interface dd 3 ; not active,slip,ppp,packet driver |
730 | assigned dd 0 ; get ip from server |
721 | assigned dd 0 ; get ip from server |
731 | 722 | ||
732 | config dd 0 |
723 | config dd 0 |
733 | 724 | ||
734 | I_END:->>>>>>> |
725 | I_END:->>>>>>> |