Дата: Воскресенье, 24.06.2012, 16:13 | Сообщение # 1
Постоянный
Зарегистрирован: 19.12.2009
Группа: Модераторы
Сообщений: 182
Статус: Offline
Code
; MINI_DS1.ASM ; ------------ ; A pure FASM no-linker example without macros ; and standard includes. Only for real coders <img src="http://s5.ucoz.net/sm/23/wink.gif" border="0" align="absmiddle" alt="wink" />
; Optimization: ; This header file is suitable for mini.xm track only! ; If you change the track, update the optimization header. ; (Use the standard eff.inc file for a general purpose player app.) include 'mini.eff.inc'
; Wave format descriptor used to configure the DirectSound buffer pcm dd 20001h ; wFormatTag <= WAVE_FORMAT_PCM, nChannels <= 2 dd UF_FREQ dd UF_FREQ*4 dd 100004h ; wBitsPerSample <= 16, nBlockAlign <= 4 dd 0 ; cbSize <= 0 (no extra info)
MsgCaption db '[FASM].XM',0 MsgBoxText db 'uFMOD ruleZ!',0
start: mov esi,lpDS xor ebx,ebx
; Request an instance of IDirectSound push ebx ; pUnkOuter <= 0 push esi ; ppDS push ebx ; lpcGuidDevice <= 0 call [DirectSoundCreate] test eax,eax js ds_error
; It is important to set the cooperative level to at least ; DSSCL_PRIORITY prior to creating 16-bit stereo buffers. push 2 ; DSSCL_PRIORITY call [GetForegroundWindow] push eax ; hWnd mov eax,[esi] mov ecx,[eax] push eax ; this call DWORD [ecx + 24] ; IDirectSound::SetCooperativeLevel test eax,eax js ds_error
kernel32_name db 'KERNEL32.DLL',0 align 2 _ExitProcess dw 0 db 'ExitProcess',0 align 2 _WaitForSingleObject dw 0 db 'WaitForSingleObject',0 align 2 _CloseHandle dw 0 db 'CloseHandle',0 align 2 _CreateThread dw 0 db 'CreateThread',0 align 2 _SetThreadPriority dw 0 db 'SetThreadPriority',0 align 2 _HeapAlloc dw 0 db 'HeapAlloc',0 align 2 _HeapCreate dw 0 db 'HeapCreate',0 align 2 _HeapDestroy dw 0 db 'HeapDestroy',0 align 2 _Sleep dw 0 db 'Sleep',0 align 2 _CreateFile dw 0 db 'CreateFile' if UF_UFS eq ANSI dw 'A' else dw 'W' end if align 2 _ReadFile dw 0 db 'ReadFile',0 align 2 _SetFilePointer dw 0 db 'SetFilePointer',0 align 2 _FindResource dw 0 db 'FindResourceA',0 align 2 _LoadResource dw 0 db 'LoadResource',0 align 2 _SizeofResource dw 0 db 'SizeofResource',0 align 2 user32_name db 'USER32.DLL',0 align 2 _MessageBox dw 0 db 'MessageBoxA',0 align 2 _GetForegroundWindow dw 0 db 'GetForegroundWindow',0 align 2 dsound_name db 'DSOUND.DLL',0
; Include the whole uFMOD sources here. (Right after ; your main code to avoid naming conflicts, but stil ; inside your code section.) macro PUBLIC symbol {} ; hide all publics macro thnk nm { nm equ [nm] } include '..\..\..\..\ufmodlib\src\fasm.asm'