src/mess/drivers/jaguar.c
| r11290 | r11291 | |
| 1 | | /*************************************************************************** |
| 2 | | |
| 3 | | Atari Jaguar |
| 4 | | |
| 5 | | Nathan Woods |
| 6 | | based on MAME cojag driver by Aaron Giles |
| 7 | | |
| 8 | | |
| 9 | | **************************************************************************** |
| 10 | | |
| 11 | | Memory map (TBA) |
| 12 | | |
| 13 | | ======================================================================== |
| 14 | | MAIN CPU |
| 15 | | ======================================================================== |
| 16 | | |
| 17 | | ------------------------------------------------------------ |
| 18 | | 000000-3FFFFF R/W xxxxxxxx xxxxxxxx DRAM 0 |
| 19 | | 400000-7FFFFF R/W xxxxxxxx xxxxxxxx DRAM 1 |
| 20 | | F00000-F000FF R/W xxxxxxxx xxxxxxxx Tom Internal Registers |
| 21 | | F00400-F005FF R/W xxxxxxxx xxxxxxxx CLUT - color lookup table A |
| 22 | | F00600-F007FF R/W xxxxxxxx xxxxxxxx CLUT - color lookup table B |
| 23 | | F00800-F00D9F R/W xxxxxxxx xxxxxxxx LBUF - line buffer A |
| 24 | | F01000-F0159F R/W xxxxxxxx xxxxxxxx LBUF - line buffer B |
| 25 | | F01800-F01D9F R/W xxxxxxxx xxxxxxxx LBUF - line buffer currently selected |
| 26 | | F02000-F021FF R/W xxxxxxxx xxxxxxxx GPU control registers |
| 27 | | F02200-F022FF R/W xxxxxxxx xxxxxxxx Blitter registers |
| 28 | | F03000-F03FFF R/W xxxxxxxx xxxxxxxx Local GPU RAM |
| 29 | | F08800-F08D9F R/W xxxxxxxx xxxxxxxx LBUF - 32-bit access to line buffer A |
| 30 | | F09000-F0959F R/W xxxxxxxx xxxxxxxx LBUF - 32-bit access to line buffer B |
| 31 | | F09800-F09D9F R/W xxxxxxxx xxxxxxxx LBUF - 32-bit access to line buffer currently selected |
| 32 | | F0B000-F0BFFF R/W xxxxxxxx xxxxxxxx 32-bit access to local GPU RAM |
| 33 | | F10000-F13FFF R/W xxxxxxxx xxxxxxxx Jerry |
| 34 | | F14000-F17FFF R/W xxxxxxxx xxxxxxxx Joysticks and GPIO0-5 |
| 35 | | F18000-F1AFFF R/W xxxxxxxx xxxxxxxx Jerry DSP |
| 36 | | F1B000-F1CFFF R/W xxxxxxxx xxxxxxxx Local DSP RAM |
| 37 | | F1D000-F1DFFF R xxxxxxxx xxxxxxxx Wavetable ROM |
| 38 | | ------------------------------------------------------------ |
| 39 | | |
| 40 | | **************************************************************************** |
| 41 | | |
| 42 | | Protection Check |
| 43 | | |
| 44 | | At power on, a checksum is performed on the cart to ensure it has been |
| 45 | | certified by Atari. The actual checksum calculation is performed by the GPU, |
| 46 | | the result being left in GPU RAM at address f03000. The GPU is instructed to |
| 47 | | do the calculation when the bios sends a 1 to f02114 while it is in the |
| 48 | | initialisation stage. The bios then loops, waiting for the GPU to finish the |
| 49 | | calculation. When it does, it sets bit 15 of f02114 high. The bios then does |
| 50 | | the compare of the checksum. The checksum algorithm is unknown, but the |
| 51 | | final result must be 03d0dead. The bios checks for this particular result, |
| 52 | | and if found, the cart is allowed to start. Otherwise, the background turns |
| 53 | | red, and the console freezes. |
| 54 | | |
| 55 | | |
| 56 | | Jaguar Logo |
| 57 | | |
| 58 | | A real Jaguar will show the red Jaguar logo, the falling white Atari letters, |
| 59 | | and the turning jaguar's head, accompanied by the sound of a flushing toilet. |
| 60 | | The cart will then start. All Jaguar emulators (including this one) skip the |
| 61 | | logo with the appropriate memory hack. The cart can also instruct the logo |
| 62 | | be skipped by placing non-zero at location 800408. We do the same thing when |
| 63 | | the cart is loaded (see the DEVICE_IMAGE_LOAD section below). |
| 64 | | |
| 65 | | |
| 66 | | Start Address |
| 67 | | |
| 68 | | The start address of a cart may be found at 800404. It is normally 802000. |
| 69 | | |
| 70 | | |
| 71 | | ***************************************************************************/ |
| 72 | | |
| 73 | | |
| 74 | | #include "emu.h" |
| 75 | | #include "emuopts.h" |
| 76 | | #include "cpu/m68000/m68000.h" |
| 77 | | #include "cpu/mips/r3000.h" |
| 78 | | #include "cpu/jaguar/jaguar.h" |
| 79 | | #include "imagedev/cartslot.h" |
| 80 | | #include "imagedev/snapquik.h" |
| 81 | | #include "sound/dac.h" |
| 82 | | #include "machine/eeprom.h" |
| 83 | | #include "includes/jaguar.h" |
| 84 | | |
| 85 | | static QUICKLOAD_LOAD( jaguar ); |
| 86 | | static DEVICE_START( jaguar_cart ); |
| 87 | | static DEVICE_IMAGE_LOAD( jaguar ); |
| 88 | | |
| 89 | | /************************************* |
| 90 | | * |
| 91 | | * Global variables |
| 92 | | * |
| 93 | | *************************************/ |
| 94 | | #ifdef MESS |
| 95 | | UINT32 *jaguar_shared_ram; |
| 96 | | UINT32 *jaguar_gpu_ram; |
| 97 | | UINT32 *jaguar_gpu_clut; |
| 98 | | UINT32 *jaguar_dsp_ram; |
| 99 | | UINT32 *jaguar_wave_rom; |
| 100 | | UINT8 cojag_is_r3000 = FALSE; |
| 101 | | #else |
| 102 | | extern UINT32 *jaguar_shared_ram; |
| 103 | | extern UINT32 *jaguar_gpu_ram; |
| 104 | | extern UINT32 *jaguar_gpu_clut; |
| 105 | | extern UINT32 *jaguar_dsp_ram; |
| 106 | | extern UINT32 *jaguar_wave_rom; |
| 107 | | extern UINT8 cojag_is_r3000; |
| 108 | | #endif |
| 109 | | UINT32* high_rom_base; |
| 110 | | |
| 111 | | |
| 112 | | /************************************* |
| 113 | | * |
| 114 | | * Local variables |
| 115 | | * |
| 116 | | *************************************/ |
| 117 | | |
| 118 | | static UINT32 joystick_data; |
| 119 | | static UINT32 *rom_base; |
| 120 | | static size_t rom_size; |
| 121 | | static UINT32 *cart_base; |
| 122 | | static size_t cart_size; |
| 123 | | static UINT8 eeprom_bit_count; |
| 124 | | static UINT8 protection_check = 0; /* 0 = check hasn't started yet; 1= check in progress; 2 = check is finished. */ |
| 125 | | extern UINT8 blitter_status; |
| 126 | | static UINT8 using_cart = 0; |
| 127 | | |
| 128 | | static IRQ_CALLBACK(jaguar_irq_callback) |
| 129 | | { |
| 130 | | return (irqline == 6) ? 0x40 : -1; |
| 131 | | } |
| 132 | | |
| 133 | | /************************************* |
| 134 | | * |
| 135 | | * Machine init |
| 136 | | * |
| 137 | | *************************************/ |
| 138 | | |
| 139 | | static MACHINE_RESET( jaguar ) |
| 140 | | { |
| 141 | | device_set_irq_callback(machine.device("maincpu"), jaguar_irq_callback); |
| 142 | | |
| 143 | | protection_check = 0; |
| 144 | | |
| 145 | | /* Set up pointers for Jaguar logo */ |
| 146 | | |
| 147 | | memcpy(jaguar_shared_ram, rom_base, 0x400); // do not increase, or Doom breaks |
| 148 | | |
| 149 | | device_set_input_line(machine.device("maincpu"), INPUT_LINE_RESET, PULSE_LINE); |
| 150 | | |
| 151 | | /* clear any spinuntil stuff */ |
| 152 | | jaguar_gpu_resume(machine); |
| 153 | | jaguar_dsp_resume(machine); |
| 154 | | |
| 155 | | /* halt the CPUs */ |
| 156 | | jaguargpu_ctrl_w(machine.device("gpu"), G_CTRL, 0, 0xffffffff); |
| 157 | | jaguardsp_ctrl_w(machine.device("audiocpu"), D_CTRL, 0, 0xffffffff); |
| 158 | | |
| 159 | | joystick_data = 0xffffffff; |
| 160 | | eeprom_bit_count = 0; |
| 161 | | blitter_status = 1; |
| 162 | | if ((using_cart) && (input_port_read(machine, "CONFIG") & 2)) |
| 163 | | { |
| 164 | | cart_base[0x102] = 1; |
| 165 | | using_cart = 0; |
| 166 | | } |
| 167 | | } |
| 168 | | |
| 169 | | |
| 170 | | /******************************************************************** |
| 171 | | * |
| 172 | | * EEPROM |
| 173 | | * ====== |
| 174 | | * |
| 175 | | * The EEPROM is accessed by a serial protocol using the registers |
| 176 | | * 0xF14000 (read data), F14800 (increment clock, write data), F15000 (reset for next word) |
| 177 | | * |
| 178 | | ********************************************************************/ |
| 179 | | /* |
| 180 | | static emu_file *jaguar_nvram_fopen( running_machine &machine, UINT32 openflags) |
| 181 | | { |
| 182 | | device_image_interface *image = dynamic_cast<device_image_interface *>(machine.device("cart")); |
| 183 | | astring *fname; |
| 184 | | file_error filerr; |
| 185 | | emu_file *file; |
| 186 | | if (image->exists()) |
| 187 | | { |
| 188 | | fname = astring_assemble_4( astring_alloc(), machine.system().name, PATH_SEPARATOR, image->basename_noext(), ".nv"); |
| 189 | | filerr = mame_fopen( SEARCHPATH_NVRAM, astring_c( fname), openflags, &file); |
| 190 | | astring_free( fname); |
| 191 | | return (filerr == FILERR_NONE) ? file : NULL; |
| 192 | | } |
| 193 | | else |
| 194 | | return NULL; |
| 195 | | } |
| 196 | | |
| 197 | | static void jaguar_nvram_load(running_machine &machine) |
| 198 | | { |
| 199 | | emu_file *nvram_file = NULL; |
| 200 | | device_t *device; |
| 201 | | |
| 202 | | for (device = machine.m_devicelist.first(); device != NULL; device = device->next()) |
| 203 | | { |
| 204 | | device_nvram_func nvram = (device_nvram_func)device->get_config_fct(DEVINFO_FCT_NVRAM); |
| 205 | | if (nvram != NULL) |
| 206 | | { |
| 207 | | if (nvram_file == NULL) |
| 208 | | nvram_file = jaguar_nvram_fopen(machine, OPEN_FLAG_READ); |
| 209 | | (*nvram)(device, nvram_file, 0); |
| 210 | | } |
| 211 | | } |
| 212 | | if (nvram_file != NULL) |
| 213 | | mame_fclose(nvram_file); |
| 214 | | } |
| 215 | | |
| 216 | | |
| 217 | | static void jaguar_nvram_save(running_machine &machine) |
| 218 | | { |
| 219 | | emu_file *nvram_file = NULL; |
| 220 | | device_t *device; |
| 221 | | |
| 222 | | for (device = machine.m_devicelist.first(); device != NULL; device = device->next()) |
| 223 | | { |
| 224 | | device_nvram_func nvram = (device_nvram_func)device->get_config_fct(DEVINFO_FCT_NVRAM); |
| 225 | | if (nvram != NULL) |
| 226 | | { |
| 227 | | if (nvram_file == NULL) |
| 228 | | nvram_file = jaguar_nvram_fopen(machine, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 229 | | // check nvram_file to avoid crash when no image is mounted or cannot be created |
| 230 | | if (nvram_file) |
| 231 | | (*nvram)(device, nvram_file, 1); |
| 232 | | } |
| 233 | | } |
| 234 | | |
| 235 | | if (nvram_file != NULL) |
| 236 | | mame_fclose(nvram_file); |
| 237 | | } |
| 238 | | |
| 239 | | static NVRAM_HANDLER( jaguar ) |
| 240 | | { |
| 241 | | if (read_or_write) { |
| 242 | | jaguar_nvram_save(machine); |
| 243 | | } |
| 244 | | else |
| 245 | | { |
| 246 | | if (file) |
| 247 | | jaguar_nvram_load(machine); |
| 248 | | } |
| 249 | | } |
| 250 | | */ |
| 251 | | static WRITE32_HANDLER( jaguar_eeprom_w ) |
| 252 | | { |
| 253 | | device_t *eeprom = space->machine().device("eeprom"); |
| 254 | | eeprom_bit_count++; |
| 255 | | if (eeprom_bit_count != 9) /* kill extra bit at end of address */ |
| 256 | | { |
| 257 | | eeprom_write_bit(eeprom,data >> 31); |
| 258 | | eeprom_set_clock_line(eeprom,PULSE_LINE); |
| 259 | | } |
| 260 | | } |
| 261 | | |
| 262 | | static READ32_HANDLER( jaguar_eeprom_clk ) |
| 263 | | { |
| 264 | | device_t *eeprom = space->machine().device("eeprom"); |
| 265 | | eeprom_set_clock_line(eeprom,PULSE_LINE); /* get next bit when reading */ |
| 266 | | return 0; |
| 267 | | } |
| 268 | | |
| 269 | | static READ32_HANDLER( jaguar_eeprom_cs ) |
| 270 | | { |
| 271 | | device_t *eeprom = space->machine().device("eeprom"); |
| 272 | | eeprom_set_cs_line(eeprom,ASSERT_LINE); /* must do at end of an operation */ |
| 273 | | eeprom_set_cs_line(eeprom,CLEAR_LINE); /* enable chip for next operation */ |
| 274 | | eeprom_write_bit(eeprom,1); /* write a start bit */ |
| 275 | | eeprom_set_clock_line(eeprom,PULSE_LINE); |
| 276 | | eeprom_bit_count = 0; |
| 277 | | return 0; |
| 278 | | } |
| 279 | | |
| 280 | | |
| 281 | | /************************************* |
| 282 | | * |
| 283 | | * 32-bit access to the GPU |
| 284 | | * |
| 285 | | *************************************/ |
| 286 | | |
| 287 | | static READ32_HANDLER( gpuctrl_r ) |
| 288 | | { |
| 289 | | UINT32 result = jaguargpu_ctrl_r(space->machine().device("gpu"), offset); |
| 290 | | |
| 291 | | if (protection_check != 1) return result; |
| 292 | | |
| 293 | | protection_check++; |
| 294 | | jaguar_gpu_ram[0] = 0x3d0dead; |
| 295 | | return 0x80000000; |
| 296 | | } |
| 297 | | |
| 298 | | |
| 299 | | static WRITE32_HANDLER( gpuctrl_w ) |
| 300 | | { |
| 301 | | if ((!protection_check) && (offset == 5) && (data == 1)) protection_check++; |
| 302 | | jaguargpu_ctrl_w(space->machine().device("gpu"), offset, data, mem_mask); |
| 303 | | } |
| 304 | | |
| 305 | | |
| 306 | | |
| 307 | | /************************************* |
| 308 | | * |
| 309 | | * 32-bit access to the DSP |
| 310 | | * |
| 311 | | *************************************/ |
| 312 | | |
| 313 | | static READ32_HANDLER( dspctrl_r ) |
| 314 | | { |
| 315 | | return jaguardsp_ctrl_r(space->machine().device("audiocpu"), offset); |
| 316 | | } |
| 317 | | |
| 318 | | |
| 319 | | static WRITE32_HANDLER( dspctrl_w ) |
| 320 | | { |
| 321 | | jaguardsp_ctrl_w(space->machine().device("audiocpu"), offset, data, mem_mask); |
| 322 | | } |
| 323 | | |
| 324 | | |
| 325 | | /************************************* |
| 326 | | * |
| 327 | | * Input ports |
| 328 | | * |
| 329 | | * Information from "The Jaguar Underground Documentation" |
| 330 | | * by Klaus and Nat! |
| 331 | | * |
| 332 | | *************************************/ |
| 333 | | |
| 334 | | static READ32_HANDLER( joystick_r ) |
| 335 | | { |
| 336 | | UINT16 joystick_result = 0xfffe; |
| 337 | | UINT16 joybuts_result = 0xffef; |
| 338 | | int i; |
| 339 | | static const char *const keynames[2][8] = |
| 340 | | { |
| 341 | | { "JOY0", "JOY1", "JOY2", "JOY3", "JOY4", "JOY5", "JOY6", "JOY7" }, |
| 342 | | { "BUTTONS0", "BUTTONS1", "BUTTONS2", "BUTTONS3", "BUTTONS4", "BUTTONS5", "BUTTONS6", "BUTTONS7" } |
| 343 | | }; |
| 344 | | |
| 345 | | /* |
| 346 | | * 16 12 8 4 0 |
| 347 | | * +---------+---------+---------^---------+ |
| 348 | | * | pad 1 | pad 0 | unused | |
| 349 | | * +---------+---------+-------------------+ |
| 350 | | * 15...12 11...8 7...0 |
| 351 | | * |
| 352 | | * Reading this register gives you the output of the selected columns |
| 353 | | * of the pads. |
| 354 | | * The buttons pressed will appear as cleared bits. |
| 355 | | * See the description of the column addressing to map the bits |
| 356 | | * to the buttons. |
| 357 | | */ |
| 358 | | |
| 359 | | for (i = 0; i < 8; i++) |
| 360 | | { |
| 361 | | if ((joystick_data & (0x10000 << i)) == 0) |
| 362 | | { |
| 363 | | joystick_result &= input_port_read(space->machine(), keynames[0][i]); |
| 364 | | joybuts_result &= input_port_read(space->machine(), keynames[1][i]); |
| 365 | | } |
| 366 | | } |
| 367 | | |
| 368 | | joystick_result |= eeprom_read_bit(space->machine().device("eeprom")); |
| 369 | | joybuts_result |= (input_port_read(space->machine(), "CONFIG") & 0x10); |
| 370 | | |
| 371 | | return (joystick_result << 16) | joybuts_result; |
| 372 | | } |
| 373 | | |
| 374 | | static WRITE32_HANDLER( joystick_w ) |
| 375 | | { |
| 376 | | /* |
| 377 | | * 16 12 8 4 0 |
| 378 | | * +-+-------^------+--+---------+---------+ |
| 379 | | * |r| unused |mu| col 1 | col 0 | |
| 380 | | * +-+--------------+--+---------+---------+ |
| 381 | | * 15 8 7...4 3...0 |
| 382 | | * |
| 383 | | * col 0: column control of joypad 0 |
| 384 | | * |
| 385 | | * Here you select which column of the joypad to poll. |
| 386 | | * The columns are: |
| 387 | | * |
| 388 | | * Joystick Joybut |
| 389 | | * col_bit|11 10 9 8 1 0 |
| 390 | | * -------+--+--+--+-- ---+------ |
| 391 | | * 0 | R L D U A PAUSE (RLDU = Joypad directions) |
| 392 | | * 1 | 1 4 7 * B |
| 393 | | * 2 | 2 5 8 0 C |
| 394 | | * 3 | 3 6 9 # OPTION |
| 395 | | * |
| 396 | | * You select a column my clearing the appropriate bit and setting |
| 397 | | * all the other "column" bits. |
| 398 | | * |
| 399 | | * |
| 400 | | * col1: column control of joypad 1 |
| 401 | | * |
| 402 | | * This is pretty much the same as for joypad EXCEPT that the |
| 403 | | * column addressing is reversed (strange!!) |
| 404 | | * |
| 405 | | * Joystick Joybut |
| 406 | | * col_bit|15 14 13 12 3 2 |
| 407 | | * -------+--+--+--+-- ---+------ |
| 408 | | * 4 | 3 6 9 # OPTION |
| 409 | | * 5 | 2 5 8 0 C |
| 410 | | * 6 | 1 4 7 * B |
| 411 | | * 7 | R L D U A PAUSE (RLDU = Joypad directions) |
| 412 | | * |
| 413 | | * mute (mu): sound control |
| 414 | | * |
| 415 | | * You can turn off the sound by clearing this bit. |
| 416 | | * |
| 417 | | * read enable (r): |
| 418 | | * |
| 419 | | * Set this bit to read from the joysticks, clear it to write |
| 420 | | * to them. |
| 421 | | */ |
| 422 | | COMBINE_DATA(&joystick_data); |
| 423 | | } |
| 424 | | |
| 425 | | |
| 426 | | |
| 427 | | |
| 428 | | /************************************* |
| 429 | | * |
| 430 | | * Main CPU memory handlers |
| 431 | | * |
| 432 | | *************************************/ |
| 433 | | |
| 434 | | // surely these should be 16-bit natively if the standard Jaguar is driven by a plain 68k? |
| 435 | | // all these trampolines are not good for performance ;-) |
| 436 | | |
| 437 | | static READ16_HANDLER( gpuctrl_r16 ) { if (!(offset&1)) { return gpuctrl_r(space, offset>>1, mem_mask<<16) >> 16; } else { return gpuctrl_r(space, offset>>1, mem_mask); } } |
| 438 | | static WRITE16_HANDLER( gpuctrl_w16 ) { if (!(offset&1)) { gpuctrl_w(space, offset>>1, data << 16, mem_mask << 16); } else { gpuctrl_w(space, offset>>1, data, mem_mask); } } |
| 439 | | static READ16_HANDLER( jaguar_blitter_r16 ) { if (!(offset&1)) { return jaguar_blitter_r(space, offset>>1, mem_mask<<16) >> 16; } else { return jaguar_blitter_r(space, offset>>1, mem_mask); } } |
| 440 | | static WRITE16_HANDLER( jaguar_blitter_w16 ) { if (!(offset&1)) { jaguar_blitter_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_blitter_w(space, offset>>1, data, mem_mask); } } |
| 441 | | static READ16_HANDLER( jaguar_serial_r16 ) { if (!(offset&1)) { return jaguar_serial_r(space, offset>>1, mem_mask<<16) >> 16; } else { return jaguar_serial_r(space, offset>>1, mem_mask); } } |
| 442 | | static WRITE16_HANDLER( jaguar_serial_w16 ) { if (!(offset&1)) { jaguar_serial_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_serial_w(space, offset>>1, data, mem_mask); } } |
| 443 | | static READ16_HANDLER( dspctrl_r16 ) { if (!(offset&1)) { return dspctrl_r(space, offset>>1, mem_mask<<16) >> 16; } else { return dspctrl_r(space, offset>>1, mem_mask); } } |
| 444 | | static WRITE16_HANDLER( dspctrl_w16 ) { if (!(offset&1)) { dspctrl_w(space, offset>>1, data << 16, mem_mask << 16); } else { dspctrl_w(space, offset>>1, data, mem_mask); } } |
| 445 | | static READ16_HANDLER( jaguar_eeprom_cs16 ) { if (!(offset&1)) { return jaguar_eeprom_cs(space, offset>>1, mem_mask<<16) >> 16; } else { return jaguar_eeprom_cs(space, offset>>1, mem_mask); } } |
| 446 | | static READ16_HANDLER( jaguar_eeprom_clk16 ) { if (!(offset&1)) { return jaguar_eeprom_clk(space, offset>>1, mem_mask<<16) >> 16; } else { return jaguar_eeprom_clk(space, offset>>1, mem_mask); } } |
| 447 | | static WRITE16_HANDLER( jaguar_eeprom_w16 ) { if (!(offset&1)) { jaguar_eeprom_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_eeprom_w(space, offset>>1, data, mem_mask); } } |
| 448 | | static READ16_HANDLER( joystick_r16 ) { if (!(offset&1)) { return joystick_r(space, offset>>1, mem_mask<<16) >> 16; } else { return joystick_r(space, offset>>1, mem_mask); } } |
| 449 | | static WRITE16_HANDLER( joystick_w16 ) { if (!(offset&1)) { joystick_w(space, offset>>1, data << 16, mem_mask << 16); } else { joystick_w(space, offset>>1, data, mem_mask); } } |
| 450 | | |
| 451 | | static READ32_HANDLER( jaguar_shared_ram_r ) { return jaguar_shared_ram[offset]; } |
| 452 | | static WRITE32_HANDLER( jaguar_shared_ram_w ) { COMBINE_DATA(&jaguar_shared_ram[offset]); } |
| 453 | | static READ32_HANDLER( jaguar_rom_base_r ) { return rom_base[offset]; } |
| 454 | | static WRITE32_HANDLER( jaguar_rom_base_w ) { /*ROM!*/ } |
| 455 | | static READ32_HANDLER( jaguar_cart_base_r ) { return cart_base[offset]; } |
| 456 | | static WRITE32_HANDLER( jaguar_cart_base_w ) { /*ROM!*/ } |
| 457 | | static READ32_HANDLER( high_rom_base_r ) { return high_rom_base[offset]; } |
| 458 | | static WRITE32_HANDLER( high_rom_base_w ) { /*ROM!*/ } |
| 459 | | static READ32_HANDLER( jaguar_dsp_ram_r ) { return jaguar_dsp_ram[offset]; } |
| 460 | | static WRITE32_HANDLER( jaguar_dsp_ram_w ) { COMBINE_DATA(&jaguar_dsp_ram[offset]); } |
| 461 | | static READ32_HANDLER( jaguar_gpu_clut_r ) { return jaguar_gpu_clut[offset]; } |
| 462 | | static WRITE32_HANDLER( jaguar_gpu_clut_w ) { COMBINE_DATA(&jaguar_gpu_clut[offset]); } |
| 463 | | static READ32_HANDLER( jaguar_gpu_ram_r ) { return jaguar_gpu_ram[offset]; } |
| 464 | | static WRITE32_HANDLER( jaguar_gpu_ram_w ) { COMBINE_DATA(&jaguar_gpu_ram[offset]); } |
| 465 | | |
| 466 | | static READ16_HANDLER( jaguar_shared_ram_r16 ) { if (!(offset&1)) { return jaguar_shared_ram_r(space, offset>>1, mem_mask<<16) >> 16; } else { return jaguar_shared_ram_r(space, offset>>1, mem_mask); } } |
| 467 | | static WRITE16_HANDLER( jaguar_shared_ram_w16 ) { if (!(offset&1)) { jaguar_shared_ram_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_shared_ram_w(space, offset>>1, data, mem_mask); } } |
| 468 | | static READ16_HANDLER( jaguar_rom_base_r16 ) { if (!(offset&1)) { return jaguar_rom_base_r(space, offset>>1, mem_mask<<16) >> 16; } else { return jaguar_rom_base_r(space, offset>>1, mem_mask); } } |
| 469 | | static WRITE16_HANDLER( jaguar_rom_base_w16 ) { if (!(offset&1)) { jaguar_rom_base_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_rom_base_w(space, offset>>1, data, mem_mask); } } |
| 470 | | static READ16_HANDLER( jaguar_cart_base_r16 ) { if (!(offset&1)) { return jaguar_cart_base_r(space, offset>>1, mem_mask<<16) >> 16; } else { return jaguar_cart_base_r(space, offset>>1, mem_mask); } } |
| 471 | | static WRITE16_HANDLER( jaguar_cart_base_w16 ) { if (!(offset&1)) { jaguar_cart_base_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_cart_base_w(space, offset>>1, data, mem_mask); } } |
| 472 | | static READ16_HANDLER( high_rom_base_r16 ) { if (!(offset&1)) { return high_rom_base_r(space, offset>>1, mem_mask<<16) >> 16; } else { return high_rom_base_r(space, offset>>1, mem_mask); } } |
| 473 | | static WRITE16_HANDLER( high_rom_base_w16 ) { if (!(offset&1)) { high_rom_base_w(space, offset>>1, data << 16, mem_mask << 16); } else { high_rom_base_w(space, offset>>1, data, mem_mask); } } |
| 474 | | |
| 475 | | static READ16_HANDLER( jaguar_dsp_ram_r16 ) { if (!(offset&1)) { return jaguar_dsp_ram_r(space, offset>>1, mem_mask<<16) >> 16; } else { return jaguar_dsp_ram_r(space, offset>>1, mem_mask); } } |
| 476 | | static WRITE16_HANDLER( jaguar_dsp_ram_w16 ) { if (!(offset&1)) { jaguar_dsp_ram_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_dsp_ram_w(space, offset>>1, data, mem_mask); } } |
| 477 | | static READ16_HANDLER( jaguar_gpu_clut_r16 ) { if (!(offset&1)) { return jaguar_gpu_clut_r(space, offset>>1, mem_mask<<16) >> 16; } else { return jaguar_gpu_clut_r(space, offset>>1, mem_mask); } } |
| 478 | | static WRITE16_HANDLER( jaguar_gpu_clut_w16 ) { if (!(offset&1)) { jaguar_gpu_clut_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_gpu_clut_w(space, offset>>1, data, mem_mask); } } |
| 479 | | static READ16_HANDLER( jaguar_gpu_ram_r16 ) { if (!(offset&1)) { return jaguar_gpu_ram_r(space, offset>>1, mem_mask<<16) >> 16; } else { return jaguar_gpu_ram_r(space, offset>>1, mem_mask); } } |
| 480 | | static WRITE16_HANDLER( jaguar_gpu_ram_w16 ) { if (!(offset&1)) { jaguar_gpu_ram_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_gpu_ram_w(space, offset>>1, data, mem_mask); } } |
| 481 | | |
| 482 | | static ADDRESS_MAP_START( jaguar_map, AS_PROGRAM, 16 ) |
| 483 | | ADDRESS_MAP_GLOBAL_MASK(0xffffff) |
| 484 | | AM_RANGE(0x000000, 0x1fffff) AM_MIRROR(0x200000) AM_READWRITE( jaguar_shared_ram_r16, jaguar_shared_ram_w16 ); |
| 485 | | AM_RANGE(0x800000, 0xdfffff) AM_READWRITE( jaguar_cart_base_r16, jaguar_cart_base_w16 ) |
| 486 | | AM_RANGE(0xe00000, 0xe1ffff) AM_READWRITE( jaguar_rom_base_r16, jaguar_rom_base_w16 ) |
| 487 | | AM_RANGE(0xf00000, 0xf003ff) AM_READWRITE(jaguar_tom_regs_r, jaguar_tom_regs_w) // might be reversed endian of the others.. |
| 488 | | AM_RANGE(0xf00400, 0xf005ff) AM_MIRROR(0x000200) AM_READWRITE(jaguar_gpu_clut_r16, jaguar_gpu_clut_w16 ) |
| 489 | | AM_RANGE(0xf02100, 0xf021ff) AM_MIRROR(0x008000) AM_READWRITE(gpuctrl_r16, gpuctrl_w16) |
| 490 | | AM_RANGE(0xf02200, 0xf022ff) AM_MIRROR(0x008000) AM_READWRITE(jaguar_blitter_r16, jaguar_blitter_w16) |
| 491 | | AM_RANGE(0xf03000, 0xf03fff) AM_MIRROR(0x008000) AM_READWRITE( jaguar_gpu_ram_r16, jaguar_gpu_ram_w16 ) |
| 492 | | AM_RANGE(0xf10000, 0xf103ff) AM_READWRITE(jaguar_jerry_regs_r, jaguar_jerry_regs_w) // might be reversed endian of the others.. |
| 493 | | AM_RANGE(0xf14000, 0xf14003) AM_READWRITE(joystick_r16, joystick_w16) |
| 494 | | AM_RANGE(0xf14800, 0xf14803) AM_READWRITE(jaguar_eeprom_clk16,jaguar_eeprom_w16) // GPI00 |
| 495 | | AM_RANGE(0xf15000, 0xf15003) AM_READ(jaguar_eeprom_cs16) // GPI01 |
| 496 | | AM_RANGE(0xf1a100, 0xf1a13f) AM_READWRITE(dspctrl_r16, dspctrl_w16) |
| 497 | | AM_RANGE(0xf1a140, 0xf1a17f) AM_READWRITE(jaguar_serial_r16, jaguar_serial_w16) |
| 498 | | AM_RANGE(0xf1b000, 0xf1cfff) AM_READWRITE(jaguar_dsp_ram_r16, jaguar_dsp_ram_w16) |
| 499 | | AM_RANGE(0xf1d000, 0xf1dfff) AM_READWRITE( high_rom_base_r16, high_rom_base_w16 ) |
| 500 | | ADDRESS_MAP_END |
| 501 | | |
| 502 | | /************************************* |
| 503 | | * |
| 504 | | * GPU/DSP memory handlers |
| 505 | | * |
| 506 | | *************************************/ |
| 507 | | |
| 508 | | static ADDRESS_MAP_START( gpu_map, AS_PROGRAM, 32 ) |
| 509 | | ADDRESS_MAP_GLOBAL_MASK(0xffffff) |
| 510 | | AM_RANGE(0x000000, 0x1fffff) AM_RAM AM_BASE(&jaguar_shared_ram) AM_MIRROR(0x200000) AM_SHARE("share1") AM_REGION("maincpu", 0) |
| 511 | | AM_RANGE(0x800000, 0xdfffff) AM_ROM AM_BASE(&cart_base) AM_SIZE(&cart_size) AM_SHARE("share15") AM_REGION("maincpu", 0x800000) |
| 512 | | AM_RANGE(0xe00000, 0xe1ffff) AM_ROM AM_BASE(&rom_base) AM_SIZE(&rom_size) AM_SHARE("share16") AM_REGION("maincpu", 0xe00000) |
| 513 | | AM_RANGE(0xf00000, 0xf003ff) AM_READWRITE(jaguar_tom_regs32_r, jaguar_tom_regs32_w) |
| 514 | | AM_RANGE(0xf00400, 0xf005ff) AM_BASE(&jaguar_gpu_clut) AM_MIRROR(0x000200) AM_RAM AM_SHARE("share2") |
| 515 | | AM_RANGE(0xf02100, 0xf021ff) AM_MIRROR(0x008000) AM_READWRITE(gpuctrl_r, gpuctrl_w) |
| 516 | | AM_RANGE(0xf02200, 0xf022ff) AM_MIRROR(0x008000) AM_READWRITE(jaguar_blitter_r, jaguar_blitter_w) |
| 517 | | AM_RANGE(0xf03000, 0xf03fff) AM_BASE(&jaguar_gpu_ram) AM_MIRROR(0x008000) AM_RAM AM_SHARE("share3") |
| 518 | | AM_RANGE(0xf10000, 0xf103ff) AM_READWRITE(jaguar_jerry_regs32_r, jaguar_jerry_regs32_w) |
| 519 | | AM_RANGE(0xf14000, 0xf14003) AM_READWRITE(joystick_r, joystick_w) |
| 520 | | AM_RANGE(0xf1a100, 0xf1a13f) AM_READWRITE(dspctrl_r, dspctrl_w) |
| 521 | | AM_RANGE(0xf1a140, 0xf1a17f) AM_READWRITE(jaguar_serial_r, jaguar_serial_w) |
| 522 | | AM_RANGE(0xf1b000, 0xf1cfff) AM_BASE(&jaguar_dsp_ram) AM_RAM AM_SHARE("share4") |
| 523 | | AM_RANGE(0xf1d000, 0xf1dfff) AM_ROM AM_BASE(&high_rom_base) AM_REGION("maincpu", 0xf1d000) |
| 524 | | ADDRESS_MAP_END |
| 525 | | |
| 526 | | static ADDRESS_MAP_START( dsp_map, AS_PROGRAM, 32 ) |
| 527 | | ADDRESS_MAP_GLOBAL_MASK(0xffffff) |
| 528 | | AM_RANGE(0x000000, 0x1fffff) AM_MIRROR(0x200000) AM_RAM AM_SHARE("share1") AM_REGION("maincpu", 0) |
| 529 | | AM_RANGE(0x800000, 0xdfffff) AM_ROM AM_SHARE("share15") AM_REGION("maincpu", 0x800000) |
| 530 | | AM_RANGE(0xe00000, 0xe1ffff) AM_ROM AM_SHARE("share16") AM_REGION("maincpu", 0xe00000) |
| 531 | | AM_RANGE(0xf00000, 0xf003ff) AM_READWRITE(jaguar_tom_regs32_r, jaguar_tom_regs32_w) |
| 532 | | AM_RANGE(0xf00400, 0xf005ff) AM_MIRROR(0x000200) AM_RAM AM_SHARE("share2") |
| 533 | | AM_RANGE(0xf02100, 0xf021ff) AM_MIRROR(0x008000) AM_READWRITE(gpuctrl_r, gpuctrl_w) |
| 534 | | AM_RANGE(0xf02200, 0xf022ff) AM_MIRROR(0x008000) AM_READWRITE(jaguar_blitter_r, jaguar_blitter_w) |
| 535 | | AM_RANGE(0xf03000, 0xf03fff) AM_MIRROR(0x008000) AM_RAM AM_SHARE("share3") |
| 536 | | AM_RANGE(0xf10000, 0xf103ff) AM_READWRITE(jaguar_jerry_regs32_r, jaguar_jerry_regs32_w) |
| 537 | | AM_RANGE(0xf14000, 0xf14003) AM_READWRITE(joystick_r, joystick_w) |
| 538 | | AM_RANGE(0xf1a100, 0xf1a13f) AM_READWRITE(dspctrl_r, dspctrl_w) |
| 539 | | AM_RANGE(0xf1a140, 0xf1a17f) AM_READWRITE(jaguar_serial_r, jaguar_serial_w) |
| 540 | | AM_RANGE(0xf1b000, 0xf1cfff) AM_RAM AM_SHARE("share4") |
| 541 | | AM_RANGE(0xf1d000, 0xf1dfff) AM_ROM AM_REGION("maincpu", 0xf1d000) |
| 542 | | ADDRESS_MAP_END |
| 543 | | |
| 544 | | |
| 545 | | /************************************* |
| 546 | | * |
| 547 | | * Port definitions |
| 548 | | * |
| 549 | | *************************************/ |
| 550 | | |
| 551 | | static INPUT_PORTS_START( jaguar ) |
| 552 | | PORT_START("JOY0") |
| 553 | | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) |
| 554 | | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) |
| 555 | | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) |
| 556 | | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) |
| 557 | | PORT_BIT( 0xf0ff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 558 | | |
| 559 | | PORT_START("JOY1") |
| 560 | | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P1 Keypad 1") PORT_CODE(KEYCODE_1) PORT_PLAYER(1) |
| 561 | | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P1 Keypad 4") PORT_CODE(KEYCODE_4) PORT_PLAYER(1) |
| 562 | | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P1 Keypad 7") PORT_CODE(KEYCODE_7) PORT_PLAYER(1) |
| 563 | | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P1 Keypad *") PORT_CODE(KEYCODE_K) PORT_PLAYER(1) |
| 564 | | PORT_BIT( 0xf0ff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 565 | | |
| 566 | | PORT_START("JOY2") |
| 567 | | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P1 Keypad 2") PORT_CODE(KEYCODE_2) PORT_PLAYER(1) |
| 568 | | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P1 Keypad 5") PORT_CODE(KEYCODE_5) PORT_PLAYER(1) |
| 569 | | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P1 Keypad 8") PORT_CODE(KEYCODE_8) PORT_PLAYER(1) |
| 570 | | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P1 Keypad 0") PORT_CODE(KEYCODE_0) PORT_PLAYER(1) |
| 571 | | PORT_BIT( 0xf0ff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 572 | | |
| 573 | | PORT_START("JOY3") |
| 574 | | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P1 Keypad 3") PORT_CODE(KEYCODE_3) PORT_PLAYER(1) |
| 575 | | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P1 Keypad 6") PORT_CODE(KEYCODE_6) PORT_PLAYER(1) |
| 576 | | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P1 Keypad 9") PORT_CODE(KEYCODE_9) PORT_PLAYER(1) |
| 577 | | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P1 Keypad #") PORT_CODE(KEYCODE_L) PORT_PLAYER(1) |
| 578 | | PORT_BIT( 0xf0ff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 579 | | |
| 580 | | PORT_START("JOY4") |
| 581 | | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P2 Keypad 3") PORT_PLAYER(2) |
| 582 | | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P2 Keypad 6") PORT_PLAYER(2) |
| 583 | | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P2 Keypad 9") PORT_PLAYER(2) |
| 584 | | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P2 Keypad #") PORT_PLAYER(2) |
| 585 | | PORT_BIT( 0x0fff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 586 | | |
| 587 | | PORT_START("JOY5") |
| 588 | | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P2 Keypad 2") PORT_PLAYER(2) |
| 589 | | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P2 Keypad 5") PORT_PLAYER(2) |
| 590 | | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P2 Keypad 8") PORT_PLAYER(2) |
| 591 | | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P2 Keypad 0") PORT_PLAYER(2) |
| 592 | | PORT_BIT( 0x0fff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 593 | | |
| 594 | | PORT_START("JOY6") |
| 595 | | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P2 Keypad 1") PORT_PLAYER(2) |
| 596 | | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P2 Keypad 4") PORT_PLAYER(2) |
| 597 | | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P2 Keypad 7") PORT_PLAYER(2) |
| 598 | | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("P2 Keypad *") PORT_PLAYER(2) |
| 599 | | PORT_BIT( 0x0fff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 600 | | |
| 601 | | PORT_START("JOY7") |
| 602 | | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) |
| 603 | | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) |
| 604 | | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) |
| 605 | | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) |
| 606 | | PORT_BIT( 0x0fff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 607 | | |
| 608 | | PORT_START("BUTTONS0") |
| 609 | | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P1 Pause") PORT_CODE(KEYCODE_I) PORT_PLAYER(1) |
| 610 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 A") PORT_PLAYER(1) |
| 611 | | PORT_BIT( 0xfffc, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 612 | | |
| 613 | | PORT_START("BUTTONS1") |
| 614 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 B") PORT_PLAYER(1) |
| 615 | | PORT_BIT( 0xfffd, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 616 | | |
| 617 | | PORT_START("BUTTONS2") |
| 618 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 C") PORT_PLAYER(1) |
| 619 | | PORT_BIT( 0xfffd, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 620 | | |
| 621 | | PORT_START("BUTTONS3") |
| 622 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 Option") PORT_CODE(KEYCODE_O) PORT_PLAYER(1) |
| 623 | | PORT_BIT( 0xfffd, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 624 | | |
| 625 | | PORT_START("BUTTONS4") |
| 626 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P2 Option") PORT_PLAYER(2) |
| 627 | | PORT_BIT( 0xfffd, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 628 | | |
| 629 | | PORT_START("BUTTONS5") |
| 630 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P2 C") PORT_PLAYER(2) |
| 631 | | PORT_BIT( 0xfffd, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 632 | | |
| 633 | | PORT_START("BUTTONS6") |
| 634 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 B") PORT_PLAYER(2) |
| 635 | | PORT_BIT( 0xfffd, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 636 | | |
| 637 | | PORT_START("BUTTONS7") |
| 638 | | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P2 Pause") PORT_PLAYER(2) |
| 639 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 A") PORT_PLAYER(2) |
| 640 | | PORT_BIT( 0xfffc, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 641 | | |
| 642 | | PORT_START("CONFIG") |
| 643 | | PORT_CONFNAME( 0x02, 0x00, "Show Logo") |
| 644 | | PORT_CONFSETTING( 0x00, "Yes") |
| 645 | | PORT_CONFSETTING( 0x02, "No") |
| 646 | | PORT_CONFNAME( 0x10, 0x10, "TV System") |
| 647 | | PORT_CONFSETTING( 0x00, "PAL") |
| 648 | | PORT_CONFSETTING( 0x10, "NTSC") |
| 649 | | INPUT_PORTS_END |
| 650 | | |
| 651 | | |
| 652 | | /************************************* |
| 653 | | * |
| 654 | | * Machine driver |
| 655 | | * |
| 656 | | *************************************/ |
| 657 | | |
| 658 | | |
| 659 | | static const jaguar_cpu_config gpu_config = |
| 660 | | { |
| 661 | | jaguar_gpu_cpu_int |
| 662 | | }; |
| 663 | | |
| 664 | | |
| 665 | | static const jaguar_cpu_config dsp_config = |
| 666 | | { |
| 667 | | jaguar_dsp_cpu_int |
| 668 | | }; |
| 669 | | |
| 670 | | static MACHINE_CONFIG_START( jaguar, driver_device ) |
| 671 | | |
| 672 | | /* basic machine hardware */ |
| 673 | | MCFG_CPU_ADD("maincpu", M68000, JAGUAR_CLOCK/2) |
| 674 | | MCFG_CPU_PROGRAM_MAP(jaguar_map) |
| 675 | | |
| 676 | | MCFG_CPU_ADD("gpu", JAGUARGPU, JAGUAR_CLOCK) |
| 677 | | MCFG_CPU_CONFIG(gpu_config) |
| 678 | | MCFG_CPU_PROGRAM_MAP(gpu_map) |
| 679 | | |
| 680 | | MCFG_CPU_ADD("audiocpu", JAGUARDSP, JAGUAR_CLOCK) |
| 681 | | MCFG_CPU_CONFIG(dsp_config) |
| 682 | | MCFG_CPU_PROGRAM_MAP(dsp_map) |
| 683 | | |
| 684 | | MCFG_MACHINE_RESET(jaguar) |
| 685 | | // MCFG_NVRAM_HANDLER(jaguar) |
| 686 | | |
| 687 | | MCFG_TIMER_ADD("serial_timer", jaguar_serial_callback) |
| 688 | | |
| 689 | | /* video hardware */ |
| 690 | | MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) |
| 691 | | MCFG_SCREEN_ADD("screen", RASTER) |
| 692 | | MCFG_SCREEN_REFRESH_RATE(60) |
| 693 | | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 694 | | MCFG_SCREEN_RAW_PARAMS(JAGUAR_CLOCK, 456, 42, 402, 262, 17, 257) |
| 695 | | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| 696 | | MCFG_SCREEN_UPDATE(cojag) |
| 697 | | |
| 698 | | MCFG_VIDEO_START(jaguar) |
| 699 | | |
| 700 | | /* sound hardware */ |
| 701 | | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 702 | | MCFG_SOUND_ADD("dac1", DAC, 0) |
| 703 | | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) |
| 704 | | MCFG_SOUND_ADD("dac2", DAC, 0) |
| 705 | | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) |
| 706 | | |
| 707 | | /* quickload */ |
| 708 | | MCFG_QUICKLOAD_ADD("quickload", jaguar, "abs,bin,cof,jag,prg", 0) |
| 709 | | |
| 710 | | /* cartridge */ |
| 711 | | MCFG_CARTSLOT_ADD("cart") |
| 712 | | MCFG_CARTSLOT_EXTENSION_LIST("j64,rom") |
| 713 | | MCFG_CARTSLOT_INTERFACE("jaguar_cart") |
| 714 | | MCFG_CARTSLOT_START(jaguar_cart) |
| 715 | | MCFG_CARTSLOT_LOAD(jaguar) |
| 716 | | |
| 717 | | /* software lists */ |
| 718 | | MCFG_SOFTWARE_LIST_ADD("cart_list","jaguar") |
| 719 | | |
| 720 | | MCFG_EEPROM_93C46_ADD("eeprom") |
| 721 | | MACHINE_CONFIG_END |
| 722 | | |
| 723 | | |
| 724 | | |
| 725 | | /************************************* |
| 726 | | * |
| 727 | | * ROM definition(s) |
| 728 | | * |
| 729 | | *************************************/ |
| 730 | | |
| 731 | | ROM_START( jaguar ) |
| 732 | | ROM_REGION( 0x1000000, "maincpu", 0 ) /* 4MB for RAM at 0 */ |
| 733 | | ROM_LOAD16_WORD( "jagboot.rom", 0xe00000, 0x020000, CRC(fb731aaa) SHA1(f8991b0c385f4e5002fa2a7e2f5e61e8c5213356) ) |
| 734 | | ROM_CART_LOAD("cart", 0x800000, 0x600000, ROM_NOMIRROR) |
| 735 | | ROM_LOAD16_WORD("jagwave.rom", 0xf1d000, 0x1000, CRC(7a25ee5b) SHA1(58117e11fd6478c521fbd3fdbe157f39567552f0) ) |
| 736 | | ROM_END |
| 737 | | |
| 738 | | ROM_START( jaguarcd ) |
| 739 | | ROM_REGION( 0x1000000, "maincpu", 0 ) |
| 740 | | ROM_SYSTEM_BIOS( 0, "default", "Jaguar CD" ) |
| 741 | | ROMX_LOAD( "jag_cd.bin", 0xe00000, 0x040000, CRC(687068d5) SHA1(73883e7a6e9b132452436f7ab1aeaeb0776428e5), ROM_BIOS(1) ) |
| 742 | | ROM_SYSTEM_BIOS( 1, "dev", "Jaguar Developer CD" ) |
| 743 | | ROMX_LOAD( "jagdevcd.bin", 0xe00000, 0x040000, CRC(55a0669c) SHA1(d61b7b5912118f114ef00cf44966a5ef62e455a5), ROM_BIOS(2) ) |
| 744 | | ROM_CART_LOAD("cart", 0x800000, 0x600000, ROM_NOMIRROR) |
| 745 | | ROM_LOAD16_WORD("jagwave.rom", 0xf1d000, 0x1000, CRC(7a25ee5b) SHA1(58117e11fd6478c521fbd3fdbe157f39567552f0) ) |
| 746 | | ROM_END |
| 747 | | |
| 748 | | /************************************* |
| 749 | | * |
| 750 | | * Driver initialization |
| 751 | | * |
| 752 | | *************************************/ |
| 753 | | |
| 754 | | static void jaguar_fix_endian( running_machine &machine, UINT32 addr, UINT32 size ) |
| 755 | | { |
| 756 | | UINT8 j[4], *RAM = machine.region("maincpu")->base(); |
| 757 | | UINT32 i; |
| 758 | | size += addr; |
| 759 | | logerror("File Loaded to address range %X to %X\n",addr,size-1); |
| 760 | | for (i = addr; i < size; i+=4) |
| 761 | | { |
| 762 | | j[0] = RAM[i]; |
| 763 | | j[1] = RAM[i+1]; |
| 764 | | j[2] = RAM[i+2]; |
| 765 | | j[3] = RAM[i+3]; |
| 766 | | RAM[i] = j[3]; |
| 767 | | RAM[i+1] = j[2]; |
| 768 | | RAM[i+2] = j[1]; |
| 769 | | RAM[i+3] = j[0]; |
| 770 | | } |
| 771 | | } |
| 772 | | |
| 773 | | static DRIVER_INIT( jaguar ) |
| 774 | | { |
| 775 | | state_save_register_global(machine, joystick_data); |
| 776 | | using_cart = 0; |
| 777 | | |
| 778 | | for (int i=0;i<0x20000/4;i++) // the cd bios is bigger.. check |
| 779 | | { |
| 780 | | rom_base[i] = ((rom_base[i] & 0xffff0000)>>16) | ((rom_base[i] & 0x0000ffff)<<16); |
| 781 | | } |
| 782 | | |
| 783 | | for (int i=0;i<0x1000/4;i++) |
| 784 | | { |
| 785 | | high_rom_base[i] = ((high_rom_base[i] & 0xffff0000)>>16) | ((high_rom_base[i] & 0x0000ffff)<<16); |
| 786 | | } |
| 787 | | } |
| 788 | | |
| 789 | | static QUICKLOAD_LOAD( jaguar ) |
| 790 | | { |
| 791 | | offs_t quickload_begin = 0x4000, start = quickload_begin, skip = 0; |
| 792 | | memset(jaguar_shared_ram, 0, 0x200000); |
| 793 | | quickload_size = MIN(quickload_size, 0x200000 - quickload_begin); |
| 794 | | |
| 795 | | image.fread( &image.device().machine().region("maincpu")->base()[quickload_begin], quickload_size); |
| 796 | | |
| 797 | | jaguar_fix_endian(image.device().machine(), quickload_begin, quickload_size); |
| 798 | | |
| 799 | | /* Deal with some of the numerous homebrew header systems */ |
| 800 | | /* COF */ |
| 801 | | if ((jaguar_shared_ram[0x1000] & 0xffff0000) == 0x01500000) |
| 802 | | { |
| 803 | | start = jaguar_shared_ram[0x100e]; |
| 804 | | skip = jaguar_shared_ram[0x1011]; |
| 805 | | } |
| 806 | | else /* PRG */ |
| 807 | | if (((jaguar_shared_ram[0x1000] & 0xffff0000) == 0x601A0000) && (jaguar_shared_ram[0x1007] == 0x4A414752)) |
| 808 | | { |
| 809 | | UINT32 type = jaguar_shared_ram[0x1008] >> 16; |
| 810 | | start = ((jaguar_shared_ram[0x1008] & 0xffff) << 16) | (jaguar_shared_ram[0x1009] >> 16); |
| 811 | | skip = 28; |
| 812 | | if (type == 2) skip = 42; |
| 813 | | else if (type == 3) skip = 46; |
| 814 | | } |
| 815 | | else /* ABS with header */ |
| 816 | | if ((jaguar_shared_ram[0x1000] & 0xffff0000) == 0x601B0000) |
| 817 | | { |
| 818 | | start = ((jaguar_shared_ram[0x1005] & 0xffff) << 16) | (jaguar_shared_ram[0x1006] >> 16); |
| 819 | | skip = 36; |
| 820 | | } |
| 821 | | |
| 822 | | else /* A header used by Badcoder */ |
| 823 | | if ((jaguar_shared_ram[0x1000] & 0xffff0000) == 0x72000000) |
| 824 | | skip = 96; |
| 825 | | |
| 826 | | else /* ABS binary */ |
| 827 | | if (!mame_stricmp(image.filetype(), "abs")) |
| 828 | | start = 0xc000; |
| 829 | | |
| 830 | | else /* JAG binary */ |
| 831 | | if (!mame_stricmp(image.filetype(), "jag")) |
| 832 | | start = 0x5000; |
| 833 | | |
| 834 | | |
| 835 | | /* Now that we have the info, reload the file */ |
| 836 | | if ((start != quickload_begin) || (skip)) |
| 837 | | { |
| 838 | | memset(jaguar_shared_ram, 0, 0x200000); |
| 839 | | image.fseek(0, SEEK_SET); |
| 840 | | image.fread( &image.device().machine().region("maincpu")->base()[start-skip], quickload_size); |
| 841 | | quickload_begin = start; |
| 842 | | jaguar_fix_endian(image.device().machine(), (start-skip)&0xfffffc, quickload_size); |
| 843 | | } |
| 844 | | |
| 845 | | |
| 846 | | /* Some programs are too lazy to set a stack pointer */ |
| 847 | | cpu_set_reg(image.device().machine().device("maincpu"), STATE_GENSP, 0x1000); |
| 848 | | jaguar_shared_ram[0]=0x1000; |
| 849 | | |
| 850 | | /* Transfer control to image */ |
| 851 | | cpu_set_reg(image.device().machine().device("maincpu"), STATE_GENPC, quickload_begin); |
| 852 | | jaguar_shared_ram[1]=quickload_begin; |
| 853 | | return IMAGE_INIT_PASS; |
| 854 | | } |
| 855 | | |
| 856 | | static DEVICE_START( jaguar_cart ) |
| 857 | | { |
| 858 | | /* Initialize for no cartridge present */ |
| 859 | | using_cart = 0; |
| 860 | | memset( cart_base, 0, cart_size ); |
| 861 | | } |
| 862 | | |
| 863 | | static DEVICE_IMAGE_LOAD( jaguar ) |
| 864 | | { |
| 865 | | UINT32 size, load_offset = 0; |
| 866 | | |
| 867 | | if (image.software_entry() == NULL) |
| 868 | | { |
| 869 | | size = image.length(); |
| 870 | | |
| 871 | | /* .rom files load & run at 802000 */ |
| 872 | | if (!mame_stricmp(image.filetype(), "rom")) |
| 873 | | { |
| 874 | | load_offset = 0x2000; // fix load address |
| 875 | | cart_base[0x101]=0x802000; // fix exec address |
| 876 | | } |
| 877 | | |
| 878 | | /* Load cart into memory */ |
| 879 | | image.fread( &image.device().machine().region("maincpu")->base()[0x800000+load_offset], size); |
| 880 | | } |
| 881 | | else |
| 882 | | { |
| 883 | | size = image.get_software_region_length("rom"); |
| 884 | | |
| 885 | | memcpy(cart_base, image.get_software_region("rom"), size); |
| 886 | | } |
| 887 | | |
| 888 | | memset(jaguar_shared_ram, 0, 0x200000); |
| 889 | | |
| 890 | | jaguar_fix_endian(image.device().machine(), 0x800000+load_offset, size); |
| 891 | | |
| 892 | | /* Skip the logo */ |
| 893 | | using_cart = 1; |
| 894 | | // cart_base[0x102] = 1; |
| 895 | | |
| 896 | | /* Transfer control to the bios */ |
| 897 | | cpu_set_reg(image.device().machine().device("maincpu"), STATE_GENPC, rom_base[1]); |
| 898 | | return IMAGE_INIT_PASS; |
| 899 | | } |
| 900 | | |
| 901 | | /************************************* |
| 902 | | * |
| 903 | | * Game driver(s) |
| 904 | | * |
| 905 | | *************************************/ |
| 906 | | |
| 907 | | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ |
| 908 | | CONS( 1993, jaguar, 0, 0, jaguar, jaguar, jaguar, "Atari", "Jaguar", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
| 909 | | CONS( 1995, jaguarcd, jaguar, 0, jaguar, jaguar, jaguar, "Atari", "Jaguar CD", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |