forked from KolibriOS/kolibrios
MV v.0.5
Dinamic Allocation Memory git-svn-id: svn://kolibrios.org@825 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
c6fefc9917
commit
a59b895ca6
@ -1,6 +1,7 @@
|
||||
; Picture browser by lisovin@26.ru
|
||||
; Modified by Ivan Poddubny - v.0.3
|
||||
; Modified by Diamond - v.0.4
|
||||
; Modified by Mario79 - v.0.5 18.07.08 Dinamic Allocation Memory
|
||||
; Compile with FASM for Menuet
|
||||
|
||||
;******************************************************************************
|
||||
@ -10,16 +11,17 @@
|
||||
dd 0x01 ; header version
|
||||
dd START ; start of code
|
||||
dd IM_END ; size of image
|
||||
dd 0x300000 ; memory for app
|
||||
dd 0x300000 ; esp
|
||||
dd I_END ;0x300000 ; memory for app
|
||||
dd I_END ;0x300000 ; esp
|
||||
dd temp_area , 0x0 ; I_Param , I_Icon
|
||||
|
||||
include 'lang.inc'
|
||||
include '..\..\..\macros.inc'
|
||||
;include 'macros.inc'
|
||||
;******************************************************************************
|
||||
|
||||
START: ; start of execution
|
||||
|
||||
mcall 68, 11
|
||||
; check for parameters
|
||||
cmp dword [temp_area],'BOOT'
|
||||
jne .no_boot
|
||||
@ -125,7 +127,7 @@ still:
|
||||
mov eax,51
|
||||
mov ebx,1
|
||||
mov ecx,thread1
|
||||
mov edx,0x29fff0
|
||||
mov edx,thread ;0x29fff0
|
||||
mcall
|
||||
jmp still
|
||||
nofile:
|
||||
@ -135,8 +137,9 @@ still:
|
||||
kopen:
|
||||
mov ecx,-1
|
||||
call getappinfo
|
||||
mov ebx,dword [I_END+42]
|
||||
mov ecx,dword [I_END+46]
|
||||
mov eax,[image_file]
|
||||
mov ebx,dword [eax+42]
|
||||
mov ecx,dword [eax+46]
|
||||
add ebx,10*65536-15
|
||||
add ecx,50*65536-55
|
||||
mov edx,0xffffff
|
||||
@ -146,7 +149,8 @@ still:
|
||||
call load_image
|
||||
|
||||
open1:
|
||||
cmp word [I_END],word 'BM'
|
||||
mov eax,[image_file]
|
||||
cmp [eax],word 'BM'
|
||||
jne still
|
||||
call convert
|
||||
call drawimage
|
||||
@ -162,7 +166,7 @@ still:
|
||||
mov eax,51
|
||||
mov ebx,1
|
||||
mov ecx,thread2
|
||||
mov edx,0x2afff0
|
||||
mov edx,thread-512 ;0x2afff0
|
||||
mcall
|
||||
jmp still
|
||||
noinfo:
|
||||
@ -177,7 +181,7 @@ still:
|
||||
mov eax,51
|
||||
mov ebx,1
|
||||
mov ecx,thread3
|
||||
mov edx,0x2bfff0
|
||||
mov edx,thread-512*2 ;0x2bfff0
|
||||
mcall
|
||||
jmp still
|
||||
;call background
|
||||
@ -190,11 +194,55 @@ still:
|
||||
|
||||
|
||||
load_image:
|
||||
mov eax, 70
|
||||
mov ebx, fileinfo
|
||||
mcall
|
||||
mov eax,[I_END+18]
|
||||
mov ebx,[I_END+22]
|
||||
mov [fileinfo+0],dword 5
|
||||
mov [fileinfo+12],dword 0
|
||||
mov [fileinfo+16],dword process_info
|
||||
|
||||
cmp [image_file],0
|
||||
je @f
|
||||
mov ecx,[image_file]
|
||||
mcall 68, 13,
|
||||
|
||||
@@:
|
||||
mcall 70, fileinfo
|
||||
|
||||
mov [fileinfo+0],dword 0
|
||||
mov [fileinfo+12],dword 512
|
||||
mov [fileinfo+16],dword process_info+40
|
||||
|
||||
mcall 70, fileinfo
|
||||
|
||||
mov ecx,[process_info+32]
|
||||
mov [fileinfo+12],ecx
|
||||
|
||||
mov eax,[process_info+40+28]
|
||||
|
||||
cmp eax, 24
|
||||
jz .convert24
|
||||
cmp eax, 8
|
||||
jz .convert8
|
||||
cmp eax, 4
|
||||
jz .convert4
|
||||
shl ecx,2
|
||||
.convert4:
|
||||
shl ecx,1
|
||||
.convert8:
|
||||
lea ecx,[ecx*3]
|
||||
.convert24:
|
||||
shl ecx,1
|
||||
@@:
|
||||
|
||||
mcall 68, 12
|
||||
|
||||
|
||||
mov [fileinfo+16],eax
|
||||
mov [image_file],eax
|
||||
|
||||
mcall 70, fileinfo
|
||||
|
||||
mov eax,[image_file]
|
||||
mov ebx,[eax+22]
|
||||
mov eax,[eax+18]
|
||||
test ebx, ebx
|
||||
jns @f
|
||||
neg ebx
|
||||
@ -215,39 +263,34 @@ load_image:
|
||||
jz @f
|
||||
mov esi,ebx
|
||||
mov edx,eax
|
||||
mov ecx,-1
|
||||
mov ebx,-1
|
||||
mov eax,67
|
||||
mcall
|
||||
mcall 67,-1,-1
|
||||
@@:
|
||||
ret
|
||||
|
||||
|
||||
drawimage:
|
||||
cmp word [I_END],word 'BM'
|
||||
mov eax,[image_file]
|
||||
cmp [eax],word 'BM'
|
||||
jne nodrawimage
|
||||
mov eax,7
|
||||
mov ebx,[soi]
|
||||
mov ecx, dword [I_END+18-2]
|
||||
mov cx, [I_END+22]
|
||||
mov ecx, dword [eax+18-2]
|
||||
mov cx, [eax+22]
|
||||
test cx, cx
|
||||
jns @f
|
||||
neg cx
|
||||
@@:
|
||||
mov edx,10*65536+50
|
||||
mcall
|
||||
mcall 7,[soi]
|
||||
nodrawimage:
|
||||
ret
|
||||
|
||||
; “‘’€<E28099>Ž‚ˆ’œ ”Ž<E2809D>
|
||||
background:
|
||||
cmp word [I_END],word 'BM'
|
||||
mov eax,[image_file]
|
||||
cmp [eax],word 'BM'
|
||||
jne @f
|
||||
mov eax,15
|
||||
mov ebx,1
|
||||
mov ecx,[I_END+18] ; è¨à¨
|
||||
mov edx,[I_END+22] ; ¢ëá®â
|
||||
mcall
|
||||
mov ecx,[eax+18] ; è¨à¨
|
||||
mov edx,[eax+22] ; ¢ëá®â
|
||||
mcall 15,1
|
||||
|
||||
mov esi, ecx
|
||||
imul esi, edx
|
||||
@ -268,20 +311,23 @@ load_image:
|
||||
ret
|
||||
|
||||
convert:
|
||||
mov ecx, I_END
|
||||
mov ecx, [image_file] ;I_END
|
||||
add ecx, [ecx+2]
|
||||
mov [soi], ecx
|
||||
mov ebp, [I_END+18]
|
||||
mov eax,[image_file]
|
||||
mov ebp, [eax+18]
|
||||
lea ebp, [ebp*3] ; ebp = size of output scanline
|
||||
mov eax, [I_END+22]
|
||||
mov eax, [eax+22]
|
||||
dec eax
|
||||
mul ebp
|
||||
add eax, ecx
|
||||
mov edi, eax ; edi points to last scanline
|
||||
mov esi, I_END
|
||||
mov esi, [image_file] ;I_END
|
||||
add esi, [esi+10]
|
||||
mov ebx, I_END+54
|
||||
mov edx, [I_END+22]
|
||||
; mov ebx, I_END+54
|
||||
mov ebx,[image_file]
|
||||
mov edx, [ebx+22]
|
||||
add ebx,54
|
||||
lea eax, [ebp*2]
|
||||
mov [delta], eax
|
||||
test edx, edx
|
||||
@ -291,7 +337,9 @@ convert:
|
||||
and [delta], 0
|
||||
mov edi, ecx
|
||||
@@:
|
||||
movzx eax, word [I_END+28]
|
||||
; movzx eax, word [I_END+28]
|
||||
mov eax,[image_file]
|
||||
movzx eax,word [eax+28]
|
||||
cmp eax, 24
|
||||
jz convert24
|
||||
cmp eax, 8
|
||||
@ -319,7 +367,11 @@ convert8:
|
||||
.loopi:
|
||||
xor eax, eax
|
||||
lodsb
|
||||
cmp dword [I_END+30], 1
|
||||
; cmp dword [I_END+30], 1
|
||||
push eax
|
||||
mov eax,[image_file]
|
||||
cmp dword [eax+30],1
|
||||
pop eax
|
||||
jnz .nocompressed
|
||||
.compressed:
|
||||
mov ecx, eax
|
||||
@ -417,8 +469,11 @@ convert1:
|
||||
|
||||
align_input:
|
||||
push esi
|
||||
sub esi, I_END
|
||||
sub esi, [I_END+10]
|
||||
push eax
|
||||
mov eax,[image_file]
|
||||
sub esi,eax ;I_END
|
||||
sub esi,[eax+10]
|
||||
pop eax
|
||||
neg esi
|
||||
and esi, 3
|
||||
add [esp], esi
|
||||
@ -449,8 +504,8 @@ draw_window:
|
||||
xor eax,eax ; function 0 : define and draw window
|
||||
; mov ebx,350 ; [x start] *65536 + [x size]
|
||||
; mov ecx,400 ; [y start] *65536 + [y size]
|
||||
mov ebx,100*65536
|
||||
mov ecx,100*65536
|
||||
mov ebx,0*65536
|
||||
mov ecx,0*65536
|
||||
add ebx,[wnd_width]
|
||||
add ecx,[wnd_height]
|
||||
mov edx,0x03ffffff ; color of work area RRGGBB,8->color gl
|
||||
@ -786,19 +841,26 @@ draw_window2:
|
||||
mov eax,47
|
||||
mov edx,200*65536+40
|
||||
mov esi,ecx
|
||||
mov ecx, [I_END+2]
|
||||
mov ecx,[image_file]
|
||||
push ecx
|
||||
mov ecx, [ecx+2]
|
||||
call digitcorrect
|
||||
mcall
|
||||
add edx,10
|
||||
mov ecx, [I_END+18]
|
||||
pop ecx
|
||||
push ecx
|
||||
mov ecx, [ecx+18]
|
||||
call digitcorrect
|
||||
mcall
|
||||
add edx,10
|
||||
mov ecx, [I_END+22]
|
||||
pop ecx
|
||||
push ecx
|
||||
mov ecx, [ecx+22]
|
||||
call digitcorrect
|
||||
mcall
|
||||
add edx,10
|
||||
movzx ecx,word [I_END+28]
|
||||
pop ecx
|
||||
movzx ecx,word [ecx+28]
|
||||
call digitcorrect
|
||||
mcall
|
||||
|
||||
@ -1046,13 +1108,24 @@ lsz ok_btn,\
|
||||
ru, 'Ok',\
|
||||
de, 'Ok'
|
||||
|
||||
image_file dd 0
|
||||
;image_file_size dd 0
|
||||
|
||||
pos: dd 6
|
||||
|
||||
;fileinfo:
|
||||
; dd 0
|
||||
; dd 0
|
||||
; dd 0
|
||||
; dd 0x290000-I_END
|
||||
; dd I_END
|
||||
|
||||
fileinfo:
|
||||
dd 5
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0x290000-I_END
|
||||
dd I_END
|
||||
dd 0 ;x290000-I_END
|
||||
dd process_info ;I_END
|
||||
string:
|
||||
db '/sys/bgr.bmp',0
|
||||
|
||||
@ -1061,5 +1134,9 @@ IM_END:
|
||||
|
||||
process_info:
|
||||
temp_area:
|
||||
rb 0x10000
|
||||
rb 1024*4
|
||||
rb 1024*2
|
||||
;rb 0x10000
|
||||
thread:
|
||||
rb 512
|
||||
I_END:
|
||||
|
Loading…
Reference in New Issue
Block a user