Hello everyone. As this is my first message on the boards, I want to warn you: I am a total coding and assembly noob. I am willing to learn, however, and I figured a good way of gaining knowledge is trying things for myself and asking around. This will probably be one of many noob questions, but since an assembly langiage messageboard if surely full of people who know this and that about this stuff, I hope answering me won't be a bother.

So what is my problem? I downloaded and installed MASM32 and wanted to play around with uFMOD. I downloaded the uFMOD package containing the example files, also those for MASM32. I was interested in either the DirectX version, or the WinMM one.

Basically all I wanted to do is exchange the default tune the program plays, but I have no idea how. The code for DirectX version is:


; Setup actual sampling rate in Hz. (48KHz is the default value.)
uFMOD_MixRate EQU 48000

.386
.model flat,stdcall

; Win32 API
proto_stdcall_arg0 typedef PROTO
proto_stdcall_arg1 typedef PROTO :DWORD
proto_stdcall_arg3 typedef PROTO :DWORD,:DWORD,:DWORD
proto_stdcall_arg4 typedef PROTO :DWORD,:DWORD,:DWORD,:DWORD
externdef _imp__ExitProcess@4:PTR proto_stdcall_arg1
ExitProcess equ <_imp__ExitProcess@4>
externdef _imp__MessageBoxA@16:PTR proto_stdcall_arg4
MessageBox equ <_imp__MessageBoxA@16>
externdef _imp__GetForegroundWindow@0:PTR proto_stdcall_arg0
GetForegroundWindow equ <_imp__GetForegroundWindow@0>
externdef _imp__DirectSoundCreate@12:PTR proto_stdcall_arg3
DirectSoundCreate equ <_imp__DirectSoundCreate@12>
includelib kernel32.lib
includelib user32.lib
includelib dsound.lib

; uFMOD (DirectX)
include dsufmod.inc

.DATA

; Let's place the stream right inside the data section.
xm_length EQU 905
xm LABEL BYTE
xm_unused_000 LABEL BYTE

; *** The following 60 bytes are not used and
; *** we'll substitute them with useful data
; (the actual size and location of such gaps
; may be found out using the Eff utility)

; Wave format descriptor used to configure the DirectSound buffer
pcm dd 20001h          ; wFormatTag <= WAVE_FORMAT_PCM, nChannels <= 2
dd uFMOD_MixRate
dd uFMOD_MixRate*4
dd 100004h         ; wBitsPerSample <= 16, nBlockAlign <= 4
dd 0               ; cbSize <= 0 (no extra info)

; DirectSound buffer descriptor
bufDesc dd 20 ; DSBUFFERDESC1
         ; (for older DirectX versions compatibility)
dd 14000h ; dwFlags <= DSBCAPS_STICKYFOCUS OR DSBCAPS_GETCURRENTPOSITION2
dd uFMOD_BUFFER_SIZE ; dwBufferBytes
dd 0
dd pcm    ; lpwfxFormat

lpDS    dd 0 ; -> IDirectSound
lpDSBuf dd 0 ; -> IDirectSoundBuffer

; Error message
szError db "DirectSound",0

org xm_unused_000 + 60
db 034h,000h,000h,000h,020h,000h,000h,000h,002h,000h,00Dh,000h,001h,000h,001h,000h
db 00Ah,000h,091h,000h,000h,001h,002h,003h,004h,005h,006h,007h,000h,001h,002h,003h
db 004h,005h,006h,007h,008h,009h,00Ah,00Bh,008h,009h,00Ch,00Bh,008h,009h,00Ah,00Bh
db 008h,009h,00Ch,00Bh,009h,000h,000h,000h,000h,004h,000h,001h,000h,083h,016h,001h
db 080h,080h,02Eh,001h,000h,00Eh,060h,080h,03Ah,001h,000h,00Eh,062h,081h,061h,083h
db 035h,001h,009h,000h,000h,000h,000h,004h,000h,001h,000h,083h,016h,001h,080h,080h
db 02Eh,001h,000h,00Eh,060h,080h,035h,001h,000h,00Eh,062h,081h,061h,083h,038h,001h
db 009h,000h,000h,000h,000h,004h,000h,001h,000h,083h,016h,001h,080h,080h,02Eh,001h
db 000h,00Eh,060h,080h,038h,001h,000h,00Eh,062h,080h,083h,033h,001h,009h,000h,000h
db 000h,000h,006h,000h,001h,000h,083h,016h,001h,080h,080h,02Eh,001h,000h,00Eh,060h
db 080h,033h,001h,000h,00Eh,061h,081h,061h,083h,035h,001h,083h,00Dh,001h,083h,036h
db 001h,080h,083h,036h,001h,009h,000h,000h,000h,000h,004h,000h,001h,000h,083h,00Fh
db 001h,080h,080h,02Eh,001h,000h,00Eh,060h,080h,036h,001h,000h,00Eh,062h,081h,061h
db 083h,033h,001h,009h,000h,000h,000h,000h,006h,000h,001h,000h,083h,00Fh,001h,080h
db 080h,02Eh,001h,000h,00Eh,060h,080h,033h,001h,000h,00Eh,061h,081h,061h,083h,02Eh
db 001h,083h,012h,001h,083h,033h,001h,080h,083h,035h,001h,009h,000h,000h,000h,000h
db 006h,000h,001h,000h,083h,016h,001h,080h,080h,02Eh,001h,000h,00Eh,060h,080h,035h
db 001h,000h,00Eh,061h,081h,061h,083h,02Eh,001h,083h,00Dh,001h,083h,031h,001h,080h
db 083h,02Eh,001h,009h,000h,000h,000h,000h,008h,000h,001h,000h,083h,012h,001h,098h
db 00Ah,001h,083h,019h,001h,088h,00Ah,083h,01Eh,001h,081h,061h,083h,012h,001h,080h
db 083h,014h,001h,080h,083h,01Bh,001h,080h,083h,020h,001h,080h,083h,014h,001h,080h
db 009h,000h,000h,000h,000h,008h,000h,001h,000h,083h,012h,001h,081h,061h,083h,019h
db 001h,080h,083h,01Eh,001h,080h,083h,012h,001h,080h,083h,019h,001h,083h,031h,001h
db 083h,01Eh,001h,080h,083h,012h,001h,083h,031h,001h,083h,019h,001h,080h,009h,000h
db 000h,000h,000h,008h,000h,001h,000h,083h,014h,001h,083h,033h,001h,083h,01Bh,001h
db 080h,083h,020h,001h,083h,031h,001h,083h,014h,001h,080h,083h,01Bh,001h,083h,030h
db 001h,083h,020h,001h,080h,083h,014h,001h,083h,031h,001h,083h,01Bh,001h,080h,009h
db 000h,000h,000h,000h,008h,000h,001h,000h,083h,016h,001h,083h,030h,001h,083h,01Dh
db 001h,083h,031h,001h,083h,022h,001h,083h,035h,001h,083h,016h,001h,098h,00Ah,001h
db 083h,01Dh,001h,088h,00Ah,083h,022h,001h,081h,061h,083h,016h,001h,080h,083h,01Dh
db 001h,080h,009h,000h,000h,000h,000h,008h,000h,001h,000h,083h,016h,001h,080h,083h
db 01Dh,001h,080h,083h,022h,001h,080h,083h,016h,001h,080h,083h,018h,001h,080h,083h
db 01Dh,001h,080h,083h,011h,001h,080h,083h,018h,001h,080h,009h,000h,000h,000h,000h
db 008h,000h,001h,000h,083h,016h,001h,083h,030h,001h,083h,01Dh,001h,083h,031h,001h
db 083h,019h,001h,083h,02Eh,001h,083h,016h,001h,098h,00Ah,001h,083h,01Dh,001h,088h
db 00Ah,083h,019h,001h,081h,061h,083h,016h,001h,080h,083h,01Dh,001h,080h,0F1h,000h
db 000h,000h
xm_unused_001 LABEL BYTE

; The following 23 bytes are not used.
; So, let's place the MessageBox text and caption instead.
MsgBoxText db "uFMOD ruleZ!",0
MsgCaption db "MASM32",0

org xm_unused_001 + 23
db 001h,000h,012h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,040h,000h,008h,000h,02Ch,000h,00Eh,000h
db 008h,000h,018h,000h,016h,000h,020h,000h,008h,000h,02Dh,000h,00Dh,000h,032h,000h
db 004h,000h,03Ch,000h,007h,000h,044h,000h,004h,000h,05Ah,000h,000h,000h,064h,000h
db 000h,000h,06Eh,000h,000h,000h,000h,000h,020h,000h,00Ah,000h,028h,000h,01Eh,000h
db 018h,000h,032h,000h,020h,000h,03Ch,000h,020h,000h,046h,000h,020h,000h,050h,000h
db 020h,000h,05Ah,000h,020h,000h,064h,000h,020h,000h,06Eh,000h,020h,000h,078h,000h
db 020h,000h,082h,000h,020h,000h,009h,006h,001h,002h,004h,002h,003h,005h,001h,000h
db 000h,000h,000h,000h,080h,000h,00Ch,000h,000h,000h,000h,000h,000h,000h,00Ch,000h
db 000h,000h,040h,000h,001h,080h,0F9h,000h,0BFh,000h,0C3h,000h,00Ah,000h,057h,000h
db 06Eh,000h,023h,000h

.CODE

start:
; EBX = 0
; ESI = IDirectSound
mov esi,OFFSET lpDS
xor ebx,ebx

; Request an instance of IDirectSound.
invoke DirectSoundCreate,ebx,esi,ebx
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.
invoke GetForegroundWindow
push 2   ; DSSCL_PRIORITY
push eax ; hWnd
mov eax,
mov ecx,
push eax ; this
call DWORD PTR ; IDirectSound::SetCooperativeLevel
test eax,eax
js ds_error

; Create a secondary sound buffer.
mov eax,
push ebx ; pUnkOuter <= 0
push OFFSET lpDSBuf
push OFFSET bufDesc
mov ecx,
push eax ; this
call DWORD PTR ; IDirectSound::CreateSoundBuffer
test eax,eax
js ds_error

; Start playback.
invoke uFMOD_DSPlaySong,OFFSET xm,xm_length,XM_MEMORY,lpDSBuf
test eax,eax
js ds_error

; Wait for user input.
invoke MessageBox,ebx,OFFSET MsgBoxText,OFFSET MsgCaption,ebx

; Stop playback.
invoke uFMOD_DSPlaySong,ebx,ebx,ebx,ebx

cleanup:
; Release DirectSound instance and free all buffers.
mov eax,
test eax,eax
jz exit
mov ecx,
push eax
call DWORD PTR ; IDirectSound::Release

exit:
invoke ExitProcess,ebx

ds_error:
; Report an error.
invoke MessageBox,ebx,OFFSET szError,ebx,10h
jmp cleanup

END start


The way I see it, there are two sections of data here: org xm_unused_000 + 60 followed by org xm_unused_001 + 23 - Is it correct to assume that the XM audio file, converted into a MASM hex dump is split between these sections? If so, why is that, and does it have to be like this? Was the author trying to use all the bytes available?

Continuing on, uFMOD comes with a pair of tools to strip XM files of unnecessary data and to create hex dumps . I chose a tiny XM file to work with, opened it with eff.exe and I ticked the "Generate a hex dump file" box only, choosing masm32/tasm as syntax.

After clicking "OK", the tool generates a pair of files: eff.inc and micromod.asm - The data contained in these files is as follows:

eff.inc

; XM-file: micromod.xm

; uFMOD optional features:
INFO_API_ON     equ 1 ;  enable InfoAPI
NOLOOP_ON       equ 1 ;  enable XM_NOLOOP
PAUSE_RESUME_ON equ 1 ;  enable pause/resume and XM_SUSPENDED
VOL_CONTROL_ON  equ 1 ;  enable volume control
JUMP_TO_PAT_ON  equ 1 ;  enable Jump2Pattern
XM_FILE_ON      equ 1 ;  enable file loading
XM_RC_ON        equ 1 ;  enable resource loading

; Special flags:
INSTRUMENTVIBRATO_ON equ 1
VOLUMEENVELOPE_ON    equ 1
PANENVELOPE_ON       equ 0
VOLUMEBYTE_ON        equ 1
ADPCM_ON             equ 0
AMIGAPERIODS_ON      equ 0

; XM effects:
ARPEGGIO_ON equ 0
PORTAUP_ON equ 0
PORTADOWN_ON equ 0
PORTATO_ON equ 0
VIBRATO_ON equ 0
PORTATOVOLSLIDE_ON equ 0
VIBRATOVOLSLIDE_ON equ 0
TREMOLO_ON equ 0
SETPANPOSITION_ON equ 0
SETSAMPLEOFFSET_ON equ 0
VOLUMESLIDE_ON equ 0
PATTERNJUMP_ON equ 0
SETVOLUME_ON equ 0
PATTERNBREAK_ON equ 0
SETSPEED_ON equ 1
SETGLOBALVOLUME_ON equ 0
GLOBALVOLSLIDE_ON equ 0
KEYOFF_ON equ 0
SETENVELOPEPOS_ON equ 0
PANSLIDE_ON equ 0
MULTIRETRIG_ON equ 0
TREMOR_ON equ 0
EXTRAFINEPORTA_ON equ 0
FINEPORTAUP_ON equ 0
FINEPORTADOWN_ON equ 0
SETVIBRATOWAVE_ON equ 0
SETFINETUNE_ON equ 0
PATTERNLOOP_ON equ 1
SETTREMOLOWAVE_ON equ 0
SETPANPOSITION16_ON equ 0
RETRIG_ON equ 0
NOTECUT_ON equ 0
NOTEDELAY_ON equ 1
PATTERNDELAY_ON equ 0
PORTAUP_OR_DOWN_ON equ 0
VIBRATO_OR_VOLSLIDE equ 0
VIBRATO_OR_TREMOLO equ 0
PORTATO_OR_VOLSLIDE equ 0
VOLUME_OR_PANENVELOPE equ 1
ROWCOMMANDS_ON equ 1
GLOBALVOL_ON equ 0
FINEVOLUMESLIDE_ON equ 0


micromod.asm

xm_length EQU 1166
xm LABEL BYTE
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,04Dh,069h,06Eh,069h,06Dh,061h,06Ch,020h,062h,079h,020h,04Ah,06Fh,073h,053h
db 073h,020h,020h,020h,020h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,015h,000h,000h,000h
db 001h,000h,000h,000h,004h,000h,001h,000h,001h,000h,001h,000h,000h,000h,064h,000h
db 000h,009h,000h,000h,000h,000h,041h,000h,0CDh,002h,038h,001h,000h,00Fh,014h,098h
db 00Eh,060h,098h,00Fh,064h,080h,080h,083h,037h,001h,080h,080h,083h,035h,001h,080h
db 080h,080h,080h,083h,030h,001h,080h,080h,083h,029h,001h,080h,080h,080h,080h,083h
db 030h,001h,080h,080h,083h,035h,001h,080h,080h,080h,030h,001h,030h,00Eh,0DAh,033h
db 001h,000h,00Eh,061h,080h,080h,038h,001h,000h,00Eh,060h,037h,001h,030h,00Eh,0DAh
db 080h,080h,083h,033h,001h,035h,001h,030h,00Eh,0DAh,080h,080h,083h,02Ch,001h,080h
db 080h,080h,080h,083h,031h,001h,080h,080h,083h,025h,001h,080h,080h,080h,031h,001h
db 030h,00Eh,0DAh,083h,02Ch,001h,080h,080h,083h,038h,001h,037h,001h,030h,00Eh,0DAh
db 080h,080h,033h,001h,000h,00Eh,061h,031h,001h,030h,00Eh,0DAh,080h,080h,083h,038h
db 001h,030h,001h,024h,00Eh,0DAh,048h,001h,035h,00Eh,060h,080h,035h,001h,020h,00Eh
db 0DAh,083h,037h,001h,080h,080h,083h,035h,001h,080h,080h,080h,035h,001h,030h,00Eh
db 0DAh,083h,030h,001h,080h,080h,083h,029h,001h,080h,080h,087h,04Dh,001h,030h,029h
db 001h,030h,00Eh,0DAh,083h,030h,001h,04Bh,001h,036h,00Eh,0DAh,080h,083h,035h,001h
db 080h,080h,080h,030h,001h,030h,00Eh,0DAh,083h,033h,001h,098h,00Eh,061h,087h,046h
db 001h,032h,038h,001h,000h,00Eh,060h,037h,001h,030h,00Eh,0DAh,087h,044h,001h,035h
db 080h,083h,033h,001h,035h,001h,030h,00Eh,0DAh,080h,080h,083h,02Ch,001h,080h,080h
db 080h,080h,083h,031h,001h,080h,080h,083h,025h,001h,080h,080h,080h,031h,001h,030h
db 00Eh,0DAh,083h,02Ch,001h,080h,080h,083h,038h,001h,037h,001h,030h,00Eh,0DAh,080h
db 080h,033h,001h,000h,00Eh,061h,031h,001h,030h,00Eh,0DAh,087h,046h,001h,030h,048h
db 001h,024h,00Eh,0DAh,083h,038h,001h,030h,001h,024h,00Eh,0DAh,041h,001h,035h,00Eh
db 060h,04Dh,001h,01Eh,00Eh,0DAh,035h,001h,020h,00Eh,0DAh,083h,037h,001h,087h,04Bh
db 001h,030h,041h,001h,01Ah,00Eh,0DAh,083h,035h,001h,080h,044h,001h,030h,00Eh,0DAh
db 087h,043h,001h,035h,035h,001h,030h,00Eh,0DAh,083h,030h,001h,080h,048h,001h,034h
db 00Eh,0DAh,083h,029h,001h,080h,080h,080h,029h,001h,030h,00Eh,0DAh,083h,030h,001h
db 04Bh,001h,036h,00Eh,0DAh,080h,083h,035h,001h,080h,080h,04Dh,001h,021h,00Eh,0DAh
db 030h,001h,030h,00Eh,0DAh,083h,033h,001h,046h,001h,020h,00Eh,061h,048h,001h,022h
db 00Eh,0DAh,038h,001h,000h,00Eh,060h,037h,001h,030h,00Eh,0DAh,087h,03Dh,001h,035h
db 049h,001h,020h,00Eh,0DAh,083h,033h,001h,035h,001h,030h,00Eh,0DAh,087h,048h,001h
db 040h,044h,001h,01Eh,00Eh,0DAh,083h,02Ch,001h,080h,087h,041h,001h,035h,044h,001h
db 02Ah,00Eh,0DAh,080h,083h,031h,001h,087h,046h,001h,040h,041h,001h,026h,00Eh,0DAh
db 083h,025h,001h,080h,080h,080h,031h,001h,030h,00Eh,0DAh,083h,02Ch,001h,080h,080h
db 083h,038h,001h,037h,001h,030h,00Eh,0DAh,080h,080h,033h,001h,000h,00Eh,061h,031h
db 001h,030h,00Eh,0DAh,087h,046h,001h,030h,048h,001h,024h,00Eh,0DAh,083h,038h,001h
db 098h,00Eh,060h,083h,011h,001h,087h,041h,001h,035h,080h,083h,037h,001h,011h,001h
db 000h,00Eh,0DAh,044h,001h,030h,00Eh,0DAh,083h,035h,001h,080h,083h,01Dh,001h,080h
db 080h,083h,030h,001h,01Dh,001h,000h,00Eh,0DAh,080h,083h,029h,001h,080h,083h,011h
db 001h,080h,080h,083h,030h,001h,011h,001h,000h,00Eh,0DAh,080h,083h,035h,001h,080h
db 083h,01Dh,001h,087h,046h,001h,035h,030h,001h,030h,00Eh,0DAh,033h,001h,000h,00Eh
db 061h,083h,01Bh,001h,087h,048h,001h,030h,038h,001h,000h,00Eh,060h,037h,001h,030h
db 00Eh,0DAh,083h,019h,001h,087h,049h,001h,035h,083h,033h,001h,035h,001h,030h,00Eh
db 0DAh,019h,001h,000h,00Eh,0DAh,048h,001h,026h,00Eh,0DAh,083h,02Ch,001h,080h,083h
db 025h,001h,087h,044h,001h,035h,080h,083h,031h,001h,080h,087h,041h,001h,030h,083h
db 025h,001h,080h,080h,080h,031h,001h,030h,00Eh,0DAh,083h,02Ch,001h,080h,080h,083h
db 038h,001h,037h,001h,030h,00Eh,0DAh,083h,022h,001h,080h,033h,001h,000h,00Eh,061h
db 031h,001h,030h,00Eh,0DAh,083h,020h,001h,080h,08Bh,035h,001h,00Fh,083h,029h,001h
db 083h,01Dh,001h,087h,048h,001h,035h,0F1h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,01Fh,001h,000h,012h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,030h,000h,004h,000h,02Bh,000h
db 009h,000h,01Eh,000h,00Dh,000h,018h,000h,013h,000h,012h,000h,01Bh,000h,00Eh,000h
db 025h,000h,00Ah,000h,032h,000h,007h,000h,040h,000h,005h,000h,04Dh,000h,003h,000h
db 08Dh,000h,000h,000h,000h,000h,030h,000h,000h,000h,020h,000h,044h,001h,020h,000h
db 050h,000h,020h,000h,050h,000h,020h,000h,050h,000h,020h,000h,050h,000h,020h,000h
db 050h,000h,020h,000h,05Ah,000h,020h,000h,064h,000h,020h,000h,06Eh,000h,020h,000h
db 078h,000h,020h,000h,082h,000h,020h,000h,00Bh,002h,006h,001h,001h,001h,001h,001h
db 001h,000h,000h,010h,00Bh,015h,080h,000h,064h,000h,000h,000h,000h,000h,000h,000h
db 064h,000h,000h,000h,040h,0DCh,011h,080h,00Ah,011h,001h,0D0h,0B0h,003h,0AFh,003h
db 0B0h,003h,0B0h,003h,0AFh,003h,0B0h,003h,0AFh,003h,0B1h,003h,0AFh,003h,0B0h,003h
db 022h,04Bh,000h,000h,000h,0FEh,000h,000h,000h,0FBh,000h,0FEh,000h,0FAh,000h,0FBh
db 000h,0FCh,000h,000h,000h,0FDh,000h,0F0h,000h,001h,000h,0FFh,000h,0FEh,000h,000h
db 000h,0FEh,000h,000h,000h,0FFh,000h,000h,000h,0FEh,000h,000h,000h,000h,000h,000h
db 000h,0FEh,000h,0FFh,000h,0FEh,000h,0FDh,000h,000h,0F2h,0EEh,050h,0FCh,050h,0FCh
db 051h,0FCh,050h,0FCh,050h,0FCh,050h,0FCh,051h,0FCh,050h,0FCh,050h,0FCh


I have noticed that aside from the hex data, there are two lines of code attached to the dump xm_length EQU 1166 and xm LABEL BYTE - These are also present in the uFMOD program code, the only difference being the xm_length value . I tried replacing this value with the 1166 I got and placing my hex dump data over either one of the sections, but after compiling, the program is silent.

This obviously is far beyond my understanding, as I don't know a first thing about assembly, and I wish that someone could explain to me how to get this working and more importantly, how to handle this in the future, with other XM files, so that I don't end up with a one time solution, but rather learn how this is done.

Bare in mind that I'm not even able to create a "Hello World" type of program, so if you're kind enough to explain these things to me, keep it simple so that I actually understand and won't keep asking you about same things over and over again. Haha.

Sorry for just pasting all the data into the message, but I figured that would be the easiest way of showing you exactly what is it that is not working. I hope you don't ban noobs or anything, because if you are, I'm pretty much gone already. Haha.

Thanks again to anyone who is willing to help me out. Thanks for your time, your patience and your knowledge.

P.S. - I attached a zip file with all the assembly uFMOD sources, but it's only MASM32 DirectX version I'm interested in, unless you think I should go with WinMM. The zip file also contains the xm audio file I want to use.
Attachments:
Posted on 2009-04-20 15:22:02 by Canine

The way I see it, there are two sections of data here: org xm_unused_000 + 60 followed by org xm_unused_001 + 23 - Is it correct to assume that the XM audio file, converted into a MASM hex dump is split between these sections? If so, why is that, and does it have to be like this? Was the author trying to use all the bytes available?


there's an option in eff that removes unused data, the mark and clear-out thing at the bottom, the xm data in the example you posted is generated with that on, that's why the xm data is split up into 2 parts, it removed the data that won't be used.. you can choose whichever you want, to remove that data or not.. anyways to use your own xm file, like the micromod.asm one you posted,


include micromod.asm ; include the generated file somewhere in the .data section..

pcm dd 20001h          ; wFormatTag <= WAVE_FORMAT_PCM, nChannels <= 2
dd uFMOD_MixRate
        .........

bufDesc dd 20 ; DSBUFFERDESC1
dd 14000h ; dwFlags <= DSBCAPS_STICKYFOCUS OR DSBCAPS_GETCURRENTPOSITION2
        .............

MsgBoxText db "uFMOD ruleZ!",0
MsgCaption db "MASM32",0

Posted on 2009-04-20 16:20:04 by lone_samurai5
Worked like a charm first time i tried it. Once the eff.exe produced a proper asm file, with the data split in two, I simply replaced the orginal information and it compiled just fine. You also mentioned using the "include micromod.asm", but I'm not entirely sure how to work with that. Like I said before, I have never coded in assembly in my life, ever.

Another problem now is larger xm files. A 2.5 meg xm will produce a 14 meg hex dump and that's just not workable in notepad using copy and paste. Is that when you simply tell the compiler to include a asm file containing the hex dump?

I would really like to see a complete example of how that would work. If you don't mind, could you simply re-post the whole uFMOD player code with your changes made to it? Thanks in advance.
Posted on 2009-04-20 19:59:29 by Canine
just move the generated asm file into the same directory your other code is in and include it.. pretty much the same as copy and pasting the hex data into the src file.. also don't include files that big, just get the xm filename during runtime and just play the file with uFMOD_DSPlaySong..
Attachments:
Posted on 2009-04-21 02:31:03 by lone_samurai5