Rev 2191 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2191 | Rev 2592 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ; |
1 | ; |
2 | ; PANEL SETUP |
2 | ; PANEL SETUP |
3 | ; |
3 | ; |
- | 4 | ;------------------------------------------------------------------------------ |
|
- | 5 | ; last update: 09/04/2012 |
|
- | 6 | ; changed by: Marat Zakiyanov aka Mario79, aka Mario |
|
4 | ; Compile with FASM for Menuet |
7 | ; changes: Code optimizing and refactoring. |
5 | ; |
8 | ; |
6 | - | ||
- | 9 | ;------------------------------------------------------------------------------ |
|
7 | use32 |
10 | use32 |
8 | - | ||
9 | org 0x0 |
11 | org 0x0 |
10 | - | ||
11 | db 'MENUET01' ; 8 byte id |
12 | db 'MENUET01' ; 8 byte id |
12 | dd 0x01 ; header version |
13 | dd 0x01 ; header version |
13 | dd START ; start of code |
14 | dd START ; start of code |
14 | dd I_END ; size of image |
15 | dd IM_END ; size of image |
15 | dd 0x8000 ; memory for app |
16 | dd I_END ;0x8000 ; memory for app |
- | 17 | dd stack_top ; esp |
|
16 | dd 0x8000 ; esp |
18 | dd 0x0 ; boot parameters |
- | 19 | dd 0x0 ; path |
|
17 | dd 0x0 , 0x0 ; I_Param , I_Icon |
20 | ;------------------------------------------------------------------------------ |
18 | - | ||
19 | include '../../../macros.inc' |
21 | include '../../../macros.inc' |
- | 22 | ;------------------------------------------------------------------------------ |
|
20 | 23 | START: |
|
21 | START: ; start of execution |
24 | ;------------------------------------------------------------------------------ |
- | 25 | align 4 |
|
22 | 26 | red: |
|
23 | call draw_window |
27 | call draw_window |
- | 28 | ;------------------------------------------------------------------------------ |
|
24 | 29 | align 4 |
|
25 | still: |
30 | still: |
26 | - | ||
27 | mov eax,10 ; wait here for event |
- | |
28 | int 0x40 |
31 | mcall 10 |
Line 29... | Line 32... | ||
29 | 32 | ||
30 | cmp eax,1 ; redraw request ? |
33 | cmp eax,1 ; redraw request ? |
- | 34 | je red |
|
31 | je red |
35 | |
32 | cmp eax,2 ; key in buffer ? |
36 | cmp eax,2 ; key in buffer ? |
- | 37 | je key |
|
33 | je key |
38 | |
34 | cmp eax,3 ; button in buffer ? |
39 | cmp eax,3 ; button in buffer ? |
Line 35... | Line 40... | ||
35 | je button |
40 | je button |
36 | - | ||
37 | jmp still |
41 | |
38 | - | ||
39 | red: ; redraw |
42 | jmp still |
40 | call draw_window |
43 | ;------------------------------------------------------------------------------ |
41 | jmp still |
- | |
42 | - | ||
43 | key: ; key |
44 | align 4 |
Line 44... | Line 45... | ||
44 | mov eax,2 ; just read it and ignore |
45 | key: |
45 | int 0x40 |
46 | mcall 2 |
46 | 47 | ||
- | 48 | shr eax,8 |
|
47 | shr eax,8 |
49 | cmp eax,'0' |
48 | cmp eax,'0' |
50 | jb still |
Line 49... | Line 51... | ||
49 | jb still |
51 | |
50 | cmp eax,'9' |
52 | cmp eax,'9' |
Line 58... | Line 60... | ||
58 | cld |
60 | cld |
59 | rep movsb |
61 | rep movsb |
Line 60... | Line 62... | ||
60 | 62 | ||
Line 61... | Line -... | ||
61 | mov [edi],al |
- | |
62 | 63 | mov [edi],al |
|
- | 64 | ||
63 | call draw_window |
65 | jmp red |
64 | jmp still |
66 | ;------------------------------------------------------------------------------ |
65 | - | ||
66 | button: ; button |
67 | align 4 |
Line 67... | Line 68... | ||
67 | mov eax,17 ; get id |
68 | button: |
68 | int 0x40 |
69 | mcall 17 |
69 | - | ||
70 | cmp ah,1 ; button id=1 ? |
- | |
71 | jne noclose |
- | |
Line -... | Line 70... | ||
- | 70 | ||
- | 71 | cmp ah,1 ; button id=1 ? |
|
- | 72 | jne noclose |
|
- | 73 | ||
72 | mov eax,-1 ; close this program |
74 | mcall -1 ; close this program |
73 | int 0x40 |
75 | ;-------------------------------------- |
Line 74... | Line 76... | ||
74 | noclose: |
76 | align 4 |
75 | 77 | noclose: |
|
76 | cmp ah,10 |
78 | cmp ah,10 |
- | 79 | jne no_apply |
|
- | 80 | ||
77 | jne no_apply |
81 | mov esi,text+17 |
78 | 82 | mov edi,panel_ini_data_area ;I_END+10 |
|
79 | mov esi,text+17 |
83 | mov ecx,12 |
80 | mov edi,I_END+10 |
84 | ;-------------------------------------- |
81 | mov ecx,12 |
85 | align 4 |
82 | newfe: |
86 | newfe: |
83 | mov ebx,[esi] |
87 | mov ebx,[esi] |
84 | mov [edi],ebx |
- | |
85 | mov [edi+4],byte ';' |
- | |
86 | add edi,5 |
- | |
87 | add esi,55 |
- | |
88 | loop newfe |
- | |
89 | mov [edi],byte 'x' |
- | |
Line -... | Line 88... | ||
- | 88 | mov [edi],ebx |
|
- | 89 | mov [edi+4],byte ';' |
|
90 | 90 | add edi,5 |
|
- | 91 | add esi,55 |
|
- | 92 | loop newfe |
|
91 | mov eax,70 |
93 | |
92 | mov ebx,dat_write |
94 | mov [edi],byte 'x' |
93 | int 0x40 |
- | |
94 | - | ||
95 | 95 | mcall 70,dat_write |
|
96 | mov esi,1 |
- | |
97 | newread: |
96 | mov esi,1 |
98 | inc esi |
97 | ;-------------------------------------- |
Line 99... | Line 98... | ||
99 | mov eax,9 |
98 | align 4 |
100 | mov ebx,I_END |
99 | newread: |
101 | mov ecx,esi |
100 | inc esi |
102 | int 0x40 |
101 | mcall 9,proc_info,esi |
- | 102 | cmp esi,eax |
|
103 | cmp esi,eax |
103 | jg all_terminated |
104 | jg all_terminated |
104 | |
105 | 105 | mov eax,[ebx+10] |
|
106 | mov eax,[ebx+10] |
106 | and eax,not 0x20202000 |
Line 107... | Line -... | ||
107 | and eax,not 0x20202000 |
- | |
108 | cmp eax,'@PAN' |
- | |
109 | jne newread |
107 | cmp eax,'@PAN' |
110 | mov eax,[ebx+14] |
- | |
111 | and eax,not 0x2020 |
- | |
112 | cmp eax,'EL ' |
- | |
113 | jne newread |
- | |
114 | - | ||
Line 115... | Line 108... | ||
115 | mov eax,18 |
108 | jne newread |
Line -... | Line 109... | ||
- | 109 | ||
116 | mov ebx,2 |
110 | mov eax,[ebx+14] |
- | 111 | and eax,not 0x2020 |
|
117 | mov ecx,esi |
112 | cmp ax,'EL' |
118 | int 0x40 |
113 | jne newread |
- | 114 | ||
Line 119... | Line -... | ||
119 | - | ||
120 | mov eax,5 |
- | |
121 | mov ebx,5 |
- | |
122 | int 0x40 |
- | |
123 | 115 | mcall 18,2,esi |
|
124 | mov esi,1 |
116 | |
125 | 117 | mcall 5,5 |
|
126 | jmp newread |
- | |
127 | 118 | ||
128 | all_terminated: |
- | |
129 | 119 | mov esi,1 |
|
130 | mov eax,5 |
120 | jmp newread |
- | 121 | ;-------------------------------------- |
|
131 | mov ebx,25 |
122 | align 4 |
132 | int 0x40 |
123 | all_terminated: |
133 | 124 | mcall 5,25 |
|
134 | mov eax, 70 |
125 | |
135 | mov ebx, panel_start |
126 | mcall 70,panel_start |
136 | int 0x40 |
127 | ;-------------------------------------- |
137 | - | ||
138 | no_apply: |
- | |
139 | - | ||
140 | cmp ah,11 |
- | |
141 | jb no_entry |
- | |
142 | shr eax,8 |
- | |
143 | sub eax,11 |
- | |
144 | imul eax,55 |
- | |
145 | add eax,17 |
- | |
146 | mov [ent],eax |
- | |
147 | mov [text+eax],dword '0000' |
- | |
148 | call draw_window |
- | |
149 | jmp still |
- | |
150 | no_entry: |
- | |
151 | - | ||
152 | - | ||
153 | jmp still |
- | |
154 | - | ||
155 | 128 | align 4 |
|
156 | ent dd 17 |
- | |
157 | - | ||
158 | panel_start: |
- | |
159 | dd 7 |
- | |
160 | dd 0 |
129 | no_apply: |
161 | dd 0 |
- | |
162 | dd 0 |
130 | cmp ah,11 |
163 | dd 0 |
131 | jb still |
164 | db '/RD/1/@PANEL',0 |
132 | |
165 | - | ||
- | 133 | shr eax,8 |
|
166 | dat_write: |
134 | sub eax,11 |
167 | dd 2 |
135 | imul eax,55 |
168 | dq 0 |
- | |
169 | dd 5*12+1 |
- | |
170 | dd I_END+10 |
- | |
171 | db 'PANEL.DAT',0 |
- | |
172 | 136 | add eax,17 |
|
173 | ; ********************************************* |
- | |
174 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
137 | mov [ent],eax |
175 | ; ********************************************* |
- | |
176 | 138 | mov [text+eax],dword '0000' |
|
177 | 139 | jmp red |
|
178 | draw_window: |
- | |
179 | 140 | ;------------------------------------------------------------------------------ |
|
180 | - | ||
181 | mov eax,12 ; function 12:tell os about windowdraw |
141 | ; ********************************************* |
182 | mov ebx,1 ; 1, start of draw |
- | |
183 | int 0x40 |
- | |
184 | - | ||
185 | ; DRAW WINDOW |
- | |
186 | mov eax,0 ; function 0 : define and draw window |
142 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
187 | mov ebx,100*65536+385 ; [x start] *65536 + [x size] |
- | |
Line 188... | Line -... | ||
188 | mov ecx,100*65536+190 ; [y start] *65536 + [y size] |
- | |
189 | mov edx,0x14ffffff ; color of work area RRGGBB,8->color gl |
143 | ; ********************************************* |
190 | mov edi,labelt ; color of frames RRGGBB |
144 | ;------------------------------------------------------------------------------ |
191 | int 0x40 |
145 | align 4 |
- | 146 | draw_window: |
|
- | 147 | mcall 12,1 |
|
192 | 148 | ; DRAW WINDOW |
|
193 | mov eax,8 |
149 | xor eax,eax |
194 | mov ebx,25*65536+335 ;160 |
150 | xor esi,esi |
195 | mov ecx,162*65536+12 |
151 | mcall ,<100,385>,<100,190>,0x14ffffff,,labelt |
196 | mov edx,10 |
152 | |
197 | mov esi,0x80a0c0 ;0x6677cc |
153 | mcall 8,<25,335>,<162,12>,10,0x80a0c0 ;0x6677cc |
Line 198... | Line 154... | ||
198 | int 0x40 |
154 | |
199 | 155 | mov ebx,340*65536+20 |
|
200 | mov eax,8 |
156 | mov ecx,34*65536+10 |
201 | mov ebx,340*65536+20 |
157 | inc edx ;11 - button |
202 | mov ecx,34*65536+10 |
- | |
203 | mov edx,11 |
158 | ;-------------------------------------- |
- | 159 | align 4 |
|
204 | newb: |
160 | newb: |
- | 161 | mcall |
|
- | 162 | add ecx,10*65536 |
|
205 | int 0x40 |
163 | inc edx |
206 | add ecx,10*65536 |
164 | cmp edx,23 |
207 | inc edx |
165 | jb newb |
208 | cmp edx,23 |
166 | |
Line 209... | Line -... | ||
209 | jb newb |
- | |
210 | - | ||
211 | mov ebx,25*65536+35 ; draw info text with function 4 |
167 | mov ebx,25*65536+35 ; draw info text with function 4 |
212 | mov ecx,0x224466 |
- | |
213 | mov edx,text |
168 | mov ecx,0x224466 |
214 | mov esi,55 |
- | |
- | 169 | mov edx,text |
|
215 | newline: |
170 | mov esi,55 |
216 | mov eax,4 |
171 | mov eax,4 |
217 | int 0x40 |
- | |
218 | add ebx,10 |
- | |
219 | add edx,55 |
172 | ;-------------------------------------- |
220 | cmp [edx],byte 'x' |
- | |
221 | jne newline |
173 | align 4 |
222 | 174 | newline: |
|
223 | mov eax,12 ; function 12:tell os about windowdraw |
175 | mcall |
224 | mov ebx,2 ; 2, end of draw |
176 | add ebx,10 |
225 | int 0x40 |
177 | add edx,55 |
Line 245... | Line 197... | ||
245 | db 'soften_middle 0001 : 0 no , 1 yes <' |
197 | db 'soften_middle 0001 : 0 no , 1 yes <' |
246 | db 'icons 0001 : 0 start , 1 activate <' |
198 | db 'icons 0001 : 0 start , 1 activate <' |
247 | db ' ' |
199 | db ' ' |
248 | db ' APPLY ' |
200 | db ' APPLY ' |
249 | db 'x' |
201 | db 'x' |
250 | - | ||
251 | - | ||
- | 202 | ;------------------------------------------------------------------------------ |
|
252 | labelt: |
203 | labelt: |
253 | db 'Panel setup' |
204 | db 'Panel setup' |
254 | labellen: |
205 | labellen: |
- | 206 | ;------------------------------------------------------------------------------ |
|
- | 207 | align 4 |
|
- | 208 | ent dd 17 |
|
- | 209 | ;------------------------------------------------------------------------------ |
|
- | 210 | align 4 |
|
- | 211 | panel_start: |
|
255 | 212 | dd 7 |
|
- | 213 | dd 0 |
|
- | 214 | dd 0 |
|
- | 215 | dd 0 |
|
- | 216 | dd 0 |
|
- | 217 | db '/RD/1/@PANEL',0 |
|
- | 218 | ;------------------------------------------------------------------------------ |
|
- | 219 | align 4 |
|
- | 220 | dat_write: |
|
- | 221 | dd 2 |
|
- | 222 | dd 0 |
|
- | 223 | dd 0 |
|
- | 224 | dd 5*12+1 |
|
- | 225 | dd panel_ini_data_area ;I_END+10 |
|
- | 226 | db 'PANEL.DAT',0 |
|
- | 227 | ;------------------------------------------------------------------------------ |
|
- | 228 | IM_END: |
|
- | 229 | ;------------------------------------------------------------------------------ |
|
- | 230 | align 4 |
|
- | 231 | proc_info: |
|
- | 232 | rb 1024 |
|
- | 233 | ;------------------------------------------------------------------------------ |
|
- | 234 | align 4 |
|
- | 235 | rb 1024 |
|
- | 236 | stack_top: |
|
- | 237 | ;------------------------------------------------------------------------------ |
|
- | 238 | align 4 |
|
- | 239 | panel_ini_data_area: |
|
- | 240 | rb 61 |
|
- | 241 | ;------------------------------------------------------------------------------ |
|
256 | I_END:' |
242 | I_END: |
- | 243 | ;------------------------------------------------------------------------------' |