src/mame/drivers/megadriv.c
| r11525 | r11526 | |
| 1 | | /* |
| 2 | | |
| 3 | | Megadrive / Genesis support (formerly in mess/drivers) |
| 4 | | |
| 5 | | Current Issues |
| 6 | | |
| 7 | | Timing is wrong |
| 8 | | -- DMA timing not emulated |
| 9 | | -- Sprite render timing incorrect |
| 10 | | -- Interrupt Timing Problems |
| 11 | | |
| 12 | | Known Problems |
| 13 | | -- g_lem / Lemmings (JU) (REV01) [!] |
| 14 | | Rasters are off |
| 15 | | -- g_drac / Bram Stoker's Dracula (U) [!] |
| 16 | | Doesn't work, Timing Sensisitve |
| 17 | | -- g_sscc / Sesame Street Counting Cafe (U) [!] |
| 18 | | Doesn't work |
| 19 | | -- g_fatr / Fatal Rewind (UE) [!] (and clones) |
| 20 | | Doesn't work. Timing Sensitive |
| 21 | | |
| 22 | | -- various |
| 23 | | Rasters off by 1 line, bottom line corrupt? bad frame timing? |
| 24 | | |
| 25 | | + more |
| 26 | | |
| 27 | | ToDo: |
| 28 | | |
| 29 | | Fix bugs - comprehensive testing! |
| 30 | | |
| 31 | | Add SegaCD |
| 32 | | |
| 33 | | Fix 32X support (not used by any arcade systems?) |
| 34 | | - this seems to require far greater sync and timing accuracy on rom / ram access than MAME can provide |
| 35 | | - split NTSC / PAL drivers |
| 36 | | - 36greatju: missing backup ram, has issues with golfer select due of that |
| 37 | | - bcracers: write to undefined PWM register? |
| 38 | | - fifa96 / nbajamte: dies on the gameplay, waiting for a comm change that never occurs; |
| 39 | | - marsch1: doesn't boot, Master / Slave communicates through SCI |
| 40 | | - nbajamte: missing I2C hookup, startup fails due of that (same I2C type as plain MD version); |
| 41 | | - nflquart: black screen, missing h irq? |
| 42 | | - sangoku4: black screen after the Sega logo |
| 43 | | - soulstar: OSD and player sprite isn't drawn; |
| 44 | | - tempo: intro is too fast, mostly noticeable with the PWM sound that cuts off too early when it gets to the title screen; |
| 45 | | - tmek: gameplay is clearly too fast |
| 46 | | - vrdxu: has 3d geometry bugs, caused by a SH-2 DRC bug; |
| 47 | | - vrdxu: crashes if you attempt to enter into main menu; |
| 48 | | - wwfraw: writes fb data to the cart area and expects it to be read back, kludging the cart area to be writeable makes the 32x gfxs to appear, why? |
| 49 | | - wwfwre: no 32x gfxs |
| 50 | | - xmen: black screen after that you choose the level, needs bare minimum SH-2 SCI support |
| 51 | | |
| 52 | | Known Non-Issues (confirmed on Real Genesis) |
| 53 | | Castlevania - Bloodlines (U) [!] - Pause text is missing on upside down level |
| 54 | | Blood Shot (E) (M4) [!] - corrupt texture in level 1 is correct... |
| 55 | | |
| 56 | | Cleanup / Rewrite notes: |
| 57 | | |
| 58 | | 32x Marsch tests documentation (keep start pressed at start-up for individual tests): |
| 59 | | |
| 60 | | MD side check: |
| 61 | | #1 Communication Check |
| 62 | | #2 FM Bit |
| 63 | | #3 Irq Register |
| 64 | | #4 Bank Control Register |
| 65 | | #5 DREQ Control FULL bit |
| 66 | | #6 DREQ SRC Address |
| 67 | | #7 DREQ DST Address |
| 68 | | #8 DREQ SIZE Address |
| 69 | | #9 SEGA TV Register |
| 70 | | #10 H IRQ Vector |
| 71 | | #11 PWM Control Register |
| 72 | | #12 PWM Frequency Register |
| 73 | | #13 PWM Lch Pulse Width Register |
| 74 | | #14 PWM Rch Pulse Width Register |
| 75 | | #15 PWM MONO Pulse Width Register |
| 76 | | 32x side check: |
| 77 | | #16 SH-2 Master Communication Check |
| 78 | | #17 SH-2 Slave Communication Check |
| 79 | | #18 SH-2 Master FM Bit |
| 80 | | #19 SH-2 Slave FM Bit |
| 81 | | #20 SH-2 Master IRQ Mask Register |
| 82 | | #21 SH-2 Slave IRQ Mask Register |
| 83 | | #22 SH-2 Master H Counter Register |
| 84 | | #23 SH-2 Slave H Counter Register |
| 85 | | #24 SH-2 Master PWM Timer Register |
| 86 | | #25 SH-2 Slave PWM Timer Register |
| 87 | | #26 SH-2 Master PWM Cont. Register |
| 88 | | #27 SH-2 Slave PWM Cont. Register |
| 89 | | #28 SH-2 Master PWM Freq. Register |
| 90 | | #29 SH-2 Slave PWM Freq. Register |
| 91 | | #30 SH-2 Master PWM Lch Register |
| 92 | | #31 SH-2 Slave PWM Lch Register |
| 93 | | #32 SH-2 Master PWM Rch Register |
| 94 | | #33 SH-2 Slave PWM Rch Register |
| 95 | | #34 SH-2 Master PWM Mono Register |
| 96 | | #35 SH-2 Slave PWM Mono Register |
| 97 | | #36 SH-2 Master ROM Read Check |
| 98 | | #37 SH-2 Slave ROM Read Check |
| 99 | | #38 SH-2 Serial Communication (ERROR - returns a Timeout Error) |
| 100 | | MD & 32x check: |
| 101 | | #39 MD&SH-2 Master Communication |
| 102 | | #40 MD&SH-2 Slave Communication |
| 103 | | #41 MD&SH-2 Master FM Bit R/W |
| 104 | | #42 MD&SH-2 Slave FM Bit R/W |
| 105 | | #43 MD&SH-2 Master DREQ CTL |
| 106 | | #44 MD&SH-2 Slave DREQ CTL |
| 107 | | #45 MD&SH-2 Master DREQ SRC address |
| 108 | | #46 MD&SH-2 Slave DREQ SRC address |
| 109 | | #47 MD&SH-2 Master DREQ DST address |
| 110 | | #48 MD&SH-2 Slave DREQ DST address |
| 111 | | #49 MD&SH-2 Master DREQ SIZE address |
| 112 | | #50 MD&SH-2 Slave DREQ SIZE address |
| 113 | | #51 SH-2 Master V IRQ |
| 114 | | #52 SH-2 Slave V IRQ |
| 115 | | #53 SH2 Master H IRQ (MD 0) |
| 116 | | #54 SH2 Slave H IRQ (MD 0) |
| 117 | | #55 SH2 Master H IRQ (MD 1) |
| 118 | | #56 SH2 Slave H IRQ (MD 1) |
| 119 | | #57 SH2 Master H IRQ (MD 2) |
| 120 | | #58 SH2 Slave H IRQ (MD 2) |
| 121 | | MD VDP check: |
| 122 | | #59 Bitmap Mode Register |
| 123 | | #60 Shift Register |
| 124 | | #61 Auto Fill Length Register |
| 125 | | #62 Auto Fill Start Address Register |
| 126 | | #63 V Blank BIT |
| 127 | | #64 H Blank BIT |
| 128 | | #65 Palette Enable BIT |
| 129 | | SH-2 VDP check: |
| 130 | | #66 Frame Swap BIT |
| 131 | | #67 SH-2 Master Bitmap MD |
| 132 | | #68 SH-2 Slave Bitmap MD |
| 133 | | #69 SH-2 Master Shift |
| 134 | | #70 SH-2 Slave Shift |
| 135 | | #71 SH-2 Master Fill SIZE |
| 136 | | #72 SH-2 Slave Fill SIZE |
| 137 | | #73 SH-2 Master Fill START |
| 138 | | #74 SH-2 Slave Fill START |
| 139 | | #75 SH-2 Master V Blank Bit |
| 140 | | #76 SH-2 Slave V Blank Bit |
| 141 | | #77 SH-2 Master H Blank Bit |
| 142 | | #78 SH-2 Slave H Blank Bit |
| 143 | | #79 SH-2 Master Palette Enable Bit |
| 144 | | #80 SH-2 Slave Palette Enable Bit |
| 145 | | #81 SH-2 Master Frame Swap Bit |
| 146 | | #82 SH-2 Slave Frame Swap Bit |
| 147 | | Framebuffer Check: |
| 148 | | #83 MD Frame Buffer 0 |
| 149 | | #84 MD Frame Buffer 1 |
| 150 | | #85 SH-2 Master Frame Buffer 0 |
| 151 | | #86 SH-2 Slave Frame Buffer 0 |
| 152 | | #87 SH-2 Master Frame Buffer 1 |
| 153 | | #88 SH-2 Slave Frame Buffer 1 |
| 154 | | #89 MD Frame Buffer 0 Overwrite |
| 155 | | #90 MD Frame Buffer 1 Overwrite |
| 156 | | #91 MD Frame Buffer 0 Byte Write |
| 157 | | #92 MD Frame Buffer 1 Byte Write |
| 158 | | #93 SH-2 Master Frame Buffer 0 Overwrite |
| 159 | | #94 SH-2 Slave Frame Buffer 0 Overwrite |
| 160 | | #95 SH-2 Master Frame Buffer 1 Overwrite |
| 161 | | #96 SH-2 Slave Frame Buffer 1 Overwrite |
| 162 | | #97 SH-2 Master Frame Buffer 0 Byte Write |
| 163 | | #98 SH-2 Slave Frame Buffer 0 Byte Write |
| 164 | | #99 SH-2 Master Frame Buffer 1 Byte Write |
| 165 | | #100 SH-2 Slave Frame Buffer 1 Byte Write |
| 166 | | #101 MD Frame Buffer 0 Fill Data |
| 167 | | #102 MD Frame Buffer 1 Fill Data |
| 168 | | #103 MD Frame Buffer 0 Fill Length & Address |
| 169 | | #104 MD Frame Buffer 1 Fill Length & Address |
| 170 | | #105 SH-2 Master Frame Buffer 0 Fill Data |
| 171 | | #106 SH-2 Slave Frame Buffer 0 Fill Data |
| 172 | | #107 SH-2 Master Frame Buffer 1 Fill Data |
| 173 | | #108 SH-2 Slave Frame Buffer 1 Fill Data |
| 174 | | #109 SH-2 Master Frame Buffer 0 Fill Address |
| 175 | | #110 SH-2 Slave Frame Buffer 0 Fill Address |
| 176 | | #111 SH-2 Master Frame Buffer 1 Fill Address |
| 177 | | #112 SH-2 Slave Frame Buffer 1 Fill Address |
| 178 | | #113 MD Palette R/W (Blank Mode) |
| 179 | | #114 MD Palette R/W (Display Mode) |
| 180 | | #115 MD Palette R/W (Fill Mode) |
| 181 | | #116 SH-2 Master Palette R/W (Blank Mode) |
| 182 | | #117 SH-2 Slave Palette R/W (Blank Mode) |
| 183 | | #118 SH-2 Master Palette R/W (Display Mode) |
| 184 | | #119 SH-2 Slave Palette R/W (Display Mode) |
| 185 | | #120 SH-2 Master Palette R/W (Fill Mode) |
| 186 | | #121 SH-2 Slave Palette R/W (Fill Mode) |
| 187 | | MD or SH-2 DMA check: |
| 188 | | #122 SH-2 Master CPU Write DMA (68S) (ERROR) |
| 189 | | #123 SH-2 Slave CPU Write DMA (68S) (ERROR) |
| 190 | | #124 MD ROM to VRAM DMA (asserts after this) |
| 191 | | ----- |
| 192 | | #127 SH-2 Master ROM to SDRAM DMA |
| 193 | | #128 SH-2 Slave ROM to SDRAM DMA |
| 194 | | #129 SH-2 Master ROM to Frame DMA |
| 195 | | #130 SH-2 Slave ROM to Frame DMA |
| 196 | | #131 SH-2 Master SDRAM to Frame DMA |
| 197 | | #132 SH-2 Slave SDRAM to Frame DMA |
| 198 | | #133 SH-2 Master Frame to SDRAM DMA |
| 199 | | #134 SH-2 Slave Frame to SDRAM DMA |
| 200 | | Sound Test (these don't explicitly fails): |
| 201 | | #135 MD 68k Monaural Sound |
| 202 | | #136 MD 68k L Sound |
| 203 | | #137 MD 68k R Sound |
| 204 | | #138 MD 68k L -> R Sound |
| 205 | | #139 MD 68k R -> L Sound |
| 206 | | #140 SH-2 Master Monaural Sound |
| 207 | | #141 SH-2 Master L Sound |
| 208 | | #142 SH-2 Master R Sound |
| 209 | | #143 SH-2 Master L -> R Pan |
| 210 | | #144 SH-2 Master R -> L Pan |
| 211 | | #145 SH-2 Slave Monaural Sound |
| 212 | | #146 SH-2 Slave L Sound |
| 213 | | #147 SH-2 Slave R Sound |
| 214 | | #148 SH-2 Slave L -> R Pan |
| 215 | | #149 SH-2 Slave R -> L Pan |
| 216 | | #150 SH-2 Master PWM Interrupt |
| 217 | | #151 SH-2 Slave PWM Interrupt |
| 218 | | #152 SH-2 Master PWM DMA Write (!) |
| 219 | | #153 SH-2 Slave PWM DMA Write (!) |
| 220 | | #154 Z80 PWM Monaural Sound (!) |
| 221 | | #155 Z80 PWM L Sound (!) |
| 222 | | #156 Z80 PWM R Sound (!) |
| 223 | | GFX check (these don't explicitly fails): |
| 224 | | #157 Direct Color Mode |
| 225 | | #158 Packed Pixel Mode |
| 226 | | #159 Runlength Mode |
| 227 | | #160 Runlength Mode |
| 228 | | #161 Runlength Mode |
| 229 | | |
| 230 | | |
| 231 | | ---------------------------- |
| 232 | | SegaCD notes |
| 233 | | ---------------------------- |
| 234 | | |
| 235 | | the use of the MAME tilemap system for the SegaCD 'Roz tilemap' isn't intended as a long-term |
| 236 | | solution. (In reality it's not a displayable tilemap anyway, just a source buffer which has |
| 237 | | a tilemap-like structure, from which data is copied) |
| 238 | | |
| 239 | | */ |
| 240 | | |
| 241 | | |
| 242 | | #include "emu.h" |
| 243 | | #include "includes/megadriv.h" |
| 244 | | |
| 245 | | /************************************* |
| 246 | | * |
| 247 | | * Input handlers |
| 248 | | * |
| 249 | | *************************************/ |
| 250 | | |
| 251 | | /* We need to always initialize 6 buttons pad */ |
| 252 | | static TIMER_CALLBACK( mess_io_timeout_timer_callback ) |
| 253 | | { |
| 254 | | md_cons_state *state = machine.driver_data<md_cons_state>(); |
| 255 | | state->m_mess_io_stage[(int)(FPTR)ptr] = -1; |
| 256 | | } |
| 257 | | |
| 258 | | /* J-Cart controller port */ |
| 259 | | WRITE16_HANDLER( jcart_ctrl_w ) |
| 260 | | { |
| 261 | | md_cons_state *state = space->machine().driver_data<md_cons_state>(); |
| 262 | | state->m_jcart_io_data[0] = (data & 1) << 6; |
| 263 | | state->m_jcart_io_data[1] = (data & 1) << 6; |
| 264 | | } |
| 265 | | |
| 266 | | READ16_HANDLER( jcart_ctrl_r ) |
| 267 | | { |
| 268 | | md_cons_state *state = space->machine().driver_data<md_cons_state>(); |
| 269 | | UINT16 retdata = 0; |
| 270 | | UINT8 joy[2]; |
| 271 | | |
| 272 | | if (state->m_jcart_io_data[0] & 0x40) |
| 273 | | { |
| 274 | | joy[0] = input_port_read_safe(space->machine(), "JCART3_3B", 0); |
| 275 | | joy[1] = input_port_read_safe(space->machine(), "JCART4_3B", 0); |
| 276 | | retdata = (state->m_jcart_io_data[0] & 0x40) | joy[0] | (joy[1] << 8); |
| 277 | | } |
| 278 | | else |
| 279 | | { |
| 280 | | joy[0] = ((input_port_read_safe(space->machine(), "JCART3_3B", 0) & 0xc0) >> 2) | |
| 281 | | (input_port_read_safe(space->machine(), "JCART3_3B", 0) & 0x03); |
| 282 | | joy[1] = ((input_port_read_safe(space->machine(), "JCART4_3B", 0) & 0xc0) >> 2) | |
| 283 | | (input_port_read_safe(space->machine(), "JCART4_3B", 0) & 0x03); |
| 284 | | retdata = (state->m_jcart_io_data[0] & 0x40) | joy[0] | (joy[1] << 8); |
| 285 | | } |
| 286 | | return retdata; |
| 287 | | } |
| 288 | | |
| 289 | | static void mess_init_6buttons_pad(running_machine &machine) |
| 290 | | { |
| 291 | | md_cons_state *state = machine.driver_data<md_cons_state>(); |
| 292 | | int i; |
| 293 | | |
| 294 | | for (i = 0; i < 3; i++) |
| 295 | | { |
| 296 | | state->m_mess_io_timeout[i] = machine.scheduler().timer_alloc(FUNC(mess_io_timeout_timer_callback), (void*)(FPTR)i); |
| 297 | | state->m_mess_io_stage[i] = -1; |
| 298 | | } |
| 299 | | } |
| 300 | | |
| 301 | | /* These overwrite the MAME ones in DRIVER_INIT */ |
| 302 | | /* They're needed to give the users the choice between different controllers */ |
| 303 | | static UINT8 mess_md_io_read_data_port(running_machine &machine, int portnum) |
| 304 | | { |
| 305 | | md_cons_state *state = machine.driver_data<md_cons_state>(); |
| 306 | | static const char *const pad6names[2][4] = { |
| 307 | | { "PAD1_6B", "PAD2_6B", "UNUSED", "UNUSED" }, |
| 308 | | { "EXTRA1", "EXTRA2", "UNUSED", "UNUSED" } |
| 309 | | }; |
| 310 | | static const char *const pad3names[4] = { "PAD1_3B", "PAD2_3B", "UNUSED", "UNUSED" }; |
| 311 | | |
| 312 | | UINT8 retdata; |
| 313 | | int controller; |
| 314 | | UINT8 helper_6b = (megadrive_io_ctrl_regs[portnum] & 0x3f) | 0xc0; // bits 6 & 7 always come from megadrive_io_data_regs |
| 315 | | UINT8 helper_3b = (megadrive_io_ctrl_regs[portnum] & 0x7f) | 0x80; // bit 7 always comes from megadrive_io_data_regs |
| 316 | | |
| 317 | | switch (portnum) |
| 318 | | { |
| 319 | | case 0: |
| 320 | | controller = (input_port_read(machine, "CTRLSEL") & 0x0f); |
| 321 | | break; |
| 322 | | |
| 323 | | case 1: |
| 324 | | controller = (input_port_read(machine, "CTRLSEL") & 0xf0); |
| 325 | | break; |
| 326 | | |
| 327 | | default: |
| 328 | | controller = 0; |
| 329 | | break; |
| 330 | | } |
| 331 | | |
| 332 | | /* Are we using a 6 buttons Joypad? */ |
| 333 | | if (controller) |
| 334 | | { |
| 335 | | if (megadrive_io_data_regs[portnum] & 0x40) |
| 336 | | { |
| 337 | | if (state->m_mess_io_stage[portnum] == 2) |
| 338 | | { |
| 339 | | /* here we read B, C & the additional buttons */ |
| 340 | | retdata = (megadrive_io_data_regs[portnum] & helper_6b) | |
| 341 | | (((input_port_read_safe(machine, pad6names[0][portnum], 0) & 0x30) | |
| 342 | | (input_port_read_safe(machine, pad6names[1][portnum], 0) & 0x0f)) & ~helper_6b); |
| 343 | | } |
| 344 | | else |
| 345 | | { |
| 346 | | /* here we read B, C & the directional buttons */ |
| 347 | | retdata = (megadrive_io_data_regs[portnum] & helper_6b) | |
| 348 | | ((input_port_read_safe(machine, pad6names[0][portnum], 0) & 0x3f) & ~helper_6b); |
| 349 | | } |
| 350 | | } |
| 351 | | else |
| 352 | | { |
| 353 | | if (state->m_mess_io_stage[portnum] == 1) |
| 354 | | { |
| 355 | | /* here we read ((Start & A) >> 2) | 0x00 */ |
| 356 | | retdata = (megadrive_io_data_regs[portnum] & helper_6b) | |
| 357 | | (((input_port_read_safe(machine, pad6names[0][portnum], 0) & 0xc0) >> 2) & ~helper_6b); |
| 358 | | } |
| 359 | | else if (state->m_mess_io_stage[portnum]==2) |
| 360 | | { |
| 361 | | /* here we read ((Start & A) >> 2) | 0x0f */ |
| 362 | | retdata = (megadrive_io_data_regs[portnum] & helper_6b) | |
| 363 | | ((((input_port_read_safe(machine, pad6names[0][portnum], 0) & 0xc0) >> 2) | 0x0f) & ~helper_6b); |
| 364 | | } |
| 365 | | else |
| 366 | | { |
| 367 | | /* here we read ((Start & A) >> 2) | Up and Down */ |
| 368 | | retdata = (megadrive_io_data_regs[portnum] & helper_6b) | |
| 369 | | ((((input_port_read_safe(machine, pad6names[0][portnum], 0) & 0xc0) >> 2) | |
| 370 | | (input_port_read_safe(machine, pad6names[0][portnum], 0) & 0x03)) & ~helper_6b); |
| 371 | | } |
| 372 | | } |
| 373 | | |
| 374 | | // mame_printf_debug("read io data port stage %d port %d %02x\n",mess_io_stage[portnum],portnum,retdata); |
| 375 | | |
| 376 | | retdata |= (retdata << 8); |
| 377 | | } |
| 378 | | /* Otherwise it's a 3 buttons Joypad */ |
| 379 | | else |
| 380 | | { |
| 381 | | if (megadrive_io_data_regs[portnum] & 0x40) |
| 382 | | { |
| 383 | | /* here we read B, C & the directional buttons */ |
| 384 | | retdata = (megadrive_io_data_regs[portnum] & helper_3b) | |
| 385 | | (((input_port_read_safe(machine, pad3names[portnum], 0) & 0x3f) | 0x40) & ~helper_3b); |
| 386 | | } |
| 387 | | else |
| 388 | | { |
| 389 | | /* here we read ((Start & A) >> 2) | Up and Down */ |
| 390 | | retdata = (megadrive_io_data_regs[portnum] & helper_3b) | |
| 391 | | ((((input_port_read_safe(machine, pad3names[portnum], 0) & 0xc0) >> 2) | |
| 392 | | (input_port_read_safe(machine, pad3names[portnum], 0) & 0x03) | 0x40) & ~helper_3b); |
| 393 | | } |
| 394 | | } |
| 395 | | |
| 396 | | return retdata; |
| 397 | | } |
| 398 | | |
| 399 | | |
| 400 | | static void mess_md_io_write_data_port(running_machine &machine, int portnum, UINT16 data) |
| 401 | | { |
| 402 | | md_cons_state *state = machine.driver_data<md_cons_state>(); |
| 403 | | int controller; |
| 404 | | |
| 405 | | switch (portnum) |
| 406 | | { |
| 407 | | case 0: |
| 408 | | controller = (input_port_read(machine, "CTRLSEL") & 0x0f); |
| 409 | | break; |
| 410 | | |
| 411 | | case 1: |
| 412 | | controller = (input_port_read(machine, "CTRLSEL") & 0xf0); |
| 413 | | break; |
| 414 | | |
| 415 | | default: |
| 416 | | controller = 0; |
| 417 | | break; |
| 418 | | } |
| 419 | | |
| 420 | | if (controller) |
| 421 | | { |
| 422 | | if (megadrive_io_ctrl_regs[portnum] & 0x40) |
| 423 | | { |
| 424 | | if (((megadrive_io_data_regs[portnum] & 0x40) == 0x00) && ((data & 0x40) == 0x40)) |
| 425 | | { |
| 426 | | state->m_mess_io_stage[portnum]++; |
| 427 | | state->m_mess_io_timeout[portnum]->adjust(machine.device<cpu_device>("maincpu")->cycles_to_attotime(8192)); |
| 428 | | } |
| 429 | | |
| 430 | | } |
| 431 | | } |
| 432 | | megadrive_io_data_regs[portnum] = data; |
| 433 | | //mame_printf_debug("Writing IO Data Register #%d data %04x\n",portnum,data); |
| 434 | | } |
| 435 | | |
| 436 | | |
| 437 | | /************************************* |
| 438 | | * |
| 439 | | * Input ports |
| 440 | | * |
| 441 | | *************************************/ |
| 442 | | |
| 443 | | |
| 444 | | static INPUT_PORTS_START( md ) |
| 445 | | PORT_START("CTRLSEL") /* Controller selection */ |
| 446 | | PORT_CATEGORY_CLASS( 0x0f, 0x00, "Player 1 Controller" ) |
| 447 | | PORT_CATEGORY_ITEM( 0x00, "Joystick 3 Buttons", 10 ) |
| 448 | | PORT_CATEGORY_ITEM( 0x01, "Joystick 6 Buttons", 11 ) |
| 449 | | // PORT_CATEGORY_ITEM( 0x02, "Sega Mouse", 12 ) |
| 450 | | /* there exists both a 2 buttons version of the Mouse (Jpn ver, to be used with RPGs, it |
| 451 | | can aslo be used as trackball) and a 3 buttons version (US ver, no trackball feats.) */ |
| 452 | | // PORT_CATEGORY_ITEM( 0x03, "Sega Menacer", 13 ) |
| 453 | | // PORT_CATEGORY_ITEM( 0x04, "Konami Justifier", 14 ) |
| 454 | | // PORT_CATEGORY_ITEM( 0x05, "Team Player (Sega Multitap)", 15 ) |
| 455 | | // PORT_CATEGORY_ITEM( 0x06, "4-Play (EA Multitap)", 16 ) |
| 456 | | // PORT_CATEGORY_ITEM( 0x07, "J-Cart", 17 ) |
| 457 | | PORT_CATEGORY_CLASS( 0xf0, 0x00, "Player 2 Controller" ) |
| 458 | | PORT_CATEGORY_ITEM( 0x00, "Joystick 3 Buttons", 20 ) |
| 459 | | PORT_CATEGORY_ITEM( 0x10, "Joystick 6 Buttons", 21 ) |
| 460 | | PORT_CATEGORY_CLASS( 0xf00, 0x00, "Player 3 Controller (J-Cart)" ) |
| 461 | | PORT_CATEGORY_ITEM( 0x00, "Joystick 3 Buttons", 30 ) |
| 462 | | PORT_CATEGORY_CLASS( 0xf000, 0x00, "Player 4 Controller (J-Cart)" ) |
| 463 | | PORT_CATEGORY_ITEM( 0x00, "Joystick 3 Buttons", 40 ) |
| 464 | | |
| 465 | | PORT_START("PAD1_3B") /* Joypad 1 (3 button + start) NOT READ DIRECTLY */ |
| 466 | | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(10) |
| 467 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(10) |
| 468 | | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(10) |
| 469 | | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(10) |
| 470 | | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 B") PORT_CATEGORY(10) |
| 471 | | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 C") PORT_CATEGORY(10) |
| 472 | | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 A") PORT_CATEGORY(10) |
| 473 | | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) PORT_CATEGORY(10) |
| 474 | | |
| 475 | | PORT_START("PAD2_3B") /* Joypad 2 (3 button + start) NOT READ DIRECTLY */ |
| 476 | | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(20) |
| 477 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(20) |
| 478 | | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(20) |
| 479 | | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(20) |
| 480 | | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 B") PORT_CATEGORY(20) |
| 481 | | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 C") PORT_CATEGORY(20) |
| 482 | | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 A") PORT_CATEGORY(20) |
| 483 | | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) PORT_CATEGORY(20) |
| 484 | | |
| 485 | | PORT_START("JCART3_3B") /* Joypad 3 on J-Cart (3 button + start) */ |
| 486 | | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3) PORT_CATEGORY(30) |
| 487 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3) PORT_CATEGORY(30) |
| 488 | | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3) PORT_CATEGORY(30) |
| 489 | | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3) PORT_CATEGORY(30) |
| 490 | | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_NAME("P3 B") PORT_CATEGORY(30) |
| 491 | | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) PORT_NAME("P3 C") PORT_CATEGORY(30) |
| 492 | | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_NAME("P3 A") PORT_CATEGORY(30) |
| 493 | | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(3) PORT_CATEGORY(30) |
| 494 | | |
| 495 | | PORT_START("JCART4_3B") /* Joypad 4 on J-Cart (3 button + start) */ |
| 496 | | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4) PORT_CATEGORY(40) |
| 497 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4) PORT_CATEGORY(40) |
| 498 | | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4) PORT_CATEGORY(40) |
| 499 | | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4) PORT_CATEGORY(40) |
| 500 | | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4) PORT_NAME("P4 B") PORT_CATEGORY(40) |
| 501 | | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4) PORT_NAME("P4 C") PORT_CATEGORY(40) |
| 502 | | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4) PORT_NAME("P4 A") PORT_CATEGORY(40) |
| 503 | | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(4) PORT_CATEGORY(40) |
| 504 | | |
| 505 | | PORT_START("PAD1_6B") /* Joypad 1 (6 button + start + mode) NOT READ DIRECTLY */ |
| 506 | | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(11) |
| 507 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(11) |
| 508 | | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(11) |
| 509 | | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(11) |
| 510 | | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 B") PORT_CATEGORY(11) |
| 511 | | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 C") PORT_CATEGORY(11) |
| 512 | | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 A") PORT_CATEGORY(11) |
| 513 | | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) PORT_CATEGORY(11) |
| 514 | | |
| 515 | | PORT_START("EXTRA1") /* Extra buttons for Joypad 1 (6 button + start + mode) NOT READ DIRECTLY */ |
| 516 | | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_NAME("P1 Z") PORT_CATEGORY(11) |
| 517 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1) PORT_NAME("P1 Y") PORT_CATEGORY(11) |
| 518 | | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 X") PORT_CATEGORY(11) |
| 519 | | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(1) PORT_NAME("P1 Mode") PORT_CATEGORY(11) |
| 520 | | |
| 521 | | PORT_START("PAD2_6B") /* Joypad 2 (6 button + start + mode) NOT READ DIRECTLY */ |
| 522 | | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(21) |
| 523 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(21) |
| 524 | | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(21) |
| 525 | | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(21) |
| 526 | | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 B") PORT_CATEGORY(21) |
| 527 | | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 C") PORT_CATEGORY(21) |
| 528 | | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 A") PORT_CATEGORY(21) |
| 529 | | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) PORT_CATEGORY(21) |
| 530 | | |
| 531 | | PORT_START("EXTRA2") /* Extra buttons for Joypad 2 (6 button + start + mode) NOT READ DIRECTLY */ |
| 532 | | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_NAME("P2 Z") PORT_CATEGORY(21) |
| 533 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("P2 Y") PORT_CATEGORY(21) |
| 534 | | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 X") PORT_CATEGORY(21) |
| 535 | | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(2) PORT_NAME("P2 Mode") PORT_CATEGORY(21) |
| 536 | | |
| 537 | | PORT_START("RESET") /* Buttons on Genesis Console */ |
| 538 | | PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Reset Button") PORT_IMPULSE(1) // reset, resets 68k (and..?) |
| 539 | | INPUT_PORTS_END |
| 540 | | |
| 541 | | |
| 542 | | /* MegaDrive inputs + Fake Region Selection */ |
| 543 | | /* We need this as long as we only have the US version of the SVP add-on, otherwise we could not play |
| 544 | | Non-US Virtua Racing versions. It is also handy to develop add-ons emulation without adding each |
| 545 | | region variants, while they do not even work. Once emulation is working this must disappear. */ |
| 546 | | static INPUT_PORTS_START( md_sel ) |
| 547 | | PORT_INCLUDE( md ) |
| 548 | | |
| 549 | | PORT_START("REGION") |
| 550 | | /* Region setting for Console */ |
| 551 | | PORT_CONFNAME( 0x000f, 0x0000, DEF_STR( Region ) ) |
| 552 | | PORT_CONFSETTING( 0x0000, "Use Default Choice" ) |
| 553 | | PORT_CONFSETTING( 0x0001, "US (NTSC, 60fps)" ) |
| 554 | | PORT_CONFSETTING( 0x0002, "Japan (NTSC, 60fps)" ) |
| 555 | | PORT_CONFSETTING( 0x0003, "Europe (PAL, 50fps)" ) |
| 556 | | INPUT_PORTS_END |
| 557 | | |
| 558 | | |
| 559 | | /************************************* |
| 560 | | * |
| 561 | | * Machine driver |
| 562 | | * |
| 563 | | *************************************/ |
| 564 | | |
| 565 | | static MACHINE_START( ms_megadriv ) |
| 566 | | { |
| 567 | | mess_init_6buttons_pad(machine); |
| 568 | | MACHINE_START_CALL( md_sram ); |
| 569 | | } |
| 570 | | |
| 571 | | static MACHINE_RESET( ms_megadriv ) |
| 572 | | { |
| 573 | | MACHINE_RESET_CALL( megadriv ); |
| 574 | | } |
| 575 | | |
| 576 | | static MACHINE_CONFIG_START( ms_megadriv, md_cons_state ) |
| 577 | | MCFG_FRAGMENT_ADD( md_ntsc ) |
| 578 | | |
| 579 | | MCFG_MACHINE_START( ms_megadriv ) |
| 580 | | MCFG_MACHINE_RESET( ms_megadriv ) |
| 581 | | |
| 582 | | MCFG_FRAGMENT_ADD( genesis_cartslot ) |
| 583 | | MACHINE_CONFIG_END |
| 584 | | |
| 585 | | static MACHINE_CONFIG_START( ms_megadpal, md_cons_state ) |
| 586 | | MCFG_FRAGMENT_ADD( md_pal ) |
| 587 | | |
| 588 | | MCFG_MACHINE_START( ms_megadriv ) |
| 589 | | MCFG_MACHINE_RESET( ms_megadriv ) |
| 590 | | |
| 591 | | MCFG_FRAGMENT_ADD( genesis_cartslot ) |
| 592 | | MACHINE_CONFIG_END |
| 593 | | |
| 594 | | static MACHINE_CONFIG_START( ms_megdsvp, mdsvp_state ) |
| 595 | | MCFG_FRAGMENT_ADD( md_ntsc ) |
| 596 | | MCFG_FRAGMENT_ADD( md_svp ) |
| 597 | | |
| 598 | | MCFG_MACHINE_START( ms_megadriv ) |
| 599 | | MCFG_MACHINE_RESET( ms_megadriv ) |
| 600 | | |
| 601 | | MCFG_FRAGMENT_ADD( genesis_cartslot ) |
| 602 | | MACHINE_CONFIG_END |
| 603 | | |
| 604 | | |
| 605 | | |
| 606 | | /************************************* |
| 607 | | * |
| 608 | | * ROM definition(s) |
| 609 | | * |
| 610 | | *************************************/ |
| 611 | | |
| 612 | | |
| 613 | | /* we don't use the bios rom (it's not needed and only provides security on early models) */ |
| 614 | | |
| 615 | | ROM_START(genesis) |
| 616 | | ROM_REGION(0x1415000, "maincpu", ROMREGION_ERASEFF) |
| 617 | | ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) |
| 618 | | ROM_END |
| 619 | | |
| 620 | | ROM_START(gensvp) |
| 621 | | ROM_REGION(0x1415000, "maincpu", ROMREGION_ERASEFF) |
| 622 | | ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) |
| 623 | | ROM_END |
| 624 | | |
| 625 | | ROM_START(megadriv) |
| 626 | | ROM_REGION(0x1415000, "maincpu", ROMREGION_ERASEFF) |
| 627 | | ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) |
| 628 | | ROM_END |
| 629 | | |
| 630 | | ROM_START(megadrij) |
| 631 | | ROM_REGION(0x1415000, "maincpu", ROMREGION_ERASEFF) |
| 632 | | ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) |
| 633 | | ROM_END |
| 634 | | |
| 635 | | |
| 636 | | /************************************* |
| 637 | | * |
| 638 | | * Driver initialization |
| 639 | | * |
| 640 | | *************************************/ |
| 641 | | |
| 642 | | static DRIVER_INIT( mess_md_common ) |
| 643 | | { |
| 644 | | megadrive_io_read_data_port_ptr = mess_md_io_read_data_port; |
| 645 | | megadrive_io_write_data_port_ptr = mess_md_io_write_data_port; |
| 646 | | } |
| 647 | | |
| 648 | | static DRIVER_INIT( genesis ) |
| 649 | | { |
| 650 | | DRIVER_INIT_CALL(megadriv); |
| 651 | | DRIVER_INIT_CALL(mess_md_common); |
| 652 | | megadrive_region_export = 1; |
| 653 | | megadrive_region_pal = 0; |
| 654 | | } |
| 655 | | |
| 656 | | static DRIVER_INIT( gensvp ) |
| 657 | | { |
| 658 | | DRIVER_INIT_CALL(megadriv); |
| 659 | | DRIVER_INIT_CALL(mess_md_common); |
| 660 | | megadrive_region_export = 1; |
| 661 | | megadrive_region_pal = 0; |
| 662 | | } |
| 663 | | |
| 664 | | static DRIVER_INIT( md_eur ) |
| 665 | | { |
| 666 | | DRIVER_INIT_CALL(megadrie); |
| 667 | | DRIVER_INIT_CALL(mess_md_common); |
| 668 | | megadrive_region_export = 1; |
| 669 | | megadrive_region_pal = 1; |
| 670 | | } |
| 671 | | |
| 672 | | static DRIVER_INIT( md_jpn ) |
| 673 | | { |
| 674 | | DRIVER_INIT_CALL(megadrij); |
| 675 | | DRIVER_INIT_CALL(mess_md_common); |
| 676 | | megadrive_region_export = 0; |
| 677 | | megadrive_region_pal = 0; |
| 678 | | } |
| 679 | | |
| 680 | | /****************************************** SegaCD & 32X emulation ****************************************/ |
| 681 | | |
| 682 | | /* Very preliminary skeleton code from David Haywood, borrowed for MESS by Fabio Priuli */ |
| 683 | | /* These are only included to document BIOS informations currently available */ |
| 684 | | |
| 685 | | static DRIVER_INIT( mess_32x ) |
| 686 | | { |
| 687 | | DRIVER_INIT_CALL(_32x); |
| 688 | | DRIVER_INIT_CALL(mess_md_common); |
| 689 | | megadrive_region_export = 1; |
| 690 | | megadrive_region_pal = 0; |
| 691 | | } |
| 692 | | |
| 693 | | static MACHINE_CONFIG_DERIVED( ms_32x, genesis_32x ) |
| 694 | | |
| 695 | | MCFG_FRAGMENT_ADD( _32x_cartslot ) |
| 696 | | MACHINE_CONFIG_END |
| 697 | | |
| 698 | | |
| 699 | | ROM_START( 32x ) |
| 700 | | ROM_REGION16_BE( 0x400000, "gamecart", ROMREGION_ERASE00 ) /* 68000 Code */ |
| 701 | | // ROM_CART_LOAD("cart", 0x000000, 0x400000, ROM_NOMIRROR) |
| 702 | | |
| 703 | | ROM_REGION32_BE( 0x400000, "gamecart_sh2", ROMREGION_ERASE00 ) /* Copy for the SH2 */ |
| 704 | | // ROM_CART_LOAD("cart", 0x000000, 0x400000, ROM_NOMIRROR) |
| 705 | | |
| 706 | | ROM_REGION16_BE( 0x400000, "32x_68k_bios", 0 ) /* 68000 Code */ |
| 707 | | ROM_LOAD( "32x_g_bios.bin", 0x000000, 0x000100, CRC(5c12eae8) SHA1(dbebd76a448447cb6e524ac3cb0fd19fc065d944) ) |
| 708 | | |
| 709 | | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 710 | | // temp, rom should only be visible here when one of the regs is set, tempo needs it |
| 711 | | // ROM_CART_LOAD("cart", 0x000000, 0x400000, ROM_NOMIRROR) |
| 712 | | ROM_COPY( "32x_68k_bios", 0x0, 0x0, 0x100) |
| 713 | | |
| 714 | | ROM_REGION( 0x400000, "32x_master_sh2", 0 ) /* SH2 Code */ |
| 715 | | ROM_SYSTEM_BIOS( 0, "retail", "Mars Version 1.0 (retail)" ) |
| 716 | | ROMX_LOAD( "32x_m_bios.bin", 0x000000, 0x000800, CRC(dd9c46b8) SHA1(1e5b0b2441a4979b6966d942b20cc76c413b8c5e), ROM_BIOS(1) ) |
| 717 | | ROM_SYSTEM_BIOS( 1, "sdk", "Mars Version 1.0 (early sdk)" ) |
| 718 | | ROMX_LOAD( "32x_m_bios_sdk.bin", 0x000000, 0x000800, BAD_DUMP CRC(c7102c53) SHA1(ed73a47f186b373b8eff765f84ef26c3d9ef6cb0), ROM_BIOS(2) ) |
| 719 | | |
| 720 | | ROM_REGION( 0x400000, "32x_slave_sh2", 0 ) /* SH2 Code */ |
| 721 | | ROM_LOAD( "32x_s_bios.bin", 0x000000, 0x000400, CRC(bfda1fe5) SHA1(4103668c1bbd66c5e24558e73d4f3f92061a109a) ) |
| 722 | | ROM_END |
| 723 | | |
| 724 | | /* We need proper names for most of these BIOS ROMs! */ |
| 725 | | ROM_START( segacd ) |
| 726 | | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 727 | | /* v1.10 confirmed dump by dead_screem */ |
| 728 | | ROM_LOAD( "mpr-15045b.bin", 0x000000, 0x020000, CRC(c6d10268) SHA1(f4f315adcef9b8feb0364c21ab7f0eaf5457f3ed) ) |
| 729 | | ROM_END |
| 730 | | |
| 731 | | ROM_START( megacd ) |
| 732 | | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 733 | | /* v1.00, confirmed good dump */ |
| 734 | | ROM_LOAD( "megacd_model1_bios_1_00_e.bin", 0x000000, 0x020000, CRC(529ac15a) SHA1(f891e0ea651e2232af0c5c4cb46a0cae2ee8f356) ) |
| 735 | | ROM_END |
| 736 | | |
| 737 | | ROM_START( megacdj ) |
| 738 | | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 739 | | /* Confirmed by ElBarto */ |
| 740 | | ROM_SYSTEM_BIOS(0, "v100s", "v1.00S") |
| 741 | | ROMX_LOAD( "mpr-14088h.bin", 0x000000, 0x020000, CRC(3773d5aa) SHA1(bbf729a1aaa1667b783749299e1ad932aaf5f253), ROM_BIOS(1) | ROM_GROUPWORD | ROM_REVERSE) |
| 742 | | ROM_SYSTEM_BIOS(1, "v100p", "v1.00P") |
| 743 | | ROMX_LOAD( "megacd_model1_bios_1_00p_j.bin", 0x000000, 0x020000, CRC(9d2da8f2) SHA1(4846f448160059a7da0215a5df12ca160f26dd69), ROM_BIOS(2) ) |
| 744 | | /* Confirmed by ElBarto */ |
| 745 | | ROM_SYSTEM_BIOS(2, "v100l", "v1.00L") |
| 746 | | ROMX_LOAD( "mpr-14088c.bin", 0x000000, 0x020000, CRC(03134289) SHA1(d60cb5a53f26d6b13e354bc149217587f2301718), ROM_BIOS(3) | ROM_GROUPWORD | ROM_REVERSE) |
| 747 | | ROM_END |
| 748 | | |
| 749 | | /* Asia bios, when run in USA region will show : |
| 750 | | ERROR! |
| 751 | | THIS IS A PAL-COMPATIBLE MEGA CD |
| 752 | | FOR EXCLUSIVE USE IN SOUTHEAST ASIA. |
| 753 | | */ |
| 754 | | ROM_START( megacda ) |
| 755 | | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 756 | | ROM_LOAD( "megacd_model1_bios_1_00s_a.bin", 0x000000, 0x020000, CRC(550f30bb) SHA1(e4193c6ae44c3cea002707d2a88f1fbcced664de)) |
| 757 | | ROM_END |
| 758 | | |
| 759 | | ROM_START( segacd2 ) |
| 760 | | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 761 | | ROM_SYSTEM_BIOS(0, "v211x", "Model 2 v2.11X") |
| 762 | | ROMX_LOAD( "mpr-15764-t.bin", 0x000000, 0x020000, CRC(2e49d72c) SHA1(328a3228c29fba244b9db2055adc1ec4f7a87e6b), ROM_BIOS(1) ) |
| 763 | | ROM_SYSTEM_BIOS(1, "v200", "Model 2 v2.00") /* verified dump */ |
| 764 | | ROMX_LOAD( "us_scd2_930314.bin", 0x000000, 0x020000, CRC(8af65f58) SHA1(5a8c4b91d3034c1448aac4b5dc9a6484fce51636), ROM_BIOS(2) ) |
| 765 | | /* this is reportedly a bad dump, it has many differences from the verified dump and does not boot in Kega */ |
| 766 | | /* ROMX_LOAD( "segacd_model2_bios_2_00_u.bin", 0x000000, 0x020000, CRC(340b4be4) SHA1(bd3ee0c8ab732468748bf98953603ce772612704), ROM_BIOS(2) ) */ |
| 767 | | ROM_SYSTEM_BIOS(2, "v200w", "Model 2 v2.00W") |
| 768 | | ROMX_LOAD( "segacd_model2_bios_2_00w_u.bin", 0x000000, 0x020000, CRC(9f6f6276) SHA1(5adb6c3af218c60868e6b723ec47e36bbdf5e6f0), ROM_BIOS(3) ) |
| 769 | | ROM_END |
| 770 | | |
| 771 | | /* All confirmed good dump by ElBarto */ |
| 772 | | ROM_START( megacd2 ) |
| 773 | | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 774 | | ROM_SYSTEM_BIOS(0, "v200w", "v2.00W") |
| 775 | | ROMX_LOAD( "mpr-15512a.bin", 0x000000, 0x020000, CRC(53f1757c) SHA1(67bf3970ca5a05fd5ce3d6c446789c5d971b98a4), ROM_BIOS(1) | ROM_GROUPWORD | ROM_REVERSE ) |
| 776 | | ROM_SYSTEM_BIOS(1, "v200", "v2.00") |
| 777 | | ROMX_LOAD( "mpr-15512.bin", 0x000000, 0x020000, CRC(cb76f114) SHA1(939f173cadc41e996a3c34498da1bf55e7e18ff8), ROM_BIOS(2) | ROM_GROUPWORD | ROM_REVERSE ) |
| 778 | | ROM_END |
| 779 | | |
| 780 | | /* Confirmed good dump by ElBarto */ |
| 781 | | ROM_START( megacd2j ) |
| 782 | | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 783 | | ROM_SYSTEM_BIOS(0, "v200c", "v2.00C") |
| 784 | | ROMX_LOAD( "mpr-15398.bin", 0x000000, 0x020000, CRC(1e4344e6) SHA1(4d1251a6973d932e734ae5e8c6b9b55eb40e4143), ROM_BIOS(1) | ROM_GROUPWORD | ROM_REVERSE ) |
| 785 | | ROM_END |
| 786 | | |
| 787 | | ROM_START( laseract ) |
| 788 | | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 789 | | ROM_SYSTEM_BIOS(0, "v104", "v1.04") |
| 790 | | ROMX_LOAD( "laseractive_bios_1_04_u.bin", 0x000000, 0x020000, CRC(50cd3d23) SHA1(aa811861f8874775075bd3f53008c8aaf59b07db), ROM_BIOS(1) ) |
| 791 | | ROM_SYSTEM_BIOS(1, "v102", "v1.02") |
| 792 | | ROMX_LOAD( "laseractive_bios_1_02_u.bin", 0x000000, 0x020000, CRC(3b10cf41) SHA1(8af162223bb12fc19b414f126022910372790103), ROM_BIOS(2) ) |
| 793 | | ROM_END |
| 794 | | |
| 795 | | ROM_START( laseractj ) |
| 796 | | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 797 | | /* v1.02 */ |
| 798 | | ROM_LOAD( "laseractive_bios_1_02_j.bin", 0x000000, 0x020000, CRC(00eedb3a) SHA1(26237b333db4a4c6770297fa5e655ea95840d5d9) ) |
| 799 | | ROM_END |
| 800 | | |
| 801 | | ROM_START( xeye ) |
| 802 | | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 803 | | /* v2.00 (US), confirmed good with a chip dump */ |
| 804 | | ROM_LOAD( "g304.bin", 0x000000, 0x020000, CRC(290f8e33) SHA1(651f14d5a5e0ecb974a60c0f43b1d2006323fb09) ) |
| 805 | | ROM_END |
| 806 | | |
| 807 | | ROM_START( wmega ) |
| 808 | | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 809 | | /* v1.00 (Japan NTSC) Sega BIOS, chip-dumped */ |
| 810 | | ROM_LOAD( "g301.bin", 0x000000, 0x020000, CRC(d21fe71d) SHA1(3fc9358072f74bd24e3e297ea11b2bf15a7af891) ) |
| 811 | | ROM_END |
| 812 | | |
| 813 | | ROM_START( wmegam2 ) |
| 814 | | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 815 | | /* v2.00 */ |
| 816 | | ROM_LOAD( "wondermega_m2_bios_2_00_j.bin", 0x000000, 0x020000, CRC(2b19972f) SHA1(b3f32e409bd5508c89ed8be33d41a58d791d0e5d) ) |
| 817 | | ROM_END |
| 818 | | |
| 819 | | ROM_START( cdx ) |
| 820 | | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 821 | | /* v2.21X */ |
| 822 | | ROM_LOAD( "segacdx_bios_2_21_u.bin", 0x000000, 0x020000, CRC(d48c44b5) SHA1(2b125c0545afa089b617f2558e686ea723bdc06e) ) |
| 823 | | ROM_END |
| 824 | | |
| 825 | | ROM_START( multmega ) |
| 826 | | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 827 | | /* v2.21X */ |
| 828 | | ROM_LOAD( "opr-16140.bin", 0x000000, 0x020000, CRC(aacb851e) SHA1(75548ac9aaa6e81224499f9a1403b2b42433f5b7) ) |
| 829 | | /* the below was marked "confirmed good dump", but 0x72 and 0x73 are 0xFF, indicating a bad dump made from memory */ |
| 830 | | /* ROM_LOAD( "multimega_bios_2_21_e.bin", 0x000000, 0x020000, CRC(34d3cce1) SHA1(73fc9c014ad803e9e7d8076b3642a8a5224b3e51) ) */ |
| 831 | | ROM_END |
| 832 | | |
| 833 | | /* some games use the 32x and SegaCD together to give better quality FMV */ |
| 834 | | ROM_START( 32x_scd ) |
| 835 | | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 836 | | |
| 837 | | ROM_REGION16_BE( 0x400000, "gamecart", 0 ) /* 68000 Code */ |
| 838 | | ROM_LOAD( "mpr-15764-t.bin", 0x000000, 0x020000, CRC(2e49d72c) SHA1(328a3228c29fba244b9db2055adc1ec4f7a87e6b) ) |
| 839 | | |
| 840 | | ROM_REGION32_BE( 0x400000, "gamecart_sh2", 0 ) /* Copy for the SH2 */ |
| 841 | | ROM_COPY( "gamecart", 0x0, 0x0, 0x400000) |
| 842 | | |
| 843 | | ROM_REGION16_BE( 0x400000, "32x_68k_bios", 0 ) /* 68000 Code */ |
| 844 | | ROM_LOAD( "32x_g_bios.bin", 0x000000, 0x000100, CRC(5c12eae8) SHA1(dbebd76a448447cb6e524ac3cb0fd19fc065d944) ) |
| 845 | | |
| 846 | | ROM_REGION( 0x400000, "32x_master_sh2", 0 ) /* SH2 Code */ |
| 847 | | ROM_LOAD( "32x_m_bios.bin", 0x000000, 0x000800, CRC(dd9c46b8) SHA1(1e5b0b2441a4979b6966d942b20cc76c413b8c5e) ) |
| 848 | | |
| 849 | | ROM_REGION( 0x400000, "32x_slave_sh2", 0 ) /* SH2 Code */ |
| 850 | | ROM_LOAD( "32x_s_bios.bin", 0x000000, 0x000400, CRC(bfda1fe5) SHA1(4103668c1bbd66c5e24558e73d4f3f92061a109a) ) |
| 851 | | ROM_END |
| 852 | | |
| 853 | | |
| 854 | | /****************************************** PICO emulation ****************************************/ |
| 855 | | |
| 856 | | /* |
| 857 | | Pico Implementation By ElBarto (Emmanuel Vadot, elbarto@megadrive.org) |
| 858 | | Still missing the PCM custom chip |
| 859 | | Some game will not boot due to this |
| 860 | | |
| 861 | | Pico Info from Notaz (http://notaz.gp2x.de/docs/picodoc.txt) |
| 862 | | |
| 863 | | addr acc description |
| 864 | | -------+-----+------------ |
| 865 | | 800001 byte Version register. |
| 866 | | ?vv? ????, where v can be: |
| 867 | | 00 - hardware is for Japan |
| 868 | | 01 - European version |
| 869 | | 10 - USA version |
| 870 | | 11 - ? |
| 871 | | 800003 byte Buttons, 0 for pressed, 1 for released: |
| 872 | | bit 0: UP (white) |
| 873 | | bit 1: DOWN (orange) |
| 874 | | bit 2: LEFT (blue) |
| 875 | | bit 3: RIGHT (green) |
| 876 | | bit 4: red button |
| 877 | | bit 5: unused? |
| 878 | | bit 6: unused? |
| 879 | | bit 7: pen button |
| 880 | | 800005 byte Most significant byte of pen x coordinate. |
| 881 | | 800007 byte Least significant byte of pen x coordinate. |
| 882 | | 800009 byte Most significant byte of pen y coordinate. |
| 883 | | 80000b byte Least significant byte of pen y coordinate. |
| 884 | | 80000d byte Page register. One bit means one uncovered page sensor. |
| 885 | | 00 - storyware closed |
| 886 | | 01, 03, 07, 0f, 1f, 3f - pages 1-6 |
| 887 | | either page 5 or page 6 is often unused. |
| 888 | | 800010 word PCM data register. |
| 889 | | r/w read returns free bytes left in PCM FIFO buffer |
| 890 | | writes write data to buffer. |
| 891 | | 800012 word PCM control register. |
| 892 | | r/w For writes, it has following possible meanings: |
| 893 | | ?p?? ???? ???? ?rrr |
| 894 | | p - set to enable playback? |
| 895 | | r - sample rate / PCM data type? |
| 896 | | 0: 8kHz 4bit ADPCM? |
| 897 | | 1-7: 16kHz variants? |
| 898 | | For reads, if bit 15 is cleared, it means PCM is 'busy' or |
| 899 | | something like that, as games sometimes wait for it to become 1. |
| 900 | | 800019 byte Games write 'S' |
| 901 | | 80001b byte Games write 'E' |
| 902 | | 80001d byte Games write 'G' |
| 903 | | 80001f byte Games write 'A' |
| 904 | | |
| 905 | | */ |
| 906 | | |
| 907 | | #define PICO_PENX 1 |
| 908 | | #define PICO_PENY 2 |
| 909 | | |
| 910 | | static UINT16 pico_read_penpos(running_machine &machine, int pen) |
| 911 | | { |
| 912 | | UINT16 penpos = 0; |
| 913 | | |
| 914 | | switch (pen) |
| 915 | | { |
| 916 | | case PICO_PENX: |
| 917 | | penpos = input_port_read_safe(machine, "PENX", 0); |
| 918 | | penpos |= 0x6; |
| 919 | | penpos = penpos * 320 / 255; |
| 920 | | penpos += 0x3d; |
| 921 | | break; |
| 922 | | case PICO_PENY: |
| 923 | | penpos = input_port_read_safe(machine, "PENY", 0); |
| 924 | | penpos |= 0x6; |
| 925 | | penpos = penpos * 251 / 255; |
| 926 | | penpos += 0x1fc; |
| 927 | | break; |
| 928 | | } |
| 929 | | |
| 930 | | return penpos; |
| 931 | | } |
| 932 | | |
| 933 | | static READ16_HANDLER( pico_68k_io_read ) |
| 934 | | { |
| 935 | | pico_state *state = space->machine().driver_data<pico_state>(); |
| 936 | | UINT8 retdata = 0; |
| 937 | | |
| 938 | | switch (offset) |
| 939 | | { |
| 940 | | case 0: /* Version register ?XX?????? where XX is 00 for japan, 01 for europe and 10 for USA*/ |
| 941 | | retdata = (megadrive_region_export << 6) | (megadrive_region_pal << 5); |
| 942 | | break; |
| 943 | | case 1: |
| 944 | | retdata = input_port_read_safe(space->machine(), "PAD", 0); |
| 945 | | break; |
| 946 | | |
| 947 | | /* |
| 948 | | Still notes from notaz for the pen : |
| 949 | | |
| 950 | | The pen can be used to 'draw' either on the drawing pad or on the storyware |
| 951 | | itself. Both storyware and drawing pad are mapped on single virtual plane, where |
| 952 | | coordinates range: |
| 953 | | |
| 954 | | x: 0x03c - 0x17c |
| 955 | | y: 0x1fc - 0x2f7 (drawing pad) |
| 956 | | 0x2f8 - 0x3f3 (storyware) |
| 957 | | */ |
| 958 | | case 2: |
| 959 | | retdata = pico_read_penpos(space->machine(), PICO_PENX) >> 8; |
| 960 | | break; |
| 961 | | case 3: |
| 962 | | retdata = pico_read_penpos(space->machine(), PICO_PENX) & 0x00ff; |
| 963 | | break; |
| 964 | | case 4: |
| 965 | | retdata = pico_read_penpos(space->machine(), PICO_PENY) >> 8; |
| 966 | | break; |
| 967 | | case 5: |
| 968 | | retdata = pico_read_penpos(space->machine(), PICO_PENY) & 0x00ff; |
| 969 | | break; |
| 970 | | case 6: |
| 971 | | /* Page register : |
| 972 | | 00 - storyware closed |
| 973 | | 01, 03, 07, 0f, 1f, 3f - pages 1-6 |
| 974 | | either page 5 or page 6 is often unused. |
| 975 | | */ |
| 976 | | { |
| 977 | | UINT8 tmp = input_port_read_safe(space->machine(), "PAGE", 0); |
| 978 | | if (tmp == 2 && state->m_page_register != 0x3f) |
| 979 | | { |
| 980 | | state->m_page_register <<= 1; |
| 981 | | state->m_page_register |= 1; |
| 982 | | } |
| 983 | | if (tmp == 1 && state->m_page_register != 0x00) |
| 984 | | state->m_page_register >>= 1; |
| 985 | | retdata = state->m_page_register; |
| 986 | | break; |
| 987 | | } |
| 988 | | case 7: |
| 989 | | /* Returns free bytes left in the PCM FIFO buffer */ |
| 990 | | retdata = 0x00; |
| 991 | | break; |
| 992 | | case 8: |
| 993 | | /* |
| 994 | | For reads, if bit 15 is cleared, it means PCM is 'busy' or |
| 995 | | something like that, as games sometimes wait for it to become 1. |
| 996 | | */ |
| 997 | | retdata = 0x00; |
| 998 | | } |
| 999 | | |
| 1000 | | return retdata | retdata << 8; |
| 1001 | | } |
| 1002 | | |
| 1003 | | static WRITE16_HANDLER( pico_68k_io_write ) |
| 1004 | | { |
| 1005 | | switch (offset) |
| 1006 | | { |
| 1007 | | } |
| 1008 | | } |
| 1009 | | |
| 1010 | | static ADDRESS_MAP_START( pico_mem, AS_PROGRAM, 16 ) |
| 1011 | | AM_RANGE(0x000000, 0x3fffff) AM_ROM |
| 1012 | | |
| 1013 | | AM_RANGE(0x800000, 0x80001f) AM_READWRITE(pico_68k_io_read, pico_68k_io_write) |
| 1014 | | |
| 1015 | | AM_RANGE(0xc00000, 0xc0001f) AM_READWRITE(megadriv_vdp_r, megadriv_vdp_w) |
| 1016 | | AM_RANGE(0xe00000, 0xe0ffff) AM_RAM AM_MIRROR(0x1f0000) AM_BASE(&megadrive_ram) |
| 1017 | | ADDRESS_MAP_END |
| 1018 | | |
| 1019 | | |
| 1020 | | static INPUT_PORTS_START( pico ) |
| 1021 | | PORT_START("PAD") |
| 1022 | | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) |
| 1023 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) |
| 1024 | | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) |
| 1025 | | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) |
| 1026 | | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("Red Button") |
| 1027 | | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Pen Button") |
| 1028 | | |
| 1029 | | PORT_START("PAGE") |
| 1030 | | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("Increment Page") |
| 1031 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("Decrement Page") |
| 1032 | | |
| 1033 | | PORT_START("PENX") |
| 1034 | | PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(30) PORT_KEYDELTA(10) PORT_MINMAX(0, 255) PORT_CATEGORY(5) PORT_PLAYER(1) PORT_NAME("PEN X") |
| 1035 | | |
| 1036 | | PORT_START("PENY") |
| 1037 | | PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(30) PORT_KEYDELTA(10) PORT_MINMAX(0,255 ) PORT_CATEGORY(5) PORT_PLAYER(1) PORT_NAME("PEN Y") |
| 1038 | | |
| 1039 | | PORT_START("REGION") |
| 1040 | | /* Region setting for Console */ |
| 1041 | | PORT_DIPNAME( 0x000f, 0x0000, DEF_STR( Region ) ) |
| 1042 | | PORT_DIPSETTING( 0x0000, "Use HazeMD Default Choice" ) |
| 1043 | | PORT_DIPSETTING( 0x0001, "US (NTSC, 60fps)" ) |
| 1044 | | PORT_DIPSETTING( 0x0002, "JAPAN (NTSC, 60fps)" ) |
| 1045 | | PORT_DIPSETTING( 0x0003, "EUROPE (PAL, 50fps)" ) |
| 1046 | | INPUT_PORTS_END |
| 1047 | | |
| 1048 | | |
| 1049 | | static MACHINE_CONFIG_START( pico, pico_state ) |
| 1050 | | MCFG_FRAGMENT_ADD( md_ntsc ) |
| 1051 | | |
| 1052 | | MCFG_CPU_MODIFY("maincpu") |
| 1053 | | MCFG_CPU_PROGRAM_MAP(pico_mem) |
| 1054 | | |
| 1055 | | MCFG_DEVICE_REMOVE("genesis_snd_z80") |
| 1056 | | |
| 1057 | | MCFG_MACHINE_RESET( ms_megadriv ) |
| 1058 | | |
| 1059 | | MCFG_FRAGMENT_ADD( pico_cartslot ) |
| 1060 | | MACHINE_CONFIG_END |
| 1061 | | |
| 1062 | | static MACHINE_CONFIG_START( picopal, pico_state ) |
| 1063 | | MCFG_FRAGMENT_ADD( md_pal ) |
| 1064 | | |
| 1065 | | MCFG_CPU_MODIFY("maincpu") |
| 1066 | | MCFG_CPU_PROGRAM_MAP(pico_mem) |
| 1067 | | |
| 1068 | | MCFG_DEVICE_REMOVE("genesis_snd_z80") |
| 1069 | | |
| 1070 | | MCFG_MACHINE_RESET( ms_megadriv ) |
| 1071 | | |
| 1072 | | MCFG_FRAGMENT_ADD( pico_cartslot ) |
| 1073 | | MACHINE_CONFIG_END |
| 1074 | | |
| 1075 | | |
| 1076 | | |
| 1077 | | ROM_START( pico ) |
| 1078 | | ROM_REGION(0x1415000, "maincpu", ROMREGION_ERASEFF) |
| 1079 | | ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) |
| 1080 | | ROM_END |
| 1081 | | |
| 1082 | | ROM_START( picou ) |
| 1083 | | ROM_REGION(0x1415000, "maincpu", ROMREGION_ERASEFF) |
| 1084 | | ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) |
| 1085 | | ROM_END |
| 1086 | | |
| 1087 | | ROM_START( picoj ) |
| 1088 | | ROM_REGION(0x1415000, "maincpu", ROMREGION_ERASEFF) |
| 1089 | | ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) |
| 1090 | | ROM_END |
| 1091 | | |
| 1092 | | /*************************************************************************** |
| 1093 | | |
| 1094 | | Game driver(s) |
| 1095 | | |
| 1096 | | ***************************************************************************/ |
| 1097 | | |
| 1098 | | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ |
| 1099 | | CONS( 1989, genesis, 0, 0, ms_megadriv, md, genesis, "Sega", "Genesis (USA, NTSC)", 0) |
| 1100 | | CONS( 1993, gensvp, genesis, 0, ms_megdsvp, md_sel, gensvp, "Sega", "Genesis (USA, NTSC, w/SVP)", 0) |
| 1101 | | CONS( 1990, megadriv, genesis, 0, ms_megadpal, md, md_eur, "Sega", "Mega Drive (Europe, PAL)", 0) |
| 1102 | | CONS( 1988, megadrij, genesis, 0, ms_megadriv, md, md_jpn, "Sega", "Mega Drive (Japan, NTSC)", 0) |
| 1103 | | CONS( 1994, pico, 0, 0, picopal, pico, md_eur, "Sega", "Pico (Europe, PAL)", 0) |
| 1104 | | CONS( 1994, picou, pico, 0, pico, pico, genesis, "Sega", "Pico (USA, NTSC)", 0) |
| 1105 | | CONS( 1993, picoj, pico, 0, pico, pico, md_jpn, "Sega", "Pico (Japan, NTSC)", 0) |
| 1106 | | |
| 1107 | | /* Not Working */ |
| 1108 | | CONS( 1994, 32x, 0, 0, ms_32x, md_sel, mess_32x, "Sega", "32X", GAME_NOT_WORKING ) |
| 1109 | | CONS( 1992, segacd, 0, 0, genesis_scd_scd, md, genesis, "Sega", "Sega CD (USA, NTSC)", GAME_NOT_WORKING ) |
| 1110 | | CONS( 1993, megacd, segacd, 0, genesis_scd_mcd, md, md_eur, "Sega", "Mega-CD (Europe, PAL)", GAME_NOT_WORKING ) |
| 1111 | | CONS( 1991, megacdj, segacd, 0, genesis_scd_mcdj,md, md_jpn, "Sega", "Mega-CD (Japan, NTSC)", GAME_NOT_WORKING ) |
| 1112 | | CONS( 1991, megacda, segacd, 0, genesis_scd_mcdj,md, md_eur, "Sega", "Mega-CD (Asia, PAL)", GAME_NOT_WORKING ) |
| 1113 | | CONS( 1993, segacd2, 0, 0, genesis_scd_scd, md, genesis, "Sega", "Sega CD 2 (USA, NTSC)", GAME_NOT_WORKING ) |
| 1114 | | CONS( 1993, megacd2, segacd2, 0, genesis_scd_mcd, md, md_eur, "Sega", "Mega-CD 2 (Europe, PAL)", GAME_NOT_WORKING ) |
| 1115 | | CONS( 1993, megacd2j, segacd2, 0, genesis_scd_mcdj,md, md_jpn, "Sega", "Mega-CD 2 (Japan, NTSC)", GAME_NOT_WORKING ) |
| 1116 | | CONS( 1993, laseract, 0, 0, genesis_scd, md, genesis, "Pioneer","LaserActive (USA, NTSC)", GAME_NOT_WORKING ) |
| 1117 | | CONS( 1993, laseractj, laseract, 0, genesis_scd, md, md_jpn, "Pioneer","LaserActive (Japan, NTSC)", GAME_NOT_WORKING ) |
| 1118 | | CONS( 1993, xeye, 0, 0, genesis_scd, md, genesis, "JVC", "X'eye (USA, NTSC)", GAME_NOT_WORKING ) |
| 1119 | | CONS( 1992, wmega, xeye, 0, genesis_scd, md, md_jpn, "Sega", "Wondermega (Japan, NTSC)", GAME_NOT_WORKING ) |
| 1120 | | CONS( 1993, wmegam2, xeye, 0, genesis_scd, md, md_jpn, "Victor", "Wondermega M2 (Japan, NTSC)", GAME_NOT_WORKING ) |
| 1121 | | CONS( 1994, cdx, 0, 0, genesis_scd, md, genesis, "Sega", "CDX (USA, NTSC)", GAME_NOT_WORKING ) |
| 1122 | | CONS( 1994, multmega, cdx, 0, genesis_scd, md, md_eur, "Sega", "Multi-Mega (Europe, PAL)", GAME_NOT_WORKING ) |
| 1123 | | CONS( 1994, 32x_scd, 0, 0, genesis_32x_scd, md_sel, mess_32x, "Sega", "Sega CD (USA, NTSC, w/32X)", GAME_NOT_WORKING ) |
src/mess/drivers/megadriv.c
| r0 | r11526 | |
| 1 | /* |
| 2 | |
| 3 | Megadrive / Genesis support (formerly in mess/drivers) |
| 4 | |
| 5 | Current Issues |
| 6 | |
| 7 | Timing is wrong |
| 8 | -- DMA timing not emulated |
| 9 | -- Sprite render timing incorrect |
| 10 | -- Interrupt Timing Problems |
| 11 | |
| 12 | Known Problems |
| 13 | -- g_lem / Lemmings (JU) (REV01) [!] |
| 14 | Rasters are off |
| 15 | -- g_drac / Bram Stoker's Dracula (U) [!] |
| 16 | Doesn't work, Timing Sensisitve |
| 17 | -- g_sscc / Sesame Street Counting Cafe (U) [!] |
| 18 | Doesn't work |
| 19 | -- g_fatr / Fatal Rewind (UE) [!] (and clones) |
| 20 | Doesn't work. Timing Sensitive |
| 21 | |
| 22 | -- various |
| 23 | Rasters off by 1 line, bottom line corrupt? bad frame timing? |
| 24 | |
| 25 | + more |
| 26 | |
| 27 | ToDo: |
| 28 | |
| 29 | Fix bugs - comprehensive testing! |
| 30 | |
| 31 | Add SegaCD |
| 32 | |
| 33 | Fix 32X support (not used by any arcade systems?) |
| 34 | - this seems to require far greater sync and timing accuracy on rom / ram access than MAME can provide |
| 35 | - split NTSC / PAL drivers |
| 36 | - 36greatju: missing backup ram, has issues with golfer select due of that |
| 37 | - bcracers: write to undefined PWM register? |
| 38 | - fifa96 / nbajamte: dies on the gameplay, waiting for a comm change that never occurs; |
| 39 | - marsch1: doesn't boot, Master / Slave communicates through SCI |
| 40 | - nbajamte: missing I2C hookup, startup fails due of that (same I2C type as plain MD version); |
| 41 | - nflquart: black screen, missing h irq? |
| 42 | - sangoku4: black screen after the Sega logo |
| 43 | - soulstar: OSD and player sprite isn't drawn; |
| 44 | - tempo: intro is too fast, mostly noticeable with the PWM sound that cuts off too early when it gets to the title screen; |
| 45 | - tmek: gameplay is clearly too fast |
| 46 | - vrdxu: has 3d geometry bugs, caused by a SH-2 DRC bug; |
| 47 | - vrdxu: crashes if you attempt to enter into main menu; |
| 48 | - wwfraw: writes fb data to the cart area and expects it to be read back, kludging the cart area to be writeable makes the 32x gfxs to appear, why? |
| 49 | - wwfwre: no 32x gfxs |
| 50 | - xmen: black screen after that you choose the level, needs bare minimum SH-2 SCI support |
| 51 | |
| 52 | Known Non-Issues (confirmed on Real Genesis) |
| 53 | Castlevania - Bloodlines (U) [!] - Pause text is missing on upside down level |
| 54 | Blood Shot (E) (M4) [!] - corrupt texture in level 1 is correct... |
| 55 | |
| 56 | Cleanup / Rewrite notes: |
| 57 | |
| 58 | 32x Marsch tests documentation (keep start pressed at start-up for individual tests): |
| 59 | |
| 60 | MD side check: |
| 61 | #1 Communication Check |
| 62 | #2 FM Bit |
| 63 | #3 Irq Register |
| 64 | #4 Bank Control Register |
| 65 | #5 DREQ Control FULL bit |
| 66 | #6 DREQ SRC Address |
| 67 | #7 DREQ DST Address |
| 68 | #8 DREQ SIZE Address |
| 69 | #9 SEGA TV Register |
| 70 | #10 H IRQ Vector |
| 71 | #11 PWM Control Register |
| 72 | #12 PWM Frequency Register |
| 73 | #13 PWM Lch Pulse Width Register |
| 74 | #14 PWM Rch Pulse Width Register |
| 75 | #15 PWM MONO Pulse Width Register |
| 76 | 32x side check: |
| 77 | #16 SH-2 Master Communication Check |
| 78 | #17 SH-2 Slave Communication Check |
| 79 | #18 SH-2 Master FM Bit |
| 80 | #19 SH-2 Slave FM Bit |
| 81 | #20 SH-2 Master IRQ Mask Register |
| 82 | #21 SH-2 Slave IRQ Mask Register |
| 83 | #22 SH-2 Master H Counter Register |
| 84 | #23 SH-2 Slave H Counter Register |
| 85 | #24 SH-2 Master PWM Timer Register |
| 86 | #25 SH-2 Slave PWM Timer Register |
| 87 | #26 SH-2 Master PWM Cont. Register |
| 88 | #27 SH-2 Slave PWM Cont. Register |
| 89 | #28 SH-2 Master PWM Freq. Register |
| 90 | #29 SH-2 Slave PWM Freq. Register |
| 91 | #30 SH-2 Master PWM Lch Register |
| 92 | #31 SH-2 Slave PWM Lch Register |
| 93 | #32 SH-2 Master PWM Rch Register |
| 94 | #33 SH-2 Slave PWM Rch Register |
| 95 | #34 SH-2 Master PWM Mono Register |
| 96 | #35 SH-2 Slave PWM Mono Register |
| 97 | #36 SH-2 Master ROM Read Check |
| 98 | #37 SH-2 Slave ROM Read Check |
| 99 | #38 SH-2 Serial Communication (ERROR - returns a Timeout Error) |
| 100 | MD & 32x check: |
| 101 | #39 MD&SH-2 Master Communication |
| 102 | #40 MD&SH-2 Slave Communication |
| 103 | #41 MD&SH-2 Master FM Bit R/W |
| 104 | #42 MD&SH-2 Slave FM Bit R/W |
| 105 | #43 MD&SH-2 Master DREQ CTL |
| 106 | #44 MD&SH-2 Slave DREQ CTL |
| 107 | #45 MD&SH-2 Master DREQ SRC address |
| 108 | #46 MD&SH-2 Slave DREQ SRC address |
| 109 | #47 MD&SH-2 Master DREQ DST address |
| 110 | #48 MD&SH-2 Slave DREQ DST address |
| 111 | #49 MD&SH-2 Master DREQ SIZE address |
| 112 | #50 MD&SH-2 Slave DREQ SIZE address |
| 113 | #51 SH-2 Master V IRQ |
| 114 | #52 SH-2 Slave V IRQ |
| 115 | #53 SH2 Master H IRQ (MD 0) |
| 116 | #54 SH2 Slave H IRQ (MD 0) |
| 117 | #55 SH2 Master H IRQ (MD 1) |
| 118 | #56 SH2 Slave H IRQ (MD 1) |
| 119 | #57 SH2 Master H IRQ (MD 2) |
| 120 | #58 SH2 Slave H IRQ (MD 2) |
| 121 | MD VDP check: |
| 122 | #59 Bitmap Mode Register |
| 123 | #60 Shift Register |
| 124 | #61 Auto Fill Length Register |
| 125 | #62 Auto Fill Start Address Register |
| 126 | #63 V Blank BIT |
| 127 | #64 H Blank BIT |
| 128 | #65 Palette Enable BIT |
| 129 | SH-2 VDP check: |
| 130 | #66 Frame Swap BIT |
| 131 | #67 SH-2 Master Bitmap MD |
| 132 | #68 SH-2 Slave Bitmap MD |
| 133 | #69 SH-2 Master Shift |
| 134 | #70 SH-2 Slave Shift |
| 135 | #71 SH-2 Master Fill SIZE |
| 136 | #72 SH-2 Slave Fill SIZE |
| 137 | #73 SH-2 Master Fill START |
| 138 | #74 SH-2 Slave Fill START |
| 139 | #75 SH-2 Master V Blank Bit |
| 140 | #76 SH-2 Slave V Blank Bit |
| 141 | #77 SH-2 Master H Blank Bit |
| 142 | #78 SH-2 Slave H Blank Bit |
| 143 | #79 SH-2 Master Palette Enable Bit |
| 144 | #80 SH-2 Slave Palette Enable Bit |
| 145 | #81 SH-2 Master Frame Swap Bit |
| 146 | #82 SH-2 Slave Frame Swap Bit |
| 147 | Framebuffer Check: |
| 148 | #83 MD Frame Buffer 0 |
| 149 | #84 MD Frame Buffer 1 |
| 150 | #85 SH-2 Master Frame Buffer 0 |
| 151 | #86 SH-2 Slave Frame Buffer 0 |
| 152 | #87 SH-2 Master Frame Buffer 1 |
| 153 | #88 SH-2 Slave Frame Buffer 1 |
| 154 | #89 MD Frame Buffer 0 Overwrite |
| 155 | #90 MD Frame Buffer 1 Overwrite |
| 156 | #91 MD Frame Buffer 0 Byte Write |
| 157 | #92 MD Frame Buffer 1 Byte Write |
| 158 | #93 SH-2 Master Frame Buffer 0 Overwrite |
| 159 | #94 SH-2 Slave Frame Buffer 0 Overwrite |
| 160 | #95 SH-2 Master Frame Buffer 1 Overwrite |
| 161 | #96 SH-2 Slave Frame Buffer 1 Overwrite |
| 162 | #97 SH-2 Master Frame Buffer 0 Byte Write |
| 163 | #98 SH-2 Slave Frame Buffer 0 Byte Write |
| 164 | #99 SH-2 Master Frame Buffer 1 Byte Write |
| 165 | #100 SH-2 Slave Frame Buffer 1 Byte Write |
| 166 | #101 MD Frame Buffer 0 Fill Data |
| 167 | #102 MD Frame Buffer 1 Fill Data |
| 168 | #103 MD Frame Buffer 0 Fill Length & Address |
| 169 | #104 MD Frame Buffer 1 Fill Length & Address |
| 170 | #105 SH-2 Master Frame Buffer 0 Fill Data |
| 171 | #106 SH-2 Slave Frame Buffer 0 Fill Data |
| 172 | #107 SH-2 Master Frame Buffer 1 Fill Data |
| 173 | #108 SH-2 Slave Frame Buffer 1 Fill Data |
| 174 | #109 SH-2 Master Frame Buffer 0 Fill Address |
| 175 | #110 SH-2 Slave Frame Buffer 0 Fill Address |
| 176 | #111 SH-2 Master Frame Buffer 1 Fill Address |
| 177 | #112 SH-2 Slave Frame Buffer 1 Fill Address |
| 178 | #113 MD Palette R/W (Blank Mode) |
| 179 | #114 MD Palette R/W (Display Mode) |
| 180 | #115 MD Palette R/W (Fill Mode) |
| 181 | #116 SH-2 Master Palette R/W (Blank Mode) |
| 182 | #117 SH-2 Slave Palette R/W (Blank Mode) |
| 183 | #118 SH-2 Master Palette R/W (Display Mode) |
| 184 | #119 SH-2 Slave Palette R/W (Display Mode) |
| 185 | #120 SH-2 Master Palette R/W (Fill Mode) |
| 186 | #121 SH-2 Slave Palette R/W (Fill Mode) |
| 187 | MD or SH-2 DMA check: |
| 188 | #122 SH-2 Master CPU Write DMA (68S) (ERROR) |
| 189 | #123 SH-2 Slave CPU Write DMA (68S) (ERROR) |
| 190 | #124 MD ROM to VRAM DMA (asserts after this) |
| 191 | ----- |
| 192 | #127 SH-2 Master ROM to SDRAM DMA |
| 193 | #128 SH-2 Slave ROM to SDRAM DMA |
| 194 | #129 SH-2 Master ROM to Frame DMA |
| 195 | #130 SH-2 Slave ROM to Frame DMA |
| 196 | #131 SH-2 Master SDRAM to Frame DMA |
| 197 | #132 SH-2 Slave SDRAM to Frame DMA |
| 198 | #133 SH-2 Master Frame to SDRAM DMA |
| 199 | #134 SH-2 Slave Frame to SDRAM DMA |
| 200 | Sound Test (these don't explicitly fails): |
| 201 | #135 MD 68k Monaural Sound |
| 202 | #136 MD 68k L Sound |
| 203 | #137 MD 68k R Sound |
| 204 | #138 MD 68k L -> R Sound |
| 205 | #139 MD 68k R -> L Sound |
| 206 | #140 SH-2 Master Monaural Sound |
| 207 | #141 SH-2 Master L Sound |
| 208 | #142 SH-2 Master R Sound |
| 209 | #143 SH-2 Master L -> R Pan |
| 210 | #144 SH-2 Master R -> L Pan |
| 211 | #145 SH-2 Slave Monaural Sound |
| 212 | #146 SH-2 Slave L Sound |
| 213 | #147 SH-2 Slave R Sound |
| 214 | #148 SH-2 Slave L -> R Pan |
| 215 | #149 SH-2 Slave R -> L Pan |
| 216 | #150 SH-2 Master PWM Interrupt |
| 217 | #151 SH-2 Slave PWM Interrupt |
| 218 | #152 SH-2 Master PWM DMA Write (!) |
| 219 | #153 SH-2 Slave PWM DMA Write (!) |
| 220 | #154 Z80 PWM Monaural Sound (!) |
| 221 | #155 Z80 PWM L Sound (!) |
| 222 | #156 Z80 PWM R Sound (!) |
| 223 | GFX check (these don't explicitly fails): |
| 224 | #157 Direct Color Mode |
| 225 | #158 Packed Pixel Mode |
| 226 | #159 Runlength Mode |
| 227 | #160 Runlength Mode |
| 228 | #161 Runlength Mode |
| 229 | |
| 230 | |
| 231 | ---------------------------- |
| 232 | SegaCD notes |
| 233 | ---------------------------- |
| 234 | |
| 235 | the use of the MAME tilemap system for the SegaCD 'Roz tilemap' isn't intended as a long-term |
| 236 | solution. (In reality it's not a displayable tilemap anyway, just a source buffer which has |
| 237 | a tilemap-like structure, from which data is copied) |
| 238 | |
| 239 | */ |
| 240 | |
| 241 | |
| 242 | #include "emu.h" |
| 243 | #include "includes/megadriv.h" |
| 244 | |
| 245 | /************************************* |
| 246 | * |
| 247 | * Input handlers |
| 248 | * |
| 249 | *************************************/ |
| 250 | |
| 251 | /* We need to always initialize 6 buttons pad */ |
| 252 | static TIMER_CALLBACK( mess_io_timeout_timer_callback ) |
| 253 | { |
| 254 | md_cons_state *state = machine.driver_data<md_cons_state>(); |
| 255 | state->m_mess_io_stage[(int)(FPTR)ptr] = -1; |
| 256 | } |
| 257 | |
| 258 | /* J-Cart controller port */ |
| 259 | WRITE16_HANDLER( jcart_ctrl_w ) |
| 260 | { |
| 261 | md_cons_state *state = space->machine().driver_data<md_cons_state>(); |
| 262 | state->m_jcart_io_data[0] = (data & 1) << 6; |
| 263 | state->m_jcart_io_data[1] = (data & 1) << 6; |
| 264 | } |
| 265 | |
| 266 | READ16_HANDLER( jcart_ctrl_r ) |
| 267 | { |
| 268 | md_cons_state *state = space->machine().driver_data<md_cons_state>(); |
| 269 | UINT16 retdata = 0; |
| 270 | UINT8 joy[2]; |
| 271 | |
| 272 | if (state->m_jcart_io_data[0] & 0x40) |
| 273 | { |
| 274 | joy[0] = input_port_read_safe(space->machine(), "JCART3_3B", 0); |
| 275 | joy[1] = input_port_read_safe(space->machine(), "JCART4_3B", 0); |
| 276 | retdata = (state->m_jcart_io_data[0] & 0x40) | joy[0] | (joy[1] << 8); |
| 277 | } |
| 278 | else |
| 279 | { |
| 280 | joy[0] = ((input_port_read_safe(space->machine(), "JCART3_3B", 0) & 0xc0) >> 2) | |
| 281 | (input_port_read_safe(space->machine(), "JCART3_3B", 0) & 0x03); |
| 282 | joy[1] = ((input_port_read_safe(space->machine(), "JCART4_3B", 0) & 0xc0) >> 2) | |
| 283 | (input_port_read_safe(space->machine(), "JCART4_3B", 0) & 0x03); |
| 284 | retdata = (state->m_jcart_io_data[0] & 0x40) | joy[0] | (joy[1] << 8); |
| 285 | } |
| 286 | return retdata; |
| 287 | } |
| 288 | |
| 289 | static void mess_init_6buttons_pad(running_machine &machine) |
| 290 | { |
| 291 | md_cons_state *state = machine.driver_data<md_cons_state>(); |
| 292 | int i; |
| 293 | |
| 294 | for (i = 0; i < 3; i++) |
| 295 | { |
| 296 | state->m_mess_io_timeout[i] = machine.scheduler().timer_alloc(FUNC(mess_io_timeout_timer_callback), (void*)(FPTR)i); |
| 297 | state->m_mess_io_stage[i] = -1; |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | /* These overwrite the MAME ones in DRIVER_INIT */ |
| 302 | /* They're needed to give the users the choice between different controllers */ |
| 303 | static UINT8 mess_md_io_read_data_port(running_machine &machine, int portnum) |
| 304 | { |
| 305 | md_cons_state *state = machine.driver_data<md_cons_state>(); |
| 306 | static const char *const pad6names[2][4] = { |
| 307 | { "PAD1_6B", "PAD2_6B", "UNUSED", "UNUSED" }, |
| 308 | { "EXTRA1", "EXTRA2", "UNUSED", "UNUSED" } |
| 309 | }; |
| 310 | static const char *const pad3names[4] = { "PAD1_3B", "PAD2_3B", "UNUSED", "UNUSED" }; |
| 311 | |
| 312 | UINT8 retdata; |
| 313 | int controller; |
| 314 | UINT8 helper_6b = (megadrive_io_ctrl_regs[portnum] & 0x3f) | 0xc0; // bits 6 & 7 always come from megadrive_io_data_regs |
| 315 | UINT8 helper_3b = (megadrive_io_ctrl_regs[portnum] & 0x7f) | 0x80; // bit 7 always comes from megadrive_io_data_regs |
| 316 | |
| 317 | switch (portnum) |
| 318 | { |
| 319 | case 0: |
| 320 | controller = (input_port_read(machine, "CTRLSEL") & 0x0f); |
| 321 | break; |
| 322 | |
| 323 | case 1: |
| 324 | controller = (input_port_read(machine, "CTRLSEL") & 0xf0); |
| 325 | break; |
| 326 | |
| 327 | default: |
| 328 | controller = 0; |
| 329 | break; |
| 330 | } |
| 331 | |
| 332 | /* Are we using a 6 buttons Joypad? */ |
| 333 | if (controller) |
| 334 | { |
| 335 | if (megadrive_io_data_regs[portnum] & 0x40) |
| 336 | { |
| 337 | if (state->m_mess_io_stage[portnum] == 2) |
| 338 | { |
| 339 | /* here we read B, C & the additional buttons */ |
| 340 | retdata = (megadrive_io_data_regs[portnum] & helper_6b) | |
| 341 | (((input_port_read_safe(machine, pad6names[0][portnum], 0) & 0x30) | |
| 342 | (input_port_read_safe(machine, pad6names[1][portnum], 0) & 0x0f)) & ~helper_6b); |
| 343 | } |
| 344 | else |
| 345 | { |
| 346 | /* here we read B, C & the directional buttons */ |
| 347 | retdata = (megadrive_io_data_regs[portnum] & helper_6b) | |
| 348 | ((input_port_read_safe(machine, pad6names[0][portnum], 0) & 0x3f) & ~helper_6b); |
| 349 | } |
| 350 | } |
| 351 | else |
| 352 | { |
| 353 | if (state->m_mess_io_stage[portnum] == 1) |
| 354 | { |
| 355 | /* here we read ((Start & A) >> 2) | 0x00 */ |
| 356 | retdata = (megadrive_io_data_regs[portnum] & helper_6b) | |
| 357 | (((input_port_read_safe(machine, pad6names[0][portnum], 0) & 0xc0) >> 2) & ~helper_6b); |
| 358 | } |
| 359 | else if (state->m_mess_io_stage[portnum]==2) |
| 360 | { |
| 361 | /* here we read ((Start & A) >> 2) | 0x0f */ |
| 362 | retdata = (megadrive_io_data_regs[portnum] & helper_6b) | |
| 363 | ((((input_port_read_safe(machine, pad6names[0][portnum], 0) & 0xc0) >> 2) | 0x0f) & ~helper_6b); |
| 364 | } |
| 365 | else |
| 366 | { |
| 367 | /* here we read ((Start & A) >> 2) | Up and Down */ |
| 368 | retdata = (megadrive_io_data_regs[portnum] & helper_6b) | |
| 369 | ((((input_port_read_safe(machine, pad6names[0][portnum], 0) & 0xc0) >> 2) | |
| 370 | (input_port_read_safe(machine, pad6names[0][portnum], 0) & 0x03)) & ~helper_6b); |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | // mame_printf_debug("read io data port stage %d port %d %02x\n",mess_io_stage[portnum],portnum,retdata); |
| 375 | |
| 376 | retdata |= (retdata << 8); |
| 377 | } |
| 378 | /* Otherwise it's a 3 buttons Joypad */ |
| 379 | else |
| 380 | { |
| 381 | if (megadrive_io_data_regs[portnum] & 0x40) |
| 382 | { |
| 383 | /* here we read B, C & the directional buttons */ |
| 384 | retdata = (megadrive_io_data_regs[portnum] & helper_3b) | |
| 385 | (((input_port_read_safe(machine, pad3names[portnum], 0) & 0x3f) | 0x40) & ~helper_3b); |
| 386 | } |
| 387 | else |
| 388 | { |
| 389 | /* here we read ((Start & A) >> 2) | Up and Down */ |
| 390 | retdata = (megadrive_io_data_regs[portnum] & helper_3b) | |
| 391 | ((((input_port_read_safe(machine, pad3names[portnum], 0) & 0xc0) >> 2) | |
| 392 | (input_port_read_safe(machine, pad3names[portnum], 0) & 0x03) | 0x40) & ~helper_3b); |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | return retdata; |
| 397 | } |
| 398 | |
| 399 | |
| 400 | static void mess_md_io_write_data_port(running_machine &machine, int portnum, UINT16 data) |
| 401 | { |
| 402 | md_cons_state *state = machine.driver_data<md_cons_state>(); |
| 403 | int controller; |
| 404 | |
| 405 | switch (portnum) |
| 406 | { |
| 407 | case 0: |
| 408 | controller = (input_port_read(machine, "CTRLSEL") & 0x0f); |
| 409 | break; |
| 410 | |
| 411 | case 1: |
| 412 | controller = (input_port_read(machine, "CTRLSEL") & 0xf0); |
| 413 | break; |
| 414 | |
| 415 | default: |
| 416 | controller = 0; |
| 417 | break; |
| 418 | } |
| 419 | |
| 420 | if (controller) |
| 421 | { |
| 422 | if (megadrive_io_ctrl_regs[portnum] & 0x40) |
| 423 | { |
| 424 | if (((megadrive_io_data_regs[portnum] & 0x40) == 0x00) && ((data & 0x40) == 0x40)) |
| 425 | { |
| 426 | state->m_mess_io_stage[portnum]++; |
| 427 | state->m_mess_io_timeout[portnum]->adjust(machine.device<cpu_device>("maincpu")->cycles_to_attotime(8192)); |
| 428 | } |
| 429 | |
| 430 | } |
| 431 | } |
| 432 | megadrive_io_data_regs[portnum] = data; |
| 433 | //mame_printf_debug("Writing IO Data Register #%d data %04x\n",portnum,data); |
| 434 | } |
| 435 | |
| 436 | |
| 437 | /************************************* |
| 438 | * |
| 439 | * Input ports |
| 440 | * |
| 441 | *************************************/ |
| 442 | |
| 443 | |
| 444 | static INPUT_PORTS_START( md ) |
| 445 | PORT_START("CTRLSEL") /* Controller selection */ |
| 446 | PORT_CATEGORY_CLASS( 0x0f, 0x00, "Player 1 Controller" ) |
| 447 | PORT_CATEGORY_ITEM( 0x00, "Joystick 3 Buttons", 10 ) |
| 448 | PORT_CATEGORY_ITEM( 0x01, "Joystick 6 Buttons", 11 ) |
| 449 | // PORT_CATEGORY_ITEM( 0x02, "Sega Mouse", 12 ) |
| 450 | /* there exists both a 2 buttons version of the Mouse (Jpn ver, to be used with RPGs, it |
| 451 | can aslo be used as trackball) and a 3 buttons version (US ver, no trackball feats.) */ |
| 452 | // PORT_CATEGORY_ITEM( 0x03, "Sega Menacer", 13 ) |
| 453 | // PORT_CATEGORY_ITEM( 0x04, "Konami Justifier", 14 ) |
| 454 | // PORT_CATEGORY_ITEM( 0x05, "Team Player (Sega Multitap)", 15 ) |
| 455 | // PORT_CATEGORY_ITEM( 0x06, "4-Play (EA Multitap)", 16 ) |
| 456 | // PORT_CATEGORY_ITEM( 0x07, "J-Cart", 17 ) |
| 457 | PORT_CATEGORY_CLASS( 0xf0, 0x00, "Player 2 Controller" ) |
| 458 | PORT_CATEGORY_ITEM( 0x00, "Joystick 3 Buttons", 20 ) |
| 459 | PORT_CATEGORY_ITEM( 0x10, "Joystick 6 Buttons", 21 ) |
| 460 | PORT_CATEGORY_CLASS( 0xf00, 0x00, "Player 3 Controller (J-Cart)" ) |
| 461 | PORT_CATEGORY_ITEM( 0x00, "Joystick 3 Buttons", 30 ) |
| 462 | PORT_CATEGORY_CLASS( 0xf000, 0x00, "Player 4 Controller (J-Cart)" ) |
| 463 | PORT_CATEGORY_ITEM( 0x00, "Joystick 3 Buttons", 40 ) |
| 464 | |
| 465 | PORT_START("PAD1_3B") /* Joypad 1 (3 button + start) NOT READ DIRECTLY */ |
| 466 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(10) |
| 467 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(10) |
| 468 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(10) |
| 469 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(10) |
| 470 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 B") PORT_CATEGORY(10) |
| 471 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 C") PORT_CATEGORY(10) |
| 472 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 A") PORT_CATEGORY(10) |
| 473 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) PORT_CATEGORY(10) |
| 474 | |
| 475 | PORT_START("PAD2_3B") /* Joypad 2 (3 button + start) NOT READ DIRECTLY */ |
| 476 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(20) |
| 477 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(20) |
| 478 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(20) |
| 479 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(20) |
| 480 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 B") PORT_CATEGORY(20) |
| 481 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 C") PORT_CATEGORY(20) |
| 482 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 A") PORT_CATEGORY(20) |
| 483 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) PORT_CATEGORY(20) |
| 484 | |
| 485 | PORT_START("JCART3_3B") /* Joypad 3 on J-Cart (3 button + start) */ |
| 486 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3) PORT_CATEGORY(30) |
| 487 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3) PORT_CATEGORY(30) |
| 488 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3) PORT_CATEGORY(30) |
| 489 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3) PORT_CATEGORY(30) |
| 490 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_NAME("P3 B") PORT_CATEGORY(30) |
| 491 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) PORT_NAME("P3 C") PORT_CATEGORY(30) |
| 492 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_NAME("P3 A") PORT_CATEGORY(30) |
| 493 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(3) PORT_CATEGORY(30) |
| 494 | |
| 495 | PORT_START("JCART4_3B") /* Joypad 4 on J-Cart (3 button + start) */ |
| 496 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4) PORT_CATEGORY(40) |
| 497 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4) PORT_CATEGORY(40) |
| 498 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4) PORT_CATEGORY(40) |
| 499 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4) PORT_CATEGORY(40) |
| 500 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4) PORT_NAME("P4 B") PORT_CATEGORY(40) |
| 501 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4) PORT_NAME("P4 C") PORT_CATEGORY(40) |
| 502 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4) PORT_NAME("P4 A") PORT_CATEGORY(40) |
| 503 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(4) PORT_CATEGORY(40) |
| 504 | |
| 505 | PORT_START("PAD1_6B") /* Joypad 1 (6 button + start + mode) NOT READ DIRECTLY */ |
| 506 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(11) |
| 507 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(11) |
| 508 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(11) |
| 509 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(11) |
| 510 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 B") PORT_CATEGORY(11) |
| 511 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 C") PORT_CATEGORY(11) |
| 512 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 A") PORT_CATEGORY(11) |
| 513 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) PORT_CATEGORY(11) |
| 514 | |
| 515 | PORT_START("EXTRA1") /* Extra buttons for Joypad 1 (6 button + start + mode) NOT READ DIRECTLY */ |
| 516 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_NAME("P1 Z") PORT_CATEGORY(11) |
| 517 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1) PORT_NAME("P1 Y") PORT_CATEGORY(11) |
| 518 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 X") PORT_CATEGORY(11) |
| 519 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(1) PORT_NAME("P1 Mode") PORT_CATEGORY(11) |
| 520 | |
| 521 | PORT_START("PAD2_6B") /* Joypad 2 (6 button + start + mode) NOT READ DIRECTLY */ |
| 522 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(21) |
| 523 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(21) |
| 524 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(21) |
| 525 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(21) |
| 526 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 B") PORT_CATEGORY(21) |
| 527 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 C") PORT_CATEGORY(21) |
| 528 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 A") PORT_CATEGORY(21) |
| 529 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) PORT_CATEGORY(21) |
| 530 | |
| 531 | PORT_START("EXTRA2") /* Extra buttons for Joypad 2 (6 button + start + mode) NOT READ DIRECTLY */ |
| 532 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_NAME("P2 Z") PORT_CATEGORY(21) |
| 533 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("P2 Y") PORT_CATEGORY(21) |
| 534 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 X") PORT_CATEGORY(21) |
| 535 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(2) PORT_NAME("P2 Mode") PORT_CATEGORY(21) |
| 536 | |
| 537 | PORT_START("RESET") /* Buttons on Genesis Console */ |
| 538 | PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Reset Button") PORT_IMPULSE(1) // reset, resets 68k (and..?) |
| 539 | INPUT_PORTS_END |
| 540 | |
| 541 | |
| 542 | /* MegaDrive inputs + Fake Region Selection */ |
| 543 | /* We need this as long as we only have the US version of the SVP add-on, otherwise we could not play |
| 544 | Non-US Virtua Racing versions. It is also handy to develop add-ons emulation without adding each |
| 545 | region variants, while they do not even work. Once emulation is working this must disappear. */ |
| 546 | static INPUT_PORTS_START( md_sel ) |
| 547 | PORT_INCLUDE( md ) |
| 548 | |
| 549 | PORT_START("REGION") |
| 550 | /* Region setting for Console */ |
| 551 | PORT_CONFNAME( 0x000f, 0x0000, DEF_STR( Region ) ) |
| 552 | PORT_CONFSETTING( 0x0000, "Use Default Choice" ) |
| 553 | PORT_CONFSETTING( 0x0001, "US (NTSC, 60fps)" ) |
| 554 | PORT_CONFSETTING( 0x0002, "Japan (NTSC, 60fps)" ) |
| 555 | PORT_CONFSETTING( 0x0003, "Europe (PAL, 50fps)" ) |
| 556 | INPUT_PORTS_END |
| 557 | |
| 558 | |
| 559 | /************************************* |
| 560 | * |
| 561 | * Machine driver |
| 562 | * |
| 563 | *************************************/ |
| 564 | |
| 565 | static MACHINE_START( ms_megadriv ) |
| 566 | { |
| 567 | mess_init_6buttons_pad(machine); |
| 568 | MACHINE_START_CALL( md_sram ); |
| 569 | } |
| 570 | |
| 571 | static MACHINE_RESET( ms_megadriv ) |
| 572 | { |
| 573 | MACHINE_RESET_CALL( megadriv ); |
| 574 | } |
| 575 | |
| 576 | static MACHINE_CONFIG_START( ms_megadriv, md_cons_state ) |
| 577 | MCFG_FRAGMENT_ADD( md_ntsc ) |
| 578 | |
| 579 | MCFG_MACHINE_START( ms_megadriv ) |
| 580 | MCFG_MACHINE_RESET( ms_megadriv ) |
| 581 | |
| 582 | MCFG_FRAGMENT_ADD( genesis_cartslot ) |
| 583 | MACHINE_CONFIG_END |
| 584 | |
| 585 | static MACHINE_CONFIG_START( ms_megadpal, md_cons_state ) |
| 586 | MCFG_FRAGMENT_ADD( md_pal ) |
| 587 | |
| 588 | MCFG_MACHINE_START( ms_megadriv ) |
| 589 | MCFG_MACHINE_RESET( ms_megadriv ) |
| 590 | |
| 591 | MCFG_FRAGMENT_ADD( genesis_cartslot ) |
| 592 | MACHINE_CONFIG_END |
| 593 | |
| 594 | static MACHINE_CONFIG_START( ms_megdsvp, mdsvp_state ) |
| 595 | MCFG_FRAGMENT_ADD( md_ntsc ) |
| 596 | MCFG_FRAGMENT_ADD( md_svp ) |
| 597 | |
| 598 | MCFG_MACHINE_START( ms_megadriv ) |
| 599 | MCFG_MACHINE_RESET( ms_megadriv ) |
| 600 | |
| 601 | MCFG_FRAGMENT_ADD( genesis_cartslot ) |
| 602 | MACHINE_CONFIG_END |
| 603 | |
| 604 | |
| 605 | |
| 606 | /************************************* |
| 607 | * |
| 608 | * ROM definition(s) |
| 609 | * |
| 610 | *************************************/ |
| 611 | |
| 612 | |
| 613 | /* we don't use the bios rom (it's not needed and only provides security on early models) */ |
| 614 | |
| 615 | ROM_START(genesis) |
| 616 | ROM_REGION(0x1415000, "maincpu", ROMREGION_ERASEFF) |
| 617 | ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) |
| 618 | ROM_END |
| 619 | |
| 620 | ROM_START(gensvp) |
| 621 | ROM_REGION(0x1415000, "maincpu", ROMREGION_ERASEFF) |
| 622 | ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) |
| 623 | ROM_END |
| 624 | |
| 625 | ROM_START(megadriv) |
| 626 | ROM_REGION(0x1415000, "maincpu", ROMREGION_ERASEFF) |
| 627 | ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) |
| 628 | ROM_END |
| 629 | |
| 630 | ROM_START(megadrij) |
| 631 | ROM_REGION(0x1415000, "maincpu", ROMREGION_ERASEFF) |
| 632 | ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) |
| 633 | ROM_END |
| 634 | |
| 635 | |
| 636 | /************************************* |
| 637 | * |
| 638 | * Driver initialization |
| 639 | * |
| 640 | *************************************/ |
| 641 | |
| 642 | static DRIVER_INIT( mess_md_common ) |
| 643 | { |
| 644 | megadrive_io_read_data_port_ptr = mess_md_io_read_data_port; |
| 645 | megadrive_io_write_data_port_ptr = mess_md_io_write_data_port; |
| 646 | } |
| 647 | |
| 648 | static DRIVER_INIT( genesis ) |
| 649 | { |
| 650 | DRIVER_INIT_CALL(megadriv); |
| 651 | DRIVER_INIT_CALL(mess_md_common); |
| 652 | megadrive_region_export = 1; |
| 653 | megadrive_region_pal = 0; |
| 654 | } |
| 655 | |
| 656 | static DRIVER_INIT( gensvp ) |
| 657 | { |
| 658 | DRIVER_INIT_CALL(megadriv); |
| 659 | DRIVER_INIT_CALL(mess_md_common); |
| 660 | megadrive_region_export = 1; |
| 661 | megadrive_region_pal = 0; |
| 662 | } |
| 663 | |
| 664 | static DRIVER_INIT( md_eur ) |
| 665 | { |
| 666 | DRIVER_INIT_CALL(megadrie); |
| 667 | DRIVER_INIT_CALL(mess_md_common); |
| 668 | megadrive_region_export = 1; |
| 669 | megadrive_region_pal = 1; |
| 670 | } |
| 671 | |
| 672 | static DRIVER_INIT( md_jpn ) |
| 673 | { |
| 674 | DRIVER_INIT_CALL(megadrij); |
| 675 | DRIVER_INIT_CALL(mess_md_common); |
| 676 | megadrive_region_export = 0; |
| 677 | megadrive_region_pal = 0; |
| 678 | } |
| 679 | |
| 680 | /****************************************** SegaCD & 32X emulation ****************************************/ |
| 681 | |
| 682 | /* Very preliminary skeleton code from David Haywood, borrowed for MESS by Fabio Priuli */ |
| 683 | /* These are only included to document BIOS informations currently available */ |
| 684 | |
| 685 | static DRIVER_INIT( mess_32x ) |
| 686 | { |
| 687 | DRIVER_INIT_CALL(_32x); |
| 688 | DRIVER_INIT_CALL(mess_md_common); |
| 689 | megadrive_region_export = 1; |
| 690 | megadrive_region_pal = 0; |
| 691 | } |
| 692 | |
| 693 | static MACHINE_CONFIG_DERIVED( ms_32x, genesis_32x ) |
| 694 | |
| 695 | MCFG_FRAGMENT_ADD( _32x_cartslot ) |
| 696 | MACHINE_CONFIG_END |
| 697 | |
| 698 | |
| 699 | ROM_START( 32x ) |
| 700 | ROM_REGION16_BE( 0x400000, "gamecart", ROMREGION_ERASE00 ) /* 68000 Code */ |
| 701 | // ROM_CART_LOAD("cart", 0x000000, 0x400000, ROM_NOMIRROR) |
| 702 | |
| 703 | ROM_REGION32_BE( 0x400000, "gamecart_sh2", ROMREGION_ERASE00 ) /* Copy for the SH2 */ |
| 704 | // ROM_CART_LOAD("cart", 0x000000, 0x400000, ROM_NOMIRROR) |
| 705 | |
| 706 | ROM_REGION16_BE( 0x400000, "32x_68k_bios", 0 ) /* 68000 Code */ |
| 707 | ROM_LOAD( "32x_g_bios.bin", 0x000000, 0x000100, CRC(5c12eae8) SHA1(dbebd76a448447cb6e524ac3cb0fd19fc065d944) ) |
| 708 | |
| 709 | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 710 | // temp, rom should only be visible here when one of the regs is set, tempo needs it |
| 711 | // ROM_CART_LOAD("cart", 0x000000, 0x400000, ROM_NOMIRROR) |
| 712 | ROM_COPY( "32x_68k_bios", 0x0, 0x0, 0x100) |
| 713 | |
| 714 | ROM_REGION( 0x400000, "32x_master_sh2", 0 ) /* SH2 Code */ |
| 715 | ROM_SYSTEM_BIOS( 0, "retail", "Mars Version 1.0 (retail)" ) |
| 716 | ROMX_LOAD( "32x_m_bios.bin", 0x000000, 0x000800, CRC(dd9c46b8) SHA1(1e5b0b2441a4979b6966d942b20cc76c413b8c5e), ROM_BIOS(1) ) |
| 717 | ROM_SYSTEM_BIOS( 1, "sdk", "Mars Version 1.0 (early sdk)" ) |
| 718 | ROMX_LOAD( "32x_m_bios_sdk.bin", 0x000000, 0x000800, BAD_DUMP CRC(c7102c53) SHA1(ed73a47f186b373b8eff765f84ef26c3d9ef6cb0), ROM_BIOS(2) ) |
| 719 | |
| 720 | ROM_REGION( 0x400000, "32x_slave_sh2", 0 ) /* SH2 Code */ |
| 721 | ROM_LOAD( "32x_s_bios.bin", 0x000000, 0x000400, CRC(bfda1fe5) SHA1(4103668c1bbd66c5e24558e73d4f3f92061a109a) ) |
| 722 | ROM_END |
| 723 | |
| 724 | /* We need proper names for most of these BIOS ROMs! */ |
| 725 | ROM_START( segacd ) |
| 726 | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 727 | /* v1.10 confirmed dump by dead_screem */ |
| 728 | ROM_LOAD( "mpr-15045b.bin", 0x000000, 0x020000, CRC(c6d10268) SHA1(f4f315adcef9b8feb0364c21ab7f0eaf5457f3ed) ) |
| 729 | ROM_END |
| 730 | |
| 731 | ROM_START( megacd ) |
| 732 | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 733 | /* v1.00, confirmed good dump */ |
| 734 | ROM_LOAD( "megacd_model1_bios_1_00_e.bin", 0x000000, 0x020000, CRC(529ac15a) SHA1(f891e0ea651e2232af0c5c4cb46a0cae2ee8f356) ) |
| 735 | ROM_END |
| 736 | |
| 737 | ROM_START( megacdj ) |
| 738 | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 739 | /* Confirmed by ElBarto */ |
| 740 | ROM_SYSTEM_BIOS(0, "v100s", "v1.00S") |
| 741 | ROMX_LOAD( "mpr-14088h.bin", 0x000000, 0x020000, CRC(3773d5aa) SHA1(bbf729a1aaa1667b783749299e1ad932aaf5f253), ROM_BIOS(1) | ROM_GROUPWORD | ROM_REVERSE) |
| 742 | ROM_SYSTEM_BIOS(1, "v100p", "v1.00P") |
| 743 | ROMX_LOAD( "megacd_model1_bios_1_00p_j.bin", 0x000000, 0x020000, CRC(9d2da8f2) SHA1(4846f448160059a7da0215a5df12ca160f26dd69), ROM_BIOS(2) ) |
| 744 | /* Confirmed by ElBarto */ |
| 745 | ROM_SYSTEM_BIOS(2, "v100l", "v1.00L") |
| 746 | ROMX_LOAD( "mpr-14088c.bin", 0x000000, 0x020000, CRC(03134289) SHA1(d60cb5a53f26d6b13e354bc149217587f2301718), ROM_BIOS(3) | ROM_GROUPWORD | ROM_REVERSE) |
| 747 | ROM_END |
| 748 | |
| 749 | /* Asia bios, when run in USA region will show : |
| 750 | ERROR! |
| 751 | THIS IS A PAL-COMPATIBLE MEGA CD |
| 752 | FOR EXCLUSIVE USE IN SOUTHEAST ASIA. |
| 753 | */ |
| 754 | ROM_START( megacda ) |
| 755 | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 756 | ROM_LOAD( "megacd_model1_bios_1_00s_a.bin", 0x000000, 0x020000, CRC(550f30bb) SHA1(e4193c6ae44c3cea002707d2a88f1fbcced664de)) |
| 757 | ROM_END |
| 758 | |
| 759 | ROM_START( segacd2 ) |
| 760 | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 761 | ROM_SYSTEM_BIOS(0, "v211x", "Model 2 v2.11X") |
| 762 | ROMX_LOAD( "mpr-15764-t.bin", 0x000000, 0x020000, CRC(2e49d72c) SHA1(328a3228c29fba244b9db2055adc1ec4f7a87e6b), ROM_BIOS(1) ) |
| 763 | ROM_SYSTEM_BIOS(1, "v200", "Model 2 v2.00") /* verified dump */ |
| 764 | ROMX_LOAD( "us_scd2_930314.bin", 0x000000, 0x020000, CRC(8af65f58) SHA1(5a8c4b91d3034c1448aac4b5dc9a6484fce51636), ROM_BIOS(2) ) |
| 765 | /* this is reportedly a bad dump, it has many differences from the verified dump and does not boot in Kega */ |
| 766 | /* ROMX_LOAD( "segacd_model2_bios_2_00_u.bin", 0x000000, 0x020000, CRC(340b4be4) SHA1(bd3ee0c8ab732468748bf98953603ce772612704), ROM_BIOS(2) ) */ |
| 767 | ROM_SYSTEM_BIOS(2, "v200w", "Model 2 v2.00W") |
| 768 | ROMX_LOAD( "segacd_model2_bios_2_00w_u.bin", 0x000000, 0x020000, CRC(9f6f6276) SHA1(5adb6c3af218c60868e6b723ec47e36bbdf5e6f0), ROM_BIOS(3) ) |
| 769 | ROM_END |
| 770 | |
| 771 | /* All confirmed good dump by ElBarto */ |
| 772 | ROM_START( megacd2 ) |
| 773 | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 774 | ROM_SYSTEM_BIOS(0, "v200w", "v2.00W") |
| 775 | ROMX_LOAD( "mpr-15512a.bin", 0x000000, 0x020000, CRC(53f1757c) SHA1(67bf3970ca5a05fd5ce3d6c446789c5d971b98a4), ROM_BIOS(1) | ROM_GROUPWORD | ROM_REVERSE ) |
| 776 | ROM_SYSTEM_BIOS(1, "v200", "v2.00") |
| 777 | ROMX_LOAD( "mpr-15512.bin", 0x000000, 0x020000, CRC(cb76f114) SHA1(939f173cadc41e996a3c34498da1bf55e7e18ff8), ROM_BIOS(2) | ROM_GROUPWORD | ROM_REVERSE ) |
| 778 | ROM_END |
| 779 | |
| 780 | /* Confirmed good dump by ElBarto */ |
| 781 | ROM_START( megacd2j ) |
| 782 | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 783 | ROM_SYSTEM_BIOS(0, "v200c", "v2.00C") |
| 784 | ROMX_LOAD( "mpr-15398.bin", 0x000000, 0x020000, CRC(1e4344e6) SHA1(4d1251a6973d932e734ae5e8c6b9b55eb40e4143), ROM_BIOS(1) | ROM_GROUPWORD | ROM_REVERSE ) |
| 785 | ROM_END |
| 786 | |
| 787 | ROM_START( laseract ) |
| 788 | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 789 | ROM_SYSTEM_BIOS(0, "v104", "v1.04") |
| 790 | ROMX_LOAD( "laseractive_bios_1_04_u.bin", 0x000000, 0x020000, CRC(50cd3d23) SHA1(aa811861f8874775075bd3f53008c8aaf59b07db), ROM_BIOS(1) ) |
| 791 | ROM_SYSTEM_BIOS(1, "v102", "v1.02") |
| 792 | ROMX_LOAD( "laseractive_bios_1_02_u.bin", 0x000000, 0x020000, CRC(3b10cf41) SHA1(8af162223bb12fc19b414f126022910372790103), ROM_BIOS(2) ) |
| 793 | ROM_END |
| 794 | |
| 795 | ROM_START( laseractj ) |
| 796 | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 797 | /* v1.02 */ |
| 798 | ROM_LOAD( "laseractive_bios_1_02_j.bin", 0x000000, 0x020000, CRC(00eedb3a) SHA1(26237b333db4a4c6770297fa5e655ea95840d5d9) ) |
| 799 | ROM_END |
| 800 | |
| 801 | ROM_START( xeye ) |
| 802 | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 803 | /* v2.00 (US), confirmed good with a chip dump */ |
| 804 | ROM_LOAD( "g304.bin", 0x000000, 0x020000, CRC(290f8e33) SHA1(651f14d5a5e0ecb974a60c0f43b1d2006323fb09) ) |
| 805 | ROM_END |
| 806 | |
| 807 | ROM_START( wmega ) |
| 808 | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 809 | /* v1.00 (Japan NTSC) Sega BIOS, chip-dumped */ |
| 810 | ROM_LOAD( "g301.bin", 0x000000, 0x020000, CRC(d21fe71d) SHA1(3fc9358072f74bd24e3e297ea11b2bf15a7af891) ) |
| 811 | ROM_END |
| 812 | |
| 813 | ROM_START( wmegam2 ) |
| 814 | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 815 | /* v2.00 */ |
| 816 | ROM_LOAD( "wondermega_m2_bios_2_00_j.bin", 0x000000, 0x020000, CRC(2b19972f) SHA1(b3f32e409bd5508c89ed8be33d41a58d791d0e5d) ) |
| 817 | ROM_END |
| 818 | |
| 819 | ROM_START( cdx ) |
| 820 | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 821 | /* v2.21X */ |
| 822 | ROM_LOAD( "segacdx_bios_2_21_u.bin", 0x000000, 0x020000, CRC(d48c44b5) SHA1(2b125c0545afa089b617f2558e686ea723bdc06e) ) |
| 823 | ROM_END |
| 824 | |
| 825 | ROM_START( multmega ) |
| 826 | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 827 | /* v2.21X */ |
| 828 | ROM_LOAD( "opr-16140.bin", 0x000000, 0x020000, CRC(aacb851e) SHA1(75548ac9aaa6e81224499f9a1403b2b42433f5b7) ) |
| 829 | /* the below was marked "confirmed good dump", but 0x72 and 0x73 are 0xFF, indicating a bad dump made from memory */ |
| 830 | /* ROM_LOAD( "multimega_bios_2_21_e.bin", 0x000000, 0x020000, CRC(34d3cce1) SHA1(73fc9c014ad803e9e7d8076b3642a8a5224b3e51) ) */ |
| 831 | ROM_END |
| 832 | |
| 833 | /* some games use the 32x and SegaCD together to give better quality FMV */ |
| 834 | ROM_START( 32x_scd ) |
| 835 | ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) |
| 836 | |
| 837 | ROM_REGION16_BE( 0x400000, "gamecart", 0 ) /* 68000 Code */ |
| 838 | ROM_LOAD( "mpr-15764-t.bin", 0x000000, 0x020000, CRC(2e49d72c) SHA1(328a3228c29fba244b9db2055adc1ec4f7a87e6b) ) |
| 839 | |
| 840 | ROM_REGION32_BE( 0x400000, "gamecart_sh2", 0 ) /* Copy for the SH2 */ |
| 841 | ROM_COPY( "gamecart", 0x0, 0x0, 0x400000) |
| 842 | |
| 843 | ROM_REGION16_BE( 0x400000, "32x_68k_bios", 0 ) /* 68000 Code */ |
| 844 | ROM_LOAD( "32x_g_bios.bin", 0x000000, 0x000100, CRC(5c12eae8) SHA1(dbebd76a448447cb6e524ac3cb0fd19fc065d944) ) |
| 845 | |
| 846 | ROM_REGION( 0x400000, "32x_master_sh2", 0 ) /* SH2 Code */ |
| 847 | ROM_LOAD( "32x_m_bios.bin", 0x000000, 0x000800, CRC(dd9c46b8) SHA1(1e5b0b2441a4979b6966d942b20cc76c413b8c5e) ) |
| 848 | |
| 849 | ROM_REGION( 0x400000, "32x_slave_sh2", 0 ) /* SH2 Code */ |
| 850 | ROM_LOAD( "32x_s_bios.bin", 0x000000, 0x000400, CRC(bfda1fe5) SHA1(4103668c1bbd66c5e24558e73d4f3f92061a109a) ) |
| 851 | ROM_END |
| 852 | |
| 853 | |
| 854 | /****************************************** PICO emulation ****************************************/ |
| 855 | |
| 856 | /* |
| 857 | Pico Implementation By ElBarto (Emmanuel Vadot, elbarto@megadrive.org) |
| 858 | Still missing the PCM custom chip |
| 859 | Some game will not boot due to this |
| 860 | |
| 861 | Pico Info from Notaz (http://notaz.gp2x.de/docs/picodoc.txt) |
| 862 | |
| 863 | addr acc description |
| 864 | -------+-----+------------ |
| 865 | 800001 byte Version register. |
| 866 | ?vv? ????, where v can be: |
| 867 | 00 - hardware is for Japan |
| 868 | 01 - European version |
| 869 | 10 - USA version |
| 870 | 11 - ? |
| 871 | 800003 byte Buttons, 0 for pressed, 1 for released: |
| 872 | bit 0: UP (white) |
| 873 | bit 1: DOWN (orange) |
| 874 | bit 2: LEFT (blue) |
| 875 | bit 3: RIGHT (green) |
| 876 | bit 4: red button |
| 877 | bit 5: unused? |
| 878 | bit 6: unused? |
| 879 | bit 7: pen button |
| 880 | 800005 byte Most significant byte of pen x coordinate. |
| 881 | 800007 byte Least significant byte of pen x coordinate. |
| 882 | 800009 byte Most significant byte of pen y coordinate. |
| 883 | 80000b byte Least significant byte of pen y coordinate. |
| 884 | 80000d byte Page register. One bit means one uncovered page sensor. |
| 885 | 00 - storyware closed |
| 886 | 01, 03, 07, 0f, 1f, 3f - pages 1-6 |
| 887 | either page 5 or page 6 is often unused. |
| 888 | 800010 word PCM data register. |
| 889 | r/w read returns free bytes left in PCM FIFO buffer |
| 890 | writes write data to buffer. |
| 891 | 800012 word PCM control register. |
| 892 | r/w For writes, it has following possible meanings: |
| 893 | ?p?? ???? ???? ?rrr |
| 894 | p - set to enable playback? |
| 895 | r - sample rate / PCM data type? |
| 896 | 0: 8kHz 4bit ADPCM? |
| 897 | 1-7: 16kHz variants? |
| 898 | For reads, if bit 15 is cleared, it means PCM is 'busy' or |
| 899 | something like that, as games sometimes wait for it to become 1. |
| 900 | 800019 byte Games write 'S' |
| 901 | 80001b byte Games write 'E' |
| 902 | 80001d byte Games write 'G' |
| 903 | 80001f byte Games write 'A' |
| 904 | |
| 905 | */ |
| 906 | |
| 907 | #define PICO_PENX 1 |
| 908 | #define PICO_PENY 2 |
| 909 | |
| 910 | static UINT16 pico_read_penpos(running_machine &machine, int pen) |
| 911 | { |
| 912 | UINT16 penpos = 0; |
| 913 | |
| 914 | switch (pen) |
| 915 | { |
| 916 | case PICO_PENX: |
| 917 | penpos = input_port_read_safe(machine, "PENX", 0); |
| 918 | penpos |= 0x6; |
| 919 | penpos = penpos * 320 / 255; |
| 920 | penpos += 0x3d; |
| 921 | break; |
| 922 | case PICO_PENY: |
| 923 | penpos = input_port_read_safe(machine, "PENY", 0); |
| 924 | penpos |= 0x6; |
| 925 | penpos = penpos * 251 / 255; |
| 926 | penpos += 0x1fc; |
| 927 | break; |
| 928 | } |
| 929 | |
| 930 | return penpos; |
| 931 | } |
| 932 | |
| 933 | static READ16_HANDLER( pico_68k_io_read ) |
| 934 | { |
| 935 | pico_state *state = space->machine().driver_data<pico_state>(); |
| 936 | UINT8 retdata = 0; |
| 937 | |
| 938 | switch (offset) |
| 939 | { |
| 940 | case 0: /* Version register ?XX?????? where XX is 00 for japan, 01 for europe and 10 for USA*/ |
| 941 | retdata = (megadrive_region_export << 6) | (megadrive_region_pal << 5); |
| 942 | break; |
| 943 | case 1: |
| 944 | retdata = input_port_read_safe(space->machine(), "PAD", 0); |
| 945 | break; |
| 946 | |
| 947 | /* |
| 948 | Still notes from notaz for the pen : |
| 949 | |
| 950 | The pen can be used to 'draw' either on the drawing pad or on the storyware |
| 951 | itself. Both storyware and drawing pad are mapped on single virtual plane, where |
| 952 | coordinates range: |
| 953 | |
| 954 | x: 0x03c - 0x17c |
| 955 | y: 0x1fc - 0x2f7 (drawing pad) |
| 956 | 0x2f8 - 0x3f3 (storyware) |
| 957 | */ |
| 958 | case 2: |
| 959 | retdata = pico_read_penpos(space->machine(), PICO_PENX) >> 8; |
| 960 | break; |
| 961 | case 3: |
| 962 | retdata = pico_read_penpos(space->machine(), PICO_PENX) & 0x00ff; |
| 963 | break; |
| 964 | case 4: |
| 965 | retdata = pico_read_penpos(space->machine(), PICO_PENY) >> 8; |
| 966 | break; |
| 967 | case 5: |
| 968 | retdata = pico_read_penpos(space->machine(), PICO_PENY) & 0x00ff; |
| 969 | break; |
| 970 | case 6: |
| 971 | /* Page register : |
| 972 | 00 - storyware closed |
| 973 | 01, 03, 07, 0f, 1f, 3f - pages 1-6 |
| 974 | either page 5 or page 6 is often unused. |
| 975 | */ |
| 976 | { |
| 977 | UINT8 tmp = input_port_read_safe(space->machine(), "PAGE", 0); |
| 978 | if (tmp == 2 && state->m_page_register != 0x3f) |
| 979 | { |
| 980 | state->m_page_register <<= 1; |
| 981 | state->m_page_register |= 1; |
| 982 | } |
| 983 | if (tmp == 1 && state->m_page_register != 0x00) |
| 984 | state->m_page_register >>= 1; |
| 985 | retdata = state->m_page_register; |
| 986 | break; |
| 987 | } |
| 988 | case 7: |
| 989 | /* Returns free bytes left in the PCM FIFO buffer */ |
| 990 | retdata = 0x00; |
| 991 | break; |
| 992 | case 8: |
| 993 | /* |
| 994 | For reads, if bit 15 is cleared, it means PCM is 'busy' or |
| 995 | something like that, as games sometimes wait for it to become 1. |
| 996 | */ |
| 997 | retdata = 0x00; |
| 998 | } |
| 999 | |
| 1000 | return retdata | retdata << 8; |
| 1001 | } |
| 1002 | |
| 1003 | static WRITE16_HANDLER( pico_68k_io_write ) |
| 1004 | { |
| 1005 | switch (offset) |
| 1006 | { |
| 1007 | } |
| 1008 | } |
| 1009 | |
| 1010 | static ADDRESS_MAP_START( pico_mem, AS_PROGRAM, 16 ) |
| 1011 | AM_RANGE(0x000000, 0x3fffff) AM_ROM |
| 1012 | |
| 1013 | AM_RANGE(0x800000, 0x80001f) AM_READWRITE(pico_68k_io_read, pico_68k_io_write) |
| 1014 | |
| 1015 | AM_RANGE(0xc00000, 0xc0001f) AM_READWRITE(megadriv_vdp_r, megadriv_vdp_w) |
| 1016 | AM_RANGE(0xe00000, 0xe0ffff) AM_RAM AM_MIRROR(0x1f0000) AM_BASE(&megadrive_ram) |
| 1017 | ADDRESS_MAP_END |
| 1018 | |
| 1019 | |
| 1020 | static INPUT_PORTS_START( pico ) |
| 1021 | PORT_START("PAD") |
| 1022 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) |
| 1023 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) |
| 1024 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) |
| 1025 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) |
| 1026 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("Red Button") |
| 1027 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Pen Button") |
| 1028 | |
| 1029 | PORT_START("PAGE") |
| 1030 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("Increment Page") |
| 1031 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("Decrement Page") |
| 1032 | |
| 1033 | PORT_START("PENX") |
| 1034 | PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(30) PORT_KEYDELTA(10) PORT_MINMAX(0, 255) PORT_CATEGORY(5) PORT_PLAYER(1) PORT_NAME("PEN X") |
| 1035 | |
| 1036 | PORT_START("PENY") |
| 1037 | PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(30) PORT_KEYDELTA(10) PORT_MINMAX(0,255 ) PORT_CATEGORY(5) PORT_PLAYER(1) PORT_NAME("PEN Y") |
| 1038 | |
| 1039 | PORT_START("REGION") |
| 1040 | /* Region setting for Console */ |
| 1041 | PORT_DIPNAME( 0x000f, 0x0000, DEF_STR( Region ) ) |
| 1042 | PORT_DIPSETTING( 0x0000, "Use HazeMD Default Choice" ) |
| 1043 | PORT_DIPSETTING( 0x0001, "US (NTSC, 60fps)" ) |
| 1044 | PORT_DIPSETTING( 0x0002, "JAPAN (NTSC, 60fps)" ) |
| 1045 | PORT_DIPSETTING( 0x0003, "EUROPE (PAL, 50fps)" ) |
| 1046 | INPUT_PORTS_END |
| 1047 | |
| 1048 | |
| 1049 | static MACHINE_CONFIG_START( pico, pico_state ) |
| 1050 | MCFG_FRAGMENT_ADD( md_ntsc ) |
| 1051 | |
| 1052 | MCFG_CPU_MODIFY("maincpu") |
| 1053 | MCFG_CPU_PROGRAM_MAP(pico_mem) |
| 1054 | |
| 1055 | MCFG_DEVICE_REMOVE("genesis_snd_z80") |
| 1056 | |
| 1057 | MCFG_MACHINE_RESET( ms_megadriv ) |
| 1058 | |
| 1059 | MCFG_FRAGMENT_ADD( pico_cartslot ) |
| 1060 | MACHINE_CONFIG_END |
| 1061 | |
| 1062 | static MACHINE_CONFIG_START( picopal, pico_state ) |
| 1063 | MCFG_FRAGMENT_ADD( md_pal ) |
| 1064 | |
| 1065 | MCFG_CPU_MODIFY("maincpu") |
| 1066 | MCFG_CPU_PROGRAM_MAP(pico_mem) |
| 1067 | |
| 1068 | MCFG_DEVICE_REMOVE("genesis_snd_z80") |
| 1069 | |
| 1070 | MCFG_MACHINE_RESET( ms_megadriv ) |
| 1071 | |
| 1072 | MCFG_FRAGMENT_ADD( pico_cartslot ) |
| 1073 | MACHINE_CONFIG_END |
| 1074 | |
| 1075 | |
| 1076 | |
| 1077 | ROM_START( pico ) |
| 1078 | ROM_REGION(0x1415000, "maincpu", ROMREGION_ERASEFF) |
| 1079 | ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) |
| 1080 | ROM_END |
| 1081 | |
| 1082 | ROM_START( picou ) |
| 1083 | ROM_REGION(0x1415000, "maincpu", ROMREGION_ERASEFF) |
| 1084 | ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) |
| 1085 | ROM_END |
| 1086 | |
| 1087 | ROM_START( picoj ) |
| 1088 | ROM_REGION(0x1415000, "maincpu", ROMREGION_ERASEFF) |
| 1089 | ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) |
| 1090 | ROM_END |
| 1091 | |
| 1092 | /*************************************************************************** |
| 1093 | |
| 1094 | Game driver(s) |
| 1095 | |
| 1096 | ***************************************************************************/ |
| 1097 | |
| 1098 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ |
| 1099 | CONS( 1989, genesis, 0, 0, ms_megadriv, md, genesis, "Sega", "Genesis (USA, NTSC)", 0) |
| 1100 | CONS( 1993, gensvp, genesis, 0, ms_megdsvp, md_sel, gensvp, "Sega", "Genesis (USA, NTSC, w/SVP)", 0) |
| 1101 | CONS( 1990, megadriv, genesis, 0, ms_megadpal, md, md_eur, "Sega", "Mega Drive (Europe, PAL)", 0) |
| 1102 | CONS( 1988, megadrij, genesis, 0, ms_megadriv, md, md_jpn, "Sega", "Mega Drive (Japan, NTSC)", 0) |
| 1103 | CONS( 1994, pico, 0, 0, picopal, pico, md_eur, "Sega", "Pico (Europe, PAL)", 0) |
| 1104 | CONS( 1994, picou, pico, 0, pico, pico, genesis, "Sega", "Pico (USA, NTSC)", 0) |
| 1105 | CONS( 1993, picoj, pico, 0, pico, pico, md_jpn, "Sega", "Pico (Japan, NTSC)", 0) |
| 1106 | |
| 1107 | /* Not Working */ |
| 1108 | CONS( 1994, 32x, 0, 0, ms_32x, md_sel, mess_32x, "Sega", "32X", GAME_NOT_WORKING ) |
| 1109 | CONS( 1992, segacd, 0, 0, genesis_scd_scd, md, genesis, "Sega", "Sega CD (USA, NTSC)", GAME_NOT_WORKING ) |
| 1110 | CONS( 1993, megacd, segacd, 0, genesis_scd_mcd, md, md_eur, "Sega", "Mega-CD (Europe, PAL)", GAME_NOT_WORKING ) |
| 1111 | CONS( 1991, megacdj, segacd, 0, genesis_scd_mcdj,md, md_jpn, "Sega", "Mega-CD (Japan, NTSC)", GAME_NOT_WORKING ) |
| 1112 | CONS( 1991, megacda, segacd, 0, genesis_scd_mcdj,md, md_eur, "Sega", "Mega-CD (Asia, PAL)", GAME_NOT_WORKING ) |
| 1113 | CONS( 1993, segacd2, 0, 0, genesis_scd_scd, md, genesis, "Sega", "Sega CD 2 (USA, NTSC)", GAME_NOT_WORKING ) |
| 1114 | CONS( 1993, megacd2, segacd2, 0, genesis_scd_mcd, md, md_eur, "Sega", "Mega-CD 2 (Europe, PAL)", GAME_NOT_WORKING ) |
| 1115 | CONS( 1993, megacd2j, segacd2, 0, genesis_scd_mcdj,md, md_jpn, "Sega", "Mega-CD 2 (Japan, NTSC)", GAME_NOT_WORKING ) |
| 1116 | CONS( 1993, laseract, 0, 0, genesis_scd, md, genesis, "Pioneer","LaserActive (USA, NTSC)", GAME_NOT_WORKING ) |
| 1117 | CONS( 1993, laseractj, laseract, 0, genesis_scd, md, md_jpn, "Pioneer","LaserActive (Japan, NTSC)", GAME_NOT_WORKING ) |
| 1118 | CONS( 1993, xeye, 0, 0, genesis_scd, md, genesis, "JVC", "X'eye (USA, NTSC)", GAME_NOT_WORKING ) |
| 1119 | CONS( 1992, wmega, xeye, 0, genesis_scd, md, md_jpn, "Sega", "Wondermega (Japan, NTSC)", GAME_NOT_WORKING ) |
| 1120 | CONS( 1993, wmegam2, xeye, 0, genesis_scd, md, md_jpn, "Victor", "Wondermega M2 (Japan, NTSC)", GAME_NOT_WORKING ) |
| 1121 | CONS( 1994, cdx, 0, 0, genesis_scd, md, genesis, "Sega", "CDX (USA, NTSC)", GAME_NOT_WORKING ) |
| 1122 | CONS( 1994, multmega, cdx, 0, genesis_scd, md, md_eur, "Sega", "Multi-Mega (Europe, PAL)", GAME_NOT_WORKING ) |
| 1123 | CONS( 1994, 32x_scd, 0, 0, genesis_32x_scd, md_sel, mess_32x, "Sega", "Sega CD (USA, NTSC, w/32X)", GAME_NOT_WORKING ) |