src/mess/audio/jaguar.c
| r0 | r5126 | |
| 1 | /***************************************************************************
|
| 2 | |
| 3 | Atari Jaguar hardware
|
| 4 | |
| 5 | ****************************************************************************
|
| 6 | |
| 7 | ------------------------------------------------------------
|
| 8 | JERRY REGISTERS
|
| 9 | ------------------------------------------------------------
|
| 10 | F10000-F13FFF R/W xxxxxxxx xxxxxxxx Jerry
|
| 11 | F10000 W xxxxxxxx xxxxxxxx JPIT1 - timer 1 pre-scaler
|
| 12 | F10004 W xxxxxxxx xxxxxxxx JPIT2 - timer 1 divider
|
| 13 | F10008 W xxxxxxxx xxxxxxxx JPIT3 - timer 2 pre-scaler
|
| 14 | F1000C W xxxxxxxx xxxxxxxx JPIT4 - timer 2 divider
|
| 15 | F10010 W ------xx xxxxxxxx CLK1 - processor clock divider
|
| 16 | F10012 W ------xx xxxxxxxx CLK2 - video clock divider
|
| 17 | F10014 W -------- --xxxxxx CLK3 - chroma clock divider
|
| 18 | F10020 R/W ---xxxxx ---xxxxx JINTCTRL - interrupt control register
|
| 19 | W ---x---- -------- (J_SYNCLR - clear synchronous serial intf ints)
|
| 20 | W ----x--- -------- (J_ASYNCLR - clear asynchronous serial intf ints)
|
| 21 | W -----x-- -------- (J_TIM2CLR - clear timer 2 [tempo] interrupts)
|
| 22 | W ------x- -------- (J_TIM1CLR - clear timer 1 [sample] interrupts)
|
| 23 | W -------x -------- (J_EXTCLR - clear external interrupts)
|
| 24 | R/W -------- ---x---- (J_SYNENA - enable synchronous serial intf ints)
|
| 25 | R/W -------- ----x--- (J_ASYNENA - enable asynchronous serial intf ints)
|
| 26 | R/W -------- -----x-- (J_TIM2ENA - enable timer 2 [tempo] interrupts)
|
| 27 | R/W -------- ------x- (J_TIM1ENA - enable timer 1 [sample] interrupts)
|
| 28 | R/W -------- -------x (J_EXTENA - enable external interrupts)
|
| 29 | F10030 R/W -------- xxxxxxxx ASIDATA - asynchronous serial data
|
| 30 | F10032 W -x------ -xxxxxxx ASICTRL - asynchronous serial control
|
| 31 | W -x------ -------- (TXBRK - transmit break)
|
| 32 | W -------- -x------ (CLRERR - clear error)
|
| 33 | W -------- --x----- (RINTEN - enable receiver interrupts)
|
| 34 | W -------- ---x---- (TINTEN - enable transmitter interrupts)
|
| 35 | W -------- ----x--- (RXIPOL - receiver input polarity)
|
| 36 | W -------- -----x-- (TXOPOL - transmitter output polarity)
|
| 37 | W -------- ------x- (PAREN - parity enable)
|
| 38 | W -------- -------x (ODD - odd parity select)
|
| 39 | F10032 R xxx-xxxx x-xxxxxx ASISTAT - asynchronous serial status
|
| 40 | R x------- -------- (ERROR - OR of PE,FE,OE)
|
| 41 | R -x------ -------- (TXBRK - transmit break)
|
| 42 | R --x----- -------- (SERIN - serial input)
|
| 43 | R ----x--- -------- (OE - overrun error)
|
| 44 | R -----x-- -------- (FE - framing error)
|
| 45 | R ------x- -------- (PE - parity error)
|
| 46 | R -------x -------- (TBE - transmit buffer empty)
|
| 47 | R -------- x------- (RBF - receive buffer full)
|
| 48 | R -------- ---x---- (TINTEN - enable transmitter interrupts)
|
| 49 | R -------- ----x--- (RXIPOL - receiver input polarity)
|
| 50 | R -------- -----x-- (TXOPOL - transmitter output polarity)
|
| 51 | R -------- ------x- (PAREN - parity enable)
|
| 52 | R -------- -------x (ODD - odd parity)
|
| 53 | F10034 R/W xxxxxxxx xxxxxxxx ASICLK - asynchronous serial interface clock
|
| 54 | ------------------------------------------------------------
|
| 55 | F14000-F17FFF R/W xxxxxxxx xxxxxxxx Joysticks and GPIO0-5
|
| 56 | F14000 R xxxxxxxx xxxxxxxx JOYSTICK - read joystick state
|
| 57 | F14000 W x------- xxxxxxxx JOYSTICK - latch joystick output
|
| 58 | W x------- -------- (enable joystick outputs)
|
| 59 | W -------- xxxxxxxx (joystick output data)
|
| 60 | F14002 R xxxxxxxx xxxxxxxx JOYBUTS - button register
|
| 61 | F14800-F14FFF R/W xxxxxxxx xxxxxxxx GPI00 - reserved
|
| 62 | F15000-F15FFF R/W xxxxxxxx xxxxxxxx GPI01 - reserved
|
| 63 | F16000-F16FFF R/W xxxxxxxx xxxxxxxx GPI02 - reserved
|
| 64 | F17000-F177FF R/W xxxxxxxx xxxxxxxx GPI03 - reserved
|
| 65 | F17800-F17BFF R/W xxxxxxxx xxxxxxxx GPI04 - reserved
|
| 66 | F17C00-F17FFF R/W xxxxxxxx xxxxxxxx GPI05 - reserved
|
| 67 | ------------------------------------------------------------
|
| 68 | F18000-F1FFFF R/W xxxxxxxx xxxxxxxx Jerry DSP
|
| 69 | F1A100 R/W xxxxxxxx xxxxxxxx D_FLAGS - DSP flags register
|
| 70 | R/W x------- -------- (DMAEN - DMA enable)
|
| 71 | R/W -x------ -------- (REGPAGE - register page)
|
| 72 | W --x----- -------- (D_EXT0CLR - clear external interrupt 0)
|
| 73 | W ---x---- -------- (D_TIM2CLR - clear timer 2 interrupt)
|
| 74 | W ----x--- -------- (D_TIM1CLR - clear timer 1 interrupt)
|
| 75 | W -----x-- -------- (D_I2SCLR - clear I2S interrupt)
|
| 76 | W ------x- -------- (D_CPUCLR - clear CPU interrupt)
|
| 77 | R/W -------x -------- (D_EXT0ENA - enable external interrupt 0)
|
| 78 | R/W -------- x------- (D_TIM2ENA - enable timer 2 interrupt)
|
| 79 | R/W -------- -x------ (D_TIM1ENA - enable timer 1 interrupt)
|
| 80 | R/W -------- --x----- (D_I2SENA - enable I2S interrupt)
|
| 81 | R/W -------- ---x---- (D_CPUENA - enable CPU interrupt)
|
| 82 | R/W -------- ----x--- (IMASK - interrupt mask)
|
| 83 | R/W -------- -----x-- (NEGA_FLAG - ALU negative)
|
| 84 | R/W -------- ------x- (CARRY_FLAG - ALU carry)
|
| 85 | R/W -------- -------x (ZERO_FLAG - ALU zero)
|
| 86 | F1A102 R/W -------- ------xx D_FLAGS - upper DSP flags
|
| 87 | R/W -------- ------x- (D_EXT1ENA - enable external interrupt 1)
|
| 88 | R/W -------- -------x (D_EXT1CLR - clear external interrupt 1)
|
| 89 | F1A104 W -------- ----xxxx D_MTXC - matrix control register
|
| 90 | W -------- ----x--- (MATCOL - column/row major)
|
| 91 | W -------- -----xxx (MATRIX3-15 - matrix width)
|
| 92 | F1A108 W ----xxxx xxxxxx-- D_MTXA - matrix address register
|
| 93 | F1A10C W -------- -----x-x D_END - data organization register
|
| 94 | W -------- -----x-- (BIG_INST - big endian instruction fetch)
|
| 95 | W -------- -------x (BIG_IO - big endian I/O)
|
| 96 | F1A110 R/W xxxxxxxx xxxxxxxx D_PC - DSP program counter
|
| 97 | F1A114 R/W xxxxxxxx xx-xxxxx D_CTRL - DSP control/status register
|
| 98 | R xxxx---- -------- (VERSION - DSP version code)
|
| 99 | R/W ----x--- -------- (BUS_HOG - hog the bus!)
|
| 100 | R/W -----x-- -------- (D_EXT0LAT - external interrupt 0 latch)
|
| 101 | R/W ------x- -------- (D_TIM2LAT - timer 2 interrupt latch)
|
| 102 | R/W -------x -------- (D_TIM1LAT - timer 1 interrupt latch)
|
| 103 | R/W -------- x------- (D_I2SLAT - I2S interrupt latch)
|
| 104 | R/W -------- -x------ (D_CPULAT - CPU interrupt latch)
|
| 105 | R/W -------- ---x---- (SINGLE_GO - single step one instruction)
|
| 106 | R/W -------- ----x--- (SINGLE_STEP - single step mode)
|
| 107 | R/W -------- -----x-- (FORCEINT0 - cause interrupt 0 on GPU)
|
| 108 | R/W -------- ------x- (CPUINT - send GPU interrupt to CPU)
|
| 109 | R/W -------- -------x (DSPGO - enable DSP execution)
|
| 110 | F1A116 R/W -------- -------x D_CTRL - upper DSP control/status register
|
| 111 | R/W -------- -------x (D_EXT1LAT - external interrupt 1 latch)
|
| 112 | F1A118-F1A11B W xxxxxxxx xxxxxxxx D_MOD - modulo instruction mask
|
| 113 | F1A11C-F1A11F R xxxxxxxx xxxxxxxx D_REMAIN - divide unit remainder
|
| 114 | F1A11C W -------- -------x D_DIVCTRL - divide unit control
|
| 115 | W -------- -------x (DIV_OFFSET - 1=16.16 divide, 0=32-bit divide)
|
| 116 | F1A120-F1A123 R xxxxxxxx xxxxxxxx D_MACHI - multiply & accumulate high bits
|
| 117 | F1A148 W xxxxxxxx xxxxxxxx R_DAC - right transmit data
|
| 118 | F1A14C W xxxxxxxx xxxxxxxx L_DAC - left transmit data
|
| 119 | F1A150 W -------- xxxxxxxx SCLK - serial clock frequency
|
| 120 | F1A150 R -------- ------xx SSTAT
|
| 121 | R -------- ------x- (left - no description)
|
| 122 | R -------- -------x (WS - word strobe status)
|
| 123 | F1A154 W -------- --xxxx-x SMODE - serial mode
|
| 124 | W -------- --x----- (EVERYWORD - interrupt on MSB of every word)
|
| 125 | W -------- ---x---- (FALLING - interrupt on falling edge)
|
| 126 | W -------- ----x--- (RISING - interrupt of rising edge)
|
| 127 | W -------- -----x-- (WSEN - enable word strobes)
|
| 128 | W -------- -------x (INTERNAL - enables serial clock)
|
| 129 | ------------------------------------------------------------
|
| 130 | F1B000-F1CFFF R/W xxxxxxxx xxxxxxxx Local DSP RAM
|
| 131 | ------------------------------------------------------------
|
| 132 | F1D000 R xxxxxxxx xxxxxxxx ROM_TRI - triangle wave
|
| 133 | F1D200 R xxxxxxxx xxxxxxxx ROM_SINE - full sine wave
|
| 134 | F1D400 R xxxxxxxx xxxxxxxx ROM_AMSINE - amplitude modulated sine wave
|
| 135 | F1D600 R xxxxxxxx xxxxxxxx ROM_12W - sine wave and second order harmonic
|
| 136 | F1D800 R xxxxxxxx xxxxxxxx ROM_CHIRP16 - chirp
|
| 137 | F1DA00 R xxxxxxxx xxxxxxxx ROM_NTRI - traingle wave with noise
|
| 138 | F1DC00 R xxxxxxxx xxxxxxxx ROM_DELTA - spike
|
| 139 | F1DE00 R xxxxxxxx xxxxxxxx ROM_NOISE - white noise
|
| 140 | ------------------------------------------------------------
|
| 141 | F20000-FFFFFF R xxxxxxxx xxxxxxxx Bootstrap ROM
|
| 142 | |
| 143 | ****************************************************************************/
|
| 144 | |
| 145 | #include "driver.h"
|
| 146 | #include "memconv.h"
|
| 147 | #include "includes/jaguar.h"
|
| 148 | #include "cpu/jaguar/jaguar.h"
|
| 149 | #include "sound/dac.h"
|
| 150 | |
| 151 | |
| 152 | /* Jerry registers */
|
| 153 | enum
|
| 154 | {
|
| 155 | JPIT1, DSP0, JPIT2, DSP1,
|
| 156 | JPIT3, DSP2, JPIT4, DSP3,
|
| 157 | CLK1, CLK2, CLK3,
|
| 158 | JINTCTRL = 0x20/2,
|
| 159 | ASIDATA = 0x30/2, ASICTRL, ASICLK,
|
| 160 | DSP_REGS
|
| 161 | };
|
| 162 | |
| 163 | |
| 164 | |
| 165 | /* DSP variables */
|
| 166 | static UINT16 dsp_regs[DSP_REGS];
|
| 167 | |
| 168 | static UINT16 serial_frequency;
|
| 169 | static emu_timer *serial_timer;
|
| 170 | |
| 171 | static UINT8 gpu_irq_state;
|
| 172 | |
| 173 | #if ENABLE_SPEEDUP_HACKS
|
| 174 | |
| 175 | static TIMER_CALLBACK( serial_chunky_callback );
|
| 176 | static WRITE32_HANDLER( dsp_flags_w );
|
| 177 | |
| 178 | #else
|
| 179 | |
| 180 | static TIMER_CALLBACK( serial_callback );
|
| 181 | |
| 182 | #endif
|
| 183 | |
| 184 | |
| 185 | |
| 186 | /*************************************
|
| 187 | *
|
| 188 | * DSP optimization control
|
| 189 | *
|
| 190 | *************************************/
|
| 191 | |
| 192 | void jaguar_dsp_suspend(running_machine *machine)
|
| 193 | {
|
| 194 | cputag_suspend(machine, "audiocpu", SUSPEND_REASON_SPIN, 1);
|
| 195 | }
|
| 196 | |
| 197 | |
| 198 | void jaguar_dsp_resume(running_machine *machine)
|
| 199 | {
|
| 200 | cputag_resume(machine, "audiocpu", SUSPEND_REASON_SPIN);
|
| 201 | }
|
| 202 | |
| 203 | |
| 204 | |
| 205 | /*************************************
|
| 206 | *
|
| 207 | * Jerry -> GPU interrupts
|
| 208 | *
|
| 209 | *************************************/
|
| 210 | |
| 211 | static void update_gpu_irq(running_machine *machine)
|
| 212 | {
|
| 213 | if (gpu_irq_state & dsp_regs[JINTCTRL] & 0x1f)
|
| 214 | {
|
| 215 | cputag_set_input_line(machine, "gpu", 1, ASSERT_LINE);
|
| 216 | jaguar_gpu_resume(machine);
|
| 217 | }
|
| 218 | else
|
| 219 | cputag_set_input_line(machine, "gpu", 1, CLEAR_LINE);
|
| 220 | }
|
| 221 | |
| 222 | |
| 223 | void jaguar_external_int(const device_config *device, int state)
|
| 224 | {
|
| 225 | if (state != CLEAR_LINE)
|
| 226 | gpu_irq_state |= 1;
|
| 227 | else
|
| 228 | gpu_irq_state &= ~1;
|
| 229 | update_gpu_irq(device->machine);
|
| 230 | }
|
| 231 | |
| 232 | |
| 233 | |
| 234 | /*************************************
|
| 235 | *
|
| 236 | * Sound initialization
|
| 237 | *
|
| 238 | *************************************/
|
| 239 | |
| 240 | void cojag_sound_init(running_machine *machine)
|
| 241 | {
|
| 242 | int i;
|
| 243 | |
| 244 | /* fill the wave ROM -- these are pretty cheesy guesses */
|
| 245 | for (i = 0; i < 0x80; i++)
|
| 246 | {
|
| 247 | /* F1D000 = triangle wave */
|
| 248 | jaguar_wave_rom[0x000 + i] = ((i <= 0x40) ? i : 0x80 - i) * 32767 / 0x40;
|
| 249 | |
| 250 | /* F1D200 = full sine wave */
|
| 251 | jaguar_wave_rom[0x080 + i] = (int)(32767. * sin(2.0 * M_PI * (double)i / (double)0x80));
|
| 252 | |
| 253 | /* F1D400 = amplitude modulated sine wave? */
|
| 254 | jaguar_wave_rom[0x100 + i] = (int)(32767. * sin(2.0 * M_PI * (double)i / (double)0x80));
|
| 255 | |
| 256 | /* F1D600 = sine wave and second order harmonic */
|
| 257 | jaguar_wave_rom[0x180 + i] = (int)(32767. * sin(2.0 * M_PI * (double)i / (double)0x80));
|
| 258 | |
| 259 | /* F1D800 = chirp (sine wave of increasing frequency) */
|
| 260 | jaguar_wave_rom[0x200 + i] = (int)(32767. * sin(2.0 * M_PI * (double)i / (double)0x80));
|
| 261 | |
| 262 | /* F1DA00 = traingle wave with noise */
|
| 263 | jaguar_wave_rom[0x280 + i] = jaguar_wave_rom[0x000 + i] * (mame_rand(machine) % 32768) / 32768;
|
| 264 | |
| 265 | /* F1DC00 = spike */
|
| 266 | jaguar_wave_rom[0x300 + i] = (i == 0x40) ? 32767 : 0;
|
| 267 | |
| 268 | /* F1DE00 = white noise */
|
| 269 | jaguar_wave_rom[0x380 + i] = mame_rand(machine) % 32768;
|
| 270 | }
|
| 271 | |
| 272 | #if ENABLE_SPEEDUP_HACKS
|
| 273 | memory_install_write32_handler(cputag_get_address_space(machine, "audiocpu", ADDRESS_SPACE_PROGRAM), 0xf1a100, 0xf1a103, 0, 0, dsp_flags_w);
|
| 274 | #endif
|
| 275 | }
|
| 276 | |
| 277 | |
| 278 | |
| 279 | /*************************************
|
| 280 | *
|
| 281 | * Sound reset
|
| 282 | *
|
| 283 | *************************************/
|
| 284 | |
| 285 | void cojag_sound_reset(running_machine *machine)
|
| 286 | {
|
| 287 | #if ENABLE_SPEEDUP_HACKS
|
| 288 | serial_timer = timer_alloc(machine, serial_chunky_callback, NULL);
|
| 289 | #else
|
| 290 | serial_timer = timer_alloc(machine, serial_callback, NULL);
|
| 291 | #endif
|
| 292 | }
|
| 293 | |
| 294 | |
| 295 | |
| 296 | /*************************************
|
| 297 | *
|
| 298 | * Jerry 16-bit register access
|
| 299 | *
|
| 300 | *************************************/
|
| 301 | |
| 302 | READ16_HANDLER( jaguar_jerry_regs_r )
|
| 303 | {
|
| 304 | if (offset != JINTCTRL && offset != JINTCTRL+2)
|
| 305 | logerror("%08X:jerry read register @ F10%03X\n", cpu_get_previouspc(space->cpu), offset * 2);
|
| 306 | |
| 307 | switch (offset)
|
| 308 | {
|
| 309 | case JINTCTRL:
|
| 310 | return gpu_irq_state;
|
| 311 | }
|
| 312 | |
| 313 | return dsp_regs[offset];
|
| 314 | }
|
| 315 | |
| 316 | |
| 317 | WRITE16_HANDLER( jaguar_jerry_regs_w )
|
| 318 | {
|
| 319 | COMBINE_DATA(&dsp_regs[offset]);
|
| 320 | |
| 321 | switch (offset)
|
| 322 | {
|
| 323 | case JINTCTRL:
|
| 324 | gpu_irq_state &= ~(dsp_regs[JINTCTRL] >> 8);
|
| 325 | update_gpu_irq(space->machine);
|
| 326 | break;
|
| 327 | }
|
| 328 | |
| 329 | if (offset != JINTCTRL && offset != JINTCTRL+2 && offset != ASICTRL)
|
| 330 | logerror("%08X:jerry write register @ F10%03X = %04X\n", cpu_get_previouspc(space->cpu), offset * 2, data);
|
| 331 | }
|
| 332 | |
| 333 | |
| 334 | |
| 335 | /*************************************
|
| 336 | *
|
| 337 | * Jerry 32-bit register access
|
| 338 | *
|
| 339 | *************************************/
|
| 340 | |
| 341 | READ32_HANDLER( jaguar_jerry_regs32_r )
|
| 342 | {
|
| 343 | return read32be_with_16be_handler(jaguar_jerry_regs_r, space, offset, mem_mask);
|
| 344 | }
|
| 345 | |
| 346 | |
| 347 | WRITE32_HANDLER( jaguar_jerry_regs32_w )
|
| 348 | {
|
| 349 | write32be_with_16be_handler(jaguar_jerry_regs_w, space, offset, data, mem_mask);
|
| 350 | }
|
| 351 | |
| 352 | |
| 353 | |
| 354 | /*************************************
|
| 355 | *
|
| 356 | * Speedier sound hack
|
| 357 | *
|
| 358 | *************************************/
|
| 359 | |
| 360 | #if ENABLE_SPEEDUP_HACKS
|
| 361 | |
| 362 | static WRITE32_HANDLER( dsp_flags_w )
|
| 363 | {
|
| 364 | /* write the data through */
|
| 365 | jaguardsp_ctrl_w(cputag_get_cpu(space->machine, "audiocpu"), offset, data, mem_mask);
|
| 366 | |
| 367 | /* if they were clearing the A2S interrupt, see if we are headed for the spin */
|
| 368 | /* loop with R22 != 0; if we are, just start spinning again */
|
| 369 | if (space->cpu == cputag_get_cpu(space->machine, "audiocpu") && ACCESSING_BITS_8_15 && (data & 0x400))
|
| 370 | {
|
| 371 | /* see if we're going back to the spin loop */
|
| 372 | if (!(data & 0x04000) && cpu_get_reg(space->cpu, JAGUAR_R22) != 0)
|
| 373 | {
|
| 374 | UINT32 r30 = cpu_get_reg(space->cpu, JAGUAR_R30) & 0xffffff;
|
| 375 | if (r30 >= 0xf1b124 && r30 <= 0xf1b126)
|
| 376 | jaguar_dsp_suspend(space->machine);
|
| 377 | }
|
| 378 | }
|
| 379 | }
|
| 380 | |
| 381 | #endif
|
| 382 | |
| 383 | |
| 384 | |
| 385 | /*************************************
|
| 386 | *
|
| 387 | * Serial port interrupt generation
|
| 388 | *
|
| 389 | *************************************/
|
| 390 | |
| 391 | #if ENABLE_SPEEDUP_HACKS
|
| 392 | |
| 393 | static TIMER_CALLBACK( serial_chunky_callback )
|
| 394 | {
|
| 395 | /* assert the A2S IRQ on CPU #2 (DSP) */
|
| 396 | cputag_set_input_line(machine, "audiocpu", 1, ASSERT_LINE);
|
| 397 | jaguar_dsp_resume(machine);
|
| 398 | |
| 399 | /* fix flaky code in interrupt handler which thwarts our speedup */
|
| 400 | if ((jaguar_dsp_ram[0x3e/4] & 0xffff) == 0xbfbc &&
|
| 401 | (jaguar_dsp_ram[0x42/4] & 0xffff) == 0xe400)
|
| 402 | {
|
| 403 | /* move the store r28,(r29) into the branch delay slot, swapping it with */
|
| 404 | /* the nop that's currently there */
|
| 405 | jaguar_dsp_ram[0x3e/4] = (jaguar_dsp_ram[0x3e/4] & 0xffff0000) | 0xe400;
|
| 406 | jaguar_dsp_ram[0x42/4] = (jaguar_dsp_ram[0x42/4] & 0xffff0000) | 0xbfbc;
|
| 407 | }
|
| 408 | }
|
| 409 | |
| 410 | #else
|
| 411 | |
| 412 | static TIMER_CALLBACK( serial_callback )
|
| 413 | {
|
| 414 | /* assert the A2S IRQ on CPU #2 (DSP) */
|
| 415 | cputag_set_input_line(machine, "audiocpu", 1, ASSERT_LINE);
|
| 416 | jaguar_dsp_resume(machine);
|
| 417 | }
|
| 418 | |
| 419 | #endif
|
| 420 | |
| 421 | |
| 422 | |
| 423 | /*************************************
|
| 424 | *
|
| 425 | * Serial port handlers
|
| 426 | *
|
| 427 | *************************************/
|
| 428 | |
| 429 | READ32_HANDLER( jaguar_serial_r )
|
| 430 | {
|
| 431 | logerror("%08X:jaguar_serial_r(%X)\n", cpu_get_previouspc(space->cpu), offset);
|
| 432 | return 0;
|
| 433 | }
|
| 434 | |
| 435 | |
| 436 | WRITE32_HANDLER( jaguar_serial_w )
|
| 437 | {
|
| 438 | switch (offset)
|
| 439 | {
|
| 440 | /* right DAC */
|
| 441 | case 2:
|
| 442 | dac_signed_data_16_w(devtag_get_device(space->machine, "dac2"), (data & 0xffff) ^ 0x8000);
|
| 443 | break;
|
| 444 | |
| 445 | /* left DAC */
|
| 446 | case 3:
|
| 447 | dac_signed_data_16_w(devtag_get_device(space->machine, "dac1"), (data & 0xffff) ^ 0x8000);
|
| 448 | break;
|
| 449 | |
| 450 | /* frequency register */
|
| 451 | case 4:
|
| 452 | serial_frequency = data & 0xffff;
|
| 453 | break;
|
| 454 | |
| 455 | /* control register -- only very specific modes supported */
|
| 456 | case 5:
|
| 457 | if ((data & 0x3f) != 0x15)
|
| 458 | logerror("Unexpected write to SMODE = %X\n", data);
|
| 459 | if ((data & 0x3f) == 0x15)
|
| 460 | {
|
| 461 | attotime rate = attotime_mul(ATTOTIME_IN_HZ(26000000), 32 * 2 * (serial_frequency + 1));
|
| 462 | timer_adjust_periodic(serial_timer, rate, 0, rate);
|
| 463 | }
|
| 464 | break;
|
| 465 | |
| 466 | default:
|
| 467 | logerror("%08X:jaguar_serial_w(%X,%X)\n", cpu_get_previouspc(space->cpu), offset, data);
|
| 468 | break;
|
| 469 | }
|
| 470 | }
|
src/mess/drivers/jaguar.c
| r5125 | r5126 | |
| 5 | 5 | Nathan Woods |
| 6 | 6 | based on MAME cojag driver by Aaron Giles |
| 7 | 7 | |
| 8 | | TODO: Quite a bit; only a few games are playable. Also, this driver |
| 9 | | lacks the speed up hacks in the MAME cojag driver |
| 8 | Game status: |
| 9 | Working: Alien vs Predator, Zool2, Power Drive Rally. |
| 10 | Raiden works until the end of the first stage, then hangs. |
| 11 | Pinball Fantasies works but no sound. |
| 12 | Rayman runs somewhat, with bad graphics and no sound. |
| 13 | Brutal Sports and 2 other games get an access violation in the blitter. |
| 14 | The rest do little or nothing. |
| 15 | None of the homebrew/quickload do anything at all. |
| 10 | 16 | |
| 17 | TODO: Lots... |
| 18 | |
| 11 | 19 | **************************************************************************** |
| 12 | 20 | |
| 13 | 21 | Memory map (TBA) |
| r5125 | r5126 | |
| 51 | 59 | #include "devices/snapquik.h" |
| 52 | 60 | #include "sound/dac.h" |
| 53 | 61 | |
| 54 | | #define JAGUAR_CLOCK XTAL_52MHz |
| 55 | | #define M68K_CLOCK XTAL_50MHz |
| 62 | /* 26.6MHz for Tom and Jerry, and half that for the CPU */ |
| 63 | #define JAGUAR_CLOCK 26.6e6 |
| 56 | 64 | |
| 57 | 65 | static QUICKLOAD_LOAD( jaguar ); |
| 58 | 66 | |
| r5125 | r5126 | |
| 106 | 114 | |
| 107 | 115 | memset(jaguar_shared_ram, 0, 0x200000); |
| 108 | 116 | memcpy(jaguar_shared_ram, rom_base, 0x10); |
| 109 | | rom_base[0x53c / 4] = 0x67000002; |
| 117 | if (cart_base[1] != 0) |
| 118 | rom_base[0x53c / 4] = 0x67000002; |
| 110 | 119 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), REG_GENPC, rom_base[1]); |
| 111 | 120 | |
| 112 | 121 | #if 0 |
| r5125 | r5126 | |
| 369 | 378 | |
| 370 | 379 | static INPUT_PORTS_START( jaguar ) |
| 371 | 380 | PORT_START("JOY0") /* [0] */ |
| 372 | | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CODE(JOYCODE_X_RIGHT_SWITCH ) PORT_PLAYER(1) |
| 373 | | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CODE(JOYCODE_X_LEFT_SWITCH ) PORT_PLAYER(1) |
| 374 | | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CODE(JOYCODE_Y_DOWN_SWITCH ) PORT_PLAYER(1) |
| 375 | | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CODE(JOYCODE_Y_UP_SWITCH ) PORT_PLAYER(1) |
| 381 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CODE(JOYCODE_X_RIGHT_SWITCH ) PORT_PLAYER(1) |
| 382 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CODE(JOYCODE_X_LEFT_SWITCH ) PORT_PLAYER(1) |
| 383 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CODE(JOYCODE_Y_DOWN_SWITCH ) PORT_PLAYER(1) |
| 384 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CODE(JOYCODE_Y_UP_SWITCH ) PORT_PLAYER(1) |
| 376 | 385 | PORT_BIT( 0xf0ff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 377 | 386 | PORT_START("JOY1") /* [1] */ |
| 378 | | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_K) PORT_PLAYER(1) |
| 379 | | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_PLAYER(1) |
| 380 | | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_PLAYER(1) |
| 381 | | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_PLAYER(1) |
| 387 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_PLAYER(1) |
| 388 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_PLAYER(1) |
| 389 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_PLAYER(1) |
| 390 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_K) PORT_PLAYER(1) |
| 382 | 391 | PORT_BIT( 0xf0ff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 383 | 392 | PORT_START("JOY2") /* [2] */ |
| 384 | 393 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_PLAYER(1) |
| r5125 | r5126 | |
| 405 | 414 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_PLAYER(2) |
| 406 | 415 | PORT_BIT( 0x0fff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 407 | 416 | PORT_START("JOY6") /* [6] */ |
| 408 | | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("*") PORT_PLAYER(2) |
| 409 | | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_PLAYER(2) |
| 410 | | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_PLAYER(2) |
| 411 | | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_PLAYER(2) |
| 417 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_PLAYER(2) |
| 418 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_PLAYER(2) |
| 419 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_PLAYER(2) |
| 420 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("*") PORT_PLAYER(2) |
| 412 | 421 | PORT_BIT( 0x0fff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 413 | 422 | PORT_START("JOY7") /* [7] */ |
| 414 | | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("Right") PORT_CODE(KEYCODE_6_PAD) PORT_CODE(JOYCODE_X_RIGHT_SWITCH ) PORT_PLAYER(2) |
| 415 | | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("Left") PORT_CODE(KEYCODE_4_PAD) PORT_CODE(JOYCODE_X_LEFT_SWITCH ) PORT_PLAYER(2) |
| 416 | | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("Down") PORT_CODE(KEYCODE_2_PAD) PORT_CODE(JOYCODE_Y_DOWN_SWITCH ) PORT_PLAYER(2) |
| 417 | | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("Up") PORT_CODE(KEYCODE_8_PAD) PORT_CODE(JOYCODE_Y_UP_SWITCH ) PORT_PLAYER(2) |
| 423 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("Right") PORT_CODE(KEYCODE_6_PAD) PORT_CODE(JOYCODE_X_RIGHT_SWITCH ) PORT_PLAYER(2) |
| 424 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("Left") PORT_CODE(KEYCODE_4_PAD) PORT_CODE(JOYCODE_X_LEFT_SWITCH ) PORT_PLAYER(2) |
| 425 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("Down") PORT_CODE(KEYCODE_2_PAD) PORT_CODE(JOYCODE_Y_DOWN_SWITCH ) PORT_PLAYER(2) |
| 426 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("Up") PORT_CODE(KEYCODE_8_PAD) PORT_CODE(JOYCODE_Y_UP_SWITCH ) PORT_PLAYER(2) |
| 418 | 427 | PORT_BIT( 0x0fff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 419 | | PORT_START("BUTTONS0") /* [8] */ |
| 428 | PORT_START("BUTTONS0") /* [8] */ |
| 420 | 429 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON5) PORT_NAME(DEF_STR(Pause)) PORT_CODE(KEYCODE_P) PORT_CODE(JOYCODE_BUTTON5 ) PORT_PLAYER(1) |
| 421 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CODE(JOYCODE_BUTTON1 ) PORT_PLAYER(1) |
| 430 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("A") PORT_CODE(KEYCODE_Z) PORT_CODE(KEYCODE_A) PORT_CODE(JOYCODE_BUTTON1 ) PORT_PLAYER(1) |
| 422 | 431 | PORT_BIT( 0xfffc, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 423 | | PORT_START("BUTTONS1") /* [9] */ |
| 424 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("B") PORT_CODE(KEYCODE_S) PORT_CODE(JOYCODE_BUTTON2 ) PORT_PLAYER(1) |
| 432 | PORT_START("BUTTONS1") /* [9] */ |
| 433 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("B") PORT_CODE(KEYCODE_X) PORT_CODE(KEYCODE_B) PORT_CODE(JOYCODE_BUTTON2 ) PORT_PLAYER(1) |
| 425 | 434 | PORT_BIT( 0xfffd, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 426 | | PORT_START("BUTTONS2") /* [10] */ |
| 427 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_NAME("C") PORT_CODE(KEYCODE_X) PORT_CODE(JOYCODE_BUTTON3 ) PORT_PLAYER(1) |
| 435 | PORT_START("BUTTONS2") /* [10] */ |
| 436 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CODE(JOYCODE_BUTTON3 ) PORT_PLAYER(1) |
| 428 | 437 | PORT_BIT( 0xfffd, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 429 | | PORT_START("BUTTONS3") /* [11] */ |
| 438 | PORT_START("BUTTONS3") /* [11] */ |
| 430 | 439 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON4) PORT_NAME("Option") PORT_CODE(KEYCODE_O) PORT_CODE(JOYCODE_BUTTON4 ) PORT_PLAYER(1) |
| 431 | 440 | PORT_BIT( 0xfffd, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 432 | | PORT_START("BUTTONS4") /* [12] */ |
| 441 | PORT_START("BUTTONS4") /* [12] */ |
| 433 | 442 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON4) PORT_NAME("Option") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CODE(JOYCODE_BUTTON4 ) PORT_PLAYER(2) |
| 434 | 443 | PORT_BIT( 0xfffd, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 435 | | PORT_START("BUTTONS5") /* [13] */ |
| 444 | PORT_START("BUTTONS5") /* [13] */ |
| 436 | 445 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_NAME("C") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CODE(JOYCODE_BUTTON3 ) PORT_PLAYER(2) |
| 437 | 446 | PORT_BIT( 0xfffd, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 438 | | PORT_START("BUTTONS6") /* [14] */ |
| 447 | PORT_START("BUTTONS6") /* [14] */ |
| 439 | 448 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("B") PORT_CODE(KEYCODE_ASTERISK) PORT_CODE(JOYCODE_BUTTON2 ) PORT_PLAYER(2) |
| 440 | 449 | PORT_BIT( 0xfffd, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 441 | | PORT_START("BUTTONS7") /* [15] */ |
| 450 | PORT_START("BUTTONS7") /* [15] */ |
| 442 | 451 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON5) PORT_NAME(DEF_STR(Pause)) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CODE(JOYCODE_BUTTON5 ) PORT_PLAYER(2) |
| 443 | 452 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("A") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CODE(JOYCODE_BUTTON1 ) PORT_PLAYER(2) |
| 444 | 453 | PORT_BIT( 0xfffc, IP_ACTIVE_LOW, IPT_UNUSED ) |
| r5125 | r5126 | |
| 486 | 495 | static MACHINE_DRIVER_START( jaguar ) |
| 487 | 496 | |
| 488 | 497 | /* basic machine hardware */ |
| 489 | | MDRV_CPU_ADD("maincpu", M68EC020, M68K_CLOCK/2) |
| 498 | MDRV_CPU_ADD("maincpu", M68EC020, JAGUAR_CLOCK/2) |
| 490 | 499 | MDRV_CPU_PROGRAM_MAP(jaguar_map) |
| 491 | 500 | |
| 492 | | MDRV_CPU_ADD("gpu", JAGUARGPU, JAGUAR_CLOCK/2) |
| 501 | MDRV_CPU_ADD("gpu", JAGUARGPU, JAGUAR_CLOCK) |
| 493 | 502 | MDRV_CPU_CONFIG(gpu_config) |
| 494 | 503 | MDRV_CPU_PROGRAM_MAP(gpu_map) |
| 495 | 504 | |
| 496 | | MDRV_CPU_ADD("audiocpu", JAGUARDSP, JAGUAR_CLOCK/2) |
| 505 | MDRV_CPU_ADD("audiocpu", JAGUARDSP, JAGUAR_CLOCK) |
| 497 | 506 | MDRV_CPU_CONFIG(dsp_config) |
| 498 | 507 | MDRV_CPU_PROGRAM_MAP(dsp_map) |
| 499 | 508 | |
| r5125 | r5126 | |
| 522 | 531 | |
| 523 | 532 | /* cartridge */ |
| 524 | 533 | MDRV_CARTSLOT_ADD("cart") |
| 525 | | MDRV_CARTSLOT_EXTENSION_LIST("jag,abs,bin,rom,j64") |
| 526 | | //MDRV_CARTSLOT_MANDATORY |
| 534 | MDRV_CARTSLOT_EXTENSION_LIST("jag,abs,rom,j64") |
| 527 | 535 | MACHINE_DRIVER_END |
| 528 | 536 | |
| 529 | 537 | |