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