DMC test Failed #19

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
User avatar
Anes
Posts: 702
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

DMC test Failed #19

Post by Anes »

Trying to implement my DMC i reached the error #19:
"There should be a one-byte buffer that's filled immediately if empty"
Can someone explain what i means cos i don't understand.
Thxs in advance.
ANes
Fiskbit
Posts: 891
Joined: Sat Nov 18, 2017 9:15 pm

Re: DMC test Failed #19

Post by Fiskbit »

The DMC unit has storage for two DPCM bytes. One is the currently playing byte, which bits are shifted out of periodically for playback. The other is a storage buffer that holds the next byte to be played. Whenever the playback byte empties, the storage byte is moved into it. Whenever the storage buffer is empty and bytes_remaining is nonzero, the DMA unit will fetch a byte into the storage buffer.

When you start a sample by writing to $4015, the storage buffer may still have the last byte of the previous sample in it. If so, then DMA waits until the storage buffer is empty, as usual. If a sample is started while the buffer is already empty, then the first byte is fetched right away (see https://www.nesdev.org/wiki/DMA#DMC_DMA for timing details).
User avatar
Anes
Posts: 702
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

Re: DMC test Failed #19

Post by Anes »

Thanks!! your explanation led me to check out mem dma redear and fixed the error.
ANes
Post Reply