Hi. I'm picking up 68k along with the hardware and I've messed with it long enough to get a hang of the graphics end of things. I tried to take the example found in the Sega2 manual towards the end of the document (the table with register/offset) but it will only play on Gens, not Kega Fusion. I'm doing everything from the 68k. Code (Text): lea $a04000, a0;register lea $a04001, a1;data ;each step move.b #$22, (a0);LFO off move.b #$00, (a1) jsr YMRdy ... I wrote each byte in the table but nothing is heard on Kega. YMRdy tests the busy bit between writes. Can someone tell me what other step I need to do or provide some other 68k code to init the 2612? Any input much appreciated. Thanks.
You have to request Z80 bus before accessing YM2612 on the 68K side, in Gens, default when you boot the ROM is Bus Requested, but in Fusion and real hardware it is Z80 having the bus. There's a reg for it, I'm not sure but I think it is $A11000 or $A12000... I don't remember.
It's $A11100 - the code to request the bus (taken from Xeno's stopZ80 macro) would be: Code (ASM): move.w #$100,($A11100).l ; stop the Z80 @waitForZ80: btst #0,($A11100).l bne.s @waitForZ80 ; loop until it says it's stopped (assuming your assembler uses @ for local labels)
Thanks for the replies. I read in Sega2 that the 68k has the bus on reset, so I guess I'll avoid assumptions like that in the future. I've tried the code you've posted shobiz but it just seems to lockup the program on Kega (Gens still works as it did before). The waitForZ80 loop is never broken. Any ideas?
That happened to me once, I believe it's because of the Z80 reset being held high at console start-up. Instead of using the code I posted in the above post, try Code (ASM): move.w #$100,($A11100).l ; stop the Z80 move.w #$100,($A11200).l ; release Z80 reset @waitForZ80: btst #0,($A11100).l bne.s @waitForZ80 ; loop until it says it's stopped
I usually don't check if the request/reset happened... no trouble on real hardware, no trouble on emulators. Code (Text): MOVE.B #$01, ($A11200); Stop Z80 reset MOVE.B #$01, ($A11100); request Z80 bus This is all required... that's what I do in the beginning on my MD WAV player. And if you want to have Z80 in the action too, you do this : Code (Text): MOVE.B #$01, ($A11200); Stop Z80 reset MOVE.B #$01, ($A11100); request Z80 bus MOVE.W #447, D0 LEA Z80prog, A0 MOVE.L #$A00000, A1 Z80loadLoop: MOVE.B (A0)+, (A1)+ DBRA D0, Z80LoadLoop MOVE.B #$00, ($A11200); Start Z80 reset MOVE.B #$00, ($A11100); unrequest Z80 bus MOVE.B #$01, ($A11200); Stop Z80 reset You will have to request and then release Z80 bus everytime you want to access YM2612 on 68K side.
shobiz: That did the trick. Thanks. TmEE: I'll keep that in mind in the case I feel like switching to the Z80.