Menu

#42 MPU-401 Intelligent mode emulation

closed
Qbix
None
5
2012-09-07
2004-02-15
Srecko
No

This is implementation of original Roland MPU 401
interface card based on card's manual.
Due to architectural limitations of dosbox, interrupt
request buffering and similar techniques had to be used
to simulate behavior of real MPU 401. As a result, this
emulation has somewhat limited functionality when
compared to a real device.
Some minor modifications of dosbox's interrupt
controller code also had to be done, as well as mpu
configuration. Archive includes patch for those changes
and should be applied to dosbox 0.61. MPU-401 emulation
is in mpu401.cpp file in archive which should replace
old mpu401.cpp in dosbox source.

Emulation was successfully tested with following games
(using canadacow's latest MT-32 emulator as midi device):
Curse of Enchantia
Innocent until Caught
David Wolf (1990, Dynamix)
Ecargxus (Demo by TPC)

If you can find any other games or applications that
use this hardware in intelligent mode, please post it
here or let me know.
Program that use MPU commands other than 3F and FF,
or which reset device and than give-up using it, are
most likely using intelligent mode.

Discussion

  • Srecko

    Srecko - 2004-02-15

    MPU-401 emulation files (+small fix)

     
  • Srecko

    Srecko - 2004-02-17

    update and fix for some glitch issues

     
  • Qbix

    Qbix - 2004-02-19

    Logged In: YES
    user_id=535630

    Hi Srecko,

    I took at glance at your emulator.
    I don't really agree on the proposed changes in pic.cpp

    Are you certain that the mpu has irq 2 ?

    We can discuss this futher if the mpu has to be on irq 2.
    (as then I have to reread the pic schematics:) else we have
    to think of a different irq ;)

    Thanks in advance,
    Peter

     
  • Srecko

    Srecko - 2004-02-22

    Logged In: YES
    user_id=624122

    Hi,
    I checked; Laser Squad and Curse of enchantia only run with
    mpu-401 on irq 2. Further, games' interrupt service routines
    don't deactivate IRQ, as if they expect for MPU-401 to do so
    (or want auto_eoi to be on ?). So I had to do edit edit a
    bit in pic.cpp and with that all irq problems disappeared:)
    This has effect on almost any game that uses intelligent
    mode. But some of them work even without the pic changes, I
    think because irq 0 and 1 still do the job (higher priority).
    Btw. why is irq 2 disabled in pic code ?

    Problem with MPU-401 is that it can request more data at
    once (it has 8 tracks and when track counter is 0 it
    requests data by calling IRQ for that track). Some games
    have slowdowns because of this and not much can be done to
    prevent that.
    I still have to look at "legend entertainment" games which
    send undocumented commands and data strings to mpu-401
    (when I'll have enough time for that).

     
  • Qbix

    Qbix - 2004-02-24

    Logged In: YES
    user_id=535630

    well a pic has 8 lines in and if one of the lines goes up
    the outline goes up as well (while considering the priorities)

    A pc has two pics. one pic(2) (irq 8-15) has an outline
    which is connected to the line in number 2 (irq 2) in pic 1:
    the ouline of that irq (0-7) is connected to cpu and signals
    for irq's

    So in our opinion irq can not be used as it's connected to
    pic and not the hardware (On modern systems this isn't true
    anymore)

    (So an irq 2 means that there is an irq to be handled in the
    second pic so (8-15)

     
  • Srecko

    Srecko - 2004-02-26

    Logged In: YES
    user_id=624122

    The MPU-401 manual says that Data Set Ready output of status
    port is usually connected to host's interrupt input( DSR is
    set when data is to be sent to host). Maybe device could run
    interrupts directly (i.e interrupt A), without PIC (I'm only
    guessing; i don't know if that could be done)
    Games mostly use only "irq 2". I even found in a manual of
    one offering more options that default irq for mpu-401 is 2.

     
  • Qbix

    Qbix - 2004-02-28

    Logged In: YES
    user_id=535630

    Hi Srecko,

    well It seems somehow that irq2 is rerouted to irq 9
    which irq handler calls the handler of irq2
    I need some time to really understand this info and make it
    into dosbox. I think it's wise to continue our conversation
    by email.

    Grtz Peter

     
  • Srecko

    Srecko - 2004-03-04

    new interrupt code,cleanups

     
  • Srecko

    Srecko - 2004-03-04

    Logged In: YES
    user_id=624122

    I uploaded a new version. Much was modified to use new
    interrupt handler and request buffer is replaced with
    simpler mask word. New pic modifications are also included
    in patch.

    I've run out of ideas for problems that still exist:
    1. Playback speed is bit slow with some games but normal
    with others.
    2. Legend Entertainment games do play something but sounds
    very weird compared to adlib output.
    3. Ecargxus demo likes to unset IF flag, causing delays
    (especially when scrolling).
    4. Some games experience slowdowns when much data is being
    sent. I couldn't find a cause.
    5. Implementation of "request to send data" command is not
    compatible with some games using UART mode, while otherwise
    a game wouldn't work with it modified (I learned that
    yesterday). For that reason "intelligent" variable in
    dosbox.conf will be set to false by default and mpu-401 will
    work in simple uart mode.

     
  • Qbix

    Qbix - 2004-03-10

    Logged In: YES
    user_id=535630

    mpu401 doesn't want to compile.
    I emailed you the exact responses

     
  • Srecko

    Srecko - 2004-03-10

    fixed compilation error and increased default tempo

     
  • Qbix

    Qbix - 2004-03-11

    Logged In: YES
    user_id=535630

    Okay commit it all.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.