gyurco / Next186

GNU General Public License v3.0
13 stars 10 forks source link

Midi MPU401 experimental work #5

Closed squidrpi closed 3 years ago

squidrpi commented 3 years ago

Wonder if you could have a browse through my changes. I'm trying to implement MIDI MPU401 support. I've sort of got it working as MIDI plays on my MT32 but the notes are garbled and volumes are set wrong. Multiple channels play but not correctly. Some of the melody sounds correct at times. I used the ao486 MPU/UART files and integrated them into ddr_186.v. Initialisation looks correct as Monkey, Atlantis, DOTT start OK when using the Roland option.

My clock timings are probably completely wrong (never get the hang of them). Possibly though the data isn't being fed correctly from the CPU IO. I'm confused about the "IORQ && CPU_CE" and have left them out of CS. Either that or there's no hope for this to work. Only experimental work but perhaps it could work?

stp2.stp setup for debug and OPL3 disabled. Next186_test.zip

gyurco commented 3 years ago

Can you show the change in git? It's much easier to see your work in it. Just fork, create a branch, do the work, and push that branch. Actually I don't have any MIDI hardware to try. IORQ show that the CPU is reading/writing to a port (PORT_ADDR is valid). It's similar to the original CPU (expect that it doesn't have a separate bus for the IO). CE should be used if you don't want to do edge detection.

squidrpi commented 3 years ago

Changes here https://github.com/squidrpi/Next186/commit/21122d5df1d1f50c216013fd6520d8324a47cbb9

squidrpi commented 3 years ago

Eureka it’s working! Ignoring the CE & IORQ for the MPU commands/game initialisation to switch to UART/dumb mode then pass directly to the 16550 UART using CE & IORQ and it’s playing great. All games I’ve tried appear to play perfectly at any CPU speed. The 16550 has some FIFO buffering that is required by some games like Monkey Island.

The 16550 could be used as a fully functional drop in replacement for the 8250 to save space.

I’ll tidy up the code and create a new pull request.

gyurco commented 3 years ago

Depending on PORT_ADDR without asserted IORQ will never be correct, so it must work by luck :) AFAIK the 8250 implementation in the core also uses a FIFO. But 16550 is not a bad idea. If you add the MPU-401, then an OSD option to switch between COM1 and MPU should be added, too.

squidrpi commented 3 years ago

Support added #8