Previous 199869 Revisions Next

r17672 Thursday 6th September, 2012 at 09:02:11 UTC by Tafoid
Some notes / observations + changes to act as an example so you can see what I'm talking about (and a fix to the input ports), regarding ttchamp.c.  From Haze (nw)
[src/mame/drivers]ttchamp.c

trunk/src/mame/drivers/ttchamp.c
r17671r17672
4949{
5050public:
5151   ttchamp_state(const machine_config &mconfig, device_type type, const char *tag)
52      : driver_device(mconfig, type, tag) ,
53      m_peno_vram(*this, "peno_vram"){ }
52      : driver_device(mconfig, type, tag)
53   { }
5454
55   required_shared_ptr<UINT16> m_peno_vram;
55   UINT16* m_peno_vram;
56   UINT16* m_peno_mainram;
57
5658   UINT16 m_paloff;
5759   DECLARE_WRITE16_MEMBER(paloff_w);
5860   DECLARE_WRITE16_MEMBER(pcup_prgbank_w);
r17671r17672
6062   DECLARE_READ16_MEMBER(peno_rand);
6163   DECLARE_READ16_MEMBER(peno_rand2);
6264   DECLARE_DRIVER_INIT(ttchamp);
65
66   DECLARE_WRITE16_MEMBER( penocup_vid_w )
67   {
68      offset &=0x7fff;
69      COMBINE_DATA(&m_peno_vram[offset]);
70   }
71
72   DECLARE_READ16_MEMBER( penocup_mainram_r )
73   {
74      return m_peno_mainram[offset];
75   }
76   
77   DECLARE_WRITE16_MEMBER( penocup_mainram_w )
78   {
79      offset &=0x7fff;
80      COMBINE_DATA(&m_peno_mainram[offset]);
81//      COMBINE_DATA(&m_peno_vram[offset]);
82   }
83
84
85
6386};
6487
6588
89
6690static VIDEO_START(ttchamp)
6791{
92   ttchamp_state *state = machine.driver_data<ttchamp_state>();
93   state->m_peno_vram = (UINT16*)auto_alloc_array_clear(machine, UINT16, 0x10000/2);
94   state->m_peno_mainram = (UINT16*)auto_alloc_array_clear(machine, UINT16, 0x10000/2);
95
96   
97
6898}
6999
70100static SCREEN_UPDATE_IND16(ttchamp)
r17671r17672
88118//  }
89119
90120   count=0;
91   UINT8 *videoram = reinterpret_cast<UINT8 *>(state->m_peno_vram.target());
121   UINT8 *videoram = (UINT8*)state->m_peno_vram;
92122   for (y=0;y<yyy;y++)
93123   {
94124      for(x=0;x<xxx;x++)
r17671r17672
138168#endif
139169
140170static ADDRESS_MAP_START( ttchamp_map, AS_PROGRAM, 16, ttchamp_state )
141    AM_RANGE(0x00000, 0x0ffff) AM_RAM
142    AM_RANGE(0x10000, 0x1ffff) AM_RAM AM_SHARE("peno_vram")
143    AM_RANGE(0x20000, 0x7ffff) AM_ROMBANK("bank1") // ?
171    AM_RANGE(0x00000, 0x0ffff) AM_RAM AM_READWRITE(penocup_mainram_r, penocup_mainram_w)
172
173 /* 0x10000 - 0x1ffff is where it writes most image stuff, but other address get written to 0 where the left edge of 'sprites' would be? why? bad code execution, or some kind of write address based blitter?
174   see for example the lines written down the side of where the (not displayed) CREDIT text would go, as well as beside the actual credit number.. also ingame if you can get it to start
175 */
176   
177   AM_RANGE(0x10000, 0xfffff) AM_WRITE(penocup_vid_w)
178
179   // how are these banked? what are the bank sizes? data needed for startup is at 0x20000-0x2ffff (strings) and 0x30000-0x3ffff (code) the rest seems to be graphics..
180   AM_RANGE(0x00000, 0x7ffff) AM_ROMBANK("bank1") // ?
144181    AM_RANGE(0x80000, 0xfffff) AM_ROMBANK("bank2") // ?
145182ADDRESS_MAP_END
146183
r17671r17672
170207    PORT_START("SYSTEM")
171208    PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
172209    PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
173    PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
174    PORT_DIPSETTING(    0x0004, DEF_STR( Off ) )
175    PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
210   PORT_SERVICE( 0x0004, IP_ACTIVE_LOW )
176211    PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
177212    PORT_DIPSETTING(    0x0008, DEF_STR( Off ) )
178213    PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
r17671r17672
229264    PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
230265    PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
231266    PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
232    PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START1 )
267    PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
233268
234269INPUT_PORTS_END
235270
r17671r17672
339374DRIVER_INIT_MEMBER(ttchamp_state,ttchamp)
340375{
341376   UINT8 *ROM1 = machine().root_device().memregion("user1")->base();
342   machine().root_device().membank("bank1")->set_base(&ROM1[0x120000]);
377   machine().root_device().membank("bank1")->set_base(&ROM1[0x100000]);
343378   machine().root_device().membank("bank2")->set_base(&ROM1[0x180000]);
344379}
345380

Previous 199869 Revisions Next


© 1997-2024 The MAME Team