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