Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6218 | leency | 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 |
||
51 | int 0x40 |
||
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 |
||
58 | int 0x40 |
||
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 |
||
93 | int 0x40 |
||
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 |
||
118 | int 0x40 |
||
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 |
||
136 | mov eax,0 |
||
137 | mov ecx,200 |
||
138 | rep stosb |
||
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 |
||
147 | int 0x40 |
||
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 |
||
180 | mov edx,150 ; size 150 bytes |
||
181 | int 0x40 |
||
182 | |||
183 | ; change wanted events list 7-bit IPC event |
||
184 | mov eax,40 |
||
185 | mov ebx,01000111b |
||
186 | int 0x40 |
||
187 | |||
188 | ; |
||
189 | ; STEP 3 run SYSTEM XTREE with parameters |
||
190 | ; |
||
191 | |||
192 | mov eax,58 |
||
193 | mov ebx,run_fileinfo |
||
194 | int 0x40 |
||
195 | |||
196 | call redproc |
||
197 | |||
198 | mov [get_loops],0 |
||
199 | getmesloop: |
||
200 | mov eax,23 |
||
201 | mov ebx,50 ;0.5 sec |
||
202 | int 0x40 |
||
203 | |||
204 | cmp eax,1 |
||
205 | je mred |
||
206 | cmp eax,2 |
||
207 | je mkey |
||
208 | cmp eax,3 |
||
209 | je mbutton |
||
210 | cmp eax,7 |
||
211 | je mgetmes |
||
212 | |||
213 | ; Get number of procces |
||
214 | mov ebx,procinfo |
||
215 | mov ecx,-1 |
||
216 | mov eax,9 |
||
217 | int 0x40 |
||
218 | mov ebp,eax |
||
219 | |||
220 | loox: |
||
221 | mov eax,9 |
||
222 | mov ebx,procinfo |
||
223 | mov ecx,ebp |
||
224 | int 0x40 |
||
225 | mov eax,[DLGPID] |
||
226 | cmp [procinfo+30],eax ;IF Dialog find |
||
227 | je dlg_is_work ;jmp to dlg_is_work |
||
228 | dec ebp |
||
229 | jnz loox |
||
230 | |||
231 | jmp erroff |
||
232 | |||
233 | dlg_is_work: |
||
234 | cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated |
||
235 | je erroff ;TESTODP2 terminated too |
||
236 | |||
237 | cmp [dlg_pid_get],dword 1 |
||
238 | je getmesloop |
||
239 | inc [get_loops] |
||
240 | cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated |
||
241 | jae erroff |
||
242 | jmp getmesloop |
||
243 | |||
244 | mred: |
||
245 | call redproc |
||
246 | jmp getmesloop |
||
247 | mkey: |
||
248 | mov eax,2 |
||
249 | int 0x40 ; read (eax=2) |
||
250 | jmp getmesloop |
||
251 | mbutton: |
||
252 | mov eax,17 ; get id |
||
253 | int 0x40 |
||
254 | cmp ah,1 ; button id=1 ? |
||
255 | jne getmesloop |
||
256 | mov eax,-1 ; close this program |
||
257 | int 0x40 |
||
258 | mgetmes: |
||
259 | |||
260 | ; If dlg_pid_get then second message get jmp to still |
||
261 | cmp [dlg_pid_get],dword 1 |
||
262 | je ready |
||
263 | |||
264 | ; First message is number of PID SYSXTREE dialog |
||
265 | |||
266 | ; convert PID dec to PID bin |
||
267 | movzx eax,byte [path+16] |
||
268 | sub eax,48 |
||
269 | imul eax,10 |
||
270 | movzx ebx,byte [path+16+1] |
||
271 | add eax,ebx |
||
272 | sub eax,48 |
||
273 | imul eax,10 |
||
274 | movzx ebx,byte [path+16+2] |
||
275 | add eax,ebx |
||
276 | sub eax,48 |
||
277 | imul eax,10 |
||
278 | movzx ebx,byte [path+16+3] |
||
279 | add eax,ebx |
||
280 | sub eax,48 |
||
281 | mov [DLGPID],eax |
||
282 | |||
283 | ; Claear and prepare IPC area for next message |
||
284 | mov [path],dword 0 |
||
285 | mov [path+4],dword 8 |
||
286 | mov [path+8],dword 0 |
||
287 | mov [path+12],dword 0 |
||
288 | mov [path+16],dword 0 |
||
289 | |||
290 | ; Set dlg_pid_get for get next message |
||
291 | mov [dlg_pid_get],dword 1 |
||
292 | call redproc ;show DLG_PID |
||
293 | jmp getmesloop |
||
294 | |||
295 | ready: |
||
296 | ; |
||
297 | ; The second message get |
||
298 | ; Second message is 100 bytes path to SAVE/OPEN file |
||
299 | ; shl path string on 16 bytes |
||
300 | ; |
||
301 | cld |
||
302 | mov esi,path+16 |
||
303 | mov edi,path |
||
304 | mov ecx,200 |
||
305 | rep movsb |
||
306 | mov [edi],byte 0 |
||
307 | |||
308 | jmp openoff |
||
309 | |||
310 | |||
311 | ; DATA AREA |
||
312 | get_loops dd 0 |
||
313 | dlg_pid_get dd 0 |
||
314 | DLGPID dd 0 |
||
315 | |||
316 | param: |
||
317 | dd 0 ; My dec PID |
||
318 | dd 0,0 ; Type of dialog |
||
319 | |||
320 | run_fileinfo: |
||
321 | dd 16 |
||
322 | dd 0 |
||
323 | dd param |
||
324 | dd 0 |
||
325 | dd procinfo ; 0x10000 |
||
326 | ;run_filepath |
||
327 | db '/RD/1/SYSXTREE',0 |
||
328 | |||
329 | procinfo: |
||
330 | times 256 db 0 |
||
331 | } |
||
332 | |||
333 | |||
334 | macro savedialog redproc,openoff,erroff,path |
||
335 | { |
||
336 | local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc |
||
337 | local run_fileinfo, run_filepath, param |
||
338 | local getmesloop, loox, mred, mkey, mbutton, mgetmes |
||
339 | local dlg_is_work, ready, procinfo |
||
340 | ; |
||
341 | ; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, |
||
342 | ; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) |
||
343 | ; |
||
344 | |||
345 | cld |
||
346 | ;; mov esi,path |
||
347 | mov edi,path |
||
348 | mov eax,0 |
||
349 | mov ecx,200 |
||
350 | rep stosb |
||
351 | |||
352 | ;mov [get_loops],0 |
||
353 | mov [dlg_pid_get],0 |
||
354 | |||
355 | ; Get my PID in dec format 4 bytes |
||
356 | mov eax,9 |
||
357 | mov ebx,procinfo |
||
358 | mov ecx,-1 |
||
359 | int 0x40 |
||
360 | |||
361 | ; convert eax bin to param dec |
||
362 | mov eax,dword [procinfo+30] ;offset of myPID |
||
363 | mov edi,param+4-1 ;offset to 4 bytes |
||
364 | mov ecx,4 |
||
365 | mov ebx,10 |
||
366 | cld |
||
367 | new_d: |
||
368 | xor edx,edx |
||
369 | div ebx |
||
370 | add dl,'0' |
||
371 | mov [edi],dl |
||
372 | dec edi |
||
373 | loop new_d |
||
374 | |||
375 | ; wirite 1 byte space to param |
||
376 | mov [param+4],byte 32 ;Space for next parametr |
||
377 | ; and 1 byte type of dialog to param |
||
378 | mov [param+5],byte 'S' ;Get Open dialog (Use 'S' for Save dialog) |
||
379 | |||
380 | ; |
||
381 | ; STEP2 prepare IPC area for get messages |
||
382 | ; |
||
383 | |||
384 | ; prepare IPC area |
||
385 | mov [path],dword 0 |
||
386 | mov [path+4],dword 8 |
||
387 | |||
388 | ; define IPC memory |
||
389 | mov eax,60 |
||
390 | mov ebx,1 ; define IPC |
||
391 | mov ecx,path ; offset of area |
||
392 | mov edx,120 ; size 150 bytes |
||
393 | int 0x40 |
||
394 | |||
395 | ; change wanted events list 7-bit IPC event |
||
396 | mov eax,40 |
||
397 | mov ebx,01000111b |
||
398 | int 0x40 |
||
399 | |||
400 | ; |
||
401 | ; STEP 3 run SYSTEM XTREE with parameters |
||
402 | ; |
||
403 | |||
404 | mov eax,58 |
||
405 | mov ebx,run_fileinfo |
||
406 | int 0x40 |
||
407 | |||
408 | call redproc |
||
409 | |||
410 | mov [get_loops],0 |
||
411 | getmesloop: |
||
412 | mov eax,23 |
||
413 | mov ebx,50 ;0.5 sec |
||
414 | int 0x40 |
||
415 | |||
416 | cmp eax,1 |
||
417 | je mred |
||
418 | cmp eax,2 |
||
419 | je mkey |
||
420 | cmp eax,3 |
||
421 | je mbutton |
||
422 | cmp eax,7 |
||
423 | je mgetmes |
||
424 | |||
425 | ; Get number of procces |
||
426 | mov ebx,procinfo |
||
427 | mov ecx,-1 |
||
428 | mov eax,9 |
||
429 | int 0x40 |
||
430 | mov ebp,eax |
||
431 | |||
432 | loox: |
||
433 | mov eax,9 |
||
434 | mov ebx,procinfo |
||
435 | mov ecx,ebp |
||
436 | int 0x40 |
||
437 | mov eax,[DLGPID] |
||
438 | cmp [procinfo+30],eax ;IF Dialog find |
||
439 | je dlg_is_work ;jmp to dlg_is_work |
||
440 | dec ebp |
||
441 | jnz loox |
||
442 | |||
443 | jmp erroff |
||
444 | |||
445 | dlg_is_work: |
||
446 | cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated |
||
447 | je erroff ;TESTODP2 terminated too |
||
448 | |||
449 | cmp [dlg_pid_get],dword 1 |
||
450 | je getmesloop |
||
451 | inc [get_loops] |
||
452 | cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated |
||
453 | jae erroff |
||
454 | jmp getmesloop |
||
455 | |||
456 | mred: |
||
457 | call redproc |
||
458 | jmp getmesloop |
||
459 | mkey: |
||
460 | int 0x40 ; read (eax=2) |
||
461 | jmp getmesloop |
||
462 | mbutton: |
||
463 | mov eax,17 ; get id |
||
464 | int 0x40 |
||
465 | cmp ah,1 ; button id=1 ? |
||
466 | jne getmesloop |
||
467 | mov eax,-1 ; close this program |
||
468 | int 0x40 |
||
469 | mgetmes: |
||
470 | |||
471 | ; If dlg_pid_get then second message get jmp to still |
||
472 | cmp [dlg_pid_get],dword 1 |
||
473 | je ready |
||
474 | |||
475 | ; First message is number of PID SYSXTREE dialog |
||
476 | |||
477 | ; convert PID dec to PID bin |
||
478 | movzx eax,byte [path+16] |
||
479 | sub eax,48 |
||
480 | imul eax,10 |
||
481 | movzx ebx,byte [path+16+1] |
||
482 | add eax,ebx |
||
483 | sub eax,48 |
||
484 | imul eax,10 |
||
485 | movzx ebx,byte [path+16+2] |
||
486 | add eax,ebx |
||
487 | sub eax,48 |
||
488 | imul eax,10 |
||
489 | movzx ebx,byte [path+16+3] |
||
490 | add eax,ebx |
||
491 | sub eax,48 |
||
492 | mov [DLGPID],eax |
||
493 | |||
494 | ; Claear and prepare IPC area for next message |
||
495 | mov [path],dword 0 |
||
496 | mov [path+4],dword 8 |
||
497 | mov [path+8],dword 0 |
||
498 | mov [path+12],dword 0 |
||
499 | mov [path+16],dword 0 |
||
500 | |||
501 | ; Set dlg_pid_get for get next message |
||
502 | mov [dlg_pid_get],dword 1 |
||
503 | call redproc ;show DLG_PID |
||
504 | jmp getmesloop |
||
505 | |||
506 | ready: |
||
507 | ; |
||
508 | ; The second message get |
||
509 | ; Second message is 100 bytes path to SAVE/OPEN file |
||
510 | ; shl path string on 16 bytes |
||
511 | ; |
||
512 | cld |
||
513 | mov esi,path+16 |
||
514 | mov edi,path |
||
515 | mov ecx,200 |
||
516 | rep movsb |
||
517 | mov [edi],byte 0 |
||
518 | |||
519 | jmp openoff |
||
520 | |||
521 | |||
522 | ; DATA AREA |
||
523 | get_loops dd 0 |
||
524 | dlg_pid_get dd 0 |
||
525 | DLGPID dd 0 |
||
526 | |||
527 | param: |
||
528 | rb 4 ; My dec PID |
||
529 | rb 6 ; Type of dialog |
||
530 | |||
531 | run_fileinfo: |
||
532 | dd 16 |
||
533 | dd 0 |
||
534 | dd param |
||
535 | dd 0 |
||
536 | dd procinfo |
||
537 | run_filepath: |
||
538 | db '/RD/1/SYSXTREE',0 |
||
539 | |||
540 | procinfo: |
||
541 | times 256 db 0 |
||
542 | } |
||
543 | |||
544 | |||
545 | |||
546 | |||
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 |
||
620 | int 0x40 |
||
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 |
||
629 | int 0x40 |
||
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 |
||
642 | int 0x40 |
||
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 |
||
654 | int 0x40 |
||
655 | } |
||
656 | |||
657 | ; SCEVENT - Scan event |
||
658 | |||
659 | macro scevent red,key,but |
||
660 | { |
||
661 | mov eax,11 |
||
662 | int 0x40 |
||
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 |
||
676 | int 0x40 |
||
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 |
||
691 | int 0x40 |
||
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 |
||
708 | int 0x40 |
||
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 |
||
719 | int 0x40 |
||
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 |
||
734 | int 0x40 |
||
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 |
||
745 | int 0x40 |
||
746 | } |
||
747 | |||
748 | |||
749 | ; STARTWD - Start of window draw |
||
750 | |||
751 | macro startwd |
||
752 | { |
||
753 | mov eax,12 |
||
754 | mov ebx,1 |
||
755 | int 0x40 |
||
756 | } |
||
757 | |||
758 | ; ENDWD - End window draw |
||
759 | |||
760 | macro endwd |
||
761 | { |
||
762 | mov eax,12 |
||
763 | mov ebx,2 |
||
764 | int 0x40 |
||
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 | macro label arg1,arg2,arg3,arg4 |
||
772 | { |
||
773 | local asd,lab |
||
774 | jmp asd |
||
775 | lab db arg3 ;arg label |
||
776 | asd: |
||
777 | ; mov ebx,arg1 ;arg1=y arg2=x |
||
778 | ; shl ebx,16 |
||
779 | ; add ebx,arg2 |
||
780 | wordstoreg ebx,arg1,arg2 |
||
781 | mov ecx,arg4 ;arg4 color |
||
782 | mov edx,lab |
||
783 | mov esi,asd-lab ;calc size |
||
784 | mov eax,4 |
||
785 | int 0x40 |
||
786 | } |
||
787 | |||
788 | ;Key's |
||
789 | key_Up equ 178 |
||
790 | key_Down equ 177 |
||
791 | key_Right equ 179 |
||
792 | key_Left equ 176 |
||
793 | key_Esc equ 27 |
||
794 | key_Space equ 32 |
||
795 | key_Enter equ 13 |
||
796 | key_Bspace equ 8 |
||
797 | key_F1 equ 50 |
||
798 | key_F2 equ 51 |
||
799 | key_F3 equ 52 |
||
800 | key_F4 equ 53 |
||
801 | key_F5 equ 54 |
||
802 | key_F6 equ 55 |
||
803 | key_F7 equ 56 |
||
804 | key_F8 equ 57 |
||
805 | key_F9 equ 48 |
||
806 | key_F10 equ 49 |
||
807 | key_F11 equ 68 |
||
808 | key_F12 equ 255 |
||
809 | key_Home equ 180 |
||
810 | key_End equ 181 |
||
811 | key_PgUp equ 184 |
||
812 | key_PgDown equ 183 |
||
813 | |||
814 | ;Attributes |
||
815 | |||
816 | ;Window Attributes |
||
817 | window_Skinned equ 0x03000000 |
||
818 | window_Type2 equ 0x02000000 |
||
819 | window_Type1 equ 0x00000000 |
||
820 | window_Reserve equ 0x01000000 |
||
821 | |||
822 | ;Font Attributes |
||
823 | font_Big equ 0x10000000 |
||
824 | |||
825 | ;Colors |
||
826 | cl_White equ 0x00ffffff |
||
827 | cl_Black equ 0x00000000 |
||
828 | cl_Grey equ 0x00888888 |
||
829 | cl_Red equ 0x00ff0000 |
||
830 | cl_Lime equ 0x0000ff00 |
||
831 | cl_Green equ 0x0000af00 |
||
832 | cl_Blue equ 0x000000ff |
||
833 | cl_Purple equ 0x008080ff |
||
834 | cl_Violet equ 0x008040ff |
||
835 | cl_Cyan equ 0x0040e0ff65536> |