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