Subversion Repositories Kolibri OS

Rev

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

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