Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2468 → Rev 2469

/programs/system/icon/trunk/icon.asm
15,7 → 15,7
ICONS_DAT equ '/sys/ICONS.DAT'
ICON_APP equ '/sys/ICON'
ICON_STRIP equ '/sys/ICONSTRP.GIF'
 
;------------------------------------------------------------------------------
use32
org 0x0
db 'MENUET01' ; 8 byte id
23,8 → 23,9
dd START ; start of code
dd I_END ; size of image
dd icon_data+0x30000 ; memory for app
dd icon_data+0x30000 ; esp
dd stack_area ; esp
dd I_Param , 0x0 ; I_Param , I_Icon
;------------------------------------------------------------------------------
include '../../../macros.inc'
include 'lang.inc'
COLOR_ORDER equ MENUETOS
31,7 → 32,7
include 'gif_lite.inc'
;include 'debug.inc'
purge newline
;******************************************************************************
;------------------------------------------------------------------------------
START: ; start of execution
mcall 70,finfo
cmp ebx,GIF_SIZE
52,51 → 53,70
call draw_window ; at first, draw the window
mov esi,[current_icon]
jmp band
;------------------------------------------------------------------------------
align 4
still:
 
mov eax,10 ; wait here for event
mcall
 
mcall 10 ; wait here for event
dec eax ; redraw request ?
jz red
dec eax ; key in buffer ?
jz key
 
;------------------------------------------------------------------------------
align 4
button: ; button
mov al,17 ; get id
mcall
 
mcall 17 ; get id
shr eax,8
 
; dps "button id: "
; dpd eax
; newline_1
cmp eax,1 ; button id=1 ?
je close
;--------------------------------------
align 4
noclose:
mov esi,[current_icon]
add esi,12
mov ebx,[cur_band];eax
cmp eax,31
cmp eax,31 ; right arrow to icons bar
jne .no_back
 
add ebx,8
mov eax,[icon_count]
cmp eax,ebx
jae .drwic2
 
xor ebx,ebx
jmp .drwic2
;--------------------------------------
align 4
.no_back:
cmp eax,30
cmp eax,30 ; left arrow to icons bar
jne .no_side
 
test ebx,ebx
jnz .dec
 
mov ebx,[icon_count]
and ebx,0xfffffff8
add ebx,8
;--------------------------------------
align 4
.dec:
sub ebx,8
;--------------------------------------
align 4
.drwic2:
mov [cur_band],ebx
;--------------------------------------
align 4
.drwic1:
call draw_icon
jmp still
;--------------------------------------
align 4
.no_side:
cmp eax,32
jne .no_ico
111,11 → 131,14
lea ecx,[ebx+eax]
cmp ecx,[icon_count]
jae still
 
mov [sel_icon1],eax
mov ecx,eax
add eax,ebx
call itoa
jmp .drwic1
;--------------------------------------
align 4
.no_ico:
cmp eax,11
jb no_str
123,14 → 146,12
jg no_str
call read_string
jmp still
;--------------------------------------
align 4
no_str:
 
 
cmp eax,21 ; apply changes
jne no_apply
 
; (1) save list
 
mov ebx,finfo ; Change by spraid
mov dword[ebx],2
mov edx,REC_SIZE
138,48 → 159,48
mov [ebx+12],edx
mov esi,iconlst
call lst_path
mov eax,70
mcall
 
mcall 70
; (2) terminate all icons
mov eax,9
mov ebx,I_END
or ecx,-1
mcall
mcall 9,I_END
mov edi,[ebx+30]
;--------------------------------------
align 4
newread2:
mov esi,1
;--------------------------------------
align 4
newread:
inc esi
mov eax,9
mov ebx,I_END
mov ecx,esi
mcall
mcall 9,I_END
cmp edi,[ebx+30]
je newread
 
cmp esi,eax
jg all_terminated
 
mov eax,[I_END+10]
mov eax,[ebx+10] ;[I_END+10]
and eax,not 20202020h
cmp eax,'@ICO'
jz @f
cmp eax,'ICON'
jne newread
;--------------------------------------
align 4
@@:
mov eax,51
cmp eax,[I_END+42]
cmp eax,[ebx+42] ;[I_END+42]
jne newread
cmp eax,[I_END+46]
 
cmp eax,[ebx+46] ;[I_END+46]
jne newread
 
mov eax,18
mov ebx,2
mov ecx,esi
mcall
 
mcall 18,2
jmp newread2
 
;------------------------------------------------------------------------------
align 4
finfo_start:
dd 7
dd 0
188,9 → 209,8
dd 0
db 0
dd finfo.path
 
 
 
;------------------------------------------------------------------------------
align 4
finfo:
dd 0
dd 0
200,38 → 220,30
.path:
db ICON_STRIP,0
rb 31-($-.path)
 
 
;------------------------------------------------------------------------------
align 4
all_terminated:
 
apply_changes:
 
;apply_changes:
mov ebx, finfo_start
mov dword [ebx+8], boot_str+6
mov esi, iconname
call lst_path
mov eax, 70
mcall
mcall 70
jmp still
 
;------------------------------------------------------------------------------
align 4
no_apply:
 
cmp eax,22 ; user pressed the 'add icon' button
jne no_add_icon
 
mov eax,4
mov ebx,24*65536+250+8*14
mov ecx,0xc0ff0000
mov edx,add_text
mov edi,0xffffff
mcall
mcall 4,,0xc0ff0000,add_text,,0xffffff
 
mov eax,10
mcall
mcall 10
cmp eax,3
jne still
mov eax,17
mcall
 
mcall 17
shr eax,8
cmp eax,40
jb no_f
241,7 → 253,10
xor edx,edx ; bcd -> 10
mov ebx,16
div ebx
imul eax,10
; imul eax,10
; multiply x10
shl eax,1 ; multiply x2
lea eax,[eax+eax*4] ; multiply x5
add eax,edx
 
mov ebx,eax
273,31 → 288,25
rep movsb
mov esi,[current_icon]
jmp band
;--------------------------------------
align 4
no_f:
 
call draw_btns;draw_window
 
jmp still
 
;--------------------------------------
align 4
no_add_icon:
 
 
cmp eax,23 ; user pressed the remove icon button
jne no_remove_icon
 
mov eax,4
mov ebx,24*65536+250+8*14
mov ecx,0xc0ff0000
mov edx,rem_text
mov edi,0xffffff
mcall
mcall 4,,0xc0ff0000,rem_text,,0xffffff
 
mov eax,10
mcall
mcall 10
cmp eax,3
jne no_f;ound
mov eax,17
mcall
 
mcall 17
shr eax,8
cmp eax,40
jb red;no_f;ound
306,7 → 315,10
xor edx,edx
mov ebx,16
div ebx
imul eax,10
; imul eax,10
; multiply x10
shl eax,1 ; multiply x2
lea eax,[eax+eax*4] ; multiply x5
add eax,edx
 
mov ebx,eax
327,6 → 339,8
mov edi,REC_SIZE
imul edi,[icons]
add edi,icon_data
;--------------------------------------
align 4
news:
cmp word [esi],ax
je foundi
334,9 → 348,9
cmp esi,edi
jb news
jmp red
 
;--------------------------------------
align 4
foundi:
 
mov ecx,edi
sub ecx,esi
 
356,13 → 370,12
shr ebx,4
add ebx,40
mov [cur_btn],ebx
 
jmp red
 
;--------------------------------------
align 4
no_remove_icon:
 
cmp eax,40 ; user pressed button for icon position
jb no_on_screen_button
jb still
mov edi,eax
sub eax,40
mov edx,eax
370,10 → 383,11
and edx,0xf
mov dh,ah
add edx,65*256+65
 
mov esi,icon_data
mov ecx,[icons]
cld
;--------------------------------------
align 4
findl1:
cmp dx,[esi]
je foundl1
380,11 → 394,13
add esi,REC_SIZE
loop findl1
jmp still
 
;--------------------------------------
align 4
foundl1:
 
mov [current_icon],esi
mov [cur_btn],edi
;--------------------------------------
align 4
band:
add esi,12
call atoi
391,32 → 407,20
and eax,0xfffff8
mov [cur_band],eax
call draw_btns
 
jmp still
 
no_on_screen_button:
 
 
jmp still
 
;------------------------------------------------------------------------------
current_icon dd icon_data
 
 
;------------------------------------------------------------------------------
align 4
print_strings:
 
pusha
 
mov eax,13 ; clear text area
mov ebx,100*65536+180
mov ecx,(278+12)*65536+40
mov edx,0xffffff
mcall
 
mcall 13,<100,180>,<278+12,40>,0xffffff ; clear text area
xor edi,edi
mov eax,4 ; icon text
mov ebx,100*65536+278+14
mov ecx,3
;--------------------------------------
align 4
.ll:
push ecx
mov ecx,0x000000
431,11 → 435,11
 
popa
ret
 
;------------------------------------------------------------------------------
iconlst db ICONS_DAT,0
 
;------------------------------------------------------------------------------
align 4
load_icon_list:
 
mov edi,icons_reserved ; clear reserved area
mov eax,32
mov ecx,10*9
444,10 → 448,15
 
mov ecx,[icons] ; set used icons to reserved area
mov esi,icon_data
;--------------------------------------
align 4
ldl1:
movzx ebx,byte [esi+1]
sub ebx,65
imul ebx,10
; imul ebx,10
; multiply x10
shl ebx,1 ; multiply x2
lea ebx,[ebx+ebx*4] ; multiply x5
movzx eax,byte [esi]
add ebx,eax
sub ebx,65
456,13 → 465,15
add esi,REC_SIZE
loop ldl1
ret
 
;------------------------------------------------------------------------------
align 4
lst_path:
mov ecx,30
mov edi,finfo.path
rep movsb
ret
 
;------------------------------------------------------------------------------
align 4
load_ic:
mov ebx,finfo
mov dword[ebx+12],48*REC_SIZE
476,11 → 487,12
div ebx
mov [icons],eax
ret
 
 
;------------------------------------------------------------------------------
align 4
positions dd 3,16,47
str_lens db 8,30,30
 
;------------------------------------------------------------------------------
align 4
read_string:
pusha
sub eax,11
487,35 → 499,39
movzx ecx,byte[str_lens+eax]
mov [cur_str],ecx
mov eax,[positions+eax*4]
 
mov edi,[current_icon]
add edi,eax
mov [addr],edi
 
add edi,ecx
 
;--------------------------------------
align 4
.l1:
dec edi
cmp byte[edi],' '
jne .found
 
mov byte[edi],'_'
loop .l1
 
dec edi
;--------------------------------------
align 4
.found:
inc edi
push edi
call print_strings
 
pop edi
;--------------------------------------
align 4
f11:
mov eax,10
mcall
mcall 10
cmp eax,2
jz fbu
jmp rs_done
;--------------------------------------
align 4
fbu:
mov eax,2
mcall
mcall 2
shr eax,8
cmp eax,13
je rs_done
527,20 → 543,21
mov [edi],byte '_'
call print_strings
jmp f11
;--------------------------------------
align 4
nobsl:
cmp eax,31
jbe f11
mov [edi],al
call print_strings
 
inc edi
mov esi,[addr]
add esi,[cur_str]
cmp esi,edi
jnz f11
 
;--------------------------------------
align 4
rs_done:
 
mov ecx,[addr]
add ecx,[cur_str]
sub ecx,edi
550,103 → 567,77
call print_strings
popa
ret
 
;------------------------------------------------------------------------------
align 4
key: ; key
mov al,2 ; just read it and ignore
mcall
mcall 2 ; just read it and ignore
jmp still
 
;------------------------------------------------------------------------------
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
align 4
draw_window:
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mcall
 
mcall 12,1
; DRAW WINDOW
xor eax,eax
mov ebx,210*65536+300
mov ecx,30*65536+390-14
mov edx,0x14ffffff
mov edi,title ; WINDOW LABEL
mcall
xor esi,esi
mcall ,<210,300>,<30,(390-14)>,0x14ffffff,,title
 
mov eax,13 ; WINDOW AREA
mov ebx,20*65536+260
mov ecx,35*65536+200
mov edx,0x3366cc
mcall
mcall 13,<20,260>,<35,200>,0x3366cc ; WINDOW AREA
 
mov eax,38 ; VERTICAL LINE ON WINDOW AREA
mov ebx,150*65536+150
mov ecx,35*65536+235
mov edx,0xffffff
mcall
mcall 38,<150,150>,<35,235>,0xffffff ; VERTICAL LINE ON WINDOW AREA
 
mov eax,38 ; HOROZONTAL LINE ON WINDOW AREA
mov ebx,20*65536+280
mov ecx,135*65536+135
mov edx,0xffffff
mcall
mcall ,<20,280>,<135,135> ; HOROZONTAL LINE ON WINDOW AREA
 
mov eax,8 ; TEXT ENTER BUTTONS
mov ebx,20*65536+72
mov ecx,(275+1+14)*65536+13-2
mov edx,11
mov esi,[bcolor]
mcall
mcall 8,<20,72>,<(275+1+14),(13-2)>,11,[bcolor] ;id 11 TEXT ENTER BUTTONS
inc edx
add ecx,14*65536
mcall
mcall ; id 12
inc edx
add ecx,14*65536
mcall
mcall ; id 13
 
; mov eax,8 ; APPLY AND SAVE CHANGES BUTTON
mov ebx,20*65536+259
mov ecx,(329+2)*65536+15-4
mov edx,21
mov esi,[bcolor]
mcall
mcall ,<20,259>,<(329+2),(15-4)>,21 ; id 21 APPLY AND SAVE CHANGES BUTTON
 
; mov eax,8 ; ADD ICON BUTTON
mov ebx,20*65536+129-2
add ecx,14*65536
inc edx
mcall
mcall ,<20,(129-2)> ; id 22 ADD ICON BUTTON
 
; mov eax,8 ; REMOVE ICON BUTTON
add ebx,(130+2)*65536
inc edx
mcall
mcall ; id 23 REMOVE ICON BUTTON
 
mcall ,<20-14,8>,<260-23,32>,30+1 shl 30 ; IMAGE BUTTON
mcall ,<(20-14),8>,<(260-23),32>,30 + 1 shl 30 ; id 30 IMAGE BUTTON
 
inc edx
add ebx,(36*7+26) shl 16
mcall
mcall ; id 31
 
add edx,1+1 shl 29
mov ebx,(33-19) shl 16+(34*8)
mcall
mcall 4,<23-15,273-24>,0,arrows,1
mcall ,<(33-19),(34*8)> ; id 32
mcall 4,<(23-15),(273-24)>,0,arrows,1
 
add ebx,(36*7+27)shl 16
add edx,2
mcall
 
dec edx
mcall ,<120,250>
 
lea edx,[ebx+8 shl 16]
mov ecx,[icon_count]
mcall 47,0x30000,,,0
mcall 47,0x30000,[icon_count],,0
 
;;
mov eax,4
mov ebx,24*65536+250+14+14+14
mov ebx,24 shl 16+(250+14+14+14)
mov ecx,0xffffff
mov edx,text
mov esi,47
;--------------------------------------
align 4
newline:
mov ecx,[edx]
add edx,4
655,15 → 646,17
add edx,47
cmp [edx],byte 'x'
jne newline
;--------------------------------------
align 4
draw_btns:
;;
mov eax,0 ; DRAW BUTTONS ON WINDOW AREA
mov ebx,20*65536+25
mov ecx,35*65536+19
mov ebx,20 shl 16+25
mov ecx,35 shl 16+19
mov edi,icon_table
mov edx,40
;--------------------------------------
align 4
newbline:
 
cmp [edi],byte 'x'
jne no_button
 
670,49 → 663,47
mov esi,0x5577cc
cmp [edi+90],byte 'x'
jne nores
 
mov esi,0xcc5555
cmp edx,[cur_btn]
jne nores
 
mov esi,0xe7e05a
;--------------------------------------
align 4
nores:
 
push eax
mov eax,8
mcall
mcall 8
pop eax
 
;--------------------------------------
align 4
no_button:
add ebx,26 shl 16
 
add ebx,26*65536
 
inc edi
inc edx
 
inc al
cmp al,9
jbe newbline
mov al,0
 
add edx,6
 
ror ebx,16
mov bx,20
ror ebx,16
add ecx,20*65536
 
add ecx,20 shl 16
inc ah
cmp ah,8;9
jbe newbline
 
call print_strings
call draw_icon
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
mcall
 
mcall 12,2
ret
 
;------------------------------------------------------------------------------
align 4
draw_icon:
mcall 13,<33-20,34*8+2>,<260-24,37+15-2>,0xffffff
mcall 13,<(33-20),(34*8+2)>,<(260-24),(37+15-2)>,0xffffff
mov esi,[current_icon]
add esi,12
call atoi
725,8 → 716,10
imul eax,34 shl 16
lea ebx,[eax+(33-19) shl 16]
mov bx,34
mcall 13,,<236+35,3>,0xff0000
mcall 13,,<(236+35),3>,0xff0000
mov eax,[esp]
;--------------------------------------
align 4
.nou:
mov eax,[cur_band]
and eax,0xfffffff8
735,6 → 728,8
lea ebx,[strip_file+8+eax]
mov ecx,8
mov edx,(33-18) shl 16+238
;--------------------------------------
align 4
.nxt:
push ecx
mcall 7,,<32,32>
747,33 → 742,32
lea edx,[ebx+(8*5)shl 16]
pop ecx
mcall 47,0x30000,,,0xff
add ecx,7
add edx,(3*8+4)shl 16
mcall
mov ecx,[icon_count]
add edx,(5*8+4)shl 16
mcall
mcall ,,[icon_count]
pop ecx
add edx,(10*8+4)shl 16
mcall ,,,,0xff0000
ret
 
;------------------------------------------------------------------------------
; DATA AREA
 
 
bcolor dd 0x335599
 
;------------------------------------------------------------------------------
icon_table:
 
times 4 db 'xxxx xxxx'
times 2 db ' '
times 1 db ' '
times 2 db 'xxxx xxxx'
; times 1 db ' '
 
;------------------------------------------------------------------------------
icons_reserved:
times 9 db ' '
 
;------------------------------------------------------------------------------
if lang eq ru
text:
db 255,255,255,0, ' ’…Š‘’ '
816,16 → 810,17
title db 'Icon Manager',0
 
end if
 
;------------------------------------------------------------------------------
arrows db '</>'
;------------------------------------------------------------------------------
iconname:
db ICON_APP,0
 
;------------------------------------------------------------------------------
icon_default:
db 'AA-SYSXTREE-000-/RD/1/SYSXTREE '
db '- *'
db 13,10
 
;------------------------------------------------------------------------------
rep_text:
if lang eq ru
db '‡€—Šˆ - ˆ‡ , ‚›€ #'
834,17 → 829,13
end if
 
rep_text_len:
 
;//////////////////////////
;------------------------------------------------------------------------------
align 4
get_bg_info:
mov eax,39
mov ebx,4
mcall
mcall 39,4
mov [bgrdrawtype],eax
 
mov eax,39 ; get background size
mov ebx,1
mcall
mcall 39,1 ; get background size
mov [bgrxy],eax
 
mov ebx,eax
853,18 → 844,21
mov [bgrx],eax
mov [bgry],ebx
ret
 
;------------------------------------------------------------------------------
align 4
calc_icon_pos:
movzx eax,byte [ebp-20] ; x position
sub eax,'A' ;eax - number of letter
cmp eax,4
jg no_left
 
shl eax,6 ;imul eax,64
add eax,16
movzx ebx,[warea.left]
add eax,ebx
jmp x_done
 
;--------------------------------------
align 4
no_left:
sub eax,9
sal eax,6 ;imul eax,64
871,18 → 865,22
sub eax,16+52-1
movzx ebx,[warea.right]
add eax,ebx
;--------------------------------------
align 4
x_done:
mov [ebp-12],eax
 
movzx eax,byte [ebp-20+1] ; y position
sub eax,'A' ; eax - number of letter
cmp eax,4
jg no_up
 
shl eax,6 ;imul eax,80
add eax,16
movzx ebx,[warea.top]
add eax,ebx
jmp y_done
;--------------------------------------
align 4
no_up:
sub eax,9
shl eax,6 ;imul eax,80
889,10 → 887,13
sub eax,16-1
movzx ebx,[warea.bottom]
add eax,ebx
;--------------------------------------
align 4
y_done:
mov [ebp-8],eax
ret
 
;--------------------------------------
align 4
;START2:
load_icon_list2:
call get_bg_info
901,48 → 902,50
mov [warea.by_x],eax
mov [warea.by_y],ebx
 
mov eax,14
mcall
mcall 14
add eax,0x00010001
mov [scrxy],eax
 
;--------------------------------------
align 4
apply_changes2:
 
mov edi,[icons]
mov esi,icon_data
mov ebp,0x5000 ; threads stack starting point
 
;--------------------------------------
align 4
start_new:
mov eax,[esi]
mov [ebp-20],eax
call calc_icon_pos
 
mov eax,51
mov ebx,1
mov ecx,thread
mov edx,ebp
mov dword[ebp-4],esi
mcall
mcall 51,1,thread
add ebp,0x100
 
mov eax,5
mov ebx,1
;--------------------------------------
align 4
wait_thread_start: ;wait until thread draw itself first time
cmp [create_thread_event],bl
jz wait_thread_end
mcall
jmp wait_thread_start
;--------------------------------------
align 4
wait_thread_end:
dec [create_thread_event] ;reset event
 
 
add esi,REC_SIZE
dec edi
jnz start_new
;--------------------------------------
align 4
close:
or eax,-1
mcall
 
;------------------------------------------------------------------------------
align 4
thread:
; pop ebp ;ebp - address of our icon
sub esp,12
950,16 → 953,14
sub esp,16
call draw_window2
mov [create_thread_event],1
mov eax,40
mov ebx,010101b
mcall
 
mcall 40,010101b
;------------------------------------------------------------------------------
align 4
still2:
mov eax,10
mcall
 
mcall 10
cmp eax,1
je red2
 
cmp eax,3
je button2
 
969,7 → 970,8
call draw_icon2
 
jmp still2
 
;------------------------------------------------------------------------------
align 4
red2:
mcall 14
add eax,0x00010001
987,17 → 989,20
mov eax,[I_END+process_information.box.top]
cmp eax,[ebp+4]
je .lp1
@@: call get_bg_info
;--------------------------------------
align 4
@@:
call get_bg_info
mcall 67,[ebp+0],[ebp+4],51,51
 
;--------------------------------------
align 4
.lp1:
call draw_window2
jmp still2
 
;------------------------------------------------------------------------------
align 4
button2:
mov al,17
mcall
 
mcall 17
cmp ah, 2
jnz still2
 
1011,8 → 1016,9
mov ecx,edx
mcall 18,1 ; set to down
call draw_window2
;--------------------------------------
align 4
@@:
mov esi,[ebp+8]
mov ebx,1
mov edi,finfo.path
1024,12 → 1030,14
cmp byte[edi],0
jne .no0
and dword[finfo_start+8],0
;--------------------------------------
align 4
.no0:
mov ebx,finfo_start
mov eax,70
mcall
mcall 70
jmp still2
 
;------------------------------------------------------------------------------
align 4
fill_paths:
push esi edi
; dps '>'
1037,7 → 1045,8
add esi,[positions+ebx*4]
push esi
add esi,ecx
 
;--------------------------------------
align 4
.l1:
dec esi
cmp byte[esi],' '
1045,11 → 1054,15
loop .l1
pop esi
jmp .noms
;--------------------------------------
align 4
.found:
lea ecx,[esi+1]
pop esi
sub ecx,esi
rep movsb
;--------------------------------------
align 4
.noms:
and byte[edi],0
; call debug_outstr
1056,11 → 1069,14
; dps <'<',13,10>
pop edi esi
ret
 
;--------------------------------------
align 4
atoi:
push esi
xor eax,eax
xor ebx,ebx
;--------------------------------------
align 4
.nxt:
lodsb
cmp al,'0'
1068,18 → 1084,25
cmp al,'9'
ja .done
sub eax,'0'
imul ebx,10
; multiply x10
shl ebx,1 ; multiply x2
lea ebx,[ebx+ebx*4] ; multiply x5
add ebx,eax
jmp .nxt
;--------------------------------------
align 4
.done:
pop esi
mov eax,ebx
ret
 
;--------------------------------------
align 4
itoa:
add esi,2
mov ebx,10
mov ecx,3
;--------------------------------------
align 4
.l0:
xor edx,edx
div ebx
1088,7 → 1111,8
dec esi
loop .l0
ret
 
;------------------------------------------------------------------------------
align 4
draw_picture:
mov [image],0x3000
mov edi,[ebp+8]
1096,7 → 1120,10
call atoi
cmp eax,[icon_count]
ja toponly.ex
imul eax,(32*3*32)
; imul eax,(32*3*32)
lea eax,[eax+eax*2] ; multiply x3
shl eax,10 ; multiply x1024
lea edi,[eax+strip_file+8]
xor ebx,ebx
xor ecx,ecx
1103,6 → 1130,9
mov esi,edi;strip_file+8+(32*3*32)*2
 
mov [pixpos],0
;--------------------------------------
; loop start
align 4
newb:
push ebx
push ecx
1117,7 → 1147,8
push esi
mov esi,edi
add esi,[pixpos]
 
;--------------------------------------
align 4
no_correction_pixpos:
add [pixpos],3
mov eax,[esi]
1130,9 → 1161,9
cmp eax,0xfffcff ;f5f5f5
je yesbpix
jmp nobpix
 
;--------------------------------------
align 4
yesbpix:
 
stretch:
cmp [bgrdrawtype],dword 2
jne nostretch
1152,11 → 1183,10
div ebx
add eax,[esp]
add esp,4
 
jmp notiled
 
;--------------------------------------
align 4
nostretch:
 
cmp [bgrdrawtype],dword 1
jne notiled
mov eax,[ebp+4]
1175,16 → 1205,14
mov eax,edx
add eax,[esp]
add esp,4
 
;--------------------------------------
align 4
notiled:
 
lea ecx,[eax+eax*2]
mov eax,39
mov ebx,2
mcall
 
mcall 39,2
;--------------------------------------
align 4
nobpix:
 
pop ecx
pop ebx
 
1208,42 → 1236,46
xor ebx,ebx
 
inc ecx
 
mov eax,[ya]
add [pixpos],eax
 
cmp [top],1
jne notop
 
cmp ecx,38
je toponly
 
;--------------------------------------
align 4
notop:
 
cmp ecx,52
jnz newb
 
;--------------------------------------
align 4
toponly:
 
mov eax,7
mov ebx,0x3000
mov ecx,52 shl 16 + 52
xor edx,edx
mcall
mcall 7,0x3000,<52,52>
;--------------------------------------
align 4
.ex:
mov [load_pic],0
ret
 
;------------------------------------------------------------------------------
align 4
draw_text:
 
mov esi,[ebp+8]
add esi,3
push edi
mov edi,title
mov ecx,8
; mov ecx,8
; cld
; rep movsb
mov ecx,8/4
cld
rep movsb
rep movsd
pop edi
mov eax,title
;--------------------------------------
align 4
news2:
cmp [eax],byte 33
jb founde
1250,6 → 1282,8
inc eax
cmp eax,title+8;11
jb news2
;--------------------------------------
align 4
founde:
sub eax,title
mov [tl],eax
1258,50 → 1292,49
lea eax,[eax+eax*2] ; eax *= char_width/2
shl eax,16
 
mov ebx,27*65536+40
mov ebx,27 shl 16+40
sub ebx,eax
 
mov eax,4
xor ecx,ecx ; black shade of text
mov edx,title
mov esi,[tl]
add ebx,1 shl 16 ;*65536+1
mcall
mcall 4,,,title,[tl]
 
inc ebx
mcall
 
add ebx,1 shl 16
mcall
 
inc ebx
mcall
 
sub ebx,1 shl 16
mcall
 
dec ebx
sub ebx,1 shl 16
mcall
 
sub ebx,1 shl 16
dec ebx
mcall
 
dec ebx
add ebx,1 shl 16
mcall
 
inc ebx
mov ecx,0xffffff
 
mcall
mcall ,,0xffffff
mov [draw_pic],0
ret
 
;------------------------------------------------------------------------------
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
align 4
draw_window2:
mcall 12,1
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mcall
 
; DRAW WINDOW
xor eax,eax ; function 0 : define and draw window
mov ebx,[ebp+0-2]
1311,14 → 1344,12
mov edx,0x41000000 ; color of work area RRGGBB,8->color gl
mcall
 
mov eax,8 ; button
mov ebx,51
mov ecx,50
mov edx,0x40000002
mcall
mcall 8,51,50,0x40000002 ; button
 
mov eax,5
mov ebx,1
;--------------------------------------
align 4
draw_icon2:
xchg [load_pic],bl
test bl,bl
1325,10 → 1356,13
je draw_icon_end
mcall
jmp draw_icon2
;--------------------------------------
align 4
draw_icon_end:
 
mov eax,5
mov ebx,1
;--------------------------------------
align 4
draw_icon_2:
xchg [draw_pic],bl
test bl,bl
1335,22 → 1369,15
je draw_icon_end_2
mcall
jmp draw_icon_2
;--------------------------------------
align 4
draw_icon_end_2:
 
mov eax,9
mov ebx,process_table
mov ecx,-1
mcall
 
mcall 9,process_table,-1
call draw_picture
call draw_text
 
mov eax,12
mov ebx,2
mcall
 
mcall 12,2
ret
 
;------------------------------------------------------------------------------
tl dd 8
yw dd 51
ya dd 0
1360,12 → 1387,12
load_pic db 0
create_thread_event db 0
 
 
image dd 0x3000
 
I_Param:
icon_data = I_END+0x1400
process_table = I_END+0x2400
stack_area = I_END+0x3400-4
process_table = I_END+0x3400
bgrx dd ?
bgry dd ?
1398,3 → 1425,4
IncludeUGlobals
 
I_END:
;------------------------------------------------------------------------------