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