trunk/src/mame/drivers/r2dx_v33.c
| r32182 | r32183 | |
| 26 | 26 | public: |
| 27 | 27 | r2dx_v33_state(const machine_config &mconfig, device_type type, const char *tag) |
| 28 | 28 | : raiden2_state(mconfig, type, tag), |
| 29 | | m_eeprom(*this, "eeprom") |
| 29 | m_eeprom(*this, "eeprom"), |
| 30 | m_r2dxbank(0), |
| 31 | m_r2dxgameselect(0) |
| 30 | 32 | { } |
| 31 | 33 | |
| 32 | 34 | optional_device<eeprom_serial_93cxx_device> m_eeprom; |
| r32182 | r32183 | |
| 48 | 50 | DECLARE_WRITE16_MEMBER(mcu_prog_w2); |
| 49 | 51 | DECLARE_WRITE16_MEMBER(mcu_prog_offs_w); |
| 50 | 52 | DECLARE_WRITE16_MEMBER(rdx_v33_eeprom_w); |
| 53 | DECLARE_WRITE16_MEMBER(r2dx_rom_bank_w); |
| 51 | 54 | DECLARE_DRIVER_INIT(rdx_v33); |
| 52 | 55 | DECLARE_DRIVER_INIT(nzerotea); |
| 53 | 56 | DECLARE_DRIVER_INIT(zerotm2k); |
| 54 | 57 | |
| 58 | void r2dx_setbanking(void); |
| 59 | |
| 55 | 60 | DECLARE_MACHINE_RESET(r2dx_v33); |
| 56 | 61 | DECLARE_MACHINE_RESET(nzeroteam); |
| 57 | 62 | |
| 63 | int m_r2dxbank; |
| 64 | int m_r2dxgameselect; |
| 65 | |
| 58 | 66 | UINT32 screen_update_rdx_v33(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 59 | 67 | INTERRUPT_GEN_MEMBER(rdx_v33_interrupt); |
| 60 | 68 | void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri); |
| r32182 | r32183 | |
| 84 | 92 | } |
| 85 | 93 | } |
| 86 | 94 | |
| 95 | void 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 | |
| 87 | 102 | WRITE16_MEMBER(r2dx_v33_state::rdx_v33_eeprom_w) |
| 88 | 103 | { |
| 89 | 104 | if (ACCESSING_BITS_0_7) |
| r32182 | r32183 | |
| 97 | 112 | |
| 98 | 113 | // 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?) |
| 99 | 114 | // 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; |
| 101 | 118 | text_layer->mark_all_dirty(); |
| 102 | 119 | |
| 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(); |
| 116 | 121 | |
| 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); |
| 119 | 123 | } |
| 120 | 124 | else |
| 121 | 125 | { |
| r32182 | r32183 | |
| 200 | 204 | //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]); |
| 201 | 205 | } |
| 202 | 206 | |
| 207 | WRITE16_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(); |
| 203 | 212 | |
| 213 | } |
| 214 | |
| 215 | |
| 204 | 216 | static ADDRESS_MAP_START( rdx_v33_map, AS_PROGRAM, 16, r2dx_v33_state ) |
| 205 | 217 | AM_RANGE(0x00000, 0x003ff) AM_RAM // vectors copied here |
| 206 | 218 | |
| 219 | AM_RANGE(0x00404, 0x00405) AM_WRITE(r2dx_rom_bank_w) |
| 207 | 220 | AM_RANGE(0x00406, 0x00407) AM_WRITE(tile_bank_w) |
| 208 | 221 | |
| 209 | 222 | // AM_RANGE(0x00400, 0x00407) AM_WRITE(mcu_table_w) |
| r32182 | r32183 | |
| 219 | 232 | // AM_RANGE(0x00650, 0x0068f) AM_RAM //??? |
| 220 | 233 | |
| 221 | 234 | // 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) |
| 224 | 237 | // AM_RANGE(0x006b4, 0x006b5) AM_WRITENOP |
| 225 | 238 | // 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) |
| 227 | 240 | // AM_RANGE(0x006be, 0x006bf) AM_WRITENOP // MCU program related |
| 228 | 241 | |
| 229 | 242 | // sprite protection not 100% verified as the same |