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