/programs/media/midamp/trunk/MIDAMP.ASM |
---|
0,0 → 1,398 |
; MIDI PLAYER FOR MENUET v1.0 |
; Written in pure assembler by Ivushkin Andrey aka Willow |
; |
; |
; Created: December 7, 2004 |
; Last changed: July 29, 2005 |
; |
; COMPILE WITH FASM |
PLAYLIST_PATH equ '/HD/1/MIDI/PLAYLIST.TXT' |
APP_MEM equ 150*1024 |
DIR_SIZE equ 1024 |
IPC_PLAY equ 0xa1 |
IPC_PAUS equ 0xa2 |
IPC_TRIG equ 0xa3 |
IPC_UPDT equ 0xb1 |
IPC_NEXT equ 0xb2 |
LISTITEMS equ 40 |
WND_BACK equ 0x24263c |
PLY equ 63 |
WND_HEIGHT equ (PLY+9*LISTITEMS+10)+25 |
BTNS_XY equ 14 shl 16+42 |
BTNS_SIZE equ 222 shl 16+17 |
BROWSE_X equ 10 shl 16+8 |
BROWSE_Y equ 26 shl 16+8 |
FN_XY equ 12 shl 16+15 |
BAR_WIDTH equ 251 |
BAR_X equ 10 shl 16 |
BAR_Y equ 29 shl 16+5 |
TOTALTIME_XY equ 124 shl 16+28 |
CURTIME_X equ 225 shl 16+40 |
CURTIME_Y equ 15 shl 16+11 |
CURTIME_XY equ 236 shl 16+15 |
NONCRITICAL_MSG equ 0 |
SOUND equ ON;OFF |
OUTDUMP equ 0 |
OUTLINE equ 8 |
FL_SHUFFLE equ 0x01 |
FL_REPEAT equ 0x02 |
FL_HIDDEN equ 0x04 |
FL_MUTE equ 0x08 |
FL_REVERSE equ 0x10 |
FL_ADD equ 0x20 |
FL_PLAY equ 0x40 |
FL_LOCK equ 0x80 |
FL_BOTTRED equ 0x100 |
FL_MULSEL equ 0x8000 |
use32 |
org 0x0 |
db 'MENUET01' |
dd 0x01 |
dd START |
dd I_END |
dd APP_MEM |
dd APP_MEM-1024 |
dd I_PARAM |
listsel dd 0 |
channel dd 0 |
COLOR_ORDER equ MENUETOS |
include 'macros.inc' ; decrease code size (optional) |
lang fix en |
;purge mov |
include 'debug.inc' |
include 'dlg.inc' |
include 'playlist.inc' |
include 'gif_lite.inc' |
bottom: |
file 'bottom.gif' |
hdrimg: |
file 'hdr.gif' |
btns: |
file 'buttons.gif' |
START: |
or [flag],FL_BOTTRED;+FL_MUTE |
mov ecx,ipcarea |
call init_ipc |
mcall 40,1000111b |
mov esi,btns |
mov edi,btn_raw |
mov eax,hash_table |
call ReadGIF |
mov esi,hdrimg |
mov edi,hdr_raw |
mov eax,hash_table |
call ReadGIF |
mov esi,bottom |
mov edi,bottom_raw |
mov eax,hash_table |
call ReadGIF |
call respawn |
mcall 9,prcinfo,-1 |
mov edx,[ebx+30] |
mov [parentPID],edx |
mov esi,I_PARAM |
cmp dword[esi],0 |
jnz .yesparam |
call PL_load |
cmp [list_count],0 |
je noparam |
mov eax,[pl_ptr] |
or word[eax],FL_MULSEL |
jmp auto_load |
.yesparam: |
mov al,byte[esi] |
cmp al,'/' |
je .defact |
mov [param],al |
inc esi |
.defact: |
mov edi,filename;fnbuf |
mov ecx,64 |
rep movsd |
jmp open_file |
clearpath: |
newline |
mov [fname_len],0 |
noparam: |
mov [param],'W' |
or [flag],FL_ADD |
call fopen |
get_path: |
cmp byte[filename],0 |
jz still |
open_file: |
cmp [param],'W' |
je .noplay |
cmp [param],'H' |
jne .nohidd |
; or [flag],FL_PLAY |
or [flag],FL_HIDDEN |
call draw_window |
and [flag],not FL_HIDDEN |
call Shade |
; jmp .noplay |
.nohidd: |
or [flag],FL_PLAY |
.noplay: |
xor eax,eax |
mov [play_area],ax |
mov [tick_count],eax |
mov [delta],eax |
inc eax |
mov [fsize],eax |
mov [curnote],0x80 |
mov ecx,64 |
mov esi,filename |
mov edi,I_PARAM |
rep movsd |
mov eax,58 |
mov ebx,file_info |
int 0x40 |
mov eax,ebx |
shr eax,9 |
inc eax |
mov [fsize],eax |
add ebx,workarea |
mov [midi_limit],ebx |
mov edi,I_PARAM |
call find_slash |
mov [fn_ptr],edi |
mov edi,filename |
call str_len |
mov [fname_len],eax |
mov eax,58 |
mov ebx,file_info |
int 0x40 |
midi_kill: |
call kill |
include 'midilite.inc' |
decode_end: |
; dpd edi |
; dps <13,10,'Notes='> |
; sub edi,[midi_limit] |
; shr edi,1 |
; dpd edi |
dps ' Notes: max=' |
movzx eax,[max_note] |
dpd eax |
dps 'min=' |
movzx eax,[min_note] |
dpd eax |
newline |
; sub esi,workarea |
; jmp _close |
.play: |
call kill |
call respawn |
xor edx,edx |
mov esi,[midi_limit] |
mov [cur_ptr],esi |
mov [cur_tick],edx |
mov [delta],edx |
.count_ticks: |
lodsw |
test eax,eax |
jz .eof |
and eax,0x7f |
add edx,eax |
jmp .count_ticks |
.eof: |
mov [tick_count],edx |
if OUTDUMP eq 1 |
mov esi,[midi_limit] |
call out_dump |
end if |
and [flag],not FL_LOCK |
test [flag],FL_PLAY |
jz .noplay |
call draw_window |
mcall 5,100 |
mov eax,IPC_PLAY |
call ipc_send |
.noplay: |
test [flag],FL_ADD |
jz red |
mov esi,filename |
mov ecx,[fname_len] |
movzx eax,[list_count] |
mov [play_num],eax |
add_song: |
call PL_add |
and [flag],not FL_ADD |
red: |
call draw_window |
still: |
mov ecx,ipcarea |
call init_ipc |
mov eax,10 |
int 0x40 |
prc_event: |
test eax,eax |
jz still |
.evt: |
cmp eax,1 |
je red |
cmp eax,2 |
je key |
cmp eax,3 |
je button |
cmp eax,7 |
jne still |
movzx eax,byte[ipcarea+16] |
cmp eax,IPC_UPDT |
jne .noupdt |
call draw_bar |
jmp still |
.noupdt: |
cmp eax,IPC_NEXT |
jne still |
cmp [param],'H' |
je _close |
xor edx,edx |
test [flag],FL_SHUFFLE |
jz .noshuf |
mcall 26,9 |
movzx ebx,byte[list_count] |
div ebx |
mov eax,edx |
jmp play_ |
.noshuf: |
test [flag],FL_REPEAT |
jnz decode_end.play |
mov eax,[play_num] |
inc eax |
cmp al,[list_count] |
jb bList.next |
mov eax,IPC_PAUS |
call ipc_send |
jmp red |
if OUTDUMP eq 1 |
out_dump: |
mov ecx,OUTLINE |
.next_byte: |
lodsd |
bswap eax |
dph eax |
dps ' ' |
lodsd |
bswap eax |
dph eax |
dps <13,10> |
loop .next_byte |
ret |
end if |
str_len: |
; in: edi-str ptr |
; out: eax-str length |
push ecx edi |
xor eax,eax |
mov ecx,256 |
repne scasb |
jecxz .nofn |
sub edi,[esp] |
mov eax,edi |
.nofn: |
pop edi ecx |
ret |
fopen: |
or [flag],FL_LOCK |
opendialog draw_window, ret_path, ret_path, filename |
ret_path: |
and [flag],not FL_LOCK |
ret |
include 'event.inc' |
include "thread.inc" |
include "draw.inc" |
; ¤¥áì 室ïâáï ¤ ë¥ ¯à®£à ¬¬ë: |
dd -2 shl 16+4,251,12 shl 16,29 shl 16+5 |
dd 21,16 |
main_coo: |
dd 14 shl 16, 42 shl 16,23 shl 16 |
dd 228 shl 16+38 |
dd 14 shl 16+10 |
dd 236 shl 16+15 |
btncoords: |
dd 120 shl 16+20, 1 shl 16+15 |
dd 149 shl 16+44, 2 shl 16+12 |
dd 195 shl 16+26, 2 shl 16+12 |
dd -2 shl 16+4,54,63 shl 16,6 shl 16+4 |
dd 6,6 |
main_coo2: |
dd 169 shl 16, 4 shl 16,9 shl 16 |
dd 121 shl 16+40 |
dd 3 shl 16+9 |
dd 130 shl 16+4 |
btncoords2: |
dd 48 shl 16+6, 6 |
dd 2000 shl 16+44, 2 shl 16+12 |
dd 2000 shl 16+26, 2 shl 16+12 |
ipcarea rb 20 |
ipcarea2 rb 20 |
dots db ':-' |
text db 'tone> chnl> <trk' |
text_end: |
coo dd main_coo |
play_limit dd playlist |
pl_ptr dd playlist |
param db 'W' |
curnote db 0x80 |
tick_count dd 0 |
play_area dw ? |
file_info: |
dd 0 |
dd 0 |
fsize dd 1 |
dd workarea |
dd hash_table |
I_END: ; ª®¥æ ¯à®£à ¬¬ë |
filename: |
rb 1024+16 |
prcinfo process_information |
I_PARAM rb 256 |
childPID dd ? |
parentPID dd ? |
play_num dd ? |
counter dd ? |
flag dd ? |
fname_len dd ? |
fn_ptr dd ? |
delta dd ? |
cur_ptr dd ? |
cur_tick dd ? |
quarter dd ? |
octave db ? |
tempo dd ? |
midi_limit dd ? |
track_len dd ? |
list_count db ? |
cur_track db ? |
sel_track db ? |
ipcmsg db ? |
fnbuf: |
rb 256 |
btn_raw rb 222*17*3+12 |
hdr_raw rb 275*29*3+12 |
bottom_raw rb 25*378*3+12 |
rb 4 |
playlist rb 256*LISTITEMS |
hash_table: |
rd 4096 |
dir_table rb DIR_SIZE |
workarea: |
/programs/media/midamp/trunk/bottom.gif |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/media/midamp/trunk/build.bat |
---|
0,0 → 1,0 |
fasm MIDAMP.ASM MIDAMP |
/programs/media/midamp/trunk/buttons.gif |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/media/midamp/trunk/debug.inc |
---|
0,0 → 1,137 |
macro debug_print str |
{ |
local ..string, ..label |
jmp ..label |
..string db str,0 |
..label: |
pushf |
pushad |
mov edx,..string |
call debug_outstr |
popad |
popf |
} |
dps fix debug_print |
macro debug_print_dec arg |
{ |
pushf |
pushad |
if ~arg eq eax |
mov eax,arg |
end if |
call debug_outdec |
popad |
popf |
} |
dpd fix debug_print_dec |
;--------------------------------- |
debug_outdec: ;(eax - num, edi-str) |
push 10 ;2 |
pop ecx ;1 |
push -'0' ;2 |
.l0: |
xor edx,edx ;2 |
div ecx ;2 |
push edx ;1 |
test eax,eax ;2 |
jnz .l0 ;2 |
.l1: |
pop eax ;1 |
add al,'0' ;2 |
call debug_outchar ; stosb |
jnz .l1 ;2 |
ret ;1 |
;--------------------------------- |
debug_outchar: ; al - char |
pushf |
pushad |
mov cl,al |
mov eax,63 |
mov ebx,1 |
int 0x40 |
popad |
popf |
ret |
debug_outstr: |
mov eax,63 |
mov ebx,1 |
@@: |
mov cl,[edx] |
test cl,cl |
jz @f |
int 40h |
inc edx |
jmp @b |
@@: |
ret |
_debug_crlf db 13, 10, 0 |
macro newline |
{ |
pushf |
pushad |
mov edx, _debug_crlf |
call debug_outstr |
popad |
popf |
} |
macro print message |
{ |
dps message |
newline |
} |
macro pregs |
{ |
dps "EAX: " |
dpd eax |
dps " EBX: " |
dpd ebx |
newline |
dps "ECX: " |
dpd ecx |
dps " EDX: " |
dpd edx |
newline |
} |
macro debug_print_hex arg |
{ |
pushf |
pushad |
if ~arg eq eax |
mov eax, arg |
end if |
call debug_outhex |
popad |
popf |
} |
dph fix debug_print_hex |
debug_outhex: |
; eax - number |
mov edx, 8 |
.new_char: |
rol eax, 4 |
movzx ecx, al |
and cl, 0x0f |
mov cl, [__hexdigits + ecx] |
pushad |
mcall 63, 1 |
popad |
dec edx |
jnz .new_char |
ret |
__hexdigits: |
db '0123456789ABCDEF' |
/programs/media/midamp/trunk/dlg.inc |
---|
0,0 → 1,209 |
macro opendialog redproc,openoff,erroff,path |
{ |
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc |
local run_fileinfo, param |
local getmesloop, loox, mred, mkey, mbutton, mgetmes |
local dlg_is_work, ready |
; |
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, |
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) |
; |
cld |
;; mov esi,path |
mov edi,path |
xor eax,eax |
mov ecx,(1024+16)/4 |
rep stosb |
;mov [get_loops],0 |
mov [dlg_pid_get],0 |
; Get my PID in dec format 4 bytes |
; mov eax,9 |
; mov ebx,prcinfo |
; mov ecx,-1 |
; int 0x40 |
mov eax,[parentPID] |
; convert eax bin to param dec |
; mov eax,dword [prcinfo+30] ;offset of myPID |
mov edi,param+4-1 ;offset to 4 bytes |
mov ecx,4 |
mov ebx,10 |
cld |
new_d: |
xor edx,edx |
div ebx |
add dl,'0' |
mov [edi],dl |
dec edi |
loop new_d |
; wirite 1 byte space to param |
mov [param+4],byte 32 ;Space for next parametr |
; and 1 byte type of dialog to param |
mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog) |
; |
; STEP2 prepare IPC area for get messages |
; |
; prepare IPC area |
mov [path],dword 0 |
mov [path+4],dword 8 |
; define IPC memory |
mov eax,60 |
mov ebx,1 ; define IPC |
mov ecx,path ; offset of area |
mov edx,1024+16 ; size |
int 0x40 |
; change wanted events list 7-bit IPC event |
mov eax,40 |
mov ebx,01000111b |
int 0x40 |
; |
; STEP 3 run SYSTEM XTREE with parameters |
; |
mov eax,70 |
mov ebx,run_fileinfo |
int 0x40 |
call redproc |
mov [get_loops],0 |
getmesloop: |
mov eax,23 |
mov ebx,50 ;0.5 sec |
int 0x40 |
dec eax |
jz mred |
dec eax |
jz mkey |
dec eax |
jz mbutton |
cmp al, 7-3 |
jz mgetmes |
; Get number of procces |
mov ebx,prcinfo |
mov ecx,-1 |
mov eax,9 |
int 0x40 |
mov ebp,eax |
loox: |
mov eax,9 |
mov ebx,prcinfo |
mov ecx,ebp |
int 0x40 |
mov eax,[DLGPID] |
cmp [prcinfo+30],eax ;IF Dialog find |
je dlg_is_work ;jmp to dlg_is_work |
dec ebp |
jnz loox |
jmp erroff |
dlg_is_work: |
cmp [prcinfo+50],word 9 ;If slot state 9 - dialog is terminated |
je erroff ;TESTODP2 terminated too |
cmp [dlg_pid_get],dword 1 |
je getmesloop |
inc [get_loops] |
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated |
jae erroff |
jmp getmesloop |
mred: |
call redproc |
jmp getmesloop |
mkey: |
mov eax,2 |
int 0x40 ; read (eax=2) |
jmp getmesloop |
mbutton: |
mov eax,17 ; get id |
int 0x40 |
cmp ah,1 ; button id=1 ? |
jne getmesloop |
mov eax,-1 ; close this program |
int 0x40 |
mgetmes: |
; If dlg_pid_get then second message get jmp to still |
cmp [dlg_pid_get],dword 1 |
je ready |
; First message is number of PID SYSXTREE dialog |
; convert PID dec to PID bin |
movzx eax,byte [path+16] |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+1] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+2] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+3] |
add eax,ebx |
sub eax,48 |
mov [DLGPID],eax |
; Claear and prepare IPC area for next message |
mov [path],dword 0 |
mov [path+4],dword 8 |
mov [path+8],dword 0 |
mov [path+12],dword 0 |
mov [path+16],dword 0 |
; Set dlg_pid_get for get next message |
mov [dlg_pid_get],dword 1 |
call redproc ;show DLG_PID |
jmp getmesloop |
ready: |
; |
; The second message get |
; Second message is 1024 bytes path to SAVE/OPEN file |
; shl path string on 16 bytes |
; |
cld |
mov esi,path+16 |
mov edi,path |
mov ecx,1024/4 |
rep movsd |
mov [edi],byte 0 |
jmp openoff |
; DATA AREA |
get_loops dd 0 |
dlg_pid_get dd 0 |
DLGPID dd 0 |
param: |
dd 0 ; My dec PID |
dd 0,0 ; Type of dialog |
run_fileinfo: |
dd 7 |
dd 0 |
dd param |
dd 0 |
dd 0 |
;run_filepath |
db '/RD/1/SYSXTREE',0 |
;prcinfo: |
;times 256 db 0 |
} |
/programs/media/midamp/trunk/draw.inc |
---|
0,0 → 1,356 |
; ********************************************* |
; ******* DRAW PLAY BAR ********************** |
; ********************************************* |
draw_bar: |
push eax ebp |
mov eax,[cur_tick] |
test eax,eax |
jz .ex |
mov ebp,[coo] |
mov ebx,[ebp-20] |
mul ebx |
mov ebx,[tick_count] |
test ebx,ebx |
jz .ex |
div ebx |
mov ebx,[ebp-16] |
mov bx,ax |
mov ecx,[ebp-12] |
mov edx,0x84706a |
mov eax,13 |
int 0x40 |
mov esi,TOTALTIME_XY |
mov eax,[tick_count] |
call draw_total_time |
.nobar: |
mov esi,[ebp+20] |
mov ebx,[ebp+12] |
mov ecx,[ebp+16] |
call draw_cur_time |
mov esi,140 shl 16+(WND_HEIGHT-18) |
sub ebx,95 shl 16 |
add ecx,(WND_HEIGHT-34)shl 16 |
call draw_cur_time |
.ex: |
pop ebp eax |
ret |
; ********************************************* |
; ******* ******* |
; ********************************************* |
draw_window: |
mov eax,12 |
mov ebx,1 |
int 0x40 |
or [flag],FL_BOTTRED |
xor eax,eax |
mov ebx,100*65536+275 |
mov ecx,200*65536+WND_HEIGHT |
mov edi,hdr_raw+12 |
mov ebp,[coo] |
test [flag],FL_HIDDEN |
jz .nohide1 |
and ebx,0xffff |
and ecx,0xffff |
add edi,275*14*3 |
.nohide1: |
push edi |
mov edx,WND_BACK |
mov esi,edx |
mov edi,edx |
int 0x40 |
mov ecx,[channel] |
shl ecx,4 |
add cl,[sel_track] |
mcall 47,0x20100,,<191,15>,0xf0f000 |
movsx ecx,[octave] |
add ecx,100 |
mcall ,0x30000,,<132,15> |
pop ebx |
mcall 7,,(275 shl 16+14),0 |
mov esi,0x80ecce7a |
mov eax,8 |
mov ebx,265 shl 16+7 |
mov ecx,3 shl 16+7 |
mov edx,1+1 shl 30 |
int 0x40 ; close button |
sub ebx,10 shl 16 |
mov edx,100+1 shl 30 |
int 0x40 ; shade button-101 |
sub ebx,10 shl 16 |
add edx,3 |
int 0x40 ; minimize button-103 |
sub ebx,239 shl 16 |
inc edx ; about button-104 |
int 0x40 |
xor esi,esi |
xor edi,edi |
mov ecx,3 |
pushd [ebp+12] |
pushd [ebp+16] |
call draw_navigation |
add esp,8 |
mov ebx,[ebp-16] |
add ebx,[ebp-20] |
mov ecx,[ebp-12] |
add ecx,[ebp-24] |
mov esi,0x2c2b46 |
mov edx,2+1 shl 29 |
int 0x40 |
shr eax,1 |
mov ecx,12 |
mov ebx,FN_XY |
mov edx,[fn_ptr];I_PARAM;filename |
mov esi,1;[fname_len] |
mov edi,0x00e200 |
.fnlp: |
push ecx |
mcall ,,edi |
add ebx,1 shl 16 |
mcall |
add ebx,6 shl 16 |
inc edx |
pop ecx |
loop .fnlp |
add ebx,5 shl 16 |
mcall ,,0xa0a0a0,text,text_end-text |
call draw_bar |
call PL_show |
test [flag],FL_HIDDEN |
jnz .nohide2 |
mov eax,7 |
mov ebx,btn_raw+12 |
mov ecx,BTNS_SIZE |
mov edx,BTNS_XY |
int 0x40 |
.nohide2: |
mov esi,FL_SHUFFLE |
mov edi,btncoords+8 |
mov eax,13 |
mov edx,0xd600 |
mov ecx,2 |
.loo3: |
test [flag],esi |
je .el |
mov ebx,[edi] |
add ebx,5 shl 16 |
add ebx,[ebp] |
mov bx,3 |
push ecx |
mov ecx,[edi+4] |
add ecx,4 shl 16 |
add ecx,[ebp+4] |
mov cx,2 |
int 0x40 |
pop ecx |
.el: |
add edi,8 |
inc esi |
loop .loo3 |
.enddraw: |
mov eax,12 |
mov ebx,2 |
int 0x40 |
ret |
draw_navigation: |
; ebp - coordinates |
push esi edi ecx |
mov eax,8 |
mov ecx,5 |
mov ebx,[ebp] |
add ebx,[ebp-8] |
add ebx,esi |
mov edx,3+1 shl 30 |
.btnloo: |
push ecx |
mov ecx,[ebp+4] |
add ecx,[ebp-4] |
add ecx,edi |
int 0x40 |
pop ecx |
add ebx,[ebp+8] |
inc edx |
loop .btnloo |
pop ecx |
lea edi,[ebp+24] |
.btnloo2: |
mov ebx,[edi] |
add ebx,[ebp] |
add ebx,[esp+4] |
push ecx |
mov ecx,[edi+4] |
add ecx,[ebp+4] |
add ecx,[esp+4] |
int 0x40 |
pop ecx |
add edi,8 |
inc edx |
loop .btnloo2 |
pop edi esi |
ret |
draw_cur_time: |
pusha |
mcall 13,,,WND_BACK |
mcall 8,,,101+1 shl 29+1 shl 30 |
mov ebx,[tick_count] |
mov eax,[cur_tick] |
test [flag],FL_REVERSE |
jz .norev |
xchg eax,ebx |
sub eax,ebx |
lea ebx,[esi-6 shl 16] |
push eax |
mcall 4,,0xf000,dots+1,1 |
pop eax |
.norev: |
mov [esp+28],eax |
popa |
draw_total_time: ; eax -time to show |
pusha |
xor edx,edx |
mov ebx,100 |
div ebx |
xor edx,edx |
mov ebx,60 |
div ebx |
push edx |
mov ecx,eax |
mcall 47,0x20000,,esi,0xf000 |
pop ecx |
add edx,17 shl 16 |
int 0x40 |
sub edx,5 shl 16 |
mcall 4,edx,esi,dots,1 |
popa |
ret |
BOTT_BTN equ 25 shl 16+18 |
BOTT_SIZEX equ 25 |
BOTT_SIZEY equ 18 |
BOTT_S equ BOTT_SIZEX*BOTT_SIZEY*3 |
BOTT_X equ PL_X |
BOTT_Y equ (WND_HEIGHT-27) |
BOTT_SPACE equ 30 shl 16 |
popup db -1 |
draw_bottom: |
pusha |
mcall 13,175,(BOTT_Y-5)shl 16+24,WND_BACK |
add ebx,(266-30)shl 16-135 |
mcall |
mov ecx,5 |
mov esi,bot_btn |
push esi |
mov ebx,bottom_raw+12 |
xor eax,eax |
.nxt: |
push ecx |
lodsw |
shl eax,16 |
lea edx,[eax+BOTT_Y] |
mcall 7,,BOTT_BTN |
add ebx,BOTT_S*4 |
pop ecx |
cmp ecx,4 |
jne .noadj |
add ebx,BOTT_S |
.noadj: |
loop .nxt |
mov esi,[esp] |
mov ecx,5 |
mov ebp,BOTT_Y shl 16+BOTT_SIZEY |
mov edx,20+1 shl 30 |
.nxt2: |
push ecx |
lodsw |
shl eax,16 |
lea ebx,[eax+BOTT_SIZEX+2 shl 16-3] |
mcall 8,,ebp |
inc edx |
pop ecx |
loop .nxt2 |
pop esi |
call draw_popup |
popa |
ret |
draw_popup: |
movsx eax,[popup] |
cmp eax,0 |
jge .ok |
mov edx,30+1 shl 31 |
mov ecx,21 |
mov eax,8 |
.clr: |
mcall |
inc edx |
loop .clr |
jmp .ex |
.ok: |
push eax |
lea edx,[eax+1 shl 31+20] |
mcall 8 |
pop eax |
mov ebx,eax |
shl eax,2 |
mov ecx,3 |
cmp eax,4 |
jne .noadj1 |
inc ecx |
.noadj1: |
cmp eax,8 |
jb .noadj2 |
inc eax |
.noadj2: |
inc eax |
push eax |
movzx edx,word[bot_btn+ebx*2] |
shl edx,16 |
add edx,BOTT_Y |
push edx |
.noadj3: |
imul ebx,eax,BOTT_S |
add ebx,bottom_raw+12 |
push ecx |
.nxt: |
push ecx |
mcall 7,,BOTT_BTN |
add ebx,BOTT_S |
sub edx,BOTT_SIZEY |
pop ecx |
loop .nxt |
pop ecx ebx edx |
mov ebp,BOTT_Y shl 16+BOTT_SIZEY |
mov eax,8 |
add edx,1 shl 30+30 |
add ebx,2 shl 16 |
mov bx,BOTT_SIZEX-3 |
.nxt2: |
push ecx |
mcall ,,ebp |
inc edx |
sub ebp,BOTT_SIZEY shl 16 |
pop ecx |
loop .nxt2 |
.ex: |
ret |
bot_btn: |
dw 10,40,70,100,240 |
about1: |
db 13,10,'* MIDAMP for MenuetOS v1.0 by Willow, July 2005 *',13,10,0 |
/programs/media/midamp/trunk/event.inc |
---|
0,0 → 1,449 |
key_codes db 27,182,109,115,114,122,98,118,108,120,99,13,8,32,0, 0, 0,0 |
db 180,181,93,91 |
; bottom actions |
db 0, 0, 0, 0, 0,185,0, 0, 0, 0,0,0,92 |
btn_codes db 1, 0, 0, 9, 10, 3, 7, 6, 8, 4, 5, 0,0, 0,101,100,11,2 |
db 0, 0, 0, 0 |
; bottom actions |
db 35,49,48,37,31,32,41,42,40,36,103,104,0 |
jmps dw _close, kDel,kMute, bList.shuf, bList.repe, bList.prev, bList.next |
dw bList.stop, kLoad, Xpress, Rewind.space, auto_load,Rewind, Rewind.space |
dw bReverse, bShade, bList, bBar, bOctU, bOctD, bSelTrack, bSelChannel |
; bottom actions |
dw kDel,bLsave,bLload,bRemAll,bAdd,bAddDir,bSelZero,bInvSel,bSelAll,bRemCrop |
dw bMinimize,bAbout,bResetTrk |
jmps_end: |
key: |
mov eax,2 |
int 0x40 |
mov edi,key_codes |
cmp ah,48 |
jb .jump |
cmp ah,57 |
ja .jump |
sub ah,48 |
mov byte[channel],ah |
jmp midi_kill |
.jump: |
mov ecx,(jmps_end-jmps)/2 |
mov ebx,edi |
shr eax,8 |
repne scasb |
jne play_.noplsel |
sub edi,ebx |
jmp word[jmps+edi*2-2] |
kDel: |
call PL_del |
call PL_show |
jmp still |
kMute: |
xor [flag],FL_MUTE |
jmp still |
kLoad: |
; dps 'Load' |
cmp [list_count],LISTITEMS |
jbe noparam |
jmp still |
Xpress: |
mov eax,IPC_PLAY |
call ipc_send |
jmp still;Rewind.space |
auto_load: |
call PL_get1stsel |
mov eax,ebx |
play_: |
mov [play_num],eax |
call PL_getbyindex |
mov edi,filename;fnbuf |
rep movsb |
xor eax,eax |
mov byte[edi],al |
and [flag],not FL_ADD |
or [flag],FL_PLAY |
jmp open_file |
.noplsel: |
call PL_get1stsel |
test ebx,ebx |
jz .noupward |
cmp al,178 |
jne .noupa |
.seldec: |
dec ebx;[listsel] |
.listdraw: |
call PL_clearsel |
mov eax,ebx |
call PL_getbyindex |
or word[esi-2],FL_MULSEL |
call PL_show |
jmp still |
.noupa: |
cmp al,184 |
jne .noupward |
dec [listsel] |
.swap: |
dec ebx |
call PL_swap |
jmp .listdraw |
.noupward: |
inc ebx |
cmp bl,[list_count] |
jae still |
cmp al,177 |
je .listdraw |
.nodowna: |
cmp al,183 |
jne still |
inc [listsel] |
jmp .swap |
Rewind: |
push [midi_limit] |
pop [cur_ptr] |
and [cur_tick],0 |
jmp red |
.space: |
cmp [tick_count],0 |
jz still |
mov eax,IPC_TRIG |
call ipc_send |
jmp red |
button: |
mov eax,17 |
int 0x40 |
cmp ah,20 |
jb .nobott |
cmp ah,25 |
ja .nobott |
sub ah,20 |
mov [popup],ah |
.sh: |
or [flag],FL_BOTTRED |
call PL_show |
jmp still |
.nobott: |
cmp ah,31 |
jb .nopop |
cmp ah,50 |
ja .nopop |
mov [popup],-1 |
or [flag],FL_BOTTRED |
call PL_show |
SH_POPUP equ 10 |
if SH_POPUP eq 1 |
mov ebx,eax |
shr ebx,8 |
dps 'Popup#=' |
dpd ebx |
jmp .sh |
end if |
.nopop: |
mov edi,btn_codes |
jmp key.jump |
bReverse: |
xor [flag],FL_REVERSE |
call draw_bar |
jmp still |
_close: |
call kill |
or eax,-1 |
int 0x40 |
bShade: |
call Shade |
jmp still |
Shade: |
xor [flag],FL_HIDDEN |
test [flag],FL_HIDDEN |
jz .open |
mov esi,14 |
mov [coo],main_coo2 |
jmp .op |
.open: |
mov esi,WND_HEIGHT |
mov [coo],main_coo |
.op: |
mov ebx,-1 |
mov ecx,ebx |
mov edx,ebx |
mov eax,67 |
int 0x40 |
ret |
bMinimize: |
; mcall 18,10 |
jmp still |
bList: |
mov [popup],-1 |
mov edx,[listsel] |
call PL_getitemclick |
mov [listsel],eax |
mcall 66,3 |
mov ebx,eax |
; dph ebx |
test ebx,1100b |
jnz .mul |
call PL_clearsel |
test ebx,11b |
jz .skipor |
mov ecx,[listsel] |
mov [listsel],edx |
cmp ecx,edx |
je .skipor |
ja .above |
xchg ecx,edx |
.above: |
sub ecx,edx |
inc ecx |
mov eax,edx |
push ecx |
call PL_getbyindex |
sub esi,2 |
pop ecx |
call PL_shiftsel |
jmp .plsh |
.mul: |
bts [flag],15 |
jc .skipor |
mov eax,edx |
call PL_getbyindex |
or word[esi-2],FL_MULSEL |
.skipor: |
mov eax,[listsel] |
call PL_getbyindex |
xor word[esi-2],FL_MULSEL |
.plsh: |
call PL_show |
mcall 40,111b |
mcall 23,30 |
push eax |
mcall 40,1000111b |
pop eax |
cmp eax,3 |
jne still |
mcall 17 |
cmp ah,11 |
jne still |
call PL_getitemclick |
cmp eax,[listsel] |
je auto_load |
mov [listsel],eax |
call PL_show |
jmp still |
.repe: |
xor [flag],FL_REPEAT |
jmp red |
.stop: |
mov eax,IPC_PAUS |
call ipc_send |
jmp Rewind |
.shuf: |
xor [flag],FL_SHUFFLE |
jmp red |
.prev: |
mov eax,[play_num] |
test eax,eax |
jz still |
dec eax |
jmp play_ |
.next: |
mov eax,[play_num] |
inc eax |
cmp al,[list_count] |
jae still |
jmp play_ |
bBar: |
cmp [tick_count],0 |
jz still |
mov eax,37 |
mov ebx,1 |
int 0x40 |
mov ebp,[coo] |
sub eax,[ebp-16] |
shr eax,16 |
mov ebx,[tick_count] |
mul ebx |
mov ebx,[ebp-20] |
div ebx |
mov ebx,eax ; ebx - selected tick |
xor ecx,ecx |
mov esi,[midi_limit] |
.further: |
lodsw |
and eax,0x7f |
add ecx,eax |
cmp ecx,ebx |
jb .further |
sub ecx,eax |
mov [cur_tick],ecx |
sub esi,2 |
mov [cur_ptr],esi |
drw: |
jmp red |
OCT_CH equ 3 |
bOctU: |
add [octave],OCT_CH |
jmp midi_kill |
bOctD: |
sub [octave],OCT_CH |
jmp midi_kill |
bSelChannel: |
call get_num |
cmp eax,-1 |
je still |
dps <13,10,'Channel#'> |
dpd eax |
mov [channel],eax |
jmp midi_kill |
bSelTrack: |
call get_num |
cmp eax,-1 |
je still |
dps <13,10,'Track#'> |
dpd eax |
mov [sel_track],al |
jmp midi_kill |
bResetTrk: |
xor eax,eax |
mov [sel_track],al |
mov [channel],eax |
dps <13,10,'Both track & channel are 0',13,10> |
jmp midi_kill |
bLsave: |
call PL_save |
bLload: |
call PL_load |
jmp red |
bRemAll: |
and [list_count],0 |
mov [play_limit],playlist-2 |
jmp red |
bAdd: |
movzx eax,[list_count] |
dpd eax |
call fopen |
mov edi,filename |
cmp byte[edi],0 |
jz still |
call str_len |
xchg eax,ecx |
mov esi,edi |
jmp add_song |
bAddDir: |
call fopen |
mov edi,filename |
cmp byte[edi],0 |
jz still |
call find_slash |
lea edx,[edi-filename+fnbuf] ; edx -> '/' |
and byte[edi],0 |
mov esi,filename |
mov edi,fnbuf |
mov ecx,64 |
rep movsb |
mov dword[file_info+12],dir_table |
mov dword[file_info+8],DIR_SIZE/512 |
.nxt2: |
mcall 58,file_info |
mov ecx,DIR_SIZE/32 |
mov esi,dir_table |
.nxt: |
mov al,[esi] |
cmp al,0xe5 |
je .no |
test al,al |
jz .end |
test byte[esi+12],11000b |
jnz .no |
mov eax,[esi+7] |
mov al,'.' |
cmp eax,'.MID' |
je .ok |
cmp eax,'.KAR' |
jne .no |
.ok: |
mov [esi+8],eax |
pusha |
mov edi,edx |
mov ecx,12 |
rep movsb |
and byte[edi],0 |
mov ecx,edi |
sub ecx,fnbuf |
mov esi,fnbuf |
call PL_add |
popa |
.no: |
add esi,32 |
loop .nxt |
add dword[file_info+4],DIR_SIZE/512 |
jmp .nxt2 |
.end: |
mov ebx,file_info |
and dword[ebx+4],0 |
mov [fsize],1 |
mov dword[ebx+12],workarea |
jmp red;still |
bSelZero: |
call PL_clearsel |
jmp red |
bInvSel: |
call PL_invsel |
jmp red |
bSelAll: |
call PL_clearsel |
call PL_invsel |
jmp red |
bRemCrop: |
call PL_invsel |
call PL_del |
jmp bSelAll |
bAbout: |
mov edx,about1 |
call debug_outstr |
jmp still |
get_num: ; out: eax-number entered |
or [flag],FL_LOCK |
mcall 10 |
dpd eax |
cmp eax,1 |
jne .nored |
call draw_window |
jmp get_num |
.nored: |
cmp eax,2 |
jne .nokey |
mcall 2 |
movzx eax,ah |
sub eax,'0' |
jl .none |
cmp eax,9 |
jbe .ok |
.none: |
mov eax,-1 |
.ok: |
and [flag],not FL_LOCK |
ret |
.nokey: |
cmp eax,3 |
jne get_num |
mcall 17 |
jmp get_num |
find_slash: |
; in: edi-filename, out: edi-slash ptr-1 |
push eax ecx |
call str_len |
mov ecx,eax |
std |
add edi,eax |
mov al,'/' |
repne scasb |
cld |
add edi,2 |
pop ecx eax |
ret |
/programs/media/midamp/trunk/gif_lite.inc |
---|
0,0 → 1,328 |
; GIF LITE v2.0 by Willow |
; Written in pure assembler by Ivushkin Andrey aka Willow |
; |
; This include file will contain functions to handle GIF image format |
; |
; Created: August 15, 2004 |
; Last changed: September 9, 2004 |
; Change COLOR_ORDER in your program |
; if colors are displayed improperly |
if ~ (COLOR_ORDER in <MENUETOS,OTHER>) |
; This message may not appear under MenuetOS, so watch... |
display 'Please define COLOR_ORDER: MENUETOS or OTHER',13,10 |
end if |
; virtual structure, used internally |
struc GIF_list |
{ |
.NextImg rd 1 |
.Left rw 1 |
.Top rw 1 |
.Width rw 1 |
.Height rw 1 |
} |
struc GIF_info |
{ |
.Left rw 1 |
.Top rw 1 |
.Width rw 1 |
.Height rw 1 |
} |
_null fix 0x1000 |
; **************************************** |
; FUNCTION GetGIFinfo - retrieve Nth image info |
; **************************************** |
; in: |
; esi - pointer to image list header |
; ecx - image_index (0...img_count-1) |
; edi - pointer to GIF_info structure to be filled |
; out: |
; eax - pointer to RAW data, or 0, if error |
GetGIFinfo: |
push esi ecx edi |
xor eax,eax |
jecxz .eloop |
.lp: |
mov esi,[esi] |
test esi,esi |
jz .error |
loop .lp |
.eloop: |
add esi,4 |
movsd |
movsd |
mov eax,esi |
.error: |
pop edi ecx esi |
ret |
; **************************************** |
; FUNCTION ReadGIF - unpacks GIF image |
; **************************************** |
; in: |
; esi - pointer to GIF file in memory |
; edi - pointer to output image list |
; eax - pointer to work area (MIN 16 KB!) |
; out: |
; eax - 0, all OK; |
; eax - 1, invalid signature; |
; eax >=8, unsupported image attributes |
; |
; ecx - number of images |
ReadGIF: |
push esi edi |
mov [.table_ptr],eax |
mov [.cur_info],edi |
xor eax,eax |
mov [.globalColor],eax |
mov [.img_count],eax |
inc eax |
cmp dword[esi],'GIF8' |
jne .er ; signature |
mov ecx,[esi+0xa] |
inc eax |
add esi,0xd |
mov edi,esi |
bt ecx,7 |
jnc .nextblock |
mov [.globalColor],esi |
call .Gif_skipmap |
.nextblock: |
cmp byte[edi],0x21 |
jne .noextblock |
inc edi |
cmp byte[edi],0xf9 ; Graphic Control Ext |
jne .no_gc |
add edi,7 |
jmp .nextblock |
.no_gc: |
cmp byte[edi],0xfe ; Comment Ext |
jne .no_comm |
inc edi |
.block_skip: |
movzx eax,byte[edi] |
lea edi,[edi+eax+1] |
cmp byte[edi],0 |
jnz .block_skip |
inc edi |
jmp .nextblock |
.no_comm: |
cmp byte[edi],0xff ; Application Ext |
jne .nextblock |
add edi,13 |
jmp .block_skip |
.noextblock: |
cmp byte[edi],0x2c ; image beginning |
jne .er |
inc [.img_count] |
inc edi |
mov esi,[.cur_info] |
add esi,4 |
xchg esi,edi |
movsd |
movsd |
push edi |
movzx ecx,word[esi] |
inc esi |
bt ecx,7 |
jc .uselocal |
push [.globalColor] |
mov edi,esi |
jmp .setPal |
.uselocal: |
call .Gif_skipmap |
push esi |
.setPal: |
movzx ecx,byte[edi] |
inc ecx |
mov [.codesize],ecx |
dec ecx |
pop [.Palette] |
lea esi,[edi+1] |
mov edi,[.table_ptr] |
xor eax,eax |
cld |
lodsb ; eax - block_count |
add eax,esi |
mov [.block_ofs],eax |
mov [.bit_count],8 |
mov eax,1 |
shl eax,cl |
mov [.CC],eax |
inc eax |
mov [.EOI],eax |
lea ecx,[eax-1] |
mov eax, _null shl 16 |
.filltable: |
stosd |
inc eax |
loop .filltable |
pop edi |
mov [.img_start],edi |
.reinit: |
mov edx,[.EOI] |
inc edx |
push [.codesize] |
pop [.compsize] |
call .Gif_get_sym |
cmp eax,[.CC] |
je .reinit |
call .Gif_output |
.cycle: |
movzx ebx,ax |
call .Gif_get_sym |
cmp eax,edx |
jae .notintable |
cmp eax,[.CC] |
je .reinit |
cmp eax,[.EOI] |
je .end |
call .Gif_output |
.add: |
push eax |
mov eax,[.table_ptr] |
mov [eax+edx*4],ebx |
pop eax |
cmp edx,0xFFF |
jae .cycle |
inc edx |
bsr ebx,edx |
cmp ebx,[.compsize] |
jne .noinc |
inc [.compsize] |
.noinc: |
jmp .cycle |
.notintable: |
push eax |
mov eax,ebx |
call .Gif_output |
push ebx |
movzx eax,bx |
call .Gif_output |
pop ebx eax |
jmp .add |
.er: |
pop edi |
jmp .ex |
.end: |
mov eax,[.cur_info] |
mov [eax],edi |
mov [.cur_info],edi |
add esi,2 |
xchg esi,edi |
.nxt: |
cmp byte[edi],0 |
jnz .continue |
inc edi |
jmp .nxt |
.continue: |
cmp byte[edi],0x3b |
jne .nextblock |
xor eax,eax |
stosd |
mov ecx,[.img_count] |
.ex: |
pop edi esi |
ret |
.Gif_skipmap: |
; in: ecx - image descriptor, esi - pointer to colormap |
; out: edi - pointer to area after colormap |
and ecx,111b |
inc ecx ; color map size |
mov ebx,1 |
shl ebx,cl |
lea ebx,[ebx*2+ebx] |
lea edi,[esi+ebx] |
ret |
.Gif_get_sym: |
mov ecx,[.compsize] |
push ecx |
xor eax,eax |
.shift: |
ror byte[esi],1 |
rcr eax,1 |
dec [.bit_count] |
jnz .loop1 |
inc esi |
cmp esi,[.block_ofs] |
jb .noblock |
push eax |
xor eax,eax |
lodsb |
test eax,eax |
jnz .nextbl |
mov eax,[.EOI] |
sub esi,2 |
add esp,8 |
jmp .exx |
.nextbl: |
add eax,esi |
mov [.block_ofs],eax |
pop eax |
.noblock: |
mov [.bit_count],8 |
.loop1: |
loop .shift |
pop ecx |
rol eax,cl |
.exx: |
xor ecx,ecx |
ret |
.Gif_output: |
push esi eax edx |
mov edx,[.table_ptr] |
.next: |
push word[edx+eax*4] |
mov ax,word[edx+eax*4+2] |
inc ecx |
cmp ax,_null |
jnz .next |
shl ebx,16 |
mov bx,[esp] |
.loop2: |
pop ax |
lea esi,[eax+eax*2] |
add esi,[.Palette] |
if COLOR_ORDER eq MENUETOS |
mov esi,[esi] |
bswap esi |
shr esi,8 |
mov [edi],esi |
add edi,3 |
else |
movsw |
movsb |
end if |
loop .loop2 |
pop edx eax esi |
ret |
.globalColor rd 1 |
.img_count rd 1 |
.cur_info rd 1 ; image table pointer |
.img_start rd 1 |
.codesize rd 1 |
.compsize rd 1 |
.bit_count rd 1 |
.CC rd 1 |
.EOI rd 1 |
.Palette rd 1 |
.block_ofs rd 1 |
.table_ptr rd 1 |
/programs/media/midamp/trunk/hdr.gif |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/media/midamp/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 |
/programs/media/midamp/trunk/midamp.txt |
---|
0,0 → 1,247 |
MIDAMP for Menuet v1.0 July 29, 2005 |
Written in pure assembler by Ivushkin Andrey aka Willow |
Monophonic MIDI player |
Vivat assembler et MENUETOS! |
MenuetOS still has a poor sound capabilities. Drivers are written for a few |
soundcard models. Till recently I considered MEOS to be as voiceless as an |
oyster. But then an alternative appeared; dear VaStaNi wrote kernel support of |
PC speaker. Old good times of Pascal and MS-DOS came to me again. About 5 years |
ago I wrote a Pascal application that parsed and played a note string in QBasic |
syntax. |
Now MeOS gets the simplest, speaker-driven sound scheme in Mario79's distro, |
but the first melody in Menuet I heard was from the my program MIDAMP in |
December, 2004. On technical reasons its release takes place only now. |
So, MIDAMP is the simplest single-voiced MIDI player. It cannot do much though |
it resembles the famous WinAmp. All it can do is to beep MIDI files. |
There are no equalizer, balance and fader, and they won't appear. Moreover, |
I may guarantee the correct sound only for files having a single track, one |
instrument channel and within technological range of notes :-( |
######### |
System requirements: |
1. Kernel having following function implemented: |
55/55 - PC speaker interface (critical!) |
67 - window shading; |
66/3 - for extended mouse selection in playlist. |
2. SYSXTREE version not below 52 - opening files and directories (critical!) |
3. RAM amount for application - about 150 Kbytes. |
######### |
MIDAMP still uses a single playlist - /HD/1/PLAYLIST.TXT by default. Persons |
interested can change the PLAYLIST_PATH constant value in MIDAMP.ASM. Playlist |
is a simple text file having filenames to be played in each line. It is NOT |
RECOMMENDED to edit the playlist by hand - bugs may appear while loading MIDAMP. |
When started, MIDAMP creates a new thread whose job is actually playing. Early |
versions had main thread that processed everything, therefore unpleasant sound |
delays appeared when managing the playlist. Threads communicate intensively |
through IPC, although I think it's an excess in such a case. But it works not |
bad. |
MIDAMP is able to shade to window header by pressing the proper button. I tried |
to perform complete minimization through mcall 18,10 (new feature of Kolibri4), |
but ran into the problem while restoring of window when PANEL button pressed. |
That function possibly does not support windows type II ? |
Hotkeys - almost like in WinAmp: |
Del - delete the selected tracks; |
z - previous track; |
x, Enter, double click - play selected file; |
c, Space - pause; |
v - stop; |
b - next track; |
Esc - close the program; |
m - sound on/off; |
PgUp, PgDn - swap 2 tracks (not completed!); |
BackSpace - rewind track; |
Home/End - increase/decrease melody notes offset and play track from beginning |
(it is shown near 'tone>' text). |
In the case of polyphonic MIDI, if an intelligent melody isn't heard, you may |
try to choose another track 'trk' or instrument channel 'chnl', pressing '[' or |
']' accordingly and then a number key from '0' to '9'. The file will be played |
from the beginning. To reset track and channel to the default value, press '\' . |
Explaining some interface buttons: |
Shuffle toggles random playback on/off. Repeat - current track will loop again |
and again. An icon in the top left corner outputs a brief info about the |
program to the Debug Board. Clicking the time toggles its view - from beginning |
or from the end of file. |
Mouse click on playlist when holding Shift or Ctrl button works like in WinAmp. |
Remarks to bottom buttons: |
'Add URL' not implemented, on clear reasons; |
'Add Dir' - specify any file in the directory desired. *.MID and *.KAR files of |
that directory will be added to the list; |
'Misc' submenu is not implemented; |
'New List' does nothing. MIDAMP still uses a fixed playlist. |
One of the following flags may precede a filename in the commandline: |
W - to load a file and wait (default); |
P - to play a file; |
H - to start shaded and close after playback. |
To-Do list: |
1. Increase playlist size (40 items for now). |
2. Add dialog to select tracks of polyphonic melodies including analysis on |
notes. |
3. Reading text in Karaoke files. |
4. Playlist select. |
5. Note editor, as in Ringtone Editor. |
6. Add comments to source. |
7. Correct bugs to be found. |
Special thanks to: |
VaStaNi - there would be no need of MIDAMP w/o his code |
Standard MIDI Files 0.06 March 1, 1988 |
MIDI 1.0 Specification |
General MIDI Level Spec |
MIDI SAMPLE DUMP STANDARD |
Standard MIDI File Format by Dustin Caldwell |
Files format of MIDI |
The USENET MIDI Primer by Bob McQueer |
Pavlushin Evgeny for his splendid SYSXTREE (DLGS.INC is the opendialog macro |
of ASCL library edited to meet MIDAMP specific needs) |
Send the wishes and bug reports to wil_low@hotbox.ru or to the meos.sysbin.com |
forum. |
See you later! |
**************************************** |
**************************************** |
MIDAMP ¤«ï Menuet v1.0 29 ¨î«ï 2005 £. |
¯¨á ç¨á⮬ áᥬ¡«¥à¥ ¢ãèª¨ë¬ ¤à¥¥¬ (Willow) |
®®ä®¨ç¥áª¨© MIDI-¯«¥¥à |
Vivat assembler et MENUETOS! |
® §¢ãª®¬ ¢ MenuetOS â㣮 ¤® á¨å ¯®à. à ©¢¥à ¯¨á ë ¤«ï ®£à ¨ç¥®£® ªà㣠|
§¢ãª®¢ëå ª àâ. ® ¥¤ ¢¥£® ¢à¥¬¥¨ MeOS ¡ë« ¤«ï ¬¥ï ¥¬ , ª ª àë¡ . ® ¯®â®¬ |
¯®ï¢¨« áì «ìâ¥à ⨢ - 㢠¦ ¥¬ë© VaStaNi ¯¨á « ¯®¤¤¥à¦ªã PC ᯨª¥à . ¥ |
áà §ã ¢á¯®¬¨«¨áì áâ àë¥ ¤®¡àë¥ ¢à¥¬¥ ᪠«ï ¨ MS-DOS. ¥â 5 § ¤ ¯¨á « |
᪠«¥ ¯à®£à ¬¬ªã, ª®â®à ï ¯ àᨫ , ¯®â®¬ ¢®á¯à®¨§¢®¤¨« áâப㠮⠢ |
á¨â ªá¨á¥ QBasic. |
¥©ç á MeOS ¢ ¤¨áâਡã⨢¥ Mario79 ®¡à¥â ¥â ¯à®á⥩èãî §¢ãª®¢ãî á奬ã á ¯®¬®éìî |
ᯨª¥à , ® ¯¥à¢ãî ¬¥«®¤¨î ¢ Menuet ï ãá«ëè « ¢á¥-â ª¨ ®â ᢮¥© ¯à®£à ¬¬ë - |
MIDAMP ¢ ¤¥ª ¡à¥ 2004 £®¤ . ® â¥å¨ç¥áª¨¬ ¯à¨ç¨ ¬ ¥¥ ५¨§ ¯à®¨á室¨â ⮫쪮 |
ᥩç á. |
â ª, MIDAMP - ¯à®á⥩訩 ®¤®£®«®áë© MIDI-¯à®¨£àë¢ â¥«ì. ¥ ¯à¥â¥¤ã¥â |
¬®£®¥, å®âì ¨ ¯®å®¦ WinAmp. á¥, çâ® ® 㬥¥â, íâ® ¯¨«¨ª âì MIDI-ä ©«ë. |
ª¢ « ©§¥à , ¡ « á ¨ ॣã«ïâ®à £à®¬ª®á⨠¥â ¨ ¥ ¯à¥¤¢¨¤¨âáï. ®«¥¥ ⮣®, |
ª®à४⮥ §¢ãç ¨¥ ¬®£ã £ à â¨à®¢ âì «¨èì ¤«ï ä ©«®¢ á 1 â४®¬, 1 ª «®¬ |
¨áâà㬥⠨ ¢ ¯à¥¤¥« å â¥å®«®£¨ç¥áª®£® ¤¨ ¯ §® ®â :-( |
######### |
¨áâ¥¬ë¥ âॡ®¢ ¨ï: |
1. ¤à® á ॠ«¨§ 樥© á«¥¤ãîé¨å á¨á⥬ëå äãªæ¨©: |
55/55 - ¨â¥à䥩á PC ᯨª¥à (¥®¡å®¤¨¬®!); |
67 - ᢮à 稢 ¨¥ ®ª ¢ § £®«®¢®ª; |
66/3 - ¤«ï ०¨¬®¢ ¢ë¤¥«¥¨ï â४®¢ ¬ëèìî. |
2. SYSXTREE ¢¥àᨨ ¥ ¨¦¥ 52 - ®âªàë⨥ ä ©«®¢ ¨ ª â «®£®¢ (¥®¡å®¤¨¬®!) |
3. ¡ê¥¬ ¯ ¬ï⨠¤«ï ¯à®£à ¬¬ë - ®ª®«® 150 ¡. |
######### |
®ª çâ® MIDAMP ¨á¯®«ì§ã¥â ¥¤¨áâ¢¥ë© ¯«¥©«¨áâ - ¯® 㬮«ç ¨î |
/HD/1/PLAYLIST.TXT. ¥« î騥 ¬®£ãâ ¨§¬¥¨âì § 票¥ ª®áâ âë PLAYLIST_PATH ¢ |
ä ©«¥ MIDAMP.ASM. «¥©«¨áâ - ®¡ëçë© â¥ªáâ®¢ë© ä ©«, ¢ ª ¦¤®© áâப¥ ª®â®à®£® |
室¨âáï ¨¬ï ä ©« ¤«ï ¢®á¯à®¨§¢¥¤¥¨ï. £® ¯à ¢¨âì ¢àãçãî - |
¢®§¬®¦ë ¡ £¨ ¯à¨ ¯®á«¥¤ãî饩 § £à㧪¥ ¥£® ¯à¨«®¦¥¨¥¬. |
ਠ§ ¯ã᪥ MIDAMP ᮧ¤ ¥â ®¢ë© ¯®â®ª, § ¤ 祩 ª®â®à®£® ï¥âáï ᮡá⢥® |
®§¢ãçª . à ¨å ¢¥àá¨ïå ¢á¥ ¤¥« « £« ¢ë© ¯®â®ª, ¯®í⮬㠢®§¨ª «¨ ¥¯à¨ïâë¥ |
§ ¤¥à¦ª¨ ¢ §¢ãç ¨¨ ¢® ¢à¥¬ï ã¯à ¢«¥¨ï ¯«¥©«¨á⮬. ®â®ª¨ ¨â¥á¨¢® ®¡é îâáï |
¬¥¦¤ã ᮡ®© ç¥à¥§ IPC, å®âï ï ᪫®ïîáì ª ⮬ã, çâ® ¢ ¤ ®¬ á«ãç ¥ íâ® |
¨§«¨è¥á⢮. ® à ¡®â ¥â ¥¯«®å®. |
MIDAMP 㬥¥â ᢮à 稢 âìáï ¢ áâப㠧 £®«®¢ª ¦ ⨥¬ ᮮ⢥âáâ¢ãî饩 ª®¯ª¨. |
¯ëâ «áï ᤥ« âì ¯®«®¥ ᢮à 稢 ¨¥ ç¥à¥§ mcall 18,10 (®¢ ï ä¨ç Kolibri4), |
® á⮫ªã«áï á ¯à®¡«¥¬®© ¢®ááâ ®¢«¥¨ï ®ª ¦ ⨥¬ ª®¯ª¨ PANEL. ®§¬®¦®, |
äãªæ¨ï ¥ ¯®¤¤¥à¦¨¢ ¥â ®ª ⨯ II ? |
®àï稥 ª« ¢¨è¨ - ¯®ç⨠ª ª ¢ WinAmp: |
Del - 㤠«¨âì ¢ë¤¥«¥ë¥ â४¨; |
z - ¯à¥¤ë¤ã騩 â४; |
x, Enter, ¤¢®©®© 饫箪 ä ©«¥ - ¢®á¯à®¨§¢¥¤¥¨¥; |
c, Space - ¯ 㧠; |
v - á⮯; |
b - á«¥¤ãî騩 â४; |
Esc - § ªàëâì ¯à®£à ¬¬ã; |
m - ¢ª«îç¨âì/¢ëª«îç¨âì §¢ãª; |
PgUp, PgDn - ¯®¬¥ïâì ¬¥áâ ¬¨ 2 á®á¥¤¨å â४ (¥ § ª®ç¥®!); |
BackSpace - ¯¥à¥¬®âª â४ ¢ ç «®; |
Home/End - 㢥«¨ç¨âì/㬥ìè¨âì â® «ì®áâì ¬¥«®¤¨¨ ¨ ¯à®¨£à âì ¥¥ á ç « |
(®â®¡à ¦ ¥âáï à冷¬ á ¤¯¨áìî 'tone>'). |
á«ãç ¥ ¯®«¨ä®¨ç¥áª¨å MIDI, ¥á«¨ ®á¬ëá«¥®© ¬¥«®¤¨¨ ¥ ¯®«ãç ¥âáï, ¬®¦® |
¯®¯à®¡®¢ âì ¢ë¡à âì ¤à㣮© â४ 'trk' ¨«¨ ª « ¨áâà㬥â 'chnl', ¦ ¢ |
ᮮ⢥âá⢥® '[' ¨«¨ ']' ¨ § ⥬ ª« ¢¨èã á ®¬¥à®¬ ®â 0 ¤® 9. ©« ¡ã¤¥â |
¢®á¯à®¨§¢¥¤¥ á á ¬®£® ç « . ¡à®á ¤®à®¦ª¨ ¨ ª « ¢ § 票¥ ¯® 㬮«ç ¨î - |
¦ ⨥¬ '\' . |
§ 票¥ ¥ª®â®àëå ª®¯®ª ¨â¥à䥩á : |
Shuffle - á«ãç ©ë© ¯®à冷ª ¯à®¨£àë¢ ¨ï â४®¢. Repeat - ⥪ã騩 â४ ¡ã¤¥â |
¯à®¨£àë¢ âìáï ᮢ ¨ ᮢ . 箪 ¢ «¥¢®¬ ¢¥à奬 㣫㠢뢮¤¨â ªà âªãî |
¨ä®à¬ æ¨î ® ¯à®£à ¬¬¥ ¤®áªã ®â« ¤ª¨. ¥«ç®ª ¢à¥¬¥®© ¬¥âª¥ ¬¥ï¥â |
ᯮᮡ ¥¥ ®â®¡à ¦¥¨ï - á ç « ¨«¨ á ª®æ ä ©« . |
¥«ç®ª ¬ëèìî ¯«¥©«¨áâ¥ á ¦ âë¬ Shift ¨«¨ Ctrl à ¡®â ¥â «®£¨ç® WinAmp. |
¬¥ç ¨ï ®â®á¨â¥«ì® ª®¯®ª ¢¨§ã: |
'Add URL' ¥ ॠ«¨§®¢ ® ¯® ¯®ïâë¬ ¯à¨ç¨ ¬; |
'Add Dir' - 㪠¦¨â¥ «î¡®© ä ©« ¢ ¦¥« ¥¬®¬ ª â «®£¥. ©«ë *.MID ¨ *.KAR í⮣® |
ª â «®£ ¡ã¤ãâ ¤®¡ ¢«¥ë ¢ ᯨ᮪; |
'Misc' ¯®¤¬¥î ¥ ॠ«¨§®¢ ®; |
'New List' ¨ç¥£® ¥ ¤¥« ¥â. ®ª ¨á¯®«ì§ã¥âáï 䨪á¨à®¢ ë© ¯«¥©«¨áâ. |
ª®¬ ¤®© áâப¥ ¯¥à¥¤ ¨¬¥¥¬ ä ©« ¤«ï ¢®á¯à®¨§¢¥¤¥¨ï ¬®¦¥â áâ®ïâì ®¤¨ ¨§ |
ä« £®¢: |
W - ¯à®áâ® § £à㧨âì ä ©« (¯® 㬮«ç ¨î); |
P - ¢®á¯à®¨§¢¥áâ¨ ä ©«; |
H - áâ à⮢ âì ᢥàãâë¬ ¢ § £®«®¢®ª, § ªàëâìáï ¯®á«¥ ¢®á¯à®¨§¢¥¤¥¨ï. |
â® ¥é¥ 㦮 ᤥ« âì: |
1. ¢¥«¨ç¨âì à §¬¥àë ¯«¥©«¨áâ (ᥩç á 40 ¯®§¨æ¨©). |
2. ®¡ ¢¨âì ¤¨ «®£ ¢ë¡®à â४®¢ ¯®«¨ä®¨ç¥áª¨å ¬¥«®¤¨© á ¨å «¨§®¬ ¯® |
«¨ç¨î ®â. |
3. ⥨¥ ⥪áâ ¢ ª à ®ª¥-ä ©« å. |
4. ë¡®à ¯«¥©«¨áâ . |
5. ®âë© à¥¤ ªâ®à, ª ª ¢ Ringtone Editor. |
6. ⪮¬¬¥â¨à®¢ âì ª®¤ (ª ª ¢á¥£¤ , «¥ì). |
7. á¯à ¢¨âì ¡ £¨, ª®â®àë¥, ¥á®¬¥®, ©¤ãâáï ;-) |
á®¡ë¥ ¡« £®¤ à®áâ¨: |
VaStaNi - ¡¥§ ¥£® ª®¤ ¯¨á ¨¥ MIDAMP ¥ ¨¬¥«® ¡ë á¬ëá« |
Standard MIDI Files 0.06 March 1, 1988 |
MIDI 1.0 Specification |
General MIDI Level Spec |
MIDI SAMPLE DUMP STANDARD |
Standard MIDI File Format by Dustin Caldwell |
®à¬ â ä ©«®¢ MIDI |
The USENET MIDI Primer by Bob McQueer |
¢«îè¨ã ¢£¥¨î § ¥¯à¥¢§®©¤¥ë© SYSXTREE (DLGS.INC - ¯¥à¥à ¡®â ë© á |
ãç¥â®¬ ᯥæ¨ä¨ª¨ MIDAMP'a ¬ ªà®á opendialog ¡¨¡«¨®â¥ª¨ ASCL) |
®¦¥« ¨ï ¨ á®®¡é¥¨ï ®¡ ®è¨¡ª å ¯à ¢«ï©â¥ wil_low@hotbox.ru ¨«¨ ä®à㬠|
meos.sysbin.com. |
® ®¢ëå ¢áâà¥ç! |
/programs/media/midamp/trunk/midilite.inc |
---|
0,0 → 1,292 |
SYS equ meos |
midi_parse: |
and [max_note],0 |
and [cur_track],0 |
mov [min_note],0xff |
mov edi,[midi_limit] |
cmp dword[workarea],'MThd' |
je .head_ok |
mov edx,sHeadInv |
call debug_outstr |
jmp clearpath |
.head_ok: |
cmp dword[workarea+4],0x6000000 |
je .heads_ok |
mov edx,sHSizeInv |
call debug_outstr |
jmp clearpath |
.heads_ok: |
cmp dword[workarea+8],0x1000000 |
jmp .headt_ok |
mov edx,sTypeUnsup |
call debug_outstr |
jmp clearpath |
.headt_ok: |
movzx eax,word[workarea+12] |
rol ax,8 |
mov [quarter],eax |
mov [tempo],50 |
mov esi,workarea+0xe |
skip_sections: |
lodsd |
cmp eax,'MTrk' |
je track_found |
if SYS eq meos |
; dps <'What?',13,10> |
end if |
lodsd |
add esi,eax |
cmp esi,[midi_limit] |
jbe skip_sections |
if NONCRITICAL_MSG eq 1 |
dps 'No more tracks' |
end if |
and word[edi],0 |
; ud2 |
jmp decode_end |
track_found: |
if SYS eq meos1 |
dps <13,10,'Track '> |
push esi |
sub esi,workarea |
; dpd esi |
pop esi |
end if |
lodsd |
bswap eax |
mov bl,[cur_track] |
cmp bl,[sel_track] |
je .trk_fnd |
add esi,eax |
jmp next_event.eot |
.trk_fnd: |
mov [track_len],eax |
dps 'TRK' |
next_event: |
call readvar |
; dpd eax |
add [delta],eax |
lodsw ; al -event, ah - next byte |
if SYS eq meos1 |
dph eax |
dps <' ',13,10> |
newline |
end if |
test al,0x80 ; check if a valid event |
jnz .valid_evt2 |
dec esi |
shl ax,8 |
mov al,[prev_cmd] |
jmp .valid_evt |
.valid_evt2: |
mov [prev_cmd],al |
.valid_evt: |
cmp al,0xf0 |
jne .nosysex |
dec esi |
call readvar |
add esi,eax |
jmp next_event |
.nosysex: |
cmp al,0xff |
jne .no_meta |
; meta events |
cmp ah,0x51 |
jne .notempo |
push eax edx |
mov eax,[esi] |
xor al,al |
bswap eax |
xor edx,edx |
mov ebx,10000 |
div ebx |
pop edx eax |
jmp .no_eot |
.notempo: |
cmp ah,0x2f ; end of track |
jne .no_eot |
inc esi |
if SYS eq meos1 |
dps <13,10,'EOT'> |
push esi |
sub esi,workarea |
dpd esi |
pop esi |
; mcall 5,200 |
; dph eax |
; ud2 |
end if |
.eot: |
; dps 'EOT ' |
inc [cur_track] |
jmp skip_sections;decode_end |
.no_eot: |
lodsb |
movzx ecx,al ; ecx - length of metadata |
add esi,ecx |
jmp next_event |
.no_meta: |
cmp al,0xfa ; system ctl events |
jb .no_sys |
.dec_esi: |
dec esi |
jmp next_event |
.no_sys: |
cmp al,0xf8 |
je .dec_esi |
movzx ecx,al ; ecx - MIDI Event Command |
and ecx,0xf ; cl - channel |
and al,0xf0 ; al - event code |
cmp al,0xe0 ; Pitch wheel change |
je .inc_esi |
cmp al,0xb0 |
ja .no_inc |
.inc_esi: |
inc esi |
.no_inc: |
cmp ecx,[channel] ; Channel must be 0 !!! |
jz .chan_ok |
if NONCRITICAL_MSG eq 1 |
dps 'C' ; Reference to unsupported channel !!! |
dpd ecx |
mov ecx,esi |
dps '-' |
sub ecx,workarea+1 |
dpd ecx |
end if |
jmp next_event |
.chan_ok: |
cmp al,0x90 ; Note On |
jne .no_noon |
add al,[octave] |
cmp [curnote],0x80 |
je .note_ok |
if NONCRITICAL_MSG eq 1 |
dps 'N!' ; Note On without Off !!! |
end if |
.note_ok: |
; dps 'N+' |
; movzx ecx,ah |
; dpd ecx |
call insert_pause |
mov [curnote],ah ; [curnote]=note number |
jmp next_event |
.no_noon: |
cmp al,0x80 ; Note Off |
jne .no_nooff |
add ah,[octave] |
cmp ah,[curnote] |
je .off_ok |
if NONCRITICAL_MSG eq 1 |
dps 'n!' ; Note Off mismatch !!! |
end if |
.off_ok: |
; dps 'N-' |
cmp ah,[max_note] |
jbe .nomax |
mov [max_note],ah |
.nomax: |
cmp ah,[min_note] |
jae .ins |
mov [min_note],ah |
.ins: |
call insert_note |
mov [curnote],al |
.no_nooff: ; No more supported events |
jmp next_event |
prev_cmd db ? |
max_note db ? |
min_note db ? |
; ********************************************* |
; ******* READ VARIABLE BYTES **************** |
; ********************************************* |
readvar: |
; in: esi - pointer; |
; out: esi - new pointer; eax - value; |
push ebx ecx |
movzx ebx,byte[esi] |
inc esi |
btr ebx,7 |
jnc .exit |
.next: |
shl ebx,7 |
lodsb |
mov ecx,eax |
and eax,0x7f |
add ebx,eax |
cmp cl,0x7f |
ja .next |
.exit: |
mov eax,ebx |
pop ecx ebx |
ret |
; ********************************************* |
; ******* INSERT PAUSE *********************** |
; ********************************************* |
insert_pause: |
cmp [delta],0 |
jz return |
push eax ebx ecx |
mov ah,0xff |
jmp write_note |
; ********************************************* |
; ******* INSERT NOTE ************************ |
; ********************************************* |
insert_note: ; ah - note code |
push eax ebx ecx |
movzx eax,ah |
mov ebx,12 |
div bl |
shl al,4 |
add ah,al |
sub ah,0x1f |
write_note: |
push eax |
mov eax,[delta] |
mov edx,[tempo] |
mul edx |
mov ecx,[quarter] |
div ecx ; ax - note delay |
cmp eax,0x7f |
jb .ok |
mov eax,0x7f |
.ok: |
movzx ecx,al |
or ecx,0x80 |
pop eax |
mov al,cl |
stosw |
xor eax,eax |
mov [delta],eax |
pop ecx ebx eax |
return: |
ret |
sHeadInv: |
if lang eq ru |
db "¥¢¥àë© § £®«®¢®ª",0 |
else |
db "Header invalid",0 |
end if |
sHSizeInv: |
if lang eq ru |
db '¥¢¥àë© à §¬¥à § £®«®¢ª ',0 |
else |
db 'Header size invalid',0 |
end if |
sTypeUnsup: |
if lang eq ru |
db '¨¯ MIDI ¥ ¯®¤¤¥à¦¨¢ ¥âáï',0 |
else |
db 'MIDI type not supported',0 |
end if |
/programs/media/midamp/trunk/playlist.inc |
---|
0,0 → 1,349 |
; Playlist support for MIDPLAY |
LCOLOR equ 0x00ff00 |
PCOLOR equ 0xffffff |
PL_X equ 10 shl 16 |
PL_Y equ PLY shl 16 |
PL_XY equ 10 shl 16+PLY |
PL_show: |
test [flag],FL_HIDDEN |
jnz .ex |
pusha |
and [counter],0 |
mov ebx,PL_X+255 |
mov eax,13 |
mov ecx,PL_Y-1 shl 16+4+9*LISTITEMS |
xor edx,edx |
int 0x40 |
movzx ecx,byte[list_count] |
test ecx,ecx |
jz .ex2 |
push ecx |
imul ecx,9 |
add ecx,PL_Y-1 shl 16-2 |
mov edx,11+1 shl 29+1 shl 30 |
mov eax,8 |
int 0x40 |
pop ecx |
mov edi,[pl_ptr] |
mov eax,4 |
mov ebx,PL_XY+2 shl 16 |
.sh_loop: |
movzx esi,word[edi] |
and esi,not FL_MULSEL |
add edi,2 |
pusha |
mov edx,edi |
mov ecx,[counter] |
test word[edi-2],FL_MULSEL |
jz .nosel |
pusha |
mov ebx,PL_X+255+1 shl 16-2 |
imul ecx,9 |
shl ecx,16 |
add ecx,PL_Y-1 shl 16+8 |
mov edx,0xc6 |
mov eax,13 |
int 0x40 |
popa |
.nosel: |
pusha |
mov edx,ebx |
mov esi,0xa0a0a0;0x508cec |
mcall 47,0x30000 |
popa |
cmp ecx,[play_num] |
je .high |
mov ecx,LCOLOR |
jmp .int |
.high: |
mov ecx,PCOLOR |
.int: |
add ebx,25 shl 16 |
int 0x40 |
popa |
add edi,esi |
add ebx,9 |
inc [counter] |
loop .sh_loop2 |
jmp .ex2 |
.sh_loop2: |
jmp .sh_loop |
.ex2: |
popa |
test [flag],FL_BOTTRED |
jz .nobott |
pusha |
mcall 7,hdr_raw+12+275*16*3,<275,12>,<10,(WND_HEIGHT-20)> |
mov ebp,main_coo2 |
mov esi,10 shl 16 |
mov edi,(WND_HEIGHT-22)shl 16 |
mov ecx,1 |
pushd 155 shl 16+5 |
pushd (WND_HEIGHT-22) shl 16+5 |
call draw_navigation |
add esp,8 |
popa |
call draw_bottom |
and [flag],not FL_BOTTRED |
.nobott: |
.ex: |
ret |
PL_add: |
; in: esi->filename,ecx->fname_len |
jecxz .ex |
cmp [list_count],LISTITEMS |
jae .ex |
pusha |
mov edi,[play_limit] |
mov [edi],cx |
add edi,2 |
rep movsb |
mov [play_limit],edi |
inc [list_count] |
popa |
.ex: |
ret |
PL_del: |
movzx ecx,byte[list_count] |
jecxz .ex |
call PL_get1stsel |
mov edx,ebx |
.lp: |
mov edi,esi |
xor eax,eax |
lodsw |
btr eax,15 |
jc .elp2 |
add esi,eax |
jmp .elp |
.elp2: |
push esi ecx |
add esi,eax |
mov ecx,[play_limit] |
sub ecx,esi |
rep movsb |
mov [play_limit],edi |
dec [list_count] |
cmp edx,[play_num] |
ja .no |
dec [play_num] |
.no: |
pop ecx esi |
sub esi,2 |
.elp: |
inc edx |
loop .lp |
.ex: |
ret |
PL_getitemclick: |
; out: eax- item # (0..n) |
mov ebx,1 |
mov eax,37 |
int 0x40 |
sub eax,PLY-1 |
mov ebx,9 |
div bl |
movzx eax,al |
ret |
PL_getbyindex: |
; in:eax-index, out: esi-filename, ecx-length |
mov esi,[pl_ptr] |
mov ecx,eax |
.loop: |
lodsw |
and eax,not FL_MULSEL |
jecxz .gbi |
add esi,eax |
dec ecx |
jmp .loop |
.gbi: |
movzx ecx,ax |
ret |
PL_get1stsel: |
; out: esi- 1st selected, ebx - index |
mov esi,[pl_ptr] |
xor ebx,ebx |
PL_getnextsel: |
push eax ecx |
movzx ecx,[list_count] |
.lp: |
movzx eax,word[esi] |
btr eax,15 |
jc .ex2 |
lea esi,[esi+eax+2] |
inc ebx |
loop .lp |
xor ebx,ebx |
.ex2: |
pop ecx |
.ex: |
pop eax |
ret |
PL_clearsel: |
pusha |
mov ebx,not FL_MULSEL |
xor eax,eax |
mov esi,[pl_ptr] |
movzx ecx,[list_count] |
jecxz .flg |
.loop: |
and word[esi],bx |
lodsw |
add esi,eax |
loop .loop |
.flg: |
and [flag],not FL_MULSEL |
popa |
ret |
PL_shiftsel: |
pusha |
xor eax,eax |
; mov esi,[pl_ptr] |
; movzx ecx,[list_count] |
.loop: |
lodsw |
or word[esi-2],FL_MULSEL |
add esi,eax |
loop .loop |
jmp PL_clearsel.flg |
PL_invsel: |
pusha |
mov ebx,not FL_MULSEL |
xor eax,eax |
mov esi,[pl_ptr] |
movzx ecx,[list_count] |
jecxz .ex |
.loop: |
xor word[esi],FL_MULSEL |
lodsw |
and eax,ebx |
add esi,eax |
loop .loop |
.ex: |
jmp PL_clearsel.flg |
PL_load: |
and [list_count],0 |
mov [pl_ptr],playlist |
mov ebx,PL_info |
mov dword[ebx+12],playlist |
mov eax,58 |
int 0x40 |
test eax,eax |
jz .ok1 ; ebx- filesize |
cmp eax,6 |
jne .ex |
.ok1: |
mov eax,0x0a0d |
cmp word[playlist],ax |
je .ok |
sub [pl_ptr],2 |
.ok: |
mov edi,[pl_ptr] |
add ebx,edi |
mov word[ebx],ax |
add edi,2 |
.loo: |
mov edx,edi |
.loo2: |
mov ecx,256 |
repne scasb |
cmp edi,ebx |
jb .ok2 |
lea edi,[ebx+1] |
.ok2: |
mov ecx,edi |
sub ecx,edx |
dec ecx |
inc edi |
jecxz .shift |
mov [edx-2],cx |
inc [list_count] |
cmp edi,ebx |
jb .loo |
.ex1: |
sub ebx,2 |
mov [play_limit],ebx |
.ex: |
ret |
.shift: |
mov ecx,ebx |
sub ecx,edi |
jecxz .ex1 |
sub ebx,2 |
mov esi,edi |
sub edi,2 |
push edi |
rep movsb |
pop edi |
jmp .loo |
PL_save: |
movzx ecx,byte[list_count] |
jecxz .ex |
mov eax,0x0a0d |
mov edi,[pl_ptr] |
lea edx,[edi+2] |
mov [PL_info+12],edx |
.savl: |
movzx ebx,word[edi] |
and bx,not FL_MULSEL |
stosw |
add edi,ebx |
loop .savl |
stosw |
sub edi,[pl_ptr] |
mov ebx,PL_info |
mov [ebx+8],edi |
mov dword[ebx],1 |
mov eax,58 |
int 0x40 |
.ex: |
ret |
PL_swap: ; swap [ebx] with [ebx+1] |
mov eax,ebx |
call PL_getbyindex |
add ecx,2 |
sub esi,2 |
push ecx esi ; save begin & length of 1st fname |
mov edi,fnbuf |
rep movsb |
movzx ecx,word[esi] |
and cx,not FL_MULSEL |
add ecx,2 |
pop edi |
rep movsb |
pop ecx |
mov esi,fnbuf |
rep movsb |
cmp ebx,[play_num] |
jne .nosel1 |
inc [play_num] |
ret |
.nosel1: |
inc ebx |
cmp ebx,[play_num] |
jne .nosel2 |
dec [play_num] |
.nosel2: |
ret |
PL_info: |
.mode dd 0 |
dd 0 |
.bytes dd 20 |
dd 0 |
dd hash_table |
db PLAYLIST_PATH,0 |
/programs/media/midamp/trunk/playlist.txt |
---|
0,0 → 1,30 |
/HD/1/MIDI2/MID/CALIFOR .MID |
/HD/1/MIDI2/ZNAYU .MID |
/HD/1/MIDI2/MID/WILD_D~1.MID |
/HD/1/MIDI/FILES/JACKSON .MID |
/HD/1/MIDI/FILES/MOZART .MID |
/HD/1/MIDI2/MID/FAVGAME .MID |
/HD/1/MIDI/PETERB .MID |
/HD/1/MIDI/KVN .MID |
/HD/1/MIDI2/911 .MID |
/HD/1/MIDI2/HYMN .MID |
/HD/1/MIDI2/GEIGU .MID |
/HD/1/MIDI2/MID/COMEAS .MID |
/HD/1/MIDI/FILES/SAINTS .MID |
/HD/1/MIDI/FILES/SNOW .MID |
/HD/1/MIDI/FILES/90210 .MID |
/HD/1/MIDI/FILES/AMAZING .MID |
/HD/1/MIDI/FILES/99LUFT~1.MID |
/HD/1/MIDI/FILES/EUROPE .MID |
/HD/1/MIDI/FILES/VANESSA .MID |
/HD/1/MIDI/FILES/SPICE .MID |
/HD/1/MIDI/FILES/NIEMAL~1.MID |
/HD/1/MIDI/FILES/SMS .MID |
/HD/1/MIDI/FILES/PRIMA .MID |
/HD/1/MIDI/FILES/POPCORN .MID |
/HD/1/MIDI/FILES/POLKKA .MID |
/HD/1/MIDI/FILES/SW_FINAL.MID |
/HD/1/MIDI/FILES/MAJORT~1.MID |
/HD/1/MIDI/FILES/7DAYS .MID |
/HD/1/MIDI/FILES/AADAMS .MID |
/programs/media/midamp/trunk/playnote.txt |
---|
0,0 → 1,293 |
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
* * |
* Copyright 2003 VaStaNi * |
* vastani@ukr.net * |
* >>>- SIMPLY - QUICKLY - SHORTLY -<<< * |
* * |
* About Player Notes for Speaker PC. * |
* ( PLAYNOTE.INC v.1.1 for MENUET OS ) * |
* * |
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
--- ATTACH --- |
>>> Insert string: include "PLAYNOTE.INC" in list file KERNEL32.INC |
......... |
......... ......... ............................. |
......... ......... ............................. |
......... ......... ............................. |
; sound |
include "SB16.INC" ; playback for Sound Blaster 16 |
include "PLAYNOTE.INC" ; player Note for Speaker PC |
......... |
......... ......... ............................. |
......... ......... ............................. |
>>> Insert line --->>> call playNote --->>> in procedure irq0 |
( listing file SYS32.INC for KERNEL.ASM ) |
.... .... |
.... .... |
.... .... |
no_error_in_previous_process: |
mov edi,[0x3000] |
imul edi,8 |
mov [edi+gdts+ tss0 +5], word 01010000b *256 +11101001b |
inc dword [0xfdf0] |
mov eax,[0xfdf0] |
call playNote ; <<<--- INSERT THIS LINE !!!!!!!!!! |
cmp eax,[next_usage_update] |
jb nocounter |
add eax,100 |
mov [next_usage_update],eax |
call updatecputimes |
nocounter: |
.... .... |
.... .... |
.... .... |
>>> file SB16.INC have this label... |
.... .... |
.... .... |
.... .... |
no_SB16_data_format: |
ret |
>>> I suggest add this code for subfunction #55 function #55 OS (player notes) |
.... .... |
.... .... |
.... .... |
no_SB16_data_format: |
cmp eax, edi ; this is subfunction #55 ? |
jne retFunc55 ; if no then return. |
movzx eax, byte [countDelayNote] |
or al, al ; player is busy ? |
jnz retFunc55 ; return counter delay Note |
mov eax, [0x3010] |
mov eax, [eax+0x10] ; address application im memory |
add eax, edx ; add offset Delay-Note string |
mov [memAdrNote], eax |
xor eax, eax ; Ok! EAX = 0 |
retFunc55: |
mov [esp+36], eax ; return value EAX for application |
ret |
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
--- USE --- |
>>> Example use in your programs: |
.... .... |
.... .... |
.... .... |
mov eax, 55 ; OS function #55 |
mov ebx, eax ; EBX = 55 for subfunction Play Note |
mov esi, MyMusic_1 ; ESI = head string Delay-Note code |
int 0x40 ; start play |
.... .... |
.... .... |
.... .... |
>>> Very simply OS use. Only put dword adress head string in [memAdrNote] |
.... .... |
mov [memAdrNote], dword MyMusic_1 ; IRQ0 -> start play!!! |
.... .... |
!!! Example OS use for send: error tone, ring signal, disconnect hardware... |
!!! Saund Card may be OFF, but Speaker PC always IS ON !!! |
..... .. .. |
..... .. .. |
MyMusic_1 db .., .., .., .., .., 0 ; string Delay-Note code for MUSIC |
... .. .. |
...... .. .. |
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
--- CODE DELAY & NOTEs --- |
>>> Format Delay-Note string: |
1. Free style play Tone |
db 1..0x80 ; !!! only (1..0x80) byte for Delay Tone |
db 1..0xFF ; lower byte (counter for period oscillate) |
db 1..0xFF ; upper byte (counter for period oscillate) |
.. .. \ |
.. .. > 3 bytes for 1 TONE !!! |
.. .. / |
db 0 ; THE END Play! |
2. Musical style play Note |
db 0x81..0xFE ; !!! 0x80 + byte (1..0x7E) for Delay Note |
db 1..0xFF ; PACK CODE (number Note & number Octave) |
.. .. \ |
.. .. / 2 bytes for 1 Note in 1 Octave !!! |
db 0 ; THE END Play! |
-= DELAY CODE =- |
ÚÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÉÍÍ 1 Í»ÉÍÍ 2 Í» |
³¤«¨â¥«ì®á⨳ DELAY NOTE ³ DELAY º DELAY ºº DELAY º |
³ ³ mSec ³ IRQ 0 º CODE ºº CODE º |
ÃÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÌÍÍÍÍÍÍÍ͹ÌÍÍÍÍÍÍÍ͹ |
³ 楫 ï ³ 2000 ³ º 0xC8 ºº absent º |
ÃÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄ´ ÇÄÄÄÄÄÄÄĶÇÄÄÄÄÄÄÄĶ |
³ 1/2 ³ 1000 ³ º 0x64 ºº 0xE4 º |
ÃÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄ´ ÇÄÄÄÄÄÄÄĶÇÄÄÄÄÄÄÄĶ |
³ 1/4 ³ 500 ³ º 0x32 ºº 0xB2 º |
ÃÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄ´ 10 ºÄÄÄÄÄÄÄĶºÄÄÄÄÄÄÄĶ |
³ 1/8 ³ 250 ³ mSec º 0x19 ºº 0x99 º |
ÃÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄ´ ÇÄÄÄÄÄÄÄĶÇÄÄÄÄÄÄÄĶ |
³ 1/16 ³ 125 ³ º 0xC ºº 0x8C º |
ÃÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄ´ ºÄÄÄÄÄÄÄĶºÄÄÄÄÄÄÄĶ |
³ 1/32 ³ 62.5 ³ º 6 ºº 0x86 º |
ÃÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄ´ ÇÄÄÄÄÄÄÄĶÇÄÄÄÄÄÄÄĶ |
³ 1/64 ³ 31.25 ³ º 3 ºº 0x83 º |
ÀÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÈÍÍÍÍÍÍÍͼÈÍÍÍÍÍÍÍͼ |
-= PACK CODE =- |
!!!!! IF PACK CODE = 0xFF THEN PAUSE = DELAY CODE !!!!! |
ÚÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÉÍÍÍÍÍÍÍÍÍÍ» ÚÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÂÄÄÄÄÄÄÉÍÍÍÍÍÍÍÍÍÍ» |
³ ³number³ code ºupper CODEº ³ ³type³numberºlower CODEº |
³ ³OCTAVE³numberºBit7..Bit4º ³ ³NOTE³ NOTE ºBit3..Bit0º |
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÌÍÍÍÍÍÍÍÍÍ͹ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄÌÍÍÍÍÍÍÍÍÍ͹ |
³ª®âப⠢ ³ -3 ³ 0 º 0000 º ³ ³ C ³ 1 º 0001 º |
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÌÄÄÄÄÄÄÄÄÄĶ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ |
³ ¡®«ìè ï ³ -2 ³ 1 º 0001 º ³ ¡¥¬®«ì ³ C# ³ 2 º 0010 º |
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÇÄÄÄÄÄÄÄÄÄĶ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ |
³ ¬ « ï ³ -1 ³ 2 º 0010 º ³ ³ D ³ 3 º 0011 º |
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄĺÄÄÄÄÄÄÄÄÄĶ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ |
³ ¯¥à¢ ï ³ 1 ³ 3 º 0011 º ³ ¡¥¬®«ì ³ D# ³ 4 º 0100 º |
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÇÄÄÄÄÄÄÄÄÄĶ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ |
³ ¢â®à ï ³ 2 ³ 4 º 0100 º ³ ³ E ³ 5 º 0101 º |
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄĺÄÄÄÄÄÄÄÄÄĶ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ |
³ âà¥âìï ³ 3 ³ 5 º 0101 º ³ ³ F ³ 6 º 0110 º |
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÇÄÄÄÄÄÄÄÄÄĶ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ |
³ ç¥â¢¥àâ ï ³ 4 ³ 6 º 0110 º ³ ¡¥¬®«ì ³ F# ³ 7 º 0111 º |
ÀÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÈÍÍÍÍÍÍÍÍÍͼ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ |
³ ³ G ³ 8 º 1000 º |
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ |
³ ¡¥¬®«ì³ G# ³ 9 º 1001 º |
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ |
³ ³ A ³ 10 º 1010 º |
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ |
³ ¡¥¬®«ì ³ A# ³ 11 º 1011 º |
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ |
³ ³ B ³ 12 º 1100 º |
ÀÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÁÄÄÄÄÄÄÈÍÍÍÍÍÍÍÍÍͼ |
PACK CODE = (number Note) AND ((code number Octave) SHL 4) |
or |
PACK CODE = (number Note) AND ((code number Octave) * 16) |
-= PERIOD OSCILLATE =- |
counter = 1193180 / FREQUENCY; |
(WORD) (sound Hz) |
ÚÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÂÄÄÄÄÄÄÉÍÍÍÍÍÍÍÍÍ ÍÍÍÍÍÍ» |
³ ³number³ code ³ ³type³numberºfrequency PACK º |
³ ³OCTAVE³number³ 1© ³NOTE³ NOTE ºsound Hz CODE º |
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄÌÍÍÍÍÍÍÍÍÍ ÍÍÍÍÍ͹ |
³ ³ ³ ³ ³ C ³ 1 º 523,251 -- 0x31 º |
³ ³ ³ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ | ÄÄÄÄÄĶ |
³ ³ ³ ³ ¡¥¬®«ì ³ C# ³ 2 º 554,365 --|-- 0x32 º |
³ ³ ³ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ | | ÄÄÄÄÄĶ |
³ ³ ³ ³ ³ D ³ 3 º 587,33 | | 0x33 º |
³ ³ ³ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ | | ÄÄÄÄÄĶ |
³ ³ ³ ³ ¡¥¬®«ì ³ D# ³ 4 º 622,254 | | 0x34 º |
³ ³ ³ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ | | ÄÄÄÄÄĶ |
³ ³ ³ ³ ³ E ³ 5 º 659,255 | | 0x35 º |
³ ³ ³ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ | | ÄÄÄÄÄĶ |
³ ³ ³ ³ ³ F ³ 6 º 698,456 | | 0x36 º |
³ ¯¥à¢ ï ³ 1 ³ 3 ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ | | ÄÄÄÄÄĶ |
³ ( first ³ ³ ³ ¡¥¬®«ì ³ F# ³ 7 º 739,989 | | 0x37 º |
³ octave ) ³ ³ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ | | ÄÄÄÄÄĶ |
³ ³ ³ ³ ³ G ³ 8 º 783,991 0x38 º |
³ ³ ³ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ x 2 ÄÄÄÄÄĶ |
³ ³ ³ ³ ¡¥¬®«ì³ G# ³ 9 º 830,609 0x39 º |
³ ³ ³ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ | | ÄÄÄÄÄĶ |
³ ³ ³ ³ ³ A ³ 10 º 880 | | 0x3A º |
³ ³ ³ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ | | ÄÄÄÄÄĶ |
³ ³ ³ ³ ¡¥¬®«ì ³ A# ³ 11 º 932,328 | | 0x3B º |
³ ³ ³ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ | | ÄÄÄÄÄĶ |
³ ³ ³ ³ ³ B ³ 12 º 987,767 | | 0x3C º |
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄÌÍÍÍÍÍÍÍÍÍ | | ÍÍÍÍÍ͹ |
³ ¢â®à ï ³ 2 ³ 4 ³ ³ ³ 1 º1046,502 <- | 0x41 º |
...... .. .. ... .. .. .... ... <---- |
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
--- EXAMPLE MUSIC --- |
ਬ¥à ¬ã§¨æ¨à®¢ ¨ï ¯® ®â ¬ ¬¥«®¤¨¨ . à¥«îª "®à¨â ®ç £..." |
ª 䨫ì¬ã " ¤¨â᪨© ¥â¥à¡ãà£" |
MyMusic_1: |
db 0xe4,0x35, 0x99,0x33, 0x99,0x31, 0x99,0x33, 0xe4,0x35, 0x99,0x35, 0x99,0x36 |
db 0x99,0x38, 0x99,0x3a, 0xe4,0x36, 0xe4,0x36, 0xb2,0xff, 0xe4,0x33, 0x99,0x31 |
db 0x99,0x2c, 0x99,0x31, 0xe4,0x33, 0xb2,0x33, 0x99,0x35, 0x99,0x36, 0xe4,0x35 |
db 0xe4,0x35, 0xb2,0xff, 0x99,0x35, 0x99,0x36, 0xe4,0x33, 0x99,0x35, 0x99,0x36 |
db 0xb2,0x33, 0x99,0x35, 0x99,0x36, 0xb2,0x33, 0x99,0x35, 0x99,0x36, 0xe4,0x39 |
db 0xe4,0x39, 0xb2,0xff, 0x99,0x35, 0x99,0x36, 0xe4,0x33, 0x99,0x35, 0x99,0x36 |
db 0xb2,0x33, 0x99,0x35, 0x99,0x36, 0xb2,0x33, 0x99,0x35, 0x99,0x36, 0xe4,0x35 |
db 0xe4,0x35, 0 |
MyMusic_2: |
db 0x90,0x31, 0x90,0x33, 0x90,0x35, 0x90,0x36, 0xA0,0xFF, 0xA0,0x06, 0x90,0xFF |
db 0xA0,0x06, 0x90,0xFF, 0x90,0x33, 0x90,0x35, 0x90,0x37, 0x90,0x38, 0xA0,0xFF |
db 0xA0,0x18, 0x90,0xFF, 0xA0,0x18, 0x90,0xFF, 0x90,0x33, 0x90,0x35, 0x90,0x37 |
db 0x90,0x38, 0xA0,0xFF, 0x90,0x33, 0x90,0x35, 0x90,0x37, 0x90,0x38, 0xA0,0xFF |
db 0x90,0x31, 0x90,0x33, 0x90,0x35, 0x90,0x36, 0xA0,0xFF, 0xA0,0x16, 0x90,0xFF |
db 0xA0,0x16, 0 |
MyMusic_3: |
db 0x99,0x31, 0xB2,0x36, 0x99,0x3A, 0xB2,0x36, 0x99,0x33, 0xB2,0x28, 0xBC,0x38 |
db 0 |
<<<<<<< >>>>>>> |
|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> !GOOD LUCK! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<| |
<<<<<<< >>>>>>> |
/programs/media/midamp/trunk/thread.inc |
---|
0,0 → 1,121 |
new_thread: |
mov ecx,ipcarea2 |
call init_ipc |
mcall 40,1000000b |
tstill: |
mov dword[ipcarea2],0 |
mov dword[ipcarea2+4],8 |
mcall 10 |
.prc: |
cmp eax,7 |
jne tstill |
and [flag],not FL_PLAY |
mov eax,dword[ipcarea2+8] |
cmp eax,[parentPID] |
jne tstill |
cmp byte[ipcarea2+16],IPC_PLAY |
je .play_next |
cmp byte[ipcarea2+16],IPC_TRIG |
jne tstill |
.play_next: |
or [flag],FL_PLAY |
mov edi,[cur_ptr] |
movzx eax,word[edi] |
mov [play_area],ax |
add [cur_ptr],2 |
if SOUND eq ON |
test [flag],FL_MUTE |
jnz .nosound |
mov esi,play_area |
mov eax,55 |
mov ebx,eax |
int 0x40 |
.nosound: |
end if |
movzx ebx,byte[play_area] |
and ebx,0x7f |
add [cur_tick],ebx |
mov eax,23 |
int 0x40 |
cmp word[edi],0 |
jne .checkevt |
mov eax,IPC_NEXT |
call ipc_send |
jmp tstill |
.checkevt: |
test eax,eax |
jz .upd |
cmp eax,7 |
jne tstill |
cmp byte[ipcarea2+16],IPC_PLAY |
jne tstill |
.upd: |
mov eax,IPC_UPDT |
call ipc_send |
jmp .play_next |
respawn: |
mcall 9,prcinfo,-1 |
mov ecx,eax |
xor edx,edx |
xor esi,esi |
.nxt: |
mcall 9 |
cmp dx,[ebx+4] |
jae .less |
mov dx,[ebx+4] |
mov esi,[ebx+30] |
.less: |
loop .nxt |
push esi |
mcall 51,1,new_thread,APP_MEM |
pop edx |
cmp edx,[childPID] |
jne .nochild |
mov edx,[parentPID] |
.nochild: |
mov [childPID],eax |
call prc_find |
mcall 18,3 |
ret |
kill: |
mov edx,[childPID] |
call prc_find |
mcall 18,2 |
.nothread: |
ret |
prc_find: ;in: edx-PID, out: ecx-number |
mcall 9,prcinfo,-1 |
mov ecx,eax |
.nxt: |
mcall 9 |
cmp edx,[ebx+30] |
je .found |
loop .nxt |
.found: |
ret |
init_ipc: |
mcall 60,1,,20 |
ret |
ipc_send: ;eax-msg |
test [flag],FL_LOCK |
jnz .noipc |
pusha |
mov [ipcmsg],al |
mov ebx,ipcarea2 |
mov ecx,childPID |
cmp eax,0xb0 |
jb .noparent |
add ecx,4 |
sub ebx,20 |
.noparent: |
mov dword[ebx],0 |
mov dword[ebx+4],8 |
mcall 60,2,[ecx],ipcmsg,1 |
popa |
.noipc: |
ret |