Rev 134 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 134 | Rev 485 | ||
---|---|---|---|
1 | lang equ ru ; ru en fr ge fi |
1 | lang equ ru ; ru en fr ge fi |
2 | 2 | ||
3 | ; |
3 | ; |
4 | ; Assembler |
4 | ; Assembler |
5 | ; SMALL |
5 | ; SMALL |
6 | ; CODE |
6 | ; CODE |
7 | ; Libary |
7 | ; Libary |
8 | ; |
8 | ; |
9 | ; Ver 0.14 By Pavlushin Evgeni (RUSSIA) |
9 | ; Ver 0.14 By Pavlushin Evgeni (RUSSIA) |
10 | ; www.waptap@mail.ru |
10 | ; www.waptap@mail.ru |
11 | 11 | ||
12 | ;Please compile aplications on FASM ver1.54 or higer!!! |
12 | ;Please compile aplications on FASM ver1.54 or higer!!! |
13 | 13 | ||
14 | ;InfoList |
14 | ;InfoList |
15 | ;0.01 scank,putpix,puttxt |
15 | ;0.01 scank,putpix,puttxt |
16 | ;0.02 label,random,colors |
16 | ;0.02 label,random,colors |
17 | ;0.03 window,startwd,endwd,attributes |
17 | ;0.03 window,startwd,endwd,attributes |
18 | ;0.04 close,delay,scevent ~30.04.2004 |
18 | ;0.04 close,delay,scevent ~30.04.2004 |
19 | ;0.05 small random, ~04.05.2004 |
19 | ;0.05 small random, ~04.05.2004 |
20 | ;0.06 wtevent ~09.05.2004 |
20 | ;0.06 wtevent ~09.05.2004 |
21 | ;0.07 timeevent ~23.05.2004 |
21 | ;0.07 timeevent ~23.05.2004 |
22 | ;0.08 txtput ~14.06.2004 |
22 | ;0.08 txtput ~14.06.2004 |
23 | ;0.09 opendialog,savedialog ~20.06.2004 |
23 | ;0.09 opendialog,savedialog ~20.06.2004 |
24 | ;0.10 wordstoreg by halyavin, add at ~30.08.2004 |
24 | ;0.10 wordstoreg by halyavin, add at ~30.08.2004 |
25 | ; random bug deleted eax is use. |
25 | ; random bug deleted eax is use. |
26 | ;0.11 loadfile from me +puttxt bug del ~07.09.2004 |
26 | ;0.11 loadfile from me +puttxt bug del ~07.09.2004 |
27 | ;0.12 open/save dialog ~13.09.2004 |
27 | ;0.12 open/save dialog ~13.09.2004 |
28 | ;0.13 dialogs bugs deleted |
28 | ;0.13 dialogs bugs deleted |
29 | ;0.14 drawlbut ~03.10.2004 |
29 | ;0.14 drawlbut ~03.10.2004 |
30 | ;0.15 extendet label! |
30 | ;0.15 extendet label! |
31 | 31 | ||
32 | ; LOADFILE |
32 | ; LOADFILE |
33 | ; (SYNTAX) LOADFILE 'full_path_to_file',file_load_area,file_temp_area |
33 | ; (SYNTAX) LOADFILE 'full_path_to_file',file_load_area,file_temp_area |
34 | ; (SAMPLE) LOADFILE '/rd/1/clock.bmp',load_area,temp_area |
34 | ; (SAMPLE) LOADFILE '/rd/1/clock.bmp',load_area,temp_area |
35 | 35 | ||
36 | 36 | ||
37 | macro loadfile file_name,file_load_area,file_temp_area |
37 | macro loadfile file_name,file_load_area,file_temp_area |
38 | { |
38 | { |
39 | local open,fileinfo,string |
39 | local open,fileinfo,string |
40 | jmp open |
40 | jmp open |
41 | fileinfo: |
41 | fileinfo: |
42 | dd 0 |
42 | dd 0 |
43 | dd 0 |
43 | dd 0 |
44 | dd 1 |
44 | dd 1 |
45 | dd file_load_area |
45 | dd file_load_area |
46 | dd file_temp_area |
46 | dd file_temp_area |
47 | string: |
47 | string: |
48 | db file_name,0 |
48 | db file_name,0 |
49 | open: |
49 | open: |
50 | mov dword [fileinfo+8],1 ; how many blocks to read (1) |
50 | mov dword [fileinfo+8],1 ; how many blocks to read (1) |
51 | mov eax,58 |
51 | mov eax,58 |
52 | mov ebx,fileinfo |
52 | mov ebx,fileinfo |
53 | int 0x40 |
53 | mcall |
54 | mov eax,[file_load_area+2] |
54 | mov eax,[file_load_area+2] |
55 | shr eax,9 ; ¯®¤¥«¨¬ 512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢ |
55 | shr eax,9 ; ¯®¤¥«¨¬ 512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢ |
56 | inc eax |
56 | inc eax |
57 | mov dword [fileinfo+8],eax |
57 | mov dword [fileinfo+8],eax |
58 | mov eax,58 |
58 | mov eax,58 |
59 | mov ebx,fileinfo |
59 | mov ebx,fileinfo |
60 | int 0x40 |
60 | mcall |
61 | } |
61 | } |
62 | 62 | ||
63 | 63 | ||
64 | ;macro wordstoreg reg,hiword,loword |
64 | ;macro wordstoreg reg,hiword,loword |
65 | ;{ |
65 | ;{ |
66 | ;if hiword eqtype 0 & loword eqtype 0 |
66 | ;if hiword eqtype 0 & loword eqtype 0 |
67 | ; mov reg,dword hiword*65536+loword |
67 | ; mov reg,dword hiword*65536+loword |
68 | ;else if hiword eqtype 12 & loword eqtype eax |
68 | ;else if hiword eqtype 12 & loword eqtype eax |
69 | ; mov reg,dword hiword*65536 |
69 | ; mov reg,dword hiword*65536 |
70 | ; add reg,dword loword |
70 | ; add reg,dword loword |
71 | ;else if hiword eqtype 12 & loword eqtype [123] |
71 | ;else if hiword eqtype 12 & loword eqtype [123] |
72 | ; mov reg,dword hiword*65536 |
72 | ; mov reg,dword hiword*65536 |
73 | ; add reg,dword loword |
73 | ; add reg,dword loword |
74 | ;else |
74 | ;else |
75 | ; mov reg,dword hiword |
75 | ; mov reg,dword hiword |
76 | ; shl reg,16 |
76 | ; shl reg,16 |
77 | ; add reg,dword loword |
77 | ; add reg,dword loword |
78 | ;end if |
78 | ;end if |
79 | ;} |
79 | ;} |
80 | 80 | ||
81 | macro dword2reg reg,doubleword |
81 | macro dword2reg reg,doubleword |
82 | { |
82 | { |
83 | if doubleword eq |
83 | if doubleword eq |
84 | ; not changes |
84 | ; not changes |
85 | else |
85 | else |
86 | mov reg,dword doubleword |
86 | mov reg,dword doubleword |
87 | end if |
87 | end if |
88 | } |
88 | } |
89 | 89 | ||
90 | macro words2reg reg,hiword,lowword |
90 | macro words2reg reg,hiword,lowword |
91 | { |
91 | { |
92 | if hiword eq |
92 | if hiword eq |
93 | if lowword eq |
93 | if lowword eq |
94 | ; not changes |
94 | ; not changes |
95 | else |
95 | else |
96 | if lowword eqtype 12 |
96 | if lowword eqtype 12 |
97 | and reg,dword 0xffff0000 |
97 | and reg,dword 0xffff0000 |
98 | add reg,dword lowword |
98 | add reg,dword lowword |
99 | else |
99 | else |
100 | and reg,dword 0xffff0000 |
100 | and reg,dword 0xffff0000 |
101 | add reg,dword lowword |
101 | add reg,dword lowword |
102 | end if |
102 | end if |
103 | end if |
103 | end if |
104 | else |
104 | else |
105 | if lowword eq |
105 | if lowword eq |
106 | if hiword eqtype 12 |
106 | if hiword eqtype 12 |
107 | and reg,dword 0x0000ffff |
107 | and reg,dword 0x0000ffff |
108 | add reg,dword hiword*65536 |
108 | add reg,dword hiword*65536 |
109 | else |
109 | else |
110 | shl reg,16 |
110 | shl reg,16 |
111 | add reg,dword hiword |
111 | add reg,dword hiword |
112 | ror reg,16 |
112 | ror reg,16 |
113 | end if |
113 | end if |
114 | else |
114 | else |
115 | if lowword eqtype 12 & hiword eqtype 12 |
115 | if lowword eqtype 12 & hiword eqtype 12 |
116 | if lowword eq 0 & hiword eq 0 |
116 | if lowword eq 0 & hiword eq 0 |
117 | xor reg,reg |
117 | xor reg,reg |
118 | else |
118 | else |
119 | mov reg,dword hiword*65536+lowword |
119 | mov reg,dword hiword*65536+lowword |
120 | end if |
120 | end if |
121 | else |
121 | else |
122 | mov reg,dword hiword |
122 | mov reg,dword hiword |
123 | shl reg,16 |
123 | shl reg,16 |
124 | add reg,dword lowword |
124 | add reg,dword lowword |
125 | end if |
125 | end if |
126 | end if |
126 | end if |
127 | end if |
127 | end if |
128 | } |
128 | } |
129 | 129 | ||
130 | 130 | ||
131 | 131 | ||
132 | 132 | ||
133 | ; DRAW BUTTON with label |
133 | ; DRAW BUTTON with label |
134 | 134 | ||
135 | macro drawlbut x,y,xs,ys,text,id,bcolor,tcolor |
135 | macro drawlbut x,y,xs,ys,text,id,bcolor,tcolor |
136 | { |
136 | { |
137 | local asd,lab |
137 | local asd,lab |
138 | jmp asd |
138 | jmp asd |
139 | lab db text ;arg label |
139 | lab db text ;arg label |
140 | asd: |
140 | asd: |
141 | words2reg ebx,x,xs |
141 | words2reg ebx,x,xs |
142 | words2reg ecx,y,ys |
142 | words2reg ecx,y,ys |
143 | mov edx,id |
143 | mov edx,id |
144 | mov esi,bcolor |
144 | mov esi,bcolor |
145 | mov eax,8 |
145 | mov eax,8 |
146 | int 0x40 |
146 | mcall |
147 | 147 | ||
148 | mov eax,asd-lab ;calc size |
148 | mov eax,asd-lab ;calc size |
149 | mov ebx,6 |
149 | mov ebx,6 |
150 | mul ebx |
150 | mul ebx |
151 | mov esi,eax |
151 | mov esi,eax |
152 | 152 | ||
153 | mov eax,xs |
153 | mov eax,xs |
154 | sub eax,esi |
154 | sub eax,esi |
155 | shr eax,1 |
155 | shr eax,1 |
156 | add eax,x |
156 | add eax,x |
157 | 157 | ||
158 | mov edx,ys |
158 | mov edx,ys |
159 | sub edx,7 |
159 | sub edx,7 |
160 | shr edx,1 |
160 | shr edx,1 |
161 | add edx,y |
161 | add edx,y |
162 | 162 | ||
163 | mov ebx,eax |
163 | mov ebx,eax |
164 | shl ebx,16 |
164 | shl ebx,16 |
165 | add ebx,edx |
165 | add ebx,edx |
166 | 166 | ||
167 | mov ecx,tcolor ;arg4 color |
167 | mov ecx,tcolor ;arg4 color |
168 | mov edx,lab |
168 | mov edx,lab |
169 | mov esi,asd-lab ;calc size |
169 | mov esi,asd-lab ;calc size |
170 | mov eax,4 |
170 | mov eax,4 |
171 | int 0x40 |
171 | mcall |
172 | } |
172 | } |
173 | 173 | ||
174 | 174 | ||
175 | macro opendialog redproc,openoff,erroff,path |
175 | macro opendialog redproc,openoff,erroff,path |
176 | { |
176 | { |
177 | local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc |
177 | local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc |
178 | local run_fileinfo, param |
178 | local run_fileinfo, param |
179 | local getmesloop, loox, mred, mkey, mbutton, mgetmes |
179 | local getmesloop, loox, mred, mkey, mbutton, mgetmes |
180 | local dlg_is_work, ready, procinfo |
180 | local dlg_is_work, ready, procinfo |
181 | ; |
181 | ; |
182 | ; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, |
182 | ; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, |
183 | ; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) |
183 | ; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) |
184 | ; |
184 | ; |
185 | 185 | ||
186 | cld |
186 | cld |
187 | ;; mov esi,path |
187 | ;; mov esi,path |
188 | mov edi,path |
188 | mov edi,path |
189 | xor eax,eax |
189 | xor eax,eax |
190 | mov ecx,(1024+16)/4 |
190 | mov ecx,(1024+16)/4 |
191 | rep stosd |
191 | rep stosd |
192 | 192 | ||
193 | ;mov [get_loops],0 |
193 | ;mov [get_loops],0 |
194 | mov [dlg_pid_get],0 |
194 | mov [dlg_pid_get],0 |
195 | 195 | ||
196 | ; Get my PID in dec format 4 bytes |
196 | ; Get my PID in dec format 4 bytes |
197 | mov eax,9 |
197 | mov eax,9 |
198 | mov ebx,procinfo |
198 | mov ebx,procinfo |
199 | mov ecx,-1 |
199 | mov ecx,-1 |
200 | int 0x40 |
200 | mcall |
201 | 201 | ||
202 | ; convert eax bin to param dec |
202 | ; convert eax bin to param dec |
203 | mov eax,dword [procinfo+30] ;offset of myPID |
203 | mov eax,dword [procinfo+30] ;offset of myPID |
204 | mov edi,param+4-1 ;offset to 4 bytes |
204 | mov edi,param+4-1 ;offset to 4 bytes |
205 | mov ecx,4 |
205 | mov ecx,4 |
206 | mov ebx,10 |
206 | mov ebx,10 |
207 | cld |
207 | cld |
208 | new_d: |
208 | new_d: |
209 | xor edx,edx |
209 | xor edx,edx |
210 | div ebx |
210 | div ebx |
211 | add dl,'0' |
211 | add dl,'0' |
212 | mov [edi],dl |
212 | mov [edi],dl |
213 | dec edi |
213 | dec edi |
214 | loop new_d |
214 | loop new_d |
215 | 215 | ||
216 | ; wirite 1 byte space to param |
216 | ; wirite 1 byte space to param |
217 | mov [param+4],byte 32 ;Space for next parametr |
217 | mov [param+4],byte 32 ;Space for next parametr |
218 | ; and 1 byte type of dialog to param |
218 | ; and 1 byte type of dialog to param |
219 | mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog) |
219 | mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog) |
220 | 220 | ||
221 | ; |
221 | ; |
222 | ; STEP2 prepare IPC area for get messages |
222 | ; STEP2 prepare IPC area for get messages |
223 | ; |
223 | ; |
224 | 224 | ||
225 | ; prepare IPC area |
225 | ; prepare IPC area |
226 | mov [path],dword 0 |
226 | mov [path],dword 0 |
227 | mov [path+4],dword 8 |
227 | mov [path+4],dword 8 |
228 | 228 | ||
229 | ; define IPC memory |
229 | ; define IPC memory |
230 | mov eax,60 |
230 | mov eax,60 |
231 | mov ebx,1 ; define IPC |
231 | mov ebx,1 ; define IPC |
232 | mov ecx,path ; offset of area |
232 | mov ecx,path ; offset of area |
233 | mov edx,1024+16 ; size |
233 | mov edx,1024+16 ; size |
234 | int 0x40 |
234 | mcall |
235 | 235 | ||
236 | ; change wanted events list 7-bit IPC event |
236 | ; change wanted events list 7-bit IPC event |
237 | mov eax,40 |
237 | mov eax,40 |
238 | mov ebx,01000111b |
238 | mov ebx,01000111b |
239 | int 0x40 |
239 | mcall |
240 | 240 | ||
241 | ; |
241 | ; |
242 | ; STEP 3 run SYSTEM XTREE with parameters |
242 | ; STEP 3 run SYSTEM XTREE with parameters |
243 | ; |
243 | ; |
244 | 244 | ||
245 | mov eax,70 |
245 | mov eax,70 |
246 | mov ebx,run_fileinfo |
246 | mov ebx,run_fileinfo |
247 | int 0x40 |
247 | mcall |
248 | 248 | ||
249 | call redproc |
249 | call redproc |
250 | 250 | ||
251 | mov [get_loops],0 |
251 | mov [get_loops],0 |
252 | getmesloop: |
252 | getmesloop: |
253 | mov eax,23 |
253 | mov eax,23 |
254 | mov ebx,50 ;0.5 sec |
254 | mov ebx,50 ;0.5 sec |
255 | int 0x40 |
255 | mcall |
256 | dec eax |
256 | dec eax |
257 | jz mred |
257 | jz mred |
258 | dec eax |
258 | dec eax |
259 | jz mkey |
259 | jz mkey |
260 | dec eax |
260 | dec eax |
261 | jz mbutton |
261 | jz mbutton |
262 | cmp al, 7-3 |
262 | cmp al, 7-3 |
263 | jz mgetmes |
263 | jz mgetmes |
264 | 264 | ||
265 | ; Get number of procces |
265 | ; Get number of procces |
266 | mov ebx,procinfo |
266 | mov ebx,procinfo |
267 | mov ecx,-1 |
267 | mov ecx,-1 |
268 | mov eax,9 |
268 | mov eax,9 |
269 | int 0x40 |
269 | mcall |
270 | mov ebp,eax |
270 | mov ebp,eax |
271 | 271 | ||
272 | loox: |
272 | loox: |
273 | mov eax,9 |
273 | mov eax,9 |
274 | mov ebx,procinfo |
274 | mov ebx,procinfo |
275 | mov ecx,ebp |
275 | mov ecx,ebp |
276 | int 0x40 |
276 | mcall |
277 | mov eax,[DLGPID] |
277 | mov eax,[DLGPID] |
278 | cmp [procinfo+30],eax ;IF Dialog find |
278 | cmp [procinfo+30],eax ;IF Dialog find |
279 | je dlg_is_work ;jmp to dlg_is_work |
279 | je dlg_is_work ;jmp to dlg_is_work |
280 | dec ebp |
280 | dec ebp |
281 | jnz loox |
281 | jnz loox |
282 | 282 | ||
283 | jmp erroff |
283 | jmp erroff |
284 | 284 | ||
285 | dlg_is_work: |
285 | dlg_is_work: |
286 | cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated |
286 | cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated |
287 | je erroff ;TESTODP2 terminated too |
287 | je erroff ;TESTODP2 terminated too |
288 | 288 | ||
289 | cmp [dlg_pid_get],dword 1 |
289 | cmp [dlg_pid_get],dword 1 |
290 | je getmesloop |
290 | je getmesloop |
291 | inc [get_loops] |
291 | inc [get_loops] |
292 | cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated |
292 | cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated |
293 | jae erroff |
293 | jae erroff |
294 | jmp getmesloop |
294 | jmp getmesloop |
295 | 295 | ||
296 | mred: |
296 | mred: |
297 | call redproc |
297 | call redproc |
298 | jmp getmesloop |
298 | jmp getmesloop |
299 | mkey: |
299 | mkey: |
300 | mov eax,2 |
300 | mov eax,2 |
301 | int 0x40 ; read (eax=2) |
301 | mcall ; read (eax=2) |
302 | jmp getmesloop |
302 | jmp getmesloop |
303 | mbutton: |
303 | mbutton: |
304 | mov eax,17 ; get id |
304 | mov eax,17 ; get id |
305 | int 0x40 |
305 | mcall |
306 | cmp ah,1 ; button id=1 ? |
306 | cmp ah,1 ; button id=1 ? |
307 | jne getmesloop |
307 | jne getmesloop |
308 | mov eax,-1 ; close this program |
308 | mov eax,-1 ; close this program |
309 | int 0x40 |
309 | mcall |
310 | mgetmes: |
310 | mgetmes: |
311 | 311 | ||
312 | ; If dlg_pid_get then second message get jmp to still |
312 | ; If dlg_pid_get then second message get jmp to still |
313 | cmp [dlg_pid_get],dword 1 |
313 | cmp [dlg_pid_get],dword 1 |
314 | je ready |
314 | je ready |
315 | 315 | ||
316 | ; First message is number of PID SYSXTREE dialog |
316 | ; First message is number of PID SYSXTREE dialog |
317 | 317 | ||
318 | ; convert PID dec to PID bin |
318 | ; convert PID dec to PID bin |
319 | movzx eax,byte [path+16] |
319 | movzx eax,byte [path+16] |
320 | sub eax,48 |
320 | sub eax,48 |
321 | imul eax,10 |
321 | imul eax,10 |
322 | movzx ebx,byte [path+16+1] |
322 | movzx ebx,byte [path+16+1] |
323 | add eax,ebx |
323 | add eax,ebx |
324 | sub eax,48 |
324 | sub eax,48 |
325 | imul eax,10 |
325 | imul eax,10 |
326 | movzx ebx,byte [path+16+2] |
326 | movzx ebx,byte [path+16+2] |
327 | add eax,ebx |
327 | add eax,ebx |
328 | sub eax,48 |
328 | sub eax,48 |
329 | imul eax,10 |
329 | imul eax,10 |
330 | movzx ebx,byte [path+16+3] |
330 | movzx ebx,byte [path+16+3] |
331 | add eax,ebx |
331 | add eax,ebx |
332 | sub eax,48 |
332 | sub eax,48 |
333 | mov [DLGPID],eax |
333 | mov [DLGPID],eax |
334 | 334 | ||
335 | ; Claear and prepare IPC area for next message |
335 | ; Claear and prepare IPC area for next message |
336 | mov [path],dword 0 |
336 | mov [path],dword 0 |
337 | mov [path+4],dword 8 |
337 | mov [path+4],dword 8 |
338 | mov [path+8],dword 0 |
338 | mov [path+8],dword 0 |
339 | mov [path+12],dword 0 |
339 | mov [path+12],dword 0 |
340 | mov [path+16],dword 0 |
340 | mov [path+16],dword 0 |
341 | 341 | ||
342 | ; Set dlg_pid_get for get next message |
342 | ; Set dlg_pid_get for get next message |
343 | mov [dlg_pid_get],dword 1 |
343 | mov [dlg_pid_get],dword 1 |
344 | call redproc ;show DLG_PID |
344 | call redproc ;show DLG_PID |
345 | jmp getmesloop |
345 | jmp getmesloop |
346 | 346 | ||
347 | ready: |
347 | ready: |
348 | ; |
348 | ; |
349 | ; The second message get |
349 | ; The second message get |
350 | ; Second message is 1024 bytes path to SAVE/OPEN file |
350 | ; Second message is 1024 bytes path to SAVE/OPEN file |
351 | ; shl path string on 16 bytes |
351 | ; shl path string on 16 bytes |
352 | ; |
352 | ; |
353 | cld |
353 | cld |
354 | mov esi,path+16 |
354 | mov esi,path+16 |
355 | mov edi,path |
355 | mov edi,path |
356 | mov ecx,1024/4 |
356 | mov ecx,1024/4 |
357 | rep movsd |
357 | rep movsd |
358 | mov [edi],byte 0 |
358 | mov [edi],byte 0 |
359 | 359 | ||
360 | jmp openoff |
360 | jmp openoff |
361 | 361 | ||
362 | 362 | ||
363 | ; DATA AREA |
363 | ; DATA AREA |
364 | get_loops dd 0 |
364 | get_loops dd 0 |
365 | dlg_pid_get dd 0 |
365 | dlg_pid_get dd 0 |
366 | DLGPID dd 0 |
366 | DLGPID dd 0 |
367 | 367 | ||
368 | param: |
368 | param: |
369 | dd 0 ; My dec PID |
369 | dd 0 ; My dec PID |
370 | dd 0,0 ; Type of dialog |
370 | dd 0,0 ; Type of dialog |
371 | 371 | ||
372 | run_fileinfo: |
372 | run_fileinfo: |
373 | dd 7 |
373 | dd 7 |
374 | dd 0 |
374 | dd 0 |
375 | dd param |
375 | dd param |
376 | dd 0 |
376 | dd 0 |
377 | dd 0 |
377 | dd 0 |
378 | ;run_filepath |
378 | ;run_filepath |
379 | db '/RD/1/SYSXTREE',0 |
379 | db '/RD/1/SYSXTREE',0 |
380 | 380 | ||
381 | procinfo: |
381 | procinfo: |
382 | times 1024 db 0 |
382 | times 1024 db 0 |
383 | } |
383 | } |
384 | 384 | ||
385 | 385 | ||
386 | macro savedialog redproc,openoff,erroff,path |
386 | macro savedialog redproc,openoff,erroff,path |
387 | { |
387 | { |
388 | local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc |
388 | local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc |
389 | local run_fileinfo, run_filepath, param |
389 | local run_fileinfo, run_filepath, param |
390 | local getmesloop, loox, mred, mkey, mbutton, mgetmes |
390 | local getmesloop, loox, mred, mkey, mbutton, mgetmes |
391 | local dlg_is_work, ready, procinfo |
391 | local dlg_is_work, ready, procinfo |
392 | ; |
392 | ; |
393 | ; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, |
393 | ; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, |
394 | ; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) |
394 | ; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) |
395 | ; |
395 | ; |
396 | 396 | ||
397 | cld |
397 | cld |
398 | ;; mov esi,path |
398 | ;; mov esi,path |
399 | mov edi,path |
399 | mov edi,path |
400 | xor eax,eax |
400 | xor eax,eax |
401 | mov ecx,(1024+16)/4 |
401 | mov ecx,(1024+16)/4 |
402 | rep stosd |
402 | rep stosd |
403 | 403 | ||
404 | ;mov [get_loops],0 |
404 | ;mov [get_loops],0 |
405 | mov [dlg_pid_get],0 |
405 | mov [dlg_pid_get],0 |
406 | 406 | ||
407 | ; Get my PID in dec format 4 bytes |
407 | ; Get my PID in dec format 4 bytes |
408 | mov eax,9 |
408 | mov eax,9 |
409 | mov ebx,procinfo |
409 | mov ebx,procinfo |
410 | mov ecx,-1 |
410 | mov ecx,-1 |
411 | int 0x40 |
411 | mcall |
412 | 412 | ||
413 | ; convert eax bin to param dec |
413 | ; convert eax bin to param dec |
414 | mov eax,dword [procinfo+30] ;offset of myPID |
414 | mov eax,dword [procinfo+30] ;offset of myPID |
415 | mov edi,param+4-1 ;offset to 4 bytes |
415 | mov edi,param+4-1 ;offset to 4 bytes |
416 | mov ecx,4 |
416 | mov ecx,4 |
417 | mov ebx,10 |
417 | mov ebx,10 |
418 | cld |
418 | cld |
419 | new_d: |
419 | new_d: |
420 | xor edx,edx |
420 | xor edx,edx |
421 | div ebx |
421 | div ebx |
422 | add dl,'0' |
422 | add dl,'0' |
423 | mov [edi],dl |
423 | mov [edi],dl |
424 | dec edi |
424 | dec edi |
425 | loop new_d |
425 | loop new_d |
426 | 426 | ||
427 | ; wirite 1 byte space to param |
427 | ; wirite 1 byte space to param |
428 | mov [param+4],byte 32 ;Space for next parametr |
428 | mov [param+4],byte 32 ;Space for next parametr |
429 | ; and 1 byte type of dialog to param |
429 | ; and 1 byte type of dialog to param |
430 | mov [param+5],byte 'S' ;Get Open dialog (Use 'S' for Save dialog) |
430 | mov [param+5],byte 'S' ;Get Open dialog (Use 'S' for Save dialog) |
431 | 431 | ||
432 | ; |
432 | ; |
433 | ; STEP2 prepare IPC area for get messages |
433 | ; STEP2 prepare IPC area for get messages |
434 | ; |
434 | ; |
435 | 435 | ||
436 | ; prepare IPC area |
436 | ; prepare IPC area |
437 | mov [path],dword 0 |
437 | mov [path],dword 0 |
438 | mov [path+4],dword 8 |
438 | mov [path+4],dword 8 |
439 | 439 | ||
440 | ; define IPC memory |
440 | ; define IPC memory |
441 | mov eax,60 |
441 | mov eax,60 |
442 | mov ebx,1 ; define IPC |
442 | mov ebx,1 ; define IPC |
443 | mov ecx,path ; offset of area |
443 | mov ecx,path ; offset of area |
444 | mov edx,1024+16 ; size |
444 | mov edx,1024+16 ; size |
445 | int 0x40 |
445 | mcall |
446 | 446 | ||
447 | ; change wanted events list 7-bit IPC event |
447 | ; change wanted events list 7-bit IPC event |
448 | mov eax,40 |
448 | mov eax,40 |
449 | mov ebx,01000111b |
449 | mov ebx,01000111b |
450 | int 0x40 |
450 | mcall |
451 | 451 | ||
452 | ; |
452 | ; |
453 | ; STEP 3 run SYSTEM XTREE with parameters |
453 | ; STEP 3 run SYSTEM XTREE with parameters |
454 | ; |
454 | ; |
455 | 455 | ||
456 | mov eax,70 |
456 | mov eax,70 |
457 | mov ebx,run_fileinfo |
457 | mov ebx,run_fileinfo |
458 | int 0x40 |
458 | mcall |
459 | 459 | ||
460 | call redproc |
460 | call redproc |
461 | 461 | ||
462 | mov [get_loops],0 |
462 | mov [get_loops],0 |
463 | getmesloop: |
463 | getmesloop: |
464 | mov eax,23 |
464 | mov eax,23 |
465 | mov ebx,50 ;0.5 sec |
465 | mov ebx,50 ;0.5 sec |
466 | int 0x40 |
466 | mcall |
467 | dec eax |
467 | dec eax |
468 | jz mred |
468 | jz mred |
469 | dec eax |
469 | dec eax |
470 | jz mkey |
470 | jz mkey |
471 | dec eax |
471 | dec eax |
472 | jz mbutton |
472 | jz mbutton |
473 | cmp al, 7-3 |
473 | cmp al, 7-3 |
474 | jz mgetmes |
474 | jz mgetmes |
475 | 475 | ||
476 | ; Get number of procces |
476 | ; Get number of procces |
477 | mov ebx,procinfo |
477 | mov ebx,procinfo |
478 | mov ecx,-1 |
478 | mov ecx,-1 |
479 | mov eax,9 |
479 | mov eax,9 |
480 | int 0x40 |
480 | mcall |
481 | mov ebp,eax |
481 | mov ebp,eax |
482 | 482 | ||
483 | loox: |
483 | loox: |
484 | mov eax,9 |
484 | mov eax,9 |
485 | mov ebx,procinfo |
485 | mov ebx,procinfo |
486 | mov ecx,ebp |
486 | mov ecx,ebp |
487 | int 0x40 |
487 | mcall |
488 | mov eax,[DLGPID] |
488 | mov eax,[DLGPID] |
489 | cmp [procinfo+30],eax ;IF Dialog find |
489 | cmp [procinfo+30],eax ;IF Dialog find |
490 | je dlg_is_work ;jmp to dlg_is_work |
490 | je dlg_is_work ;jmp to dlg_is_work |
491 | dec ebp |
491 | dec ebp |
492 | jnz loox |
492 | jnz loox |
493 | 493 | ||
494 | jmp erroff |
494 | jmp erroff |
495 | 495 | ||
496 | dlg_is_work: |
496 | dlg_is_work: |
497 | cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated |
497 | cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated |
498 | je erroff ;TESTODP2 terminated too |
498 | je erroff ;TESTODP2 terminated too |
499 | 499 | ||
500 | cmp [dlg_pid_get],dword 1 |
500 | cmp [dlg_pid_get],dword 1 |
501 | je getmesloop |
501 | je getmesloop |
502 | inc [get_loops] |
502 | inc [get_loops] |
503 | cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated |
503 | cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated |
504 | jae erroff |
504 | jae erroff |
505 | jmp getmesloop |
505 | jmp getmesloop |
506 | 506 | ||
507 | mred: |
507 | mred: |
508 | call redproc |
508 | call redproc |
509 | jmp getmesloop |
509 | jmp getmesloop |
510 | mkey: |
510 | mkey: |
511 | mov eax,2 |
511 | mov eax,2 |
512 | int 0x40 ; read (eax=2) |
512 | mcall ; read (eax=2) |
513 | jmp getmesloop |
513 | jmp getmesloop |
514 | mbutton: |
514 | mbutton: |
515 | mov eax,17 ; get id |
515 | mov eax,17 ; get id |
516 | int 0x40 |
516 | mcall |
517 | cmp ah,1 ; button id=1 ? |
517 | cmp ah,1 ; button id=1 ? |
518 | jne getmesloop |
518 | jne getmesloop |
519 | mov eax,-1 ; close this program |
519 | mov eax,-1 ; close this program |
520 | int 0x40 |
520 | mcall |
521 | mgetmes: |
521 | mgetmes: |
522 | 522 | ||
523 | ; If dlg_pid_get then second message get jmp to still |
523 | ; If dlg_pid_get then second message get jmp to still |
524 | cmp [dlg_pid_get],dword 1 |
524 | cmp [dlg_pid_get],dword 1 |
525 | je ready |
525 | je ready |
526 | 526 | ||
527 | ; First message is number of PID SYSXTREE dialog |
527 | ; First message is number of PID SYSXTREE dialog |
528 | 528 | ||
529 | ; convert PID dec to PID bin |
529 | ; convert PID dec to PID bin |
530 | movzx eax,byte [path+16] |
530 | movzx eax,byte [path+16] |
531 | sub eax,48 |
531 | sub eax,48 |
532 | imul eax,10 |
532 | imul eax,10 |
533 | movzx ebx,byte [path+16+1] |
533 | movzx ebx,byte [path+16+1] |
534 | add eax,ebx |
534 | add eax,ebx |
535 | sub eax,48 |
535 | sub eax,48 |
536 | imul eax,10 |
536 | imul eax,10 |
537 | movzx ebx,byte [path+16+2] |
537 | movzx ebx,byte [path+16+2] |
538 | add eax,ebx |
538 | add eax,ebx |
539 | sub eax,48 |
539 | sub eax,48 |
540 | imul eax,10 |
540 | imul eax,10 |
541 | movzx ebx,byte [path+16+3] |
541 | movzx ebx,byte [path+16+3] |
542 | add eax,ebx |
542 | add eax,ebx |
543 | sub eax,48 |
543 | sub eax,48 |
544 | mov [DLGPID],eax |
544 | mov [DLGPID],eax |
545 | 545 | ||
546 | ; Claear and prepare IPC area for next message |
546 | ; Claear and prepare IPC area for next message |
547 | mov [path],dword 0 |
547 | mov [path],dword 0 |
548 | mov [path+4],dword 8 |
548 | mov [path+4],dword 8 |
549 | mov [path+8],dword 0 |
549 | mov [path+8],dword 0 |
550 | mov [path+12],dword 0 |
550 | mov [path+12],dword 0 |
551 | mov [path+16],dword 0 |
551 | mov [path+16],dword 0 |
552 | 552 | ||
553 | ; Set dlg_pid_get for get next message |
553 | ; Set dlg_pid_get for get next message |
554 | mov [dlg_pid_get],dword 1 |
554 | mov [dlg_pid_get],dword 1 |
555 | call redproc ;show DLG_PID |
555 | call redproc ;show DLG_PID |
556 | jmp getmesloop |
556 | jmp getmesloop |
557 | 557 | ||
558 | ready: |
558 | ready: |
559 | ; |
559 | ; |
560 | ; The second message get |
560 | ; The second message get |
561 | ; Second message is 1024 bytes path to SAVE/OPEN file |
561 | ; Second message is 1024 bytes path to SAVE/OPEN file |
562 | ; shl path string on 16 bytes |
562 | ; shl path string on 16 bytes |
563 | ; |
563 | ; |
564 | cld |
564 | cld |
565 | mov esi,path+16 |
565 | mov esi,path+16 |
566 | mov edi,path |
566 | mov edi,path |
567 | mov ecx,1024/4 |
567 | mov ecx,1024/4 |
568 | rep movsd |
568 | rep movsd |
569 | mov [edi],byte 0 |
569 | mov [edi],byte 0 |
570 | 570 | ||
571 | jmp openoff |
571 | jmp openoff |
572 | 572 | ||
573 | 573 | ||
574 | ; DATA AREA |
574 | ; DATA AREA |
575 | get_loops dd 0 |
575 | get_loops dd 0 |
576 | dlg_pid_get dd 0 |
576 | dlg_pid_get dd 0 |
577 | DLGPID dd 0 |
577 | DLGPID dd 0 |
578 | 578 | ||
579 | param: |
579 | param: |
580 | dd 0 ; My dec PID |
580 | dd 0 ; My dec PID |
581 | dd 0,0 ; Type of dialog |
581 | dd 0,0 ; Type of dialog |
582 | 582 | ||
583 | run_fileinfo: |
583 | run_fileinfo: |
584 | dd 7 |
584 | dd 7 |
585 | dd 0 |
585 | dd 0 |
586 | dd param |
586 | dd param |
587 | dd 0 |
587 | dd 0 |
588 | dd 0 |
588 | dd 0 |
589 | ;run_filepath: |
589 | ;run_filepath: |
590 | db '/RD/1/SYSXTREE',0 |
590 | db '/RD/1/SYSXTREE',0 |
591 | 591 | ||
592 | procinfo: |
592 | procinfo: |
593 | times 1024 db 0 |
593 | times 1024 db 0 |
594 | } |
594 | } |
595 | 595 | ||
596 | 596 | ||
597 | 597 | ||
598 | 598 | ||
599 | ; RANDOM - generate random count (small) |
599 | ; RANDOM - generate random count (small) |
600 | ; (SYNTAX) RANDOM MaxCount,OutArgument |
600 | ; (SYNTAX) RANDOM MaxCount,OutArgument |
601 | ; (SAMPLE) RANDOM 10000,eax |
601 | ; (SAMPLE) RANDOM 10000,eax |
602 | ; ( NOTE ) Maxint<65536 ; use random 65536,eax for more combinations |
602 | ; ( NOTE ) Maxint<65536 ; use random 65536,eax for more combinations |
603 | 603 | ||
604 | randomuse = 0 |
604 | randomuse = 0 |
605 | 605 | ||
606 | macro random arg1,arg2 |
606 | macro random arg1,arg2 |
607 | { |
607 | { |
608 | local rxproc |
608 | local rxproc |
609 | randomuse = randomuse + 1 |
609 | randomuse = randomuse + 1 |
610 | 610 | ||
611 | jmp rxproc |
611 | jmp rxproc |
612 | 612 | ||
613 | if defined randomuse & randomuse = 1 |
613 | if defined randomuse & randomuse = 1 |
614 | randomproc: |
614 | randomproc: |
615 | jmp rnj |
615 | jmp rnj |
616 | rsx1 dw 0x4321 |
616 | rsx1 dw 0x4321 |
617 | rsx2 dw 0x1234 |
617 | rsx2 dw 0x1234 |
618 | rnj: |
618 | rnj: |
619 | ; mov eax,arg1 |
619 | ; mov eax,arg1 |
620 | push bx |
620 | push bx |
621 | push cx |
621 | push cx |
622 | push dx |
622 | push dx |
623 | push si |
623 | push si |
624 | push di |
624 | push di |
625 | mov cx,ax |
625 | mov cx,ax |
626 | mov ax,word ptr rsx1 |
626 | mov ax,word ptr rsx1 |
627 | mov bx,word ptr rsx2 |
627 | mov bx,word ptr rsx2 |
628 | mov si,ax |
628 | mov si,ax |
629 | mov di,bx |
629 | mov di,bx |
630 | mov dl,ah |
630 | mov dl,ah |
631 | mov ah,al |
631 | mov ah,al |
632 | mov al,bh |
632 | mov al,bh |
633 | mov bh,bl |
633 | mov bh,bl |
634 | xor bl,bl |
634 | xor bl,bl |
635 | rcr dl,1 |
635 | rcr dl,1 |
636 | rcr ax,1 |
636 | rcr ax,1 |
637 | rcr bx,1 |
637 | rcr bx,1 |
638 | add bx,di |
638 | add bx,di |
639 | adc ax,si |
639 | adc ax,si |
640 | add bx,0x62e9 |
640 | add bx,0x62e9 |
641 | adc ax,0x3619 |
641 | adc ax,0x3619 |
642 | mov word ptr rsx1,bx |
642 | mov word ptr rsx1,bx |
643 | mov word ptr rsx2,ax |
643 | mov word ptr rsx2,ax |
644 | xor dx,dx |
644 | xor dx,dx |
645 | cmp ax,0 |
645 | cmp ax,0 |
646 | je nodiv |
646 | je nodiv |
647 | cmp cx,0 |
647 | cmp cx,0 |
648 | je nodiv |
648 | je nodiv |
649 | div cx |
649 | div cx |
650 | nodiv: |
650 | nodiv: |
651 | mov ax,dx |
651 | mov ax,dx |
652 | pop di |
652 | pop di |
653 | pop si |
653 | pop si |
654 | pop dx |
654 | pop dx |
655 | pop cx |
655 | pop cx |
656 | pop bx |
656 | pop bx |
657 | and eax,0000ffffh |
657 | and eax,0000ffffh |
658 | ; mov arg2,0 |
658 | ; mov arg2,0 |
659 | ; mov arg2,eax |
659 | ; mov arg2,eax |
660 | ret |
660 | ret |
661 | end if |
661 | end if |
662 | 662 | ||
663 | rxproc: |
663 | rxproc: |
664 | mov eax,arg1 |
664 | mov eax,arg1 |
665 | call randomproc |
665 | call randomproc |
666 | mov arg2,eax |
666 | mov arg2,eax |
667 | } |
667 | } |
668 | 668 | ||
669 | macro scank |
669 | macro scank |
670 | { |
670 | { |
671 | mov eax,10 |
671 | mov eax,10 |
672 | int 0x40 |
672 | mcall |
673 | } |
673 | } |
674 | 674 | ||
675 | macro putpix x,y,color |
675 | macro putpix x,y,color |
676 | { |
676 | { |
677 | mov ebx,x |
677 | mov ebx,x |
678 | mov ecx,y |
678 | mov ecx,y |
679 | mov edx,color |
679 | mov edx,color |
680 | mov eax,1 |
680 | mov eax,1 |
681 | int 0x40 |
681 | mcall |
682 | } |
682 | } |
683 | 683 | ||
684 | macro puttxt x,y,offs,size,color |
684 | macro puttxt x,y,offs,size,color |
685 | { |
685 | { |
686 | ; mov ebx,x |
686 | ; mov ebx,x |
687 | ; shl ebx,16 |
687 | ; shl ebx,16 |
688 | ; add ebx,y |
688 | ; add ebx,y |
689 | words2reg ebx,x,y |
689 | words2reg ebx,x,y |
690 | 690 | ||
691 | dword2reg ecx,color |
691 | dword2reg ecx,color |
692 | dword2reg edx,offs |
692 | dword2reg edx,offs |
693 | dword2reg esi,size |
693 | dword2reg esi,size |
694 | 694 | ||
695 | ; mov ecx,color |
695 | ; mov ecx,color |
696 | ; mov edx,offs |
696 | ; mov edx,offs |
697 | ; mov esi,size |
697 | ; mov esi,size |
698 | mov eax,4 |
698 | mov eax,4 |
699 | int 0x40 |
699 | mcall |
700 | } |
700 | } |
701 | 701 | ||
702 | macro outcount data, x, y, color, numtype |
702 | macro outcount data, x, y, color, numtype |
703 | { |
703 | { |
704 | mov ecx,data |
704 | mov ecx,data |
705 | mov ebx,numtype |
705 | mov ebx,numtype |
706 | mov bl,0 |
706 | mov bl,0 |
707 | ; mov edx,x*65536+y |
707 | ; mov edx,x*65536+y |
708 | words2reg edx,x,y |
708 | words2reg edx,x,y |
709 | mov esi,color |
709 | mov esi,color |
710 | mov eax,47 |
710 | mov eax,47 |
711 | int 0x40 |
711 | mcall |
712 | } |
712 | } |
713 | 713 | ||
714 | ; SCEVENT - Scan event |
714 | ; SCEVENT - Scan event |
715 | 715 | ||
716 | macro scevent red,key,but |
716 | macro scevent red,key,but |
717 | { |
717 | { |
718 | mov eax,11 |
718 | mov eax,11 |
719 | int 0x40 |
719 | mcall |
720 | dec eax |
720 | dec eax |
721 | jz red |
721 | jz red |
722 | dec eax |
722 | dec eax |
723 | jz key |
723 | jz key |
724 | dec eax |
724 | dec eax |
725 | jz but |
725 | jz but |
726 | } |
726 | } |
727 | 727 | ||
728 | ; WTEVENT - Wait event |
728 | ; WTEVENT - Wait event |
729 | 729 | ||
730 | macro wtevent red,key,but |
730 | macro wtevent red,key,but |
731 | { |
731 | { |
732 | mov eax,10 |
732 | mov eax,10 |
733 | int 0x40 |
733 | mcall |
734 | dec eax |
734 | dec eax |
735 | jz red |
735 | jz red |
736 | dec eax |
736 | dec eax |
737 | jz key |
737 | jz key |
738 | dec eax |
738 | dec eax |
739 | jz but |
739 | jz but |
740 | } |
740 | } |
741 | 741 | ||
742 | ; TIMEEVENT - Wite for event with timeout |
742 | ; TIMEEVENT - Wite for event with timeout |
743 | 743 | ||
744 | macro timeevent xfps,noevent,red,key,but |
744 | macro timeevent xfps,noevent,red,key,but |
745 | { |
745 | { |
746 | mov eax,23 |
746 | mov eax,23 |
747 | mov ebx,xfps |
747 | mov ebx,xfps |
748 | int 0x40 |
748 | mcall |
749 | cmp eax,0 |
749 | cmp eax,0 |
750 | je noevent |
750 | je noevent |
751 | dec eax |
751 | dec eax |
752 | jz red |
752 | jz red |
753 | dec eax |
753 | dec eax |
754 | jz key |
754 | jz key |
755 | dec eax |
755 | dec eax |
756 | jz but |
756 | jz but |
757 | } |
757 | } |
758 | 758 | ||
759 | 759 | ||
760 | ; CLOSE - Close program |
760 | ; CLOSE - Close program |
761 | 761 | ||
762 | macro close |
762 | macro close |
763 | { |
763 | { |
764 | mov eax,-1 |
764 | mov eax,-1 |
765 | int 0x40 |
765 | mcall |
766 | } |
766 | } |
767 | 767 | ||
768 | ; DELAY - Create delay 1/100 sec |
768 | ; DELAY - Create delay 1/100 sec |
769 | ; (SYNTAX) Delay time |
769 | ; (SYNTAX) Delay time |
770 | ; (SAMPLE) Delay 100 ;delay 2 sec 1/100*200=2 sec |
770 | ; (SAMPLE) Delay 100 ;delay 2 sec 1/100*200=2 sec |
771 | 771 | ||
772 | macro delay arg1 |
772 | macro delay arg1 |
773 | { |
773 | { |
774 | mov eax,5 |
774 | mov eax,5 |
775 | mov ebx,arg1 |
775 | mov ebx,arg1 |
776 | int 0x40 |
776 | mcall |
777 | } |
777 | } |
778 | 778 | ||
779 | ; WINDOW - Draw window |
779 | ; WINDOW - Draw window |
780 | ; (SYNTAX) WINDOW Xstart,Ystart,'Text',Color |
780 | ; (SYNTAX) WINDOW Xstart,Ystart,'Text',Color |
781 | ; (SAMPLE) WINDOW 10,10,640+8,480+24,window_Skinned |
781 | ; (SAMPLE) WINDOW 10,10,640+8,480+24,window_Skinned |
782 | 782 | ||
783 | macro window arg1,arg2,arg3,arg4,arg5 |
783 | macro window arg1,arg2,arg3,arg4,arg5 |
784 | { |
784 | { |
785 | ; mov ebx,arg1*65536+arg3 |
785 | ; mov ebx,arg1*65536+arg3 |
786 | ; mov ecx,arg2*65536+arg4 |
786 | ; mov ecx,arg2*65536+arg4 |
787 | words2reg ebx,arg1,arg3 |
787 | words2reg ebx,arg1,arg3 |
788 | words2reg ecx,arg2,arg4 |
788 | words2reg ecx,arg2,arg4 |
789 | mov edx,arg5 |
789 | mov edx,arg5 |
790 | mov eax,0 |
790 | mov eax,0 |
791 | int 0x40 |
791 | mcall |
792 | } |
792 | } |
793 | 793 | ||
794 | macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7 |
794 | macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7 |
795 | { |
795 | { |
796 | mov ebx,arg1*65536+arg3 |
796 | mov ebx,arg1*65536+arg3 |
797 | mov ecx,arg2*65536+arg4 |
797 | mov ecx,arg2*65536+arg4 |
798 | mov edx,arg5 |
798 | mov edx,arg5 |
799 | mov esi,arg6 |
799 | mov esi,arg6 |
800 | mov edi,arg7 |
800 | mov edi,arg7 |
801 | mov eax,0 |
801 | mov eax,0 |
802 | int 0x40 |
802 | mcall |
803 | } |
803 | } |
804 | 804 | ||
805 | 805 | ||
806 | ; STARTWD - Start of window draw |
806 | ; STARTWD - Start of window draw |
807 | 807 | ||
808 | macro startwd |
808 | macro startwd |
809 | { |
809 | { |
810 | mov eax,12 |
810 | mov eax,12 |
811 | mov ebx,1 |
811 | mov ebx,1 |
812 | int 0x40 |
812 | mcall |
813 | } |
813 | } |
814 | 814 | ||
815 | ; ENDWD - End window draw |
815 | ; ENDWD - End window draw |
816 | 816 | ||
817 | macro endwd |
817 | macro endwd |
818 | { |
818 | { |
819 | mov eax,12 |
819 | mov eax,12 |
820 | mov ebx,2 |
820 | mov ebx,2 |
821 | int 0x40 |
821 | mcall |
822 | } |
822 | } |
823 | 823 | ||
824 | ; LABEL - Put text to frame |
824 | ; LABEL - Put text to frame |
825 | ; (SYNTAX) LABEL Xstart,Ystart,'Text',Color |
825 | ; (SYNTAX) LABEL Xstart,Ystart,'Text',Color |
826 | ; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big |
826 | ; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big |
827 | 827 | ||
828 | macro glabel arg1,arg2,arg3,arg4 |
828 | macro glabel arg1,arg2,arg3,arg4 |
829 | { |
829 | { |
830 | local asd,lab |
830 | local asd,lab |
831 | jmp asd |
831 | jmp asd |
832 | lab db arg3 ;arg label |
832 | lab db arg3 ;arg label |
833 | asd: |
833 | asd: |
834 | ; mov ebx,arg1 ;arg1=y arg2=x |
834 | ; mov ebx,arg1 ;arg1=y arg2=x |
835 | ; shl ebx,16 |
835 | ; shl ebx,16 |
836 | ; add ebx,arg2 |
836 | ; add ebx,arg2 |
837 | 837 | ||
838 | words2reg ebx,arg1,arg2 |
838 | words2reg ebx,arg1,arg2 |
839 | 839 | ||
840 | dword2reg ecx,arg4 |
840 | dword2reg ecx,arg4 |
841 | 841 | ||
842 | mov edx,lab |
842 | mov edx,lab |
843 | mov esi,asd-lab ;calc size |
843 | mov esi,asd-lab ;calc size |
844 | mov eax,4 |
844 | mov eax,4 |
845 | int 0x40 |
845 | mcall |
846 | } |
846 | } |
847 | 847 | ||
848 | ;Key's |
848 | ;Key's |
849 | key_Up equ 178 |
849 | key_Up equ 178 |
850 | key_Down equ 177 |
850 | key_Down equ 177 |
851 | key_Right equ 179 |
851 | key_Right equ 179 |
852 | key_Left equ 176 |
852 | key_Left equ 176 |
853 | key_Esc equ 27 |
853 | key_Esc equ 27 |
854 | key_Space equ 32 |
854 | key_Space equ 32 |
855 | key_Enter equ 13 |
855 | key_Enter equ 13 |
856 | key_Bspace equ 8 |
856 | key_Bspace equ 8 |
857 | key_F1 equ 50 |
857 | key_F1 equ 50 |
858 | key_F2 equ 51 |
858 | key_F2 equ 51 |
859 | key_F3 equ 52 |
859 | key_F3 equ 52 |
860 | key_F4 equ 53 |
860 | key_F4 equ 53 |
861 | key_F5 equ 54 |
861 | key_F5 equ 54 |
862 | key_F6 equ 55 |
862 | key_F6 equ 55 |
863 | key_F7 equ 56 |
863 | key_F7 equ 56 |
864 | key_F8 equ 57 |
864 | key_F8 equ 57 |
865 | key_F9 equ 48 |
865 | key_F9 equ 48 |
866 | key_F10 equ 49 |
866 | key_F10 equ 49 |
867 | key_F11 equ 68 |
867 | key_F11 equ 68 |
868 | key_F12 equ 255 |
868 | key_F12 equ 255 |
869 | key_Home equ 180 |
869 | key_Home equ 180 |
870 | key_End equ 181 |
870 | key_End equ 181 |
871 | key_PgUp equ 184 |
871 | key_PgUp equ 184 |
872 | key_PgDown equ 183 |
872 | key_PgDown equ 183 |
873 | 873 | ||
874 | ;Attributes |
874 | ;Attributes |
875 | 875 | ||
876 | ;Window Attributes |
876 | ;Window Attributes |
877 | window_Skinned equ 0x03000000 |
877 | window_Skinned equ 0x03000000 |
878 | window_Type2 equ 0x02000000 |
878 | window_Type2 equ 0x02000000 |
879 | window_Type1 equ 0x00000000 |
879 | window_Type1 equ 0x00000000 |
880 | window_Reserve equ 0x01000000 |
880 | window_Reserve equ 0x01000000 |
881 | 881 | ||
882 | ;Font Attributes |
882 | ;Font Attributes |
883 | font_Big equ 0x10000000 |
883 | font_Big equ 0x10000000 |
884 | 884 | ||
885 | ;Colors |
885 | ;Colors |
886 | cl_White equ 0x00ffffff |
886 | cl_White equ 0x00ffffff |
887 | cl_Black equ 0x00000000 |
887 | cl_Black equ 0x00000000 |
888 | cl_Grey equ 0x00888888 |
888 | cl_Grey equ 0x00888888 |
889 | cl_Red equ 0x00ff0000 |
889 | cl_Red equ 0x00ff0000 |
890 | cl_Lime equ 0x0000ff00 |
890 | cl_Lime equ 0x0000ff00 |
891 | cl_Green equ 0x0000af00 |
891 | cl_Green equ 0x0000af00 |
892 | cl_Blue equ 0x000000ff |
892 | cl_Blue equ 0x000000ff |
893 | cl_Purple equ 0x008080ff |
893 | cl_Purple equ 0x008080ff |
894 | cl_Violet equ 0x008040ff |
894 | cl_Violet equ 0x008040ff |
895 | cl_Cyan equ 0x0040e0ff65536> |
895 | cl_Cyan equ 0x0040e0ff65536> |