Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1723 ataualpa 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
31 halyavin 2
;                                          ;
3
;   Stack Configuration Tool               ;
4
;                                          ;
5
;   Compile with FASM for Menuet           ;
6
;                                          ;
7
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8
 
199 heavyiron 9
 
10
memsize = 100000h
664 ataualpa 11
	       org 0
12
PARAMS	= memsize - 1024
199 heavyiron 13
 
31 halyavin 14
use32
15
 
664 ataualpa 16
	       db     'MENUET01'	      ; 8 byte id
17
	       dd     0x01		      ; header version
18
	       dd     START		      ; start of code
19
	       dd     I_END		      ; size of image
20
	       dd     memsize		      ; memory for app
21
	       dd     memsize - 1024	      ; esp
22
	       dd     PARAMS , 0x0	      ; I_Param , I_Icon
31 halyavin 23
 
24
include 'lang.inc'
1010 hidnplayr 25
include '../../../macros.inc'
485 heavyiron 26
 
664 ataualpa 27
START:				; start of execution
31 halyavin 28
 
1010 hidnplayr 29
read_stack_setup:
199 heavyiron 30
 
1010 hidnplayr 31
    mov  eax,52
32
    mov  ebx,0
33
    mcall
34
    mov  [config],eax
199 heavyiron 35
 
1010 hidnplayr 36
    mov  eax,52
37
    mov  ebx,1
38
    mcall
39
    mov  dword [ip_address],eax
40
 
41
    mov  eax,52
42
    mov  ebx,9
43
    mcall
44
    mov  dword [gateway_ip],eax
45
 
46
    mov  eax,52
47
    mov  ebx,10
48
    mcall
49
    mov  dword [subnet_mask],eax
50
 
51
    mov  eax,52
52
    mov  ebx,13
53
    mcall
54
    mov  dword [dns_ip],eax
55
 
56
    mov  eax,[config]	; unwrap com IRQ
57
    shr  eax,8
58
    and  eax,0xf
59
    mov  [com_irq],eax
60
 
61
    mov  eax,[config]	; unwrap com PORT
62
    shr  eax,16
63
    and  eax,0xfff
64
    mov  [com_add],eax
65
 
66
    mov  eax,[config]	; unwrap IRQ
67
    and  eax,0xf
68
    mov  [interface],eax
69
 
70
    mov  eax,[config]	; unwrap com PORT
71
    shr  eax,7
72
    and  eax,1
73
    mov  [assigned],eax
74
 
485 heavyiron 75
  red:
664 ataualpa 76
    call draw_window		; at first, draw the window
31 halyavin 77
 
78
still:
79
 
664 ataualpa 80
    mov  eax,10 		; wait here for event
485 heavyiron 81
    mcall
31 halyavin 82
 
664 ataualpa 83
    cmp  eax,1			; redraw request ?
84
    jz	 red
85
    cmp  eax,2			; key in buffer ?
485 heavyiron 86
    jnz  button
31 halyavin 87
 
664 ataualpa 88
  key:				; key
625 diamond 89
;    mov  al,2                  ; just read it and ignore
485 heavyiron 90
    mcall
31 halyavin 91
    jmp  still
92
 
664 ataualpa 93
  button:			; button
94
    mov  al,17		       ; get id
485 heavyiron 95
    mcall
31 halyavin 96
 
97
    shr  eax,8
98
 
664 ataualpa 99
    dec  eax			 ; button id=1 ?
31 halyavin 100
    jne  noclose
664 ataualpa 101
    or	 eax,-1 		; close this program
485 heavyiron 102
    mcall
31 halyavin 103
  noclose:
104
 
664 ataualpa 105
    dec  eax
106
    je	 read_stack_setup
31 halyavin 107
 
664 ataualpa 108
    dec  eax
199 heavyiron 109
    jne  no_apply_stack_setup
110
    call apply_stack_setup
111
    jmp  still
31 halyavin 112
 
199 heavyiron 113
no_apply_stack_setup:
664 ataualpa 114
    dec  eax		      ; GET COM PORT
625 diamond 115
    dec  eax
31 halyavin 116
    jne  no_read_comport
117
    mov  [string_x],272
118
    mov  [string_y],40
119
    mov  [string_length],3
120
    call read_string
121
    movzx eax,byte [string]
122
    cmp  eax,'A'
664 ataualpa 123
    jb	 gcp1
31 halyavin 124
    sub  eax,'A'-'9'-1
125
   gcp1:
126
    sub  eax,48
127
    shl  eax,8
128
    mov  ebx,eax
129
    movzx eax,byte [string+1]
130
    cmp  eax,'A'
664 ataualpa 131
    jb	 gcp2
31 halyavin 132
    sub  eax,'A'-'9'-1
133
   gcp2:
134
    sub  eax,48
135
    shl  eax,4
136
    add  ebx,eax
137
    movzx eax,byte [string+2]
138
    cmp  eax,'A'
664 ataualpa 139
    jb	 gcp3
31 halyavin 140
    sub  eax,'A'-'9'-1
141
   gcp3:
142
    sub  eax,48
143
    add  ebx,eax
144
    mov  [com_add],ebx
625 diamond 145
    jmp  red
31 halyavin 146
   no_read_comport:
147
 
664 ataualpa 148
    dec  eax		      ; GET COM IRQ
31 halyavin 149
    jne  no_read_comirq
150
    mov  [string_x],284
151
    mov  [string_y],50
152
    mov  [string_length],1
153
    call read_string
154
    movzx eax,byte [string]
155
    cmp  eax,'A'
664 ataualpa 156
    jb	 gci1
31 halyavin 157
    sub  eax,'A'-'9'-1
158
   gci1:
159
    sub  eax,48
160
    mov  [com_irq],eax
625 diamond 161
    jmp  red
31 halyavin 162
    no_read_comirq:
163
 
664 ataualpa 164
    dec  eax		      ; GET IP
625 diamond 165
    jne  no_read_ip
166
    mov  [string_x],205
167
    mov  [string_y],80
168
    mov  [string_length],15
169
    call read_string
170
    mov   esi,string-1
171
    mov   edi,ip_address
172
   ip0:
173
    xor   eax,eax
174
   ip1:
175
    inc   esi
176
    cmp   [esi],byte '0'
664 ataualpa 177
    jb	  ip2
625 diamond 178
    cmp   [esi],byte '9'
664 ataualpa 179
    jg	  ip2
625 diamond 180
    imul  eax,10
181
    movzx ebx,byte [esi]
182
    sub   ebx,48
183
    add   eax,ebx
184
    jmp   ip1
185
   ip2:
186
    stosb
187
    cmp   edi,ip_address+3
188
    jbe   ip0
189
    jmp   red
190
   no_read_ip:
664 ataualpa 191
 
192
    dec     eax 		; set gateway ip
31 halyavin 193
    jne     no_set_gateway
194
 
195
    mov  [string_x],205
196
    mov  [string_y],90
197
    mov  [string_length],15
198
    call read_string
199
    mov   esi,string-1
200
    mov   edi,gateway_ip
625 diamond 201
   gip0:
31 halyavin 202
    xor   eax,eax
203
   gip1:
204
    inc   esi
205
    cmp   [esi],byte '0'
664 ataualpa 206
    jb	  gip2
31 halyavin 207
    cmp   [esi],byte '9'
664 ataualpa 208
    jg	  gip2
31 halyavin 209
    imul  eax,10
210
    movzx ebx,byte [esi]
211
    sub   ebx,48
212
    add   eax,ebx
213
    jmp   gip1
214
   gip2:
625 diamond 215
    stosb