Rev 828 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 828 | Rev 832 | ||
---|---|---|---|
Line 5... | Line 5... | ||
5 | ; v.0.5 18.07.08 Dinamic Allocation Memory |
5 | ; v.0.5 18.07.08 Dinamic Allocation Memory |
6 | ; v.0.6 20.07.08 |
6 | ; v.0.6 20.07.08 |
7 | ; 1) Use Editbox (Author |
7 | ; 1) Use Editbox (Author |
8 | ; 2) Draw window without fill working area (C = 1) |
8 | ; 2) Draw window without fill working area (C = 1) |
9 | ; 3) Open file with parameter in patch: |
9 | ; 3) Open file with parameter in patch: |
10 | ; Size of parameter - 4 bytes. Parameter starts with the character "\", |
10 | ; Size of parameter - 4 bytes. Parameter starts with the |
11 | ; the unused characters are filled by a blank (ASCII 20h). |
11 | ; character "\", the unused characters are filled |
- | 12 | ; by a blank (ASCII 20h). |
|
12 | ; '\T /hd0/1/1.jpg' - set background, mode: tile |
13 | ; '\T /hd0/1/1.bmp' - set background, mode: tile |
13 | ; '\S /hd0/1/1.jpg' - set background, mode: stretch |
14 | ; '\S /hd0/1/1.bmp' - set background, mode: stretch |
- | 15 | ; v.0.65 23.07.08 |
|
- | 16 | ; 1) Use new version Editbox (Thanks |
|
- | 17 | ; (mouse correctly works in secondary thread) |
|
- | 18 | ; 2) The memory used for storage of the file BMP |
|
- | 19 | ; after conversion in RAW comes back to OS. |
|
- | 20 | ; 3) Usage of keys 1,2,3,4 for call of buttons of the application |
|
- | 21 | ; without the mouse, before the key were defined incorrectly. |
|
- | 22 | ; 4) Deleting of the unnecessary procedure of clearing of |
|
- | 23 | ; a background of a picture at pressing the button "Open". |
|
14 | ; Compile with FASM for Menuet |
24 | ; Compile with FASM for Menuet |
Line 15... | Line 25... | ||
15 | 25 | ||
16 | ;****************************************************************************** |
26 | ;****************************************************************************** |
17 | use32 |
27 | use32 |
18 | org 0x0 |
28 | org 0x0 |
19 | db 'MENUET01' ; 8 byte id |
29 | db 'MENUET01' ; 8 byte id |
20 | dd 0x01 ; header version |
30 | dd 0x01 ; header version |
21 | dd START ; start of code |
31 | dd START ; start of code |
22 | dd IM_END ; size of image |
32 | dd IM_END ; size of image |
23 | dd I_END ;0x300000 ; memory for app |
33 | dd I_END ; memory for app |
24 | dd I_END ;0x300000 ; esp |
34 | dd I_END ; esp |
Line 25... | Line 35... | ||
25 | dd temp_area , 0x0 ; I_Param , I_Icon |
35 | dd temp_area , 0x0 ; I_Param , I_Icon |
26 | 36 | ||
- | 37 | include 'lang.inc' |
|
27 | include 'lang.inc' |
38 | include '..\..\..\macros.inc' |
28 | include '..\..\..\macros.inc' |
39 | include '..\..\..\develop\examples\editbox\trunk\editbox.inc' |
29 | ;include 'macros.inc' |
40 | ;include 'macros.inc' |
30 | include 'EDITBOX.INC' |
41 | ;include 'EDITBOX.INC' |
Line 31... | Line 42... | ||
31 | use_edit_box procinfo |
42 | use_edit_box |
32 | ;****************************************************************************** |
43 | ;****************************************************************************** |
- | 44 | ||
33 | 45 | START: ; start of execution |
|
34 | START: ; start of execution |
46 | mcall 68, 11 |
35 | mcall 68, 11 |
47 | mcall 66, 1,1 |
36 | ; check for parameters |
48 | ; check for parameters |
37 | cmp dword [temp_area],'BOOT' |
49 | cmp dword [temp_area],'BOOT' |
Line 118... | Line 130... | ||
118 | 130 | ||
119 | key: ; key |
131 | key: ; key |
120 | mov al,2 |
132 | mov al,2 |
121 | mcall |
133 | mcall |
122 | mov al,ah |
134 | mov al,ah |
123 | cmp al,6 |
135 | cmp al,130 ; 1 |
124 | je kfile |
136 | je kfile |
125 | cmp al,15 |
137 | cmp al,131 ; 2 |
126 | je kopen |
138 | je kopen |
127 | cmp al,9 |
139 | cmp al,132 ; 3 |
128 | je kinfo |
140 | je kinfo |
129 | cmp al,2 |
141 | cmp al,133 ; 4 |
130 | je kbgrd |
142 | je kbgrd |
Line 131... | Line 143... | ||
131 | jmp still |
143 | jmp still |
132 | 144 | ||
Line 167... | Line 179... | ||
167 | jne noopen |
179 | jne noopen |
Line 168... | Line 180... | ||
168 | 180 | ||
169 | kopen: |
181 | kopen: |
170 | mov ecx,-1 |
182 | mov ecx,-1 |
171 | call getappinfo |
- | |
172 | mov eax,[image_file] |
- | |
173 | mov ebx,dword [eax+42] |
- | |
174 | mov ecx,dword [eax+46] |
- | |
175 | add ebx,10*65536-15 |
- | |
176 | add ecx,50*65536-55 |
- | |
177 | mov edx,0xffffff |
- | |
178 | mov eax,13 |
- | |
Line 179... | Line 183... | ||
179 | mcall |
183 | call getappinfo |
Line 180... | Line 184... | ||
180 | 184 | ||
181 | call load_image |
185 | call load_image |
182 | 186 | ||
183 | open1: |
187 | open1: |
184 | mov eax,[image_file] |
188 | mov eax,[image_file] |
185 | cmp [eax],word 'BM' |
- | |
186 | jne still |
189 | cmp [eax],word 'BM' |
187 | call convert |
190 | jne still |
Line 188... | Line 191... | ||
188 | call drawimage |
191 | call convert |
189 | jmp still |
192 | jmp draw_still |
190 | noopen: |
193 | noopen: |
Line 196... | Line 199... | ||
196 | jnz still |
199 | jnz still |
197 | or byte [status], 2 |
200 | or byte [status], 2 |
198 | mov eax,51 |
201 | mov eax,51 |
199 | mov ebx,1 |
202 | mov ebx,1 |
200 | mov ecx,thread2 |
203 | mov ecx,thread2 |
201 | mov edx,thread-512 ;0x2afff0 |
204 | mov edx,thread-512 |
202 | mcall |
205 | mcall |
203 | jmp still |
206 | jmp still |
204 | noinfo: |
207 | noinfo: |
Line 205... | Line 208... | ||
205 | 208 | ||
Line 211... | Line 214... | ||
211 | jnz still |
214 | jnz still |
212 | or byte [status], 8 |
215 | or byte [status], 8 |
213 | mov eax,51 |
216 | mov eax,51 |
214 | mov ebx,1 |
217 | mov ebx,1 |
215 | mov ecx,thread3 |
218 | mov ecx,thread3 |
216 | mov edx,thread-512*2 ;0x2bfff0 |
219 | mov edx,thread-512*2 |
217 | mcall |
220 | mcall |
218 | jmp still |
221 | jmp still |
219 | ;call background |
222 | ;call background |
Line 220... | Line 223... | ||
220 | 223 | ||
Line 246... | Line 249... | ||
246 | mcall 70, fileinfo |
249 | mcall 70, fileinfo |
Line 247... | Line 250... | ||
247 | 250 | ||
248 | mov ecx,[process_info+32] |
251 | mov ecx,[process_info+32] |
Line -... | Line 252... | ||
- | 252 | mov [fileinfo+12],ecx |
|
- | 253 | ||
- | 254 | mcall 68, 12 |
|
- | 255 | ||
- | 256 | ||
- | 257 | mov [fileinfo+16],eax |
|
249 | mov [fileinfo+12],ecx |
258 | mov [image_file_1],eax |
Line 250... | Line 259... | ||
250 | 259 | ||
251 | mov eax,[process_info+40+28] |
260 | mov eax,[process_info+40+28] |
252 | 261 | ||
Line 260... | Line 269... | ||
260 | .convert4: |
269 | .convert4: |
261 | shl ecx,1 |
270 | shl ecx,1 |
262 | .convert8: |
271 | .convert8: |
263 | lea ecx,[ecx*3] |
272 | lea ecx,[ecx*3] |
264 | .convert24: |
273 | .convert24: |
265 | shl ecx,1 |
- | |
266 | @@: |
- | |
Line 267... | Line 274... | ||
267 | 274 | ||
Line -... | Line 275... | ||
- | 275 | ;@@: |
|
- | 276 | ||
Line 268... | Line -... | ||
268 | mcall 68, 12 |
- | |
269 | 277 | add ecx,512 |
|
Line 270... | Line 278... | ||
270 | 278 | mcall 68, 12 |
|
Line -... | Line 279... | ||
- | 279 | ||
- | 280 | mov [image_file],eax |
|
- | 281 | ||
- | 282 | mcall 70, fileinfo |
|
- | 283 | ||
- | 284 | mov esi,[image_file_1] |
|
271 | mov [fileinfo+16],eax |
285 | mov edi,[image_file] |
272 | mov [image_file],eax |
286 | mov ecx,512/4 |
273 | 287 | cld |
|
274 | mcall 70, fileinfo |
288 | rep movsd |
275 | 289 | ||
276 | mov eax,[image_file] |
290 | mov eax,[image_file] |
277 | mov ebx,[eax+22] |
291 | mov ebx,[eax+22] |
278 | mov eax,[eax+18] |
292 | mov eax,[eax+18] |
279 | test ebx, ebx |
293 | test ebx, ebx |
280 | jns @f |
294 | jns @f |
281 | neg ebx |
295 | neg ebx |
282 | @@: |
296 | @@: |
283 | add eax,9 ;20 |
297 | add eax,9 |
284 | cmp eax,210 |
298 | cmp eax,210 |
285 | jae @f |
299 | jae @f |
286 | mov eax,210 |
300 | mov eax,210 |
287 | @@: |
301 | @@: |
288 | add ebx,54 ;58 |
302 | add ebx,54 |
Line 342... | Line 356... | ||
342 | mcall |
356 | mcall |
343 | @@: |
357 | @@: |
344 | ret |
358 | ret |
Line 345... | Line 359... | ||
345 | 359 | ||
- | 360 | convert: |
|
- | 361 | call convert_1 |
|
- | 362 | mov ecx,[image_file_1] |
|
- | 363 | mcall 68, 13, |
|
- | 364 | ret |
|
346 | convert: |
365 | convert_1: |
347 | mov ecx, [image_file] ;I_END |
366 | mov ecx, [image_file] |
348 | add ecx, [ecx+2] |
367 | add ecx,512 |
349 | mov [soi], ecx |
368 | mov [soi], ecx |
350 | mov eax,[image_file] |
369 | mov eax,[image_file_1] |
351 | mov ebp, [eax+18] |
370 | mov ebp, [eax+18] |
352 | lea ebp, [ebp*3] ; ebp = size of output scanline |
371 | lea ebp, [ebp*3] ; ebp = size of output scanline |
353 | mov eax, [eax+22] |
372 | mov eax, [eax+22] |
354 | dec eax |
373 | dec eax |
355 | mul ebp |
374 | mul ebp |
356 | add eax, ecx |
375 | add eax, ecx |
357 | mov edi, eax ; edi points to last scanline |
376 | mov edi, eax ; edi points to last scanline |
358 | mov esi, [image_file] ;I_END |
377 | mov esi, [image_file_1] |
359 | add esi, [esi+10] |
- | |
360 | ; mov ebx, I_END+54 |
378 | add esi, [esi+10] |
361 | mov ebx,[image_file] |
379 | mov ebx,[image_file_1] |
362 | mov edx, [ebx+22] |
380 | mov edx, [ebx+22] |
363 | add ebx,54 |
381 | add ebx,54 |
364 | lea eax, [ebp*2] |
382 | lea eax, [ebp*2] |
365 | mov [delta], eax |
383 | mov [delta], eax |
Line 368... | Line 386... | ||
368 | jns @f |
386 | jns @f |
369 | neg edx |
387 | neg edx |
370 | and [delta], 0 |
388 | and [delta], 0 |
371 | mov edi, ecx |
389 | mov edi, ecx |
372 | @@: |
390 | @@: |
373 | ; movzx eax, word [I_END+28] |
- | |
374 | mov eax,[image_file] |
391 | mov eax,[image_file_1] |
375 | movzx eax,word [eax+28] |
392 | movzx eax,word [eax+28] |
376 | cmp eax, 24 |
393 | cmp eax, 24 |
377 | jz convert24 |
394 | jz convert24 |
378 | cmp eax, 8 |
395 | cmp eax, 8 |
379 | jz convert8 |
396 | jz convert8 |
Line 398... | Line 415... | ||
398 | push edi |
415 | push edi |
399 | add [esp], ebp |
416 | add [esp], ebp |
400 | .loopi: |
417 | .loopi: |
401 | xor eax, eax |
418 | xor eax, eax |
402 | lodsb |
419 | lodsb |
403 | ; cmp dword [I_END+30], 1 |
- | |
404 | push eax |
420 | push eax |
405 | mov eax,[image_file] |
421 | mov eax,[image_file_1] |
406 | cmp dword [eax+30],1 |
422 | cmp dword [eax+30],1 |
407 | pop eax |
423 | pop eax |
408 | jnz .nocompressed |
424 | jnz .nocompressed |
409 | .compressed: |
425 | .compressed: |
410 | mov ecx, eax |
426 | mov ecx, eax |
Line 501... | Line 517... | ||
501 | ret |
517 | ret |
Line 502... | Line 518... | ||
502 | 518 | ||
503 | align_input: |
519 | align_input: |
504 | push esi |
520 | push esi |
505 | push eax |
521 | push eax |
506 | mov eax,[image_file] |
522 | mov eax,[image_file_1] |
507 | sub esi,eax ;I_END |
523 | sub esi,eax |
508 | sub esi,[eax+10] |
524 | sub esi,[eax+10] |
509 | pop eax |
525 | pop eax |
510 | neg esi |
526 | neg esi |
511 | and esi, 3 |
527 | and esi, 3 |
Line 526... | Line 542... | ||
526 | mcall 9, procinfo, -1 |
542 | mcall 9, procinfo, -1 |
527 | mov eax,[ebx+46] |
543 | mov eax,[ebx+46] |
528 | mov [window_high],eax |
544 | mov [window_high],eax |
529 | mov eax,[ebx+42] |
545 | mov eax,[ebx+42] |
530 | mov [window_width],eax |
546 | mov [window_width],eax |
531 | ; mov eax,[ebx+70] |
- | |
532 | ; mov [window_status],eax |
- | |
533 | mcall 48,4 |
547 | mcall 48,4 |
534 | mov [skin_high],eax |
548 | mov [skin_high],eax |
535 | ret |
549 | ret |
536 | ;--------------------------------------------------------------------- |
550 | ;--------------------------------------------------------------------- |
Line 553... | Line 567... | ||
553 | ; mov ecx,400 ; [y start] *65536 + [y size] |
567 | ; mov ecx,400 ; [y start] *65536 + [y size] |
554 | mov ebx,0*65536 |
568 | mov ebx,0*65536 |
555 | mov ecx,0*65536 |
569 | mov ecx,0*65536 |
556 | add ebx,[wnd_width] |
570 | add ebx,[wnd_width] |
557 | add ecx,[wnd_height] |
571 | add ecx,[wnd_height] |
- | 572 | cmp cx,55 |
|
- | 573 | ja @f |
|
- | 574 | mov cx,55 |
|
- | 575 | @@: |
|
558 | mov edx,0x43ffffff ; color of work area RRGGBB,8->color gl |
576 | mov edx,0x43ffffff ; color of work area RRGGBB,8->color gl |
559 | mcall |
577 | mcall |
Line 560... | Line 578... | ||
560 | 578 | ||
Line 579... | Line 597... | ||
579 | shl ebx,16 |
597 | shl ebx,16 |
580 | add ebx,[window_width] |
598 | add ebx,[window_width] |
581 | sub ebx,4 |
599 | sub ebx,4 |
582 | sub bx,ax |
600 | sub bx,ax |
583 | cmp bx,0 |
601 | cmp bx,0 |
584 | jb @f |
602 | jbe @f |
585 | add ecx,50 shl 16 |
603 | add ecx,50 shl 16 |
586 | mcall 13, , ,0xffffff |
604 | mcall 13, , ,0xffffff |
587 | @@: |
605 | @@: |
588 | pop ecx |
606 | pop ecx |
589 | pop ebx |
607 | pop ebx |
Line 591... | Line 609... | ||
591 | mov ax,cx |
609 | mov ax,cx |
592 | shl ecx,16 |
610 | shl ecx,16 |
593 | add ecx,[window_high] |
611 | add ecx,[window_high] |
594 | sub cx,ax |
612 | sub cx,ax |
595 | sub ecx,4 |
613 | sub ecx,4 |
596 | cmp bx,0 |
614 | cmp cx,0 |
597 | jb @f |
615 | jbe @f |
598 | mcall 13, , ,0xffffff |
616 | mcall 13, , ,0xffffff |
599 | @@: |
617 | @@: |
600 | mov eax,8 |
618 | mov eax,8 |
601 | mov ebx,10*65536+46 |
619 | mov ebx,10*65536+46 |
602 | mov ecx,25*65536+20 |
620 | mov ecx,25*65536+20 |
Line 643... | Line 661... | ||
643 | 661 | ||
Line 644... | Line 662... | ||
644 | thread1: ; start of thread1 |
662 | thread1: ; start of thread1 |
Line -... | Line 663... | ||
- | 663 | ||
- | 664 | mcall 40, 0x27 |
|
- | 665 | ||
645 | 666 | or ecx,-1 ; get information about me |
|
646 | mcall 40, 0x27 |
667 | call getappinfo |
647 | 668 | ||
648 | mov esi,string |
669 | mov esi,string |
649 | @@: |
670 | @@: |
Line 660... | Line 681... | ||
660 | red1: |
681 | red1: |
661 | call draw_window1 |
682 | call draw_window1 |
Line 662... | Line 683... | ||
662 | 683 | ||
Line 663... | Line 684... | ||
663 | still1: |
684 | still1: |
664 | - | ||
Line 665... | Line 685... | ||
665 | mov eax,10 ; wait here for event |
685 | |
666 | mcall |
686 | mcall 10 ; wait here for event |
667 | 687 | ||
668 | cmp eax,1 ; redraw request ? |
688 | cmp eax,1 ; redraw request ? |
669 | je red1 |
689 | je red1 |
670 | cmp eax,2 ; key in buffer ? |
690 | cmp eax,2 ; key in buffer ? |
- | 691 | je key1 |
|
671 | je key1 |
692 | cmp eax,3 ; button in buffer ? |
672 | cmp eax,3 ; button in buffer ? |
693 | je button1 |
Line 673... | Line 694... | ||
673 | je button1 |
694 | |
674 | mouse_edit_box name_editboxes |
695 | mouse_edit_box name_editboxes |
675 | jmp still1 |
696 | jmp still1 |
676 | 697 | ||
677 | key1: ; key |
698 | key1: ; key |
678 | mcall 2 |
699 | mcall 2 |
- | 700 | cmp ah,13 |
|
679 | cmp ah,13 |
701 | je close1 |
680 | je close1 |
702 | cmp ah,27 |
Line 681... | Line 703... | ||
681 | cmp ah,27 |
703 | je close1 |
682 | je close1 |
704 | |
Line 1115... | Line 1137... | ||
1115 | en, 'Ok',\ |
1137 | en, 'Ok',\ |
1116 | ru, 'Ok',\ |
1138 | ru, 'Ok',\ |
1117 | de, 'Ok' |
1139 | de, 'Ok' |
Line 1118... | Line 1140... | ||
1118 | 1140 | ||
1119 | image_file dd 0 |
1141 | image_file dd 0 |
Line 1120... | Line 1142... | ||
1120 | ;image_file_size dd 0 |
1142 | image_file_1 dd 0 |
Line 1121... | Line 1143... | ||
1121 | 1143 | ||
1122 | pos: dd 6 |
1144 | pos: dd 6 |
Line 1134... | Line 1156... | ||
1134 | ;--------------------------------------------------------------------- |
1156 | ;--------------------------------------------------------------------- |
1135 | fileinfo: |
1157 | fileinfo: |
1136 | dd 5 |
1158 | dd 5 |
1137 | dd 0 |
1159 | dd 0 |
1138 | dd 0 |
1160 | dd 0 |
1139 | dd 0 ;x290000-I_END |
1161 | dd 0 |
1140 | dd process_info ;I_END |
1162 | dd process_info |
1141 | string: |
1163 | string: |
1142 | db '/sys/bgr.bmp',0 |
1164 | db '/sys/bgr.bmp',0 |
Line 1143... | Line 1165... | ||
1143 | 1165 | ||
1144 | IM_END: |
1166 | IM_END: |
Line 1147... | Line 1169... | ||
1147 | temp_area: |
1169 | temp_area: |
1148 | procinfo: |
1170 | procinfo: |
1149 | process_info: |
1171 | process_info: |
1150 | rb 1024*4 |
1172 | rb 1024*4 |
1151 | rb 1024*2 |
1173 | rb 1024*2 |
1152 | ;rb 0x10000 |
- | |
1153 | thread: |
1174 | thread: |
1154 | rb 512 |
1175 | rb 512 |
1155 | I_END:0>0> |
1176 | I_END:0>0> |