Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2475 → Rev 2476

/programs/system/icon/trunk/icon.asm
5,6 → 5,11
;* Compile with flat assembler *
;* *
;********************************
; version: 2.11
; last update: 19/03/2012
; changed by: Marat Zakiyanov aka Mario79, aka Mario
; changes: The program uses only 140 Kb memory is now.
; Some speedup.
;---------------------------------------------------------------------
; version: 2.1
; last update: 17/03/2012
33,8 → 38,8
; changes: modified for work with new multi-thread ICON.
;******************************************************************************
ICON_SIZE equ 32*32*3
RAW_SIZE equ ICON_SIZE*32 ;350000
GIF_SIZE equ 12*1024 ;45000
;RAW_SIZE equ ICON_SIZE*32 ;350000
;GIF_SIZE equ 12*1024 ;45000
REC_SIZE equ 80
ICONS_DAT equ '/sys/ICONS.DAT'
ICON_APP equ '/sys/ICON'
59,16 → 64,40
purge newline
;------------------------------------------------------------------------------
START: ; start of execution
mcall 68,11
; get size of file ICONSTRP.GIF
mcall 70,finfo
cmp ebx,GIF_SIZE
ja close
mov esi,gif_file
mov edi,strip_file
mov eax,icon_data
test eax,eax
jnz close
; get memory for ICONSTRP.GIF
mov ecx,[process_table+32]
mov [finfo.size],ecx
mcall 68,12
mov [finfo.point],eax
; load ICONSTRP.GIF
mov [finfo],dword 0
mcall 70,finfo
test eax,eax
jnz close
; calculate and get memory for RAW data
mov esi,[finfo.point]
movzx eax,word [esi+6] ;x
movzx edi,word [esi+8] ;y
imul eax,edi ;x*y
lea edi,[eax+eax*2] ; multiply x3
mov ecx,edi
mcall 68,12
mov [strip_file],eax
mov edi,eax
; convert GIF to RAW
call ReadGIF
; back memeory to system
mcall 68,13,[finfo.point]
 
mov eax,dword[edi+4]
shr eax,5
mov [icon_count],eax
; load ICON.DAT
call load_ic
boot_str:
cmp [I_Param],dword 'BOOT'
237,11 → 266,11
;------------------------------------------------------------------------------
align 4
finfo:
dd 5
dd 0
dd 0
dd 0
dd GIF_SIZE
dd gif_file
.size dd 0 ;GIF_SIZE
.point dd process_table ;gif_file
.path:
db ICON_STRIP,0
rb 31-($-.path)
327,7 → 356,7
mcall 10
cmp eax,3
jne no_f;ound
jne no_f
 
mcall 17
shr eax,8
475,7 → 504,6
ldl1:
movzx ebx,byte [esi+1]
sub ebx,65
; imul ebx,10
; multiply x10
shl ebx,1 ; multiply x2
lea ebx,[ebx+ebx*4] ; multiply x5
747,7 → 775,8
and eax,0xfffffff8
push eax
imul eax,ICON_SIZE
lea ebx,[strip_file+8+eax]
mov ebx,[strip_file]
lea ebx,[ebx+8+eax]
mov ecx,8
mov edx,(33-18) shl 16+238
;--------------------------------------
944,7 → 973,6
mov dword[ebp-4],esi
mcall 51,1,thread
add ebp,0x100
 
; change to next thread if mutex is blocked
mov eax,68
mov ebx,1
971,7 → 999,7
; esp-28 = start of thread stack
; esp-24 = ???
; esp-20 = 'AA-F' or...
; esp-16 = ??? SHL greedy maniac mode on!
; esp-16 = ebp-4 - area of f. 15.6
; esp-12 = ebp+0 = X
; esp-8 = ebp+4 = Y
; esp-4 = ebp+8 = adress of icon_data
981,7 → 1009,6
sub esp,12
mov ebp,esp
sub esp,16
call shape_window
call draw_window2
mov [create_thread_event],1
mcall 40,010101b
1069,7 → 1096,6
align 4
fill_paths:
push esi edi
; dps '>'
movzx ecx,byte[str_lens+ebx]
add esi,[positions+ebx*4]
push esi
1094,8 → 1120,6
align 4
.noms:
and byte[edi],0
; call debug_outstr
; dps <'<',13,10>
pop edi esi
ret
;--------------------------------------
1143,6 → 1167,13
;------------------------------------------------------------------------------
align 4
draw_picture:
mcall 15,6
test eax,eax
jnz @f
mcall 68,1
jmp draw_picture
@@:
mov [ebp-4],eax
mov [image],image_area
 
mov edi,[ebp+8]
1154,18 → 1185,24
lea eax,[eax+eax*2] ; multiply x3
shl eax,10 ; multiply x1024
lea edi,[eax+strip_file+8]
xor ebx,ebx
mov edi,[strip_file]
lea edi,[eax+edi+8]
xor ecx,ecx
mov esi,edi
 
mov [pixpos],0
;--------------------------------------
; loop start
; loop Y start
align 4
new_line:
push ecx ; Y
xor ebx,ebx
;--------------------------------------
; loop X start
align 4
newb:
push ebx
push ecx
mov ecx,[esp]
push ebx ; X
 
cmp ebx,10
jb yesbpix
1204,7 → 1241,7
imul eax,[bgrx]
push eax
mov eax,[ebp+0]
add eax,[esp+8]
add eax,[esp+4]
imul eax,[bgrx]
cdq
movzx ebx,word [scrxy+2]
1226,7 → 1263,7
imul eax,[bgrx]
push eax
mov eax,[ebp+0]
add eax,[esp+8]
add eax,[esp+4]
movzx ebx,word [bgrxy+2]
cdq
div ebx
1237,13 → 1274,11
align 4
notiled:
lea ecx,[eax+eax*2]
mcall 39,2
add ecx,[ebp-4]
mov eax,[ecx]
;--------------------------------------
align 4
nobpix:
pop ecx
pop ebx
 
mov edx,eax
mov eax,[image]
 
1259,6 → 1294,9
inc eax
mov [image],eax
 
pop ebx
 
inc ebx
mov eax,[yw]
1266,7 → 1304,7
cmp ebx,eax
jb newb
xor ebx,ebx
pop ecx
 
inc ecx
mov eax,[ya]
1281,10 → 1319,16
align 4
notop:
cmp ecx,52
jnz newb
jnz new_line
;--------------------------------------
align 4
toponly:
mcall 15,7,[ebp-4]
test eax,eax
jnz @f
mcall 68,1
jmp toponly
@@:
xor edx,edx
mcall 7,image_area,<52,52>
;--------------------------------------
1364,7 → 1408,6
align 4
draw_window2:
mcall 12,1
 
; DRAW WINDOW
xor eax,eax ; function 0 : define and draw window
mov ebx,[ebp+0-2]
1411,74 → 1454,6
mcall 12,2
ret
;------------------------------------------------------------------------------
shape_window:
; give the shape reference area
mcall 50,0,shape_reference
; give the shape scale 32 x 32 -> 128 x 128 ecx = 2
; you dont have to give this, scale is 1:1 by default
; mcall 50,1,2
ret
;------------------------------------------------------------------------------
shape_reference: ; 32 x 32 ( window_size_X + 1 ) * ( window_size_Y + 1 )
 
db 0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0
db 0,0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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
;------------------------------------------------------------------------------
tl dd 8
yw: dd 51
ya dd 0
1517,17 → 1492,12
cur_band dd ?
sel_icon1 rd 1
icon_count rd 1
strip_file rd 1
;------------------------------------------------------------------------------
align 4
param_str rb 31
;------------------------------------------------------------------------------
align 4
gif_file rb GIF_SIZE
;------------------------------------------------------------------------------
align 4
strip_file rb RAW_SIZE
;------------------------------------------------------------------------------
align 4
process_table:
rb 0x400
;------------------------------------------------------------------------------
1551,8 → 1521,4
image_area:
rb 52*52*3
;------------------------------------------------------------------------------
;align 4
;shape_reference_0:
; rb 52*52 ; ( window_size_X + 1 ) * ( window_size_Y + 1 )
;------------------------------------------------------------------------------
I_END: