> Would it be possible to adapt Soeren's sound engine to play sampled
> sounds (I know the quality wouldn't be up to much, but It must be
> possible, as the soul callibur game, apparently, has speech)
Ok, I have disassembled the part of SOUL CALIBUR that plays sound samples.
It works very simple: instead of directly controlling the speaker, they
turn on and off a 50KHz tone produced by timer1 in RC clock mode. The
routine starts at $18F8, the "NAMCO" sound data starts at $22D4, the first
two bytes are the length ($540) the rest is sampledata, every sample is
a single bits, MSB first.
Here are my comments for the sample player, to avoid legal problems I have
removed the code, disassemble it yourself with "lcdis SCALIBR3.VMS ENTRY0x18F8"
then use cut and paste. The binary is the one from www.dreamcast.com, md5sum
is 0bd5020e6d06b3f5118e868ccb4852e0.
A note to disassembling the rest of the code:
the automatic code recognition of lcdis fails, many routines are called by
pushing their address onto the stack and then RET. The start addresses of
such routines are put into MEM13D/MEM13B and MEM152/MEM150. Other addresses
are stored in ROM tables and moved from there into registers. I have not found
all such tables and there is still missing some code. Since I found the routine
I wanted, I don't care. If you want my results, just mail me, my current set
of addresses are about 160 entry points.
|;; play sound samples
18f8- |; battery low?
18fb- |; sound flag
18fe- |
|
18ff- |
1901- |
1903- |; access OS ram bank
1905- |; Stop Timer1 (sound off)
1908- |; disable irq
190a- |; RC clk
190d- |
190e- |
1911- |; 50KHz
1914- |; access game ram bank
1916- |; acc=0
1918- |
1919- |; highbyte of length
191b- |
191e- |
191f- |; lowbyte of length
1921- |
1924- |; advance trh/trl
1927- |; ???
192a- |; pointer offset
192d- |; @R1=MEM110
1930- |; @R0=MEM111
1933- |; 8 bits in a byte
1936- |; pointer offset
1938- |
193a- |; get next byte
193b- |; =MEM110=pointer offset
193e- |; advance pointer
1940- |; check for 0/1
1943- |; play 1
1946- |; continue
|
1948- |; play 0
194b- |; next bit
194c- |; until all bits played
194f- |; lowbyte of length!=0?
1952- |; highbyte of length
1954- |; 0? end
1956- |; highbyte of length
1958- |; lowbyte of length
195a- |; continue loop
|
195c- |;Stop Timer1 (sound off)
195f- |;access game ram bank
1961- |
1963- |
1965- |
Soeren