Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 485 → Rev 484

/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: