Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 485 → Rev 484

/programs/media/mv/trunk/mv.asm
15,7 → 15,7
dd temp_area , 0x0 ; I_Param , I_Icon
 
include 'lang.inc'
include '..\..\..\macros.inc'
include 'macros.inc'
;******************************************************************************
 
START: ; start of execution
27,7 → 27,7
call convert
call background
or eax,-1
mcall
int 0x40
.no_boot:
 
cmp byte [temp_area],0
52,7 → 52,7
.no_param:
 
 
or ecx,-1 ; get information about me
mov ecx,-1 ; get information about me
call getappinfo
 
mov edx,[process_info+30] ; ⥯¥àì ¢ edx ­ è ¨¤¥­â¨ä¨ª â®à
75,7 → 75,7
still:
 
mov eax,10 ; wait here for event
mcall
int 0x40
 
dec eax
jz red
84,7 → 84,7
 
key: ; key
mov al,2
mcall
int 0x40
mov al,ah
cmp al,6
je kfile
102,19 → 102,19
mov al, 18
mov ebx, 3
mov ecx, [process]
mcall
int 0x40
and byte [status], not 4
jmp still
 
button: ; button
mov eax,17 ; get id
mcall
int 0x40
 
cmp ah,1 ; button id=1 ?
jne noclose
 
mov eax,-1 ; close this program
mcall
int 0x40
noclose:
cmp ah,2
jne nofile
126,7 → 126,7
mov ebx,1
mov ecx,thread1
mov edx,0x29fff0
mcall
int 0x40
jmp still
nofile:
cmp ah,3
141,7 → 141,7
add ecx,50*65536-55
mov edx,0xffffff
mov eax,13
mcall
int 0x40
 
call load_image
 
163,7 → 163,7
mov ebx,1
mov ecx,thread2
mov edx,0x2afff0
mcall
int 0x40
jmp still
noinfo:
 
178,7 → 178,7
mov ebx,1
mov ecx,thread3
mov edx,0x2bfff0
mcall
int 0x40
jmp still
;call background
 
185,7 → 185,7
getappinfo:
mov eax,9
mov ebx,process_info
mcall
int 0x40
ret
 
 
192,7 → 192,7
load_image:
mov eax, 70
mov ebx, fileinfo
mcall
int 0x40
mov eax,[I_END+18]
mov ebx,[I_END+22]
test ebx, ebx
218,7 → 218,7
mov ecx,-1
mov ebx,-1
mov eax,67
mcall
int 40h
@@:
ret
 
235,7 → 235,7
neg cx
@@:
mov edx,10*65536+50
mcall
int 0x40
nodrawimage:
ret
 
247,7 → 247,7
mov ebx,1
mov ecx,[I_END+18] ; è¨à¨­ 
mov edx,[I_END+22] ; ¢ëá®â 
mcall
int 0x40
 
mov esi, ecx
imul esi, edx
256,14 → 256,14
mov ecx,[soi]
xor edx,edx
;;; mov esi, ;640*480*3
mcall
int 0x40
 
dec ebx ;tile/stretch
mov ecx,dword [bgrmode]
mcall
int 0x40
 
dec ebx
mcall
int 0x40
@@:
ret
 
443,7 → 443,7
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mcall
int 0x40
 
; DRAW WINDOW
xor eax,eax ; function 0 : define and draw window
454,7 → 454,7
add ebx,[wnd_width]
add ecx,[wnd_height]
mov edx,0x03ffffff ; color of work area RRGGBB,8->color gl
mcall
int 0x40
 
mov eax,8
mov ebx,10*65536+46
462,7 → 462,7
mov edx,2
mov esi,0x780078
newbutton:
mcall
int 0x40
add ebx,48*65536
inc edx
cmp edx,6
474,18 → 474,18
mov ecx,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB )
mov edx,labelt ; pointer to text beginning
mov esi,12 ; text length
mcall
int 0x40
 
mov ebx,14*65536+32
mov edx,buttext
mov esi,26
mcall
int 0x40
 
call drawimage
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
mcall
int 0x40
 
ret
 
507,7 → 507,7
still1:
 
mov eax,10 ; wait here for event
mcall
int 0x40
 
cmp eax,1 ; redraw request ?
je thread1
519,7 → 519,7
jmp still1
 
key1: ; key
mcall
int 0x40
cmp ah,179
jne noright
mov eax,[pos]
596,7 → 596,7
 
button1: ; button
mov eax,17 ; get id
mcall
int 0x40
 
cmp ah,1 ; button id=1 ?
jne noclose1
605,13 → 605,13
bts dword [status],2
btr dword [status],0
mov eax,-1 ; close this program
mcall
int 0x40
noclose1:
cmp ah,2
jne nosetcur
mov eax,37
mov ebx,1
mcall
int 0x40
shr eax,16
sub eax,21
xor edx,edx
645,7 → 645,7
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mcall
int 0x40
 
; DRAW WINDOW
xor eax,eax ; function 0 : define and draw window
652,7 → 652,7
mov ebx,100*65536+300 ; [x start] *65536 + [x size]
mov ecx,100*65536+80 ; [y start] *65536 + [y size]
mov edx,0x03780078 ; color of work area RRGGBB,8->color gl
mcall
int 0x40
 
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
660,13 → 660,13
mov ecx,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB )
mov edx,labelt1 ; pointer to text beginning
mov esi,labelt1.size ; text length
mcall
int 0x40
 
call drawstring
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
mcall
int 0x40
 
ret
 
676,11 → 676,11
mov ebx,21*65536+258
mov ecx,40*65536+15
mov edx,0x60000002
mcall
int 0x40
 
mov eax,13 ;bar
mov edx,0xe0e0e0
mcall
int 0x40
push eax ;cursor
mov eax,6*65536
mul dword [pos]
688,13 → 688,13
mov ebx,eax
pop eax
mov edx,0x6a73d0
mcall
int 0x40
mov eax,4 ;path
mov ebx,21*65536+44
xor ecx,ecx
mov edx,string
mov esi,43
mcall
int 0x40
 
 
popa
714,7 → 714,7
still2:
 
mov eax,10 ; wait here for event
mcall
int 0x40
 
cmp eax,1 ; redraw request ?
je thread2
727,7 → 727,7
 
button2: ; button
mov eax,17 ; get id
mcall
int 0x40
 
cmp ah,1 ; button id=1 ?
jne noclose2
735,7 → 735,7
btr dword [status],1
bts dword [status],2
mov eax,-1 ; close this program
mcall
int 0x40
noclose2:
 
jmp still2
753,7 → 753,7
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mcall
int 0x40
 
; DRAW WINDOW
xor eax,eax ; function 0 : define and draw window
760,7 → 760,7
mov ebx,100*65536+330 ; [x start] *65536 + [x size]
mov ecx,100*65536+90 ; [y start] *65536 + [y size]
mov edx,0x03780078 ; color of work area RRGGBB,8->color gl
mcall
int 0x40
 
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
768,17 → 768,17
mov ecx,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB )
mov edx,labelt2 ; pointer to text beginning
mov esi,labelt2.size ; text length
mcall
int 0x40
 
mov ebx,10*65536+30
mov edx,string
mov esi,43
mcall
int 0x40
mov edx,fitext
mov esi,14
add ebx,70*65536+10
followstring:
mcall
int 0x40
add ebx,10
add edx,esi
cmp ebx,80*65536+70
788,23 → 788,23
mov esi,ecx
mov ecx, [I_END+2]
call digitcorrect
mcall
int 0x40
add edx,10
mov ecx, [I_END+18]
call digitcorrect
mcall
int 0x40
add edx,10
mov ecx, [I_END+22]
call digitcorrect
mcall
int 0x40
add edx,10
movzx ecx,word [I_END+28]
call digitcorrect
mcall
int 0x40
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
mcall
int 0x40
 
ret
 
861,7 → 861,7
still3:
 
mov eax,10 ; wait here for event
mcall
int 0x40
 
cmp eax,1 ; redraw request ?
je thread3
873,7 → 873,7
jmp still3
 
key3:
mcall
int 0x40
cmp ah,27
je close3
cmp ah,13
897,7 → 897,7
 
button3: ; button
mov eax,17 ; get id
mcall
int 0x40
 
cmp ah,1 ; button id=1 ?
jne noclose3
905,7 → 905,7
btr dword [status],3
bts dword [status],2
mov eax,-1 ; close this program
mcall
int 0x40
noclose3:
cmp ah,4
jne nook
936,7 → 936,7
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mcall
int 0x40
 
; DRAW WINDOW
xor eax,eax ; function 0 : define and draw window
943,7 → 943,7
mov ebx,100*65536+200 ; [x start] *65536 + [x size]
mov ecx,100*65536+100 ; [y start] *65536 + [y size]
mov edx,0x03780078 ; color of work area RRGGBB,8->color gl
mcall
int 0x40
 
mov eax,8
mov ebx,70*65536+40
950,7 → 950,7
mov ecx,70*65536+20
mov edx,4
mov esi,0xac0000
mcall
int 0x40
 
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
958,30 → 958,30
mov ecx,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB )
mov edx,labelt3 ; pointer to text beginning
mov esi,labelt3.size ; text length
mcall
int 0x40
add ebx,38*65536+20
mov ecx,0xddeeff
mov edx, bgrdtext
mov esi, bgrdtext.size
mcall
int 0x40
add ebx,40*65536+15
mov edx, tiled
mov esi, tiled.size
mcall
int 0x40
add ebx,15
mov edx, stretch
mov esi, stretch.size ;7
mcall
int 0x40
add ebx,18
mov edx, ok_btn
mov esi, ok_btn.size ;2
mcall
int 0x40
 
call drawflags
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
mcall
int 0x40
 
ret
 
991,10 → 991,10
mov ecx,40*65536+10
mov edx,2
mov esi,0xe0e0e0
mcall
int 0x40
add ecx,15*65536
inc edx
mcall
int 0x40
mov eax,4
mov ebx,73*65536+42
xor ecx,ecx
1004,7 → 1004,7
je nodownflag
add ebx,15
nodownflag:
mcall
int 0x40
ret
 
 
/programs/media/mv/trunk/build_en.bat
1,5 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm mv.asm mv
@erase lang.inc
@pause
/programs/media/mv/trunk/build_ru.bat
1,5 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm mv.asm mv
@erase lang.inc
@pause
/programs/media/mv/trunk/macros.inc
0,0 → 1,267
; 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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property