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