Thanks for trying this rom sdw, it uses the z80, but for my Wolf3D demos I use the code for "GCC" then I converted to asm, both drivers come with the tfm music maker, but I realized something: both have errors in the initialization of the YM2612 look at these codes:Sdw wrote:The test version (tfmsmd.rar) plays back correctly on my PAL Megadrive with using and Everydrive MD.
The latest Wolf3D build (wol3ddemo_b2.rar) however does not, sound effects sound fine, but the music is just some isolated blips and blops, nothing at all like the test version.
Code: Select all
gcc code:
if(!TFCP.play) /* mute ym2612 */
{
ym2612wr(0x2f,0,0); /* freq.scaler */
ym2612wr(0x2d,0,0);
ym2612wr(0x22,0,0); /* LFO off */
ym2612wr(0x2b,0,0); /* DAC off */
ym2612wr(0x27,0,0); /* CH3 normal mode */
ym2612wr(0x27,0,1); /* CH3 normal mode */
for(cc=0;cc<2;cc++)
{
for(aa=0;aa<3;aa++)
{
for(bb=0x30;bb<0x40;bb+=4) ym2612wr(aa+bb,0x00,cc); /* dt1/mul */
for(bb=0x40;bb<0x50;bb+=4) ym2612wr(aa+bb,0x7f,cc); /* tl */
for(bb=0x50;bb<0x60;bb+=4) ym2612wr(aa+bb,0x00,cc); /* rs/ar */
for(bb=0x60;bb<0x70;bb+=4) ym2612wr(aa+bb,0x00,cc); /* am/d1r */
for(bb=0x70;bb<0x80;bb+=4) ym2612wr(aa+bb,0x00,cc); /* d2r */
for(bb=0x80;bb<0x90;bb+=4) ym2612wr(aa+bb,0x0f,cc); /* d1l/rr */
for(bb=0x90;bb<0xa0;bb+=4) ym2612wr(aa+bb,0x00,cc); /* ssg-eg */
ym2612wr(0xb0+bb,0x00,cc); /* fb/algo */ ------->should be: ym2612wr(0xb0+aa,0x00,cc);<-----
ym2612wr(0xb4+bb,0x00,cc); /* ams/fms */ ------->should be: ym2612wr(0xb4+aa,0x00,cc);<-----
ym2612wr(0x28,aa+(cc<<2),0); /* keyoff */
}
}
}
Code: Select all
z80 code:
ld ix,#4000 ;sel. bank #0
CALL tfminiPP
ld ix,#4002 ;sel. bank #1
call tfminiPP
ld bc,#0700 ;keyoff's
ld a,3
tfmShK0
cp c
call nz,keyOff
inc c
djnz tfmShK0
ret
tfminiPP
ld bc,#1000
ld de,#3000
call ymWrPortFL ;dt1,mul=#00
ld e,#7f
ld b,#10
call ymWrPortFL ;tl=#7f
ld e,c
ld b,#30
call ymWrPortFL ;rs,ar,am,d1r,d2r=#00
ld e,#0f
ld b,#10
call ymWrPortFL ;d1l,rr=#0f
ld e,c
ld b,#28 ;all other regs=#00
ymWrPortFL
WaitStatus
ld (ix),d
inc d
WaitStatus
ld (ix),e ;--------> should be: ld (ix+1),e <---------
djnz ymWrPortFL
ret
;---------------------------
;---------------------------
keyOff
WaitStatus
ld (iy),#28
WaitStatus
ld (iy+1),c
ret
In the version for z80 is even worse, most of the registers are not initialized because instead of writing to $4000($4002) and then to $4001($4003), it always writes to $4000($4002) and then again to $4000($4,002), but at least the regs #22, #2b, #2f, #2d, #27 (before this part of the code) and #28 (KeyOff) are initialized correctly.
Then I wonder: is necessary to initialize all the YM2612 regs?, Because this rom (tfmsmd.rar) uses the z80 and not initialized all regs, but works fine on real hardware.
I made two versions of the rom, one (wolf3ddemo_b2_posfix.bin), which fix the error in the regs. 0XB0 - 0xb6, and the other (wolf3ddemo_b2_zclr.bin) where only some registers are initialized as in the z80.
Here is the link to download:
http://www.mediafire.com/download/e2035 ... b2test.rar