Previous 199869 Revisions Next

r32183 Thursday 18th September, 2014 at 20:16:54 UTC by David Haywood
better CPU banking (nw)
[src/mame/drivers]r2dx_v33.c

trunk/src/mame/drivers/r2dx_v33.c
r32182r32183
2626public:
2727   r2dx_v33_state(const machine_config &mconfig, device_type type, const char *tag)
2828      : raiden2_state(mconfig, type, tag),
29      m_eeprom(*this, "eeprom")
29      m_eeprom(*this, "eeprom"),
30      m_r2dxbank(0),
31      m_r2dxgameselect(0)
3032   { }
3133
3234   optional_device<eeprom_serial_93cxx_device> m_eeprom;
r32182r32183
4850   DECLARE_WRITE16_MEMBER(mcu_prog_w2);
4951   DECLARE_WRITE16_MEMBER(mcu_prog_offs_w);
5052   DECLARE_WRITE16_MEMBER(rdx_v33_eeprom_w);
53   DECLARE_WRITE16_MEMBER(r2dx_rom_bank_w);
5154   DECLARE_DRIVER_INIT(rdx_v33);
5255   DECLARE_DRIVER_INIT(nzerotea);
5356   DECLARE_DRIVER_INIT(zerotm2k);
5457
58   void r2dx_setbanking(void);
59
5560   DECLARE_MACHINE_RESET(r2dx_v33);
5661   DECLARE_MACHINE_RESET(nzeroteam);
5762
63   int m_r2dxbank;
64   int m_r2dxgameselect;
65
5866   UINT32 screen_update_rdx_v33(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5967   INTERRUPT_GEN_MEMBER(rdx_v33_interrupt);
6068   void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri);
r32182r32183
8492   }
8593}
8694
95void r2dx_v33_state::r2dx_setbanking(void)
96{
97   membank("bank1")->set_entry(m_r2dxgameselect*0x20 + m_r2dxbank + 16);
98   membank("bank2")->set_entry(m_r2dxgameselect*0x20 + 3);
99   membank("bank3")->set_entry(m_r2dxgameselect);
100}
101
87102WRITE16_MEMBER(r2dx_v33_state::rdx_v33_eeprom_w)
88103{
89104   if (ACCESSING_BITS_0_7)
r32182r32183
97112
98113      // 0x04 is active in Raiden DX mode, it could be part of the rom bank (which half of the rom to use) or the FG tile bank (or both?)
99114      // the bit gets set if it reads RAIDENDX from the EEPROM
100      tx_bank = (data & 0x04) >> 2;
115      m_r2dxgameselect = (data & 0x04) >> 2;
116     
117      tx_bank = m_r2dxgameselect;
101118      text_layer->mark_all_dirty();
102119
103      if (data & 4) // todo: almost certainly wrong
104      {
105         // sensible defaults if booting as RDX
106         membank("bank1")->set_entry(0x20+16);
107         membank("bank2")->set_entry(0x20+3);
108         membank("bank3")->set_entry(1);
109      }
110      else
111      {
112         membank("bank1")->set_entry(2);
113         membank("bank2")->set_entry(3);
114         membank("bank3")->set_entry(0);
115      }
120      r2dx_setbanking();
116121
117
118      if (data&0x07) printf("eeprom_w extra bits used %04x\n",data & 7);
122      if (data&0x03) printf("eeprom_w extra bits used %04x\n",data & 3);
119123   }
120124   else
121125   {
r32182r32183
200204   //popmessage("%04x %04x %04x %04x | %04x %04x %04x %04x",mcu_data[0/2],mcu_data[2/2],mcu_data[4/2],mcu_data[6/2],mcu_data[8/2],mcu_data[0xa/2],mcu_data[0xc/2],mcu_data[0xe/2]);
201205}
202206
207WRITE16_MEMBER(r2dx_v33_state::r2dx_rom_bank_w)
208{
209   printf("rom bank %04x %04x\n", data, mem_mask);
210   m_r2dxbank = data & 0xf;
211   r2dx_setbanking();
203212
213}
214
215
204216static ADDRESS_MAP_START( rdx_v33_map, AS_PROGRAM, 16, r2dx_v33_state )
205217   AM_RANGE(0x00000, 0x003ff) AM_RAM // vectors copied here
206218
219   AM_RANGE(0x00404, 0x00405) AM_WRITE(r2dx_rom_bank_w)
207220   AM_RANGE(0x00406, 0x00407) AM_WRITE(tile_bank_w)
208221
209222//   AM_RANGE(0x00400, 0x00407) AM_WRITE(mcu_table_w)
r32182r32183
219232//   AM_RANGE(0x00650, 0x0068f) AM_RAM //???
220233
221234//   AM_RANGE(0x0068e, 0x0068f) AM_WRITENOP // synch for the MCU?
222   AM_RANGE(0x006b0, 0x006b1) AM_WRITE(mcu_prog_w)
223   AM_RANGE(0x006b2, 0x006b3) AM_WRITE(mcu_prog_w2)
235//   AM_RANGE(0x006b0, 0x006b1) AM_WRITE(mcu_prog_w)
236//   AM_RANGE(0x006b2, 0x006b3) AM_WRITE(mcu_prog_w2)
224237//  AM_RANGE(0x006b4, 0x006b5) AM_WRITENOP
225238//  AM_RANGE(0x006b6, 0x006b7) AM_WRITENOP
226   AM_RANGE(0x006bc, 0x006bd) AM_WRITE(mcu_prog_offs_w)
239//   AM_RANGE(0x006bc, 0x006bd) AM_WRITE(mcu_prog_offs_w)
227240//   AM_RANGE(0x006be, 0x006bf) AM_WRITENOP // MCU program related
228241
229242   // sprite protection not 100% verified as the same

Previous 199869 Revisions Next


© 1997-2024 The MAME Team