Page 1 of 3
Discovery...
Posted: Thu May 31, 2007 11:19 am
by TmEE co.(TM)
If 68K accesses VDP, it affects the bank access of z80. Yesterday I put a PCM playing in background in my game, and every more intense VDP access made the sample rate drop a little. The higher the sample rate the bigger the effect.
Also when 68K is halted in MD mode (MD has SMS mode too), z80 can't access bank, and gets halted aswell (until 68K gets unhalted). If you bomb the VDP too fast, it'll pull up DTACK! signal which halts 68K until VDP has its business done, so in that period, z80 has difficulty getting data from its bank. Thats my idea what happens, anyone different ideas ?
Posted: Thu May 31, 2007 11:33 am
by Stef
I believe that when you push too much datas to the VDP, it will lock the 68K on a BUS cycle then Z80 can't access the 68000 BUS anymore at the same time. You can avoid that by checking the VDP FIFO full/empty flag. It doesn't work on Gens (Fudged) but it does on real hardware, this permit to avoid some BUS lock to the Z80 (for 68K it doesn't change anythink as you have to wait anyway).
Posted: Thu May 31, 2007 11:35 am
by TmEE co.(TM)
I wonder what happens when you do a DMA
Posted: Thu May 31, 2007 11:52 am
by Fonzie
When u do a DMA (from 68Kram to Vram or Rom to Vram), you may halt the Z80... Because, if the Z80 try to access the cartridge during the DMA, it will crash.
I cannot confirm the way it will crash (big crash, just reset, just halt?), but many peoples around ALWAYS halt the Z80 during DMA

Posted: Thu May 31, 2007 11:55 am
by TmEE co.(TM)
There's always something that limits MDs sound capabilities !!!Why !!!??? Why !!!???
I must try it out, I want to see what happens. I believe it just halts, but you'll never know unless you try it out

Posted: Thu May 31, 2007 12:01 pm
by Fonzie
I beleive the best games just have a few Bytes buffer in the Z80 ram and a flag to say "dont access cartridge"/"you can access cartridge"... Since DMA's are usualy short, the playback isn't killed
Any idea?
BTW: i may move this thread to the "expert" section

Posted: Thu May 31, 2007 12:10 pm
by TmEE co.(TM)
This really affects high quality samples, where you'll hear problem too well. You listened my tune, percussions will sound the same once I finish my tracker and MD Music & Sound Engine (MSE). Cymbals get really sucky when something interrupts the sound processing process, and I must keep the quality high as if I don't cymbals sound too sucky (more like Shhh Shhh not TSHHhhh...
Posted: Thu May 31, 2007 12:14 pm
by Fonzie
Can't you store the cymbals into Z80 ram then?

The sample size isn't more than 1KB, is it?
Posted: Thu May 31, 2007 12:17 pm
by TmEE co.(TM)
Well, the sample set is near half a megabyte and almost half of it are cymbals... I can't do that

Posted: Fri Jun 01, 2007 10:20 pm
by MERLiX
Dont know if this is ideal for what your doing, but how about using z80 ram for 2 buffers?, it means you have to use 68k to move it though, thats what I did for my adpcm demo.
Posted: Sat Jun 02, 2007 9:40 am
by TmEE co.(TM)
Z80 does ALL the dirty work, 68K just has to load the driver and issue commands, nothing else. BTW your ADPCM demo is really nice.
There will be 2ch mixing at 22KHz, very similiar to Shiru's 4ch mixer.
Posted: Fri Jun 08, 2007 6:03 pm
by TmEE co.(TM)
Another discovery: YOU DO NOT HAVE HALT Z80 WHEN YOU ARE GOING DO A DMA TRANSFER. Z80 stops itself, and leaves a nasty gap into the sound if you transfer 320x480 pixels of tiles. But if the images are small it is not so big deal. No crashes or halts or any other issues.
Posted: Fri Jun 08, 2007 9:59 pm
by Fonzie
I would suggest to halt, really, there are lot of "warning" in several documentations

Some megadrive model may lockup ^^
But nice to know that a few tiles DMA doesn't affect so much a PCM playback! Good luck!
Posted: Sat Jun 09, 2007 12:19 pm
by TmEE co.(TM)
Maybe some models do crash, but I'll leave that to be found out by beta tester, but when my game is in a half finished state...
Also, is there any DMA issues on real hardware ? My DMA routine doesn't always work correctly on Fusion and MD.
Here's my code, is there any bugs in it ? :
Code: Select all
LoadTiles: ; D0=Start tile , D3=tiles , A0=Source address
LSL.W #5, D0 ; modifying routines, uses DMA
SWAP D0
CLR.W D0
SWAP D0
MOVE.L D0, D2
LSL.L #2, D2
CLR.W D2
SWAP D2
AND.L #$3FFF, D0
SWAP D0
OR.L D0, D2 ; Add rest of the Address bits
LSL.W #4, D3
MOVE.W D3, D0
JSR DoDMAtoVRAM
RTS
DoDMAtoVRAM: ; Does DMA to VRAM
MOVE.L #CPORT, A1
MOVE.L A0, D1 ; D0 = WORDs to transfer
LSR.L #1, D1 ; D2 = VRAM address
MOVE.L D1, A0 ; A0 = source address
MOVE.W D0, D1
AND.W #$00FF, D1
OR.W #$9300, D1
MOVE.W D1, (A1)
LSR.W #8, D0
OR.W #$9400, D0
MOVE.W D0, (A1)
MOVE.L A0, D0
MOVE.W #$9500, D1
OR.B D0, D1
MOVE.W D1, (A1)
LSR.L #8, D0
MOVE.W #$9600, D1
OR.B D0, D1
MOVE.W D1, (A1)
LSR.L #8, D0
AND.B #$7F, D0
MOVE.W #$9700, D1
OR.B D0, D1
MOVE.W D1, (A1)
OR.L #$40000080, D2
MOVE.L D2, (A1)
RTS
Posted: Tue Jun 12, 2007 6:15 am
by 8bitwizard
TmEE co.(TM) wrote:Maybe some models do crash, but I'll leave that to be found out by beta tester, but when my game is in a half finished state...
Also, is there any DMA issues on real hardware ? My DMA routine doesn't always work correctly on Fusion and MD.
I don't use DMA right now (aside from the VDP memory clear at startup), but I have seen a case where a DMA fill cleared one more character cell on real hardware than on the MESS emulator. Since I thought I was doing it right and don't know why the real hardware was clearing more than I thought it should, I just disabled it in favor of a write loop.
So it is entirely possible that an emulator could be emulating DMA incorrectly.