VOGONS


First post, by mattw

User metadata
Rank Oldbie
Rank
Oldbie

hi All,

today, by pure chance, looking at an unrelated topic, I found out that 2013, MAME not only made dump of the Original Roland MPU-401 ROM (i.e. firmware), but also wrote emulator of the Real Device using the Real firmware, my initial realization about it is here:

Re: The Soundblaster DSP project

So, I don't know if their emulator is fully functional, but if yes (presumable if not, it can be fixed, because the hardest part is done, i.e. dumping the ROM), what about like we have MUNT-box, we have dedicated MAME-MPU401-box in front of it, i.e. do not rely anymore on expensive, speculatively priced MPU401 interfaces - I mean do diagram like this would be possible:

your (retro) PC with any sound card with MIDI UART (just to send the SysEx to MAME-box) --> Midi cable --> MIDI-In of dedicated MAME-MPU401-box --> MIDI-Out of dedicated MAME-MPU401-box --> Midi cable --> dedicated MUNT-box

What you think? Possible or I am missing something?

Reply 1 of 6, by keropi

User metadata
Rank l33t++
Rank
l33t++

I would say that since SoftMPU exists it defeats the purpose of some mame-box emulating an mpu?

🎵 🎧 PCMIDI MPU , OrpheusII , Action Rewind , Megacard and 🎶GoldLib soundcard website

Reply 2 of 6, by mattw

User metadata
Rank Oldbie
Rank
Oldbie
keropi wrote on 2023-10-12, 22:33:

I would say that since SoftMPU exists it defeats the purpose of some mame-box emulating an mpu?

SoftMPU has issues and limitations... in fact even simple tests show how different it responds compared to Roland ROM:

Re: Missing music in Gateway (MT-32 mode)

Reply 3 of 6, by keropi

User metadata
Rank l33t++
Rank
l33t++

I would think these things got patched like they did on dosbox since then - but I can't claim to be an expert on softmpu... it is my impression that it works fine provided one meets the system reqs

🎵 🎧 PCMIDI MPU , OrpheusII , Action Rewind , Megacard and 🎶GoldLib soundcard website

Reply 4 of 6, by mattw

User metadata
Rank Oldbie
Rank
Oldbie
keropi wrote on 2023-10-12, 22:46:

I would think these things got patched like they did on dosbox since then - but I can't claim to be an expert on softmpu...

I tested them earlier today on the latest SoftMPU v1.9 - not only they are there, but test "2A" and "1A" - cause total freeze with SoftMPU (i.e. it's worse than the old test ran on Dosbox) plus I guess MAME could be ran on the same Box where the MUNT is run, i.e. not have physically 2 boxes. basically, instead run SoftMPU on the Retro PC, run MAME on the MUNT box next to it.

Reply 5 of 6, by mattw

User metadata
Rank Oldbie
Rank
Oldbie

I don't know which is the best way to disassemble 6801-assembler, even less I know how to read it, but even my very clumsy attempt , seems to make a lot of sense:

mpu401_asm.jpg
Filename
mpu401_asm.jpg
File size
172.08 KiB
Views
1199 views
File comment
6801 ASM
File license
Public domain

because MPU-401 Command 0xAC and Command 0xAD communication is the following:

Re: Roland LAPC-N / I question

and that is very obvious on the above screenshot of 6801 ASM code:

load 0x15, compare if the CMD is 0xAC, return it

and same:

load 0x01, compare if the CMD is 0xAD, return it

and so on. So, definitely, someone familiar with 6801-assembler can read the above better and even do some improvement to the MAME code. I guess that's also confirmation MAME ROM dump is good.

Reply 6 of 6, by mattw

User metadata
Rank Oldbie
Rank
Oldbie

OK, here is something like a Guide and my current findings. That will save time of other people in case they want to join and help with the effort.

I am using the latest MAME 0.259 and apart of that, you need only 6 other files (that you can find and download online), you put them in sub-directory named "ct486" in your MAME roms directory:

sha1sum roms/ct486/*
0100f8789fb4de74706ae7f9473a12ec2b9bd729 roms/ct486/1503033.bin
b88d09be66905ed2deddc26a6f8522e7d2d6f9a8 roms/ct486/chips_1.ami
945d405b0fb4b8f26830d495881f8587d90e5ef9 roms/ct486/et4000.bin
72134882a5c03e785db07cc54dfb7572c0a730d9 roms/ct486/natural.bin

00efbfb96aeb997b69bb16981c6751d3c784bb87 roms/ct486/roland__6801v0b55p__15179222.bin

81d2b1598c6f08bc8ea223b535025db859f51821 roms/ct486/msdos622.chd

("msdos622.chd" is optional, you can generate your own HDD image using MAME 'chdman' tool and install your own DOS or other OS, but I will not cover it, because in this case it's just waste of time)

After that running MAME with Roland MPU-401 emulation and running DOS 6.22 installation is as easy as:

mame ct486 -hard1 msdos622 -isa5 mpu401

NOTE: on the 1st run of the emulator, you need to enter the emulated 486-machine BIOS with pressing DEL and go to auto-detect the HDD and save the changes to the BIOS.

NOTE2: in case you want to exchange some files between the DOS 6.22 installation running in MAME and the "outside world" the stupidest way I found is using floppy disk image (created with WinImage) in the following way:

mame ct486 -hard1 msdos622 -flop1 f720.ima -isa5 mpu401

In order to be able to experiment and add some debug messages to Roland MPU-401 emulator you need to be able to build MAME from its source code - that turned out to be extremely easy in my 'Ubuntu 22.04.2 LTS' installation, only 3 simple steps:

# sudo apt-get install git build-essential python3 libsdl2-dev libsdl2-ttf-dev libfontconfig-dev libpulse-dev qtbase5-dev qtbase5-dev-tools qtchooser qt5-qmake

# git clone https://github.com/mamedev/mame.git

# cd mame
# make -j8

So, that initial test shows there are what seems to be minor bugs/problems with the MAME emulation of Roland MPU-401, I tracked down those problems to the time when that emulation was made - even before it was in MAME, it was initially part of the 'MESS project release 0.150' - that should explain why it's not popular, because since then (over 10 years now), no one cared to fix those small issues, here are the details:

MAME 6801-emulator seems to properly run the Roland MPU-401 ROM, but something is not quite right as the screenshot shows and explains:

mame_mpu401_bug.jpg
Filename
mame_mpu401_bug.jpg
File size
99.62 KiB
Views
1103 views
File comment
MAME emulation of Roland MPU-401 issues
File license
Public domain

I don't claim the below is the correct and the best fix - it's just way to illustrate the MAME emulation of Roland MPU-401 problems look very minor and probably easy to be ironed out:

In:
https://github.com/mamedev/mame/blob/master/s … hine/mpu401.cpp

I changed the following code:

void mpu401_device::asic_w(offs_t offset, uint8_t data)
{
// printf("MPU401: %02x to gate array @ %d\n", data, offset);

if (offset == 1)
{
m_mpudata = data;
m_gatearrstat &= ~STAT_RX_EMPTY;
write_irq(ASSERT_LINE);
}
}

to:

void mpu401_device::asic_w(offs_t offset, uint8_t data)
{
printf("MPU401: %02x to gate array @ %d\n", data, offset);

m_mpudata = data;

if (offset == 1)
{
m_gatearrstat &= ~STAT_RX_EMPTY;
write_irq(ASSERT_LINE);
}
}

and after that the result is on the screenshot below:

mame_mpu401_fix.jpg
Filename
mame_mpu401_fix.jpg
File size
92.67 KiB
Views
1103 views
File license
Public domain

So, currently, my conclusion is that MAME did all the hard work - dumped the latest version of Roland MPU-401 ROM (v1.5A) and wrote 6801-emulator that is working. The communication between the 6801-Emulator and the upper layers (where DOS is running) has some issues, but they seem that should be easily fixable as I illustrated above.

[EDIT] I forgot to mention that MAME includes tools called 'unidasm' that is capable to disassemble the Roland MPU-401 ROM:

unidasm -arch m6801 roland__6801v0b55p__15179222.bin