Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 453 → Rev 454

/kernel/branches/hd_kolibri/apps/DEFAULT.SKN
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/kernel/branches/hd_kolibri/apps/icon/ICONS.DAT
0,0 → 1,24
AA-SYSXTREE-004-/hd0/1/kolibri/bin/sysxtree - *
AB-COPY -008-/hd0/1/kolibri/bin/copy2 - *
BB-CALC -006-/hd0/1/kolibri/bin/calc - *
CA-TINYPAD -011-/hd0/1/kolibri/bin/tinypad - *
CB-TINYPAD2-011-/hd0/1/kolibri/tinypad2 - *
JA-VRR -009-/hd0/1/kolibri/bin/vrr - *
II-C4 -005-/hd0/1/kolibri/bin/c4 - *
JI-MINE -017-/hd0/1/kolibri/bin/mine - *
IH-TETRIS -021-/hd0/1/kolibri/bin/tetris - *
JH-MBLOCKS -013-/hd0/1/kolibri/bin/mblocks - *
HI-PONG -026-/hd0/1/kolibri/bin/pong3 - *
GI-15 -000-/hd0/1/kolibri/bin/15 - *
HH-LIFE2 -015-/hd0/1/kolibri/bin/life2 - *
BA-FASM -012-/hd0/1/kolibri/bin/fasm - *
JB-ANIMAGE -018-/hd0/1/kolibri/bin/animage - *
CC-CMD -023-/hd0/1/kolibri/bin/cmd - *
IA-BOARD -022-/hd0/1/kolibri/bin/board - *
BC-KFAR -027-/hd0/1/kolibri/bin/kfar/kfar - *
HA-MTDBG -029-/hd0/1/kolibri/bin/mtdbg - *
AH-PIPES -030-/hd0/1/kolibri/bin/pipes - *
AI-FARA -031-/hd0/1/kolibri/bin/fara - *
BI-ARC-II -014-/hd0/1/kolibri/bin/arcanii - *
BH-XONIX -024-/hd0/1/kolibri/bin/xonix - *
GH-CHECKERS-002-/hd0/1/kolibri/bin/checkers - *
/kernel/branches/hd_kolibri/apps/icon/build_en.bat
0,0 → 1,5
@erase lang.inc
@echo lang fix en >lang.inc
@fasm icon.asm icon
@erase lang.inc
@pause
/kernel/branches/hd_kolibri/apps/icon/build_ge.bat
0,0 → 1,5
@erase lang.inc
@echo lang fix ge >lang.inc
@fasm icon.asm icon
@erase lang.inc
@pause
/kernel/branches/hd_kolibri/apps/icon/build_ru.bat
0,0 → 1,5
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm icon.asm icon
@erase lang.inc
@pause
/kernel/branches/hd_kolibri/apps/icon/gif_lite.inc
0,0 → 1,328
; GIF LITE v2.0 by Willow
; Written in pure assembler by Ivushkin Andrey aka Willow
;
; This include file will contain functions to handle GIF image format
;
; Created: August 15, 2004
; Last changed: September 9, 2004
 
; Change COLOR_ORDER in your program
; if colors are displayed improperly
 
if ~ (COLOR_ORDER in <MENUETOS,OTHER>)
; This message may not appear under MenuetOS, so watch...
display 'Please define COLOR_ORDER: MENUETOS or OTHER',13,10
end if
 
; virtual structure, used internally
 
struc GIF_list
{
.NextImg rd 1
.Left rw 1
.Top rw 1
.Width rw 1
.Height rw 1
}
 
struc GIF_info
{
.Left rw 1
.Top rw 1
.Width rw 1
.Height rw 1
}
 
_null fix 0x1000
 
; ****************************************
; FUNCTION GetGIFinfo - retrieve Nth image info
; ****************************************
; in:
; esi - pointer to image list header
; ecx - image_index (0...img_count-1)
; edi - pointer to GIF_info structure to be filled
 
; out:
; eax - pointer to RAW data, or 0, if error
 
GetGIFinfo:
push esi ecx edi
xor eax,eax
jecxz .eloop
.lp:
mov esi,[esi]
test esi,esi
jz .error
loop .lp
.eloop:
add esi,4
movsd
movsd
mov eax,esi
.error:
pop edi ecx esi
ret
 
; ****************************************
; FUNCTION ReadGIF - unpacks GIF image
; ****************************************
; in:
; esi - pointer to GIF file in memory
; edi - pointer to output image list
; eax - pointer to work area (MIN 16 KB!)
 
; out:
; eax - 0, all OK;
; eax - 1, invalid signature;
; eax >=8, unsupported image attributes
;
; ecx - number of images
 
ReadGIF:
push esi edi
mov [.table_ptr],eax
mov [.cur_info],edi
xor eax,eax
mov [.globalColor],eax
mov [.img_count],eax
inc eax
cmp dword[esi],'GIF8'
jne .er ; signature
mov ecx,[esi+0xa]
inc eax
add esi,0xd
mov edi,esi
bt ecx,7
jnc .nextblock
mov [.globalColor],esi
call .Gif_skipmap
.nextblock:
cmp byte[edi],0x21
jne .noextblock
inc edi
cmp byte[edi],0xf9 ; Graphic Control Ext
jne .no_gc
add edi,7
jmp .nextblock
.no_gc:
cmp byte[edi],0xfe ; Comment Ext
jne .no_comm
inc edi
.block_skip:
movzx eax,byte[edi]
lea edi,[edi+eax+1]
cmp byte[edi],0
jnz .block_skip
inc edi
jmp .nextblock
.no_comm:
cmp byte[edi],0xff ; Application Ext
jne .nextblock
add edi,13
jmp .block_skip
.noextblock:
cmp byte[edi],0x2c ; image beginning
jne .er
inc [.img_count]
inc edi
mov esi,[.cur_info]
add esi,4
xchg esi,edi
movsd
movsd
push edi
movzx ecx,word[esi]
inc esi
bt ecx,7
jc .uselocal
push [.globalColor]
mov edi,esi
jmp .setPal
.uselocal:
call .Gif_skipmap
push esi
.setPal:
movzx ecx,byte[edi]
inc ecx
mov [.codesize],ecx
dec ecx
pop [.Palette]
lea esi,[edi+1]
mov edi,[.table_ptr]
xor eax,eax
cld
lodsb ; eax - block_count
add eax,esi
mov [.block_ofs],eax
mov [.bit_count],8
mov eax,1
shl eax,cl
mov [.CC],eax
inc eax
mov [.EOI],eax
lea ecx,[eax-1]
mov eax, _null shl 16
.filltable:
stosd
inc eax
loop .filltable
pop edi
mov [.img_start],edi
.reinit:
mov edx,[.EOI]
inc edx
push [.codesize]
pop [.compsize]
call .Gif_get_sym
cmp eax,[.CC]
je .reinit
call .Gif_output
.cycle:
movzx ebx,ax
call .Gif_get_sym
cmp eax,edx
jae .notintable
cmp eax,[.CC]
je .reinit
cmp eax,[.EOI]
je .end
call .Gif_output
.add:
push eax
mov eax,[.table_ptr]
mov [eax+edx*4],ebx
pop eax
cmp edx,0xFFF
jae .cycle
inc edx
bsr ebx,edx
cmp ebx,[.compsize]
jne .noinc
inc [.compsize]
.noinc:
jmp .cycle
.notintable:
push eax
mov eax,ebx
call .Gif_output
push ebx
movzx eax,bx
call .Gif_output
pop ebx eax
jmp .add
.er:
pop edi
jmp .ex
.end:
mov eax,[.cur_info]
mov [eax],edi
mov [.cur_info],edi
add esi,2
xchg esi,edi
.nxt:
cmp byte[edi],0
jnz .continue
inc edi
jmp .nxt
.continue:
cmp byte[edi],0x3b
jne .nextblock
xor eax,eax
stosd
mov ecx,[.img_count]
.ex:
pop edi esi
ret
 
.Gif_skipmap:
; in: ecx - image descriptor, esi - pointer to colormap
; out: edi - pointer to area after colormap
 
and ecx,111b
inc ecx ; color map size
mov ebx,1
shl ebx,cl
lea ebx,[ebx*2+ebx]
lea edi,[esi+ebx]
ret
 
.Gif_get_sym:
mov ecx,[.compsize]
push ecx
xor eax,eax
.shift:
ror byte[esi],1
rcr eax,1
dec [.bit_count]
jnz .loop1
inc esi
cmp esi,[.block_ofs]
jb .noblock
push eax
xor eax,eax
lodsb
test eax,eax
jnz .nextbl
mov eax,[.EOI]
sub esi,2
add esp,8
jmp .exx
.nextbl:
add eax,esi
mov [.block_ofs],eax
pop eax
.noblock:
mov [.bit_count],8
.loop1:
loop .shift
pop ecx
rol eax,cl
.exx:
xor ecx,ecx
ret
 
.Gif_output:
push esi eax edx
mov edx,[.table_ptr]
.next:
push word[edx+eax*4]
mov ax,word[edx+eax*4+2]
inc ecx
cmp ax,_null
jnz .next
shl ebx,16
mov bx,[esp]
.loop2:
pop ax
 
lea esi,[eax+eax*2]
add esi,[.Palette]
 
if COLOR_ORDER eq MENUETOS
mov esi,[esi]
bswap esi
shr esi,8
mov [edi],esi
add edi,3
else
movsw
movsb
end if
 
loop .loop2
pop edx eax esi
ret
 
.globalColor rd 1
.img_count rd 1
.cur_info rd 1 ; image table pointer
.img_start rd 1
.codesize rd 1
.compsize rd 1
.bit_count rd 1
.CC rd 1
.EOI rd 1
.Palette rd 1
.block_ofs rd 1
.table_ptr rd 1
/kernel/branches/hd_kolibri/apps/icon/icon
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/kernel/branches/hd_kolibri/apps/icon/icon.asm
0,0 → 1,1418
;********************************
;* *
;* DESKTOP ICON MANAGER *
;* *
;* Compile with flat assembler *
;* *
;********************************
; 22.02.05 was modified for work with new multi-thread ICON.
; 8.03.07 ïåðåõîä íà 70 ôóíêöèþ by SPraid
;******************************************************************************
RAW_SIZE equ 350000
ICON_SIZE equ 32*32*3
GIF_SIZE equ 45000
REC_SIZE equ 80
ICONS_DAT equ '/HD0/1/KOLIBRI/ETC/ICONS.DAT'
ICON_APP equ '/HD0/1/KOLIBRI/Bin/ICON'
ICON_STRIP equ '/HD0/1/KOLIBRI/ETC/ICONSTRP.GIF'
 
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd icon_data+0x30000 ; memory for app
dd icon_data+0x30000 ; esp
dd I_Param , 0x0 ; I_Param , I_Icon
include 'macros.inc'
include 'lang.inc'
COLOR_ORDER equ MENUETOS
include 'gif_lite.inc'
;include 'debug.inc'
purge newline
;******************************************************************************
START: ; start of execution
mcall 70,finfo
cmp ebx,GIF_SIZE
ja close
mov esi,gif_file
mov edi,strip_file
mov eax,icon_data
call ReadGIF
movzx eax,word[strip_file+10]
shr eax,5
mov [icon_count],eax
call load_ic
boot_str:
cmp [I_Param],dword 'BOOT'
je load_icon_list2
call load_icon_list
red:
call draw_window ; at first, draw the window
mov esi,[current_icon]
jmp band
still:
 
mov eax,10 ; wait here for event
int 0x40
 
dec eax ; redraw request ?
jz red
dec eax ; key in buffer ?
jz key
 
button: ; button
mov al,17 ; get id
int 0x40
 
shr eax,8
 
cmp eax,1 ; button id=1 ?
je close
noclose:
mov esi,[current_icon]
add esi,12
mov ebx,[cur_band];eax
cmp eax,31
jne .no_back
add ebx,8
mov eax,[icon_count]
cmp eax,ebx
jae .drwic2
xor ebx,ebx
jmp .drwic2
.no_back:
cmp eax,30
jne .no_side
test ebx,ebx
jnz .dec
mov ebx,[icon_count]
and ebx,0xfffffff8
add ebx,8
.dec:
sub ebx,8
.drwic2:
mov [cur_band],ebx
.drwic1:
call draw_icon
jmp still
.no_side:
cmp eax,32
jne .no_ico
push ebx
mcall 37,1
pop ebx
shr eax,16
sub eax,33-19
mov edi,34
xor edx,edx
div edi
lea ecx,[ebx+eax]
cmp ecx,[icon_count]
jae still
mov [sel_icon1],eax
mov ecx,eax
add eax,ebx
call itoa
jmp .drwic1
.no_ico:
cmp eax,11
jb no_str
cmp eax,13
jg no_str
call read_string
jmp still
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
imul edx,dword [icons]
mov [ebx+12],edx
mov esi,iconlst
call lst_path
mov eax,70
int 0x40
 
; (2) terminate all icons
mov eax,9
mov ebx,I_END
or ecx,-1
int 0x40
mov edi,[ebx+30]
newread2:
mov esi,1
newread:
inc esi
mov eax,9
mov ebx,I_END
mov ecx,esi
int 0x40
cmp edi,[ebx+30]
je newread
cmp esi,eax
jg all_terminated
 
cmp [I_END+10],dword '@ICO'
jne newread
mov eax,51
cmp eax,[I_END+42]
jne newread
cmp eax,[I_END+46]
jne newread
 
mov eax,18
mov ebx,2
mov ecx,esi
int 0x40
 
jmp newread2
 
finfo_start:
dd 7
dd 0
.params dd 0
dd 0
dd 0
db 0
dd finfo.path
 
 
 
finfo:
dd 0
dd 0
dd 0
dd GIF_SIZE
dd gif_file
.path:
db ICON_STRIP,0
rb 60-($-.path)
 
 
all_terminated:
 
apply_changes:
 
mov ebx, finfo_start
mov dword [ebx+8], boot_str+6
mov esi, iconname
call lst_path
mov eax, 70
int 0x40
jmp still
 
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
int 0x40
 
mov eax,10
int 0x40
cmp eax,3
jne still
mov eax,17
int 0x40
shr eax,8
cmp eax,40
jb no_f
mov edi,eax
sub eax,40
 
xor edx,edx ; bcd -> 10
mov ebx,16
div ebx
imul eax,10
add eax,edx
 
mov ebx,eax
add ebx,icons_reserved
cmp [ebx],byte 'x'
je no_f
mov [ebx],byte 'x'
 
mov [cur_btn],edi
xor edx,edx
mov ebx,10
div ebx
add eax,65
add edx,65
mov [icon_default+0],dl
mov [icon_default+1],al
 
inc dword [icons]
mov edi,[icons]
dec edi
imul edi,REC_SIZE
add edi,icon_data
 
mov [current_icon],edi
 
mov esi,icon_default
mov ecx,REC_SIZE
cld
rep movsb
mov esi,[current_icon]
jmp band
no_f:
 
call draw_btns;draw_window
 
jmp still
 
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
int 0x40
 
mov eax,10
int 0x40
cmp eax,3
jne no_f;ound
mov eax,17
int 0x40
shr eax,8
cmp eax,40
jb red;no_f;ound
sub eax,40
 
xor edx,edx
mov ebx,16
div ebx
imul eax,10
add eax,edx
 
mov ebx,eax
add ebx,icons_reserved
cmp [ebx],byte 'x'
jne red
mov [ebx],byte ' '
 
xor edx,edx
mov ebx,10
div ebx
shl eax,8
mov al,dl
 
add eax,65*256+65
 
mov esi,icon_data
mov edi,REC_SIZE
imul edi,[icons]
add edi,icon_data
news:
cmp word [esi],ax
je foundi
add esi,REC_SIZE
cmp esi,edi
jb news
jmp red
 
foundi:
 
mov ecx,edi
sub ecx,esi
 
mov edi,esi
add esi,REC_SIZE
 
cld
rep movsb
 
dec [icons]
 
mov eax,icon_data
mov [current_icon],eax
movzx ebx,word[eax]
sub bx,'AA'
shl bl,4
shr ebx,4
add ebx,40
mov [cur_btn],ebx
 
jmp red
 
no_remove_icon:
 
cmp eax,40 ; user pressed button for icon position
jb no_on_screen_button
mov edi,eax
sub eax,40
mov edx,eax
shl eax,4
and edx,0xf
mov dh,ah
add edx,65*256+65
 
mov esi,icon_data
mov ecx,[icons]
cld
findl1:
cmp dx,[esi]
je foundl1
add esi,REC_SIZE
loop findl1
jmp still
 
foundl1:
 
mov [current_icon],esi
mov [cur_btn],edi
band:
add esi,12
call atoi
and eax,0xfffff8
mov [cur_band],eax
call draw_btns
 
jmp still
 
no_on_screen_button:
 
 
jmp still
 
current_icon dd icon_data
 
 
print_strings:
 
pusha
 
mov eax,13 ; clear text area
mov ebx,100*65536+180
mov ecx,(278+12)*65536+40
mov edx,0xffffff
int 0x40
 
xor edi,edi
mov eax,4 ; icon text
mov ebx,100*65536+278+14
mov ecx,3
.ll:
push ecx
mov ecx,0x000000
mov edx,[current_icon]
add edx,[positions+edi*4]
movzx esi,byte[str_lens+edi]
inc edi
int 0x40
add ebx,14
pop ecx
loop .ll
 
popa
ret
 
iconlst db ICONS_DAT,0
 
load_icon_list:
 
mov edi,icons_reserved ; clear reserved area
mov eax,32
mov ecx,10*9
cld
rep stosb
 
mov ecx,[icons] ; set used icons to reserved area
mov esi,icon_data
ldl1:
movzx ebx,byte [esi+1]
sub ebx,65
imul ebx,10
movzx eax,byte [esi]
add ebx,eax
sub ebx,65
add ebx,icons_reserved
mov [ebx],byte 'x'
add esi,REC_SIZE
loop ldl1
ret
 
lst_path:
mov ecx,30
mov edi,finfo.path
rep movsb
ret
 
load_ic:
mov ebx,finfo
mov dword[ebx+12],48*REC_SIZE
mov dword[ebx+16],icon_data
mov esi,iconlst
call lst_path
mcall 70
lea eax,[ebx+10]
xor edx,edx
mov ebx,REC_SIZE
div ebx
mov [icons],eax
ret
 
 
positions dd 3,16,47
str_lens db 8,30,30
 
read_string:
pusha
sub eax,11
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
 
.l1:
dec edi
cmp byte[edi],' '
jne .found
mov byte[edi],'_'
loop .l1
dec edi
.found:
inc edi
push edi
call print_strings
 
pop edi
f11:
mov eax,10
int 0x40
cmp eax,2
jz fbu
jmp rs_done
fbu:
mov eax,2
int 0x40
shr eax,8
cmp eax,13
je rs_done
cmp eax,8
jnz nobsl
cmp edi,[addr]
jz f11
dec edi
mov [edi],byte '_'
call print_strings
jmp f11
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
 
rs_done:
 
mov ecx,[addr]
add ecx,[cur_str]
sub ecx,edi
mov eax,32
cld
rep stosb
call print_strings
popa
ret
 
key: ; key
mov al,2 ; just read it and ignore
int 0x40
jmp still
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
 
; DRAW WINDOW
xor eax,eax
mov ebx,210*65536+300
mov ecx,30*65536+390-14
mov edx,0x13ffffff
mov edi,header ; WINDOW LABEL
int 0x40
 
mov eax,13 ; WINDOW AREA
mov ebx,20*65536+260
mov ecx,35*65536+200
mov edx,0x3366cc
int 0x40
 
mov eax,38 ; VERTICAL LINE ON WINDOW AREA
mov ebx,150*65536+150
mov ecx,35*65536+235
mov edx,0xffffff
int 0x40
 
mov eax,38 ; HOROZONTAL LINE ON WINDOW AREA
mov ebx,20*65536+280
mov ecx,135*65536+135
mov edx,0xffffff
int 0x40
 
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]
int 0x40
inc edx
add ecx,14*65536
int 0x40
inc edx
add ecx,14*65536
int 0x40
 
; 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]
int 0x40
 
; mov eax,8 ; ADD ICON BUTTON
mov ebx,20*65536+129-2
add ecx,14*65536
inc edx
int 0x40
 
; mov eax,8 ; REMOVE ICON BUTTON
add ebx,(130+2)*65536
inc edx
int 0x40
 
mcall ,<20-14,8>,<260-23,32>,30+1 shl 30 ; IMAGE BUTTON
inc edx
add ebx,(36*7+26) shl 16
mcall
add edx,1+1 shl 29
mov ebx,(33-19) shl 16+(34*8)
mcall
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
 
;;
mov eax,4
mov ebx,24*65536+250+14+14+14
mov ecx,0xffffff
mov edx,text
mov esi,47
newline:
mov ecx,[edx]
add edx,4
int 0x40
add ebx,14
add edx,47
cmp [edx],byte 'x'
jne newline
draw_btns:
;;
mov eax,0 ; DRAW BUTTONS ON WINDOW AREA
mov ebx,20*65536+25
mov ecx,35*65536+19
mov edi,icon_table
mov edx,40
newbline:
 
cmp [edi],byte 'x'
jne no_button
 
mov esi,0x5577cc
cmp [edi+90],byte 'x'
jne nores
mov esi,0xcc5555
cmp edx,[cur_btn]
jne nores
mov esi,0xe7e05a
nores:
 
push eax
mov eax,8
int 0x40
pop eax
 
no_button:
 
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
 
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
int 0x40
 
ret
 
draw_icon:
mcall 13,<33-20,34*8+2>,<260-24,37+15-2>,0xffffff
mov esi,[current_icon]
add esi,12
call atoi
push eax
cmp eax,[cur_band]
jb .nou
sub eax,[cur_band]
cmp eax,7
ja .nou
imul eax,34 shl 16
lea ebx,[eax+(33-19) shl 16]
mov bx,34
mcall 13,,<236+35,3>,0xff0000
mov eax,[esp]
.nou:
mov eax,[cur_band]
and eax,0xfffffff8
push eax
imul eax,ICON_SIZE
lea ebx,[strip_file+12+eax]
mov ecx,8
mov edx,(33-18) shl 16+238
.nxt:
push ecx
mcall 7,,<32,32>
pop ecx
add ebx,ICON_SIZE
add edx,34 shl 16
loop .nxt
 
mcall 4,<45,280-2>,0,rep_text,rep_text_len-rep_text
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
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, ' ’…Š‘’ '
db 255,255,255,0, ' Žƒ€ŒŒ€ '
db 255,255,255,0, ' €€Œ…’› '
db 255,255,255,0, ' ˆŒ…ˆ’œ '
db 255,255,255,0, ' „Ž€‚ˆ’œ “„€‹ˆ’œ '
db 0,0,0,0, '€†Œˆ’… € Ž‡ˆ–ˆž ˆŠŽŠˆ „‹Ÿ …„€Š’ˆŽ‚€ˆŸ '
db 'x' ; <- END MARKER, DONT DELETE
add_text db '€†Œˆ’… € Ž‡ˆ–ˆž …ˆ‘Ž‹œ‡“…ŒŽ‰ ˆŠŽŠˆ ',0
 
rem_text db '€†Œˆ’… € Ž‡ˆ–ˆž ˆ‘Ž‹œ‡“…ŒŽ‰ ˆŠŽŠˆ ',0
header db 'Œ¥­¥¤¦¥à ¨ª®­®ª',0
 
else if lang eq ge
text:
db 255,255,255,0, ' TITLE '
db 255,255,255,0, ' APP NAME '
db 255,255,255,0, ' PARAMETER '
db 255,255,255,0, ' ANWENDEN '
db 255,255,255,0, ' HINZUFUEGEN ENTFERNEN '
db 0,0,0,0, 'AUF BUTTON KLICKEN, UM ICON ZU EDITIEREN '
db 'x' ; <- END MARKER, DONT DELETE
add_text db 'AUF UNBENUTZTE ICONPOSITION KLICKEN ',0
 
rem_text db 'ICON ANKLICKEN; DAS GELOESCHT WERDEN SOLL',0
header db 'Icon Manager',0
 
else
text:
db 255,255,255,0, ' TITLE '
db 255,255,255,0, ' APP NAME '
db 255,255,255,0, ' PARAMETERS '
db 255,255,255,0, ' APPLY CHANGES '
db 255,255,255,0, ' ADD ICON REMOVE ICON '
db 0,0,0,0, 'CLICK BUTTON ON ICON POSITION FOR EDIT '
db 'x' ; <- END MARKER, DONT DELETE
add_text db 'CLICK ON A NOT USED POSITION ',0
 
rem_text db 'CLICK ICON POSITION; YOU WANT TO DELETE',0
header 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 '‡€—Šˆ - ˆ‡ , ‚›€ #'
else
db 'ICONS - OF , SELECTED'
end if
 
rep_text_len:
 
;//////////////////////////
get_bg_info:
mov eax,39
mov ebx,4
int 0x40
mov [bgrdrawtype],eax
 
mov eax,39 ; get background size
mov ebx,1
int 0x40
mov [bgrxy],eax
 
mov ebx,eax
shr eax,16
and ebx,0xffff
mov [bgrx],eax
mov [bgry],ebx
ret
 
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
no_left:
sub eax,9
sal eax,6 ;imul eax,64
sub eax,16+52-1
movzx ebx,[warea.right]
add eax,ebx
x_done:
; mov [xpos],eax
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
no_up:
sub eax,9
shl eax,6 ;imul eax,80
sub eax,16-1
movzx ebx,[warea.bottom]
add eax,ebx
y_done:
; mov [ypos],eax
mov [ebp-8],eax
ret
 
;START2:
load_icon_list2:
call get_bg_info
 
mcall 48,5
mov [warea.by_x],eax
mov [warea.by_y],ebx
 
mov eax,14
int 0x40
add eax,0x00010001
mov [scrxy],eax
 
apply_changes2:
 
mov edi,[icons]
mov esi,icon_data
mov ebp,0x5000 ; threads stack starting point
 
start_new:
mov eax,[esi]
mov [ebp-20],eax
call calc_icon_pos
 
mov eax,51
mov ebx,1
mov ecx,thread
; mov edx,[thread_stack]
mov edx,ebp
; sub edx,4
; mov [edx],esi
mov dword[ebp-4],esi
int 0x40
; add [thread_stack],0x100
add ebp,0x100
 
mov eax,5
mov ebx,1
wait_thread_start: ;wait until thread draw itself first time
cmp [create_thread_event],bl
jz wait_thread_end
int 0x40
jmp wait_thread_start
wait_thread_end:
dec [create_thread_event] ;reset event
 
 
add esi,REC_SIZE
dec edi
jnz start_new
close:
or eax,-1
int 0x40
 
thread:
; pop ebp ;ebp - address of our icon
sub esp,12
mov ebp,esp
sub esp,16
call draw_window2
mov [create_thread_event],1
mov eax,40
mov ebx,010101b
int 0x40
 
still2:
 
mov eax,10
int 0x40
 
cmp eax,1
je red2
cmp eax,3
je button2
cmp eax,5
jne still2
 
call get_bg_info
mov eax,5
mov ebx,1
call draw_icon2
 
jmp still2
 
red2:
mcall 14
add eax,0x00010001
mov [scrxy],eax
mcall 48,5
mov [warea.by_x],eax
mov [warea.by_y],ebx
add ebp,+12
call calc_icon_pos
add ebp,-12
mcall 9,I_END,-1
mov eax,[I_END+process_information.x_start]
cmp eax,[ebp+0]
jne @f
mov eax,[I_END+process_information.y_start]
cmp eax,[ebp+4]
je .lp1
@@: call get_bg_info
mcall 67,[ebp+0],[ebp+4],51,51
 
.lp1: call draw_window2
jmp still2
 
key2:
mov al,2
int 0x40
 
jmp still2
 
button2:
mov al,17
int 0x40
 
 
mov esi,[ebp+8]
mov ebx,1
mov edi,finfo.path
call fill_paths
inc ebx
mov edi,param_str
mov dword[finfo_start+8],edi
call fill_paths
cmp byte[edi],0
jne .no0
and dword[finfo_start+8],0
.no0:
; lea ebx,[ebp+19]
mov ebx,finfo_start
mov eax,70
int 0x40
; dph eax
; cmp eax,1024
; jae still2
jmp still2
 
fill_paths:
push esi edi
; dps '>'
movzx ecx,byte[str_lens+ebx]
add esi,[positions+ebx*4]
push esi
; mov edx,esi
add esi,ecx
 
.l1:
dec esi
cmp byte[esi],' '
jnz .found
loop .l1
pop esi
jmp .noms
.found:
lea ecx,[esi+1]
pop esi
sub ecx,esi
rep movsb
.noms:
and byte[edi],0
; call debug_outstr
; dps <'<',13,10>
pop edi esi
ret
 
atoi:
push esi
xor eax,eax
xor ebx,ebx
.nxt:
lodsb
cmp al,'0'
jb .done
cmp al,'9'
ja .done
sub eax,'0'
imul ebx,10
add ebx,eax
jmp .nxt
.done:
pop esi
mov eax,ebx
ret
 
itoa:
; mov esi,[current_icon]
add esi,2
mov ebx,10
mov ecx,3
.l0:
xor edx,edx
div ebx
add dl,'0'
mov [esi],dl
dec esi
loop .l0
; and byte[esi],0
ret
 
draw_picture:
mov [image],0x3000
mov edi,[ebp+8]
lea esi,[edi+12]
call atoi
cmp eax,[icon_count]
ja toponly.ex
imul eax,(32*3*32)
lea edi,[eax+strip_file+12]
xor ebx,ebx
xor ecx,ecx
mov esi,edi;strip_file+12+(32*3*32)*2
 
mov [pixpos],0
newb:
push ebx
push ecx
 
cmp ebx,10
jb yesbpix
cmp ebx,42
jge yesbpix
cmp ecx,31;2
jg yesbpix
 
push esi
mov esi,edi
add esi,[pixpos]
 
no_correction_pixpos:
add [pixpos],3
mov eax,[esi]
and eax,0xffffff
 
pop esi
 
cmp eax,0
je yesbpix
cmp eax,0xfffcff ;f5f5f5
je yesbpix
jmp nobpix
 
yesbpix:
 
stretch:
cmp [bgrdrawtype],dword 2
jne nostretch
; mov eax,[ypos]
mov eax,[ebp+4]
add eax,ecx
imul eax,[bgry]
cdq
movzx ebx,word [scrxy]
div ebx
imul eax,[bgrx]
push eax
; mov eax,[xpos]
mov eax,[ebp+0]
add eax,[esp+8]
imul eax,[bgrx]
cdq
movzx ebx,word [scrxy+2]
div ebx
add eax,[esp]
add esp,4
 
jmp notiled
 
nostretch:
 
cmp [bgrdrawtype],dword 1
jne notiled
; mov eax,[ypos]
mov eax,[ebp+4]
add eax,ecx
cdq
movzx ebx,word [bgrxy]
div ebx
mov eax,edx
imul eax,[bgrx]
push eax
; mov eax,[xpos]
mov eax,[ebp+0]
add eax,[esp+8]
movzx ebx,word [bgrxy+2]
cdq
div ebx
mov eax,edx
add eax,[esp]
add esp,4
 
notiled:
 
lea ecx,[eax+eax*2]
mov eax,39
mov ebx,2
int 0x40
 
nobpix:
 
pop ecx
pop ebx
 
mov edx,eax
mov eax,[image]
mov [eax],edx
mov [eax],dl
inc eax
ror edx,8
mov [eax],dl
inc eax
ror edx,8
mov [eax],dl
inc eax
mov [image],eax
inc ebx
mov eax,[yw]
inc eax
cmp ebx,eax
jnz newb
xor ebx,ebx
 
inc ecx
 
mov eax,[ya]
add [pixpos],eax
 
cmp [top],1
jne notop
cmp ecx,38
je toponly
 
notop:
 
cmp ecx,52
jnz newb
 
toponly:
 
mov eax,7
mov ebx,0x3000
mov ecx,52 shl 16 + 52
xor edx,edx
int 0x40
.ex:
mov [load_pic],0
ret
 
draw_text:
 
mov esi,[ebp+8]
add esi,3
push edi
mov edi,header
mov ecx,8
cld
rep movsb
pop edi
mov eax,header
news2:
cmp [eax],byte 33
jb founde
inc eax
cmp eax,header+8;11
jb news2
founde:
sub eax,header
mov [tl],eax
 
mov eax,[tl]
lea eax,[eax+eax*2] ; eax *= char_width/2
shl eax,16
 
mov ebx,27*65536+40
sub ebx,eax
 
mov eax,4
xor ecx,ecx ; black shade of text
mov edx,header
mov esi,[tl]
add ebx,1 shl 16 ;*65536+1
int 0x40
inc ebx
int 0x40
add ebx,1 shl 16
int 0x40
inc ebx
int 0x40
sub ebx,1 shl 16
int 0x40
dec ebx
sub ebx,1 shl 16
int 0x40
sub ebx,1 shl 16
dec ebx
int 0x40
dec ebx
add ebx,1 shl 16
int 0x40
inc ebx
mov ecx,0xffffff
 
int 0x40
mov [draw_pic],0
ret
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window2:
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
 
; DRAW WINDOW
xor eax,eax ; function 0 : define and draw window
; mov ebx,[xpos-2]
mov ebx,[ebp+0-2]
; mov ecx,[ypos-2]
mov ecx,[ebp+4-2]
add ebx,[yw] ; [x start] *65536 + [x size]
add ecx,51 ; [y start] *65536 + [y size]
mov edx,0x01000000 ; color of work area RRGGBB,8->color gl
int 0x40
 
mov eax,8 ; button
mov ebx,51
mov ecx,50
mov edx,0x40000001
int 0x40
 
mov eax,5
mov ebx,1
draw_icon2:
xchg [load_pic],bl
test bl,bl
je draw_icon_end
int 0x40
jmp draw_icon2
draw_icon_end:
 
mov eax,5
mov ebx,1
draw_icon_2:
xchg [draw_pic],bl
test bl,bl
je draw_icon_end_2
int 0x40
jmp draw_icon_2
draw_icon_end_2:
 
mov eax,9
mov ebx,process_table
mov ecx,-1
int 0x40
 
call draw_picture
call draw_text
 
mov eax,12
mov ebx,2
int 0x40
 
ret
 
tl dd 8
yw dd 51
ya dd 0
cur_btn dd 40
 
;xpos dd 15
;ypos dd 185
draw_pic db 0
load_pic db 0
create_thread_event db 0
 
 
image dd 0x3000
;thread_stack dd 0x5000
 
;icons dd 0
 
 
I_Param:
 
icon_data = I_END+0x1400
process_table = I_END+0x2400
 
;I_END:
 
bgrx dd ?
bgry dd ?
param_str rb 31
 
;//////////////////////////
 
bgrxy dd ?
warea:
.by_x:
.right dw ?
.left dw ?
.by_y:
.bottom dw ?
.top dw ?
scrxy dd ?
bgrdrawtype dd ?
 
pixpos dd ?
top dd ?
icons dd ?
addr dd ?
cur_str dd ?
cur_band dd ?
sel_icon1 rd 1
icon_count rd 1
gif_file rb GIF_SIZE
strip_file rb RAW_SIZE
;I_Param:
 
; icon_data = I_END+256
 
I_END:
/kernel/branches/hd_kolibri/apps/icon/iconstrp.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/kernel/branches/hd_kolibri/apps/icon/lang.inc
0,0 → 1,0
lang fix en
/kernel/branches/hd_kolibri/apps/icon/macros.inc
0,0 → 1,269
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
dw ? ; +52 - reserved
.client_left dd ? ; +54
.client_top dd ? ; +58
.client_width dd ? ; +62
.client_height dd ? ; +66
.wnd_state db ? ; +70
rb (1024-71)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
/kernel/branches/hd_kolibri/apps/jpegview/build.bat
0,0 → 1,3
echo lang fix en >lang.inc
fasm jpegview.asm jpegview
 
/kernel/branches/hd_kolibri/apps/jpegview/filelib.asm
0,0 → 1,77
file_handler:
.operation=0
.position=4
.reserved=8
.n_bytes=12
.bufer=16
.name=20
.st_size=20+1024
 
open: ;esi=name_string
;retorna eax
pushad
mov ecx,file_handler.st_size
call mallocz
mov [esp+28],edi
push edi
mov ecx,1024
add edi,file_handler.name
call movedata
pop edi
; test if file exists
lea ebx,[edi+file_handler.operation]
mov byte[ebx],5
mov dword[ebx+16],fileattr
mov eax,70
int 0x40
cmp eax,2
jz .virtual
test eax,eax
jnz close.b
@@:
clc
popad
ret
.virtual:
mov byte [fileattr], 0x10
jmp @b
 
close:
pushad
.b:
mov edi,[esp+28]
call free
popad
xor eax,eax
ret
 
 
read: ;(f,bufer,nbytes) eax,edi,ecx ncr
;retorna bytes leidos en ecx
pushad
lea ebx, [eax+file_handler.operation]
mov byte [ebx], 0
mov [ebx+12], ecx
mov [ebx+16], edi
mov eax, 70
int 0x40
cmp ebx, -1
sbb ebx, -1
mov eax, [esp+28]
add [eax+file_handler.position], ebx
mov [esp+24], ebx
popad
ret
 
ftell: mov edx,[eax+file_handler.position]
ret
lseek: ;eax=file edx=pos
mov [eax+file_handler.position],edx
ret
skip: ;eax=file edx=bytes to skip
add [eax+file_handler.position],edx
ret
 
 
 
 
/kernel/branches/hd_kolibri/apps/jpegview/jpegdat.asm
0,0 → 1,22
modes:
dd mcu100,color100,8,8 ;monocromo
dd mcu111,color111,8,8
dd mcu211,color211,16,8
dd mcu411,color411,16,16
 
zigzag:
db 0,0, 4+1,0, 32,1, 64,1, 36,2, 8+1,0, 12+1,0, 40,4
db 68,2, 96,1, 128,1, 100,2, 72,4, 44,8, 16+1,0, 20+1,0
db 48,16, 76,8, 104,4, 132,2, 160,1, 192,1, 164,2, 136,4
db 108,8, 80,16, 52,32, 24+1,0, 28+1,0, 56,64, 84,32, 112,16
db 140,8, 168,4, 196,2, 224,1, 228,2, 200,4, 172,8, 144,16
db 116,32, 88,64, 60,128, 92,128, 120,64, 148,32, 176,16, 204,8
db 232,4, 236,8, 208,16, 180,32, 152,64, 124,128, 156,128, 184,64
db 212,32, 240,16, 244,32, 216,64, 188,128, 220,128, 248,64, 252,128
 
k:
dd 1.41421,1.84776,1.08239,-2.6131
k2:
dd 0.3535534,0.49039264,0.46193953,0.415734806
dd 0.3535534,0.277785116,0.191341716,0.0975451609
 
/kernel/branches/hd_kolibri/apps/jpegview/jpeglib.asm
0,0 → 1,1181
;405 412 586
;
;
bufer_size=1024*16+2
fichero=4
mcu_ptr=8
color_ptr=12
estado=16
color_c=17
nbits=color_c
idct=20
tmp_bits=24
actable=28
matriz_limit=32
sourcebits=36
sourcebits_index=40
sourcebits_limit=44
qt_ptrs=48
ht_dc_ptrs=64
ht_ac_ptrs=80
matrices=96
tmp_bufer=100
x_org=104
y_org=108
x_mcu=112
y_mcu=116
x_size=120
y_size=124
x_org2=128
y_org2=132
x_mcu2=136
y_mcu2=140
x_size2=144
y_size2=148
q_ptr=152
dc=164
position=204
draw_ptr=208
struct_size=212
 
jpeg_info: ;fichero en eax
;retorna ebp
xor ebp,ebp
pushad
mov ebp,esp
mov ecx,6
sub esp,ecx
mov edi,esp
call read
pop dx
cmp dx,0d8ffh
je .l1
mov esp,ebp
popad
ret
.l1: push eax
mov ecx,struct_size
call mallocz
mov [edi],ebp
mov ebp,edi
pop dword [ebp+fichero]
pop ax
pop cx
jmp .l3
.l2: mov ebx,[ebp+tmp_bufer]
add ebx,[ebx-4]
mov cx,[ebx-2]
mov ax,[ebx-4]
.l3: push .l2
xchg cl,ch
add cx,2
cmp ch,3
jnc .l4
cmp al,0ffh
jne eoi
cmp ah,0dbh
je dqt
cmp ah,0c4h
je dht
cmp ah,0c0h
je sof0
cmp ah,0dah
je sos
cmp ah,0c2h
je eoi
cmp ah,0c9h
je eoi
cmp ah,0d9h
je eoi
.l4: lea edx,[ecx-4]
xor ecx,ecx
mov eax,[ebp+fichero]
call skip
mov ecx,4
call READ
cmp ecx,[edi-4]
jne eoi
ret
 
eoi:
mov esp,[ebp]
; do not close file - this will be done by caller
and dword [ebp+fichero], 0
call jpeg_close
popad
xor ebp,ebp
ret
 
jpeg_close:
test ebp,ebp
jz .l2
pushad
mov eax,[ebp+fichero]
call close
mov edi,[ebp+sourcebits]
call free
lea esi,[ebp+qt_ptrs]
mov ecx,14
.l1: mov edi,[esi]
add esi,4
call free
loop .l1
mov edi,ebp
call free
popad
.l2: ret
 
dqt: call READ
mov esi,edi
lea eax,[edi+ecx]
push eax
.l1: xor eax,eax
lodsb
cmp al,4
jnc eoi
lea ebx,[ebp+qt_ptrs+eax*4]
test dword [ebx],-1
jnz eoi
mov ecx,64
xor eax,eax
sub esp,128
mov edi,esp
.l2: lodsb
stosw
loop .l2
mov ecx,256
call malloc
mov [ebx],edi
mov eax,esi
mov esi,esp
pushad
mov ebp,zigzag
fninit
mov cl,64
xor eax,eax
.l3: fild word[esi]
mov al,[ebp]
and al,-2
add ebp,2
add esi,2
mov ebx,eax
and ebx,28
fmul dword [ebx+k2]
mov ebx,eax
shr ebx,3
and ebx,4+8+16
fmul dword [ebx+k2]
fstp dword [edi+eax]
dec cl
jnz .l3
popad
mov esi,eax
add esp,128
mov eax,[esp]
sub eax,esi
jc eoi
cmp eax,4
ja .l1
jne eoi
pop eax
ret
 
sof0: call READ
cmp byte [edi],8
jne eoi ;precision
mov ax,[edi+1]
xchg al,ah
mov [ebp+y_size],ax
mov ax,[edi+3]
xchg al,ah
mov [ebp+x_size],ax
mov al,[edi+5] ;ncomponentes
mov cl,al
mov [ebp+color_c],al
mov edx,modes
dec al
jz .l1
dec al
dec al
jnz eoi
mov al,[edi+10]
mov ah,[edi+13]
cmp ax,1111h
jne eoi
mov al,[edi+7]
add edx,16
cmp al,11h
je .l1
add edx,16
cmp al,21h
je .l1
add edx,16
cmp al,22h
jne eoi
.l1: lea ebx,[ebp+q_ptr]
lea esi,[ebp+qt_ptrs]
mov [ebp+mcu_ptr],edx
.l2: movzx eax,byte [edi+8]
add edi,3
cmp al,4
jnc eoi
lea eax,[eax*4+esi]
mov [ebx],eax
add ebx,16
dec cl
jnz .l2
ret
 
READ: mov eax,[ebp+fichero]
mov edi,[ebp+tmp_bufer]
movzx ecx,cx
call mresize
mov [ebp+tmp_bufer],edi
jmp read
 
dht: call READ
mov esi,edi
lea eax,[edi+ecx]
push eax
.l1: lodsb
mov edi,esi
mov ebx,3+16
and bl,al
cmp bl,al
jne eoi
shr bl,2
and al,3
or bl,al
lea ebx,[ebp+ht_dc_ptrs+ebx*4]
test dword [ebx],-1
jnz eoi
mov cl,15
mov al,[edi]
.l2: inc edi ;calcular numero de codigos
add al,[edi]
jc eoi
dec cl
jnz .l2
movzx ecx,al
lea ecx,[ecx*4+2]
call malloc
mov [ebx],edi
call arbol_hf
mov eax,[esp]
sub eax,ebx
jc eoi
mov esi,ebx
cmp eax,4
ja .l1
jne eoi
pop eax
ret
 
arbol_hf: ;esi=ht edi=memoria para el arbol
;retorna en ebx el final de ht
;codigos: bits 0-3=nbits del siguiente numero
; bits 4-7=numero de zeros
; bits 8-14=longitud de este codigo o error si =127
; bit 15=codigo/puntero
push ebp
lea ebx,[edi-2]
add ebx,[ebx-2]
mov word [ebx],-1 ;codigo de error si encontrado
push ebx
push esi
lea ebx,[esi+16]
mov ebp,esp
xor ecx,ecx
push edi
push ecx
add edi,2
mov dx,1
add dh,[esi]
jz .l3
jmp .l2
.l1: push edi
push ecx
add edi,2
.l2: inc cl
cmp cl,dl
jc .l1
mov al,[ebx]
inc ebx
mov ah,128 ;marca de codigo
or ah,dl
cmp edi,[ebp+4]
jnc .l5
stosw
cmp esp,ebp
jnc .l5
pop ecx
pop esi
lea eax,[edi-2]
sub eax,esi
mov [esi],ax
dec dh
jnz .l2 ;ncodigos
mov esi,[ebp]
.l3: inc esi
inc dl
cmp dl,17
jnc .l4
add dh,[esi]
jz .l3
mov [ebp],esi
jmp .l2
.l4: lea esp,[ebp+8]
pop ebp
ret
.l5: mov ebp,[ebp+8]
jmp eoi
 
sos: sub ecx,4 ;a continuacion vienen los datos de la imagen
call READ
mov eax,[ebp+fichero]
call ftell
mov [ebp+position],edx
mov esi,edi
lea edi,[ebp+q_ptr]
lodsb ;numero de componentes
sub [ebp+color_c],al
jnz eoi
mov dh,al
.l1: mov ebx,[edi]
mov eax,[ebx]
stosd
lodsw
mov cl,ah
and eax,0f00h
and ecx,0f0h
shr eax,6
shr ecx,2
lea ebx,[ebp+ht_ac_ptrs+eax]
mov eax,[ebx]
lea ebx,[ebp+ht_dc_ptrs+ecx]
mov ecx,[ebx]
test eax,eax
jz eoi
test ecx,ecx
jz eoi
stosd
mov eax,ecx
stosd
add edi,4
dec dh
jnz .l1
mov edx,[ebp+mcu_ptr]
cmp edx,modes
jne .l2
lea esi,[ebp+q_ptr]
lea edi,[ebp+q_ptr+32]
movsd
movsd
movsd
.l2:
mov esi,edx
push dword [esi]
pop dword [ebp+mcu_ptr]
push dword [esi+4]
pop dword[ebp+color_ptr]
push dword [esi+12]
pop dword [ebp+y_mcu]
push dword [esi+8]
pop dword [ebp+x_mcu]
mov ecx,64*18
call malloc
mov [ebp+matrices],edi
mov ecx,bufer_size
call malloc
mov [ebp+sourcebits],edi
mov esp,[ebp]
mov [esp+8],ebp
popad
ret
 
jpeg_display:
test ebp,ebp
jnz .inicio
ret
.inicio:
pushad
mov [ebp],esp
mov eax,[ebp+fichero]
mov edx,[ebp+position]
call lseek
mov edi,[ebp+sourcebits]
add edi,bufer_size
mov [ebp+sourcebits_index],edi
sub edi,2
mov [ebp+sourcebits_limit],edi
mov edi,[ebp+matrices]
mov [ebp+matriz_limit],edi
xor eax,eax
mov [esp+8],eax
mov [ebp+estado],eax
mov [ebp+tmp_bits],eax
mov [ebp+dc],eax
mov [ebp+dc+16],eax
mov [ebp+dc+32],eax
 
mov eax,[ebp+y_mcu]
mov ecx,[ebp+y_org]
sub ecx,eax
mov [ebp+y_org2],ecx
mov [ebp+y_mcu2],eax
push dword [ebp+y_size]
pop dword [ebp+y_size2]
.l3: push dword [ebp+x_org]
pop dword [ebp+x_org2]
push dword [ebp+x_mcu]
pop dword [ebp+x_mcu2]
push dword [ebp+x_size]
pop dword [ebp+x_size2]
mov eax,[ebp+y_mcu2]
add [ebp+y_org2],eax
sub [ebp+y_size2],eax
jnc .l4
add eax,[ebp+y_size2]
jnz .cont
mov [esp+8],ebp
popad
ret
.cont:
mov dword [ebp+y_size2],0
mov [ebp+y_mcu2],eax
.l4:
mov eax,[ebp+x_mcu2]
sub [ebp+x_size2],eax
jnc .l5
add eax,[ebp+x_size2]
jz .l3
mov dword [ebp+x_size2],0
mov [ebp+x_mcu2],eax
call dword [ebp+mcu_ptr]
mov eax,[ebp+x_mcu]
mov ecx,[ebp+x_mcu2]
mov edx,[ebp+y_mcu2]
call recortar
jmp .l6
.l5:
call dword [ebp+mcu_ptr]
mov ecx,[ebp+x_mcu2]
mov edx,[ebp+y_mcu2]
.l6:
mov eax,[ebp+x_org2]
mov ebx,[ebp+y_org2]
call dword [ebp+draw_ptr]
add [ebp+x_org2],ecx
mov ax,[ebp+estado]
test al,15
jz .l4
cmp ah,8
jnc .l4
xor edx,edx
mov [ebp+tmp_bits],edx
mov [ebp+dc],edx
mov [ebp+dc+16],edx
mov [ebp+dc+32],edx
add dword [ebp+sourcebits_index],2
and word [ebp+estado],0c0h
test al,32
jz .l4
jmp .l3
 
color100:
push edi
.l1: lodsw
mov dl,ah
mov ah,al
stosw
mov ah,dl
stosb
mov al,dl
stosb
stosw
dec cl
jnz .l1
pop edi
ret
 
color111:
push edi
.l1: lodsw
mov bx,[esi+62]
mov dx,[esi+126]
xchg ah,bh
xchg ah,dl
xchg ah,bl
stosw
mov ax,bx
stosw
mov ax,dx
stosw
dec cl
jnz .l1
pop edi
mov ecx,64*3
jmp ybr_bgr
 
color411:
push ebp
push edi
lea ebp,[esi+ecx*8]
.l1: push ecx
mov ax,[esi]
mov cx,[ebp]
mov dx,[ebp+64]
add ebp,2
xchg ch,dl
mov bx,ax
mov ah,cl
mov bl,ch
mov [edi],ax
mov [edi+2],bx
mov [edi+4],cx
mov ax,[esi+8]
mov bh,ah
mov ah,cl
mov [edi+48],ax
mov [edi+48+2],bx
mov [edi+48+4],cx
mov ax,[esi+2]
mov bx,ax
mov ah,dl
mov bl,dh
mov [edi+6],ax
mov [edi+2+6],bx
mov [edi+4+6],dx
mov ax,[esi+8+2]
mov bh,ah
mov ah,dl
mov [edi+48+6],ax
mov [edi+48+2+6],bx
mov [edi+48+4+6],dx
pop ecx
add edi,12
dec ecx
add esi,4
test cl,1
jnz .l1
add esi,64-8
test cl,2
jnz .l1
sub esi,128-16
add edi,48
test cl,15
jnz .l1
add esi,64
test cl,cl
jnz .l1
pop edi
pop ebp
mov ecx,64*4*3
jmp ybr_bgr
 
color211:
push ebp
push edi
lea ebp,[esi+ecx*4]
.l1: push ecx
mov ax,[esi]
mov cx,[ebp]
mov dx,[ebp+64]
add ebp,2
xchg ch,dl
mov bx,ax
mov ah,cl
mov bl,ch
mov [edi],ax
mov [edi+2],bx
mov [edi+4],cx
mov ax,[esi+2]
mov bx,ax
mov ah,dl
mov bl,dh
mov [edi+6],ax
mov [edi+2+6],bx
mov [edi+4+6],dx
pop ecx
add edi,12
dec cl
add esi,4
test cl,1
jnz .l1
add esi,64-8
test cl,2
jnz .l1
sub esi,128-8
test cl,cl
jnz .l1
pop edi
pop ebp
mov ecx,64*3*2
jmp ybr_bgr
 
 
mcu411: lea ebx,[ebp+q_ptr]
call hufdecode
lea ebx,[ebp+q_ptr]
call hufdecode
mcu211: lea ebx,[ebp+q_ptr]
call hufdecode
mcu111: lea ebx,[ebp+q_ptr]
call hufdecode
lea ebx,[ebp+q_ptr+16]
call hufdecode
mcu100: lea ebx,[ebp+q_ptr+32]
call hufdecode
mov esi,[ebp+matrices]
mov dword [ebp+matriz_limit],esi
mov ecx,32
lea edi,[esi+64*6]
jmp dword [ebp+color_ptr]
 
cargar_bits: ;edx=bits,cl=nbits,
;bp=data struct
;cr: cl,edx,eax,si
;ncr bx,bp,di,ch
 
mov esi,[ebp+sourcebits_index]
cmp esi,[ebp+sourcebits_limit]
jnc .l6
movzx eax,byte [esi]
inc esi
add cl,8
cmp al,-1
je .l2
mov ah,al
lodsb
add cl,8
cmp al,-1
je .l2
.l1: ror eax,cl
or edx,eax
mov [ebp+sourcebits_index],esi
ret
.l2: lodsb
test al,al
jnz .l3
mov al,-1
call .l1
cmp cl,16
jc cargar_bits
ret
.l3: sub esi,2
sub cl,8
sub al,0d0h
cmp al,8
jc .l4
sub al,9
mov al,63
jz .l4
mov al,127
.l4: inc al
or [ebp+estado],al
movzx eax,ah
jmp .l1
.l5: mov [ebp+sourcebits_limit],edi
mov word [edi],0d9ffh
popad
jmp cargar_bits
.l6: ;read file
pushad
mov ecx,bufer_size-2
mov edx,[ebp+sourcebits_limit]
mov edi,[ebp+sourcebits]
mov ax,[edx]
sub edx,edi
stosw
sub esi,edx
mov [ebp+sourcebits_index],esi
cmp edx,ecx
jne .l5
mov eax,[ebp+fichero]
call read
lea ecx,[edi+ecx-2]
mov [ebp+sourcebits_limit],ecx
popad
jmp cargar_bits
 
 
hufdecode: ;si->dctable [bp+20]->actable di->outbufer edx->bits cl->bits en edx
 
 
;[bp+24]->sourcebits
;[bp+22]=outbufer+128
;[bx] q ptr para aa&n
;[bx+2] a ptr
;[bx+4] d ptr
;[bx+8] dc componente
fninit
push dword [ebx]
mov cl,[ebp+nbits]
mov edx,[ebp+tmp_bits]
cmp cl,16
jnc .l1
call cargar_bits
.l1: mov eax,[ebx+4]
mov esi,[ebx+8]
mov [ebp+actable],eax
movzx eax,word [esi]
add esi,2
.l2: add edx,edx
jnc .l3
add esi,eax
.l3: lodsw
test ax,ax
jns .l2
;codigo encontrado
and ax,7f0fh
mov edi,[ebp+matriz_limit] ;arrays
sub cl,ah
jns .l4
fldz
.error:
xor ecx,ecx
or byte [ebp+estado],32
jmp .l12
.l4: cmp cl,al
jnc .l5
push eax
call cargar_bits
pop eax
.l5: sub cl,al
mov ch,cl
mov cl,al
mov eax,edx
shl edx,cl
sar eax,17
xor ax,8000h
xor cl,15
sar ax,cl
mov cl,ch
mov ch,2
add ax,8000h ;incrementar si negativo
adc ax,8000h
add [ebx+12],ax
fild word [ebx+12]
push ecx
mov ecx,64
xor eax,eax
add [ebp+matriz_limit],ecx
rep stosd
pop ecx
sub edi,64*4
mov ebx,[esp]
fmul dword [ebx]
.l6: cmp cl,16
jnc .l7
call cargar_bits
.l7: mov esi,[ebp+actable]
movzx eax,word[esi]
add esi,2
.l8: add edx,edx
jnc .l9
add esi,eax
.l9: lodsw
test ax,ax
jns .l8
;codigo encontrado
and ah,127
xor ebx,ebx
sub cl,ah
js .error
or bl,al
jz .l12
and al,0f0h
shr al,3
add ch,al
js .error
and bl,0fh
jz .l11
cmp cl,bl
jnc .l10
call cargar_bits
.l10: sub cl,bl
xchg bl,cl
mov eax,edx
shl edx,cl
sar eax,17
xor cl,15
xor ax,8000h
sar ax,cl
add ax,8000h ;incrementar si negativo
adc ax,8000h
mov cl,bl
mov bl,ch
mov [ebp+tmp_bits],ax
mov ax,[ebx+zigzag]
mov ebx,[esp]
fild word [ebp+tmp_bits]
or [ebp+idct],ax
and eax,11111100b
fmul dword [ebx+eax]
fstp dword [edi+eax]
.l11: add ch,2
jns .l6
.l12: mov [ebp+nbits],cl
mov [ebp+tmp_bits],edx
xor ebx,ebx
add esp,4
xchg ebx,[ebp+idct]
cmp ch,2
je idctf1
fstp dword [edi]
test bh,0feh
jnz idctf3
idctf2a: test bh,1
mov esi,edi
jz .l1
test bl,1
jnz idctf3
push idctf2b
jmp idctf3b
.l1: call idctf3a
mov cl,4
call limit
mov eax,[edi-8]
mov edx,[edi-4]
mov cl,7
.l2: mov [edi],eax
mov [edi+4],edx
add edi,8
dec cl
jnz .l2
ret
 
idctf1: fistp word[edi+64]
mov ax,128
add ax,[edi+64]
jz .l2
test ah,ah
jz .l1
mov al,-1
js .l2
.l1: mov ah,al
stosw
stosw
mov eax,[edi-4]
mov ecx,15
rep stosd
.l2: ret
 
idctf3: mov bl,8
mov esi,edi
.l1: rcr bh,1
jc .l3
mov eax,[esi]
test eax,eax
jz .l4
mov cl,7
.l2: add esi,32
mov [esi],eax
dec cl
jnz .l2
sub esi,32*7-4
dec bl
jnz .l1
jmp .l5
.l3: call idctf3b
.l4: add esi,4
dec bl
jnz .l1
.l5: mov esi,edi
mov cl,8
.l6: call idctf3a
add esi,32
add edi,16
dec cl
jnz .l6
sub edi,128
mov esi,edi
mov cl,32
limit: mov dx,[esi]
mov bx,[esi+2]
add esi,4
add dx,128
add bx,128
test dh,dh
mov ax,dx
jz .l1
mov al,0
js .l1
mov al,-1
.l1: test bh,bh
mov ah,bl
jz .l2
mov ah,0
js .l2
mov ah,-1
.l2: stosw
dec cl
jnz limit
ret
 
idctf2b:
mov dl,8
.l1: fld dword[esi]
add esi,32
mov ax,128
fistp word [edi]
add ax,[edi]
test ah,ah
jz .l2
mov al,0
js .l2
mov al,-1
.l2: mov ah,al
stosw
stosw
stosw
stosw
dec dl
jnz .l1
ret
 
idctf3a: ;si(d float),di(w int) ncr
fld dword[esi+1*4] ;f1 ;t21=f1+f7
fld st0
fld dword[esi+7*4] ;f7
fadd st2,st0
fsubp st1,st0 ;t22=f1-f7
fld dword[esi+5*4]
fld st0 ;f5 ;t23=f5+f3
fld dword[esi+3*4] ;f3
fadd st2,st0
fsubp st1,st0 ;t20=f5-f3
fld st0
fadd st0,st3 ;t25=(t20+t22)*k2
fmul dword[k+4] ;k2 ;t25,t20,t23,t22,t21
fld st4 ;t7=t21+t23
fadd st0,st3 ;t7,t25,t20,t23,t22,t21
fld dword[k+12] ;k4 ;t6=k4*t20+t25-t7
fmulp st3,st0
fsub st2,st0
fld st1
faddp st3,st0 ;t7,t25,t6,t23,t22,t21
fld st5 ;t5=(t21-t23)*k1-t6
fsub st0,st4
fmul dword[k] ;k1
fsub st0,st3
fstp st6 ;t7,t25,t6,t23,t22,t5
fstp st3 ;t25,t6,t7,t22,t5
fxch st3
fmul dword[k+8] ;k3 ;t4=k3*t22-t25+t5
fadd st0,st4 ;t22*k3+t5,t6,t7,t25,t5
fsubrp st3,st0 ;t6,t7,t4,t5
fld dword[esi] ;f0 ;t10=f0+f4
fst st5 ;f0,t4,t5,t6,t7,f0
fld dword[esi+4*4] ;f4
fsub st6,st0 ;t11=f0-f4
faddp st1,st0
fld st0 ;t10,t10,t6,t7,t4,t5,t11
fld dword[esi+2*4] ;f2 ;t13=f2+f6
fadd dword[esi+6*4] ;f6 ;t13,t10,t10,t6,t7,t4,t5,t11
fadd st2,st0 ;t13,t10,t0,t6,t7,t4,t5,t11 ;t0=t10+t13
fsubp st1,st0 ;t3,t0,t6,t7,t4,t5,t11 ;t3=t10-t13
fld st0 ;p3=t3-t4
fsub st0,st5
fistp word [edi+3*2] ;p3
fadd st0,st4 ;p4=t3+t4
fld dword[esi+2*4] ;f2
fstp st5
fistp word [edi+4*2] ;p4 ;t0,t6,t7,f2,t5,t11
fld st0 ;p0=t0+t7
fsub st0,st3
fistp word [edi+7*2] ;p7
fadd st0,st2 ;p7=t0-t7
fistp word [edi] ;p0 ;t6,t7,f2,t5,t11
fld st2 ;f2 ;f2,t6,t7,f2,t5,t11 ;t12=(f2-f6)*k1-t13
fld dword[esi+6*4] ;f6
fadd st4,st0 ;f6,f2,t6,t7,t13,t5,t11
fsubp st1,st0
fmul dword[k] ;k1
fsub st0,st3
fst st3 ;t12,t6,t7,t12,t5,t11
fadd st0,st5 ;t1=t11+t12
fst st2 ;t1,t6,t1,t12,t5,t11
fadd st0,st1 ;p1=t1+t6
fistp word [edi+2] ;p1 ;t6,t1,t12,t5,t11
fsubp st1,st0 ;p6=t1-t6
fistp word [edi+6*2] ;p6 ;t12,t5,t11
fsubp st2,st0 ;t2=t11-t12 ;t5,t2
fld st0
fadd st0,st2 ;p2=t2+t5
fistp word [edi+2*2] ;p2
fsubp st1,st0 ;p5=t2-t5 ;t5,t2
fistp word [edi+5*2]
ret ;p5
 
 
 
 
idctf3b: ;si ncr
fld dword[esi+1*32]
fld st0 ;f1 ;t21=f1+f7
fld dword[esi+7*32]
fadd st2,st0 ;f7
fsubp st1,st0 ;t22=f1-f7
fld dword[esi+5*32]
fld st0 ;f5 ;t23=f5+f3
fld dword[esi+3*32] ;f3
fadd st2,st0
fsubp st1,st0
fld st0 ;t20=f5-f3
fadd st0,st3 ;t25=(t20+t22)*k2
fmul dword[k+4] ;k2 ;t25,t20,t23,t22,t21
fld st4 ;t7=t21+t23
fadd st0,st3 ;t7,t25,t20,t23,t22,t21
fld dword[k+12] ;k4 ;t6=k4*t20+t25-t7
fmulp st3,st0
fsub st2,st0
fld st1
faddp st3,st0 ;t7,t25,t6,t23,t22,t21
fld st5 ;t5=(t21-t23)*k1-t6
fsub st0,st4
fmul dword[k] ;k1
fsub st0,st3
fstp st6 ;t7,t25,t6,t23,t22,t5
fstp st3
fxch st3 ;t25,t6,t7,t22,t5
fmul dword[k+8] ;k3 ;t4=k3*t22-t25+t5
fadd st0,st4 ;t22*k3+t5,t6,t7,t25,t5
fsubrp st3,st0 ;t6,t7,t4,t5
fld dword[esi] ;f0 ;t10=f0+f4
fst st5 ;f0,t4,t5,t6,t7,f0
fld dword[esi+4*32] ;f4
fsub st6,st0 ;t11=f0-f4
faddp st1,st0
fld st0 ;t10,t10,t6,t7,t4,t5,t11
fld dword[esi+2*32] ;f2 ;t13=f2+f6
fadd dword[esi+6*32] ;f6 ;t13,t10,t10,t6,t7,t4,t5,t11
fadd st2,st0 ;t13,t10,t0,t6,t7,t4,t5,t11 ;t0=t10+t13
fsubp st1,st0 ;t3,t0,t6,t7,t4,t5,t11 ;t3=t10-t13
fld st0 ;p3=t3-t4
fsub st0,st5
fstp dword[esi+3*32] ;p3
fadd st0,st4 ;p4=t3+t4
fld dword[esi+2*32] ;f2
fstp st5
fstp dword[esi+4*32] ;p4 ;t0,t6,t7,f2,t5,t11
fld st0
fsub st0,st3 ;p0=t0+t7
fstp dword[esi+7*32] ;p7
fadd st0,st2 ;p7=t0-t7
fstp dword[esi] ;p0 ;t6,t7,f2,t5,t11
fld st2 ;f2 ;f2,t6,t7,f2,t5,t11 ;t12=(f2-f6)*k1-t13
fld dword[esi+6*32] ;f6
fadd st4,st0 ;f6,f2,t6,t7,t13,t5,t11
fsubp st1,st0
fmul dword[k] ;k1
fsub st0,st3
fst st3 ;t12,t6,t7,t12,t5,t11
fadd st0,st5 ;t1=t11+t12
fst st2 ;t1,t6,t1,t12,t5,t11
fadd st0,st1 ;p1=t1+t6
fstp dword[esi+1*32] ;p1 ;t6,t1,t12,t5,t11
fsubp st1,st0 ;p6=t1-t6
fstp dword[esi+6*32] ;p6 ;t12,t5,t11
fsubp st2,st0
fld st0 ;t2=t11-t12 ;t5,t2
fadd st0,st2 ;p2=t2+t5
fstp dword[esi+2*32] ;p2
fsubp st1,st0 ;p5=t2-t5 ;t5,t2
fstp dword[esi+5*32]
ret ;p5
 
ybr_bgr: ;edi=bmp ecx=n_BYTES
;retorna edi+=ecx
pushad
mov esi,edi
add edi,ecx
push edi
mov edi,[colortabla]
.l1: lodsw
movzx ebx,ah
movzx ebp,al
movzx eax,al
movzx ecx,byte[esi]
lea ebx,[ebx*4+edi+1024]
lea ecx,[ecx*4+edi]
add eax,[ebx] ;cb ;solo se usan 16 bits
mov edx,[ebx+2] ;pero el codigo de 32 bits es mas rapido
mov ebx,[ecx] ;cr
add eax,[ecx+2]
add ebx,ebp ;b
add edx,ebp ;r
test ah,ah
jz .l2
mov al,0
js .l2
mov al,-1
.l2: test dh,dh
jz .l3
mov dl,0
js .l3
mov dl,-1
.l3: test bh,bh
mov dh,al
jz .l4
mov bl,0
js .l4
mov bl,-1
.l4: mov [esi-2],dx
mov [esi],bl
inc esi
cmp esi,[esp]
jc .l1
pop edi
popad
ret
 
recortar: ;edi=bufer eax=ancho en pixels (ecx,edx)tama¤o deseado
pushad
dec edx
jz .l2
lea ebx,[ecx*3]
lea eax,[eax*3]
lea esi,[edi+eax]
add edi,ebx
sub eax,ebx
.l1: mov ecx,ebx
call movedata
add esi,eax
dec edx
jnz .l1
.l2: popad
ret
 
;R = Y + 1.402 *(Cr-128)
;G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128)
;B = Y + 1.772 *(Cb-128)
 
colortabla: dd 0
 
colorprecalc: ;prepara la tabla para convertir ycb a rgb
mov ecx,1024*2
call malloc
mov [colortabla],edi
fninit
fld dword [.k+4]
fld dword [.k]
mov dl,0
call .l1
fld dword [.k+12]
fld dword[.k+8]
.l1: mov cx,-128
.l2: mov [edi],ecx
inc ecx
fild word[edi]
fld st0
fmul st0,st2
fistp word[edi]
fmul st0,st2
fistp word[edi+2]
add edi,4
inc dl
jnz .l2
ret
 
.k: dd 1.402,-0.71414,-0.34414,+1.772
/kernel/branches/hd_kolibri/apps/jpegview/jpegview
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/kernel/branches/hd_kolibri/apps/jpegview/jpegview.asm
0,0 → 1,545
; IMGVIEW.ASM
;
; This program displays jpeg images. The window can be resized.
;
; Version 0.0 END OF 2003
; Octavio Vega
; Version 0.1 7th March 2004
; Mike Hibbett ( very small part! )
; Version 0.11 7th April 2004
; Ville Turjanmaa ( 'set_as_bgr' function )
; Version 0.12 29th May 2004
; Ivan Poddubny (correct "set_as_bgr"+parameters+boot+...)
; Version 0.12 30 de mayo 2004
; Octavio Vega
; bugs correction and slideshow
; version 0.13 3 de junio 2004
; Octavio Vega
; unos retoques
; version 0.14 10th August 2004
; Mike Hibbett Added setting default colours
; version 0.15 24th August 2006
; diamond (rewritten to function 70)
;
 
memsize=20000h
org 0
PARAMS = memsize - 1024
 
appname equ 'Jpegview '
version equ '0.15'
 
use32
 
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd memsize ; memory for app
dd memsize - 1024 ; esp
dd PARAMS , 0x0 ; I_Param , I_Icon
 
stack_size=4096 + 1024
 
include 'macros.inc'
 
START: ; start of execution
 
cmp [PARAMS], byte 0
jne check_parameters
 
; Calculate the 'free' memory available
; to the application, and create the malloc block from it
.l1:
mov ecx,memsize-fin-stack_size
mov edi,fin
call add_mem
 
call colorprecalc ;inicializa tablas usadas para pasar de ybr a bgr
call draw_window
call read_string.rs_done
 
still:
push still
mov ebx,100 ;1 second
mov eax,23 ; wait here for event
int 0x40
cmp eax,1 ; redraw request ?
je draw_window
cmp eax,2 ; key in buffer ?
je read_string
cmp eax,3 ; button in buffer ?
je button
jmp display_next
 
button: ; BUTTON
mov eax,17
int 0x40
cmp ah,3
je set_as_bgr2
cmp ah,2
je slideshow
cmp ah,1 ; CLOSE PROGRAM
jne close_program.exit
close_program:
mov eax,-1
int 0x40
.exit:
ret
 
; Put a 'chunk' of the image on the window
put_image:
pushad
 
lea ebp,[edx+eax+7]
cmp [winxs],bp
jc .l1
lea ebp,[ecx+ebx+20+2+17]
cmp [winys],bp
jc .l1
 
add eax,2 ; offset for boarder
add ebx,2 ; offset for title bar
push ax ; pox
push bx ; pos
push cx ; size
push dx ; size
pop ecx
pop edx
mov ebx,edi
mov eax,7
 
int 40h ; Put image function
.l1:
popad
ret
 
 
 
;******************************************************************************
 
check_parameters:
cmp [PARAMS], dword "BOOT" ; received BOOT parameter -> goto handler
je boot_set_background
 
mov edi, name_string ; clear string with file name
mov al, 0
mov ecx, 100
rep stosb
 
mov ecx, 100 ; calculate length of parameter string
mov edi, PARAMS
repne scasb
sub edi, PARAMS
mov ecx, edi
 
mov esi, PARAMS ; copy parameters to file name
mov edi, name_string
cld
rep movsb
 
jmp START.l1 ; return to beggining of the progra
 
;******************************************************************************
 
 
 
boot_set_background:
 
mov ecx,memsize-fin-stack_size ; size
mov edi,fin ; pointer
call add_mem ; mark memory from fin to 0x100000-1024 as free
call colorprecalc ; calculate colors
mov esi,name_string
call open
test eax,eax
jz close_program
call jpeg_info
mov dword [jpeg_st],ebp
call set_as_bgr2 ; set wallpaper
jmp close_program ; close the program right now
 
;******************************************************************************
;******************************************************************************
 
set_as_bgr2:
mov ebp,dword[jpeg_st]
test ebp,ebp
jz .end
 
mov dword [ebp+draw_ptr],put_chunk_to_bgr
call jpeg_display
mov eax, 15
mov ebx, 1
mov ecx, [ebp + x_size]
mov edx, [ebp + y_size]
int 0x40
 
; Stretch the image to fit
mov eax, 15
mov ebx, 4
mov ecx, 2
int 0x40
 
mov eax, 15
mov ebx, 3
int 0x40
 
 
.end:
ret
 
;******************************************************************************
 
put_chunk_to_bgr:
pushad
 
mov [x_pointer], edi
mov esi, ecx
imul esi, 3
mov [x_numofbytes], esi
mov ecx, [ebp + x_size]
imul ecx, ebx
add ecx, eax
imul ecx, 3
mov [x_offset], ecx
mov [x_counter], edx
mov eax, [ebp + x_size]
imul eax, 3
mov [x_numofb2], eax
.new_string:
mov eax, 15
mov ebx, 5
mov ecx, [x_pointer]
mov edx, [x_offset]
mov esi, [x_numofbytes]
int 0x40
mov eax, [x_numofbytes]
add [x_pointer], eax
mov eax, [x_numofb2]
add [x_offset], eax
dec [x_counter]
jnz .new_string
 
popad
ret
 
;******************************************************************************
 
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
 
mov eax,48
mov ebx,3
mov ecx,sc
mov edx,sizeof.system_colors
int 0x40
 
mov eax,12
mov ebx,1
int 0x40
 
; Draw the window to the appropriate size - it may have
; been resized by the user
cmp [winxs], 0
jne dw_001
 
; Give the screen some inital defaults
mov [winxs], 400
mov [winys], 300
mov ax, 100
mov [winxo], ax
mov [winyo], ax
jmp dw_002
 
dw_001:
mov eax, 9
mov ebx, memsize - 1024
mov ecx, -1
int 0x40
mov eax, [ebx + 34]
mov [winxo], ax
mov eax, [ebx + 38]
mov [winyo], ax
mov eax, [ebx + 42]
mov [winxs], ax
mov eax, [ebx + 46]
mov [winys], ax
 
dw_002:
mov ebx, dword [winxo-2]
mov bx, [winxs]
mov ecx, dword [winyo-2]
mov cx, [winys]
 
xor eax,eax ; DRAW WINDOW
mov edx,[sc.work]
or edx,0x33000000
mov edi,header ; WINDOW LABEL
int 0x40
 
 
mov eax,8 ; BUTTON 2: slideshow
mov ebx,57
mov cx, [winys]
sub cx, 39
shl ecx, 16
add ecx, 12
mov esi, [sc.work_button]
mov edx,2
int 0x40
 
mov eax,4 ; Button text
movzx ebx, word [winys]
add ebx, 3 shl 16 - 36
mov ecx,[sc.work_button_text]
mov edx,setname
mov esi,setnamelen-setname
int 0x40
 
 
mov eax,8 ; BUTTON 3: set as background
mov bx, [winxs]
sub bx, 65
shl ebx, 16
mov bx,55
mov cx, [winys]
sub cx, 39
shl ecx, 16
add ecx, 12
mov esi, [sc.work_button]
mov edx,3
int 0x40
 
mov eax,4 ; Button text
movzx ebx, word [winxs]
sub ebx, 63
shl ebx,16
mov bx, word [winys]
sub bx,36
mov ecx,[sc.work_button_text]
mov edx,setbgr
mov esi,setbgrlen-setbgr
int 0x40
call print_strings
call load_image
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
 
 
; Read in the image file name.
read_string:
movzx edi,byte[name_string.cursor]
add edi,name_string
mov eax,2
int 0x40 ; Get the key value
shr eax,8
cmp eax,13 ; Return key ends input
je .rs_done
cmp eax,8
jnz .nobsl
cmp edi,name_string
je .exit
dec edi
mov [edi],byte 0;'_'
dec byte[name_string.cursor]
jmp print_strings
.exit: ret
.nobsl:
cmp eax,31
jbe .exit
cmp eax,97
jb .keyok
sub eax,32
.keyok:
mov ah,0
stosw
cmp edi,name_string.end
jnc print_strings
inc byte[name_string.cursor]
jmp print_strings
.rs_done:
call print_strings
mov esi,name_string
call open
test eax,eax
jz .exit
call jpeg_info
test ebp,ebp
jz close
xchg [jpeg_st],ebp
call jpeg_close
 
load_image:
 
mov eax,13 ; clear picture area
movzx ebx, word [winxs]
add ebx, 1 shl 16 -10
movzx ecx, word [winys]
sub ecx, 40
add ecx, 1 shl 16
 
mov edx,[sc.work]
int 0x40
mov ebp,[jpeg_st]
test ebp,ebp
jz .exit
mov dword [ebp+draw_ptr],put_image
jmp jpeg_display
.exit: ret
 
print_strings:
pusha
mov eax,13 ; clear text area
movzx ebx, word [winxs]
add ebx, 59 shl 16 -125
mov cx, [winys]
sub cx, 39
shl ecx, 16
add ecx, 12
mov edx,0xffffff
int 0x40
 
mov eax,4 ;
movzx ebx, word [winys]
add ebx, 61 shl 16 - 37
mov ecx,0x000000
mov edx,name_string
mov esi,60
int 0x40
popa
ret
 
slideshow:
cmp [file_dir], 0
jnz .exit
cmp [jpeg_st], 0
jz .exit
mov esi, name_string
movzx ecx, byte [name_string.cursor]
.l1:
cmp byte [esi+ecx], '/'
jz .l2
loop .l1
.exit:
ret
.l2:
mov byte [esi+ecx], 0
call open
mov byte [esi+ecx], '/'
test eax, eax
jz .exit
test byte [fileattr], 0x10
jz .exit
mov [file_dir], eax
inc ecx
mov [name_string.cursor], cl
display_next:
mov ebx, [file_dir]
test ebx, ebx
jnz @f
ret
@@:
mov byte [ebx], 1
mov byte [ebx+12], 1
mov dword [ebx+16], dirinfo
mov eax, 70
int 0x40
mov eax, [file_dir]
inc dword [eax+4]
cmp ebx, 1
jz @f
mov eax, [file_dir]
and [file_dir], 0
jmp close
@@:
movzx edi, byte [name_string.cursor]
add edi, name_string
lea esi, [dirinfo+32+40]
@@:
lodsb
stosb
test al, al
jnz @b
mov ecx, name_string.end
sub ecx, edi
rep stosb
call print_strings
mov esi,name_string
call open
test eax,eax
jz display_next
call jpeg_info
test ebp,ebp
jnz .l6
call close
jmp display_next
.l6:
mov dword[ebp+draw_ptr],put_image
push ebp
xchg [jpeg_st],ebp
call jpeg_close
pop ebp
jmp jpeg_display
 
 
include 'filelib.asm'
include 'memlib.asm'
include 'jpeglib.asm'
 
 
; DATA AREA
 
wcolor dd 0x000000
header db appname,version,0
setname db 'SLIDESHOW'
setnamelen:
 
setbgr db ' BGR '
setbgrlen:
 
x_pointer dd 0
x_offset dd 0
x_numofbytes dd 0
x_numofb2 dd 0
x_counter dd 0
winxo dw 0
winyo dw 0
winxs dw 0
winys dw 0
jpeg_st dd 0
file_dir dd 0
name_string: db '/HD0/1/KOLIBRI/ETC/jpegview.jpg',0
rb 256
.end:
.cursor: db 19
.cursor2: db 0
 
align 4
 
rgb16: db 0,4,8,13,17,21,25,29,34,38,42,46,50,55,59,63
rgb4: db 0,21,42,63
 
include 'jpegdat.asm'
 
align 4
 
iniciomemoria:
dd -(iniciomemoria+4),-(iniciomemoria+4),(iniciomemoria+4),.l1,0
.l1 dd 0
 
fin:
I_END:
sc system_colors
fileattr: rb 40
dirinfo: rb 32+304
/kernel/branches/hd_kolibri/apps/jpegview/jpegview.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/kernel/branches/hd_kolibri/apps/jpegview/lang.inc
0,0 → 1,0
lang fix en
/kernel/branches/hd_kolibri/apps/jpegview/macros.inc
0,0 → 1,268
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
; language for programs
lang fix ru ; ru en fr ge fi
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
/kernel/branches/hd_kolibri/apps/jpegview/memlib.asm
0,0 → 1,210
 
movedata:
push eax
xor eax,eax
sub eax,edi
and eax,3
xchg ecx,eax
sub eax,ecx
jle .l1
rep movsb
mov ecx,eax
shr ecx,2
rep movsd
and eax,3
.l1: add ecx,eax
rep movsb
pop eax
ret
 
mallocz:
call malloc
pushad
add ecx,3
xor eax,eax
shr ecx,2
rep stosd
popad
ret
 
mresize1: popad
xor edi,edi
stc
mresize2: ret
mresize: ; puntero en di ncr retorna nuevo puntero en di
test edi,edi
jz malloc
cmp ecx,[edi-4]
je mresize2
call free
malloc:
mov edi,ecx
jecxz mresize2
pushad
mov esi,iniciomemoria+4
lea ebx,[ecx+3]
and ebx,-4 ;redondeo a 4
.l1: mov edi,esi
add esi,[esi]
jc mresize1
lodsd
cmp eax,ebx
jc .l1
cmp esi,[iniciomemoria+8]
jc .l2
jne mresize1
lea edx,[ebx+esi+4]
cmp edx,[iniciomemoria+12]
jnc mresize1
mov [iniciomemoria+8],edx
.l2: pop dword [esi-4]
push esi
sub eax,ebx
je .l3
sub eax,4
mov [esi+ebx],eax
jz .l3
;fragmentar
add ebx,4
add [edi],ebx
mov eax,[esi]
sub eax,ebx
mov [esi+ebx],eax
popad
ret
.l3: lodsd
add eax,4
add [edi],eax
popad
ret
 
realloc: test edi,edi
jz malloc
jecxz free
pushad
pop esi
mov eax,[edi-4]
call malloc
push edi
cmp ecx,eax
jc .l1
mov ecx,eax
.l1: push esi
call movedata
pop edi
call free
popad
.l2: ret
free: ;puntero en di
;no se comprueban los punteros
;retorna di=0 , ncr
test edi,edi
jz realloc.l2
pushad
pop edi
mov ebp,[edi-4]
dec ebp
and ebp,-4 ;redondeo a 4,dx=dx-4
xor edx,edx
push edx
mov edx,iniciomemoria+4
mov esi,edx
;buscar puntero libre anterior
.l1: mov ebx,esi
lodsd
add esi,eax
cmp esi,edi
jc .l1
;enlazar
mov ecx,esi
sub ecx,edi
sub eax,ecx
sub ecx,4
mov [ebx],eax
;fusionar con el anterior
cmp eax,[ebx-4]
jne .l2
cmp ebx,edx
je .l2 ;no fusionar con el primero
mov edi,ebx
add eax,4
add ecx,eax
add ebp,eax
.l2: mov ebx,ebp ;fusionar con bloques de tama¤o 0
.l3: add ebx,4
test dword [edi+ebx],-1
jz .l3
cmp ebx,ecx
jne .l4
;fusionar con el siguiente
add ebx,[esi-4]
add ecx,[esi]
add ebx,4
add ecx,4
cmp esi,[edx+4]
jne .l4
mov [edx+4],edi
.l4: mov [edi-4],ebx
mov [edi],ecx
popad
ret
 
add_mem: ;edi,ecx ;el ultimo bloque libre debe ser >8 bytes para poder fragmentarlo
cmp ecx,64
jc .l1
add ecx,edi
add edi,3
and edi,-4
and ecx,-4
mov eax,ecx
sub ecx,edi ;redondeo
xchg eax,[iniciomemoria+12]
cmp edi,eax
jna .l1
lea esi,[edi+4]
mov edx,esi
xchg esi,[iniciomemoria+8]
neg edx
mov [edi],edx
mov [edi+4],edx
lea edx,[edi-4]
sub edi,esi
mov [esi],edi
sub eax,4
sub eax,esi
mov [esi-4],eax
add esi,eax
sub edx,esi
mov [esi],edx
.l1: ret
 
check_mem: ;busqueda de errores en la memoria
;retorna edx nbloques o 0 si error,ecx memoria libre
;ncr: ebp,ebx,eax
mov edi,iniciomemoria
mov esi,edi
xor edx,edx
mov ecx,[edi]
neg ecx ;el primer bloque no cuenta
.l1: add ecx,[edi]
add edi,4
add edi,[edi]
.l2: inc edx
add esi,[esi]
jc .l4
add esi,7
jc .l3
and esi,-4
cmp esi,edi
jc .l2
je .l1
jmp .l4
.l3: test edi,edi
jnz .l4
add ecx,[iniciomemoria+12]
ret
.l4: xor edx,edx
stc
ret
 
 
/kernel/branches/hd_kolibri/apps/launcher/AUTORUN.DAT
0,0 → 1,11
7 # <- Number of programs in the list
 
# Program Parameters Delay
/HD0/1/KOLIBRI/BIN/SETUP BOOT 99 # System setup
/HD0/1/KOLIBRI/BIN/JPEGVIEW BOOT 99 # Background image
/HD0/1/KOLIBRI/BIN/@RB <NO> 30 # Desktop right-click menu
/HD0/1/KOLIBRI/BIN/@SS <NO> 30 # Screensaver
/HD0/1/KOLIBRI/BIN/@TRACKER <NO> 30 # tracker
/HD0/1/KOLIBRI/BIN/@TASKBAR <NO> 30 # taskbar
/HD0/1/KOLIBRI/BIN/@DOCK <NO> 30 # dock
### Total: 2.6 seconds ###
/kernel/branches/hd_kolibri/apps/launcher/build.bat
0,0 → 1,2
echo lang fix en >lang.inc
fasm launcher.asm launcher
/kernel/branches/hd_kolibri/apps/launcher/lang.inc
0,0 → 1,0
lang fix en
/kernel/branches/hd_kolibri/apps/launcher/launcher
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/kernel/branches/hd_kolibri/apps/launcher/launcher.asm
0,0 → 1,200
;
; LAUNCHER - €‚’Ž‡€“‘Š Žƒ€ŒŒ
; Š®¤ ¯à®£à ¬¬ë ᮢᥬ ­¥ ®¯â¨¬¨§¨à®¢ ­, ­® ®ç¥­ì ¯à®áâ ¤«ï ¯®­¨¬ ­¨ï.
; â®â « ã­ç¥à £à㧨⠨­ä®à¬ æ¨î ® ¯à®£à ¬¬ å ¤«ï § ¯ã᪠ ¨§ ä ©« 
; AUTORUN.DAT. ”®à¬ â ®ç¥­ì ¯à®áâ ¨ ¢ ª®¬¬¥­â à¨ïå ­¥ ­ã¦¤ ¥âáï.
;
; Š®¬¯¨«¨àã©â¥ á ¯®¬®éìî FASM 1.52 ¨ ¢ëè¥
;
include "MACROS.INC"
 
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x8000 ; memory for app
dd 0x8000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
;include "DEBUG.INC"
 
START: ; start of execution
 
; mov eax, 5
; mov ebx, 10
; int 0x40
 
mcall 18,15
 
mov eax, 70 ; load AUTORUN.DAT
mov ebx, autorun_dat_info
int 0x40
 
call get_number
mov [number_of_files], eax
;dps "NUMBER OF FILES: "
;dpd eax
;dps <13,10>
call next_line
 
start_program:
;dps <"STARTING A PROGRAM",13,10>
call clear_strings
mov edi, program
call get_string
mov edi, parameters
call get_string
call get_number
call run_program
call next_line
dec [number_of_files]
jnz start_program
 
exit:
or eax, -1
int 0x40
 
 
run_program: ; time to delay in eax
push eax
mcall 70, start_info
pop ebx
 
mov eax, 5
int 0x40
ret
 
 
clear_strings: ; clears buffers
pushad
 
mov ecx, 60
mov edi, program
xor al, al ;mov al, ' '
rep stosb
 
mov ecx, 60
mov edi, parameters
rep stosb
 
popad
ret
 
 
get_string: ; pointer to destination buffer in edi
pushad
call skip_spaces
mov esi, [position]
;dpd esi
;dps <13,10>
add esi, file_data
.start:
lodsb
cmp al, ' '
je .finish
stosb
inc [position]
jmp .start
.finish:
popad
ret
 
 
get_number:
push ebx esi
call skip_spaces
mov esi, [position]
add esi, file_data
xor eax, eax
xor ebx, ebx
.start:
lodsb
sub al, '0'
cmp al, 9
ja .finish
lea ebx,[ebx*4+ebx]
lea ebx,[ebx*2+eax]
inc [position]
jmp .start
.finish:
mov eax, ebx
pop esi ebx
ret
 
 
skip_spaces:
pushad
xor eax, eax
mov esi, [position]
add esi, file_data
.start:
lodsb
cmp al, ' '
jne .finish
inc [position]
jmp .start
.finish:
;dps "NOW AL = "
;mov [tmp],al
;mov edx, tmp
;call debug_outstr
;dps <13,10>
popad
ret
 
 
next_line:
pushad
mov esi, [position]
add esi, file_data
.start:
lodsb
cmp al, 13
je .finish
inc [position]
jmp .start
.finish:
add [position], 2
inc esi
lodsb
cmp al, '#'
je .skipline
cmp al, 13
jne .donotskip
.skipline:
call next_line
.donotskip:
popad
ret
 
 
 
; DATA:
position dd 0 ; position in file
 
autorun_dat_info: ; AUTORUN.DAT
.mode dd 0 ; read file
.start_block dd 0 ; block to read
dd 0
.blocks dd 16*512 ; 16*512 bytes max
.address dd file_data
db "/HD0/1/KOLIBRI/ETC/AUTORUN.DAT",0
 
start_info:
.mode dd 7
dd 0
.params dd parameters
dd 0
dd 0
.path: ;      
 
I_END:
 
program rb 61 ; 60 + [0] char
parameters rb 61
 
number_of_files dd ?
 
file_data rb 16*512
/kernel/branches/hd_kolibri/apps/launcher/macros.inc
0,0 → 1,269
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
dw ? ; +52 - reserved
.client_left dd ? ; +54
.client_top dd ? ; +58
.client_width dd ? ; +62
.client_height dd ? ; +66
.wnd_state db ? ; +70
rb (1024-71)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
/kernel/branches/hd_kolibri/apps/menu/MENU.DAT
0,0 → 1,163
#0 **** MAIN ****
GAMES > /@6
DEMOS > /@1
GRAPHICS > /@12
SOUND AND MUSIC > /@11
DEVELOPMENT > /@2
SYSTEM > /@4
NETWORK > /@3
OTHER > /@5
HELP /HD0/1/KOLIBRI/BIN/docpak
RUN APPLICATION /HD0/1/KOLIBRI/BIN/run
SHUTDOWN /HD0/1/KOLIBRI/BIN/end
#1 **** DEMOS ****
FIRE /HD0/1/KOLIBRI/BIN/fire
FIRE2 /HD0/1/KOLIBRI/BIN/fire2
CIRCLE /HD0/1/KOLIBRI/BIN/circle
TRANSPARENCY /HD0/1/KOLIBRI/BIN/transp
FRACTAL /HD0/1/KOLIBRI/BIN/tinyfrac
COLOR DEMO /HD0/1/KOLIBRI/BIN/colorref
EYES /HD0/1/KOLIBRI/BIN/eyes
TUBE /HD0/1/KOLIBRI/BIN/tube
PLASMA /HD0/1/KOLIBRI/BIN/plasma
MOVEBACK /HD0/1/KOLIBRI/BIN/movback
LIFE /HD0/1/KOLIBRI/BIN/life2
SDLFIRE /HD0/1/KOLIBRI/BIN/sdlfire
TRANTEST /HD0/1/KOLIBRI/BIN/trantest
3D > /@15
#2 **** PROGRAMMING ****
ARCHIVER MHC /HD0/1/KOLIBRI/BIN/mhc
PACKER MTAPPACK /HD0/1/KOLIBRI/BIN/mtappack
TINYPAD /HD0/1/KOLIBRI/BIN/tinypad
TINYPAD2 /HD0/1/KOLIBRI/BIN/tinypad2
FLAT ASSEMBLER /HD0/1/KOLIBRI/BIN/fasm
HEX-EDITOR /HD0/1/KOLIBRI/BIN/heed
ASCII-CODES /HD0/1/KOLIBRI/BIN/keyascii
SCAN-CODES /HD0/1/KOLIBRI/BIN/scancode
HEX2DEC2BIN /HD0/1/KOLIBRI/BIN/h2d2b
CALCULATOR /HD0/1/KOLIBRI/BIN/calc
DEBUG BOARD /HD0/1/KOLIBRI/BIN/board
DEBUGGER /HD0/1/KOLIBRI/BIN/mtdbg
EXAMPLES > /@7
#3 **** NET ****
CONFIGURATION /HD0/1/KOLIBRI/BIN/stackcfg
NET STATUS /HD0/1/KOLIBRI/BIN/ethstat
ARP STATUS /HD0/1/KOLIBRI/BIN/arpstat
DNS RESOLVER /HD0/1/KOLIBRI/BIN/dnsr
DHCP (ONLY TEST) /HD0/1/KOLIBRI/BIN/dhcp
AUTODHCP /HD0/1/KOLIBRI/BIN/autodhcp
TERMINAL /HD0/1/KOLIBRI/BIN/terminal
LOCAL CLUSTER /HD0/1/KOLIBRI/BIN/local
REMOTE CLUSTER /HD0/1/KOLIBRI/BIN/remote
SERVERS > /@9
CLIENTS > /@10
#4 **** SYSTEM ****
PROTECTION TEST /HD0/1/KOLIBRI/BIN/test
DEBUG BOARD /HD0/1/KOLIBRI/BIN/board
READ HDD /HD0/1/KOLIBRI/BIN/hdread
ADJUSTMENT > /@8
SYSTEM SENSORS > /@14
WORK WITH FILES > /@13
#5 **** MISC ****
SCREEN MAGNIFIER /HD0/1/KOLIBRI/BIN/magnify
ANALOGUE CLOCK /HD0/1/KOLIBRI/BIN/aclock
BINARY CLOCK /HD0/1/KOLIBRI/BIN/bcdclk
TIMER /HD0/1/KOLIBRI/BIN/timer
SCRSHOOT /HD0/1/KOLIBRI/BIN/scrshoot
CALENDAR /HD0/1/KOLIBRI/BIN/calendar
BGI FONT DEMO /HD0/1/KOLIBRI/BIN/bgitest
RTF READER /HD0/1/KOLIBRI/BIN/rtfread
@RCHER /HD0/1/KOLIBRI/BIN/@rcher
#6 **** GAMES ****
TETRIS /HD0/1/KOLIBRI/BIN/tetris
C4 /HD0/1/KOLIBRI/BIN/c4
15 /HD0/1/KOLIBRI/BIN/15
MINE /HD0/1/KOLIBRI/BIN/mine
PONG /HD0/1/KOLIBRI/BIN/pong
MEMORY BLOCKS /HD0/1/KOLIBRI/BIN/mblocks
NEW PONG /HD0/1/KOLIBRI/BIN/pong3
PHENIX /HD0/1/KOLIBRI/BIN/phenix
FREECELL /HD0/1/KOLIBRI/BIN/freecell
ARCANII /HD0/1/KOLIBRI/BIN/arcanii
CLICKOMANIA /HD0/1/KOLIBRI/BIN/click
RED SQUARE /HD0/1/KOLIBRI/BIN/rsquare
PIPES /HD0/1/KOLIBRI/BIN/pipes
XONIX /HD0/1/KOLIBRI/BIN/xonix
PHARAOH TOMB /HD0/1/KOLIBRI/BIN/fara
SQ_GAME /HD0/1/KOLIBRI/BIN/sq_game
CHECKERS /HD0/1/KOLIBRI/BIN/checkers
QUAKE HD0_1 /HD0/1/MENUETOS/sdlquake
DOOM HD0_1 /HD0/1/MENUETOS/doom/mdoom
SOKOBAN HD0_1 /HD0/1/KOLIBRI/BIN/soko
#7 **** EXAMPLES ****
THREADS /HD0/1/KOLIBRI/BIN/thread
IPC /HD0/1/KOLIBRI/BIN/ipc
COLOR SLIDER /HD0/1/KOLIBRI/BIN/cslide
CONSOLE EXAMPLE /HD0/1/KOLIBRI/BIN/testcon2
#8 **** SETUP ****
DEVICES SETUP /HD0/1/KOLIBRI/BIN/setup
BACKGROUND SETUP /HD0/1/KOLIBRI/BIN/pic4
MEVIEW /HD0/1/KOLIBRI/BIN/mv
JPEGVIEW /HD0/1/KOLIBRI/BIN/jpegview
COLORS & SKIN SETUP /HD0/1/KOLIBRI/BIN/desktop
PANEL SETUP /HD0/1/KOLIBRI/BIN/spanel
ICONS SETUP /HD0/1/KOLIBRI/BIN/icon
VRR /HD0/1/KOLIBRI/BIN/vrr
#9 **** SERVERS ****
SMTPS /HD0/1/KOLIBRI/BIN/smtps
HTTPS /HD0/1/KOLIBRI/BIN/https
MP3S /HD0/1/KOLIBRI/BIN/mp3s
FTPS /HD0/1/KOLIBRI/BIN/ftps
NETSENDS /HD0/1/KOLIBRI/BIN/netsends
RCC-SERVER /HD0/1/KOLIBRI/BIN/rccs
#10 **** CLIENTS ****
TFTP CLIENT /HD0/1/KOLIBRI/BIN/tftpc
INTERNET-CHESS /HD0/1/KOLIBRI/BIN/chess
SIMPLY BROWSER /HD0/1/KOLIBRI/BIN/httpc
NNTP-NEWSGROUPS /HD0/1/KOLIBRI/BIN/nntpc
TELNET /HD0/1/KOLIBRI/BIN/telnet
POP - MAIL /HD0/1/KOLIBRI/BIN/popc
TFTP AUDIO STREAM /HD0/1/KOLIBRI/BIN/tftpa
IRC CLIENT /HD0/1/KOLIBRI/BIN/airc
YAHOO MESSENG.(DEMO) /HD0/1/KOLIBRI/BIN/ym
NETSENDC /HD0/1/KOLIBRI/BIN/netsendc
TESTFTP1 /HD0/1/KOLIBRI/BIN/testftp1
RCC-CLIENT /HD0/1/KOLIBRI/BIN/rccc
JMAIL /rd/1/network/jmail
#11 **** AUDIO ****
SB AUDIO PLAYER /HD0/1/KOLIBRI/BIN/sb
MIDAMP /HD0/1/KOLIBRI/BIN/midamp
CD PLAYER /HD0/1/KOLIBRI/BIN/cdp
VOLUME /HD0/1/KOLIBRI/BIN/mixer
TEST MIDI /HD0/1/KOLIBRI/BIN/midiplay
#12 **** GRAPHICS ****
ICON EDITOR (BMP) /HD0/1/KOLIBRI/BIN/iconedit
JPEG VIEWER /HD0/1/KOLIBRI/BIN/jpegview
BMP VIEWER /HD0/1/KOLIBRI/BIN/mv
GIFVIEW /HD0/1/KOLIBRI/BIN/gifview
ANIMAGE /HD0/1/KOLIBRI/BIN/animage
#13 **** €Ž’€ ‘ ”€‰‹€Œˆ ****
CMD CONSOLE /HD0/1/KOLIBRI/BIN/cmd
SYSXTREE /HD0/1/KOLIBRI/BIN/sysxtree
KFAR /HD0/1/KOLIBRI/BIN/kfar
COPY FILE /HD0/1/KOLIBRI/BIN/copy2
SAVE RD IMAGE /HD0/1/KOLIBRI/BIN/rdsave
#14
PROCESSES (CPU) /HD0/1/KOLIBRI/BIN/cpu
PCI DEVICES /HD0/1/KOLIBRI/BIN/pcidev
TEST GRAPHICS SPEED /HD0/1/KOLIBRI/BIN/mgb
CPUID /HD0/1/KOLIBRI/BIN/cpuid
GHOST MONITOR /HD0/1/KOLIBRI/BIN/gmon
K. BUS DISCONNECTED /HD0/1/KOLIBRI/BIN/kbd
#15
SCREENSAVER /HD0/1/KOLIBRI/BIN/crownscr
3D-CUBE /HD0/1/KOLIBRI/BIN/3dcube2
3D-LABYRINTH /HD0/1/KOLIBRI/BIN/free3d04
3D-TEXTURED CUBE /HD0/1/KOLIBRI/BIN/3dtcub10
3DSHEART /HD0/1/KOLIBRI/BIN/3dsheart
VIEW3DS /HD0/1/KOLIBRI/BIN/view3ds
CUBELINE /HD0/1/KOLIBRI/BIN/cubeline
3D-TEXTURED CUBE 2 /HD0/1/KOLIBRI/BIN/cubetext
GEARS /HD0/1/KOLIBRI/BIN/gears
FLATWAV /HD0/1/KOLIBRI/BIN/flatwav
##
/kernel/branches/hd_kolibri/apps/menu/build.bat
0,0 → 1,2
echo lang fix en >lang.inc
fasm menu.asm menu
/kernel/branches/hd_kolibri/apps/menu/lang.inc
0,0 → 1,0
lang fix en
/kernel/branches/hd_kolibri/apps/menu/macros.inc
0,0 → 1,269
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
dw ? ; +52 - reserved
.client_left dd ? ; +54
.client_top dd ? ; +58
.client_width dd ? ; +62
.client_height dd ? ; +66
.wnd_state db ? ; +70
rb (1024-71)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
/kernel/branches/hd_kolibri/apps/menu/menu
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/kernel/branches/hd_kolibri/apps/menu/menu.asm
0,0 → 1,566
;******************************************************************************
; MAIN MENU by lisovin@26.ru
; Some parts of code rewritten by Ivan Poddubny <ivan-yar@bk.ru>
;
; Compile with FASM for Menuet
;******************************************************************************
include "lang.inc"
include "macros.inc"
 
BTN_HEIGHT = 22
TXT_Y = (BTN_HEIGHT)/2-5
 
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x20000 ; memory for app
dd 0x20000-1 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
;******************************************************************************
;include "DEBUG.INC" ; debug macros
START: ; start of execution
 
mov eax, 48 ; load system colors
mov ebx, 3
mov ecx, sc
mov edx, sizeof.system_colors
int 0x40
 
mov eax, 70 ; load MENU.DAT
mov ebx, fileinfo
int 0x40
test eax, eax ; error ?
jz @f
cmp eax,6
jnz close
@@:
test ebx, ebx ; length = 0 ?
jz close
mov ecx, ebx
mov edi, mem_end
newsearch:
mov al, '#'
cld
repne scasb
test ecx, ecx ; if not found
jz close
call get_number
test ebx, ebx
jnz .number
cmp al, '#'
je search_end
.number:
shl ebx, 4
add ebx, menu_data ; pointer to process table
mov [ebx], edi
inc [processes]
jmp newsearch
search_end:
mov [end_pointer], edi
mov ebx, [processes]
dec ebx
shl ebx, 4
add ebx, menu_data
newprocess:
xor edx, edx
mov ecx, edi
sub ecx, [ebx]
mov al, 10
newsearch1:
std
repne scasb
test ecx, ecx
je endprocess
cmp [edi], byte 13
jne newsearch1
inc edx
jmp newsearch1
endprocess:
mov esi, ebx
add esi, 4
dec edx
mov [esi], dl
cmp ebx, menu_data
jbe search_end1
sub ebx, 16
jmp newprocess
search_end1:
mov eax, 14
int 0x40
sub ax, 20
mov [menu_data + y_end], ax
mov [menu_data + x_start], 5
mov al, [menu_data + rows]
mov [menu_data + cur_sel], al ; clear selection
mov [menu_data + prev_sel], al
 
mov [buffer], 0
thread:
mov eax, [buffer] ; identifier
shl eax, 4
add eax, menu_data
mov edi, eax
 
mov eax, 40 ; set event mask
mov ebx, 100111b ; mouse + button + key + redraw
int 0x40
 
call draw_window
 
still:
mov eax, 23 ; wait here for event
mov ebx, 5
int 0x40
 
test [close_now], 1 ; is close flag set?
jnz close
 
cmp eax, 1 ; redraw request ?
je red
cmp eax, 2 ; key pressed ?
je key
cmp eax, 3 ; button in buffer ?
je button
cmp eax, 6 ; mouse event ?
je mouse
 
cmp edi, menu_data
je still ; if main process-ignored
 
movzx ebx, [edi + parent] ; parent id
shl ebx, 4
add ebx, menu_data ; ebx = base of parent info
call backconvert ; get my id in al
cmp al, [ebx + child] ; if I'm not child of my parent, I shall die :)
jne close
 
jmp still
 
 
red: ; redraw
call draw_window
jmp still
 
 
key:
; mov eax, 2
int 0x40
 
mov al, [edi + rows] ; number of buttons
 
cmp ah, 178 ; KEY_UP
jne .noup
 
mov ah, [edi+cur_sel]
mov [edi+prev_sel], ah
dec byte [edi+cur_sel]
jnz redrawbut
mov [edi+cur_sel], al
jmp redrawbut
 
 
.noup:
cmp ah, 177 ; KEY_DOWN
jne .nodn
 
mov ah, [edi + cur_sel]
mov [edi + prev_sel], ah
inc [edi + cur_sel]
cmp [edi + cur_sel], al
jna redrawbut
mov [edi + cur_sel], 1
jmp redrawbut
 
.nodn:
cmp ah, 13 ; ENTER
jne .noenter
mov ah, [edi + cur_sel]
jmp button1
 
.noenter:
cmp ah, 27 ; ESC
jne still
jmp close
 
; include "DEBUG.INC"
 
button: ; BUTTON HANDLER
mov eax, 17 ; get id
int 0x40
 
button1:
mov esi, edi
push edi
mov edi, [edi + pointer]
 
; print "hello"
mov al, [esi + cur_sel]
mov [esi + prev_sel], al
mov [esi + cur_sel], ah
pushad
mov edi, esi
; dph eax
call draw_only_needed_buttons
popad
 
; look for the next line <ah> times; <ah> = button_id
push eax
.next_string:
call searchstartstring
dec ah
jnz .next_string
pop eax
 
mov ecx, 40
mov al, '/'
cld
repne scasb
test ecx, ecx ; if '/' not found
je searchexit
 
cmp [edi], byte '@' ; check for submenu
je runthread
 
dec edi
push edi ; pointer to start of filename
call searchstartstring ; search for next string
sub edi, 2 ; to last byte of string
 
mov ecx, edi
pop esi
sub ecx, esi
inc ecx ; length of filename
mov edi, fileinfo_start.name
rep movsb ; copy string
mov byte [edi], 0 ; store terminator
mov eax, 70 ; start program
mov ebx, fileinfo_start
int 0x40
; mcall 5,100
or [close_now], 1 ; set close flag
pop edi
mov [mousemask], 0
jmp close
 
searchexit:
pop edi
jmp still
 
 
runthread:
inc edi
 
push eax
call get_number ; get number of this process
pop eax
 
test ebx, ebx ; returned zero - main menu or not number
jz searchexit
 
mov al, bl
 
mov ebx, [processes]
dec bl
cmp al, bl
ja searchexit ; such process doesnt exist
cmp al, [esi + child]
je searchexit ; such process already exists
 
mov [esi + child], al ; this is my child
mov cx, [esi + x_start]
add cx, 141 ; new x_start in cx
movzx edx, al
shl edx, 4
add edx, menu_data ; edx points to child's base address
mov [edx + x_start], cx ; xstart for new thread
mov cx, [esi + y_end] ; y_end in cx
mov bl, [esi + rows] ; number of buttons in bl
sub bl, ah ; number of btn from bottom
movzx eax, al
mov [buffer], eax ; thread id in buffer
movzx ebx, bl
push edx
mov eax, BTN_HEIGHT
mul ebx
sub cx, ax ; new y_end for new thread
pop edx
mov [edx + y_end], cx ; store y_end
mov edi, esi
call backconvert ; get number of this process (al)
mov [edx + parent], al ; store number of parent process
mov al, [edx + rows]
mov [edx + cur_sel], al ; clear current selected element
mov [edx + prev_sel], al ; clear previous selected element
mov [edx + child], 0
 
cmp [thread_stack], 0x1e000
jne thread_stack_not_full
mov [thread_stack], 0xE000
 
thread_stack_not_full:
add [thread_stack], 0x2000 ; start new thread
mov eax, 51
mov ebx, 1
mov ecx, thread
mov edx, [thread_stack]
int 0x40
 
jmp searchexit
 
 
mouse: ; MOUSE EVENT HANDLER
mov eax, 37
mov ebx, 2
int 0x40
test eax, eax ; check buttons state
jnz click
mov eax, 37
mov ebx, 1
int 0x40
ror eax, 16 ; eax = [ Y | X ] relative to window
cmp ax, 140 ; pointer in window?
ja noinwindow
;  in window 
 
shr eax, 16 ; eax = [ 0 | Y ]
xor edx, edx
mov ebx, BTN_HEIGHT
div ebx
inc eax ; number of "button" in eax
movzx ebx, [edi + rows] ; total strings in ebx
cmp eax, ebx
ja noinwindow
cmp [edi + cur_sel], al
je noredrawbut
mov bl, [edi + cur_sel]
 
;;;;;;
cmp [edi + child], 0
jne noredrawbut
;;;;;;
 
mov [edi + cur_sel], al
mov [edi + prev_sel], bl
redrawbut:
call draw_only_needed_buttons
noredrawbut:
call backconvert
bts [mousemask], eax
jmp still
noinwindow:
call backconvert
btr [mousemask], eax
jmp still
click:
cmp [mousemask], 0 ; not in a window (i.e. menu)
je close
jmp still
 
 
close:
or eax, -1 ; close this thread
mov [edi + child], al ; my child is not mine
int 0x40
 
 
backconvert: ; convert from pointer to process id
mov eax, edi
sub eax, menu_data
shr eax, 4
ret
 
 
;==================================
; get_number
; load number from [edi] to ebx
;==================================
get_number:
push edi
 
xor eax, eax
xor ebx, ebx
 
.get_next_char:
mov al, [edi]
inc edi
cmp al, '0'
jb .finish
cmp al, '9'
ja .finish
sub al, '0'
imul ebx, 10
add ebx, eax
jmp .get_next_char
 
.finish:
pop edi
ret
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
 
mov eax, 12 ; function 12:tell os about windowdraw
mov ebx, 1 ; 1, start of draw
int 0x40
 
movzx ebx, [edi + rows]
imul eax, ebx, BTN_HEIGHT ; eax = height of window
movzx ecx, [edi + y_end]
sub ecx, eax ; ecx = Y_START
shl ecx, 16
add ecx, eax ; ecx = [ Y_START | Y_SIZE ]
dec ecx
movzx ebx, [edi + x_start]
shl ebx, 16
mov bx, 140 ; ebx = [ X_START | X_SIZE ]
xor eax, eax ; function 0 : define and draw window
mov edx, 0x01000000 ; color of work area RRGGBB,8->color gl
mov esi, edx ; unmovable window
int 0x40
 
call draw_all_buttons
 
mov eax,12
mov ebx,2
int 0x40
 
ret
 
 
draw_all_buttons:
xor edx, edx
.new_button:
call draw_one_button
inc edx
cmp dl, [edi + rows]
jb .new_button
 
ret
 
 
draw_only_needed_buttons:
xor edx, edx
mov dl, [edi + cur_sel]
dec dl
call draw_one_button
mov dl, [edi + prev_sel]
dec dl
call draw_one_button
ret
 
 
draw_one_button:
; receives number of button in dl
push edx;ad
 
mov eax, 8
mov ebx, 140
movzx ecx, dl
imul ecx, BTN_HEIGHT
shl ecx, 16
add ecx, BTN_HEIGHT-1
; edx = button identifier
mov esi, [sc.work]
inc dl
cmp [edi + cur_sel], dl
jne .nohighlight
add esi, 0x101010
.nohighlight:
or edx, 0x20000000
int 0x40
movzx edx, dl
 
dec dl
imul ebx, edx, BTN_HEIGHT
add ebx, (4 shl 16) + TXT_Y
 
movzx ecx, dl
inc ecx
mov edx, [edi + pointer]
.findline:
cmp byte [edx], 13
je .linefound
inc edx
jmp .findline
.linefound:
inc edx
cmp byte [edx], 10
jne .findline
dec ecx
jnz .findline
 
mov ecx, [sc.work_text]
mov eax, 4
mov esi, 21
int 0x40
 
pop edx;ad
ret
 
 
searchstartstring:
mov ecx, 40
mov al, 13
cld
repne scasb
cmp byte [edi], 10
jne searchstartstring
ret
 
 
;*** DATA AREA ****************************************************************
 
thread_stack dd 0xE000
processes dd 0
 
fileinfo:
.subfunction dd 0 ; 0=READ
.start dd 0 ; start byte
.size_high dd 0 ; rezerved
.size dd 0x10000-mem_end ; blocks to read
.return dd mem_end ; return data pointer
.name:
db '/HD0/1/KOLIBRI/ETC/MENU.DAT',0 ; ASCIIZ dir & filename
 
fileinfo_start:
.subfunction dd 7 ; 7=START APPLICATION
.flags dd 0 ; flags
.params dd 0x0 ; nop
.rezerved dd 0x0 ; nop
.rezerved_1 dd 0x0 ; nop
.name:
times 50 db ' '
 
I_END:
 
close_now dd ? ; close all processes immediately
end_pointer dd ?
buffer dd ?
mousemask dd ? ; mask for mouse pointer location
 
sc system_colors
 
menu_data:
rb 0x4000 ;x10000
 
virtual at 0 ; PROCESSES TABLE (located at menu_data)
pointer dd ? ; +0 pointer in file
rows db ? ; +4 numer of strings
x_start dw ? ; +5 x start
y_end dw ? ; +7 y end
child db ? ; +9 id of child menu
parent db ? ; +10 id of parent menu
cur_sel db ? ; +11 current selection
prev_sel db ? ; +12 previous selection
rb 16-$+1 ; [16 bytes per element]
end virtual
 
mem_end:
/kernel/branches/hd_kolibri/apps/menu/readme.txt
0,0 → 1,73
English text is below
ÍÎÂÎÅ ÃËÀÂÍÎÅ ÌÅÍÞ.
Âíèìàíèå: äëÿ êîððåêòíîé ðàáîòû ðåêîìåíäóåòñÿ MENUET íå íèæå 0.76
è öâåòíîé ìîíèòîð (íà ìîíîõðîìíîì ïîäñâåòêà íå âèäíà)
 
Îòëè÷èÿ îò Âèëëèíîãî ìåíþ:
1.Êîíôèãóðèðóåìîñòü. Ïóíêòû êàê îñíîâíîãî, òàê è äîïîëíèòåëüíûõ
ìåíþøåê çàäàþòñÿ ôàéëîì MENU.DAT.
Ýòî ïîçâîëÿåò:
-äîáàâëÿòü/óáèðàòü ëþáûå ïóíêòû â ìåíþ. Ïðîãðàììà ñàìà àíàëèçèðóåò
èçìåíåíèÿ è ðèñóåò îêíî ñ êíîïêàìè ïî êîëè÷åñòâó ïóíêòîâ. äàëüíåéøåì
èìõî ýòî ïîçâîëèò êîíôèãóðèðîâàòü ìåíþ íå òîëüêî âðó÷íóþ, íî è ïðîã-
ðàììíî. Íèêàêîãî âìåøàòåëüñòâà â êîä, ÷òî ïîçâîëÿåò êîíôèãóðèòü ìåíþ
è ïðîñòûì ïîëüçîâàòåëÿì.
-ïåðåâîäèòü ìåíþ íà ëþáûå ÿçûêè, íå ëàçÿ â êîä.
-ïîñêîëüêó çàïóñê ïðèëîæåíèé ÷åðåç 58-þ ôóíêöèþ, ïðèëîæåíèÿ ìîãóò íàõîäèòü-
ñÿ íå òîëüêî íà ðàìäèñêå.
2.Âåùèöà, ñîâñåì íå èíòåðåñíàÿ äëÿ ïîëüçîâàòåëåé, íî âîçìîæíî
ïðåäñòàâëÿþùàÿ èíòåðåñ äëÿ ïðîãðàììèñòîâ. Ïðèëîæåíèå ìíîãîïîòî÷íîå, íî âñå
ïîòîêè çàïóñêàþòñÿ íà îäíîì è òîì æå êîäå. Ýòî ïîçâîëèëî çàìåíèòü èñïîë-
íÿåìûå ôàéëû MENU, SELECT1, SELECT2 è ò.ä. îäíèì-åäèíñòâåííûì MENU
è ñèëüíî ñýêîíîìèòü ìåñòî íà äèñêå.
3.Ñàìîóíè÷òîæàåìîñòü ìåíþ ïðè êëèêå çà åãî ïðåäåëàìè è ïðè çàïóñêå ïðèëîæåíèÿ
4.Êíîïêè, ïîäñâå÷èâàåìûå ïðè íàâåäåíèè íà íèõ ìûøüþ (íà ìîíîõðîìíîì ìîíèòîðå
ïîäñâåòêà íå âèäíà).
5.Ïîääåðæêà êëàâèàòóðû. Êíîïêè Ââåðõ, Âíèç, Enter è Esc.
 îáùåì, ïîñòàðàëñÿ ïðèáëèçèòüñÿ ê âèíäîâñêîé ìåíþøêå.
 
Çàìå÷àíèÿ ïî ñèíòàêñèñó ôàéëà MENU.DAT:
Ðàçìåð ôàéëà MENU.DAT-íå áîëåå 2Ê
Ìåíþ #0-âñåãäà ãëàâíîå.
Êîëè÷åñòâî ìåíþ-íå áîëåå 10 - îò #0 äî #9
 êàæäîé ñòðîêå ëèáî ïóòü íà èñïîëíÿåìûé ôàéë, ëèáî ññûëêà íà äî÷åðíåå
ìåíþ, íàïðèìåð /@5
Ìàðêåð êîíöà ## îáÿçàòåëåí (âíèìàíèå! TINYPAD áûâàåò åãî îáðåçàåò)
Ïîä òåêñò íà ìåíþøíûõ êíîïêàõ îòâîäÿòñÿ ïåðâûå 20 ïîçèöèé êàæäîé ñòðîêè
Êàæäàÿ ñòðîêà îòäåëÿåòñÿ ENTERîì, ò.å. äîëæíû ïðèñóòñòâîâàòü çíàêè ïåðå-
âîäà ñòðîêè 0x0d,0x0a
 
Ïðîãà Î×ÅÍÜ ñûðàÿ, ïîýòîìó ïðîñüáà íå óäèâëÿòüñÿ, åñëè ÷òî-íèòü íå áóäåò
ðàáîòàòü. Ñ ôàéëîì MENU.DAT ïðîñüáà îáðàùàòüñÿ î÷åíü îñòîðîæíî. TINYPAD
èíîãäà åãî êàëå÷èò. Îñîáåííî ìàðêåð êîíöà ôàéëà!
Èñïîëíÿåìûé ôàéë î÷åíü ðåêîìåíäóåòñÿ íàçâàòü MENU. (ïðè êîìïèëÿöèè)
Òîãäà îí áóäåò âûçûâàòüñÿ èç ïàíåëè êàê è ïîëîæåíî.
Âñå çàìå÷àíèÿ è ïðåäëîæåíèÿ ñ óäîâîëüñòâèåì ïðèíèìàþòñÿ íà lisovin@26.ru
Ïðèàòòà÷åííûå ôàéëû ñëåäóåò âûñûëàòü íà mutny@rambler.ru
Ñ óâàæåíèåì,
Ìèõàèë Ëèñîâèí
 
NEW MAIN MENU
Requirements: MENUET 0.76, color monitor
WHAT'S NEW?
1.Self-configuring menu. All the configurational data is in MENU.DAT
You may add/remove menu positions, translate menu to any language,
run menu applications from HDD without source code change.
2.Multi-thread application. There're two files only: MENU and MENU.DAT
instead of MENU, SELECT1, SELECT2, SELECT3 etc.
3.Self-closing when running application or clicking out of menu.
4.Button highlight
5.Keyboard support (keys Up, Dn, Enter, Esc.)
So, it's just like Windows menu ;)
NOTES ON MENU.DAT:
Size of MENU.DAT should be not more than 2K
Number of menus-not more than 10 (from #0 to #9). #0 is always main menu
## is an end file marker - always required.
First 20 positions of any string reserved for button text
Any string contains file path or link to submenu, for example /@4.
You may edit MENU.DAT by any text editor, but be careful when using
TINYPAD (sometimes it cuts end marker).
It is recommended to compile MMENU.ASM as MENU. So, you can run it from
standard panel.
All the comments and bugreports send to lisovin@26.ru
Michail Lisovin.
/kernel/branches/hd_kolibri/apps/menu/readme2.txt
0,0 → 1,6
Changes:
11.07.06 - Mario79, application used function 70.
Earlier changes were made:
Ivan Poddubny, Mario79 and Halyavin
 
 
/kernel/branches/hd_kolibri/apps/panel/@PANEL.ASM
0,0 → 1,2089
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; MENUBAR for KolibriOS - Compile with fasm ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; program start
dd I_END ; program image size
dd 0xA000 ; reguired amount of memory - 10 Kb
dd 0xA000 ; esp
dd 0x0,0x0 ; param, icon
 
include 'lang.inc'
include 'macros.inc'
 
width dd 305
buttons dd 1 ; 0 no frames ; 1 frames
soften_up dd 1 ; 0 no ; 1 yes
soften_down dd 0 ; 0 no ; 1 yes
minimize_left dd 1
minimize_right dd 1
icons_position dd 95
menu_enable dd 1
setup_enable dd 0
graph_text dd 1
soften_middle dd 1 ; 0 no ; 1 yes
icons dd 1 ; 0 defaults ; 1 activate
 
PANEL_HEIGHT = 18
 
handle_key:
 
mcall 18, 7
mov [active_process],eax
 
mcall 2
cmp al, 2
jnz begin_1.ret
mov ebx, exec_fileinfo
shr eax, 8
cmp al, 15
jz alt_tab_pressed
cmp al, 88
jz start_end_application
cmp al, 91
jz start_menu_application
cmp al, 92
jz start_menu_application
cmp al, 62
jz kill_active_application
cmp al, 71
jz page_list_next
cmp al, 72
jz page_list_prev
cmp [current_alt_tab_app], -1
jz @f
test ah, 0x30
jz alt_tab_released
@@:
; this is hotkey Ctrl+Shift ;or LShift+RShift
mov ebx, setup_exec
; test ah, 001100b
; jz change_sys_lang
change_key_lang:
mov dword [ebx+8], chlang
mcall 70
call chlang_music
; mcall 5, 25
begin_1:
mov ecx,[active_process]
mcall 18, 3
mcall 5, 25
.ret:
ret
 
;change_sys_lang:
; mov dword [ebx+8], syslang
; mcall 70
; call syslang_music
;; mcall 5, 25
; jmp begin_1
 
start_end_application:
mov dword [ebx+21], end_name
mcall 70
mcall 5 ,50
jmp begin_1.ret
 
kill_active_application:
mcall 18, 7
mov ecx,eax
; mcall 9, area9
; mov eax,area9
; mov ecx,[eax+4]
mcall 18, 2
jmp begin_1.ret
 
start_menu_application:
mov [draw_window_1], 1
mov dword [ebx+21], menu_name
mcall 70
call menu_music
mcall 5,50
jmp begin_1.ret
 
page_list_next:
cmp [page_list],15
je @f
inc [page_list]
mov [draw_window_1],1
@@:
jmp begin_1.ret
 
page_list_prev:
cmp [page_list],0
je @f
dec [page_list]
mov [draw_window_1],1
@@:
jmp begin_1.ret
 
alt_tab_pressed:
; handle Alt+Tab and Alt+Shift+Tab
mov ebp, eax
cmp [current_alt_tab_app], -1
jnz has_alt_tab_app
; § ¯®«­ï¥¬ â ¡«¨æ㠯ਫ®¦¥­¨©, ¯®¤«¥¦ é¨å ¯¥à¥ª«î祭¨î
xor edx, edx
mov ebx, 0x8000
mov ecx, 1
mov eax, 9
.fill:
inc ecx
int 0x40
call need_window_tab
jz @f
cmp edx, 256
jz @f
mov [alt_tab_list+edx*8], ecx
movzx esi, word [ebx+4]
mov [alt_tab_list+edx*8+4], esi
inc edx
@@:
cmp ecx, eax
mov eax, 9
jb .fill
mov [alt_tab_list_size], edx
cmp edx, 2
jb begin_1.ret
mcall 66,4,0,0 ; «®¢¨¬ ¬®¬¥­â ®â¯ã᪠­¨ï ¢á¥å ã¯à ¢«ïîé¨å ª« ¢¨è
test eax, eax
jnz begin_1.ret
xor edx, edx
mov eax, [alt_tab_list+4]
xor ecx, ecx
inc ecx
.findmax:
cmp [alt_tab_list+ecx*8+4], eax
jb @f
mov edx, ecx
mov eax, [alt_tab_list+ecx*8+4]
@@:
inc ecx
cmp ecx, [alt_tab_list_size]
jb .findmax
mov [current_alt_tab_app], edx
has_alt_tab_app:
mov eax, [current_alt_tab_app]
mov edx, [alt_tab_list+eax*8+4] ; slot
xor ecx, ecx
or eax, -1
test ebp, 300h
jz .notshift
or esi, -1
.loop1:
cmp [alt_tab_list+ecx*8+4], edx
jbe @f
cmp [alt_tab_list+ecx*8+4], esi
jae @f
mov eax, ecx
mov esi, [alt_tab_list+ecx*8+4]
@@:
inc ecx
cmp ecx, [alt_tab_list_size]
jb .loop1
cmp eax, -1
jnz .found
xor edx, edx
xor ecx, ecx
jmp .loop1
.notshift:
xor esi, esi
.loop2:
cmp [alt_tab_list+ecx*8+4], edx
jae @f
cmp [alt_tab_list+ecx*8+4], esi
jbe @f
mov eax, ecx
mov esi, [alt_tab_list+ecx*8+4]
@@:
inc ecx
cmp ecx, [alt_tab_list_size]
jb .loop2
cmp eax, -1
jnz .found
or edx, -1
xor ecx, ecx
jmp .loop2
.found:
mov [current_alt_tab_app], eax
push eax
xor edx, edx
div [max_applications]
mov [page_list], eax
mov [draw_window_1], 1
mov edi, app_list
push edi
mov ecx, 20
or eax, -1
rep stosd
pop edi
pop ecx
sub ecx, edx
@@:
cmp ecx, [alt_tab_list_size]
jae redraw_window_tabs
mov eax, [alt_tab_list+ecx*8]
stosd
inc ecx
jmp @b
 
alt_tab_released:
mcall 66,5,0,0 ; 㦥 ¯®©¬ «¨, 墠â¨â :)
or eax, -1
xchg eax, [current_alt_tab_app]
mov ecx, [alt_tab_list+eax*8]
mov eax, 18
mov ebx, 3
int 0x40
jmp redraw_window_tabs
 
active_process dd 0
 
calendar_music:
mcall 55, eax, , , calendarmusic
ret
setup_music:
mcall 55,eax, , ,setupmusic
ret
sysmeter_music:
mcall 55,eax, , ,sysmetermusic
ret
button_music:
mcall 55,eax, , ,buttonmusic
ret
;syslang_music:
; mcall 55, eax, , , syslangmusic
; ret
chlang_music:
mcall 55, eax, , , chlangmusic
ret
menu_music:
mcall 55,eax, , ,menumusic
ret
 
chlangmusic: db 0x82,0x60,0x83,0x65,0x82,0x60,0
 
;syslangmusic: db 0x82,0x65,0x83,0x70,0x82,0x65,0
 
menumusic: db 0x82,0x50,0x84,0x48,0x82,0x50,0x84,0x53,0x82,0x51,0
 
activatemusic: db 0x83,0x30,0x85,0x60,0
 
buttonmusic: db 0x85,0x25,0x85,0x40,0
 
sysmetermusic: db 0x85,0x35,0x85,0x45,0
 
setupmusic: db 0x85,0x40,0x85,0x50,0
 
calendarmusic: db 0x85,0x37,0x85,0x48,0
 
; .exit: mcall -1
 
 
START:
mcall 66,4,0,2 ; LShift+RShift
mcall 66, , ,11h ; Ctrl+Shift
mcall 66,,88,110h ; Alt+Ctrl+F12
mcall 66,,91,100h ; Alt+LWin
mcall 66,,92 ; Alt+RWin
mcall 66,,62 ; Alt+F4
mcall 66,,71 ; Alt+Home
mcall 66,,72 ; Alt+Up
mcall 66,,15 ; Alt+Tab
mcall 66,,,101h ; Alt+Shift+Tab
mcall 18, 8, 1
test eax, eax
jne @f
mcall 18, 8, 2
@@:
mov eax, 70
mov ebx, dat_fileinfo
int 0x40
 
mov edi,width
mov esi,I_END
xor eax,eax
new_number:
cmp [esi],byte ';'
je number_ready
imul eax,10
movzx ebx,byte [esi]
sub ebx,'0'
add eax,ebx
inc esi
jmp new_number
number_ready:
stosd
xor eax,eax
inc esi
cmp [esi],byte 'x'
jne new_number
 
mcall 14
mov [screen_size],eax
 
mcall 48,5
mov ecx,eax
lea edx,[ebx-PANEL_HEIGHT-1]
mcall 48,6
 
call set_variables
 
start_after_minimize:
 
call draw_window
call draw_info
call draw_running_applications
 
mov eax, 23
mov ebx, 30
int 0x40
 
still:
; mcall 13,<390,70>,<3,11>,0xffffff
; mov ecx,[button_presssed_alt]
; mcall 47,0x80100,ecx ,400 shl 16+5,0
 
call draw_info
call draw_running_applications
 
mov eax, 23
mov ebx, 20
int 0x40
 
cmp eax,1 ; redraw ?
jz red
cmp eax,3 ; button ?
jz button
call handle_key
jmp still
 
red: ; redraw window
 
mcall 14
movzx ecx,ax
mov edx,eax
shr edx,16
cmp [screen_size.height],ax
jne @f
rol eax,16
cmp [screen_size.width],ax
je .lp1
rol eax,16
@@: mov [screen_size],eax
sub ecx,PANEL_HEIGHT
mcall 67,0,,,PANEL_HEIGHT
 
.lp1:
call draw_window
call draw_info
jmp still
 
button: ; button
mov eax,17
int 0x40
 
cmp ah,50
jb no_activate
cmp ah,70
jg no_activate
 
movzx ecx,byte ah
sub ecx,52
shl ecx,2
 
mov eax,18
mov ebx,3
mov ecx,[app_list+ecx]
int 0x40
; cmp [music_type],0
; je still
mcall 55,eax, , ,activatemusic
jmp still
no_activate:
 
 
cmp ah,101 ; minimize to left
je left_button
 
cmp ah,102 ; minimize to right
je right_button
 
cmp ah,byte 1 ; start/terminate menu
jnz noselect
call menu_handler
; cmp [music_type],0
; je still
call menu_music
jmp still
noselect:
 
mov ebx, exec_fileinfo
cmp ah,byte 2 ; start calendar
jnz noid15 ;noclock
mov dword [ebx+21], calendar_name
mov eax, 70
int 0x40
call calendar_music
jmp still
 
noid15:
cmp ah,16
jne noid16
mov ebx, setup_exec
mov dword [ebx+8], chlang
mov eax, 70
int 0x40
call chlang_music
mcall 5, 25
jmp still
 
noid16:
; cmp ah,17
; jne noid17
; mov ebx, setup_exec
; mov dword [ebx+8], syslang
; mov eax, 70
; int 0x40
; call syslang_music
; mcall 5, 25
; jmp still
;
; noid17:
cmp ah,18
jne noid18
mov dword [ebx+21], sysmeter_name
mov eax, 70
int 0x40
call sysmeter_music
jmp still
 
noid18:
cmp ah,19
jne noid19
; inc [music_type]
; and [music_type],1
mcall 18,8,2
; mcall 18,8
; mov [sound_flag],al
 
; mcall 15,4,2
mcall 15,3
jmp red
 
noid19:
cmp ah,20 ; start system setup
jnz noid20
mov ebx, setup_exec
and dword [ebx+8], 0
mov eax, 70
int 0x40
call setup_music
jmp still
 
noid20:
cmp ah,21
jnz noid21
cmp [page_list],15
je @f
inc [page_list]
jmp red
@@:
jmp still
 
noid21:
cmp ah,22
jnz noid22
cmp [page_list],0
je @f
dec [page_list]
jmp red
@@:
jmp still
 
noid22:
 
jmp still
 
 
 
draw_running_applications:
 
pusha
 
cmp [icons],1
jne dr_ret
 
call calculate_applications
 
cmp edi,[running_applications]
jne noret
popa
ret
noret:
 
; cmp edi,[running_applications]
; jge no_application_decrease
call draw_window
; no_application_decrease:
 
mov [running_applications],edi
 
call redraw_window_tabs
 
dr_ret:
 
popa
 
ret
 
need_window_tab:
; in: ebx->process info
; out: ZF set <=> do not draw
cmp byte [ebx+10], '@'
jz .nodraw
; \begin{diamond}[29.03.2007]
; do not draw undefined (zero-sized) windows
cmp dword [ebx+42], 0
jnz @f
cmp dword [ebx+46], 0
jz .nodraw
@@:
; \end{diamond}[29.03.2007]
cmp dword [ebx+10], 'ICON'
jnz @f
cmp [ebx+42], dword 51
jnz @f
cmp [ebx+46], dword 51
jz .nodraw
@@:
cmp [ebx+10], dword ' '
.nodraw:
ret
 
redraw_window_tabs:
xor edi, edi
mov [contrast], 0
.loop:
mov ecx, [app_list+edi*4]
cmp ecx, -1
jz .done
 
push ecx
mov eax, 9
mov ebx, 0x8000
int 0x40
 
mov eax, 13
imul ebx, edi, 6*10*10000h
add ebx, 6*10*10000h + 7*10000h + 54
mov ecx, 3*10000h + 14
xor edx, edx
int 0x40
sub ebx, 10000h + 53
mov ecx, 4*10000h + 12
int 0x40
sub ebx, 10000h
mov ecx, 5*10000h + 10
int 0x40
add ebx, 56*10000h
mov ecx, 4*10000h + 12
int 0x40
add ebx, 10000h
mov ecx, 5*10000h + 10
int 0x40
 
mov edx, 0x88FF
xor [contrast], 1
jz @f
mov dh, 0x55
@@:
pop ecx
mov esi, [current_alt_tab_app]
cmp esi, -1
jz @f
cmp ecx, [alt_tab_list+esi*8]
jnz @f
; xor edx, 0xFFFFFF
mov edx, 0xFF8000
@@:
sub ebx, 55*10000h - 53
mov ecx, 4*10000h + 12
int 0x40
sub ebx, 10000h + 53
mov ecx, 5*10000h + 10
int 0x40
add ebx, 55*10000h
int 0x40
 
mov eax, 4
sub ebx, 51*10000h - 6
mov ecx, 0xffffff ;[wcolor]
mov edx, 0x8000+10
mov esi, 11
int 0x40
 
inc edi
cmp edi, [max_applications]
jb .loop
.done:
ret
 
calculate_applications:
 
mov eax,[max_applications]
mul [page_list]
test eax,eax
je @f
inc eax
@@:
mov [draw_start_position],eax
 
mov edi,app_list
mov ecx,20
mov eax,-1
cld
rep stosd
 
mov edi,0
mov ecx,2
 
cnewpr:
 
mov eax,9
mov ebx,0x8000
int 0x40
 
call need_window_tab
jz cnorpl
sub [draw_start_position], 1
jg cnorpl
 
mov [app_list+edi*4],ecx
 
inc edi
 
cnorpl:
inc ecx
 
cmp eax,ecx
jge cnewpr
 
ret
 
 
draw_application_buttons:
 
pusha
 
cmp [icons],1
jne da_ret
 
mov eax,14
int 0x40
 
shr eax,16
 
cmp eax,639
jne now1
mov [max_applications],7 ;6
now1:
cmp eax,799
jne now2
mov [max_applications],9 ;10 ;8
now2:
cmp eax,1023
jne now3
mov [max_applications],12 ;13 ;8
now3:
cmp eax,1279
jne now4
mov [max_applications],17 ;18 ;8
now4:
mov edi,1
 
nb:
 
mov eax,8
mov ebx,edi
shl ebx,16
imul ebx,6*10 ;13
add ebx,15*65536+10*6-1 ;13
mov ecx,1*65536+17
mov edx,edi
add edx,51
cmp [buttons],1
je bufr
or edx,0x60000000
bufr:
mov esi,[wcolor]
sub ebx,11 shl 16
int 0x40
 
inc edi
cmp edi,[max_applications]
jbe nb
 
da_ret:
 
popa
 
ret
 
 
menu_handler:
mov eax, 70
mov ebx, exec_fileinfo
mov dword [ebx+21], menu_name
int 0x40
ret
 
draw_small_right:
 
pusha
 
mov eax,12
mov ebx,1
int 0x40
 
mov eax,0
mov edx,[wcolor]
mov esi,edx
mov edi,edx
or edx, 0x01000000
int 0x40
 
mov eax,8
mov ebx,0*65536+9
mov ecx,0*65536
mov cx,[b_size_y]
mov edx,1
mov esi,[wcolor]
int 0x40
 
mov eax,4
mov ebx,2*65536+16
cmp [graph_text],1
jne nos3
mov ebx,2*65536+7
nos3:
mov ecx,[wcolor]
add ecx,0x303030
mov edx,hidetext
mov esi,1
int 0x40
 
mov eax,12
mov ebx,2
int 0x40
 
popa
 
ret
 
 
 
draw_small_left:
 
pusha
 
mov eax,12
mov ebx,1
int 0x40
 
mov eax,0
mov edx,[wcolor]
mov esi,edx
mov edi,edx
or edx, 0x01000000
int 0x40
 
cmp [graph_text],1
je nos4
 
mov eax,8
mov ebx,0*65536+9
mov ecx,0*65536+18-6
mov edx,2
mov esi,[wcolor]
int 0x40
 
mov eax,4
mov ebx,2*65536+4
mov ecx,[wcolor]
add ecx,0x303030
mov edx,hidetext+2
mov esi,1
int 0x40
 
nos4:
 
mov eax,8
mov ebx,0*65536+9
mov ecx,13*65536+25
cmp [graph_text],1
jne nos6
mov ecx,0*65536
mov cx,word [b_size_y]
nos6:
mov edx,1
mov esi,[wcolor]
int 0x40
 
mov eax,4
mov ebx,3*65536+22
cmp [graph_text],1
jne nos7
mov ebx,3*65536+7
nos7:
mov ecx,[wcolor]
add ecx,0x303030
mov edx,hidetext+1
mov esi,1
int 0x40
 
mov eax,12
mov ebx,2
int 0x40
 
popa
ret
 
 
;-------------------------------------------------
 
right_button:
 
call button_music
 
mov [small_draw],dword draw_small_right
 
mcall 14
shr eax, 16
mov ebx, eax
mov ecx, -1
mov edx, 9
sub ebx, edx
mov esi, -1
mcall 67
 
call draw_small_right
 
jmp small_wait
 
;-------------------------------------------------
 
left_button:
 
call button_music
 
mov [small_draw],dword draw_small_left
 
mov ebx, 0
mov edx, 9
mov ecx, -1
mov esi, -1
mcall 67
 
call draw_small_left
 
;-------------------------------------------------
 
small_wait:
 
mov eax, 10
int 0x40
 
cmp eax,1
jne no_win
call [small_draw]
jmp small_wait
no_win:
cmp eax,2
jne no_key
call handle_key
jmp small_wait
no_key:
 
mov eax,17
int 0x40
 
cmp ah,1
jne no_full
 
mov eax, 14 ; get screen max x & max y
int 0x40
mov edx, eax
shr edx, 16
xor ebx, ebx
mov ecx, -1
mov esi, -1
mcall 67 ; x0 y0 xs ys
 
call button_music
 
jmp still
 
 
no_full:
 
call menu_handler
 
jmp small_wait
 
 
 
set_variables:
 
pusha
 
mov [b_size_y],dword 38
cmp [graph_text],1
jne noy2
mov [b_size_y],dword 18
noy2:
 
mov [button_frames],0x0
cmp [buttons],0
jne no_frames
mov [button_frames],0x40000000
no_frames:
 
 
mov eax,48 ; 3d button look
mov ebx,1
mov ecx,1
int 0x40
 
mov eax,0x40404040 ; dividers for processes
mov edi,pros
mov ecx,10
cld
rep stosd
 
popa
ret
 
 
 
; eax = number (1 or 2)
; ebx = language id
draw_flag:
pusha
 
; cmp [graph_text],0
; je mini_flag
 
; eax = 2 BIG
; eax = 1 small
 
mov edx,ebx
 
mov ebx,[maxx]
and eax,1
imul eax,17 ;17
sub ebx,eax
sub ebx,76 ;79 ;28
 
pushad
; dec ebx
sub ebx,2
shl ebx, 16
add ebx, 15 ;25
mov ecx, 4*65536+13
mov edx,0
mov eax,13
int 0x40
add ebx,1 shl 16
sub ebx,2
mov ecx, 5 shl 16+11
cmp [type_lang],1
je label_1
mov edx,0xff ;[wcolor]
jmp label_2
label_1:
mov edx,0x7700
label_2:
mov eax, 13
int 0x40
popad
 
shl ebx,16
add ebx,7 ;24
 
mov ecx,[bte] ; color
 
dec edx
shl edx,1
add edx,flag_text
mov esi,2
mov eax,4
int 0x40
 
mov ebx,[maxx]
sub ebx,48
shl ebx,16
mov bx,34
mov ecx,3 shl 16+14
xor edx,edx
mov eax,13
int 0x40
add ebx,1 shl 16
sub ebx,2
mov ecx,4 shl 16+12
mov edx,0x66cc
int 0x40
 
popa
ret
 
;mini_flag:
; popa
; ret
 
 
 
 
; ***************************************************
; ********* WINDOW DEFINITIONS AND DRAW *************
; ***************************************************
 
 
draw_window:
 
pusha
 
mov [running_applications],-1
mov [checks],-1
 
mov eax, 12 ; tell os about redraw
mov ebx, 1
int 0x40
 
mov eax, 48
mov ebx, 3
mov ecx, system_colours
mov edx, 10*4
int 0x40
 
mov eax, [system_colours+4*6]
sub eax, 0x101010
mov [wcolor], eax
 
mov eax,14 ; get screen max x & max y
int 0x40
 
cmp [width],0
je no_def_width
and eax,0xffff
mov ebx,[width]
shl ebx,16
add eax,ebx
no_def_width:
 
mov ebx,eax
mov [screenxy],ebx
shr ebx,16
sub ax,38
shl eax,16
mov ecx,eax
add ecx,0*65536+38
cmp [graph_text],1
jne no_text_1
mov cx,PANEL_HEIGHT
add ecx,20*65536
no_text_1:
mov eax, 0 ; DEFINE AND DRAW WINDOW
mov edx, [wcolor]
or edx, 0x01000000 ; do not draw the window
mov esi, [wcolor]
or esi, 0x01000000 ; unmovable window
mov edi, [wcolor]
int 0x40
 
movzx ebx,word [screenxy+2]
mov ecx,0*65536+0
mov edx,[wcolor]
add edx,0x161616
newline:
sub edx,0x040404
mov eax,38
cmp [soften_up],1
jne no_su
and edx,0x00FFFFFF
int 0x40
no_su:
 
pusha
cmp [soften_down],1
jne no_sd
sub edx,0x141414
mov edi,[b_size_y]
shl edi,16
add edi,[b_size_y]
add ecx,edi
sub ecx,3*65536+3
and edx,0x00FFFFFF
int 0x40
no_sd:
popa
 
add ecx,1*65536+1
cmp cx,5
jb newline
 
cmp [soften_middle],1
jne no_sm
 
movzx ebx,word [screenxy+2]
mov ecx,5*65536+5
mov esi,stripe
mov edx,[wcolor]
newline3:
add edx,[esi]
add esi,4
 
mov eax,38
and edx,0x00FFFFFF
int 0x40
add ecx,1*65536+1
cmp cx,15
jb newline3
 
no_sm:
 
cmp [minimize_left],1
jne no_mleft
mov eax,8 ; ABS LEFT
mov ebx,0 *65536+9
mov ecx,1 *65536
add ecx,[b_size_y]
dec ecx
mov edx,101
add edx,[button_frames]
mov esi,[wcolor]
int 0x40
mov eax,4 ; HIDE TEXT
mov ebx,2*65536+17
cmp [graph_text],1
jne no_y1
mov bx,7
no_y1:
mov ecx,[wcolor]
add ecx,0x303030
mov edx,hidetext
mov esi,1
int 0x40
no_mleft:
 
movzx eax,word [screenxy+2]
mov [maxx],eax
 
cmp [minimize_right],1
jne no_mright
mov eax,[maxx]
sub eax,77
shl eax,16
mov ebx,eax
add ebx,67
mov eax,8 ; ABS RIGHT
mov ecx,1 *65536
add ecx,[b_size_y]
dec ecx
add ebx,68*65536
mov bx,9
mov edx,102
add edx,[button_frames]
mov esi,[wcolor]
int 0x40
mov edx,hidetext+1
mov eax,4
mov ebx,[maxx]
sub ebx,6
shl ebx,16
mov bx,17
cmp [graph_text],1
jne no_y2
mov bx,7
no_y2:
mov ecx,[wcolor]
add ecx,0x303030
mov esi,1
int 0x40
no_mright:
 
call draw_menuet_icon
 
call draw_program_icons
 
mov [ptime],0
call draw_info
 
call draw_application_buttons
 
; mov ecx,[button_presssed_alt]
; mcall 47,0x80100,ecx ,400 shl 16+5,0
 
mov eax,12
mov ebx,2
int 0x40
 
popa
ret
 
 
 
draw_menuet_icon:
 
pusha
 
cmp [menu_enable],1
jne no_menu
 
 
mov eax, 8 ; M BUTTON
mov ebx, 10*65536 + 47
cmp [minimize_left], 0
jne @f
sub ebx, 10*65536
@@:
mov ecx, 1*65536
add ecx, [b_size_y]
dec ecx
mov edx, 0x20000001
add edx, [button_frames]
mov esi, [wcolor]
int 0x40
 
cmp [graph_text], 1
jne no_mtext
 
push ebx
mov eax,13
mov ebx,12 shl 16+44 ;51
mov ecx,1 shl 16+17
xor edx,edx
int 0x40
; mov ebx,63 shl 16+1
mov ebx,56 shl 16+1
mov ecx,2 shl 16+15
int 0x40
mov ebx,57 shl 16+1
mov ecx,4 shl 16+11
int 0x40
mov ebx,58 shl 16+1
mov ecx,6 shl 16+7
int 0x40
; mov ebx,66 shl 16+1
; mov ecx,9 shl 16+1
; int 0x40
mov ebx,13 shl 16+43 ;50
mov ecx,2 shl 16+15
mov edx,0x7700
int 0x40
; mov ebx,62 shl 16+1
; mov ecx,3 shl 16+14
; int 0x40
mov ebx,56 shl 16+1
mov ecx,4 shl 16+11
int 0x40
mov ebx,57 shl 16+1
mov ecx,6 shl 16+7
int 0x40
pop ebx
 
mov eax, 4
mov bx, 7
add ebx, 8*65536
mov ecx, 0x10ffffff
mov edx, m_text
mov esi, 4
int 0x40
 
popa
ret
 
no_mtext:
 
 
 
mov eax,[wcolor]
mov [m_icon+4],eax
 
; load & display menuet.bmp
mov eax, 70
mov ebx, m_bmp_fileinfo
int 0x40
 
mov eax,40
mov ebx,0
mov edi,image+53
 
new_m_pix:
 
; movzx ecx,byte [edi]
; shr ecx,5
 
cmp byte [edi], 10
jb nopix
cmp byte [edi+1], 10
jb nopix
cmp byte [edi+2], 10
jb nopix
 
pusha
cmp [minimize_left],0
jne no_m_s2
sub ebx,10
no_m_s2:
; mov edx,[ecx*4+m_icon]
mov edx,[edi+1]
 
mov ecx,eax
mov eax,1
add ebx,12
int 0x40
popa
 
nopix:
 
add edi,3
add ebx,1
cmp ebx,40
jnz new_m_pix
 
mov ebx,0
dec eax
jnz new_m_pix
 
no_menu:
 
popa
ret
 
 
draw_program_icons:
 
pusha
 
cmp [icons],0
jne dp_ret
 
mov edi,1
push edi
 
new_icon_file:
 
pusha
mov edx,[esp+32]
add edx,10
push edx
mov esi,[wcolor]
mov ecx,1*65536
add ecx,[b_size_y]
dec ecx
mov eax,edi
dec eax
imul eax,40
mov ebx,eax
add ebx,[icons_position]
shl ebx,16
mov bx,39
pop edx
add edx,[button_frames]
or edx, 0x20000000
mov eax,8
int 0x40
popa
 
mov ecx,[esp]
add ecx,48
mov [iconf+6],cl
 
mov eax, 70
mov ebx, iconf_fileinfo
int 0x40
 
mov eax,0
mov ebx,32
mov edi,image+51+32*33*3
 
np2: ; new pixel of file
 
mov edx,[edi]
and edx,0xffffff
 
cmp eax,3 ; Y draw limits
jb nopix2
cmp eax,36
jg nopix2
cmp ebx,38 ; X draw limits
jg nopix2
cmp ebx,2
jb nopix2
 
cmp edx,0
jz nopix2
 
cmp [graph_text],1
jne no_icon_text
 
pusha
 
mov ebx,[esp+32]
dec ebx
imul ebx,40
add ebx,8
add ebx,[icons_position]
shl ebx,16
mov bx,7
 
mov eax,4
mov ecx,0xffffff
mov edx,[esp+32]
dec edx
imul edx,4
add edx,mi_text
mov esi,4
int 0x40
 
popa
 
jmp nopix2
 
no_icon_text:
 
mov esi,[esp]
pusha
push edx
mov ecx,eax
add ecx,2
mov eax,esi
dec eax
imul eax,40
add ebx,eax
add ebx,3
add ebx,[icons_position]
pop edx
mov eax,1
int 0x40
popa
 
nopix2:
 
sub edi,3
dec ebx
jnz np2
 
mov ebx,32
add eax,1
cmp eax,32
jnz np2
 
add dword [esp],1
mov edi,[esp]
cmp dword [esp],4
jbe new_icon_file
add esp,4
 
mov eax,4
mov ebx,40
imul ebx,3
add ebx,[icons_position]
add ebx,10
shl ebx,16
mov bx,23
mov ecx,[wcolor]
mov edx,gpl
mov esi,3
int 0x40
 
dp_ret:
 
popa
ret
 
 
 
draw_info: ; draw cpu usage, time, date
 
pusha
 
cmp [setup_enable],1
jne no_setup
 
cmp [minimize_right],0
jne no_m_r
add [maxx],10
 
no_m_r:
 
mov eax,3
int 0x40
cmp eax,[ptime]
jz _ret
mov [ptime],eax
 
call draw_cpu_usage
 
mov eax,[maxx] ; blink sec
sub eax,33
shl eax,16
mov ebx,eax
add ebx,9
mov eax,3
int 0x40
cmp [graph_text],1
jne no_y4
sub bx,2
no_y4:
mov ecx,eax
shr ecx,16
and ecx,1
mov edx,[bte]
sub edx,[wcolor]
imul ecx,edx
add ecx,[wcolor]
mov edx,sec
mov eax,4
mov esi,1
int 0x40
 
 
; mov eax,26 ; check for change in time or country
; mov ebx,5
; int 0x40
; mov edx,eax
mov eax,26
mov ebx,2
mov ecx,9
int 0x40
; add edx,eax
mov edx,eax
mov eax,3
int 0x40
and eax,0xffff
add edx,eax
cmp edx,[checks]
je _ret
mov [checks],edx
 
mov ebx,[maxx]
sub ebx,48 ;;94 ;;74
shl ebx,16
add ebx,33 ;;84 ;;64
 
mov eax,8 ; time/date button
mov ecx,3 *65536
add ecx,[b_size_y]
; dec ecx
sub cx,5
mov edx,2+0x20000000
mov esi,[wcolor]
int 0x40
pusha
mov eax,13
add ebx,10*65536-16
add ecx,5*65536-8
mov edx,[wcolor]
int 0x40
popa
and edx,0xffff
add edx,[button_frames]
int 0x40
 
mov eax,8
mov ebx,[maxx]
sub ebx,77 ;80
shl ebx,16
add ebx,12
mov ecx,5 shl 16+10
mov edx,16+0x20000000 ;button 16
mov esi,[wcolor]
int 0x40
sub ebx,17 shl 16
inc edx ;button 17
; int 0x40
add ebx,33 shl 16
mov bx,8
inc edx ;button 18
int 0x40
sub ebx,30 shl 16
mov bx,10
inc edx ;button 19
int 0x40
sub ebx,14 shl 16
inc edx ;button 20
int 0x40
sub ebx,12 shl 16
mov bx,8
mov ecx,6 shl 16+10
inc edx ;button 21
int 0x40
sub ebx,18 shl 16
inc edx ;button 22
int 0x40
 
; flags
 
; mov eax,26
; mov ebx,5
; int 0x40
; mov ebx,eax
;
; mov eax,1
; mov [type_lang],al
; call draw_flag
 
mov eax,26
mov ebx,2
mov ecx,9
int 0x40
mov ebx,eax
 
mov eax,2
mov [type_lang],al
call draw_flag
 
mcall 18,8,1
mov [sound_flag],al
 
mov ebx,[maxx]
sub ebx,92 ;109 ;112 ;28
shl ebx,16
mov bx,12
mov ecx, 4*65536+13
mov edx,0
mov eax,13
int 0x40
add ebx,1 shl 16
sub bx,2
mov ecx,5 shl 16+11
mov edx,0xcc
int 0x40
add ebx,1 shl 16
mov bx,5
mov ecx,8 shl 16+5
mov edx,0xdddd00
int 0x40
add ebx,5 shl 16
mov bx,1
mov ecx,7 shl 16+7
int 0x40
add ebx,1 shl 16
mov ecx,6 shl 16+9
int 0x40
add ebx,1 shl 16
mov ecx,5 shl 16+11
int 0x40
 
; cmp [music_type],0
; jne dalshe
cmp [sound_flag],0
je dalshe
 
sub ebx,8 shl 16
ror ebx,16
mov cx,bx
rol ebx,16
mov bx,cx
add bx,8
mov ecx,5 shl 16+15
mov edx,0xff0000
mov eax,38
int 0x40
add ebx,1 shl 16
inc bx
int 0x40
rol ecx,16
int 0x40
sub ebx,1 shl 16
dec bx
int 0x40
 
dalshe:
 
mov ebx,[maxx]
sub ebx,106;123
shl ebx,16
mov bx,12
mov ecx, 4*65536+13
mov edx,0
mov eax,13
int 0x40
add ebx,1 shl 16
sub bx,2
mov ecx,5 shl 16+11
mov edx,0xffcc00
int 0x40
mov eax,4
mov ebx,[maxx]
sub ebx,104;121
shl ebx,16
mov bx,7
mov ecx,0x10000000
mov edx,file_sys
mov esi,1
int 0x40
add ebx,1 shl 16
int 0x40
 
mov edx,0
mov eax,13
mov ebx,[maxx]
sub ebx,117;134
shl ebx,16
mov bx,9
mov ecx,6 shl 16+11
int 0x40
sub ebx,18 shl 16
int 0x40
add ebx,19 shl 16
sub bx,2
mov ecx,7 shl 16+9
mov edx,0xffffff
int 0x40
sub ebx,18 shl 16
int 0x40
 
mov eax,4
mov edx,page_a1
mov ebx,[maxx]
sub ebx,133;150
shl ebx,16
mov bx,8
mov esi,4
int 0x40
add ebx,1 shl 16
int 0x40
 
mov eax,47
mov ebx,0x10100
mov ecx,[page_list]
mov edx,[maxx]
sub edx,124;141
shl edx,16
mov dx,7
mov esi,0xffffff
int 0x40
 
; sub ebx,14 shl 16
; mov bx,7
; mov edx,turn_text
; mov esi,1
 
; mov ecx,0x60a060 ;[wcolor]
; add ecx,0x303030
; mov eax,4
; int 0x40
; add ebx,1 shl 16
; int 0x40
; add ebx,1 shl 16
; int 0x40
; add ebx,1 shl 16
; int 0x40
 
; add ebx,1 shl 16
; mov ecx,0x60a060 ;[wcolor]
; int 0x40
; add ebx,1 shl 16
; int 0x40
; add ebx,1 shl 16
; sub ecx,0x303030
; int 0x40
 
; sub ebx,6 shl 16
; mov bx,1
; mov ecx,2 shl 16+15
; mov edx,0x60a060 ;[wcolor]
; add edx,0x303030
; mov eax,13
; int 0x40
; add ebx,1 shl 16
; mov bx,1
; mov edx,0x60a060 ;[wcolor]
; int 0x40
; add ebx,1 shl 16
; mov bx,1
; sub edx,0x303030
; int 0x40
; add ebx,1 shl 16
; mov edx,[wcolor]
; int 0x40
 
mov eax,3 ; get time
int 0x40
 
movzx ebx,al
shr eax,8
movzx ecx,al
shr eax,8
movzx edx,al
 
; ebx ecx edx h m s
 
push ebx
push ecx
 
mov eax,[maxx]
sub eax,32
shl eax,16
mov ebx,eax
add ebx,9
 
mov ecx,[bte]
 
cmp [graph_text],1
jne no_y3
sub bx,2
mov ecx,0xffffff
no_y3:
 
 
mov edx,[esp] ; __:_X
and edx,15
mov eax,4
add ebx,10*65536
add edx,text
mov esi,1
int 0x40
 
pop edx ; __:X_
shr edx,4
and edx,15
mov eax,4
sub ebx,6*65536
add edx,text
mov esi,1
int 0x40
 
mov edx,[esp] ; _X:__
and edx,15
mov eax,4
sub ebx,11*65536
add edx,text
mov esi,1
int 0x40
 
pop edx ; X_:__
shr edx,4
and edx,15
mov eax,4
sub ebx,6*65536
add edx,text
mov esi,1
int 0x40
 
call draw_cpu_usage
 
_ret:
 
cmp [minimize_right],0
jne no_m_r2
sub [maxx],10
no_m_r2:
 
no_setup:
 
popa
ret
 
 
 
draw_cpu_usage:
 
pushad
 
mov [ysi],30
cmp [graph_text],1
jne @f
mov [ysi],12
@@:
 
 
mov eax,18 ; TSC / SEC
mov ebx,5
int 0x40
shr eax,20
push eax
mov eax,18 ; IDLE / SEC
mov ebx,4
int 0x40
shr eax,20
xor edx,edx
imul eax,[ysi]
 
cdq
pop ebx
inc ebx
div ebx
cmp eax,[ysi]
jng no_bug
mov eax,[ysi]
no_bug:
push eax
 
mov eax,13
mov ebx,[maxx]
sub ebx,60
shl ebx,16
add ebx,8
mov ecx,5 shl 16
add ecx,[ysi]
mov edx,0xdd2222
int 0x40
 
pop eax
mov ecx,5 shl 16
add ecx,eax
mov eax,13
mov edx,0x44aa44
int 0x40
 
popad
ret
 
; DATA
 
stripe:
dd -0x010101
dd -0x010101
dd -0x020202
dd -0x010101
dd -0x000000
 
dd 0x000000
dd 0x010101
dd 0x020202
dd 0x010101
dd 0x010101
 
m_icon:
dd 0x0
dd 0x808080
dd 0x000000
dd 0x000000
dd 0xffffff
 
 
lsz m_text,\
ru, "Œ…ž",\
en, "MENU",\
et, "MENÜÜ"
 
mi_text db 'WAVETETRBGRDGPL '
 
flag_text db 'EnFiGeRuFrEt'
 
type_lang db 0
;music_type db 1
sound_flag db 0
button_frames dd 0x0
 
checks dd -1
hidetext db 0x11,0x10,0x1e
 
turn_text db '><'
gpl db 'GPL'
 
chlang db 'LANG',0
;syslang db 'SLAN',0
 
contrast db 0
 
running_applications dd 0x100
max_applications dd 11
 
current_alt_tab_app dd -1
 
page_list dd 0
draw_start_position dd 0
draw_window_1 db 0
 
b_size_y: dd 0x0
ysi dd 0
small_draw dd 0x0
 
ptime dd 0x0
maxx dd 0x0
text db '0123456789'
page_a1 db '< >'
bte dd 0xccddee
 
wcolor dd 0x506070
 
sec db ': '
pros db ' '
db ' '
 
screenxy dd 0x0
stcount dd 0x0
 
setup_exec:
dd 7
dd 0
.cmdline dd ?
dd 0
dd 0
db '/HD0/1/KOLIBRi/BIN/'
file_sys db 'SETUP',0
 
exec_fileinfo:
dd 7
dd 0
dd 0
dd 0
dd 0
db 0
.name dd ?
 
end_name db '/HD0/1/KOLIBRi/BIN/END',0
menu_name db '/HD0/1/KOLIBRi/BIN/@MENU',0
calendar_name db '/HD0/1/KOLIBRi/BIN/CALENDAR',0
sysmeter_name db '/HD0/1/KOLIBRi/BIN/GMON',0
 
dat_fileinfo:
dd 0
dd 0
dd 0
dd 1024
dd I_END
db '/HD0/1/KOLIBRi/ETC/PANEL.DAT',0
 
m_bmp_fileinfo:
dd 0
dd 0
dd 0
dd 8192
dd image
db '/HD0/1/KOLIBRi/USR/ICONS/MENUET.BMP',0
 
iconf_fileinfo:
dd 0
dd 0
dd 0
dd 8192
dd image
db '/HD0/1/KOLIBRi/USR/ICONS/'
iconf db 'MBAR_IX.BMP',0
 
I_END:
 
screen_size:
.height dw ?
.width dw ?
 
area9 rb 100
system_colours rd 10
app_list rd 50
alt_tab_list rd 256*2
alt_tab_list_size dd ?
tictable:
rd 256
image:
/kernel/branches/hd_kolibri/apps/panel/@panel
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/kernel/branches/hd_kolibri/apps/panel/PANEL.DAT
0,0 → 1,0
0000;0000;0001;0001;0001;0001;0100;0001;0001;0001;0001;0001;x
/kernel/branches/hd_kolibri/apps/panel/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm @panel.asm @panel
@pause
/kernel/branches/hd_kolibri/apps/panel/build_et.bat
0,0 → 1,5
@erase lang.inc
@echo lang fix et >lang.inc
@fasm @panel.asm @panel
@erase lang.inc
@pause
/kernel/branches/hd_kolibri/apps/panel/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm @panel.asm @panel
@pause
/kernel/branches/hd_kolibri/apps/panel/lang.inc
0,0 → 1,0
lang fix en
/kernel/branches/hd_kolibri/apps/panel/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
/kernel/branches/hd_kolibri/apps/rb/@RB.ASM
0,0 → 1,405
;
; DESKTOP CONTEXT MENU
; written by Ivan Poddubny
;
; €¢â®à - ˆ¢ ­ ®¤¤ã¡­ë©
; e-mail: ivan-yar@bk.ru
;
; Compile with flat assembler
;
include 'lang.inc'
include 'macros.inc'
 
meos_app_start
code
 
mov eax,40 ; ãáâ ­®¢¨¬ ¬ áªã ᮡë⨩
mov ebx,100000b ; ­ á ¨­â¥à¥áã¥â ⮫쪮 ¬ëèì
int 0x40
 
still: ; £« ¢­ë© 横« ®á­®¢­®£® ¯à®æ¥áá 
 
mov eax,10 ; ¦¤ñ¬ ᮡëâ¨ï
int 0x40
 
mov eax,37 ; ª ª¨¥ ­ ¦ âë ª¯®¯ª¨?
mov ebx,2
int 0x40
 
cmp eax,2 ; ¥á«¨ ­¥ ¯à ¢ ï, ¢®§¢à â
jne still
 
;---¯®¥å «¨!---
 
; mov eax,37 ; íâ® ¤«ï ®â« ¤ª¨ - ¥á«¨ ¬ëèì ¢ â®çª¥ (0;0), § ªà®¥¬áï
; xor ebx,ebx
; int 0x40
; test eax,eax ; ªãàá®à ¢ â®çª¥ (0;0), â.¥. eax = 0
; je exit
 
 
mov eax,9 ; ¯®«ã稬 ç¨á«® ¯à®æ¥áᮢ ¢ á¨á⥬¥
mov ebx,procinfo
xor ecx,ecx
int 0x40
 
inc eax ; ⥯¥àì ¢ eax ᮤ¥à¦¨âáï ç¨á«® ¯à®æ¥áᮢ + 1
mov [processes],eax
mov ecx,1
 
new_process:
pushad
mov eax,9 ; ¯®«ã稬 ¨­ä®à¬ æ¨î ® ¯à®æ¥áá¥; ­®¬¥à - ¢ ecx
mov ebx,procinfo
int 0x40
mov eax,37 ; ª®®à¤¨­ âë ªãàá®à 
xor ebx,ebx
int 0x40
mov ebx,eax ; eax = cursor_x
shr eax,16 ; ebx = cursor_y
and ebx,0xffff
mov [curx1],eax ; curx1 = cursor_x
mov [cury1],ebx ; cury1 = cursor_y
; \begin{diamond}[18.09.2006]
; ignore minimized windows
test [procinfo.wnd_state], 2
jnz ne_goden
; \end{diamond}[18.09.2006]
mov eax,[procinfo.x_start] ; eax = wnd_x_start
mov ebx,[procinfo.y_start] ; ebx = wnd_y_start
 
mov ecx,[procinfo.x_size]
add ecx,eax ; ecx = wnd_x_end
mov edx,[procinfo.y_size]
add edx,ebx ; ecx = wnd_y_end
 
cmp eax,[curx1] ; wnd_x_start > cursor_x => ªãàá®à «¥¢¥¥ ®ª­ 
jg ne_goden
cmp ecx,[curx1] ; wnd_x_end < cursor_x => ªãàá®à ¯à ¢¥¥ ®ª­ 
jl ne_goden
cmp ebx,[cury1] ; wnd_y_start > cursor_y => ªãàá®à ¢ëè¥ ®ª­ 
jg ne_goden
cmp edx,[cury1] ; wnd_y_end < cursor_y => ªãàá®à ­¨¦¥ ®ª­ 
jl ne_goden
 
goden: ; ª«¨ª ¡ë« ¢­ãâਠª ª®£®-â® ®ª­ , ¯®í⮬㠭¨ç¥£® ­¥ ¤¥« ¥¬
popad
jmp still
 
ne_goden: ; ª«¨ª ¡ë« á­ à㦨 à áᬠâਢ ¥¬®£® ®ª­ , ¯®í⮬ã
popad
inc ecx
cmp ecx,[processes]
jl new_process ; «¨¡® ᬮਬ á«¥¤ãî饥 ®ª­®, «¨¡® § ¯ã᪠¥¬ ¬¥­î
 
 
@@: ; ¯®¤®¦¤ñ¬, ¯®ª  ¯®«ì§®¢ â¥«ì ­¥ ®â¯ãá⨫ ¯à ¢ãî ª­®¯ªã ¬ëè¨
mov eax,37
mov ebx,2 ; äã­ªæ¨ï 37-2:
int 0x40 ; ­ ¦ âë «¨ ª­®¯ª¨ ¬ëè¨?
cmp eax,ebx ; ¥á«¨ ®â¯ãá⨫, (eax != 2)
jnz @f ; ¨¤ñ¬ ¢ ­ ç «® £« ¢­®£® 横« 
 
mov eax,5 ; ¨­ ç¥
mov ebx,2 ; ¯®¤®¦¤ñ¬ 2 ¬á
int 0x40
 
jmp @b ; ¨ ¯à®¢¥à¨¬ ¬ëèì ®¯ïâì
@@:
 
; ¥á«¨ 㦥 ¡ë«® ®âªàëâ® ¬¥­î, ­ã¦­® ¯®¤®¦¤ âì, ¯®ª  ®­® § ªà®¥âáï:
@@:
cmp [menu_opened],0
je @f
mov eax,5
mov ebx,3 ; ¦¤ñ¬ 3 ¬á
int 0x40
jmp @b
@@:
 
mov eax,51 ;   ⥯¥àì ¬®¦­® ᬥ«® § ¯ã᪠âì ¯à®æ¥áá (¯®â®ª) ¬¥­î
mov ebx,1 ; ᮧ¤ ñ¬ ¯®â®ª (thread)
mov ecx,start_wnd ; â®çª  ¢å®¤  ¯®â®ª 
mov edx,stack_wnd ; ¢¥à設  áâíª  ¤«ï ¯®â®ª 
int 0x40
 
jmp still
 
 
 
exit_menu: ; ¥á«¨ ¢ë室¨¬ ¨§ ¬¥­î, ­ ¤® § ¯¨á âì ¢ [menu_opened] 0
mov [menu_opened],0
exit: ; á ¬ë ¨¤ñ¬, ª®£¤  ¢ë室¨¬ ¨§ ®á­®¢­®£® ¯à®æ¥áá 
or eax,-1 ; eax = -1
int 0x40
 
 
 
 
; §¤¥áì áâ àâã¥â ¯à®æ¥áá ¬¥­î
start_wnd:
mov [menu_opened],1
mov eax,40 ; ãáâ ­®¢¨¬ ¬ áªã ¦¥« ¥¬ëå ᮡë⨩ ¤«ï í⮣® ¯à®æ¥áá 
mov ebx,100101b ; ¬¥­î + ª­®¯ª¨ + ¯¥à¥à¨á®¢ª 
int 0x40
 
red:
call draw_window
 
still2: ; £« ¢­ë© 横« ¯à®æ¥áá  ¬¥­î
 
mov eax,10 ; ¦¤ñ¬ ᮡëâ¨ï
int 0x40
 
cmp eax,1 ; ¯¥à¥à¨á®¢ª ?
je red
cmp eax,3 ; ª­®¯ª ?
je button
cmp eax,6 ; ¬ëèì?
je mouse
 
jmp still2 ; ¢¥à­ñ¬áï ¢ ­ ç «® £« ¢­®£® 横« 
 
 
; Ž€Ž’—ˆŠ Œ›˜ˆ
mouse: ; ª®£¤  ¯®«ì§®¢ â¥«ì ­ ¦¬ñâ ª­®¯ªã ¬ëè¨, § ªà®¥¬áï
mov eax,37
mov ebx,2 ; ª ª¨¥ ª­®¯ª¨ ­ ¦ âë?
int 0x40
test eax,eax ; ­¨ª ª¨¥? - ⮣¤  ¯à¥ªà á­®! ¢¥à­ñ¬áï ¢ £« ­ë© 横«
jz still2
jmp exit_menu ;   ¥á«¨ ¢áñ-â ª¨ ­ ¦ âë - § ªà®¥¬ ®ª­®
 
 
; €†€’€ ŠŽŠ€
button:
mov eax,17 ; ¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª­®¯ª¨
int 0x40
 
sub ah,10 ; áà ¢­¨¢ ¥¬ á 10
jl nofuncbtns ; ¥á«¨ ¬¥­ìè¥ - § ªà뢠¥¬ ¬¥­î
 
movzx ebx,ah ; ¯®«ã稫¨ ­®¬¥à ¯à®£à ¬¬ë ¢ ᯨ᪥ ¢ ebx
mov esi, [startapps + ebx*4]
mov edi, start_info.path
cld
@@:
lodsb
stosb
test al, al
jnz @b
mcall 70, start_info
 
; mov eax,5 ; ¯®¤®¦¤ñ¬, ¯®ª  ¯à®£à ¬¬  § ¯ãáâ¨âìáï
; mov ebx,1 ;   â® ¥ñ ®ª­® ­¥ ¡ã¤¥â ®âà¨á®¢ ­® (¡ £ ¢ ï¤à¥???)
; int 0x40 ; à áª®¬¬¥­â¨àã©â¥ í⨠áâப¨, ¥á«¨ ã ¢ á ¯à®¡«¥¬ë
; á ®âà¨á®¢ª®©
 
nofuncbtns: ; § ªà뢠¥¬ ¬¥­î
jmp exit_menu
 
 
 
_BTNS_ = 7 ; ª®«¨ç¥á⢮ ª­®¯®ª ("¯ã­ªâ®¢ ¬¥­î")
 
if lang eq ru
font = 0x00000000
string_length = 20 ; ¤«¨­  áâப¨
wnd_x_size = 133 ; è¨à¨­  ®ª­ 
header_pos = 36 shl 16 + 7
else
font = 0x10000000
string_length = 12 ; ¤«¨­  áâப¨
wnd_x_size = 105 ; è¨à¨­  ®ª­ 
header_pos = 23 shl 16 + 7
end if
 
;*******************************
;******** ˆ‘“…Œ ŽŠŽ ********
;*******************************
 
draw_window:
 
mov eax,12 ; ­ ç¨­ ¥¬ "à¨á®¢ âì"
mov ebx,1
int 0x40
 
mov eax,[curx1] ; ⥪ã騥 ª®®à¤¨­ âë ªãàá®à 
mov [curx],eax ; § ¯¨è¥¬ ¢ ª®®à¤¨­ âë ®ª­ 
mov eax,[cury1]
mov [cury],eax
 
; ⥯¥àì ¡ã¤¥¬ áç¨â âì ª®®à¤¨­ âë ®ª­ , çâ®¡ë ®­® §  ªà © íªà ­  ­¥ ¢ë«¥§«®
mov eax,14 ; ¯®«ã稬 à §¬¥à íªà ­ 
int 0x40
mov ebx,eax
shr eax,16 ; ¢ eax - x_screen
and ebx,0xffff ; ¢ ebx - y_screen
add eax,-wnd_x_size ; eax = [x_screen - è¨à¨­  ®ª­ ]
add ebx,-_BTNS_*15-21 ; ebx = [y_screen - ¢ëá®â  ®ª­ ]
 
cmp eax,[curx]
jg .okx ; ¥á«¨ ®ª­® ᫨誮¬ ¡«¨§ª® ª ¯à ¢®¬ã ªà î,
add [curx],-wnd_x_size ; ᤢ¨­¥¬ ¥£® ¢«¥¢® ­  100
.okx:
 
cmp ebx, [cury]
jg .oky ; ¯® ¢¥à⨪ «¨ â®ç­® â ª¦¥
add [cury], -_BTNS_*15-21
.oky:
 
mov eax, 48 ; ¯®«ãç¨âì á¨á⥬­ë¥ 梥â 
mov ebx, 3
mov ecx, sc ;  ¤à¥á áâàãªâãàë
mov edx, sizeof.system_colors ; ¨ ¥¥ à §¬¥à
int 0x40
 
xor eax, eax ; äã­ªæ¨ï 0 - ᮧ¤ âì ®ª­®
mov ebx, [curx] ; ebx = [ª®®à¤¨­ â  ¯® x] shl 16 + [è¨à¨­ ]
shl ebx, 16
add ebx, wnd_x_size
mov ecx, [cury] ; ecx = [ª®®à¤¨­ â  ¯® y] shl 16 + [¢ëá®â ]
shl ecx, 16
add ecx, _BTNS_*15+21
mov edx, [sc.work] ; 梥â à ¡®ç¥© ®¡« áâ¨
mov esi, [sc.grab] ; 梥⠧ £®«®¢ª 
or esi, 0x81000000
mov edi, [sc.frame] ; 梥â à ¬ª¨
int 0x40
 
mov eax, 4 ; § £®«®¢®ª
mov ebx, header_pos ; [x] shl 16 + [y]
mov ecx, [sc.grab_text]; èà¨äâ ¨ 梥â (á¥àë©)
or ecx, 0x10000000
; add ecx, -0x333333
push ecx
push ecx
xor edx,edx
.dec_color:
sub byte [esp+edx], 0x33
jae @f
mov byte [esp+edx], 0
@@:
inc edx
jnp .dec_color
pop ecx
mov edx, header ;  ¤à¥á § £®«®¢ª 
mov esi, header.size ; ¤«¨­  § £®«®¢ª  ("M E N U")
int 0x40
pop ecx
add ebx, 1 shl 16 ; ᤢ¨­¥¬ ¢¯à ¢® ­  1
int 0x40
 
mov ebx, 1*65536+wnd_x_size-2 ; ­ ç¨­ ¥¬ ¤¥« âì ª­®¯ª¨
mov ecx, 20*65536+15
mov edx, 10 or 0x40000000 ; ¡¨â 30 ãáâ ­®¢«¥­ => ª­®¯ª  ­¥ à¨áã¥âáï
 
mov edi,_BTNS_ ; ª®«¨ç¥á⢮ ª­®¯®ª (áçñâ稪)
 
newbtn: ; ­ ç «® 横« 
mov eax,8 ; ᮧ¤ ñ¬ ª­®¯ªã
int 0x40
 
; ¯¨è¥¬ ⥪áâ ­  ª­®¯ª¥
pushad ; ᯠᠥ¬ ॣ¨áâàë
shr ecx, 16
and ebx, 0xffff0000
add ebx, ecx ; ebx = [x] shl 16 + [y];
add ebx, 10*65536+4 ; ebx += ᬥ饭¨¥ ®â­®á¨â¥«ì­® ªà ï ª­®¯ª¨;
mov ecx, [sc.work_text] ; èà¨äâ ¨ 梥â
or ecx, font
add edx, -10 ; edx = ­®¬¥à ª­®¯ª¨;
imul edx, string_length ; edx *= ¤«¨­  áâப¨;
add edx, text ; edx += text; ⥯¥àì ¢ edx  ¤à¥á áâப¨
mov esi, string_length ; ¢ esi - ¤«¨­  áâப¨
mov eax, 4 ; äã­ªæ¨ï 4 - ¢ë¢®¤ ⥪áâ 
int 0x40
popad
 
inc edx ; ­®¬¥à ª­®¯ª¨++;
add ecx,15*65536 ; 㢥«¨ç¨¬ ᬥ饭¨¥ ¯® y
dec edi ; 㬥­ì訬 áçñâ稪
jnz newbtn ; ¥á«¨ ­¥ ­®«ì, ¯®¢â®à¨¬ ¢áñ ¥éñ à §
 
mov eax,12 ; § ª®­ç¨«¨ "à¨á®¢ âì"
mov ebx,2
int 0x40
 
ret ; ¢®§¢à â
 
 
 
; „€›… Žƒ€ŒŒ›
DATA
 
macro strtbl name, [string]
{
common
label name dword
forward
local str
dd str
forward
str db string
}
 
strtbl startapps ,\
<"/HD0/1/KOLIBRI/BIN/PIC4",0> ,\
<"/HD0/1/KOLIBRI/BIN/SKINSEL",0> ,\
<"/HD0/1/KOLIBRI/BIN/DESKTOP",0> ,\
<"/HD0/1/KOLIBRI/BIN/ICON",0> ,\
<"/HD0/1/KOLIBRI/BIN/SETUP",0> ,\
<"/HD0/1/KOLIBRI/BIN/VRR",0> ,\
<"/HD0/1/KOLIBRI/BIN/CPU",0>
sz header, "KolibriOS"
 
lsz text,\
en, 'Background ',\
en, 'Change skin ',\
en, 'Desktop ',\
en, 'Icon manager',\
en, 'Device setup',\
en, 'VRR ',\
en, 'Processes ',\
\
ru, 'ƒ¥­¥à â®à ®¡®¥¢ ',\
ru, '‘¬¥­  ᪨­  ',\
ru, ' áâனª  ®ª®­ ',\
ru, '“¯à ¢«¥­¨¥ ¨ª®­ª ¬¨ ',\
ru, ' áâனª  ãáâனá⢠',\
ru, ' áâனª  ¬®­¨â®à  ',\
ru, 'à®æ¥ááë '
 
start_info:
.mode dd 7
dd 0
.params dd 0
dd 0
dd 0
db 0
dd start_info.path
 
; …ˆˆ–ˆ€‹ˆ‡ˆŽ‚€›… „€›…
UDATA
processes dd ? ; ª®«¨ç¥á⢮ ¯à®æ¥áᮢ ¢ á¨á⥬¥
curx1 dd ? ; ª®®à¤¨­ âë ªãàá®à 
cury1 dd ?
curx dd ? ; ª®®à¤¨­ âë ®ª­  ¬¥­î
cury dd ?
 
menu_opened db ? ; ®âªàëâ® ¬¥­î ¨«¨ ­¥â? (1-¤ , 0-­¥â)
 
align 4
start_info.path rb 256
 
sc system_colors ; á¨á⥬­ë¥ 梥â 
procinfo process_information ; ¨­ä®à¬ æ¨ï ® ¯à®æ¥áá¥
 
rb 1024 ; áâíª ¤«ï ®ª­  ¬¥­î - 墠â¨â ¨ 1 Š¡
align 32
stack_wnd:
 
 
MEOS_APP_END
; ŠŽ…– Žƒ€ŒŒ›
/kernel/branches/hd_kolibri/apps/rb/@rb
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/kernel/branches/hd_kolibri/apps/rb/build_en.bat
0,0 → 1,5
@erase lang.inc
@echo lang fix en >lang.inc
@fasm @rb.asm @rb
@erase lang.inc
@pause
/kernel/branches/hd_kolibri/apps/rb/build_ru.bat
0,0 → 1,5
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm @rb.asm @rb
@erase lang.inc
@pause
/kernel/branches/hd_kolibri/apps/rb/lang.inc
0,0 → 1,0
lang fix en
/kernel/branches/hd_kolibri/apps/rb/macros.inc
0,0 → 1,269
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
dw ? ; +52 - reserved
.client_left dd ? ; +54
.client_top dd ? ; +58
.client_width dd ? ; +62
.client_height dd ? ; +66
.wnd_state db ? ; +70
rb (1024-71)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
/kernel/branches/hd_kolibri/apps/setup/SETUP.DAT
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/kernel/branches/hd_kolibri/apps/setup/build.bat
0,0 → 1,3
echo lang fix en > lang.inc
fasm setup.asm setup
pause
/kernel/branches/hd_kolibri/apps/setup/lang.inc
0,0 → 1,0
lang fix en
/kernel/branches/hd_kolibri/apps/setup/macros.inc
0,0 → 1,269
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
dw ? ; +52 - reserved
.client_left dd ? ; +54
.client_top dd ? ; +58
.client_width dd ? ; +62
.client_height dd ? ; +66
.wnd_state db ? ; +70
rb (1024-71)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
/kernel/branches/hd_kolibri/apps/setup/setup.asm
0,0 → 1,1804
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; DEVICE SETUP ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
; Authors: Ville - original version
; A. Ivushkin - autostart (w launcher)
; M. Lisovin - added many feauters (apply all, save all, set time...)
; I. Poddubny - fixed russian keymap
;14/08/06 Mario79 - added regulation of mouse features
 
;******************************************************************************
use32
org 0x0
db 'MENUET01' ; 8 byte identifier
dd 0x01 ; header version
dd START ; pointer to program start
dd I_END ; size of image
dd 0x4000 ; reguired amount of memory
dd 0x4000 ; stack pointer (esp)
dd I_PARAM,0 ; parameters, reserved
; include 'lang.inc'
include 'macros.inc'
;******************************************************************************
 
LLL equ (56+3)
BBB equ 25
 
;******************************************************************************
apply_all:
 
call _midibase ;1
call _sound_dma ;10
call _pci_acc ;12
call _sb16 ;4
call _wssp ;6
call _syslang ;5
call _keyboard ;2
call _mouse_speed
call _mouse_delay
call get_disk_info
cmp [cd],0
jne no_cd
call _cdbase ;3
no_cd:
cmp [hd],0
jne no_hd
call _lba_read ;11
call _hdbase ;7
call _f32p ;8
no_hd:
ret
;-------------------------------------------------------------------------------
get_disk_info:
mov [hd],1
mov [cd],1
mov [hdbase],0
mov [cdbase],0
mcall 18,11,1,table_area
 
ide_0:
mov al,[table_area+1]
shr al,6
cmp al,0
je ide_1
cmp al,01b
jnz ide_0_cd
mov [hdbase],1
mov [hd],0
jmp ide_1
 
ide_0_cd:
cmp al,10b
jnz ide_1
mov [cdbase],1
mov [cd],0
cmp [hd],0
je all_device
 
ide_1:
mov al,[table_area+1]
shl al,2
shr al,6
cmp al,0
je ide_2
cmp al,01b
jnz ide_1_cd
cmp [hd],0
je ide_11
mov [hdbase],2
mov [hd],0
ide_11:
cmp [cd],0
je all_device
jmp ide_2
 
ide_1_cd:
cmp al,10b
jnz ide_2
cmp [cd],0
je ide_11_cd
mov [cdbase],2
mov [cd],0
ide_11_cd:
cmp [hd],0
je all_device
 
ide_2:
mov al,[table_area+1]
shl al,4
shr al,6
cmp al,0
je ide_3
cmp al,01b
jnz ide_2_cd
cmp [hd],0
je ide_21
mov [hdbase],3
mov [hd],0
ide_21:
cmp [cd],0
je all_device
jmp ide_3
 
ide_2_cd:
cmp al,10b
jnz ide_3
cmp [cd],0
je ide_21_cd
mov [cdbase],3
mov [cd],0
ide_21_cd:
cmp [hd],0
je all_device
 
ide_3:
mov al,[table_area+1]
shl al,6
shr al,6
cmp al,0
je not_device
cmp al,01b
jnz ide_3_cd
cmp [hd],0
je ide_31
mov [hdbase],4
mov [hd],0
ide_31:
cmp [cd],0
jmp all_device
 
ide_3_cd:
cmp al,10b
jnz not_device
cmp [cd],0
je all_device
mov [cdbase],4
mov [cd],0
 
all_device:
not_device:
ret
 
hd db 0
cd db 0
;******************************************************************************
apply_all_and_exit:
mcall 70,read_fileinfo
call apply_all
 
jmp close
 
;******************************************************************************
set_language_and_exit:
mov eax,26
mov ebx,2
mov ecx,9
int 0x40
; cmp eax,5
; jne @f
; xor eax,eax
;@@: mov [keyboard],eax
cmp eax,1
je russian
xor eax,eax
set_lang_now:
mov [keyboard],eax
call _keyboard
jmp close
russian:
mov eax,3
jmp set_lang_now
 
set_syslanguage_and_exit:
mov eax,26
mov ebx,5
; mov ecx,9
int 0x40
cmp eax,6
jne temp ;@f
xor eax,eax
;@@: inc eax
temp: inc eax
mov [syslang],eax
call _syslang
jmp close
 
get_setup_values:
mcall 26,1
mov [midibase],eax
mcall 26,2,9
dec eax
mov [keyboard],eax
mcall 26,3
mov [cdbase],eax
mcall 26,4
mov [sb16],eax
mcall 26,5
mov [syslang],eax
mcall 26,6
cmp eax,0x530
jne s_wss_2
mov eax,1
jmp get_other
s_wss_2:
cmp eax,0x608
jne s_wss_3
mov eax,2
jmp get_other
s_wss_3:
cmp eax,0xe80
jne s_wss_4
mov eax,3
jmp get_other
s_wss_4:
mov eax,4
get_other:
mov [wss],eax
mcall 26,7
mov [hdbase],eax
mcall 26,8
mov [f32p],eax
mcall 26,10
mov [sound_dma],eax
mcall 26,11
mov [lba_read],eax
mcall 26,12
mov [pci_acc],eax
mcall 18,19,0
mov [mouse_speed],eax
mcall 18,19,2
mov [mouse_delay],eax
ret
 
;******************************************************************************
 
START:
cmp [I_PARAM], 'SLAN'
je set_syslanguage_and_exit
 
cmp [I_PARAM], 'LANG'
je set_language_and_exit
 
cmp [I_PARAM], 'BOOT'
je apply_all_and_exit
 
call get_setup_values
call loadtxt
red:
call draw_window
 
still:
 
cmp word [blinkpar],0
jne blinker
mov eax,29 ;get system date
int 0x40
cmp eax,[date]
je gettime
mov [date],eax
gettime:
mov eax,3 ;get system time
int 0x40
cmp ax,[time]
je sysevent
mov [time],ax
call drawtime
 
sysevent:
mov eax,23
mov ebx,8 ; wait here for event with timeout
int 0x40
 
cmp eax,1
jz red
cmp eax,2
jz key
cmp eax,3
jz button
 
jmp still
 
blinker:
cmp byte [count],6
jb noblink
btc dword [blinkpar],16
mov byte [count],0
call drawtime
noblink:
inc byte [count]
jmp sysevent
 
incdectime:
cmp byte [blinkpar],0
je still
mov esi,time
mov bl,0x23 ;border
cmp byte [blinkpar],1
je hours
mov bl,0x59 ;minutes
inc esi
hours:
mov al,byte [esi]
cmp ah,112
je dectime
cmp al,bl
je noinctime
inc al
daa
jmp incdectime1
noinctime:
xor al,al
incdectime1:
mov byte [esi],al
jmp still
dectime:
cmp al,0
je nodectime
dec al
das
jmp incdectime1
nodectime:
mov al,bl
jmp incdectime1
 
incdecdate:
cmp byte [blinkpar+1],0
je still
mov esi,date
mov bl,0 ;border of years
cmp byte [blinkpar+1],1
jne days
mov bl,0x12 ;months
inc esi
days:
cmp byte [blinkpar+1],2
jne nodays
mov bl,0x31
add esi,2
nodays:
mov al,byte [esi]
cmp ah,122
je decdate
cmp al,bl
je noincdate
inc al ;add al,1
daa
jmp incdecdate1
noincdate:
mov al,1
incdecdate1:
mov byte [esi],al
jmp still
decdate:
cmp al,1
je nodecdate
dec al
das
jmp incdecdate1
nodecdate:
mov al,bl
jmp incdecdate1
 
 
key:
;mov eax,2
int 0x40
cmp ah,27
jne still
mov dword [blinkpar],0
call drawtime
jmp still
 
button:
 
mov eax,17
int 0x40
 
cmp ah,112
je incdectime
cmp ah,113
je incdectime
cmp ah,122
je incdecdate
cmp ah,123
je incdecdate
cmp ah,111
jne noseltime
mov al, [blinkpar]
cmp al,2
jae seltime
inc al
jmp seltime1
seltime:
xor al,al
seltime1:
mov [blinkpar],al
call drawtime
jmp still
noseltime:
cmp ah,121
jne noseldate
mov al,byte [blinkpar+1]
cmp al,3
jae seldate
inc al
jmp seldate1
seldate:
xor al,al
seldate1:
mov [blinkpar+1],al
call drawtime
jmp still
noseldate:
cmp ah,99
jne nosaveall
mcall 70,save_fileinfo
call settime
mov dword [blinkpar],0
call drawtime
jmp still
nosaveall:
cmp ah,100
jne no_apply_all
call apply_all
jmp still
no_apply_all:
 
cmp ah,1 ; CLOSE APPLICATION
jne no_close
close:
or eax,-1
int 0x40
no_close:
 
cmp ah,11 ; SET MIDI BASE
jnz nosetbase1
call _midibase
nosetbase1:
cmp ah,12
jnz nomm
sub [midibase],2
call draw_infotext
nomm:
cmp ah,13
jnz nomp
add [midibase],2
call draw_infotext
nomp:
 
 
cmp ah,4 ; SET KEYBOARD
jnz nokm
mov eax,[keyboard]
test eax,eax
je downuplbl
dec eax
jmp nodownup
downuplbl:
mov eax,5
nodownup:
mov [keyboard],eax
call draw_infotext
nokm:
cmp ah,5
jnz nokp
mov eax,[keyboard]
cmp eax,5
je updownlbl
inc eax
jmp noupdown
updownlbl:
xor eax,eax
noupdown:
mov [keyboard],eax
call draw_infotext
nokp:
 
 
cmp ah,22 ; SET CD BASE
jnz nocm
mov eax,[cdbase]
sub eax,2
and eax,3
inc eax
mov [cdbase],eax
call draw_infotext
nocm:
cmp ah,23
jnz nocp
mov eax,[cdbase]
and eax,3
inc eax
mov [cdbase],eax
call draw_infotext
nocp:
cmp ah,21
jnz nocs
call _cdbase
nocs:
 
cmp ah,62 ; SET HD BASE
jnz hnocm
mov eax,[hdbase]
sub eax,2
and eax,3
inc eax
mov [hdbase],eax
call draw_infotext
hnocm:
cmp ah,63
jnz hnocp
mov eax,[hdbase]
and eax,3
inc eax
mov [hdbase],eax
call draw_infotext
hnocp:
cmp ah,61
jnz hnocs
call _hdbase
hnocs:
 
cmp ah,82 ; SET SOUND DMA
jne no_sdma_d
mov eax,[sound_dma]
dec eax
sdmal:
and eax,3
mov [sound_dma],eax
call draw_infotext
jmp still
no_sdma_d:
cmp ah,83
jne no_sdma_i
mov eax,[sound_dma]
inc eax
jmp sdmal
no_sdma_i:
cmp ah,81
jne no_set_sound_dma
call _sound_dma
jmp still
no_set_sound_dma:
 
cmp ah,92 ; SET LBA READ
jne no_lba_d
slbal:
btc [lba_read],0
call draw_infotext
jmp still
no_lba_d:
cmp ah,93
jne no_lba_i
jmp slbal
no_lba_i:
cmp ah,91
jne no_set_lba_read
call _lba_read
jmp still
no_set_lba_read:
 
 
cmp ah,102 ; SET PCI ACCESS
jne no_pci_d
pcip:
btc [pci_acc],0
call draw_infotext
jmp still
no_pci_d:
cmp ah,103
jne no_pci_i
jmp pcip
no_pci_i:
cmp ah,101
jne no_set_pci_acc
call _pci_acc
jmp still
no_set_pci_acc:
 
 
set_partition:
cmp ah,72 ; SET FAT32 PARTITION
jnz .nominus
mov eax,[f32p]
sub eax,2
; and eax,15 ; 3 - four partitions, 7 - eight p., 15 - sixteen, etc.
cmp eax,15
jb @f
mov eax,14
@@:
inc eax
mov [f32p],eax
call draw_infotext
.nominus:
cmp ah,73
jnz .noplus
mov eax,[f32p]
; and eax,15 ; 3 - four partitions, 7 - eight p., 15 - sixteen, etc.
cmp eax,15
jb @f
mov eax,0
@@:
inc eax
mov [f32p],eax
call draw_infotext
.noplus:
cmp ah,71
jnz .noapply
call _f32p
.noapply:
 
cmp ah,32 ; SET SOUND BLASTER 16 BASE
jnz nosbm
sub [sb16],2
call draw_infotext
nosbm:
cmp ah,33
jnz nosbp
add [sb16],2
call draw_infotext
nosbp:
cmp ah,31
jnz nosbs
call _sb16
nosbs:
 
cmp ah,52 ; SET WINDOWS SOUND SYSTEM BASE
jnz nowssm
mov eax,[wss]
sub eax,2
and eax,3
inc eax
mov [wss],eax
call draw_infotext
nowssm:
cmp ah,53
jnz nowssp
mov eax,[wss]
and eax,3
inc eax
mov [wss],eax
call draw_infotext
nowssp:
cmp ah,51
jnz nowsss
call _wssp
nowsss:
 
cmp ah,42 ; SET SYSTEM LANGUAGE BASE
jnz nosysm
mov eax,[syslang]
dec eax
jz still
mov [syslang],eax
call draw_infotext
nosysm:
cmp ah,43
jnz nosysp
mov eax,[syslang]
cmp eax,6
je nosysp
inc eax
mov [syslang],eax
call draw_infotext
nosysp:
cmp ah,41
jnz nosyss
call _syslang
call cleantxt
call loadtxt
call draw_window
call drawtime
nosyss:
cmp ah,132 ; SET MOUSE SPEED
jnz .nominus
mov eax,[mouse_speed]
sub eax,2
cmp eax,9
jb @f
mov eax,8
@@:
inc eax
mov [mouse_speed],eax
call draw_infotext
.nominus:
cmp ah,133
jnz .noplus
mov eax,[mouse_speed]
cmp eax,9
jb @f
mov eax,0
@@:
inc eax
mov [mouse_speed],eax
call draw_infotext
.noplus:
cmp ah,131
jnz .noapply
call _mouse_speed
.noapply:
mousedelay:
cmp ah,142 ; SET MOUSE DELAY
jnz .nominus
mov eax,[mouse_delay]
sub eax,2
cmp eax,0xfff
jb @f
mov eax,0xffe
@@:
inc eax
mov [mouse_delay],eax
call draw_infotext
.nominus:
cmp ah,143
jnz .noplus
mov eax,[mouse_delay]
cmp eax,0xfff
jb @f
mov eax,0
@@:
inc eax
mov [mouse_delay],eax
call draw_infotext
.noplus:
cmp ah,141
jnz .noapply
call _mouse_delay
.noapply:
 
cmp ah,3 ; SET KEYMAP
jne still
call _keyboard
jmp still
 
_keyboard:
cmp [keyboard],0
jnz nosetkeyle
mov eax,21 ; english
mov ebx,2
mov ecx,1
mov edx,en_keymap
int 0x40
mov eax,21
inc ecx
mov edx,en_keymap_shift
int 0x40
mov eax,21
mov ecx,9
mov edx,1
int 0x40
call alt_gen
nosetkeyle:
cmp [keyboard],1
jnz nosetkeylfi
mov eax,21 ; finnish
mov ebx,2
mov ecx,1
mov edx,fi_keymap
int 0x40
mov eax,21
inc ecx
mov edx,fi_keymap_shift
int 0x40
mov eax,21
mov ecx,9
mov edx,2
int 0x40
call alt_gen
nosetkeylfi:
cmp [keyboard],2
jnz nosetkeylge
mov eax,21 ; german
mov ebx,2
mov ecx,1
mov edx,ge_keymap
int 0x40
mov eax,21
inc ecx
mov edx,ge_keymap_shift
int 0x40
mov eax,21
mov ecx,9
mov edx,3
int 0x40
call alt_gen
nosetkeylge:
cmp [keyboard],3
jnz nosetkeylru
mov eax,21 ; russian
mov ebx,2
mov ecx,1
mov edx,ru_keymap
int 0x40
mov eax,21
inc ecx
mov edx,ru_keymap_shift
int 0x40
call alt_gen
mov eax,21
mov ecx,9
mov edx,4
int 0x40
nosetkeylru:
cmp [keyboard],4 ;french
jnz nosetkeylfr
mov eax,21
mov ebx,2
mov ecx,1
mov edx,fr_keymap
int 0x40
mov eax,21
inc ecx
mov edx,fr_keymap_shift
int 0x40
mov eax,21
inc ecx
mov edx,fr_keymap_alt_gr
int 0x40
mov eax,21
mov ecx,9
mov edx,5
int 0x40
nosetkeylfr:
cmp [keyboard],5
jnz nosetkeylet
mov eax,21 ; estonian
mov ebx,2
mov ecx,1
mov edx,et_keymap
int 0x40
mov eax,21
inc ecx
mov edx,et_keymap_shift
int 0x40
mov eax,21
mov ecx,9
mov edx,6
int 0x40
call alt_gen
nosetkeylet:
ret
 
alt_gen:
mov eax,21
mov ecx,3
mov edx,alt_general
int 0x40
ret
 
 
 
draw_buttons:
 
pusha
 
shl ecx,16
add ecx,12
mov ebx,(350-50)*65536+46+BBB
 
mov eax,8
int 0x40
 
mov ebx,(350-79)*65536+9
inc edx
int 0x40
 
mov ebx,(350-67)*65536+9
inc edx
int 0x40
 
popa
ret
 
 
 
; ********************************************
; ******* WINDOW DEFINITIONS AND DRAW *******
; ********************************************
 
 
draw_window:
 
pusha
 
mov eax,12
mov ebx,1
int 0x40
 
xor eax,eax ; DRAW WINDOW
mov ebx,40*65536+355+BBB
mov ecx,40*65536+320
mov edx,0x83111199
; mov esi,0x805588dd
; mov edi,0x005588dd
int 0x40
 
mov eax,4
mov ebx,8*65536+8
mov ecx,0x10ffffff
mov edx,labelt
cmp [syslang],4
je ruslabel
add edx,20
ruslabel:
mov esi,19 ;26
int 0x40
 
; mov eax,8 ; CLOSE BUTTON
; mov ebx,(355+BBB-19)*65536+12
; mov ecx,5*65536+12
; mov edx,1
; mov esi,0x005588dd
; int 0x40
 
mov eax,8 ; APPLY ALL
mov ebx,(350-79)*65536+100
mov ecx,282*65536+12
mov edx,100
mov esi,0x005588dd
int 0x40
add ecx,16*65536 ; SAVE ALL
dec edx
int 0x40
 
mov esi,0x5580c0
 
mov edx,11
mov ecx,43
call draw_buttons
 
mov edx,41
mov ecx,43+8*8
call draw_buttons
 
mov edx,21
mov ecx,43+4*8
call draw_buttons
 
mov edx,31
mov ecx,43+2*8
call draw_buttons
 
mov edx,3
mov ecx,43+10*8
call draw_buttons
 
mov edx,51
mov ecx,43+12*8
call draw_buttons
 
mov edx,61
mov ecx,43+6*8
call draw_buttons
 
mov edx,91
mov ecx,43+18*8
call draw_buttons
 
mov edx,71
mov ecx,43+14*8
call draw_buttons
 
mov edx,81
mov ecx,43+16*8
call draw_buttons
 
mov edx,101
mov ecx,43+20*8
call draw_buttons
 
mov edx,111
mov ecx,43+22*8 ; 22
call draw_buttons
 
mov edx,121
mov ecx,43+24*8 ; 24
call draw_buttons
 
mov edx,131
mov ecx,43+26*8 ; 26
call draw_buttons
 
mov edx,141
mov ecx,43+28*8 ; 26
call draw_buttons
 
call draw_infotext
 
mov eax,12
mov ebx,2
int 0x40
 
popa
ret
 
 
 
draw_infotext:
 
pusha
 
mov eax,[keyboard] ; KEYBOARD
test eax,eax
jnz noen
mov [text00+LLL*10+28],dword 'ENGL'
mov [text00+LLL*10+32],dword 'ISH '
noen:
cmp eax,1
jnz nofi
mov [text00+LLL*10+28],dword 'FINN'
mov [text00+LLL*10+32],dword 'ISH '
nofi:
cmp eax,2
jnz noge
mov [text00+LLL*10+28],dword 'GERM'
mov [text00+LLL*10+32],dword 'AN '
noge:
cmp eax,3
jnz nogr
mov [text00+LLL*10+28],dword 'RUSS'
mov [text00+LLL*10+32],dword 'IAN '
nogr:
cmp eax,4
jnz nofr
mov [text00+LLL*10+28],dword 'FREN'
mov [text00+LLL*10+32],dword 'CH '
nofr:
cmp eax,5
jnz noet
mov [text00+LLL*10+28],dword 'ESTO'
mov [text00+LLL*10+32],dword 'NIAN'
noet:
 
mov eax,[syslang] ; SYSTEM LANGUAGE
dec eax
test eax,eax
jnz noen5
mov [text00+LLL*8+28],dword 'ENGL'
mov [text00+LLL*8+32],dword 'ISH '
noen5:
cmp eax,1
jnz nofi5
mov [text00+LLL*8+28],dword 'FINN'
mov [text00+LLL*8+32],dword 'ISH '
nofi5:
cmp eax,2
jnz noge5
mov [text00+LLL*8+28],dword 'GERM'
mov [text00+LLL*8+32],dword 'AN '
noge5:
cmp eax,3
jnz nogr5
mov [text00+LLL*8+28],dword 'RUSS'
mov [text00+LLL*8+32],dword 'IAN '
nogr5:
cmp eax,4
jne nofr5
mov [text00+LLL*8+28],dword 'FREN'
mov [text00+LLL*8+32],dword 'CH '
nofr5:
cmp eax,5
jne noet5
mov [text00+LLL*8+28],dword 'ESTO'
mov [text00+LLL*8+32],dword 'NIAN'
noet5:
 
mov eax,[midibase]
mov esi,text00+LLL*0+32
call hexconvert ; MIDI BASE
 
 
mov eax,[sb16] ; SB16 BASE
mov esi,text00+LLL*2+32
call hexconvert
 
 
mov eax,[wss] ; WSS BASE
cmp eax,1
jnz nowss1
mov [wssp],dword 0x530
nowss1:
cmp eax,2
jnz nowss2
mov [wssp],dword 0x608
nowss2:
cmp eax,3
jnz nowss3
mov [wssp],dword 0xe80
nowss3:
cmp eax,4
jnz nowss4
mov [wssp],dword 0xf40
nowss4:
 
mov eax,[wssp]
mov esi,text00+LLL*12+32
call hexconvert
 
mov eax,[cdbase] ; CD BASE
cmp eax,1
jnz noe1
mov [text00+LLL*4+28],dword 'PRI.'
mov [text00+LLL*4+32],dword 'MAST'
mov [text00+LLL*4+36],dword 'ER '
noe1:
cmp eax,2
jnz nof1
mov [text00+LLL*4+28],dword 'PRI.'
mov [text00+LLL*4+32],dword 'SLAV'
mov [text00+LLL*4+36],dword 'E '
nof1:
cmp eax,3
jnz nog1
mov [text00+LLL*4+28],dword 'SEC.'
mov [text00+LLL*4+32],dword 'MAST'
mov [text00+LLL*4+36],dword 'ER '
nog1:
cmp eax,4
jnz nog2
mov [text00+LLL*4+28],dword 'SEC.'
mov [text00+LLL*4+32],dword 'SLAV'
mov [text00+LLL*4+36],dword 'E '
nog2:
 
 
mov eax,[hdbase] ; HD BASE
cmp eax,1
jnz hnoe1
mov [text00+LLL*6+28],dword 'PRI.'
mov [text00+LLL*6+32],dword 'MAST'
mov [text00+LLL*6+36],dword 'ER '
hnoe1:
cmp eax,2
jnz hnof1
mov [text00+LLL*6+28],dword 'PRI.'
mov [text00+LLL*6+32],dword 'SLAV'
mov [text00+LLL*6+36],dword 'E '
hnof1:
cmp eax,3
jnz hnog1
mov [text00+LLL*6+28],dword 'SEC.'
mov [text00+LLL*6+32],dword 'MAST'
mov [text00+LLL*6+36],dword 'ER '
hnog1:
cmp eax,4
jnz hnog2
mov [text00+LLL*6+28],dword 'SEC.'
mov [text00+LLL*6+32],dword 'SLAV'
mov [text00+LLL*6+36],dword 'E '
hnog2:
 
 
mov eax,[f32p] ; FAT32 PARTITION
add al,48
mov [text00+LLL*14+28],al
 
mov eax,[sound_dma] ; SOUND DMA
add eax,48
mov [text00+LLL*16+28],al
 
mov eax,[lba_read]
call onoff ; LBA READ
mov [text00+LLL*18+28],ebx
 
mov eax,[pci_acc]
call onoff ; PCI ACCESS
mov [text00+LLL*20+28],ebx
 
mov eax,[mouse_speed] ; MOUSE SPEED
add al,48
mov [text00+LLL*26+28],al
 
mov eax,[mouse_delay]
mov esi,text00+LLL*28+32
call hexconvert ; MOUSE DELAY
 
mov eax,13
mov ebx,175*65536+85
mov ecx,40*65536+245
mov edx,0x80111199-19
int 0x40
 
mov edx,text00
mov ebx,10*65536+45
mov eax,4
mov ecx,0xffffff
mov esi,LLL
newline:
int 0x40
add ebx,8
add edx,LLL
cmp [edx],byte 'x'
jnz newline
 
popa
ret
 
drawtime:
mov ax,[time] ;hours 22
mov cl,1
call unpacktime
mov [text00+LLL*22+28],word bx
mov al,ah ;minutes
inc cl
call unpacktime
mov [text00+LLL*22+31],word bx
mov eax,[date]
mov ch,3
call unpackdate
mov [text00+LLL*24+34],word bx ;year 24
mov al,ah
mov ch,1
call unpackdate
mov [text00+LLL*24+28],word bx ;month
bswap eax
mov al,ah
inc ch
call unpackdate
mov [text00+LLL*24+31],word bx ;day
 
mov eax,13
mov ebx,175*65536+85
mov ecx,40*65536+245
mov edx,0x80111199-19
int 0x40
 
mov edx,text00
mov ebx,10*65536+45
mov eax,4
mov ecx,0xffffff
mov esi,LLL
newline1:
int 0x40
add ebx,8
add edx,LLL
cmp [edx],byte 'x'
jnz newline1
ret
 
unpacktime:
cmp byte [blinkpar],cl ;translate packed number to ascii
jne unpack1
chkblink:
bt dword [blinkpar],16
jnc unpack1
xor bx,bx
ret
unpackdate:
cmp byte [blinkpar+1],ch
je chkblink
unpack1:
xor bx,bx
mov bh,al
mov bl,al
and bh,0x0f
shr bl,4
add bx,0x3030
ret
 
hexconvert: ;converting dec to hex in ascii
xor ebx,ebx
mov bl,al
and bl,15
add ebx,hex
mov cl,[ebx]
mov [esi],cl
shr eax,4
xor ebx,ebx
mov bl,al
and bl,15
add ebx,hex
mov cl,[ebx]
dec esi
mov [esi],cl
shr eax,4
xor ebx,ebx
mov bl,al
and bl,15
add ebx,hex
mov cl,[ebx]
dec esi
mov [esi],cl
ret
 
onoff:
cmp [syslang],4
jne norus1
mov ebx,'„€ '
cmp eax,1
je exitsub
mov ebx,'…’ '
ret
norus1:
mov ebx,'ON '
cmp eax,1
je exitsub
mov ebx,'OFF '
exitsub:
ret
 
_midibase:
mov eax,21
mov ebx,1
mov ecx,[midibase]
int 0x40
ret
 
_cdbase:
mov eax,21
mov ebx,3
mov ecx,[cdbase]
int 0x40
ret
 
_hdbase:
mov eax,21
mov ebx,7
mov ecx,[hdbase]
int 0x40
ret
 
_sound_dma:
mov eax,21
mov ebx,10
mov ecx,[sound_dma]
int 0x40
ret
 
_lba_read:
mov eax,21
mov ebx,11
mov ecx,[lba_read]
int 0x40
ret
 
_pci_acc:
mov eax,21
mov ebx,12
mov ecx,[pci_acc]
int 0x40
ret
 
_f32p:
mov eax,21
mov ebx,8
mov ecx,[f32p]
int 0x40
ret
 
_sb16:
mov eax,21
mov ebx,4
mov ecx,[sb16]
int 0x40
ret
 
_wssp:
mov eax,21
mov ebx,6
mov ecx,[wssp]
int 0x40
ret
 
_syslang:
mov eax,21
mov ebx,5
mov ecx,[syslang]
int 0x40
ret
 
_mouse_speed:
mov eax,18
mov ebx,19
mov ecx,1
mov edx,[mouse_speed]
int 0x40
ret
 
_mouse_delay:
mov eax,18
mov ebx,19
mov ecx,3
mov edx,[mouse_delay]
int 0x40
ret
 
loadtxt:
cld
mov edi,text00
mov ecx,488 ;28
cmp [syslang],4
jne norus
mov esi,textrus
jmp sload
norus:
mov esi,texteng
sload:
rep movsd
ret
 
cleantxt:
xor eax,eax
mov ecx,428
cld
mov edi,text00
rep stosd
mov [text00+1711],byte 'x'
ret
 
settime:
mov dx,0x70
call startstopclk
dec dx
mov al,2 ;set minutes
out dx,al
inc dx
mov al,byte [time+1]
out dx,al
dec dx
mov al,4 ;set hours
out dx,al
inc dx
mov al,byte [time]
out dx,al
dec dx
mov al,7 ;set day
out dx,al
inc dx
mov al,byte [date+2]
out dx,al
dec dx
mov al,8 ;set month
out dx,al
inc dx
mov al,byte [date+1]
out dx,al
dec dx
mov al,9 ;set year
out dx,al
inc dx
mov al,byte [date]
out dx,al
dec dx
call startstopclk
ret
 
startstopclk:
mov al,0x0b
out dx,al
inc dx
in al,dx
btc ax,7
out dx,al
ret
 
; DATA AREA
count: db 0x0
blinkpar: dd 0x0
time: dw 0x0
date: dd 0x0
 
textrus:
 
db ' §  MIDI ROLAND MPU-401 : 0x320 - + à¨¬¥­¨âì'
db ' '
db ' §  SoundBlaster 16 : 0x240 - + à¨¬¥­¨âì'
db ' '
db ' §  CD-ROM  : PRI.SLAVE - + à¨¬¥­¨âì'
db ' '
db ' §  †„-1 : PRI.MASTER - + à¨¬¥­¨âì'
db ' '
db 'Ÿ§ëª á¨á⥬ë : ENGLISH - + à¨¬¥­¨âì'
db ' '
db ' áª« ¤ª  ª« ¢¨ âãàë : ENGLISH - + à¨¬¥­¨âì'
db ' '
db ' §  WSS : 0x200 - + à¨¬¥­¨âì'
db ' '
db ' §¤¥« FAT32 ­  †„-1 : 1 - + à¨¬¥­¨âì'
db ' '
db '‡¢ãª®¢®© ª ­ « DMA : 1 - + à¨¬¥­¨âì'
db ' '
db '‚ª«îç¨âì LBA : OFF - + à¨¬¥­¨âì'
db ' '
db '„®áâ㯠ª 設¥ PCI : OFF - + à¨¬¥­¨âì'
db ' '
db '‘¨á⥬­®¥ ¢à¥¬ï : 0:00 - + ‚ë¡®à '
db ' '
db '‘¨á⥬­ ï ¤ â  (¬,¤,£) : 00/00/00 - + ‚ë¡®à '
db ' '
db '‘ª®à®áâì ªãàá®à  ¬ëè¨ : 1 - + à¨¬¥­¨âì'
db ' '
db '‡ ¤¥à¦ª  ã᪮७¨ï ¬ëè¨ : 0x00a - + à¨¬¥­¨âì'
db ' '
db '‚ˆŒ€ˆ…: à¨¬¥­¨âì ¢á¥ '
db 'ˆ‘Ž‹œ‡“‰’… „Ž‘’“ Š FAT ‘ Ž‘’ŽŽ†Ž‘’œž! '
db '… ‡€“„œ’… ‘Ž•€ˆ’œ €‘’Ž‰Šˆ ‘®åà ­¨âì ¢á¥ '
db 'x'
 
texteng:
 
db 'MIDI: ROLAND MPU-401 BASE : 0x320 - + APPLY '
db ' '
db 'SOUND: SB16 BASE : 0x240 - + APPLY '
db ' '
db 'CD-ROM BASE : PRI.SLAVE - + APPLY '
db ' '
db 'HARDDISK-1 BASE : PRI.MASTER - + APPLY '
db ' '
db 'SYSTEM LANGUAGE : ENGLISH - + APPLY '
db ' '
db 'KEYBOARD LAYOUT : ENGLISH - + APPLY '
db ' '
db 'WINDOWS SOUND SYSTEM BASE : 0x200 - + APPLY '
db ' '
db 'FAT32-1 PARTITION IN HD-1 : 1 - + APPLY '
db ' '
db 'SOUND DMA CHANNEL : 1 - + APPLY '
db ' '
db 'LBA READ ENABLED : OFF - + APPLY '
db ' '
db 'PCI ACCESS FOR APPL. : OFF - + APPLY '
db ' '
db 'SYSTEM TIME : 0:00 - + SELECT '
db ' '
db 'SYSTEM DATE (M,D,Y) : 00/00/00 - + SELECT '
db ' '
db 'Mouse pointer speed : 1 - + APPLY '
db ' '
db 'Mouse pointer delay : 0x00a - + APPLY '
db ' '
db 'NOTE: APPLY ALL '
db 'TEST FAT FUNCTIONS WITH EXTREME CARE '
db 'SAVE YOUR SETTINGS BEFORE QUIT MENUET SAVE ALL '
db 'x'
 
labelt:
db '€‘’Ž‰Š€ “‘’Ž‰‘’‚ DEVICE SETUP '
 
hex db '0123456789ABCDEF'
 
alt_general:
 
; db ' ',27
; db ' @ $ {[]}\ ',8,9
; db ' ',13
; db ' ',0,' ',0,'4',0,' '
; db ' ',180,178,184,'6',176,'7'
; db 179,'8',181,177,183,185,182
; db 'ABCD',255,'FGHIJKLMNOPQRSTUVWXYZ'
; db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
; db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
; db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
en_keymap:
 
db '6',27
db '1234567890-=',8,9
db 'qwertyuiop[]',13
db '~asdfghjkl;',39,96,0,'\zxcvbnm,./',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
en_keymap_shift:
 
db '6',27
db '!@#$%^&*()_+',8,9
db 'QWERTYUIOP{}',13
db '~ASDFGHJKL:"~',0,'|ZXCVBNM<>?',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
fr_keymap:
 
db '6',27
db '&Ž"',39,'(-_“)=',8,9
db 'azertyuiop^$',13
db '~qsdfghjklm’',0,0,'*wxcvbn,;:!',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
 
fr_keymap_shift:
 
 
db '6',27
db '1234567890+',8,9
db 'AZERTYUIOP•”',13
db '~QSDFGHJKLM%',0,'–WXCVBN?./',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
fr_keymap_alt_gr:
 
 
db '6',27
db 28,'~#{[|˜\^@]}',8,9
db 'azertyuiop^$',13
db '~qsdfghjklm’',0,0,'*wxcvbn,;:!',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
 
 
fi_keymap:
 
db '6',27
db '1234567890+[',8,9
db 'qwertyuiop',192,'~',13
db '~asdfghjkl',194,193,'1',0,39,'zxcvbnm,.-',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
fi_keymap_shift:
 
db '6',27
db '!"#%&/()=?]',8,9
db 'QWERTYUIOP',200,'~',13
db '~ASDFGHJKL',202,201,'1',0,'*ZXCVBNM;:_',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
 
ge_keymap:
 
db '6',27
db '1234567890?[',8,9
db 'qwertzuiop',203,'~',13
db '~asdfghjkl',194,193,'1',0,39,'yxcvbnm,.-',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
ge_keymap_shift:
 
db '6',27
db '!"#$%&/()=',197,']',8,9
db 'QWERTZUIOP',195,'~',13
db '~ASDFGHJKL',202,201,'1',0,'*YXCVBNM;:_',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
ru_keymap:
 
db '6',27
db '1234567890-=',8,9
db '©æ㪥­£èé§åê',13
db 0,"ä뢠¯à®«¤¦í"
db 0xf1, '-/'
db "ïçᬨâì¡î",'.-','45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
 
ru_keymap_shift:
 
db '6',27
db '!"N;%:?*()_+',8,0
db "‰–“Š…ƒ˜™‡•š",13
db 0,"”›‚€Ž‹„†"
db 0xf0, '-\'
db "Ÿ—‘Œˆ’œž",',-','45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
et_keymap:
 
db '6',27
db '1234567890+´',8,9
db 'qwertyuiopüõ',13
db '~asdfghjklöä','1',0,'<zxcvbnm,.-',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
et_keymap_shift:
 
db '6',27
db '!"#¤%&/()=?`',8,9
db 'QWERTYUIOPÜÕ',13
db '~ASDFGHJKLÖÄ','1',0,'>ZXCVBNM;:_',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
read_fileinfo:
dd 0
dd 0
dd 0
dd 56
dd keyboard
db 0
dd file_name
 
save_fileinfo:
dd 2
dd 0
dd 0
dd 56
dd keyboard
file_name: db '/hd0/1/kolibri/etc/setup.dat',0
 
I_PARAM dd 0
 
keyboard dd 0x0
midibase dd 0x320
cdbase dd 0x2
sb16 dd 0x220
syslang dd 0x1
wss dd 0x1
wssp dd 0x0
hdbase dd 0x1
f32p dd 0x1
sound_dma dd 0x1
lba_read dd 0x1
pci_acc dd 0x1
mouse_speed dd 0x3
mouse_delay dd 0x10
text00:
 
 
I_END:
table_area:
/kernel/branches/hd_kolibri/apps/vrr_m/build.bat
0,0 → 1,2
fasm vrr_m.asm vrr_m
pause
/kernel/branches/hd_kolibri/apps/vrr_m/macros.inc
0,0 → 1,269
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
dw ? ; +52 - reserved
.client_left dd ? ; +54
.client_top dd ? ; +58
.client_width dd ? ; +62
.client_height dd ? ; +66
.wnd_state db ? ; +70
rb (1024-71)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
/kernel/branches/hd_kolibri/apps/vrr_m/vrr_m.asm
0,0 → 1,123
;
; à¨¬¥à ¯à®£à ¬¬ë ¤«ï MenuetOS
; ®§¢ã稢 ¥â ª®¤ ­ ¦ â®© ª« ¢¨è¨ ;)
;
; Š®¬¯¨«¨à®¢ âì FASM'®¬
;
; ‘¬. â ª¦¥:
; template.asm - ¯à¨¬¥à ¯à®á⥩襩 ¯à®£à ¬¬ë (­®¢ë©!)
; rb.asm - ª®­â¥ªáâ­®¥ ¬¥­î à ¡®ç¥£® á⮫ 
; example2.asm - ¯à¨¬¥à ¬¥­î ¨ ¤®¯®«­¨â¥«ì­ëå ®ª®­
; example3.asm - ¯à¨¬¥à ¬¥­î, ॠ«¨§®¢ ­­®£® ¯®-¤à㣮¬ã
;---------------------------------------------------------------------
 
use32 ; ¢ª«îç¨âì 32-¡¨â­ë© ०¨¬  áᥬ¡«¥à 
org 0x0 ;  ¤à¥á æ¨ï á ­ã«ï
 
db 'MENUET01' ; 8-¡ ©â­ë© ¨¤¥­â¨ä¨ª â®à MenuetOS
dd 0x01 ; ¢¥àá¨ï § £®«®¢ª  (¢á¥£¤  1)
dd START ;  ¤à¥á ¯¥à¢®© ª®¬ ­¤ë
dd I_END ; à §¬¥à ¯à®£à ¬¬ë
dd 0x1000 ; ª®«¨ç¥á⢮ ¯ ¬ïâ¨
dd 0x1000 ;  ¤à¥á ¢¥à設ë áâíª 
dd 0x0 ;  ¤à¥á ¡ãä¥à  ¤«ï ¯ à ¬¥â஢ (­¥ ¨á¯®«ì§ã¥âáï)
dd 0x0 ; § à¥§¥à¢¨à®¢ ­®
 
include 'MACROS.INC' ; ¬ ªà®áë ®¡«¥£ç îâ ¦¨§­ì  áᥬ¡«¥à騪®¢!
 
;---------------------------------------------------------------------
;--- €—€‹Ž Žƒ€ŒŒ› ----------------------------------------------
;---------------------------------------------------------------------
 
START:
; mcall 5,10
mov ecx, 1
mov edx, drvinfo
push @f
jmp call_driver
@@:
; jmp run_launcher
 
mov ecx, 2
push @f
call_driver:
mcall 21,13
ret
@@:
; cmp eax,-1
inc eax
je run_launcher
; cmp ecx,280
; je change_vrr
; cmp ecx,277
; je change_vrr
; cmp ecx,6
; je change_vrr
; cmp ecx,7
; je change_vrr
; jmp run_launcher
change_vrr:
; mov ax,cx
; dec cx
; shl cx,1
; xor edx,edx
; mov dx,[vidmode+ecx]
; mov ebx,ecx
; shl ebx,2
; add ebx,ecx ; ebx=ebx*5
; shr ax,8
; dec ax
; shl ax,1
; add ebx,eax
; ror edx,16
; mov dx,[_m1+ebx]
; rol edx,16
;mov eax,ecx
mov eax, 10
cmp cx,277+3
je yes_277
cmp cx,274+3
jne yes_280
yes_274:
add al,10
yes_277:
add al,10
yes_280:
mov edx, [_m1+eax-2]
lea dx, [ecx-3]
push run_launcher
mov ecx, 3
jmp call_driver
run_launcher:
mcall 70,launcher
mcall -1
 
launcher:
dd 7
dd 0
dd 0
dd 0
dd 0
db 0
prog: dd autorun_prog
 
autorun_prog db '/hd0/1/kolibri/bin/launcher',0
I_END: ; ¬¥âª  ª®­æ  ¯à®£à ¬¬ë
db ? ; system loader will zero all memory after program end
; this byte will be terminating zero for launcher string
; \begin{Serge}
; A you really believe it?
; Áëàæåí, êòî âåðóåò, òåïëî åìó íà ñâåòå!
; \end{Serge}
drvinfo: ; 512 bytes driver info area
; +0 - Full driver name
; +32 - Driver version
; +64 - Word List of support video modes (max 32 positions)
; +128 - 5 words list of support vertical rate to each present mode
org $+32
drvver:
org $+32
vidmode:
org $+64
_m1:
org drvinfo+200h