Author Topic: Porting MAME drivers (vbt's work in progress)  (Read 60349 times)

Offline vbt

  • FBNeo Contributor
  • *****
  • Posts: 205
  • Karma: +9005/-0
Porting MAME drivers (vbt's work in progress)
« on: October 16, 2011, 03:54:54 PM »
any good method to do that ? should i start with latest sources our olders ones (0.33) ?
« Last Edit: August 14, 2015, 04:16:01 PM by iq_132 »

Offline Barry Harris

  • dontbeabarry
  • *
  • Posts: 1785
  • Karma: +0/-65535
  • I'm Barry Harris and I like to f*** people over
Re: Porting MAME drivers
« Reply #1 on: October 16, 2011, 04:31:46 PM »
iq did a very good, very well commented driver at one stage that documented a lot of the things that need to be done. I'm not sure which it is off the top of my head, but when iq pops in he may remember which it was.

That would be the best starting point. Either that or pick something that's already been done and is simple. The News driver is pretty simple and only took me about half an hour years ago. If you port that first, then if you get stuck you could always refer to the FB Alpha driver.
Account of Barry Harris; the traitor.
Send me an e-mail at barry@fbalpha.com letting me know how big of a piece of sh** I am.

Offline iq_132

  • Administrator
  • *****
  • Posts: 3728
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: Porting MAME drivers
« Reply #2 on: October 17, 2011, 09:36:10 AM »
here ya go!
http://neo-source.com/index.php?topic=1332.msg10974#msg10974

If you have any questions, send me a pm on here, post a message here, or message me on msn messenger.
I will get back to you sooner or later.


Offline vbt

  • FBNeo Contributor
  • *****
  • Posts: 205
  • Karma: +9005/-0
Re: Porting MAME drivers
« Reply #3 on: October 24, 2011, 02:57:04 PM »
Little try, a new game on system 1 driver (not finished). At least it boots.


Offline Barry Harris

  • dontbeabarry
  • *
  • Posts: 1785
  • Karma: +0/-65535
  • I'm Barry Harris and I like to f*** people over
Re: Porting MAME drivers
« Reply #4 on: October 24, 2011, 03:09:29 PM »
Cool, saves me having to go back and do them - I can never get motivated enough for them!

Good luck!
Account of Barry Harris; the traitor.
Send me an e-mail at barry@fbalpha.com letting me know how big of a piece of sh** I am.

Offline vbt

  • FBNeo Contributor
  • *****
  • Posts: 205
  • Karma: +9005/-0
Re: Porting MAME drivers
« Reply #5 on: November 01, 2011, 07:54:45 PM »
well, it's more less working on saturn, pc & XB360 (Lantus work & help :))
i got some troubles with inputlist & diplist, can you help on how to map mame data with fba data :

Quote
static struct BurnDIPInfo ChplftbDIPList[]=
{
   // Default Values
   {0x0f, 0xff, 0xff, 0xbe, NULL                     },
   {0xf0, 0xff, 0xff, 0xff, NULL                     },

   // Dip 1
   {0   , 0xfe, 0   , 2   , "Cabinet"                },
   {0x0f, 0x01, 0x01, 0x00, "Upright"                },
   {0x0f, 0x01, 0x01, 0x01, "Cocktail"               },
   
   {0   , 0xfe, 0   , 4   , "Lives"                  },
   {0x0f, 0x01, 0x0c, 0x04, "3"                      },
   {0x0f, 0x01, 0x0c, 0x0c, "4"                      },
   {0x0f, 0x01, 0x06, 0x08, "5"                      },

   {0   , 0xfe, 0   , 2   , "Demo Sounds"            },
   {0x0f, 0x01, 0x40, 0x40, "Off"                    },
   {0x0f, 0x01, 0x40, 0x00, "On"                     },
   
   // Dip 2
   {0   , 0xfe, 0   , 8   , "Coinage"                },
   {0x10, 0x01, 0x07, 0x04, "4 Coins 1 Credit"       },
   {0x10, 0x01, 0x07, 0x05, "3 Coins 1 Credit"       },
   {0x10, 0x01, 0x07, 0x00, "4 Coins 2 Credits"      },
   {0x10, 0x01, 0x07, 0x06, "2 Coins 1 Credit"       },
   {0x10, 0x01, 0x07, 0x01, "3 Coins 2 Credits"      },
   {0x10, 0x01, 0x07, 0x02, "2 Coins 1 Credits"      },
   {0x10, 0x01, 0x07, 0x07, "1 Coin  1 Credit"       },
   {0x10, 0x01, 0x07, 0x03, "1 Coin  2 Credits"      },

   {0   , 0xfe, 0   , 2   , "Allow Continue"         },
   {0x10, 0x01, 0x10, 0x00, "Off"                    },
   {0x10, 0x01, 0x10, 0x10, "On"                     },
   
   {0   , 0xfe, 0   , 4   , "Mode"                   },
   {0x10, 0x01, 0xc0, 0xc0, "Normal Game"            },
   {0x10, 0x01, 0xc0, 0x80, "Free Play"              },
   {0x10, 0x01, 0xc0, 0x40, "Test Mode"              },
   {0x10, 0x01, 0xc0, 0x00, "Endless Game"           },
};
Quote
static struct BurnInputInfo ChplftbInputList[] = {
   {"Coin 1"            , BIT_DIGITAL  , System1InputPort2 + 0, "p1 coin"   },
   {"Start 1"           , BIT_DIGITAL  , System1InputPort2 + 4, "p1 start"  },
   {"Coin 2"            , BIT_DIGITAL  , System1InputPort2 + 1, "p2 coin"   },
   {"Start 2"           , BIT_DIGITAL  , System1InputPort2 + 5, "p2 start"  },

   {"P1 Up"             , BIT_DIGITAL  , System1InputPort0 + 5, "p1 up"     },
   {"P1 Down"           , BIT_DIGITAL  , System1InputPort0 + 4, "p1 down"   },
   {"P1 Left"           , BIT_DIGITAL  , System1InputPort0 + 7, "p1 left"   },
   {"P1 Right"          , BIT_DIGITAL  , System1InputPort0 + 6, "p1 right"  },
   {"P1 Fire 1"         , BIT_DIGITAL  , System1InputPort0 + 1, "p1 fire 1" },
   {"P1 Fire 2"         , BIT_DIGITAL  , System1InputPort0 + 2, "p1 fire 2" },

   {"P2 Up"             , BIT_DIGITAL  , System1InputPort1 + 5, "p2 up"     },
   {"P2 Down"           , BIT_DIGITAL  , System1InputPort1 + 4, "p2 down"   },
   {"P2 Left"           , BIT_DIGITAL  , System1InputPort1 + 7, "p2 left"   },
   {"P2 Right"          , BIT_DIGITAL  , System1InputPort1 + 6, "p2 right"  },
   {"P2 Fire 1"         , BIT_DIGITAL  , System1InputPort1 + 1, "p2 fire 1" },
   {"P2 Fire 2"         , BIT_DIGITAL  , System1InputPort1 + 2, "p2 fire 2" },

   {"Reset"             , BIT_DIGITAL  , &System1Reset        , "reset"     },
   {"Service"           , BIT_DIGITAL  , System1InputPort2 + 3, "service"   },
   {"Test"              , BIT_DIGITAL  , System1InputPort2 + 2, "diag"      },
   {"Dip 1"             , BIT_DIPSWITCH, System1Dip + 0       , "dip"       },
   {"Dip 2"             , BIT_DIPSWITCH, System1Dip + 1       , "dip"       },

};

Quote
  811      PORT_START("P1")
  812      PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
  813      PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
  814      PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
  815      PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  816      PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
  817      PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
  818      PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
  819      PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
  820 
  821      PORT_START("P2")
  822      PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
  823      PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
  824      PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
  825      PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  826      PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
  827      PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
  828      PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
  829      PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
  830 
  831      PORT_START("SYSTEM")
  832      PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  833      PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  834      PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )
  835      PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
  836      PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
  837      PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
  838      PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  839      PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )




1623  static INPUT_PORTS_START( choplift )
 1624      PORT_INCLUDE( system1_generic )
 1625 
 1626      PORT_MODIFY("SWB")
 1627      PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )       PORT_DIPLOCATION("SWA:1,2,3,4")
 1628      PORT_DIPSETTING(    0x07, DEF_STR( 4C_1C ) )
 1629      PORT_DIPSETTING(    0x08, DEF_STR( 3C_1C ) )
 1630      PORT_DIPSETTING(    0x09, DEF_STR( 2C_1C ) )
 1631      PORT_DIPSETTING(    0x05, "2 Coins/1 Credit 5/3 6/4" )
 1632      PORT_DIPSETTING(    0x04, "2 Coins/1 Credit 4/3" )
 1633      PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
 1634      PORT_DIPSETTING(    0x01, "1 Coin/1 Credit 2/3" )
 1635      PORT_DIPSETTING(    0x02, "1 Coin/1 Credit 4/5" )
 1636      PORT_DIPSETTING(    0x03, "1 Coin/1 Credit 5/6" )
 1637      PORT_DIPSETTING(    0x06, DEF_STR( 2C_3C ) )
 1638      PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
 1639      PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
 1640      PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
 1641      PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
 1642      PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
 1643      PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )       PORT_DIPLOCATION("SWA:5,6,7,8")
 1644      PORT_DIPSETTING(    0x70, DEF_STR( 4C_1C ) )
 1645      PORT_DIPSETTING(    0x80, DEF_STR( 3C_1C ) )
 1646      PORT_DIPSETTING(    0x90, DEF_STR( 2C_1C ) )
 1647      PORT_DIPSETTING(    0x50, "2 Coins/1 Credit 5/3 6/4" )
 1648      PORT_DIPSETTING(    0x40, "2 Coins/1 Credit 4/3" )
 1649      PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
 1650      PORT_DIPSETTING(    0x10, "1 Coin/1 Credit 2/3" )
 1651      PORT_DIPSETTING(    0x20, "1 Coin/1 Credit 4/5" )
 1652      PORT_DIPSETTING(    0x30, "1 Coin/1 Credit 5/6" )
 1653      PORT_DIPSETTING(    0x60, DEF_STR( 2C_3C ) )
 1654      PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
 1655      PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
 1656      PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
 1657      PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
 1658      PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
 1659 
 1660      PORT_MODIFY("SWA")
 1661      PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )      PORT_DIPLOCATION("SWB:1")
 1662      PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
 1663      PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
 1664      PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )  PORT_DIPLOCATION("SWB:2")
 1665      PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
 1666      PORT_DIPSETTING(    0x00, DEF_STR( On ) )
 1667      PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )        PORT_DIPLOCATION("SWB:3,4")
 1668      PORT_DIPSETTING(    0x08, "2" )
 1669      PORT_DIPSETTING(    0x0c, "3" )
 1670      PORT_DIPSETTING(    0x04, "4" )
 1671      PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
 1672      PORT_DIPNAME( 0x10, 0x10, DEF_STR( Bonus_Life ) )   PORT_DIPLOCATION("SWB:5")
 1673      PORT_DIPSETTING(    0x10, "20k 70k 120k 170k" )
 1674      PORT_DIPSETTING(    0x00, "50k 100k 150k 200k" )
 1675      PORT_DIPNAME( 0x20, 0x00, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SWB:6")
 1676      PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
 1677      PORT_DIPSETTING(    0x20, DEF_STR( Easy ) )
 1678      PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SWB:7" )
 1679      PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SWB:8" )
 1680  INPUT_PORTS_END

in fact I got a crash in BurnDrvGetDIPInfo@InpDIPSWResetDIPs, so i've disabled this part to boot the game on pc.

Offline iq_132

  • Administrator
  • *****
  • Posts: 3728
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: Porting MAME drivers
« Reply #6 on: November 01, 2011, 09:49:50 PM »
Try this
Code: [Select]
static struct BurnDIPInfo ChplftbDIPList[]=
{
   // Default Values
   {0x13, 0xff, 0xff, 0xbe, NULL                     },
   {0x14, 0xff, 0xff, 0xff, NULL                     },

   // Dip 1
   {0   , 0xfe, 0   , 2   , "Cabinet"                },
   {0x13, 0x01, 0x01, 0x00, "Upright"                },
   {0x13, 0x01, 0x01, 0x01, "Cocktail"               },
   
   {0   , 0xfe, 0   , 4   , "Lives"                  },
   {0x13, 0x01, 0x0c, 0x04, "3"                      },
   {0x13, 0x01, 0x0c, 0x0c, "4"                      },
   {0x13, 0x01, 0x06, 0x08, "5"                      },

   {0   , 0xfe, 0   , 2   , "Demo Sounds"            },
   {0x13, 0x01, 0x40, 0x40, "Off"                    },
   {0x13, 0x01, 0x40, 0x00, "On"                     },
   
   // Dip 2
   {0   , 0xfe, 0   , 8   , "Coinage"                },
   {0x14, 0x01, 0x07, 0x04, "4 Coins 1 Credit"       },
   {0x14, 0x01, 0x07, 0x05, "3 Coins 1 Credit"       },
   {0x14, 0x01, 0x07, 0x00, "4 Coins 2 Credits"      },
   {0x14, 0x01, 0x07, 0x06, "2 Coins 1 Credit"       },
   {0x14, 0x01, 0x07, 0x01, "3 Coins 2 Credits"      },
   {0x14, 0x01, 0x07, 0x02, "2 Coins 1 Credits"      },
   {0x14, 0x01, 0x07, 0x07, "1 Coin  1 Credit"       },
   {0x14, 0x01, 0x07, 0x03, "1 Coin  2 Credits"      },

   {0   , 0xfe, 0   , 2   , "Allow Continue"         },
   {0x14, 0x01, 0x10, 0x00, "Off"                    },
   {0x14, 0x01, 0x10, 0x10, "On"                     },
   
   {0   , 0xfe, 0   , 4   , "Mode"                   },
   {0x14, 0x01, 0xc0, 0xc0, "Normal Game"            },
   {0x14, 0x01, 0xc0, 0x80, "Free Play"              },
   {0x14, 0x01, 0xc0, 0x40, "Test Mode"              },
   {0x14, 0x01, 0xc0, 0x00, "Endless Game"           },
};


Offline vbt

  • FBNeo Contributor
  • *****
  • Posts: 205
  • Karma: +9005/-0
Re: Porting MAME drivers
« Reply #7 on: November 04, 2011, 08:30:53 AM »
thanks iq  :cool: it's better, i have to fix the scrolling and it's done(surely, i'll leave some bugs).
I worked on wonder boy in monster land not encrypted and it looks like nothing work.
I'm wondering if memindex,system1init and bankswitch need to be rewritten for this game, i did :

WbmljbInputList
WbmljbDIPList (again wrong)
WbmljbInit
WbmlZ801PortRead
WbmlZ801PortWrite
WbmlZ801ProgRead
WbmlZ801ProgWrite

Offline iq_132

  • Administrator
  • *****
  • Posts: 3728
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: Porting MAME drivers
« Reply #8 on: November 04, 2011, 08:44:15 AM »
Here's how the dip switch offsets are figured out
Code: [Select]
static struct BurnInputInfo ChplftbInputList[] = {
   {"Coin 1"            , BIT_DIGITAL  , System1InputPort2 + 0, "p1 coin"   }, // 0
   {"Start 1"           , BIT_DIGITAL  , System1InputPort2 + 4, "p1 start"  }, // 1
   {"Coin 2"            , BIT_DIGITAL  , System1InputPort2 + 1, "p2 coin"   }, // 2
   {"Start 2"           , BIT_DIGITAL  , System1InputPort2 + 5, "p2 start"  }, // 3

   {"P1 Up"             , BIT_DIGITAL  , System1InputPort0 + 5, "p1 up"     }, // 4
   {"P1 Down"           , BIT_DIGITAL  , System1InputPort0 + 4, "p1 down"   }, // 5
   {"P1 Left"           , BIT_DIGITAL  , System1InputPort0 + 7, "p1 left"   }, // 6
   {"P1 Right"          , BIT_DIGITAL  , System1InputPort0 + 6, "p1 right"  }, // 7
   {"P1 Fire 1"         , BIT_DIGITAL  , System1InputPort0 + 1, "p1 fire 1" }, // 8
   {"P1 Fire 2"         , BIT_DIGITAL  , System1InputPort0 + 2, "p1 fire 2" }, // 9

   {"P2 Up"             , BIT_DIGITAL  , System1InputPort1 + 5, "p2 up"     }, // 10
   {"P2 Down"           , BIT_DIGITAL  , System1InputPort1 + 4, "p2 down"   }, // 11
   {"P2 Left"           , BIT_DIGITAL  , System1InputPort1 + 7, "p2 left"   }, // 12
   {"P2 Right"          , BIT_DIGITAL  , System1InputPort1 + 6, "p2 right"  }, // 13
   {"P2 Fire 1"         , BIT_DIGITAL  , System1InputPort1 + 1, "p2 fire 1" }, // 14
   {"P2 Fire 2"         , BIT_DIGITAL  , System1InputPort1 + 2, "p2 fire 2" }, // 15

   {"Reset"             , BIT_DIGITAL  , &System1Reset        , "reset"     }, // 16
   {"Service"           , BIT_DIGITAL  , System1InputPort2 + 3, "service"   }, // 17
   {"Test"              , BIT_DIGITAL  , System1InputPort2 + 2, "diag"      }, // 18
   {"Dip 1"             , BIT_DIPSWITCH, System1Dip + 0       , "dip"       }, // 19 (0x13)
   {"Dip 2"             , BIT_DIPSWITCH, System1Dip + 1       , "dip"       }, // 20 (0x14)
};


Offline vbt

  • FBNeo Contributor
  • *****
  • Posts: 205
  • Karma: +9005/-0
Re: Porting MAME drivers
« Reply #9 on: May 01, 2012, 06:20:59 PM »
well, scrolling is now working on choplifter, it looks to be finished. I try to merge my old version(v0.2.97.11) with the the latest one. then i add wonderboy 2.  :smilie:

Offline vbt

  • FBNeo Contributor
  • *****
  • Posts: 205
  • Karma: +9005/-0
Re: Porting MAME drivers
« Reply #10 on: May 06, 2012, 05:25:31 AM »
for feedback, source only fbad was too  big

Offline vbt

  • FBNeo Contributor
  • *****
  • Posts: 205
  • Karma: +9005/-0
Re: Porting MAME drivers
« Reply #11 on: May 09, 2012, 03:42:32 PM »
good ? bad ?

Offline Barry Harris

  • dontbeabarry
  • *
  • Posts: 1785
  • Karma: +0/-65535
  • I'm Barry Harris and I like to f*** people over
Re: Porting MAME drivers
« Reply #12 on: May 12, 2012, 12:08:14 PM »
good ? bad ?

Sorry, I haven't had chance to look at this yet, will try and take a look this weekend.
Account of Barry Harris; the traitor.
Send me an e-mail at barry@fbalpha.com letting me know how big of a piece of sh** I am.

Offline vbt

  • FBNeo Contributor
  • *****
  • Posts: 205
  • Karma: +9005/-0
Re: Porting MAME drivers
« Reply #13 on: May 28, 2012, 12:58:54 PM »
well system 2 is too much for me, any good way to debug ?

Offline vbt

  • FBNeo Contributor
  • *****
  • Posts: 205
  • Karma: +9005/-0
Re: Porting MAME drivers
« Reply #14 on: June 27, 2012, 05:43:58 PM »
ok, it's not fba main target