Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 485 → Rev 470

/programs/media/jpegview/trunk/jpegview.asm
41,7 → 41,7
 
stack_size=4096 + 1024
 
include '..\..\..\macros.inc'
include 'macros.inc'
 
START: ; start of execution
 
63,7 → 63,7
push still
mov ebx,100 ;1 second
mov eax,23 ; wait here for event
mcall
int 0x40
cmp eax,1 ; redraw request ?
je draw_window
cmp eax,2 ; key in buffer ?
74,7 → 74,7
 
button: ; BUTTON
mov eax,17
mcall
int 0x40
cmp ah,3
je set_as_bgr2
cmp ah,2
83,7 → 83,7
jne close_program.exit
close_program:
mov eax,-1
mcall
int 0x40
.exit:
ret
 
109,7 → 109,7
mov ebx,edi
mov eax,7
 
mcall ; Put image function
int 40h ; Put image function
.l1:
popad
ret
171,7 → 171,7
mov ebx, 1
mov ecx, [ebp + x_size]
mov edx, [ebp + y_size]
mcall
int 0x40
 
mov dword [ebp+draw_ptr],put_chunk_to_bgr
call jpeg_display
180,11 → 180,11
mov eax, 15
mov ebx, 4
mov ecx, 2
mcall
int 0x40
 
mov eax, 15
mov ebx, 3
mcall
int 0x40
 
 
.end:
214,7 → 214,7
mov ecx, [x_pointer]
mov edx, [x_offset]
mov esi, [x_numofbytes]
mcall
int 0x40
mov eax, [x_numofbytes]
add [x_pointer], eax
mov eax, [x_numofb2]
240,11 → 240,11
mov ebx,3
mov ecx,sc
mov edx,sizeof.system_colors
mcall
int 0x40
 
mov eax,12
mov ebx,1
mcall
int 0x40
 
; Draw the window to the appropriate size - it may have
; been resized by the user
263,7 → 263,7
mov eax, 9
mov ebx, memsize - 1024
mov ecx, -1
mcall
int 0x40
mov eax, [ebx + 34]
mov [winxo], ax
mov eax, [ebx + 38]
282,8 → 282,8
xor eax,eax ; DRAW WINDOW
mov edx,[sc.work]
or edx,0x33000000
mov edi,title ; WINDOW LABEL
mcall
mov edi,header ; WINDOW LABEL
int 0x40
 
 
mov eax,8 ; BUTTON 2: slideshow
294,7 → 294,7
add ecx, 12
mov esi, [sc.work_button]
mov edx,2
mcall
int 0x40
 
mov eax,4 ; Button text
movzx ebx, word [winys]
302,7 → 302,7
mov ecx,[sc.work_button_text]
mov edx,setname
mov esi,setnamelen-setname
mcall
int 0x40
 
 
mov eax,8 ; BUTTON 3: set as background
316,7 → 316,7
add ecx, 12
mov esi, [sc.work_button]
mov edx,3
mcall
int 0x40
 
mov eax,4 ; Button text
movzx ebx, word [winxs]
327,12 → 327,12
mov ecx,[sc.work_button_text]
mov edx,setbgr
mov esi,setbgrlen-setbgr
mcall
int 0x40
call print_strings
call load_image
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
mcall
int 0x40
 
ret
 
343,7 → 343,7
movzx edi,byte[name_string.cursor]
add edi,name_string
mov eax,2
mcall ; Get the key value
int 0x40 ; Get the key value
shr eax,8
cmp eax,13 ; Return key ends input
je .rs_done
391,7 → 391,7
add ecx, 1 shl 16
 
mov edx,[sc.work]
mcall
int 0x40
mov ebp,[jpeg_st]
test ebp,ebp
jz .exit
409,7 → 409,7
shl ecx, 16
add ecx, 12
mov edx,0xffffff
mcall
int 0x40
 
mov eax,4 ;
movzx ebx, word [winys]
417,7 → 417,7
mov ecx,0x000000
mov edx,name_string
mov esi,60
mcall
int 0x40
popa
ret
 
455,7 → 455,7
mov byte [ebx+12], 1
mov dword [ebx+16], dirinfo
mov eax, 70
mcall
int 0x40
mov eax, [file_dir]
inc dword [eax+4]
cmp ebx, 1
502,7 → 502,7
; DATA AREA
 
wcolor dd 0x000000
title db appname,version,0
header db appname,version,0
setname db 'SLIDESHOW'
setnamelen:
 
/programs/media/jpegview/trunk/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
/programs/media/pic4/trunk/pic4.asm
12,7 → 12,7
dd I_Param,0
 
include 'lang.inc'
include '..\..\..\macros.inc'
include 'macros.inc'
 
START:
mov eax,48
31,16 → 31,18
still:
 
mov eax,10 ; wait here for event
mcall
 
dec eax
int 0x40
cmp eax,1
jz red
dec eax
jnz button
cmp eax,2
jz key
cmp eax,3
jz button
jmp still
 
key:
mov al,2
mcall
mov eax,2
int 0x40
jmp still
 
red:
48,10 → 50,11
jmp still
 
button:
mov al,17
mcall
mov eax,17
int 0x40
 
shr eax,8
and eax,255
 
cmp eax,101 ; tiled
jne no101
58,10 → 61,10
mov eax,15
mov ebx,4
mov ecx,1
mcall
int 0x40
mov eax,15
mov ebx,3
mcall
int 0x40
jmp still
no101:
 
70,18 → 73,18
mov eax,15
mov ebx,4
mov ecx,2
mcall
int 0x40
mov eax,15
mov ebx,3
mcall
int 0x40
jmp still
no102:
 
cmp eax,1 ; end program
jnz no_end
jnz noproend
or eax,-1
mcall
no_end:
int 0x40
noproend:
 
cmp eax,11
jz bg
123,7 → 126,7
mov ebx,1
mov ecx,256
mov edx,256
mcall
int 0x40
 
mov eax,15
mov ebx,5
131,19 → 134,19
; <<< 0x40000+2 for green background at boot
mov edx,0
mov esi,256*3*256
mcall
int 0x40
 
mov eax,15
mov ebx,4
mov ecx,2
mcall
int 0x40
 
mov eax,15
mov ebx,3
mcall
int 0x40
 
mov eax,-1
mcall
int 0x40
 
 
 
191,7 → 194,7
mov ebx,1
mov ecx,256
mov edx,256
mcall
int 0x40
 
mov eax,15
mov ebx,5
198,11 → 201,11
mov ecx,edi
mov edx,0
mov esi,256*256*3
mcall
int 0x40
 
mov eax,15
mov ebx,3
mcall
int 0x40
 
jmp still
 
213,30 → 216,35
 
push eax
 
mcall 15,4,1
 
mov eax,15
mov ebx,1
mov ecx,1
mov edx,1
mcall
mov ecx,8
mov edx,8
int 0x40
 
pop eax
mov eax,[esp]
 
sub eax,14
imul eax,3
shl eax,2
 
mov ecx,fill
add ecx,eax
mov edx,[colors+eax]
 
mov esi,32*32*4
mov edi,0
mov ecx,0
dbl2:
mov eax,15
mov ebx,5
xor edx,edx
mov esi,3*1*1
mcall
mov ebx,2
int 0x40
add ecx,3
inc edi
cmp edi,esi
jb dbl2
 
 
mov eax,15
mov ebx,3
mcall
int 0x40
 
jmp still
 
253,11 → 261,11
 
mov eax,15
mov ebx,1
mcall
int 0x40
 
mov eax,15
mov ebx,3
mcall
int 0x40
 
jmp still
 
354,7 → 362,7
mov ebx,0x40000
mov ecx,256*65536+255
mov edx,14*65536+40;55
mcall
int 0x40
 
ret
 
369,7 → 377,7
 
mov eax, 12 ; tell os about draw
mov ebx, 1
mcall
int 0x40
 
xor eax, eax ; define and draw window
mov ebx, 220*65536+293
376,8 → 384,8
mov ecx, 50*65536+408
mov edx, [sc.work]
or edx, 0x33000000
mov edi, title
mcall
mov edi, header
int 0x40
 
call draw_image
 
386,17 → 394,17
mov ecx,y_add*65536+y_s
mov edx,11
mov esi,0x005555bb
mcall
int 0x40
;mov eax,8 ; Red button
mov ebx,(set+208+27)*65536+17
mov edx,12
mov esi,0x00bb5555
mcall
int 0x40
;mov eax,8 ; Green button
mov ebx,(set+253)*65536+17
mov edx,13
mov esi,0x0055bb55
mcall
int 0x40
 
;mov eax, 8 ; tiled
mov ebx, 90*65536+63
403,12 → 411,12
mov ecx, y_add*65536+y_s
mov edx, 101
mov esi, [sc.work_button]
mcall
int 0x40
 
;mov eax, 8 ; stretch
mov ebx, 154*65536+61
mov edx, 102
mcall
int 0x40
 
mov eax, 4
mov ebx, 215*65536+5
415,17 → 423,17
mov ecx, [sc.work_text]
mov edx, apply_text
mov esi, apply_text.size
mcall
int 0x40
 
mov ebx, 14*65536+301
mov edx, image_buttons_text
mov esi, image_buttons_text.size
mcall
int 0x40
 
mov ebx, 14*65536+(y_add2+27)
mov edx, simple_text
mov esi, simple_text.size
mcall
int 0x40
 
mov ecx, (y_add2)*65536+20
mov ebx, (13)*65536+25
434,7 → 442,7
mov edi, 9
mov eax, 8
@@:
mcall
int 0x40
add ebx, 29*65536
inc edx
dec edi
443,11 → 451,11
 
mov edx, 34+4
mov edi, 4
;mov eax, 8
mov eax, 8
mov ebx, 13*65536+18
mov ecx, y_add*65536+y_s
@@:
mcall
int 0x40
inc edx
add ebx, 19*65536
dec edi
455,7 → 463,6
 
 
;-----------------------
mov eax,8
mov edx,14 ; button number
mov ebx,(13)*65536+17 ; button start x & size
mov ecx,(y_add2+40)*65536+14 ; button start y & size
463,10 → 470,12
newcb:
mov esi,[(edx-14)*4+colors]
 
mcall
mov eax,8
int 0x40
 
inc edx
add ebx,20*65536
add esi,5*256*256
 
cmp edx,27
jnz newcb
477,11 → 486,11
mov ecx, [sc.work_button_text]
mov edx, la2
mov esi, la2.size
mcall
int 0x40
 
mov eax,12
mov ebx,2
mcall
int 0x40
 
ret
 
490,9 → 499,9
; DATA SECTION
 
if lang eq ru
title db 'ƒ¥­¥à â®à ä®­  à ¡®ç¥£® á⮫ ',0
header db 'ƒ¥­¥à â®à ä®­  à ¡®ç¥£® á⮫ ',0
else
title db 'Background',0
header db 'Background',0
end if
 
lsz apply_text,\
526,23 → 535,9
dd 0x775533
dd 0x773355
dd 0x553377
dd 0x111111
dd 0x000000
dd 0xcccccc
 
fill:
db 0x00,0x00,0x77
db 0x00,0x77,0x00
db 0x77,0x00,0x00
db 0x00,0x77,0x77
db 0x77,0x00,0x77
db 0x77,0x77,0x00
db 0x77,0x77,0x77
db 0x77,0x55,0x33
db 0x33,0x55,0x77
db 0x55,0x33,0x77
db 0x77,0x33,0x55
db 0x11,0x11,0x11
db 0xcc,0xcc,0xcc
 
shape:
 
/programs/media/pic4/trunk/build_en.bat
1,5 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm pic4.asm pic4
@erase lang.inc
@pause
/programs/media/pic4/trunk/build_ru.bat
1,5 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm pic4.asm pic4
@erase lang.inc
@pause
/programs/media/pic4/trunk/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
/programs/media/scrshoot/scrshoot.asm
13,7 → 13,7
meos_header cmdstr ; ¢áâ ¢«ï¥¬ § £®«®¢®ª ¯à®£à ¬¬ë
include 'scrwin.inc' ; ¢áâ ¢«ï¥¬ ª®¤ ®ª­  ¯à¤¯à®á¬®âà 
include 'scrsavef.inc'; ¢áâ ¢«ï¥¬ ¯à®æ¥¤ãàã á®åà ­¥­¨ï ä ©« 
use_edit_box structure_of_potock,22,5 ; \
use_edit_box ; \
use_txt_button ; |
use_label ; |-- GUI ª®¬¯®­¥­âë ¨ ­¥ª®â®àë¥ ¯à®æ¥¤ãàë
use_check_box ; |
492,10 → 492,10
labels_end:
 
editboxes:
edit1 edit_box 300,5,35,cl_white,0xaabbcc,0,0,0,1024,ed_buffer.1,ed_focus ; ¯ãâì ª ä ©«ã
edit2 edit_box 35,75,134,cl_white,0xaabbcc,0,0,0,9,ed_buffer.2,ed_figure_only ; § ¤¥à¦ª 
edit3 edit_box 35,165,164,cl_white,0xaabbcc,0,0,0,9,ed_buffer.3,ed_figure_only
edit4 edit_box 16,165,181,cl_white,0xaabbcc,0,0,0,1,sign_n_input,ed_figure_only,1
edit1 edit_box 300,5,35,cl_white,0,0,0,1024,ed_buffer.1,ed_focus ; ¯ãâì ª ä ©«ã
edit2 edit_box 35,75,134,cl_white,0,0,0,9,ed_buffer.2,ed_figure_only ; § ¤¥à¦ª 
edit3 edit_box 35,165,164,cl_white,0,0,0,9,ed_buffer.3,ed_figure_only
edit4 edit_box 16,165,181,cl_white,0,0,0,1,sign_n_input,ed_figure_only,1
editboxes_end:
 
buttons:
/programs/media/scrshoot/macros.inc
9,10 → 9,6
include 'textwork.inc'
;include 'ini.inc'
 
__CPU_type equ p5
SYSENTER_VAR equ 0
 
 
macro movr reg,val
{
if val < 65536
23,49 → 19,6
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld, updated by Ghost for Fast System Calls
local ..ret_point
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
 
if __CPU_type eq p5
int 0x40
else
if __CPU_type eq p6
push ebp
mov ebp, esp
push ..ret_point ; it may be 2 or 5 byte
sysenter
..ret_point:
pop edx
pop ecx
 
else
if __CPU_type eq k6
push ecx
syscall
pop ecx
else
display 'ERROR : unknown CPU type'
int 0x40
end if
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 meos_header par_buf,cur_dir_buf
{
/programs/media/animage/trunk/animage.asm
21,7 → 21,6
dd parameters,0x0
 
 
include '..\..\..\macros.inc'
include 'giflib.inc'
include 'bmplib.inc'
include 'dialog.inc'
40,7 → 39,7
;--------------------------------------------------------
mov eax,40
mov ebx,1100111b
mcall
int 0x40
;---------------------------------------------------------
;-----------------------init data-------------------------
;---------------------------------------------------------
/programs/media/animage/trunk/cursors.inc
12,7 → 12,7
mov ebx, 4
mov ecx,brush_cursor
mov edx,1
mcall
int 0x40
 
mov ebx,[PointerToCursorsID]
mov [ebx],eax
22,7 → 22,7
mov ebx, 4
mov ecx,flood_fill_cursor
mov edx,1
mcall
int 0x40
 
mov ebx,[PointerToCursorsID]
mov [ebx],eax
32,7 → 32,7
mov ebx, 4
mov ecx,lastik_cursor
mov edx,1
mcall
int 0x40
 
mov ebx,[PointerToCursorsID]
mov [ebx],eax
43,7 → 43,7
mov ebx, 4
mov ecx,other_cursor
mov edx,1
mcall
int 0x40
 
 
mov ebx,[PointerToCursorsID]
54,7 → 54,7
mov ebx, 4
mov ecx,pencil_cursor
mov edx,1
mcall
int 0x40
 
 
mov ebx,[PointerToCursorsID]
65,7 → 65,7
mov ebx, 4
mov ecx,pipette_cursor
mov edx,1
mcall
int 0x40
 
mov ebx,[PointerToCursorsID]
mov [ebx],eax
75,7 → 75,7
mov ebx, 4
mov ecx,spray_cursor
mov edx,1
mcall
int 0x40
 
mov ebx,[PointerToCursorsID]
mov [ebx],eax
85,7 → 85,7
mov ebx, 4
mov ecx,zoom_cursor
mov edx,1
mcall
int 0x40
 
mov ebx,[PointerToCursorsID]
mov [ebx],eax
288,7 → 288,7
 
mov eax, 37
mov ebx, 5
mcall
int 0x40
 
no_change_cursor:
 
312,7 → 312,7
 
mov eax,37
mov ebx,6
mcall
int 0x40
 
add [PointerToCursorsID],4
 
/programs/media/animage/trunk/design.inc
217,7 → 217,7
shl ecx,16
add ebx,[line_size_x]
add ecx,[line_size_y]
mcall
int 0x40
ret
;----------------------------------------------------------
draw_conture:
303,17 → 303,17
mov ebx,[text_x]
shl ebx,16
add ebx,[text_y]
mcall
int 0x40
ret
;----------------------------------------------------------
draw_rectangle:
mov eax,13
mcall
int 0x40
ret
;------------------------
draw_line:
mov eax,38
mcall
int 0x40
ret
;----------------------------------------------------------
;lightlin 12508927
/programs/media/animage/trunk/dialog.inc
22,8 → 22,8
; Get my PID in dec format 4 bytes
mov eax,9
mov ebx,procinfo
or ecx,-1
mcall
mov ecx,-1
int 0x40
 
; convert eax bin to param dec
mov eax,dword [procinfo+30] ;offset of myPID
57,12 → 57,12
mov ebx,1 ; define IPC
mov ecx,path ; offset of area
mov edx,1024+16 ; size
mcall
int 0x40
 
; change wanted events list 7-bit IPC event
mov eax,40
mov ebx,01000111b
mcall
int 0x40
 
;
; STEP 3 run SYSTEM XTREE with parameters
70,7 → 70,7
 
mov eax,70
mov ebx,run_fileinfo
mcall
int 0x40
 
call redproc
 
78,7 → 78,7
getmesloop:
mov eax,23
mov ebx,50 ;0.5 sec
mcall
int 0x40
dec eax
jz mred
dec eax
92,7 → 92,7
mov ebx,procinfo
mov ecx,-1
mov eax,9
mcall
int 0x40
mov ebp,eax
 
loox:
99,7 → 99,7
mov eax,9
mov ebx,procinfo
mov ecx,ebp
mcall
int 0x40
mov eax,[DLGPID]
cmp [procinfo+30],eax ;IF Dialog find
je dlg_is_work ;jmp to dlg_is_work
124,15 → 124,15
jmp getmesloop
mkey:
mov eax,2
mcall ; read (eax=2)
int 0x40 ; read (eax=2)
jmp getmesloop
mbutton:
mov eax,17 ; get id
mcall
int 0x40
cmp ah,1 ; button id=1 ?
jne getmesloop
mov eax,-1 ; close this program
mcall
int 0x40
mgetmes:
 
; If dlg_pid_get then second message get jmp to still
234,7 → 234,7
mov eax,9
mov ebx,procinfo
mov ecx,-1
mcall
int 0x40
 
; convert eax bin to param dec
mov eax,dword [procinfo+30] ;offset of myPID
268,12 → 268,12
mov ebx,1 ; define IPC
mov ecx,path ; offset of area
mov edx,1024+16 ; size
mcall
int 0x40
 
; change wanted events list 7-bit IPC event
mov eax,40
mov ebx,01000111b
mcall
int 0x40
 
;
; STEP 3 run SYSTEM XTREE with parameters
281,7 → 281,7
 
mov eax,70
mov ebx,run_fileinfo
mcall
int 0x40
 
call redproc
 
289,7 → 289,7
getmesloop:
mov eax,23
mov ebx,50 ;0.5 sec
mcall
int 0x40
dec eax
jz mred
dec eax
303,7 → 303,7
mov ebx,procinfo
mov ecx,-1
mov eax,9
mcall
int 0x40
mov ebp,eax
 
loox:
310,7 → 310,7
mov eax,9
mov ebx,procinfo
mov ecx,ebp
mcall
int 0x40
mov eax,[DLGPID]
cmp [procinfo+30],eax ;IF Dialog find
je dlg_is_work ;jmp to dlg_is_work
335,15 → 335,15
jmp getmesloop
mkey:
mov eax,2
mcall ; read (eax=2)
int 0x40 ; read (eax=2)
jmp getmesloop
mbutton:
mov eax,17 ; get id
mcall
int 0x40
cmp ah,1 ; button id=1 ?
jne getmesloop
mov eax,-1 ; close this program
mcall
int 0x40
mgetmes:
 
; If dlg_pid_get then second message get jmp to still
/programs/media/animage/trunk/events.inc
3,7 → 3,7
;----------------------------------------------------------
event:
mov eax,10
mcall
int 0x40
ret
;---------------------------------------------------------
;---------------SOUND of EVENTS---------------------------
11,5 → 11,5
sound:
mov eax,55
mov ebx,eax
mcall
int 0x40
ret
/programs/media/animage/trunk/events_of_buttons.inc
21,7 → 21,7
no_finish_instrument_button:
 
mov eax,17
mcall
int 0x40
 
shr eax,8
 
31,8 → 31,8
mov eax,CursorsID
call delete_cursors
 
or eax,-1
mcall
mov eax,-1
int 0x40
 
no_exit:
 
/programs/media/animage/trunk/events_of_keys.inc
4,7 → 4,7
keys:
 
mov eax,2
mcall
int 0x40
shr eax,8
 
cmp eax,176
80,7 → 80,7
call delete_cursors
 
mov eax,-1
mcall
int 0x40
 
jmp still
 
/programs/media/animage/trunk/events_of_mouse.inc
297,7 → 297,7
 
mov eax,37
mov ebx,1
mcall
int 0x40
 
mov ebx,eax
shr eax,16
313,6 → 313,6
GetMouseClick:
mov eax,37
mov ebx,2
mcall
int 0x40
 
ret
/programs/media/animage/trunk/events_of_window.inc
6,7 → 6,7
mov eax,9
mov ebx,IPC_table
or ecx,-1
mcall
int 0x40
 
mov eax,[IPC_table+34]
mov ebx,[IPC_table+38]
54,7 → 54,7
 
mov eax,12
mov ebx,1
mcall
int 0x40
 
and eax,0
mov ebx,[Window_CordinatX]
66,7 → 66,7
mov edx,0x03aabbcc
mov esi,0x805080d0
mov edi,0x005080d0
mcall
int 0x40
 
call draw_panel
call PrintMousePos
84,7 → 84,7
 
mov eax,12
mov ebx,2
mcall
int 0x40
 
mov ecx,[k]
 
/programs/media/animage/trunk/files.inc
26,7 → 26,7
 
mov eax,70
mov ebx,file_information
mcall
int 0x40
 
ret
;-----------------------------------------------------------
55,7 → 55,7
 
mov eax,70
mov ebx,file_information
mcall
int 0x40
test eax,eax
jnz error_load_file
75,7 → 75,7
 
mov eax,70
mov ebx,file_information
mcall
int 0x40
 
error_load_file:
 
108,7 → 108,7
 
mov eax,70
mov ebx,file_information
mcall
int 0x40
 
ret
 
/programs/media/animage/trunk/icons.inc
24,7 → 24,7
add ebx,(1200*1000*3)+12
mov eax,7
mov ecx,417*65536+46
mcall
int 0x40
 
 
;main buttons of instrumnts
47,7 → 47,7
mov edx,[counter]
add edx,10
add edx,1000000000000000000000000000000b
mcall
int 0x40
 
 
add [Icon_X],22
77,7 → 77,7
mov edx,[counter]
add edx,40
add edx,1000000000000000000000000000000b
mcall
int 0x40
 
add [Icon_X],19
 
106,7 → 106,7
mov edx,[counter]
add edx,45
add edx,1000000000000000000000000000000b
mcall
int 0x40
 
add [Icon_X],19
 
130,7 → 130,7
add ecx,21
mov edx,51
add edx,1000000000000000000000000000000b
mcall
int 0x40
 
; button of color
mov [Icon_X],7+128+1
147,12 → 147,12
add ecx,21
mov edx,52
add edx,1000000000000000000000000000000b
mcall
int 0x40
 
mov eax,13
mov ebx,136*65536+20
mov ecx,65*65536+20
mov edx,[Color]
mcall
int 0x40
 
ret
/programs/media/animage/trunk/icons_instruments.inc
173,7 → 173,7
mov ebx,136*65536+20
mov ecx,65*65536+21
mov edx,[Color]
mcall
int 0x40
 
jmp still
no_pipetka:
489,7 → 489,7
shl ecx,16
add ebx,13
add ecx,13
mcall
int 0x40
add [x],15
cmp [x],20+15*32
jl no_new_line
510,7 → 510,7
jne no_keys
 
mov eax,2
mcall
int 0x40
 
no_keys:
 
517,7 → 517,7
cmp eax,3
jne no_buttons
mov eax,17
mcall
int 0x40
 
no_buttons:
 
566,7 → 566,7
 
mov eax,5
mov ebx,10
mcall
int 0x40
 
call drawwin
 
/programs/media/animage/trunk/init_data.inc
36,12 → 36,12
 
;mov eax,68
;mov ebx,11
;mcall
;int 0x40
 
;mov eax,68
;mov ebx,12
;mov ecx,60000
;mcall
;int 0x40
 
;mov [PointerToIcons],eax
 
/programs/media/animage/trunk/load_dlls.inc
9,7 → 9,7
mov ecx,eax
mov eax,68
mov ebx,19
mcall
int 0x40
 
ret
 
/programs/media/animage/trunk/memory.inc
13,7 → 13,7
add ecx,[ScreenPointer]
add ecx,(1200*1000)*3+50*(20*20*3)+500000+16000+0x4000
add ecx,[extended_memory]
mcall
int 0x40
 
test eax,eax
jz have_new_memory
/programs/media/animage/trunk/menu_instruments.inc
65,7 → 65,7
mov ecx,115*65536+14
mov edx,1000000000000000000000000000000b
add edx,1000
mcall
int 0x40
 
mov eax,8
mov ebx,177*65536+40
72,7 → 72,7
mov ecx,139*65536+14
mov edx,1000000000000000000000000000000b
add edx,1001
mcall
int 0x40
 
mov eax,8
mov ebx,175*65536+40
79,12 → 79,12
mov ecx,170*65536+15
mov edx,1000000000000000000000000000000b
add edx,1002
mcall
int 0x40
 
no_activate_space:
 
mov eax,10
mcall
int 0x40
 
cmp eax,1
je exit_new
93,7 → 93,7
jne no_activate_space
 
mov eax,17
mcall
int 0x40
shr eax,8
 
cmp eax,1000
155,7 → 155,7
mov ecx,170*65536+15
mov edx,11100000000000000000000000000000b
add edx,1002
mcall
int 0x40
 
mov eax,8
mov ebx,177*65536+40
162,7 → 162,7
mov ecx,139*65536+14
mov edx,11100000000000000000000000000000b
add edx,1001
mcall
int 0x40
 
mov eax,8
mov ebx,177*65536+40
169,7 → 169,7
mov ecx,115*65536+14
mov edx,11100000000000000000000000000000b
add edx,1000
mcall
int 0x40
 
;get memory for new picture
mov eax,[Picture_SizeX]
222,7 → 222,7
 
mov eax,40
mov ebx,100111b
mcall
int 0x40
 
mov eax,file_path
mov ebx,[ScreenPointer]
387,7 → 387,7
save_enter:
mov eax,40
mov ebx,100111b
mcall
int 0x40
 
call analizing_picture_to_palette
;eax => number of colors in picture
428,7 → 428,7
jne no_exit_program
 
mov eax,-1
mcall
int 0x40
 
no_exit_program:
 
/programs/media/animage/trunk/panel_engen.inc
5,7 → 5,7
;>>>>>>>>>>>>>>>>>>>>>>>>>>
mov eax,18
mov ebx,14
;mcall
;int 0x40
 
and [Panel_flag],0
;collision with text on panel
50,7 → 50,7
 
mov eax,18
mov ebx,14
;mcall
;int 0x40
 
call print_panel_menu
 
92,7 → 92,7
mov eax,8
mov edx,[counter]
add edx,11100000000000000000000000000000b
mcall
int 0x40
inc [counter]
 
cmp [counter],30
106,7 → 106,7
mov eax,8
mov edx,[counter]
add edx,11100000000000000000000000000000b
mcall
int 0x40
inc [counter]
 
cmp [counter],45
120,7 → 120,7
mov eax,8
mov edx,[counter]
add edx,11100000000000000000000000000000b
mcall
int 0x40
inc [counter]
 
cmp [counter],50
130,7 → 130,7
mov eax,8
mov edx,51
add edx,11100000000000000000000000000000b
mcall
int 0x40
 
 
;delit buttons of color
137,7 → 137,7
mov eax,8
mov edx,52
add edx,11100000000000000000000000000000b
mcall
int 0x40
 
pop [counter]
 
174,7 → 174,7
;ᣫ ¦¨¢ ­¨¥  ­¨¬ æ¨¨ >>>>>>>>>>>>>>>>>>
mov eax,18
mov ebx,14
;mcall
;int 0x40
 
menu_loop:
 
231,11 → 231,11
menu_still:
 
mov eax,10
mcall
int 0x40
mov eax,2
mcall
int 0x40
mov eax,17
mcall
int 0x40
 
call GetMouseClick
 
292,7 → 292,7
 
mov eax,5
mov ebx,15
mcall
int 0x40
 
push [counter]
pushad
356,7 → 356,7
shl edx,16
add edx,20+15+6+6
and esi,0
mcall
int 0x40
 
mov eax,47
mov ebx,4*65536
367,7 → 367,7
shl edx,16
add edx,20+15+6+18+1+6
and esi,0
mcall
int 0x40
 
popad
ret
/programs/media/animage/trunk/screen.inc
239,7 → 239,7
fps:
;mov eax,18
;mov ebx,14
;mcall
;int 0x40
 
mov eax,7
mov ebx,[ScreenPointer]
248,7 → 248,7
shl ecx,16
add ecx,edx
mov edx,8*65536+20+15+49+5+1
mcall
int 0x40
 
ret
;----------------------------------------------------------
/programs/media/animage/trunk/time.inc
4,7 → 4,7
Clock:
mov eax,26
mov ebx,9
mcall
int 0x40
mov [time],eax
 
ret
/programs/media/animage/trunk/dialog2.inc
16,7 → 16,7
 
opros:
mov eax,10
mcall
int 0x40
 
cmp eax,1
je exit_cycle
25,7 → 25,7
jne opros
 
mov eax,2
mcall
int 0x40
shr eax,8
 
cmp eax,13
110,7 → 110,7
add ebx,2
add ecx,10
mov edx,0xffffff
mcall
int 0x40
mov eax,4
mov ebx,[string_x]
shl ebx,16
118,7 → 118,7
mov ecx,0
mov edx,string_
mov esi,[MaxSizeString]
mcall
int 0x40
ret
 
print_cursor:
132,7 → 132,7
add ebx,2
add ecx,8
mov edx,0xff6c58
mcall
int 0x40
ret
;----------------------------------------------------------
MinMaxCorrect:
/programs/media/midamp/trunk/MIDAMP.ASM
63,7 → 63,7
listsel dd 0
channel dd 0
COLOR_ORDER equ MENUETOS
include '..\..\..\macros.inc' ; decrease code size (optional)
include 'macros.inc' ; decrease code size (optional)
lang fix en
;purge mov
include 'debug.inc'
153,7 → 153,7
rep movsd
mov eax,70
mov ebx,file_info
mcall
int 0x40
add ebx,workarea
mov [midi_limit],ebx
mov edi,I_PARAM
225,7 → 225,7
mov ecx,ipcarea
call init_ipc
mov eax,10
mcall
int 0x40
prc_event:
test eax,eax
jz still
/programs/media/midamp/trunk/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
/programs/media/midamp/trunk/draw.inc
18,7 → 18,7
mov ecx,[ebp-12]
mov edx,0x84706a
mov eax,13
mcall
int 0x40
mov esi,TOTALTIME_XY
mov eax,[tick_count]
call draw_total_time
44,7 → 44,7
draw_window:
mov eax,12
mov ebx,1
mcall
int 0x40
or [flag],FL_BOTTRED
xor eax,eax
mov ebx,100*65536+275
61,7 → 61,7
mov edx,WND_BACK
mov esi,edx
mov edi,edx
mcall
int 0x40
mov ecx,[channel]
shl ecx,4
add cl,[sel_track]
77,16 → 77,16
mov ebx,265 shl 16+7
mov ecx,3 shl 16+7
mov edx,1+1 shl 30
mcall ; close button
int 0x40 ; close button
sub ebx,10 shl 16
mov edx,100+1 shl 30
mcall ; shade button-101
int 0x40 ; shade button-101
sub ebx,10 shl 16
add edx,3
mcall ; minimize button-103
int 0x40 ; minimize button-103
sub ebx,239 shl 16
inc edx ; about button-104
mcall
int 0x40
xor esi,esi
xor edi,edi
mov ecx,3
101,7 → 101,7
add ecx,[ebp-24]
mov esi,0x2c2b46
mov edx,2+1 shl 29
mcall
int 0x40
 
shr eax,1
 
129,7 → 129,7
mov ebx,btn_raw+12
mov ecx,BTNS_SIZE
mov edx,BTNS_XY
mcall
int 0x40
.nohide2:
mov esi,FL_SHUFFLE
mov edi,btncoords+8
148,7 → 148,7
add ecx,4 shl 16
add ecx,[ebp+4]
mov cx,2
mcall
int 0x40
pop ecx
.el:
add edi,8
158,7 → 158,7
.enddraw:
mov eax,12
mov ebx,2
mcall
int 0x40
ret
 
draw_navigation:
176,7 → 176,7
mov ecx,[ebp+4]
add ecx,[ebp-4]
add ecx,edi
mcall
int 0x40
pop ecx
add ebx,[ebp+8]
inc edx
192,7 → 192,7
mov ecx,[edi+4]
add ecx,[ebp+4]
add ecx,[esp+4]
mcall
int 0x40
pop ecx
add edi,8
inc edx
230,7 → 230,7
mcall 47,0x20000,,esi,0xf000
pop ecx
add edx,17 shl 16
mcall
int 0x40
sub edx,5 shl 16
mcall 4,edx,esi,dots,1
popa
/programs/media/midamp/trunk/event.inc
17,7 → 17,7
 
key:
mov eax,2
mcall
int 0x40
mov edi,key_codes
cmp ah,48
jb .jump
111,7 → 111,7
 
button:
mov eax,17
mcall
int 0x40
cmp ah,20
jb .nobott
cmp ah,25
149,7 → 149,7
_close:
call kill
or eax,-1
mcall
int 0x40
 
bShade:
call Shade
169,7 → 169,7
mov ecx,ebx
mov edx,ebx
mov eax,67
mcall
int 0x40
ret
bMinimize:
; mcall 18,10
258,7 → 258,7
jz still
mov eax,37
mov ebx,1
mcall
int 0x40
mov ebp,[coo]
sub eax,[ebp-16]
shr eax,16
/programs/media/midamp/trunk/playlist.inc
15,7 → 15,7
mov eax,13
mov ecx,PL_Y-1 shl 16+4+9*LISTITEMS
xor edx,edx
mcall
int 0x40
movzx ecx,byte[list_count]
test ecx,ecx
jz .ex2
24,7 → 24,7
add ecx,PL_Y-1 shl 16-2
mov edx,11+1 shl 29+1 shl 30
mov eax,8
mcall
int 0x40
pop ecx
mov edi,[pl_ptr]
mov eax,4
45,7 → 45,7
add ecx,PL_Y-1 shl 16+8
mov edx,0xc6
mov eax,13
mcall
int 0x40
popa
.nosel:
pusha
61,7 → 61,7
mov ecx,PCOLOR
.int:
add ebx,25 shl 16
mcall
int 0x40
popa
add edi,esi
add ebx,9
144,7 → 144,7
; out: eax- item # (0..n)
mov ebx,1
mov eax,37
mcall
int 0x40
sub eax,PLY-1
mov ebx,9
div bl
240,7 → 240,7
and dword[ebx],0
mov dword[ebx+12],20*512
mov eax,70
mcall
int 0x40
test eax,eax
jz .ok1 ; ebx- filesize
cmp eax,6
310,7 → 310,7
mov [ebx+12],edi
mov byte[ebx],2
mov eax,70
mcall
int 0x40
.ex:
ret
 
/programs/media/midamp/trunk/build.bat
1,2 → 1,0
@fasm MIDAMP.ASM MIDAMP
@pause
fasm MIDAMP.ASM MIDAMP
/programs/media/midamp/trunk/debug.inc
55,7 → 55,7
mov cl,al
mov eax,63
mov ebx,1
mcall
int 0x40
popad
popf
ret
/programs/media/midamp/trunk/dlg.inc
23,7 → 23,7
; mov eax,9
; mov ebx,prcinfo
; mov ecx,-1
; mcall
; int 0x40
mov eax,[parentPID]
; convert eax bin to param dec
; mov eax,dword [prcinfo+30] ;offset of myPID
57,12 → 57,12
mov ebx,1 ; define IPC
mov ecx,path ; offset of area
mov edx,1024+16 ; size
mcall
int 0x40
 
; change wanted events list 7-bit IPC event
mov eax,40
mov ebx,01000111b
mcall
int 0x40
 
;
; STEP 3 run SYSTEM XTREE with parameters
70,7 → 70,7
 
mov eax,70
mov ebx,run_fileinfo
mcall
int 0x40
 
call redproc
 
78,7 → 78,7
getmesloop:
mov eax,23
mov ebx,50 ;0.5 sec
mcall
int 0x40
dec eax
jz mred
dec eax
92,7 → 92,7
mov ebx,prcinfo
mov ecx,-1
mov eax,9
mcall
int 0x40
mov ebp,eax
 
loox:
99,7 → 99,7
mov eax,9
mov ebx,prcinfo
mov ecx,ebp
mcall
int 0x40
mov eax,[DLGPID]
cmp [prcinfo+30],eax ;IF Dialog find
je dlg_is_work ;jmp to dlg_is_work
124,15 → 124,15
jmp getmesloop
mkey:
mov eax,2
mcall ; read (eax=2)
int 0x40 ; read (eax=2)
jmp getmesloop
mbutton:
mov eax,17 ; get id
mcall
int 0x40
cmp ah,1 ; button id=1 ?
jne getmesloop
or eax,-1 ; close this program
mcall
mov eax,-1 ; close this program
int 0x40
mgetmes:
 
; If dlg_pid_get then second message get jmp to still
/programs/media/midamp/trunk/thread.inc
29,7 → 29,7
mov esi,play_area
mov eax,55
mov ebx,eax
mcall
int 0x40
.nosound:
end if
movzx ebx,byte[play_area]
36,7 → 36,7
and ebx,0x7f
add [cur_tick],ebx
mov eax,23
mcall
int 0x40
cmp word[edi],0
jne .checkevt
mov eax,IPC_NEXT
/programs/media/gifview/trunk/gifview.asm
29,7 → 29,7
dd 0x0
 
include 'lang.inc'
include '..\..\..\macros.inc' ; decrease code size (optional)
include 'macros.inc' ; decrease code size (optional)
include 'debug.inc'
COLOR_ORDER equ MENUETOS
 
54,7 → 54,7
openfile2:
mov eax,70
mov ebx,file_info
mcall
int 0x40
cmp eax,6
je temp
test eax,eax
96,12 → 96,6
ok2:
and dword[img_index],0
 
mov eax,48
mov ebx,3
mov ecx,sc
mov edx,sizeof.system_colors
mcall
 
red:
 
call draw_window
115,7 → 109,7
.delay:
mov ebx,DELAY
mov eax,23
mcall
int 0x40
@@:
dec eax
jz red
137,7 → 131,7
 
key:
mov eax,2
mcall
int 0x40
cmp ah,13
je is_input
jmp still
144,13 → 138,13
 
button:
mov eax,17
mcall
int 0x40
 
cmp ah,1
jne noclose
_close:
or eax,-1
mcall
int 0x40
 
noclose:
is_input: ; simple input line with backspace feature
158,12 → 152,12
wait_input:
call draw_input
mov eax,10
mcall
int 0x40
cmp eax,2
jne still
mov edi,[inp_pos]
mov eax,2
mcall
int 0x40
shr eax,8
cmp eax,27
je still
197,13 → 191,13
mov ebx,INP_X
mov ecx,INP_Y
mov edx,2
mcall
int 0x40
mov eax,4
mov ecx,0x00107a30
mov ebx,INP_XY
mov edx,fn_input
mov esi,[inp_pos]
mcall
int 0x40
pop edi
ret
 
213,9 → 207,15
 
draw_window:
 
mov eax,48
mov ebx,3
mov ecx,sc
mov edx,sizeof.system_colors
int 0x40
 
mov eax,12
mov ebx,1
mcall
int 0x40
 
mov eax,0
mov ebx,50*65536+700
222,8 → 222,8
mov ecx,50*65536+500
mov edx,[sc.work]
or edx,0x33000000
mov edi,title
mcall
mov edi,header
int 0x40
 
call draw_input
 
237,7 → 237,7
.enddraw:
mov eax,12
mov ebx,2
mcall
int 0x40
ret
 
draw_subimage:
259,13 → 259,13
add edx,eax
add edx,5 shl 16 +25
mov eax,7
mcall
int 0x40
.enddraw:
ret
 
; ‡¤¥áì ­ å®¤ïâáï ¤ ­­ë¥ ¯à®£à ¬¬ë:
 
title db appname,0 ; áâப  § £®«®¢ª 
header db appname,0 ; áâப  § £®«®¢ª 
 
inp_pos dd inp_end-fn_input
fn_input:
/programs/media/gifview/trunk/macros.inc
0,0 → 1,263
; 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
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
/programs/media/gifview/trunk/debug.inc
55,7 → 55,7
mov cl,al
mov eax,63
mov ebx,1
mcall
int 0x40
popad
popf
ret
/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
/programs/media/cdp/trunk/cdp.asm
4,7 → 4,7
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
include "..\..\..\macros.inc"
include "macros.inc"
include "lang.inc"
 
FALSE equ 0
35,14 → 35,12
START:
call chk_cdrom ; start of execution
call read_cd
 
red: ; redraw
call draw_window ; at first, draw the window
still:
 
mov eax,23
mov ebx,10 ; wait here for event
mcall
int 0x40
 
cmp eax,1 ; redraw request ?
jz red
58,10 → 56,14
@@:
jmp still
 
red: ; redraw
call draw_window
 
jmp still
 
key: ; key
mov eax,2 ; just read it and ignore
mcall
int 0x40
 
;====== hotkeys:
cmp ah,0x61
187,15 → 189,15
 
button: ; button
mov eax,17
mcall
int 0x40
 
cmp ah,1 ; button id=1 ?
jnz no_but_close
mov eax,24
mov ebx,3
mcall
int 0x40
mov eax,0xffffffff ; close this program
mcall
int 0x40
no_but_close:
 
cmp ah,2
524,7 → 526,7
 
mov eax,24
mov ebx,1
mcall
int 0x40
ret
 
play_n_track:
534,7 → 536,7
call draw_window
; mov eax,26
; mov ebx,9
; mcall
; int 0x40
call get_uptime
mov [stimtrk],eax
xor ebx,ebx
586,7 → 588,7
mov ecx,ebx
mov eax,24
mov ebx,1
mcall
int 0x40
ret
 
 
638,7 → 640,7
stop_playing:
mov eax, 24
mov ebx,3
mcall
int 0x40
mov cl,[max_trk]
mov [shuftab],cl
mov [if_stopped],TRUE
659,17 → 661,17
mov ebx, 10 shl 16 + 41
mov ecx,120 shl 16 + 9
mov edx,0x00ffffff
mcall
int 0x40
mov ebx, 96 shl 16 + 11
mcall
int 0x40
mov ebx, 185 shl 16 + 11
mcall
int 0x40
mov ebx, 200 shl 16 + 11
mcall
int 0x40
mov ebx, 150 shl 16 + 11
mcall
int 0x40
mov ebx, 165 shl 16 + 11
mcall
int 0x40
;bar<-
 
mov eax,4
699,7 → 701,7
jmp info_mode_end
info_mode_end:
mov esi,7
mcall
int 0x40
 
;num info ->
mov eax,47
711,7 → 713,7
mov cl, [curr_trk] ;number to draw
mov edx,96 shl 16 + 120
mov esi,0x111111
mcall
int 0x40
mov eax,[curr_trk_pg_time]
xor edx,edx
mov ecx,60
720,10 → 722,10
mov ecx,eax
mov eax,47
mov edx,150 shl 16 + 120
mcall
int 0x40
pop ecx
mov edx,165 shl 16 + 120
mcall
int 0x40
mov eax,[curr_trk_length]
xor edx,edx
mov ecx,60
732,10 → 734,10
mov ecx,eax
mov eax,47
mov edx,185 shl 16 + 120
mcall
int 0x40
pop ecx
mov edx,200 shl 16 + 120
mcall
int 0x40
;num info <-
ret
 
744,7 → 746,7
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mcall
int 0x40
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx, 50*65536+219 ; [x start] *65536 + [x size]
752,7 → 754,7
mov edx,0x03ffffff ; color of work area RRGGBB
mov esi,0x8099bbff ; color of grab bar RRGGBB,8->color glide
mov edi,0x0099bbee ; color of frames RRGGBB
mcall
int 0x40
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
759,13 → 761,13
mov ecx,0x1000ffff ; color of text RRGGBB
mov edx,labelt ; pointer to text beginning
mov esi,labellen-labelt ; text length
mcall
int 0x40
 
mov eax,13 ;bar
mov ebx,8 shl 16 + 204
mov ecx,28 shl 16 + 84
mov edx,0x000fe6f5
mcall
int 0x40
 
;info ->
mov eax,4
773,24 → 775,24
mov ecx,0x00111111
mov edx,playing_trk_info
mov esi,6
mcall
int 0x40
mov ebx,120 shl 16 + 120
mov edx,playing_time_info
; mov esi,5
dec esi
mcall
int 0x40
mov ebx,178 shl 16 + 120
mov edx,slash
mov esi,1
mcall
int 0x40
mov ebx,196 shl 16 + 120
mov edx,column
; mov esi,1
mcall
int 0x40
mov ebx,161 shl 16 + 120
mov edx,column
; mov esi,1
mcall
int 0x40
;info <-
 
; button MODE
799,7 → 801,7
mov ecx,135*65536+20
mov edx,7
mov esi,COLOR_FUNC_BUTS
mcall
int 0x40
; text
mov eax,4
mov ebx,19*65536+142
806,7 → 808,7
mov ecx,0x100f73f5;ffff0f
mov edx,but_mode_lab
mov esi,1
mcall
int 0x40
 
; button BACK
mov eax,8
814,7 → 816,7
mov ecx,135*65536+20
mov edx,6
mov esi,COLOR_FUNC_BUTS
mcall
int 0x40
mov [coord_x],51
mov [coord_y],141
call draw_left_triangle
827,7 → 829,7
mov ecx,135*65536+20
mov edx,5
mov esi,COLOR_FUNC_BUTS
mcall
int 0x40
mov [coord_x],68
mov [coord_y],141
call draw_right_triangle
840,7 → 842,7
mov ecx,135*65536+20
mov edx,8
mov esi,COLOR_FUNC_BUTS
mcall
int 0x40
mov [coord_x],102
mov [coord_y],141
call draw_left_triangle
853,7 → 855,7
mov ecx,135*65536+20
mov edx,3
mov esi,COLOR_FUNC_BUTS
mcall
int 0x40
mov [coord_x],118
mov [coord_y],142
call draw_square
865,7 → 867,7
mov ecx,135*65536+20
mov edx,2
mov esi,COLOR_FUNC_BUTS
mcall
int 0x40
cmp [if_stopped],TRUE
je playing_paused
cmp [if_paused],TRUE
889,7 → 891,7
mov ecx,135*65536+20
mov edx,9
mov esi,COLOR_FUNC_BUTS
mcall
int 0x40
mov [coord_x],167
mov [coord_y],141
call draw_right_triangle
902,7 → 904,7
mov ecx,135*65536+20
mov edx,4
mov esi,COLOR_FUNC_BUTS
mcall
int 0x40
mov [coord_x],192
mov [coord_y],140
call draw_vert_list_line
949,7 → 951,7
add edx,10
mov esi,0xaaaaaa
add esi,edi
mcall
int 0x40
;---draw tracs numbers
mov eax,47
xor ebx,ebx
964,7 → 966,7
add dl,[posy]
add dl,5
mov esi,0xffffff
mcall
int 0x40
;---
mov al,[posx]
add al,20
996,7 → 998,7
mov ecx,0x10ffff00
mov edx,define_cdrom
mov esi,define_cdrom_len-define_cdrom
mcall
int 0x40
flag3:
cmp [flag],3
jne flag4
1005,7 → 1007,7
mov ecx,0x10ffff00
mov edx,no_cda
mov esi,no_cda_len-no_cda
mcall
int 0x40
flag4:
cmp [flag],4
jne flag5
1028,7 → 1030,7
mov eax,4
mov ecx,0x111111
mov esi,31
mcall
int 0x40
noline:
add ebx,10
add edx,31
1040,7 → 1042,7
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
mcall
int 0x40
 
ret
 
1064,7 → 1066,7
inc ebx
push eax
mov eax,1
mcall
int 0x40
pop eax
cmp esi,0
jne draw_pixel
1088,7 → 1090,7
inc ebx
push eax
mov eax,1
mcall
int 0x40
pop eax
cmp esi,0
jne q_draw_pixel
1119,7 → 1121,7
dec ebx
push eax
mov eax,1
mcall
int 0x40
pop eax
cmp esi,0
jne l_draw_pixel
1142,7 → 1144,7
inc ecx
push eax
mov eax,1
mcall
int 0x40
pop eax
dec esi
cmp esi,0
1162,7 → 1164,7
mov esi,11
vlstart_draw_vline:
inc ecx
mcall
int 0x40
dec esi
cmp esi,0
jne vlstart_draw_vline
1179,7 → 1181,7
mov esi,11
hlstart_draw_vline:
inc ebx
mcall
int 0x40
dec esi
cmp esi,0
jne hlstart_draw_vline
1196,7 → 1198,7
mov esi,5
slstart_draw_vline:
inc ebx
mcall
int 0x40
dec esi
cmp esi,0
jne slstart_draw_vline
1208,7 → 1210,7
chk_cdrom:
mov eax,24
mov ebx,1
mcall
int 0x40
cmp eax,0
je chk_cdrom_ok
mov [flag],2
1230,7 → 1232,7
mov ebx,2
mov ecx, cdp
mov edx,321
mcall
int 0x40
mov [flag],1
mov al,100
cmp [cdp+3],al
1245,7 → 1247,7
push ebx
mov eax,26
mov ebx,9
mcall
int 0x40
pop ebx
ret
 
/programs/media/cdp/trunk/build_en.bat
1,5 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm cdp.asm cdp
@erase lang.inc
@pause
/programs/media/cdp/trunk/build_ru.bat
1,5 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm cdp.asm cdp
@erase lang.inc
@pause
/programs/media/cdp/trunk/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/media/iconedit/trunk/build_en.bat
1,5 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm iconedit.asm iconedit
@erase lang.inc
@pause
/programs/media/iconedit/trunk/build_ru.bat
1,5 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm iconedit.asm iconedit
@erase lang.inc
@pause
/programs/media/iconedit/trunk/iconedit.asm
14,7 → 14,7
dd 0x0 , 0x0 ; I_Param , I_Icon
 
include 'lang.inc'
include '..\..\..\macros.inc'
include 'macros.inc'
 
window_x_size equ 346
window_y_size equ 312
33,7 → 33,7
 
mov eax,23 ; wait here for event
mov ebx,1 ; for 1ms
mcall
int 0x40
 
cmp eax,1 ; redraw request ?
je red
50,7 → 50,7
key:
 
mov eax,2 ; get a key
mcall ; do it
int 0x40 ; do it
shr eax,8 ; move it to al
cmp byte [editstate],0 ; are we in edit mode
je check_mouse ; if not start loop again
94,12 → 94,12
 
button: ; button
mov eax,17 ; get id
mcall
int 0x40
 
cmp ah,1 ; button id=1 ?
jne button_3
mov eax,-1 ; close this program
mcall
int 0x40
button_3:
cmp ah,3 ; was it button 3 - FILENAME
jne button_4 ; no then try button 4
134,21 → 134,15
mov byte [editstate],0 ; dont want to be in edit mode
call draw_filename ; update filename
call clear_graph_icon ; clear the icon and edit screens
jmp check_mouse
 
button_7:
cmp ah,7 ; was it button 7 - FLIP ICON
jne button_8 ; no then try button 8
call flip_icon ; flip
jmp check_mouse
 
button_8:
cmp ah,8 ; was it button 8 - MIRROR ICON
jne button_9 ; no then try button 9
call flip_diag ; flip L/R and U/D
call flip_icon ; cheated now have to flip it
jmp check_mouse
 
button_9:
cmp ah,9 ; was it button 9 - FLIP L/R and U/D
jne button_10 ; no then try button 10
155,8 → 149,6
call flip_diag ; flip L/R and U/D
call draw_icon ; update icon
call draw_graph ; update graph
jmp check_mouse
 
button_10:
cmp ah,10 ; was it button 9 - SET AS BGR
jne check_mouse ; no then exit
171,20 → 163,28
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mcall
int 0x40
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+window_x_size ; [x start] *65536 + [x size]
mov ecx,100*65536+window_y_size ; [y start] *65536 + [y size]
mov edx,0x13ffffff ; color of work area 0x00RRGGBB
mov edi,title ; WINDOW LABEL
mcall
mov edx,0x03ffffff ; color of work area 0x00RRGGBB
mov esi,0x807799bb ; color of grab bar 0x00RRGGBB
mov edi,0x007799bb ; color of frames 0x00RRGGBB
int 0x40
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,7*65536+7 ; [x start] *65536 + [y start]
mov ecx,0xddeeff ; color of text 0x00RRGGBB
mov edx,labelt ; pointer to text beginning
mov esi,11 ; text length
int 0x40
; DRAW BUTTON BAR
mov eax,13 ; function 13 : draw bar
mov ebx,5*65536+window_x_size-9 ; [x start] *65536 + [x size]
mov ecx,(window_y_size-20)*65536+16 ; [y start] *65536 + [y size]
mov edx,0x7799bb ; colour 0x00RRGGBB
mcall
int 0x40
; DEFINE BUTTON 3 : FILENAME
mov eax,8 ; function 8 : define button
mov ebx,5*65536+62 ; [x start] *65536 + [x size]
191,7 → 191,7
mov ecx,(window_y_size-19)*65536+14 ; [y start] *65536 + [y size]
mov edx,3 ; button id number
mov esi,0x7799bb ; button color 0x00RRGGBB
mcall
int 0x40
; BUTTON 3 TEXT
mov eax,4 ; function 4 : write text to window
mov ebx,13*65536+window_y_size-15 ; [x start] *65536 + [y start]
198,7 → 198,7
mov ecx,0xddeeff ; text color 0x00RRGGBB
mov edx,button_text_3 ; pointer to text beginning
mov esi,8 ; text length
mcall
int 0x40
 
call draw_filename ; update filename
 
208,32 → 208,32
mov ecx,(window_y_size-19)*65536+14 ; [y start] *65536 + [y size]
mov edx,4 ; button id number
mov esi,0x7799bb ; button color 0x00RRGGBB
mcall
int 0x40
; DEFINE BUTTON 5 : SAVE
mov ebx,(window_x_size-43)*65536+38 ; [x start] *65536 + [x size]
mov edx,5 ; button id number
mcall
int 0x40
; DEFINE BUTTON 6 : CLEAR ICON
mov ebx,268*65536+72 ; [x start] *65536 + [x size]
mov ecx,65*65536+14 ; [y start] *65536 + [y size]
mov edx,6 ; button id number
mcall
int 0x40
; DEFINE BUTTON 7 : FLIP VERTICAL
mov ecx,85*65536+14 ; [y start] *65536 + [y size]
mov edx,7 ; button id number
mcall
int 0x40
; DEFINE BUTTON 8 : FLIP HORIZONTAL
mov ecx,105*65536+14 ; [y start] *65536 + [y size]
mov edx,8 ; button id number
mcall
int 0x40
; DEFINE BUTTON 9 : SET AS BACKGROUND
mov ecx,125*65536+14 ; [y start] *65536 + [y size]
mov edx,9 ; button id number
mcall
int 0x40
; DEFINE BUTTON 10 : SET AS BACKGROUND
mov ecx,145*65536+14 ; [y start] *65536 + [y size]
mov edx,10 ; button id number
mcall
int 0x40
; BUTTON 4 TEXT
mov eax,4 ; function 4 : write text to window
mov ebx,267*65536+window_y_size-15 ; [x start] *65536 + [y start]
240,67 → 240,67
mov ecx,0xddeeff ; text color 0x00RRGGBB
mov edx,button_text_4 ; pointer to text beginning
mov esi,4 ; text length
mcall
int 0x40
; BUTTON 5 TEXT
mov ebx,311*65536+window_y_size-15 ; [x start] *65536 + [y start]
mov edx,button_text_5 ; pointer to text beginning
mcall
int 0x40
; BUTTON 6 TEXT
mov ebx,275*65536+69 ; [x start] *65536 + [y start]
mov edx,button_text_6 ; pointer to text beginning
mov esi,10 ; text length
mcall
int 0x40
; BUTTON 7 TEXT
mov ebx,275*65536+89 ; [x start] *65536 + [y start]
mov edx,button_text_7 ; pointer to text beginning
mcall
int 0x40
; BUTTON 8 TEXT
mov ebx,275*65536+109 ; [x start] *65536 + [y start]
mov edx,button_text_8 ; pointer to text beginning
mcall
int 0x40
; BUTTON 9 TEXT
mov ebx,275*65536+129 ; [x start] *65536 + [y start]
mov edx,button_text_9 ; pointer to text beginning
mcall
int 0x40
; BUTTON 10 TEXT
mov ebx,275*65536+149 ; [x start] *65536 + [y start]
mov edx,button_text_10 ; pointer to text beginning
mcall
int 0x40
; DRAW GRAPH BACKGROUND
mov eax,13 ; function 13 : draw bar
mov ebx,6*65536+257 ; [x start] *65536 + [x size]
mov ecx,26*65536+257 ; [y start] *65536 + [y size]
mov edx,0x7799bb ; colour 0x00RRGGBB
mcall
int 0x40
; DRAW ICON BACKGROUND
mov ebx,268*65536+34 ; [x start] *65536 + [x size]
mov ecx,26*65536+34 ; [y start] *65536 + [y size]
mcall
int 0x40
; DRAW PALETTE BACKGROUND
mov ebx,268*65536+34 ; [x start] *65536 + [x size]
mov ecx,217*65536+33 ; [y start] *65536 + [y size]
mcall
int 0x40
; DRAW PALETTE BACKGROUND
mov ebx,268*65536+33 ; [x start] *65536 + [x size]
mov ecx,250*65536+33 ; [y start] *65536 + [y size]
mcall
int 0x40
; DRAW PALETTE BACKGROUND
mov ebx,301*65536+33 ; [x start] *65536 + [x size]
mov ecx,249*65536+34 ; [y start] *65536 + [y size]
mcall
int 0x40
; DRAW GREYSCALE BACKGROUND
mov ebx,307*65536+34 ; [x start] *65536 + [x size]
mov ecx,210*65536+34 ; [y start] *65536 + [y size]
mcall
int 0x40
; DRAW SELECTED COLOUR BACKGROUND
mov ebx,268*65536+73 ; [x start] *65536 + [x size]
mov ecx,171*65536+34 ; [y start] *65536 + [y size]
mcall
int 0x40
; DRAW WHITE TO START
mov ebx,269*65536+71 ; [x start] *65536 + [x size]
mov ecx,172*65536+32 ; [y start] *65536 + [y size]
mov edx,0xffffff ; colour 0x00RRGGBB
mcall
int 0x40
; DRAW PALETTE RED + GREEN SECTION
xor edi,edi ; clear column loop count
next_r_g_outer:
319,7 → 319,7
add edx,255 ; maximum green
sub edx,esi ; minus line count
shl edx,8 ; into position 0x00RRGG00
mcall
int 0x40
add esi,5 ; colour in steps of 5 to keep small
cmp esi,255 ; have we done a line
jne next_r_g_inner ; nop then do next pixel
343,7 → 343,7
sub edx,edi
shl edx,16
add edx,esi
mcall
int 0x40
add esi,5
cmp esi,255
jne next_g_b_inner
366,7 → 366,7
mov edx,edi
shl edx,8
add edx,esi
mcall
int 0x40
add esi,5
cmp esi,255
jne next_b_r_inner
391,7 → 391,7
add edx,esi
shl edx,8
add edx,esi
mcall
int 0x40
add esi,5
cmp esi,255
jne next_b_w_inner
409,7 → 409,7
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
mcall
int 0x40
 
ret ; return
 
441,17 → 441,17
mov ebx,1 ; set background size
mov ecx,32 ; x size
mov edx,32 ; y size
mcall ; do it
mov ebx,4 ; type of background draw
mov ecx,1 ; tile
mcall ; do it
int 0x40 ; do it
mov ebx,5 ; blockmove image to os bgr memory
mov ecx,image+3600 ; point to image
mov edx,0 ; start of bgr memory
mov esi,32*32*3 ; byte count
mcall ; do it
int 0x40 ; do it
mov ebx,4 ; type of background draw
mov ecx,1 ; tile
int 0x40 ; do it
mov ebx,3 ; draw background
mcall ; do it
int 0x40 ; do it
 
ret ; return
 
461,7 → 461,7
get_screen_size:
 
mov eax,14 ; function 14 : get screen max
mcall ; returns eax : 0xXXXXYYYY
int 0x40 ; returns eax : 0xXXXXYYYY
push eax ; save reg
and eax,0x0000ffff ; split out y size
add eax,1 ; add 1 to remove zero base
483,7 → 483,7
mov ecx,0 ; reserved
mov edx,200000 ; reserved
mov esi,image ; point to image buffer
mcall ; do it
int 0x40 ; do it
 
ret ; return
 
497,7 → 497,7
mov ecx,image ; point to our data
mov edx,54+32*32*3 ; how much data to transfer
xor esi,esi ; 0 - create a new file
mcall ; do it
int 0x40 ; do it
 
ret ; return
 
511,7 → 511,7
mov ebx,73*65536+81 ; [x start] *65536 + [x size]
mov ecx,(window_y_size-19)*65536+15 ; [y start] *65536 + [y size]
mov edx,0x557799 ; colour 0x00RRGGBB
mcall
int 0x40
 
mov eax,4 ; function 4 : write text to window
mov ebx,78*65536+(window_y_size-15) ; [y start] *65536 + [y size]
522,7 → 522,7
jne no_active_1 ; no then jump over change colour
mov ecx,0x00112299 ; else change colour
no_active_1:
mcall ; do it
int 0x40 ; do it
popa ; return all registers to original
ret ; return
 
541,7 → 541,7
mov edx,[eax] ; colour 0x00RRGGBB from image data
push eax ; save our position
mov eax,1 ; function 1 : put pixel
mcall ; do it
int 0x40 ; do it
pop eax ; restore our position
sub eax,3 ; point to next pixel colour
dec ebx ; move our x position
578,7 → 578,7
mov edx,[eax] ; point to bmp data
push eax ; save our position
mov eax,13 ; function 13 : draw bar
mcall ; do it
int 0x40 ; do it
pop eax ; restore our position
sub eax,3 ; point to next pixel colour
dec esi ; increment column count
674,7 → 674,7
 
mov eax,37 ; function 37
mov ebx,2 ; sub function 2 : check for mouse button
mcall ; do it
int 0x40 ; do it
cmp eax,0 ; was a button pressed
je exit_mouse ; no then jump to exit
cmp eax,1 ; left hand button
687,7 → 687,7
blank:
mov eax,37 ; function 37
mov ebx,1 ; sub function 1 : get mouse position
mcall ; do it
int 0x40 ; do it
push eax ; save our x/y position for later
and eax,0x0000ffff ; y is in lower bytes
add eax,1 ; add 1 because we are zero based
726,7 → 726,7
shl ecx,16 ;
add ecx,7 ;
mov edx,[draw_colour] ; give it a colour
mcall ; do it
int 0x40 ; do it
mov eax,1 ; function 1 : put pixel
mov ebx,[icon_x] ; icon x from above
add ebx,269 ; add icon x offset
733,7 → 733,7
mov ecx,[icon_y] ; icon y from above
add ecx,27 ; add icon y offset
mov edx,[draw_colour] ; give it a colour
mcall ; do it
int 0x40 ; do it
mov ecx,image+54 ; point to our data
mov ebx,31 ; 32 lines in image zero based
sub ebx,[icon_y] ; get the correct line
760,12 → 760,12
 
mov eax,37 ; function 37
mov ebx,2 ; sub function 2 : check for mouse button
mcall ; do it
int 0x40 ; do it
cmp eax,0 ; was a button pressed
je exit_draw ; no then jump to exit
mov eax,37 ; function 37
mov ebx,1 ; sub function 1 : get mouse position
mcall ; do it
int 0x40 ; do it
push eax ; save our x/y position for later
and eax,0x0000ffff ; y is in lower bytes
add eax,1 ; add 1 because we are zero based
798,7 → 798,7
add ecx,211
mov edx,[sel_colour]
add edx,esi
mcall
int 0x40
add esi,5
cmp esi,255
jne next_sel_rg_inner
835,7 → 835,7
shl eax,8
add edx,eax
mov eax,1
mcall
int 0x40
add esi,5
cmp esi,255
jne next_sel_rb_inner
872,7 → 872,7
shl eax,16
add edx,eax
mov eax,1
mcall
int 0x40
add esi,5
cmp esi,255
jne next_sel_bg_inner
897,7 → 897,7
mov ebx,269*65536+71
mov ecx,172*65536+32
mov edx,[sel_colour]
mcall
int 0x40
 
mov eax,[sel_colour]
mov [draw_colour],eax
910,7 → 910,7
mov ecx,[sel_colour]
mov edx,273*65536+176
mov esi,0x000000
mcall
int 0x40
 
exit_draw:
 
924,7 → 924,7
 
mov eax,37
xor ebx,ebx
mcall
int 0x40
mov ebx,eax
mov ecx,eax
and ebx,0xffff0000
935,7 → 935,7
add ebx,ecx
mov eax,35
dec ebx
mcall
int 0x40
 
mov [sel_colour],eax
 
969,7 → 969,7
button_text_9 db 'FLIP DIAG '
button_text_10 db 'SET AS BGR'
 
title db 'ICON EDITOR',0
labelt: db 'ICON EDITOR'
 
icon: db 'WRITE.BMP '
 
/programs/media/iconedit/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
/programs/media/midiplay/trunk/build_en.bat
1,5 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm midiplay.asm midiplay
@erase lang.inc
@pause
/programs/media/midiplay/trunk/build_ru.bat
1,5 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm midiplay.asm midiplay
@erase lang.inc
@pause
/programs/media/midiplay/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
/programs/media/midiplay/trunk/midiplay.asm
4,28 → 4,29
;
 
include 'lang.inc'
include '..\..\..\macros.inc'
include 'macros.inc'
 
use32
 
org 0x0
db 'MENUET01' ; header
dd 0x01 ; header version
dd START ; entry point
dd I_END ; image size
dd 0x1000 ; required memory
dd 0x1000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Path
db 'MENUET00' ; 8 byte id
dd 38 ; required os
dd START ; program start
dd I_END ; program image size
dd 0x1000 ; reguired amount of memory
dd 0x1000
dd 0x00000000 ; reserved=no extended header
 
 
 
START:
 
red:
call draw_window
 
still:
 
mov eax,10 ; redraw ?
mcall
int 0x40
 
cmp eax,1
jz red
33,9 → 34,13
jz button
jmp still
 
red:
call draw_window
jmp still
 
button:
mov eax,17
mcall
int 0x40
 
cmp al,byte 0
jnz still
44,7 → 49,7
jnz noexit
 
mov eax,0xffffffff
mcall
int 0x40
 
noexit:
 
54,7 → 59,7
mov eax,20 ; reset midi device
mov ebx,1
mov ecx,0
mcall
int 0x40
 
cmp eax,0
jz noe1
76,7 → 81,7
pusha
mov eax,5
mov ebx,8
mcall
int 0x40
popa
mov ebx,0
; call noteout
88,7 → 93,7
pusha
mov eax,5
mov ebx,8
mcall
int 0x40
popa
mov ebx,0
; call noteout
108,41 → 113,63
 
mov eax,12 ; tell os about redraw
mov ebx,1
mcall
int 0x40
 
mov eax,0 ; define and draw window
mov ebx,20*65536+250
mov ecx,20*65536+120
mov edx,0x13ffffff
mov edi,title
mcall
mov edx,0x02ffffff
mov esi,0x805070d0;88ccee
mov edi,0x005070d0;88ccee
int 0x40
 
; CLOSE BUTTON
mov eax,8 ; function 8 : define and draw
mov ebx,(250-19)*65536+12 ; [x start] *65536 + [x size]
mov ecx,5*65536+12 ; [y start] *65536 + [y size]
mov edx,1 ; button id
mov esi,0x5577cc ; button color RRGGBB
int 0x40
 
 
mov eax,4 ; 4 = write text
mov ebx,8*65536+8
mov ecx,dword 0x00ffffff ; 8b window nro - RR GG BB color
mov edx,labelt ; pointer to text beginning
mov esi,labellen-labelt ; text length
int 0x40
 
mov eax,8
mov ebx,10*65536+200 ; button start x & size
mov ecx,40 *65536+17 ; button start y & size
mov edx,2 ; button number
mov esi,0x4060b0 ; button color
mcall
int 0x40
 
mov eax,8
mov ebx,10*65536+200 ; button start x & size
mov ecx,60 *65536+17 ; button start y & size
mov edx,3 ; button number
mcall
mov esi,0x4060b0 ; button color
int 0x40
 
mov eax,4
mov eax,dword 4
mov ebx,25*65536+45
mov ecx,dword 0xffffff
mov edx,buttont
mov esi,buttontlen-buttont
mcall
int 0x40
 
mov eax,dword 4
mov ebx,25*65536+65
mov ecx,dword 0xffffff
mov edx,buttont2
mov esi,buttontlen2-buttont2
mcall
int 0x40
 
mov eax,12 ; tell os about redraw end
mov ebx,2
mcall
int 0x40
 
popa
ret
158,15 → 185,15
mov eax,20
mov ebx,2
mov ecx,0x9f
mcall
int 0x40
mov eax,20
mov ebx,2
pop ecx
mcall
int 0x40
mov eax,20
mov ebx,2
pop ecx
mcall
int 0x40
 
cmp eax,0
jz noe2
185,7 → 212,7
mov ecx,0x000000
mov edx,error1
mov esi,errorlen1-error1
mcall
int 0x40
 
mov eax,dword 4
mov ebx,15*65536+95
192,7 → 219,7
mov ecx,0x000000
mov edx,error2
mov esi,errorlen2-error2
mcall
int 0x40
 
ret
 
200,7 → 227,9
; DATA AREA
 
 
title db 'MIDI TEST',0
labelt:
db 'MIDI TEST'
labellen:
 
buttont:
db 'PLAY A FEW NOTES'
219,6 → 248,7
 
base db 0x0
 
 
I_END:
 
 
/programs/media/mixer/trunk/build_en.bat
1,5 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm mixer.asm mixer
@erase lang.inc
@pause
/programs/media/mixer/trunk/build_ru.bat
1,5 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm mixer.asm mixer
@erase lang.inc
@pause
/programs/media/mixer/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
/programs/media/mixer/trunk/mixer.asm
5,25 → 5,23
; Compile with FASM
;
 
include 'lang.inc'
include '..\..\..\macros.inc'
use32
 
 
use32
org 0x0
db 'MENUET01' ; header
dd 0x01 ; header version
dd START ; entry point
dd I_END ; image size
dd 0x1000 ; required memory
dd 0x1000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Path
db 'MENUET00' ; 8 byte id
dd 38 ; required os
dd START ; program start
dd I_END ; program image size
dd 0x1000 ; reguired amount of memory
dd 0x1000
dd 0x00000000 ; reserved=no extended header
 
include 'lang.inc'
include 'macros.inc'
 
 
START: ; start of execution
 
red: ; redraw
 
call draw_window ; at first, draw the window
 
 
30,7 → 28,7
still:
 
mov eax,10 ; wait here for event
mcall
int 0x40
 
cmp eax,1 ; redraw request ?
jz red
41,20 → 39,25
 
jmp still
 
red: ; redraw
call draw_window
 
jmp still
 
key: ; key
mov eax,2 ; just read it and ignore
mcall
int 0x40
 
jmp still
 
button: ; button
mov eax,17
mcall
int 0x40
 
cmp ah,1 ; button id=1 ?
jnz noclose
or eax,-1 ; close this program
mcall
mov eax,-1 ; close this program
int 0x40
noclose:
 
cmp ah,101
120,7 → 123,7
 
mov eax,25
mov ebx,1
mcall
int 0x40
 
jmp still
 
151,7 → 154,7
 
mov eax,25
mov ebx,2
mcall
int 0x40
 
jmp still
 
193,7 → 196,7
 
mov eax,28
mov ebx,1
mcall
int 0x40
 
jmp still
 
224,7 → 227,7
 
mov eax,28
mov ebx,2
mcall
int 0x40
 
jmp still
 
271,7 → 274,7
 
mov eax,27
mov ebx,1
mcall
int 0x40
 
jmp still
 
302,7 → 305,7
 
mov eax,27
mov ebx,2
mcall
int 0x40
 
jmp still
 
323,7 → 326,7
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mcall
int 0x40
 
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
330,10 → 333,26
mov ebx,100*65536+195 ; [x start] *65536 + [x size]
mov ecx,100*65536+140 ; [y start] *65536 + [y size]
mov edx,[wcolor] ; color of work area RRGGBB
mov edi,title ; WINDOW LABEL
mcall
mov esi,0x8099bbff ; color of grab bar RRGGBB,8->color glide
mov edi,0x0099bbee ; color of frames RRGGBB
int 0x40
 
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,0x00ffffff ; color of text RRGGBB
mov edx,labelt ; pointer to text beginning
mov esi,labellen-labelt ; text length
int 0x40
 
; CLOSE BUTTON
mov eax,8 ; function 8 : define and draw button
mov ebx,(195-19)*65536+12 ; [x start] *65536 + [x size]
mov ecx,5*65536+12 ; [y start] *65536 + [y size]
mov edx,1 ; button id
mov esi,0x22aacc ; button color RRGGBB
; int 0x40
 
mov edx,16 ; button id
mov ebx,10*65536
 
348,23 → 367,27
mov bx,22 ; [x start] *65536 + [x size]
mov ecx,35*65536+8 ; [y start] *65536 + [y size]
dec edx
mcall
int 0x40
mov eax,8 ; function 8 : define and draw button
mov bx,22 ; [x start] *65536 + [x size]
mov ecx,45*65536+8 ; [y start] *65536 + [y size]
dec edx
mcall
int 0x40
mov eax,8 ; function 8 : define and draw button
mov bx,22 ; [x start] *65536 + [x size]
mov ecx,55*65536+8 ; [y start] *65536 + [y size]
dec edx
mcall
int 0x40
mov eax,8 ; function 8 : define and draw button
mov bx,22 ; [x start] *65536 + [x size]
mov ecx,65*65536+8 ; [y start] *65536 + [y size]
dec edx
mcall
int 0x40
mov eax,8 ; function 8 : define and draw button
mov bx,22 ; [x start] *65536 + [x size]
mov ecx,75*65536+8 ; [y start] *65536 + [y size]
dec edx
mcall
int 0x40
 
pop ebx
pop edx
385,7 → 408,7
mov ecx,0x00ffffff ; color of text RRGGBB
mov edx,text ; pointer to text beginning
mov esi,29
mcall
int 0x40
 
mov eax,8 ; function 8 : define and draw button
mov ebx,(5)*65536+185 ; [x start] *65536 + [x size]
392,13 → 415,13
mov ecx,120*65536+14 ; [y start] *65536 + [y size]
mov edx,101 ; button id
mov esi,[bcolor] ; button color RRGGBB
mcall
int 0x40
 
call drawusedcard
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
mcall
int 0x40
 
ret
 
411,7 → 434,7
mov ebx,14*65536+160
mov ecx,123*65536+10
mov edx,[bcolor]
mcall
int 0x40
 
mov eax,[usecard]
mov edx,c3
433,7 → 456,7
mov ebx,14*65536+123
mov ecx,0x00ffffff
mov esi,30
mcall
int 0x40
 
popa
 
445,7 → 468,7
 
bcolor dd 0x5577c8
 
wcolor dd 0x13000000
wcolor dd 0x03000000
 
 
text:
458,7 → 481,9
 
usecard dd 0x1
 
title db 'MIXER',0
labelt:
db 'MIXER'
labellen:
 
I_END:
 
/programs/media/mp3s/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm mp3s.asm mp3s
@pause
/programs/media/mp3s/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm mp3s.asm mp3s
@pause
/programs/media/mp3s/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
/programs/media/mp3s/trunk/mp3s.asm
0,0 → 1,791
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; Tiny MP3 Shoutcast Server v0.1 (vt) ;
; ;
; Compile with FASM for Menuet ;
; ;
; Listening to port 8008 ;
; Connect with eg: 192.168.1.22:8008 ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
version equ '0.3'
 
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; program start
dd I_END ; program image size
dd 0x80000 ; memory usage
dd 0x20000 ; stack
dd 0,0
 
include 'lang.inc'
include 'macros.inc'
 
; 0x0+ program image
; 0x1ffff stack
; 0x20000 work area for file read
; 0x40000+ file send buffer ( 100 kb )
 
 
START: ; start of execution
 
mov [status],0
call clear_input
call draw_window ; at first, draw the window
 
still:
 
mov eax,23 ; wait here for event
mov ebx,2
int 0x40
 
call check_events
 
call check_connection_status
 
cmp [status],4
je start_transmission
 
jmp still
 
 
check_events:
 
cmp eax,1 ; redraw request ?
jz red
cmp eax,2 ; key in buffer ?
jz key
cmp eax,3 ; button in buffer ?
jz button
 
ret
 
red: ; redraw
call draw_window
ret
 
key:
mov eax,2 ; Just read it and ignore
int 0x40
ret
 
button: ; button
 
mov eax,17 ; get id
int 0x40
 
cmp ah,1 ; close
jne no_close
mov eax,-1
int 0x40
no_close:
 
cmp ah,2 ; button id=2 ?
jnz tst3
; open socket
mov eax,53
mov ebx,5
mov ecx,8008 ; local port # - http
mov edx,0 ; no remote port specified
mov esi,0 ; no remote ip specified
mov edi,0 ; PASSIVE open
int 0x40
mov [socket], eax
mov [posy],1
mov [posx],0
mov [read_on],1
call check_for_incoming_data
call draw_window
ret
tst3:
 
cmp ah,4
je close_socket
cmp ah,6
je close_socket
jmp no_socket_close
close_socket:
mov edx,eax
; Close socket
mov eax, 53
mov ebx, 8
mov ecx, [socket]
int 0x40
mov esp,0x1fff0
cmp dh,6
je read_string
jmp still
no_socket_close:
 
cmp ah,9
jne no_bps_add
add [bps],8*1000
call draw_window
ret
no_bps_add:
 
cmp ah,8
jne no_bps_sub
sub [bps],8*1000
call draw_window
ret
no_bps_sub:
 
 
ret
 
 
clear_input:
 
mov edi,input_text
mov eax,0
mov ecx,60*40
cld
rep stosb
 
ret
 
 
read_string:
 
mov [addr],dword filename
mov [ya],dword 95
 
mov edi,[addr]
mov eax,32
mov ecx,30
cld
rep stosb
 
call print_text
 
mov edi,[addr]
 
f11:
mov eax,10
int 0x40
cmp eax,2
jne read_done
mov eax,2
int 0x40
shr eax,8
cmp eax,13
je read_done
cmp eax,8
jnz nobsl
cmp edi,[addr]
jz f11
sub edi,1
mov [edi],byte 32
call print_text
jmp f11
nobsl:
cmp eax,dword 31
jbe f11
cmp eax,dword 95
jb keyok
sub eax,32
keyok:
mov [edi],al
 
call print_text
 
add edi,1
mov esi,[addr]
add esi,30
cmp esi,edi
jnz f11
 
read_done:
 
mov ecx,40
mov eax,0
cld
rep movsb
 
call print_text
 
jmp still
 
 
print_text:
 
pusha
 
mov eax,13
mov ebx,56*65536+30*6
mov ecx,[ya]
shl ecx,16
mov cx,8
mov edx,0xffffff
int 0x40
 
mov eax,4
mov edx,[addr]
mov ebx,56*65536
add ebx,[ya]
mov ecx,0x000000
mov esi,30
int 0x40
 
popa
ret
 
 
wait_for dd 0x0
 
transmission_start dd 0x0
sentbytes dd 0x0
 
start_transmission:
 
call clear_input
 
mov eax,5
mov ebx,50
int 0x40
 
call check_for_incoming_data
call draw_window
 
call send_header
 
mov [fileinfo+4],dword 0 ; start from beginning
mov [read_to],0x40000
mov [playpos],0x40000
 
mov ecx,1024 / 512
 
new_buffer:
 
mov eax,[read_to]
mov ebx,1
call read_file
 
loop new_buffer
 
 
newpart:
 
call check_connection_status
call draw_window
 
mov eax,26
mov ebx,9
int 0x40
mov [transmission_start],eax
mov [sentbytes],0
 
newblock:
 
mov eax,[read_to]
mov ebx,2
call read_file
 
wait_more:
 
mov eax,26
mov ebx,9
int 0x40
 
cmp eax,[wait_for]
jge nomw
 
mov eax,5
mov ebx,1
int 0x40
 
jmp wait_more
 
nomw:
 
add eax,2
mov [wait_for],eax
 
mov eax,11
int 0x40
call check_events
 
mov eax,53
mov ebx,255
mov ecx,103
int 0x40
 
cmp eax,0
jne wait_more
 
; write to socket
mov eax,53
mov ebx,7
mov ecx,[socket]
mov edx,[playadd]
mov esi,[playpos]
int 0x40
 
add [sentbytes],edx
 
mov esi,[playpos]
add esi,[playadd]
mov edi,0x40000
mov ecx,110000 / 4
cld
rep movsd
 
mov eax,[playadd]
sub [read_to],eax
 
call check_for_incoming_data
call show_progress
call check_rate
 
mov eax, 53
mov ebx, 6
mov ecx, [socket]
int 0x40
cmp eax,4
jne end_stream
 
cmp [read_to],0x40000
jge newblock
 
end_stream:
 
; Close socket
 
mov eax, 53
mov ebx, 8
mov ecx, [socket]
int 0x40
 
mov eax,5
mov ebx,5
int 0x40
 
; Open socket
 
mov eax,53
mov ebx,5
mov ecx,8008 ; local port # - http
mov edx,0 ; no remote port specified
mov esi,0 ; no remote ip specified
mov edi,0 ; PASSIVE open
int 0x40
mov [socket], eax
mov [posy],1
mov [posx],0
mov [read_on],0
 
call draw_window
 
jmp still
 
 
check_rate:
 
pusha
 
mov eax,[bps]
xor edx,edx
mov ebx,8*100
div ebx
shl eax,1
mov [playadd],eax
 
mov eax,26
mov ebx,9
int 0x40
 
sub eax,[transmission_start]
shr eax,1
 
imul eax,[playadd]
 
mov edx,0x00dd00
 
cmp [sentbytes],eax
jge sendok
 
sub eax,20000
cmp [sentbytes],eax ; a long buffer underrun correction
jge no_buffer_overrun ; actually leads to overrun
mov [sentbytes],eax
no_buffer_overrun:
 
add [playadd],150
mov edx,0xdd0000
 
sendok:
 
mov eax,13
mov ebx,320*65536+10
mov ecx,105*65536+10
int 0x40
 
mov eax,47
mov ebx,4*65536
mov ecx,[playadd]
mov edx,322*65536+106
mov esi,0x000000
; int 0x40
 
popa
 
ret
 
 
show_progress:
 
pusha
 
mov eax,13
mov ebx,236*65536+10*6
mov ecx,107*65536+8
mov edx,0xffffff
int 0x40
 
mov ecx,[fileinfo+4]
imul ecx,512
 
mov eax,47 ; file read
mov ebx,9*65536
mov edx,236*65536+107
mov esi,0x000000
int 0x40
 
popa
ret
 
 
playpos dd 0x100000
playadd dd 256000 / 8 / 100
 
 
send_header:
 
pusha
 
mov [playpos],0x40000
 
mov esi,fileinfo+5*4
mov edi,transname
mov ecx,30
cld
rep movsb
 
mov eax, 53
mov ebx, 7
mov ecx, [socket]
mov edx, headere-headers
mov esi, headers
int 0x40
 
popa
ret
 
 
read_file:
 
cmp [read_to],0x40000+2000
jg cache_ok
mov [read_on],1
cache_ok:
 
cmp [read_to],0x40000+95500
jg no_read_1
 
mov [fileinfo+12],eax
mov [fileinfo+8],ebx
 
mov eax,58
mov ebx,fileinfo
int 0x40
 
cmp eax,0
jne no_read_1
 
mov eax,[fileinfo+8]
add [fileinfo+4],eax
 
add [read_to],512*2
 
ret
 
no_read_1:
 
mov [read_on],0
 
ret
 
 
 
check_for_incoming_data:
 
pusha
 
mov eax, 53
mov ebx, 2
mov ecx, [socket]
int 0x40
 
cmp eax,0
je _ret_now
 
new_data:
 
mov eax, 53
mov ebx, 2
mov ecx, [socket]
int 0x40
 
cmp eax,0
je _ret
 
mov eax,53
mov ebx,3
mov ecx,[socket]
int 0x40
 
cmp bl,10
jne no_lf
inc [posy]
mov [posx],0
jmp new_data
no_lf:
 
cmp bl,20
jb new_data
 
inc [posx]
cmp [posx],60
jbe xok
inc [posy]
mov [posx],0
xok:
 
cmp [posy],12
jbe yok
mov [posy],1
yok:
 
mov eax,[posy]
imul eax,60
add eax,[posx]
 
mov [input_text+eax],bl
 
jmp new_data
 
_ret:
 
; call draw_window
 
_ret_now:
 
popa
ret
 
 
 
check_connection_status:
 
pusha
 
mov eax, 53
mov ebx, 6
mov ecx, [socket]
int 0x40
 
cmp eax,[status]
je .ccs_ret
mov [status],eax
add eax,48
mov [text+20],al
call draw_window
.ccs_ret:
 
popa
ret
 
 
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
 
pusha
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
 
mov eax,0 ; Draw Window
mov ebx,50*65536+410
mov ecx,100*65536+141
mov edx,0x03ffffff
mov esi,0x00405080
mov edi,0x00405080
int 0x40
 
mov eax,4 ; Window label
mov ebx,8*65536+8
mov ecx,0x10ffffff
mov edx,wls
mov esi,wle-wls
int 0x40
 
mov eax,8 ; Start server
mov ebx,(25)*65536+21
mov ecx,57*65536+10
mov edx,2
mov esi,0x409040
int 0x40 ; Stop server
mov eax,8
mov ebx,(25)*65536+21
mov ecx,69*65536+10
mov edx,4
mov esi,0x904040
int 0x40
 
mov esi,0x3366d0
 
mov eax,8 ; Enter filename
mov ebx,(25)*65536+21
mov ecx,93*65536+10
mov edx,6
int 0x40
mov eax,8 ; Decrease transfer rate
mov ebx,(25)*65536+10
mov ecx,105*65536+10
mov edx,8
int 0x40
mov eax,8 ; Increase transfer rate
mov ebx,(36)*65536+10
mov ecx,105*65536+10
mov edx,9
int 0x40
 
mov ebx,10*65536+35 ; draw info text
mov ecx,0x00000000
mov edx,text
mov esi,40
newline:
mov eax,4
int 0x40
add ebx,12
add edx,40
cmp [edx],byte 'x'
jnz newline
 
mov eax,4 ; Filename
mov ebx,56*65536+95
mov ecx,0x000000
mov edx,filename
mov esi,30
int 0x40
 
mov eax,[bps]
xor edx,edx
mov ebx,1000
div ebx
mov ecx,eax
 
mov eax,47
mov ebx,3*65536
mov edx,58*65536+107
mov esi,0x00000000
int 0x40
 
mov [input_text+0],dword 'RECE'
mov [input_text+4],dword 'IVED'
mov [input_text+8],dword ': '
 
mov ebx,230*65536+35 ; draw info text
mov ecx,0x00000000
mov edx,input_text
mov esi,28
mov edi,7
newline2:
mov eax,4
int 0x40
add ebx,10
add edx,60
dec edi
jnz newline2
 
mov eax,38
mov ebx,210*65536+210
mov ecx,22*65536+136
mov edx,0x6699cc ; 002288
int 0x40
 
mov eax,38
mov ebx,211*65536+211
mov ecx,22*65536+136
mov edx,0x336699 ; 002288
int 0x40
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
popa
 
ret
 
 
 
; DATA AREA
 
text:
db ' TCB status: 0 '
db ' '
db ' Activate - port 8008 '
db ' Stop server '
db ' '
db ' > '
db ' < > Kbps '
db 'x'; <- END MARKER, DONT DELETE
 
headers:
 
db 'ICY 200 OK',13,10
db 'icy-notice1:This stream requires Winamp or xmms',13,10
db 'icy-url:http://www.menuetos.org',13,10
db 'icy-pub: 1',13,10
db 'icy-name: Menuet Mp3 Shoutcast Radio ',version,' - '
transname:
db ' ',13,10,13,10
 
headere:
 
wls: db 'MP3 shoutcast server ',version
wle:
 
socket dd 0
status dd 0
 
posy dd 1
posx dd 0
 
read_on db 1
read_to dd 0
 
addr dd 0
ya dd 0
 
bps dd 128*1000
 
fileinfo: dd 0,0,0,0,0x20000
filename: db '/RD/1/MENUET.MP3',0
times 50 db 0
 
input_text:
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/media/sb/trunk/build_en.bat
1,5 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm sb.asm sb
@erase lang.inc
@pause
/programs/media/sb/trunk/build_ru.bat
1,5 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm sb.asm sb
@erase lang.inc
@pause
/programs/media/sb/trunk/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/media/sb/trunk/sb.asm
5,7 → 5,7
;
 
include 'lang.inc'
include '..\..\..\macros.inc'
include 'macros.inc'
 
use32
 
43,7 → 43,7
 
mov eax,26
mov ebx,9
mcall
int 0x40
mov [next_tic],eax
 
still:
58,11 → 58,11
mov ebx,2
mov ecx,0
mov edx,[mono_stereo]
mcall
int 0x40
 
mov eax,23 ; wait here for event
mov ebx,1
mcall
int 0x40
 
cmp eax,0
jne do_task
74,7 → 74,7
 
mov eax,26
mov ebx,9
mcall
int 0x40
mov ebx,[next_tic]
cmp eax,ebx
jge play_wave_block
101,7 → 101,7
jne no_irman
mov eax,42
mov ebx,4
mcall
int 0x40
dec [ir_count]
cmp bl,140
jne no_first
136,15 → 136,15
mov eax,55 ; load wave
mov ebx,0
mov ecx,[playposition]
mcall
int 0x40
 
mov eax,55 ; play wave
mov ebx,1
mcall
int 0x40
 
mov eax,26
mov ebx,9
mcall
int 0x40
add eax,[delay]
mov [next_tic],eax
 
159,12 → 159,12
 
key: ; key
mov eax,2 ; just read it and ignore
mcall
int 0x40
jmp still2
 
button: ; button
mov eax,17 ; get id
mcall
int 0x40
 
cmp ah,6
jne no_ir
233,15 → 233,15
mov eax,45
mov ebx,1
mov ecx,4
mcall
int 0x40
mov eax,46
mov ebx,1
mov ecx,0x3f0
mov edx,0x3ff
mcall
int 0x40
no_dis:
mov eax,-1 ; close this program
mcall
int 0x40
noclose:
 
jmp still2
254,7 → 254,7
mov eax,55
mov ebx,0
mov ecx,0x20000
mcall
int 0x40
 
popa
ret
300,7 → 300,7
sub esi,edx
add ecx,esi
mov edx,0x00ff00
mcall
int 0x40
 
mov eax,13
mov ebx,320*65536+20
311,7 → 311,7
shl edx,16
sub ecx,edx
mov edx,0xff0000
mcall
int 0x40
 
popa
 
329,7 → 329,7
 
mov eax,58
mov ebx,file_info
mcall
int 0x40
 
movzx eax,byte [0x10000+1024+12+10]
mov [channels],eax
381,17 → 381,17
mov ebx,190*65536+10
mov ecx,104*65536+10
mov edx,0xff0000
mcall
int 0x40
pusha
 
mov eax,5
mov ebx,[pause_between_songs]
mcall
int 0x40
 
popa
mov eax,13
mov edx,0x000000
mcall
int 0x40
 
popa
 
430,12 → 430,12
 
mov eax,58
mov ebx,file_info
mcall
int 0x40
 
 
pusha
mov eax,11
mcall
int 0x40
cmp eax,1
jne no_wd
call draw_window
448,7 → 448,7
mov ecx,71*65536+71
add ebx,25*65536+25
mov edx,0x555555
; mcall
; int 0x40
mov eax,38
mov ebx,[esp+32-12]
and ebx,65536/512 -1
456,7 → 456,7
add ebx,25*65536+25
mov ecx,71*65536+71
mov edx,0x999999
; mcall
; int 0x40
popa
 
cmp eax,0
476,7 → 476,7
mov eax,5
mov ebx,[pause_between_songs]
add ebx,[delay]
mcall
int 0x40
 
call read_header
 
632,11 → 632,11
 
f11:
mov eax,10
mcall
int 0x40
cmp eax,2
jne read_done
mov eax,2
mcall
int 0x40
shr eax,8
cmp eax,13
je read_done
689,7 → 689,7
mov ebx,25*65536+215
mov ecx,61*65536+8
mov edx,[border]
mcall
int 0x40
 
cmp [onoff],1
je yes_playing
710,13 → 710,13
mov ecx,61*65536+1
mov edx,[drawp]
newbar:
mcall
int 0x40
add edx,0x101010
add ecx,1*65536
cmp ecx,65*65536
jb newbar
newbar2:
mcall
int 0x40
sub edx,0x101010
add ecx,1*65536
cmp ecx,69*65536
738,7 → 738,7
mov eax,13
mov edi,5
newb:
; mcall
; int 0x40
add ebx,1*65536-2
add ecx,1*65536-2
sub edx,0x332211;3366aa
758,7 → 758,7
mov ebx,42*65536+33*6
mov ecx,114*65536+11
mov edx,0x000000
mcall
int 0x40
 
mov eax,4
mov ebx,42*65536+117
765,7 → 765,7
mov ecx,[textc]
mov edx,now_playing
mov esi,38
mcall
int 0x40
 
popa
 
781,12 → 781,12
mov eax,50
mov ebx,0
mov ecx,shape_reference
mcall
int 0x40
 
mov eax,50
mov ebx,1
mov ecx,4
mcall
int 0x40
 
popa
 
809,16 → 809,16
mov ebx,0
mov ecx,0x3f0
mov edx,0x3ff
mcall
int 0x40
 
mov eax,45
mov ebx,0
mov ecx,4
mcall
int 0x40
 
mov eax,40
mov ebx,10000b shl 16 + 111b
mcall
int 0x40
 
mov [infrared_enabled],1
 
841,16 → 841,24
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mcall
int 0x40
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+320 ; [x start] *65536 + [x size]
mov ecx,100*65536+140 ; [y start] *65536 + [y size]
mov edx,[bgr]
or edx,0x13000000 ; color of work area RRGGBB,8->color gl
mov edi,title ; WINDOW LABEL
mcall
add edx,0x03000000 ; color of work area RRGGBB,8->color gl
mov esi,0x808844ee
mov edi,0x008844ee ; color of frames RRGGBB
int 0x40
 
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,0x10ffffff ; color of text RRGGBB
mov edx,labelt ; pointer to text beginning
mov esi,labellen-labelt ; text length
int 0x40
mov eax,8 ; START/STOP - id 2
mov ebx,24*65536+77
857,27 → 865,27
mov ecx,80*65536+16
mov edx,2
mov esi,[border]
mcall
int 0x40
 
inc edx ; << / >> - id 3 , 4
add ebx,86*65536-57
mov eax,8
mcall
int 0x40
inc edx
add ebx,24*65536
mov eax,8
mcall
int 0x40
 
mov eax,8 ; REPEAT
add ebx,29*65536+54
inc edx
mcall
int 0x40
 
mov eax,8 ; enable infrared
add ebx,98*65536-33
add ecx,10*65536+10
inc edx
mcall
int 0x40
 
pusha
mov eax,8
884,7 → 892,7
mov ebx,25*65536+9
mov ecx,115*65536+9
inc edx
mcall
int 0x40
popa
 
mov eax,4
894,11 → 902,11
mov ecx,0xffffff
mov edx,infrared_text
mov esi,10
mcall
int 0x40
add ebx,11
add edx,10
mov eax,4
mcall
int 0x40
 
mov ebx,25*65536+35 ; draw info text with function 4
mov ecx,[textc]
906,7 → 914,7
mov esi,40
newline:
mov eax,4
mcall
int 0x40
add ebx,10
add edx,40
cmp [edx],byte 'x'
918,7 → 926,7
 
mov eax,12
mov ebx,2
mcall
int 0x40
 
popa
ret
936,7 → 944,7
mov ebx,260*65536+43
mov ecx,42*65536+32
mov edx,[border]
mcall
int 0x40
 
mov esi,[playposition]
mov ebx,260
947,7 → 955,7
shr ecx,3
add ecx,42
mov edx,[drawc];0x2255aa
mcall
int 0x40
 
add esi,2
 
995,6 → 1003,8
db ' '
 
 
title db ' WAVE PLAYER : 8b Mono - 16b Stereo',0
labelt:
db ' WAVE PLAYER : 8b Mono - 16b Stereo'
labellen:
 
I_END: