src/mame/audio/segasnd.c
| r11160 | r11161 | |
| 80 | 80 | { |
| 81 | 81 | sound_stream * stream; /* output stream */ |
| 82 | 82 | device_t *cpu; /* CPU index of the 8035 */ |
| 83 | device_t *maincpu; |
| 83 | 84 | UINT8 in_latch; /* input latch */ |
| 84 | 85 | UINT8 out_latch; /* output latch */ |
| 85 | 86 | UINT8 last_p2_value; /* current P2 output value */ |
| r11160 | r11161 | |
| 99 | 100 | filter_state noise_filters[5]; |
| 100 | 101 | }; |
| 101 | 102 | |
| 102 | | |
| 103 | | |
| 104 | | /*************************************************************************** |
| 105 | | GLOBAL VARIABLES |
| 106 | | ***************************************************************************/ |
| 107 | | |
| 108 | 103 | /* SP0250-based speech board */ |
| 109 | | static UINT8 speech_latch, speech_t0, speech_p2, speech_drq; |
| 104 | typedef struct _speech_state speech_state; |
| 105 | struct _speech_state |
| 106 | { |
| 107 | UINT8 latch, t0, p2, drq; |
| 108 | UINT8 *speech; |
| 109 | }; |
| 110 | 110 | |
| 111 | | /* Universal sound board */ |
| 112 | | static usb_state usb; |
| 113 | 111 | |
| 114 | 112 | |
| 115 | | |
| 116 | 113 | /*************************************************************************** |
| 117 | 114 | INLINE FUNCTIONS |
| 118 | 115 | ***************************************************************************/ |
| r11160 | r11161 | |
| 144 | 141 | SPEECH BOARD |
| 145 | 142 | ***************************************************************************/ |
| 146 | 143 | |
| 144 | DECLARE_LEGACY_SOUND_DEVICE(SEGASPEECH, speech_sound); |
| 147 | 145 | |
| 146 | INLINE speech_state *get_safe_speech(device_t *device) |
| 147 | { |
| 148 | assert(device != NULL); |
| 149 | assert(device->type() == SEGASPEECH); |
| 150 | |
| 151 | return (speech_state *)downcast<legacy_device_base *>(device)->token(); |
| 152 | } |
| 153 | |
| 154 | static DEVICE_START( speech_sound ) |
| 155 | { |
| 156 | speech_state *state = get_safe_speech(device); |
| 157 | |
| 158 | state->speech = device->machine().region("speech")->base(); |
| 159 | } |
| 160 | |
| 161 | |
| 162 | DEVICE_GET_INFO( speech_sound ) |
| 163 | { |
| 164 | switch (state) |
| 165 | { |
| 166 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 167 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(speech_state); break; |
| 168 | |
| 169 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 170 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(speech_sound); break; |
| 171 | |
| 172 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 173 | case DEVINFO_STR_NAME: strcpy(info->s, "Sega Speech Sound Board"); break; |
| 174 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | DEFINE_LEGACY_SOUND_DEVICE(SEGASPEECH, speech_sound); |
| 179 | |
| 180 | |
| 181 | |
| 148 | 182 | /************************************* |
| 149 | 183 | * |
| 150 | 184 | * i8035 port accessors |
| 151 | 185 | * |
| 152 | 186 | *************************************/ |
| 153 | 187 | |
| 154 | | static READ8_HANDLER( speech_t0_r ) |
| 188 | |
| 189 | |
| 190 | static READ8_DEVICE_HANDLER( speech_t0_r ) |
| 155 | 191 | { |
| 156 | | return speech_t0; |
| 192 | speech_state *state = get_safe_speech(device); |
| 193 | |
| 194 | return state->t0; |
| 157 | 195 | } |
| 158 | 196 | |
| 159 | | static READ8_HANDLER( speech_t1_r ) |
| 197 | static READ8_DEVICE_HANDLER( speech_t1_r ) |
| 160 | 198 | { |
| 161 | | return speech_drq; |
| 199 | speech_state *state = get_safe_speech(device); |
| 200 | |
| 201 | return state->drq; |
| 162 | 202 | } |
| 163 | 203 | |
| 164 | | static READ8_HANDLER( speech_p1_r ) |
| 204 | static READ8_DEVICE_HANDLER( speech_p1_r ) |
| 165 | 205 | { |
| 166 | | return speech_latch & 0x7f; |
| 206 | speech_state *state = get_safe_speech(device); |
| 207 | |
| 208 | return state->latch & 0x7f; |
| 167 | 209 | } |
| 168 | 210 | |
| 169 | | static READ8_HANDLER( speech_rom_r ) |
| 211 | static READ8_DEVICE_HANDLER( speech_rom_r ) |
| 170 | 212 | { |
| 171 | | return space->machine().region("speech")->base()[0x100 * (speech_p2 & 0x3f) + offset]; |
| 213 | speech_state *state = get_safe_speech(device); |
| 214 | |
| 215 | return state->speech[0x100 * (state->p2 & 0x3f) + offset]; |
| 172 | 216 | } |
| 173 | 217 | |
| 174 | | static WRITE8_HANDLER( speech_p1_w ) |
| 218 | static WRITE8_DEVICE_HANDLER( speech_p1_w ) |
| 175 | 219 | { |
| 220 | speech_state *state = get_safe_speech(device); |
| 221 | |
| 176 | 222 | if (!(data & 0x80)) |
| 177 | | speech_t0 = 0; |
| 223 | state->t0 = 0; |
| 178 | 224 | } |
| 179 | 225 | |
| 180 | | static WRITE8_HANDLER( speech_p2_w ) |
| 226 | static WRITE8_DEVICE_HANDLER( speech_p2_w ) |
| 181 | 227 | { |
| 182 | | speech_p2 = data; |
| 228 | speech_state *state = get_safe_speech(device); |
| 229 | |
| 230 | state->p2 = data; |
| 183 | 231 | } |
| 184 | 232 | |
| 185 | 233 | |
| r11160 | r11161 | |
| 192 | 240 | |
| 193 | 241 | static void speech_drq_w(device_t *device, int level) |
| 194 | 242 | { |
| 195 | | speech_drq = (level == ASSERT_LINE); |
| 243 | device_t *speech = device->machine().device("segaspeech"); |
| 244 | speech_state *state = get_safe_speech(speech); |
| 245 | |
| 246 | state->drq = (level == ASSERT_LINE); |
| 196 | 247 | } |
| 197 | 248 | |
| 198 | 249 | |
| r11160 | r11161 | |
| 206 | 257 | static TIMER_CALLBACK( delayed_speech_w ) |
| 207 | 258 | { |
| 208 | 259 | int data = param; |
| 209 | | UINT8 old = speech_latch; |
| 260 | speech_state *state = (speech_state *)ptr; |
| 261 | UINT8 old = state->latch; |
| 210 | 262 | |
| 211 | 263 | /* all 8 bits are latched */ |
| 212 | | speech_latch = data; |
| 264 | state->latch = data; |
| 213 | 265 | |
| 214 | 266 | /* the high bit goes directly to the INT line */ |
| 215 | 267 | cputag_set_input_line(machine, "audiocpu", 0, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE); |
| 216 | 268 | |
| 217 | 269 | /* a clock on the high bit clocks a 1 into T0 */ |
| 218 | 270 | if (!(old & 0x80) && (data & 0x80)) |
| 219 | | speech_t0 = 1; |
| 271 | state->t0 = 1; |
| 220 | 272 | } |
| 221 | 273 | |
| 222 | 274 | |
| 223 | | WRITE8_HANDLER( sega_speech_data_w ) |
| 275 | WRITE8_DEVICE_HANDLER( sega_speech_data_w ) |
| 224 | 276 | { |
| 225 | | space->machine().scheduler().synchronize(FUNC(delayed_speech_w), data); |
| 277 | speech_state *state = get_safe_speech(device); |
| 278 | |
| 279 | device->machine().scheduler().synchronize(FUNC(delayed_speech_w), data, state); |
| 226 | 280 | } |
| 227 | 281 | |
| 228 | 282 | |
| 229 | | WRITE8_HANDLER( sega_speech_control_w ) |
| 283 | WRITE8_DEVICE_HANDLER( sega_speech_control_w ) |
| 230 | 284 | { |
| 231 | 285 | LOG(("Speech control = %X\n", data)); |
| 232 | 286 | } |
| r11160 | r11161 | |
| 245 | 299 | |
| 246 | 300 | |
| 247 | 301 | static ADDRESS_MAP_START( speech_portmap, AS_IO, 8 ) |
| 248 | | AM_RANGE(0x00, 0xff) AM_READ(speech_rom_r) |
| 302 | AM_RANGE(0x00, 0xff) AM_DEVREAD("segaspeech", speech_rom_r) |
| 249 | 303 | AM_RANGE(0x00, 0xff) AM_DEVWRITE("speech", sp0250_w) |
| 250 | | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(speech_p1_r, speech_p1_w) |
| 251 | | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(speech_p2_w) |
| 252 | | AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(speech_t0_r) |
| 253 | | AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(speech_t1_r) |
| 304 | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVREADWRITE("segaspeech", speech_p1_r, speech_p1_w) |
| 305 | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_DEVWRITE("segaspeech", speech_p2_w) |
| 306 | AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_DEVREAD("segaspeech", speech_t0_r) |
| 307 | AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_DEVREAD("segaspeech", speech_t1_r) |
| 254 | 308 | ADDRESS_MAP_END |
| 255 | 309 | |
| 256 | 310 | |
| r11160 | r11161 | |
| 282 | 336 | MCFG_CPU_IO_MAP(speech_portmap) |
| 283 | 337 | |
| 284 | 338 | /* sound hardware */ |
| 339 | MCFG_SOUND_ADD("segaspeech", SEGASPEECH, 0) |
| 285 | 340 | MCFG_SOUND_ADD("speech", SP0250, SPEECH_MASTER_CLOCK) |
| 286 | 341 | MCFG_SOUND_CONFIG(sp0250_interface) |
| 287 | 342 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| r11160 | r11161 | |
| 293 | 348 | UNIVERSAL SOUND BOARD |
| 294 | 349 | ***************************************************************************/ |
| 295 | 350 | |
| 351 | static DECLARE_LEGACY_SOUND_DEVICE(SEGAUSB, usb_sound); |
| 296 | 352 | |
| 353 | INLINE usb_state *get_safe_token(device_t *device) |
| 354 | { |
| 355 | assert(device != NULL); |
| 356 | assert(device->type() == SEGAUSB); |
| 357 | |
| 358 | return (usb_state *)downcast<legacy_device_base *>(device)->token(); |
| 359 | } |
| 360 | |
| 297 | 361 | /************************************* |
| 298 | 362 | * |
| 299 | 363 | * Initialization/reset |
| r11160 | r11161 | |
| 302 | 366 | |
| 303 | 367 | static TIMER_DEVICE_CALLBACK( increment_t1_clock ) |
| 304 | 368 | { |
| 369 | device_t *usbsnd = timer.machine().device("usbsnd"); |
| 370 | usb_state *usb = get_safe_token(usbsnd); |
| 371 | |
| 305 | 372 | /* only increment if it is not being forced clear */ |
| 306 | | if (!(usb.last_p2_value & 0x80)) |
| 307 | | usb.t1_clock++; |
| 373 | if (!(usb->last_p2_value & 0x80)) |
| 374 | usb->t1_clock++; |
| 308 | 375 | } |
| 309 | 376 | |
| 310 | 377 | |
| 311 | | void sega_usb_reset(running_machine &machine, UINT8 t1_clock_mask) |
| 378 | static DEVICE_RESET( usb_sound ) |
| 312 | 379 | { |
| 380 | usb_state *usb = get_safe_token(device); |
| 381 | |
| 313 | 382 | /* halt the USB CPU at reset time */ |
| 314 | | device_set_input_line(usb.cpu, INPUT_LINE_RESET, ASSERT_LINE); |
| 383 | device_set_input_line(usb->cpu, INPUT_LINE_RESET, ASSERT_LINE); |
| 315 | 384 | |
| 316 | 385 | /* start the clock timer */ |
| 317 | | usb.t1_clock_mask = t1_clock_mask; |
| 386 | usb->t1_clock_mask = 0x10; |
| 318 | 387 | } |
| 319 | 388 | |
| 320 | 389 | |
| r11160 | r11161 | |
| 325 | 394 | * |
| 326 | 395 | *************************************/ |
| 327 | 396 | |
| 328 | | READ8_HANDLER( sega_usb_status_r ) |
| 397 | READ8_DEVICE_HANDLER( sega_usb_status_r ) |
| 329 | 398 | { |
| 330 | | LOG(("%04X:usb_data_r = %02X\n", cpu_get_pc(&space->device()), (usb.out_latch & 0x81) | (usb.in_latch & 0x7e))); |
| 399 | usb_state *usb = get_safe_token(device); |
| 331 | 400 | |
| 332 | | device_adjust_icount(&space->device(), -200); |
| 401 | LOG(("%04X:usb_data_r = %02X\n", cpu_get_pc(usb->maincpu), (usb->out_latch & 0x81) | (usb->in_latch & 0x7e))); |
| 333 | 402 | |
| 403 | device_adjust_icount(usb->maincpu, -200); |
| 404 | |
| 334 | 405 | /* only bits 0 and 7 are controlled by the I8035; the remaining */ |
| 335 | 406 | /* bits 1-6 reflect the current input latch values */ |
| 336 | | return (usb.out_latch & 0x81) | (usb.in_latch & 0x7e); |
| 407 | return (usb->out_latch & 0x81) | (usb->in_latch & 0x7e); |
| 337 | 408 | } |
| 338 | 409 | |
| 339 | 410 | |
| 340 | 411 | static TIMER_CALLBACK( delayed_usb_data_w ) |
| 341 | 412 | { |
| 413 | usb_state *usb = (usb_state *)ptr; |
| 342 | 414 | int data = param; |
| 343 | 415 | |
| 344 | 416 | /* look for rising/falling edges of bit 7 to control the RESET line */ |
| 345 | | device_set_input_line(usb.cpu, INPUT_LINE_RESET, (data & 0x80) ? ASSERT_LINE : CLEAR_LINE); |
| 417 | device_set_input_line(usb->cpu, INPUT_LINE_RESET, (data & 0x80) ? ASSERT_LINE : CLEAR_LINE); |
| 346 | 418 | |
| 347 | 419 | /* if the CLEAR line is set, the low 7 bits of the input are ignored */ |
| 348 | | if ((usb.last_p2_value & 0x40) == 0) |
| 420 | if ((usb->last_p2_value & 0x40) == 0) |
| 349 | 421 | data &= ~0x7f; |
| 350 | 422 | |
| 351 | 423 | /* update the effective input latch */ |
| 352 | | usb.in_latch = data; |
| 424 | usb->in_latch = data; |
| 353 | 425 | } |
| 354 | 426 | |
| 355 | 427 | |
| 356 | | WRITE8_HANDLER( sega_usb_data_w ) |
| 428 | WRITE8_DEVICE_HANDLER( sega_usb_data_w ) |
| 357 | 429 | { |
| 358 | | LOG(("%04X:usb_data_w = %02X\n", cpu_get_pc(&space->device()), data)); |
| 359 | | space->machine().scheduler().synchronize(FUNC(delayed_usb_data_w), data); |
| 430 | usb_state *usb = get_safe_token(device); |
| 360 | 431 | |
| 432 | LOG(("%04X:usb_data_w = %02X\n", cpu_get_pc(usb->maincpu), data)); |
| 433 | device->machine().scheduler().synchronize(FUNC(delayed_usb_data_w), data, usb); |
| 434 | |
| 361 | 435 | /* boost the interleave so that sequences can be sent */ |
| 362 | | space->machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(250)); |
| 436 | device->machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(250)); |
| 363 | 437 | } |
| 364 | 438 | |
| 365 | 439 | |
| 366 | | READ8_HANDLER( sega_usb_ram_r ) |
| 440 | READ8_DEVICE_HANDLER( sega_usb_ram_r ) |
| 367 | 441 | { |
| 368 | | return usb.program_ram[offset]; |
| 442 | usb_state *usb = get_safe_token(device); |
| 443 | |
| 444 | return usb->program_ram[offset]; |
| 369 | 445 | } |
| 370 | 446 | |
| 371 | 447 | |
| 372 | | WRITE8_HANDLER( sega_usb_ram_w ) |
| 448 | WRITE8_DEVICE_HANDLER( sega_usb_ram_w ) |
| 373 | 449 | { |
| 374 | | if (usb.in_latch & 0x80) |
| 375 | | usb.program_ram[offset] = data; |
| 450 | usb_state *usb = get_safe_token(device); |
| 451 | |
| 452 | if (usb->in_latch & 0x80) |
| 453 | usb->program_ram[offset] = data; |
| 376 | 454 | else |
| 377 | | LOG(("%04X:sega_usb_ram_w(%03X) = %02X while /LOAD disabled\n", cpu_get_pc(&space->device()), offset, data)); |
| 455 | LOG(("%04X:sega_usb_ram_w(%03X) = %02X while /LOAD disabled\n", cpu_get_pc(usb->maincpu), offset, data)); |
| 378 | 456 | } |
| 379 | 457 | |
| 380 | 458 | |
| r11160 | r11161 | |
| 385 | 463 | * |
| 386 | 464 | *************************************/ |
| 387 | 465 | |
| 388 | | static READ8_HANDLER( usb_p1_r ) |
| 466 | static READ8_DEVICE_HANDLER( usb_p1_r ) |
| 389 | 467 | { |
| 468 | usb_state *usb = get_safe_token(device); |
| 469 | |
| 390 | 470 | /* bits 0-6 are inputs and map to bits 0-6 of the input latch */ |
| 391 | | if ((usb.in_latch & 0x7f) != 0) |
| 392 | | LOG(("%03X: P1 read = %02X\n", cpu_get_pc(&space->device()), usb.in_latch & 0x7f)); |
| 393 | | return usb.in_latch & 0x7f; |
| 471 | if ((usb->in_latch & 0x7f) != 0) |
| 472 | LOG(("%03X: P1 read = %02X\n", cpu_get_pc(usb->maincpu), usb->in_latch & 0x7f)); |
| 473 | return usb->in_latch & 0x7f; |
| 394 | 474 | } |
| 395 | 475 | |
| 396 | 476 | |
| 397 | | static WRITE8_HANDLER( usb_p1_w ) |
| 477 | static WRITE8_DEVICE_HANDLER( usb_p1_w ) |
| 398 | 478 | { |
| 479 | usb_state *usb = get_safe_token(device); |
| 480 | |
| 399 | 481 | /* bit 7 maps to bit 0 on the output latch */ |
| 400 | | usb.out_latch = (usb.out_latch & 0xfe) | (data >> 7); |
| 401 | | LOG(("%03X: P1 write = %02X\n", cpu_get_pc(&space->device()), data)); |
| 482 | usb->out_latch = (usb->out_latch & 0xfe) | (data >> 7); |
| 483 | LOG(("%03X: P1 write = %02X\n", cpu_get_pc(usb->maincpu), data)); |
| 402 | 484 | } |
| 403 | 485 | |
| 404 | 486 | |
| 405 | | static WRITE8_HANDLER( usb_p2_w ) |
| 487 | static WRITE8_DEVICE_HANDLER( usb_p2_w ) |
| 406 | 488 | { |
| 407 | | UINT8 old = usb.last_p2_value; |
| 408 | | usb.last_p2_value = data; |
| 489 | usb_state *usb = get_safe_token(device); |
| 490 | UINT8 old = usb->last_p2_value; |
| 491 | usb->last_p2_value = data; |
| 409 | 492 | |
| 410 | 493 | /* low 2 bits control the bank of work RAM we are addressing */ |
| 411 | | usb.work_ram_bank = data & 3; |
| 494 | usb->work_ram_bank = data & 3; |
| 412 | 495 | |
| 413 | 496 | /* bit 6 controls the "ready" bit output to the host */ |
| 414 | 497 | /* it also clears the input latch from the host (active low) */ |
| 415 | | usb.out_latch = ((data & 0x40) << 1) | (usb.out_latch & 0x7f); |
| 498 | usb->out_latch = ((data & 0x40) << 1) | (usb->out_latch & 0x7f); |
| 416 | 499 | if ((data & 0x40) == 0) |
| 417 | | usb.in_latch = 0; |
| 500 | usb->in_latch = 0; |
| 418 | 501 | |
| 419 | 502 | /* bit 7 controls the reset on the upper counter at U33 */ |
| 420 | 503 | if ((old & 0x80) && !(data & 0x80)) |
| 421 | | usb.t1_clock = 0; |
| 504 | usb->t1_clock = 0; |
| 422 | 505 | |
| 423 | | LOG(("%03X: P2 write -> bank=%d ready=%d clock=%d\n", cpu_get_pc(&space->device()), data & 3, (data >> 6) & 1, (data >> 7) & 1)); |
| 506 | LOG(("%03X: P2 write -> bank=%d ready=%d clock=%d\n", cpu_get_pc(usb->maincpu), data & 3, (data >> 6) & 1, (data >> 7) & 1)); |
| 424 | 507 | } |
| 425 | 508 | |
| 426 | 509 | |
| 427 | | static READ8_HANDLER( usb_t1_r ) |
| 510 | static READ8_DEVICE_HANDLER( usb_t1_r ) |
| 428 | 511 | { |
| 512 | usb_state *usb = get_safe_token(device); |
| 513 | |
| 429 | 514 | /* T1 returns 1 based on the value of the T1 clock; the exact */ |
| 430 | 515 | /* pattern is determined by one or more jumpers on the board. */ |
| 431 | | return (usb.t1_clock & usb.t1_clock_mask) != 0; |
| 516 | return (usb->t1_clock & usb->t1_clock_mask) != 0; |
| 432 | 517 | } |
| 433 | 518 | |
| 434 | 519 | |
| r11160 | r11161 | |
| 482 | 567 | |
| 483 | 568 | static STREAM_UPDATE( usb_stream_update ) |
| 484 | 569 | { |
| 570 | usb_state *usb = get_safe_token(device); |
| 485 | 571 | stream_sample_t *dest = outputs[0]; |
| 486 | 572 | |
| 487 | 573 | /* iterate over samples */ |
| r11160 | r11161 | |
| 503 | 589 | */ |
| 504 | 590 | |
| 505 | 591 | /* update the noise source */ |
| 506 | | for (step = USB_2MHZ_CLOCK / SAMPLE_RATE; step >= usb.noise_subcount; step -= usb.noise_subcount) |
| 592 | for (step = USB_2MHZ_CLOCK / SAMPLE_RATE; step >= usb->noise_subcount; step -= usb->noise_subcount) |
| 507 | 593 | { |
| 508 | | usb.noise_shift = (usb.noise_shift << 1) | (((usb.noise_shift >> 13) ^ (usb.noise_shift >> 16)) & 1); |
| 509 | | usb.noise_state = (usb.noise_shift >> 16) & 1; |
| 510 | | usb.noise_subcount = USB_2MHZ_CLOCK / MM5837_CLOCK; |
| 594 | usb->noise_shift = (usb->noise_shift << 1) | (((usb->noise_shift >> 13) ^ (usb->noise_shift >> 16)) & 1); |
| 595 | usb->noise_state = (usb->noise_shift >> 16) & 1; |
| 596 | usb->noise_subcount = USB_2MHZ_CLOCK / MM5837_CLOCK; |
| 511 | 597 | } |
| 512 | | usb.noise_subcount -= step; |
| 598 | usb->noise_subcount -= step; |
| 513 | 599 | |
| 514 | 600 | /* update the filtered noise value -- this is just an approximation to the pink noise filter */ |
| 515 | 601 | /* being applied on the PCB, but it sounds pretty close */ |
| 516 | | usb.noise_filters[0].capval = 0.99765 * usb.noise_filters[0].capval + usb.noise_state * 0.0990460; |
| 517 | | usb.noise_filters[1].capval = 0.96300 * usb.noise_filters[1].capval + usb.noise_state * 0.2965164; |
| 518 | | usb.noise_filters[2].capval = 0.57000 * usb.noise_filters[2].capval + usb.noise_state * 1.0526913; |
| 519 | | noiseval = usb.noise_filters[0].capval + usb.noise_filters[1].capval + usb.noise_filters[2].capval + usb.noise_state * 0.1848; |
| 602 | usb->noise_filters[0].capval = 0.99765 * usb->noise_filters[0].capval + usb->noise_state * 0.0990460; |
| 603 | usb->noise_filters[1].capval = 0.96300 * usb->noise_filters[1].capval + usb->noise_state * 0.2965164; |
| 604 | usb->noise_filters[2].capval = 0.57000 * usb->noise_filters[2].capval + usb->noise_state * 1.0526913; |
| 605 | noiseval = usb->noise_filters[0].capval + usb->noise_filters[1].capval + usb->noise_filters[2].capval + usb->noise_state * 0.1848; |
| 520 | 606 | |
| 521 | 607 | /* final output goes through a CR filter; the scaling factor is arbitrary to get the noise to the */ |
| 522 | 608 | /* correct relative volume */ |
| 523 | | noiseval = step_cr_filter(&usb.noise_filters[4], noiseval); |
| 609 | noiseval = step_cr_filter(&usb->noise_filters[4], noiseval); |
| 524 | 610 | noiseval *= 0.075; |
| 525 | 611 | |
| 526 | 612 | /* there are 3 identical groups of circuits, each with its own 8253 */ |
| 527 | 613 | for (group = 0; group < 3; group++) |
| 528 | 614 | { |
| 529 | | timer8253 *g = &usb.timer_group[group]; |
| 615 | timer8253 *g = &usb->timer_group[group]; |
| 530 | 616 | double chan0, chan1, chan2, mix; |
| 531 | 617 | |
| 532 | 618 | |
| r11160 | r11161 | |
| 601 | 687 | } |
| 602 | 688 | |
| 603 | 689 | /* the exponents for the gate filters are determined by channel 2's output */ |
| 604 | | g->gate1.exponent = usb.gate_rc1_exp[g->chan[2].output]; |
| 605 | | g->gate2.exponent = usb.gate_rc2_exp[g->chan[2].output]; |
| 690 | g->gate1.exponent = usb->gate_rc1_exp[g->chan[2].output]; |
| 691 | g->gate2.exponent = usb->gate_rc2_exp[g->chan[2].output]; |
| 606 | 692 | |
| 607 | 693 | /* based on the envelope mode, we do one of two things with source 2 */ |
| 608 | 694 | if (g->config == 0) |
| r11160 | r11161 | |
| 631 | 717 | WEIGHT |
| 632 | 718 | |
| 633 | 719 | */ |
| 634 | | *dest++ = 4000 * step_cr_filter(&usb.final_filter, sample); |
| 720 | *dest++ = 4000 * step_cr_filter(&usb->final_filter, sample); |
| 635 | 721 | } |
| 636 | 722 | } |
| 637 | 723 | |
| 638 | 724 | |
| 639 | 725 | static DEVICE_START( usb_sound ) |
| 640 | 726 | { |
| 727 | usb_state *usb = get_safe_token(device); |
| 641 | 728 | running_machine &machine = device->machine(); |
| 642 | 729 | filter_state temp; |
| 643 | 730 | int tchan, tgroup; |
| 644 | 731 | |
| 645 | 732 | /* find the CPU we are associated with */ |
| 646 | | usb.cpu = machine.device("usbcpu"); |
| 647 | | assert(usb.cpu != NULL); |
| 733 | usb->maincpu = machine.device("maincpu"); |
| 734 | assert(usb->maincpu != NULL); |
| 735 | usb->cpu = machine.device("usbcpu"); |
| 736 | assert(usb->cpu != NULL); |
| 648 | 737 | |
| 649 | | /* allocate work RAM */ |
| 650 | | usb.work_ram = auto_alloc_array(machine, UINT8, 0x400); |
| 738 | /* allocate RAM */ |
| 739 | usb->program_ram = (UINT8 *)memory_get_shared(device->machine(), "pgmram"); |
| 740 | usb->work_ram = auto_alloc_array(machine, UINT8, 0x400); |
| 651 | 741 | |
| 652 | 742 | /* create a sound stream */ |
| 653 | | usb.stream = device->machine().sound().stream_alloc(*device, 0, 1, SAMPLE_RATE, NULL, usb_stream_update); |
| 743 | usb->stream = device->machine().sound().stream_alloc(*device, 0, 1, SAMPLE_RATE, NULL, usb_stream_update); |
| 654 | 744 | |
| 655 | 745 | /* initialize state */ |
| 656 | | usb.noise_shift = 0x15555; |
| 746 | usb->noise_shift = 0x15555; |
| 657 | 747 | |
| 658 | 748 | for (tgroup = 0; tgroup < 3; tgroup++) |
| 659 | 749 | { |
| 660 | | timer8253 *g = &usb.timer_group[tgroup]; |
| 750 | timer8253 *g = &usb->timer_group[tgroup]; |
| 661 | 751 | configure_filter(&g->chan_filter[0], 10e3, 1e-6); |
| 662 | 752 | configure_filter(&g->chan_filter[1], 10e3, 1e-6); |
| 663 | 753 | configure_filter(&g->gate1, 100e3, 0.01e-6); |
| r11160 | r11161 | |
| 665 | 755 | } |
| 666 | 756 | |
| 667 | 757 | configure_filter(&temp, 100e3, 0.01e-6); |
| 668 | | usb.gate_rc1_exp[0] = temp.exponent; |
| 758 | usb->gate_rc1_exp[0] = temp.exponent; |
| 669 | 759 | configure_filter(&temp, 1e3, 0.01e-6); |
| 670 | | usb.gate_rc1_exp[1] = temp.exponent; |
| 760 | usb->gate_rc1_exp[1] = temp.exponent; |
| 671 | 761 | configure_filter(&temp, 2 * 100e3, 0.01e-6); |
| 672 | | usb.gate_rc2_exp[0] = temp.exponent; |
| 762 | usb->gate_rc2_exp[0] = temp.exponent; |
| 673 | 763 | configure_filter(&temp, 2 * 1e3, 0.01e-6); |
| 674 | | usb.gate_rc2_exp[1] = temp.exponent; |
| 764 | usb->gate_rc2_exp[1] = temp.exponent; |
| 675 | 765 | |
| 676 | | configure_filter(&usb.noise_filters[0], 2.7e3 + 2.7e3, 1.0e-6); |
| 677 | | configure_filter(&usb.noise_filters[1], 2.7e3 + 1e3, 0.30e-6); |
| 678 | | configure_filter(&usb.noise_filters[2], 2.7e3 + 270, 0.15e-6); |
| 679 | | configure_filter(&usb.noise_filters[3], 2.7e3 + 0, 0.082e-6); |
| 680 | | configure_filter(&usb.noise_filters[4], 33e3, 0.1e-6); |
| 766 | configure_filter(&usb->noise_filters[0], 2.7e3 + 2.7e3, 1.0e-6); |
| 767 | configure_filter(&usb->noise_filters[1], 2.7e3 + 1e3, 0.30e-6); |
| 768 | configure_filter(&usb->noise_filters[2], 2.7e3 + 270, 0.15e-6); |
| 769 | configure_filter(&usb->noise_filters[3], 2.7e3 + 0, 0.082e-6); |
| 770 | configure_filter(&usb->noise_filters[4], 33e3, 0.1e-6); |
| 681 | 771 | |
| 682 | | configure_filter(&usb.final_filter, 100e3, 4.7e-6); |
| 772 | configure_filter(&usb->final_filter, 100e3, 4.7e-6); |
| 683 | 773 | |
| 684 | 774 | /* register for save states */ |
| 685 | | state_save_register_item(machine, "usb", NULL, 0, usb.in_latch); |
| 686 | | state_save_register_item(machine, "usb", NULL, 0, usb.out_latch); |
| 687 | | state_save_register_item(machine, "usb", NULL, 0, usb.last_p2_value); |
| 688 | | state_save_register_item(machine, "usb", NULL, 0, usb.work_ram_bank); |
| 689 | | state_save_register_item(machine, "usb", NULL, 0, usb.t1_clock); |
| 775 | state_save_register_item(machine, "usb", NULL, 0, usb->in_latch); |
| 776 | state_save_register_item(machine, "usb", NULL, 0, usb->out_latch); |
| 777 | state_save_register_item(machine, "usb", NULL, 0, usb->last_p2_value); |
| 778 | state_save_register_item(machine, "usb", NULL, 0, usb->work_ram_bank); |
| 779 | state_save_register_item(machine, "usb", NULL, 0, usb->t1_clock); |
| 690 | 780 | |
| 691 | 781 | for (tgroup = 0; tgroup < 3; tgroup++) |
| 692 | 782 | { |
| 693 | | timer8253 *group = &usb.timer_group[tgroup]; |
| 783 | timer8253 *group = &usb->timer_group[tgroup]; |
| 694 | 784 | for (tchan = 0; tchan < 3; tchan++) |
| 695 | 785 | { |
| 696 | 786 | timer8253_channel *channel = &group->chan[tchan]; |
| r11160 | r11161 | |
| 714 | 804 | state_save_register_item(machine, "usb", NULL, tgroup, group->config); |
| 715 | 805 | } |
| 716 | 806 | |
| 717 | | state_save_register_item_array(machine, "usb", NULL, 0, usb.timer_mode); |
| 718 | | state_save_register_item(machine, "usb", NULL, 0, usb.noise_shift); |
| 719 | | state_save_register_item(machine, "usb", NULL, 0, usb.noise_state); |
| 720 | | state_save_register_item(machine, "usb", NULL, 0, usb.noise_subcount); |
| 721 | | state_save_register_item(machine, "usb", NULL, 0, usb.final_filter.capval); |
| 722 | | state_save_register_item(machine, "usb", NULL, 0, usb.noise_filters[0].capval); |
| 723 | | state_save_register_item(machine, "usb", NULL, 0, usb.noise_filters[1].capval); |
| 724 | | state_save_register_item(machine, "usb", NULL, 0, usb.noise_filters[2].capval); |
| 725 | | state_save_register_item(machine, "usb", NULL, 0, usb.noise_filters[3].capval); |
| 726 | | state_save_register_item(machine, "usb", NULL, 0, usb.noise_filters[4].capval); |
| 807 | state_save_register_item_array(machine, "usb", NULL, 0, usb->timer_mode); |
| 808 | state_save_register_item(machine, "usb", NULL, 0, usb->noise_shift); |
| 809 | state_save_register_item(machine, "usb", NULL, 0, usb->noise_state); |
| 810 | state_save_register_item(machine, "usb", NULL, 0, usb->noise_subcount); |
| 811 | state_save_register_item(machine, "usb", NULL, 0, usb->final_filter.capval); |
| 812 | state_save_register_item(machine, "usb", NULL, 0, usb->noise_filters[0].capval); |
| 813 | state_save_register_item(machine, "usb", NULL, 0, usb->noise_filters[1].capval); |
| 814 | state_save_register_item(machine, "usb", NULL, 0, usb->noise_filters[2].capval); |
| 815 | state_save_register_item(machine, "usb", NULL, 0, usb->noise_filters[3].capval); |
| 816 | state_save_register_item(machine, "usb", NULL, 0, usb->noise_filters[4].capval); |
| 727 | 817 | } |
| 728 | 818 | |
| 729 | 819 | |
| r11160 | r11161 | |
| 731 | 821 | { |
| 732 | 822 | switch (state) |
| 733 | 823 | { |
| 824 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 825 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(usb_state); break; |
| 826 | |
| 734 | 827 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 735 | 828 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(usb_sound); break; |
| 829 | case DEVINFO_FCT_RESET: info->start = DEVICE_RESET_NAME(usb_sound); break; |
| 736 | 830 | |
| 737 | 831 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 738 | 832 | case DEVINFO_STR_NAME: strcpy(info->s, "Sega Universal Sound Board"); break; |
| r11160 | r11161 | |
| 740 | 834 | } |
| 741 | 835 | } |
| 742 | 836 | |
| 743 | | DECLARE_LEGACY_SOUND_DEVICE(SEGAUSB, usb_sound); |
| 744 | 837 | DEFINE_LEGACY_SOUND_DEVICE(SEGAUSB, usb_sound); |
| 745 | 838 | |
| 746 | 839 | |
| r11160 | r11161 | |
| 751 | 844 | * |
| 752 | 845 | *************************************/ |
| 753 | 846 | |
| 754 | | static void timer_w(int which, UINT8 offset, UINT8 data) |
| 847 | static void timer_w(usb_state *usb, int which, UINT8 offset, UINT8 data) |
| 755 | 848 | { |
| 756 | | timer8253 *g = &usb.timer_group[which]; |
| 849 | timer8253 *g = &usb->timer_group[which]; |
| 757 | 850 | timer8253_channel *ch; |
| 758 | 851 | int was_holding; |
| 759 | 852 | |
| 760 | | usb.stream->update(); |
| 853 | usb->stream->update(); |
| 761 | 854 | |
| 762 | 855 | /* switch off the offset */ |
| 763 | 856 | switch (offset) |
| r11160 | r11161 | |
| 820 | 913 | } |
| 821 | 914 | |
| 822 | 915 | |
| 823 | | static void env_w(int which, UINT8 offset, UINT8 data) |
| 916 | static void env_w(usb_state *usb, int which, UINT8 offset, UINT8 data) |
| 824 | 917 | { |
| 825 | | timer8253 *g = &usb.timer_group[which]; |
| 918 | timer8253 *g = &usb->timer_group[which]; |
| 826 | 919 | |
| 827 | | usb.stream->update(); |
| 920 | usb->stream->update(); |
| 828 | 921 | |
| 829 | 922 | if (offset < 3) |
| 830 | 923 | g->env[offset] = (double)data; |
| r11160 | r11161 | |
| 840 | 933 | * |
| 841 | 934 | *************************************/ |
| 842 | 935 | |
| 843 | | static READ8_HANDLER( usb_workram_r ) |
| 936 | static READ8_DEVICE_HANDLER( usb_workram_r ) |
| 844 | 937 | { |
| 845 | | offset += 256 * usb.work_ram_bank; |
| 846 | | return usb.work_ram[offset]; |
| 938 | usb_state *usb = get_safe_token(device); |
| 939 | |
| 940 | offset += 256 * usb->work_ram_bank; |
| 941 | return usb->work_ram[offset]; |
| 847 | 942 | } |
| 848 | 943 | |
| 849 | 944 | |
| 850 | | static WRITE8_HANDLER( usb_workram_w ) |
| 945 | static WRITE8_DEVICE_HANDLER( usb_workram_w ) |
| 851 | 946 | { |
| 852 | | offset += 256 * usb.work_ram_bank; |
| 853 | | usb.work_ram[offset] = data; |
| 947 | usb_state *usb = get_safe_token(device); |
| 854 | 948 | |
| 949 | offset += 256 * usb->work_ram_bank; |
| 950 | usb->work_ram[offset] = data; |
| 951 | |
| 855 | 952 | /* writes to the low 32 bytes go to various controls */ |
| 856 | 953 | switch (offset & ~3) |
| 857 | 954 | { |
| 858 | 955 | case 0x00: /* CTC0 */ |
| 859 | | timer_w(0, offset & 3, data); |
| 956 | timer_w(usb, 0, offset & 3, data); |
| 860 | 957 | break; |
| 861 | 958 | |
| 862 | 959 | case 0x04: /* ENV0 */ |
| 863 | | env_w(0, offset & 3, data); |
| 960 | env_w(usb, 0, offset & 3, data); |
| 864 | 961 | break; |
| 865 | 962 | |
| 866 | 963 | case 0x08: /* CTC1 */ |
| 867 | | timer_w(1, offset & 3, data); |
| 964 | timer_w(usb, 1, offset & 3, data); |
| 868 | 965 | break; |
| 869 | 966 | |
| 870 | 967 | case 0x0c: /* ENV1 */ |
| 871 | | env_w(1, offset & 3, data); |
| 968 | env_w(usb, 1, offset & 3, data); |
| 872 | 969 | break; |
| 873 | 970 | |
| 874 | 971 | case 0x10: /* CTC2 */ |
| 875 | | timer_w(2, offset & 3, data); |
| 972 | timer_w(usb, 2, offset & 3, data); |
| 876 | 973 | break; |
| 877 | 974 | |
| 878 | 975 | case 0x14: /* ENV2 */ |
| 879 | | env_w(2, offset & 3, data); |
| 976 | env_w(usb, 2, offset & 3, data); |
| 880 | 977 | break; |
| 881 | 978 | } |
| 882 | 979 | } |
| r11160 | r11161 | |
| 890 | 987 | *************************************/ |
| 891 | 988 | |
| 892 | 989 | static ADDRESS_MAP_START( usb_map, AS_PROGRAM, 8 ) |
| 893 | | AM_RANGE(0x0000, 0x0fff) AM_RAM AM_BASE(&usb.program_ram) |
| 990 | AM_RANGE(0x0000, 0x0fff) AM_RAM AM_SHARE("pgmram") |
| 894 | 991 | ADDRESS_MAP_END |
| 895 | 992 | |
| 896 | 993 | |
| r11160 | r11161 | |
| 900 | 997 | |
| 901 | 998 | |
| 902 | 999 | static ADDRESS_MAP_START( usb_portmap, AS_IO, 8 ) |
| 903 | | AM_RANGE(0x00, 0xff) AM_READWRITE(usb_workram_r, usb_workram_w) |
| 904 | | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(usb_p1_r, usb_p1_w) |
| 905 | | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(usb_p2_w) |
| 906 | | AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(usb_t1_r) |
| 1000 | AM_RANGE(0x00, 0xff) AM_DEVREADWRITE("usbsnd", usb_workram_r, usb_workram_w) |
| 1001 | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVREADWRITE("usbsnd", usb_p1_r, usb_p1_w) |
| 1002 | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_DEVWRITE("usbsnd", usb_p2_w) |
| 1003 | AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_DEVREAD("usbsnd", usb_t1_r) |
| 907 | 1004 | ADDRESS_MAP_END |
| 908 | 1005 | |
| 909 | 1006 | |
src/mame/audio/dcs.c
| r11160 | r11161 | |
| 216 | 216 | |
| 217 | 217 | |
| 218 | 218 | /* these macros are used to reference the SDRC ASIC */ |
| 219 | | #define SDRC_ROM_ST ((sdrc.reg[0] >> 0) & 3) /* 0=0000, 1=3000, 2=3400, 3=none */ |
| 220 | | #define SDRC_ROM_SZ ((sdrc.reg[0] >> 4) & 1) /* 0=4k, 1=1k */ |
| 221 | | #define SDRC_ROM_MS ((sdrc.reg[0] >> 5) & 1) /* 0=/BMS, 1=/DMS */ |
| 222 | | #define SDRC_ROM_PG ((sdrc.reg[0] >> 7) & 7) |
| 223 | | #define SDRC_SM_EN ((sdrc.reg[0] >> 11) & 1) |
| 224 | | #define SDRC_SM_BK ((sdrc.reg[0] >> 12) & 1) |
| 225 | | #define SDRC_SMODE ((sdrc.reg[0] >> 13) & 7) |
| 219 | #define SDRC_ROM_ST ((dcs.sdrc.reg[0] >> 0) & 3) /* 0=0000, 1=3000, 2=3400, 3=none */ |
| 220 | #define SDRC_ROM_SZ ((dcs.sdrc.reg[0] >> 4) & 1) /* 0=4k, 1=1k */ |
| 221 | #define SDRC_ROM_MS ((dcs.sdrc.reg[0] >> 5) & 1) /* 0=/BMS, 1=/DMS */ |
| 222 | #define SDRC_ROM_PG ((dcs.sdrc.reg[0] >> 7) & 7) |
| 223 | #define SDRC_SM_EN ((dcs.sdrc.reg[0] >> 11) & 1) |
| 224 | #define SDRC_SM_BK ((dcs.sdrc.reg[0] >> 12) & 1) |
| 225 | #define SDRC_SMODE ((dcs.sdrc.reg[0] >> 13) & 7) |
| 226 | 226 | |
| 227 | | #define SDRC_DM_ST ((sdrc.reg[1] >> 0) & 3) /* 0=none, 1=0000, 2=3000, 3=3400 */ |
| 228 | | #define SDRC_DM_REF ((sdrc.reg[1] >> 4) & 3) |
| 229 | | #define SDRC_DM_3WS ((sdrc.reg[1] >> 7) & 1) |
| 230 | | #define SDRC_TFS_INV ((sdrc.reg[1] >> 8) & 1) |
| 231 | | #define SDRC_RES_TFS ((sdrc.reg[1] >> 10) & 3) |
| 232 | | #define SDRC_LED ((sdrc.reg[1] >> 13) & 1) |
| 233 | | #define SDRC_MUTE ((sdrc.reg[1] >> 14) & 1) |
| 234 | | #define SDRC_AREF_ACT ((sdrc.reg[1] >> 15) & 1) |
| 227 | #define SDRC_DM_ST ((dcs.sdrc.reg[1] >> 0) & 3) /* 0=none, 1=0000, 2=3000, 3=3400 */ |
| 228 | #define SDRC_DM_REF ((dcs.sdrc.reg[1] >> 4) & 3) |
| 229 | #define SDRC_DM_3WS ((dcs.sdrc.reg[1] >> 7) & 1) |
| 230 | #define SDRC_TFS_INV ((dcs.sdrc.reg[1] >> 8) & 1) |
| 231 | #define SDRC_RES_TFS ((dcs.sdrc.reg[1] >> 10) & 3) |
| 232 | #define SDRC_LED ((dcs.sdrc.reg[1] >> 13) & 1) |
| 233 | #define SDRC_MUTE ((dcs.sdrc.reg[1] >> 14) & 1) |
| 234 | #define SDRC_AREF_ACT ((dcs.sdrc.reg[1] >> 15) & 1) |
| 235 | 235 | |
| 236 | | #define SDRC_DM_PG ((sdrc.reg[2] >> 0) & 0x7ff) |
| 237 | | #define SDRC_EPM_PG ((sdrc.reg[2] >> 0) & 0x1fff) |
| 236 | #define SDRC_DM_PG ((dcs.sdrc.reg[2] >> 0) & 0x7ff) |
| 237 | #define SDRC_EPM_PG ((dcs.sdrc.reg[2] >> 0) & 0x1fff) |
| 238 | 238 | |
| 239 | 239 | |
| 240 | 240 | /* these macros are used to reference the DSIO ASIC */ |
| 241 | | #define DSIO_EMPTY_FIFO ((dsio.reg[1] >> 0) & 1) |
| 242 | | #define DSIO_CUR_OUTPUT ((dsio.reg[1] >> 4) & 1) |
| 243 | | #define DSIO_RES_TFS ((dsio.reg[1] >> 10) & 1) |
| 244 | | #define DSIO_LED ((dsio.reg[1] >> 13) & 1) |
| 245 | | #define DSIO_MUTE ((dsio.reg[1] >> 14) & 1) |
| 241 | #define DSIO_EMPTY_FIFO ((dcs.dsio.reg[1] >> 0) & 1) |
| 242 | #define DSIO_CUR_OUTPUT ((dcs.dsio.reg[1] >> 4) & 1) |
| 243 | #define DSIO_RES_TFS ((dcs.dsio.reg[1] >> 10) & 1) |
| 244 | #define DSIO_LED ((dcs.dsio.reg[1] >> 13) & 1) |
| 245 | #define DSIO_MUTE ((dcs.dsio.reg[1] >> 14) & 1) |
| 246 | 246 | |
| 247 | | #define DSIO_DM_PG ((dsio.reg[2] >> 0) & 0x7ff) |
| 247 | #define DSIO_DM_PG ((dcs.dsio.reg[2] >> 0) & 0x7ff) |
| 248 | 248 | |
| 249 | 249 | |
| 250 | 250 | /* these macros are used to reference the DENVER ASIC */ |
| 251 | | #define DENV_DSP_SPEED ((dsio.reg[1] >> 2) & 3) /* read only: 1=33.33MHz */ |
| 252 | | #define DENV_RES_TFS ((dsio.reg[1] >> 10) & 1) |
| 253 | | #define DENV_CHANNELS ((dsio.reg[1] >> 11) & 3) /* 0=2ch, 1=4ch, 2=6ch */ |
| 254 | | #define DENV_LED ((dsio.reg[1] >> 13) & 1) |
| 255 | | #define DENV_MUTE ((dsio.reg[1] >> 14) & 1) |
| 251 | #define DENV_DSP_SPEED ((dcs.dsio.reg[1] >> 2) & 3) /* read only: 1=33.33MHz */ |
| 252 | #define DENV_RES_TFS ((dcs.dsio.reg[1] >> 10) & 1) |
| 253 | #define DENV_CHANNELS ((dcs.dsio.reg[1] >> 11) & 3) /* 0=2ch, 1=4ch, 2=6ch */ |
| 254 | #define DENV_LED ((dcs.dsio.reg[1] >> 13) & 1) |
| 255 | #define DENV_MUTE ((dcs.dsio.reg[1] >> 14) & 1) |
| 256 | 256 | |
| 257 | | #define DENV_DM_PG ((dsio.reg[2] >> 0) & 0x7ff) |
| 257 | #define DENV_DM_PG ((dcs.dsio.reg[2] >> 0) & 0x7ff) |
| 258 | 258 | |
| 259 | 259 | |
| 260 | 260 | |
| r11160 | r11161 | |
| 281 | 281 | }; |
| 282 | 282 | |
| 283 | 283 | |
| 284 | typedef struct _hle_transfer_state hle_transfer_state; |
| 285 | struct _hle_transfer_state |
| 286 | { |
| 287 | UINT8 hle_enabled; |
| 288 | INT32 dcs_state; |
| 289 | INT32 state; |
| 290 | INT32 start; |
| 291 | INT32 stop; |
| 292 | INT32 type; |
| 293 | INT32 temp; |
| 294 | INT32 writes_left; |
| 295 | UINT16 sum; |
| 296 | INT32 fifo_entries; |
| 297 | timer_device *watchdog; |
| 298 | }; |
| 299 | |
| 300 | |
| 284 | 301 | typedef struct _dcs_state dcs_state; |
| 285 | 302 | struct _dcs_state |
| 286 | 303 | { |
| r11160 | r11161 | |
| 334 | 351 | UINT32 timer_scale; |
| 335 | 352 | UINT32 timer_period; |
| 336 | 353 | UINT32 timers_fired; |
| 337 | | }; |
| 338 | 354 | |
| 355 | UINT16 *sram; |
| 356 | UINT16 *polling_base; |
| 357 | UINT32 *internal_program_ram; |
| 358 | UINT32 *external_program_ram; |
| 339 | 359 | |
| 340 | | typedef struct _hle_transfer_state hle_transfer_state; |
| 341 | | struct _hle_transfer_state |
| 342 | | { |
| 343 | | UINT8 hle_enabled; |
| 344 | | INT32 dcs_state; |
| 345 | | INT32 state; |
| 346 | | INT32 start; |
| 347 | | INT32 stop; |
| 348 | | INT32 type; |
| 349 | | INT32 temp; |
| 350 | | INT32 writes_left; |
| 351 | | UINT16 sum; |
| 352 | | INT32 fifo_entries; |
| 353 | | timer_device *watchdog; |
| 360 | sdrc_state sdrc; |
| 361 | dsio_state dsio; |
| 362 | hle_transfer_state transfer; |
| 354 | 363 | }; |
| 355 | 364 | |
| 356 | 365 | |
| r11160 | r11161 | |
| 362 | 371 | *************************************/ |
| 363 | 372 | |
| 364 | 373 | static dcs_state dcs; |
| 365 | | static sdrc_state sdrc; |
| 366 | | static dsio_state dsio; |
| 367 | | static hle_transfer_state transfer; |
| 368 | 374 | |
| 369 | | static UINT16 *dcs_sram; |
| 370 | 375 | |
| 371 | | static UINT16 *dcs_polling_base; |
| 372 | 376 | |
| 373 | | static UINT32 *dcs_internal_program_ram; |
| 374 | | static UINT32 *dcs_external_program_ram; |
| 375 | | |
| 376 | | |
| 377 | | |
| 378 | 377 | /************************************* |
| 379 | 378 | * |
| 380 | 379 | * Prototypes |
| r11160 | r11161 | |
| 390 | 389 | static WRITE16_HANDLER( sdrc_w ); |
| 391 | 390 | static STATE_POSTLOAD( sdrc_postload ); |
| 392 | 391 | |
| 393 | | static void dsio_reset(void); |
| 392 | static void dsio_reset(running_machine &machine); |
| 394 | 393 | static READ16_HANDLER( dsio_r ); |
| 395 | 394 | static WRITE16_HANDLER( dsio_w ); |
| 396 | 395 | |
| 397 | | static void denver_reset(void); |
| 396 | static void denver_reset(running_machine &machine); |
| 398 | 397 | static READ16_HANDLER( denver_r ); |
| 399 | 398 | static WRITE16_HANDLER( denver_w ); |
| 400 | 399 | |
| r11160 | r11161 | |
| 432 | 431 | |
| 433 | 432 | /* DCS 2k memory map */ |
| 434 | 433 | static ADDRESS_MAP_START( dcs_2k_program_map, AS_PROGRAM, 32 ) |
| 435 | | AM_RANGE(0x0000, 0x03ff) AM_RAM AM_BASE(&dcs_internal_program_ram) |
| 436 | | AM_RANGE(0x0800, 0x0fff) AM_RAM AM_SHARE("share1") AM_BASE(&dcs_external_program_ram) |
| 437 | | AM_RANGE(0x1000, 0x17ff) AM_RAM AM_SHARE("share1") |
| 438 | | AM_RANGE(0x1800, 0x1fff) AM_RAM AM_SHARE("share1") |
| 434 | AM_RANGE(0x0000, 0x03ff) AM_RAM AM_SHARE("dcsint") |
| 435 | AM_RANGE(0x0800, 0x0fff) AM_RAM AM_SHARE("dcsext") |
| 436 | AM_RANGE(0x1000, 0x17ff) AM_RAM AM_SHARE("dcsext") |
| 437 | AM_RANGE(0x1800, 0x1fff) AM_RAM AM_SHARE("dcsext") |
| 439 | 438 | ADDRESS_MAP_END |
| 440 | 439 | |
| 441 | 440 | static ADDRESS_MAP_START( dcs_2k_data_map, AS_DATA, 16 ) |
| r11160 | r11161 | |
| 463 | 462 | |
| 464 | 463 | /* DCS 8k memory map */ |
| 465 | 464 | static ADDRESS_MAP_START( dcs_8k_program_map, AS_PROGRAM, 32 ) |
| 466 | | AM_RANGE(0x0000, 0x03ff) AM_RAM AM_BASE(&dcs_internal_program_ram) |
| 467 | | AM_RANGE(0x0800, 0x1fff) AM_RAM AM_BASE(&dcs_external_program_ram) |
| 465 | AM_RANGE(0x0000, 0x03ff) AM_RAM AM_SHARE("dcsint") |
| 466 | AM_RANGE(0x0800, 0x1fff) AM_RAM AM_SHARE("dcsext") |
| 468 | 467 | ADDRESS_MAP_END |
| 469 | 468 | |
| 470 | 469 | static ADDRESS_MAP_START( dcs_8k_data_map, AS_DATA, 16 ) |
| r11160 | r11161 | |
| 487 | 486 | |
| 488 | 487 | static ADDRESS_MAP_START( dcs2_2115_program_map, AS_PROGRAM, 32 ) |
| 489 | 488 | ADDRESS_MAP_UNMAP_HIGH |
| 490 | | AM_RANGE(0x0000, 0x03ff) AM_RAM AM_BASE(&dcs_internal_program_ram) |
| 489 | AM_RANGE(0x0000, 0x03ff) AM_RAM AM_SHARE("dcsint") |
| 491 | 490 | ADDRESS_MAP_END |
| 492 | 491 | |
| 493 | 492 | static ADDRESS_MAP_START( dcs2_2104_program_map, AS_PROGRAM, 32 ) |
| 494 | 493 | ADDRESS_MAP_UNMAP_HIGH |
| 495 | | AM_RANGE(0x0000, 0x01ff) AM_RAM AM_BASE(&dcs_internal_program_ram) |
| 494 | AM_RANGE(0x0000, 0x01ff) AM_RAM AM_SHARE("dcsint") |
| 496 | 495 | ADDRESS_MAP_END |
| 497 | 496 | |
| 498 | 497 | |
| r11160 | r11161 | |
| 530 | 529 | |
| 531 | 530 | static ADDRESS_MAP_START( dsio_program_map, AS_PROGRAM, 32 ) |
| 532 | 531 | ADDRESS_MAP_UNMAP_HIGH |
| 533 | | AM_RANGE(0x0000, 0x3fff) AM_RAM AM_BASE(&dcs_internal_program_ram) |
| 532 | AM_RANGE(0x0000, 0x3fff) AM_RAM AM_SHARE("dcsint") |
| 534 | 533 | ADDRESS_MAP_END |
| 535 | 534 | |
| 536 | 535 | |
| r11160 | r11161 | |
| 562 | 561 | |
| 563 | 562 | static ADDRESS_MAP_START( denver_program_map, AS_PROGRAM, 32 ) |
| 564 | 563 | ADDRESS_MAP_UNMAP_HIGH |
| 565 | | AM_RANGE(0x0000, 0x3fff) AM_RAM AM_BASE(&dcs_internal_program_ram) |
| 564 | AM_RANGE(0x0000, 0x3fff) AM_RAM AM_SHARE("dcsint") |
| 566 | 565 | ADDRESS_MAP_END |
| 567 | 566 | |
| 568 | 567 | |
| r11160 | r11161 | |
| 750 | 749 | * |
| 751 | 750 | *************************************/ |
| 752 | 751 | |
| 753 | | static void dcs_boot(void) |
| 752 | static void dcs_boot(running_machine &machine) |
| 754 | 753 | { |
| 755 | 754 | UINT8 buffer[0x1000]; |
| 756 | 755 | UINT32 max_banks; |
| r11160 | r11161 | |
| 769 | 768 | /* convert from 16-bit data to 8-bit data and boot */ |
| 770 | 769 | for (i = 0; i < 0x1000; i++) |
| 771 | 770 | buffer[i] = base[i]; |
| 772 | | dcs.cpu->load_boot_data(buffer, dcs_internal_program_ram); |
| 771 | dcs.cpu->load_boot_data(buffer, dcs.internal_program_ram); |
| 773 | 772 | break; |
| 774 | 773 | |
| 775 | 774 | /* rev 2: use the ROM page in the SDRC to boot from */ |
| r11160 | r11161 | |
| 790 | 789 | /* convert from 16-bit data to 8-bit data and boot */ |
| 791 | 790 | for (i = 0; i < 0x1000; i++) |
| 792 | 791 | buffer[i] = base[i]; |
| 793 | | dcs.cpu->load_boot_data(buffer, dcs_internal_program_ram); |
| 792 | dcs.cpu->load_boot_data(buffer, dcs.internal_program_ram); |
| 794 | 793 | break; |
| 795 | 794 | |
| 796 | 795 | /* rev 3/4: HALT the ADSP-2181 until program is downloaded via IDMA */ |
| 797 | 796 | case 3: |
| 798 | 797 | case 4: |
| 799 | 798 | device_set_input_line(dcs.cpu, INPUT_LINE_HALT, ASSERT_LINE); |
| 800 | | dsio.start_on_next_write = 0; |
| 799 | dcs.dsio.start_on_next_write = 0; |
| 801 | 800 | break; |
| 802 | 801 | } |
| 803 | 802 | } |
| r11160 | r11161 | |
| 831 | 830 | |
| 832 | 831 | /* rev 3: reset the DSIO ASIC */ |
| 833 | 832 | case 3: |
| 834 | | dsio_reset(); |
| 833 | dsio_reset(machine); |
| 835 | 834 | break; |
| 836 | 835 | |
| 837 | 836 | /* rev 4: reset the Denver ASIC */ |
| 838 | 837 | case 4: |
| 839 | | denver_reset(); |
| 838 | denver_reset(machine); |
| 840 | 839 | break; |
| 841 | 840 | } |
| 842 | 841 | |
| r11160 | r11161 | |
| 862 | 861 | (*dcs.output_full_cb)(machine, dcs.last_output_full = 0); |
| 863 | 862 | |
| 864 | 863 | /* boot */ |
| 865 | | dcs_boot(); |
| 864 | dcs_boot(machine); |
| 866 | 865 | |
| 867 | 866 | /* reset timers */ |
| 868 | 867 | dcs.timer_enable = 0; |
| r11160 | r11161 | |
| 874 | 873 | dcs.sport_timer->adjust(attotime::from_hz(1000), 0, attotime::from_hz(1000)); |
| 875 | 874 | |
| 876 | 875 | /* reset the HLE transfer states */ |
| 877 | | transfer.dcs_state = transfer.state = 0; |
| 876 | dcs.transfer.dcs_state = dcs.transfer.state = 0; |
| 878 | 877 | } |
| 879 | 878 | |
| 880 | 879 | |
| r11160 | r11161 | |
| 887 | 886 | |
| 888 | 887 | static void dcs_register_state(running_machine &machine) |
| 889 | 888 | { |
| 890 | | state_save_register_global_array(machine, sdrc.reg); |
| 891 | | state_save_register_global(machine, sdrc.seed); |
| 889 | state_save_register_global_array(machine, dcs.sdrc.reg); |
| 890 | state_save_register_global(machine, dcs.sdrc.seed); |
| 892 | 891 | |
| 893 | | state_save_register_global_array(machine, dsio.reg); |
| 894 | | state_save_register_global(machine, dsio.start_on_next_write); |
| 895 | | state_save_register_global(machine, dsio.channelbits); |
| 892 | state_save_register_global_array(machine, dcs.dsio.reg); |
| 893 | state_save_register_global(machine, dcs.dsio.start_on_next_write); |
| 894 | state_save_register_global(machine, dcs.dsio.channelbits); |
| 896 | 895 | |
| 897 | 896 | state_save_register_global(machine, dcs.channels); |
| 898 | 897 | state_save_register_global(machine, dcs.size); |
| r11160 | r11161 | |
| 921 | 920 | state_save_register_global(machine, dcs.timer_period); |
| 922 | 921 | state_save_register_global(machine, dcs.timers_fired); |
| 923 | 922 | |
| 924 | | state_save_register_global(machine, transfer.dcs_state); |
| 925 | | state_save_register_global(machine, transfer.state); |
| 926 | | state_save_register_global(machine, transfer.start); |
| 927 | | state_save_register_global(machine, transfer.stop); |
| 928 | | state_save_register_global(machine, transfer.type); |
| 929 | | state_save_register_global(machine, transfer.temp); |
| 930 | | state_save_register_global(machine, transfer.writes_left); |
| 931 | | state_save_register_global(machine, transfer.sum); |
| 932 | | state_save_register_global(machine, transfer.fifo_entries); |
| 923 | state_save_register_global(machine, dcs.transfer.dcs_state); |
| 924 | state_save_register_global(machine, dcs.transfer.state); |
| 925 | state_save_register_global(machine, dcs.transfer.start); |
| 926 | state_save_register_global(machine, dcs.transfer.stop); |
| 927 | state_save_register_global(machine, dcs.transfer.type); |
| 928 | state_save_register_global(machine, dcs.transfer.temp); |
| 929 | state_save_register_global(machine, dcs.transfer.writes_left); |
| 930 | state_save_register_global(machine, dcs.transfer.sum); |
| 931 | state_save_register_global(machine, dcs.transfer.fifo_entries); |
| 933 | 932 | |
| 934 | | if (dcs_sram != NULL) |
| 935 | | state_save_register_global_pointer(machine, dcs_sram, 0x8000*4 / sizeof(dcs_sram[0])); |
| 933 | if (dcs.sram != NULL) |
| 934 | state_save_register_global_pointer(machine, dcs.sram, 0x8000*4 / sizeof(dcs.sram[0])); |
| 936 | 935 | |
| 937 | 936 | if (dcs.rev == 2) |
| 938 | 937 | machine.state().register_postload(sdrc_postload, NULL); |
| r11160 | r11161 | |
| 941 | 940 | void dcs_init(running_machine &machine) |
| 942 | 941 | { |
| 943 | 942 | memset(&dcs, 0, sizeof(dcs)); |
| 944 | | dcs_sram = NULL; |
| 943 | dcs.sram = NULL; |
| 945 | 944 | |
| 945 | dcs.internal_program_ram = (UINT32 *)memory_get_shared(machine, "dcsint"); |
| 946 | dcs.external_program_ram = (UINT32 *)memory_get_shared(machine, "dcsext"); |
| 947 | |
| 946 | 948 | /* find the DCS CPU and the sound ROMs */ |
| 947 | 949 | dcs.cpu = machine.device<adsp21xx_device>("dcs"); |
| 948 | 950 | dcs.program = dcs.cpu->space(AS_PROGRAM); |
| r11160 | r11161 | |
| 979 | 981 | int soundbank_words; |
| 980 | 982 | |
| 981 | 983 | memset(&dcs, 0, sizeof(dcs)); |
| 984 | dcs.internal_program_ram = (UINT32 *)memory_get_shared(machine, "dcsint"); |
| 985 | dcs.external_program_ram = (UINT32 *)memory_get_shared(machine, "dcsext"); |
| 982 | 986 | |
| 983 | 987 | /* find the DCS CPU and the sound ROMs */ |
| 984 | 988 | dcs.cpu = machine.device<adsp21xx_device>("dcs2"); |
| r11160 | r11161 | |
| 1022 | 1026 | memory_configure_bank(machine, "databank", 0, dcs.sounddata_banks, dcs.sounddata, soundbank_words*2); |
| 1023 | 1027 | |
| 1024 | 1028 | /* allocate memory for the SRAM */ |
| 1025 | | dcs_sram = auto_alloc_array(machine, UINT16, 0x8000*4/2); |
| 1029 | dcs.sram = auto_alloc_array(machine, UINT16, 0x8000*4/2); |
| 1026 | 1030 | |
| 1027 | 1031 | /* create the timers */ |
| 1028 | 1032 | dcs.internal_timer = machine.device<timer_device>("dcs_int_timer"); |
| r11160 | r11161 | |
| 1035 | 1039 | /* install the speedup handler */ |
| 1036 | 1040 | dcs.polling_offset = polling_offset; |
| 1037 | 1041 | if (polling_offset) |
| 1038 | | dcs_polling_base = dcs.cpu->space(AS_DATA)->install_legacy_readwrite_handler(polling_offset, polling_offset, FUNC(dcs_polling_r), FUNC(dcs_polling_w)); |
| 1042 | dcs.polling_base = dcs.cpu->space(AS_DATA)->install_legacy_readwrite_handler(dcs.polling_offset, dcs.polling_offset, FUNC(dcs_polling_r), FUNC(dcs_polling_w)); |
| 1039 | 1043 | |
| 1040 | 1044 | /* allocate a watchdog timer for HLE transfers */ |
| 1041 | | transfer.hle_enabled = (ENABLE_HLE_TRANSFERS && dram_in_mb != 0); |
| 1042 | | if (transfer.hle_enabled) |
| 1043 | | transfer.watchdog = machine.device<timer_device>("dcs_hle_timer"); |
| 1045 | dcs.transfer.hle_enabled = (ENABLE_HLE_TRANSFERS && dram_in_mb != 0); |
| 1046 | if (dcs.transfer.hle_enabled) |
| 1047 | dcs.transfer.watchdog = machine.device<timer_device>("dcs_hle_timer"); |
| 1044 | 1048 | |
| 1045 | 1049 | /* register for save states */ |
| 1046 | 1050 | dcs_register_state(machine); |
| r11160 | r11161 | |
| 1050 | 1054 | } |
| 1051 | 1055 | |
| 1052 | 1056 | |
| 1053 | | void dcs_set_auto_ack(int state) |
| 1057 | void dcs_set_auto_ack(running_machine &machine, int state) |
| 1054 | 1058 | { |
| 1055 | 1059 | dcs.auto_ack = state; |
| 1056 | 1060 | } |
| r11160 | r11161 | |
| 1065 | 1069 | |
| 1066 | 1070 | static READ16_HANDLER( dcs_dataram_r ) |
| 1067 | 1071 | { |
| 1068 | | return dcs_external_program_ram[offset] >> 8; |
| 1072 | return dcs.external_program_ram[offset] >> 8; |
| 1069 | 1073 | } |
| 1070 | 1074 | |
| 1071 | 1075 | |
| 1072 | 1076 | static WRITE16_HANDLER( dcs_dataram_w ) |
| 1073 | 1077 | { |
| 1074 | | UINT16 newdata = dcs_external_program_ram[offset] >> 8; |
| 1078 | UINT16 newdata = dcs.external_program_ram[offset] >> 8; |
| 1075 | 1079 | COMBINE_DATA(&newdata); |
| 1076 | | dcs_external_program_ram[offset] = (newdata << 8) | (dcs_external_program_ram[offset] & 0xff); |
| 1080 | dcs.external_program_ram[offset] = (newdata << 8) | (dcs.external_program_ram[offset] & 0xff); |
| 1077 | 1081 | } |
| 1078 | 1082 | |
| 1079 | 1083 | |
| r11160 | r11161 | |
| 1134 | 1138 | else |
| 1135 | 1139 | { |
| 1136 | 1140 | /* first start with a clean program map */ |
| 1137 | | dcs.program->install_ram(0x0800, 0x3fff, dcs_sram + 0x4800); |
| 1141 | dcs.program->install_ram(0x0800, 0x3fff, dcs.sram + 0x4800); |
| 1138 | 1142 | |
| 1139 | 1143 | /* set up the data map based on the SRAM banking */ |
| 1140 | 1144 | /* map 0: ram from 0800-37ff */ |
| 1141 | 1145 | if (SDRC_SM_BK == 0) |
| 1142 | 1146 | { |
| 1143 | | dcs.data->install_ram(0x0800, 0x17ff, dcs_sram + 0x0000); |
| 1144 | | dcs.data->install_ram(0x1800, 0x27ff, dcs_sram + 0x1000); |
| 1145 | | dcs.data->install_ram(0x2800, 0x37ff, dcs_sram + 0x2000); |
| 1147 | dcs.data->install_ram(0x0800, 0x17ff, dcs.sram + 0x0000); |
| 1148 | dcs.data->install_ram(0x1800, 0x27ff, dcs.sram + 0x1000); |
| 1149 | dcs.data->install_ram(0x2800, 0x37ff, dcs.sram + 0x2000); |
| 1146 | 1150 | } |
| 1147 | 1151 | |
| 1148 | 1152 | /* map 1: nothing from 0800-17ff, alternate RAM at 1800-27ff, same RAM at 2800-37ff */ |
| 1149 | 1153 | else |
| 1150 | 1154 | { |
| 1151 | 1155 | dcs.data->unmap_readwrite(0x0800, 0x17ff); |
| 1152 | | dcs.data->install_ram(0x1800, 0x27ff, dcs_sram + 0x3000); |
| 1153 | | dcs.data->install_ram(0x2800, 0x37ff, dcs_sram + 0x2000); |
| 1156 | dcs.data->install_ram(0x1800, 0x27ff, dcs.sram + 0x3000); |
| 1157 | dcs.data->install_ram(0x2800, 0x37ff, dcs.sram + 0x2000); |
| 1154 | 1158 | } |
| 1155 | 1159 | } |
| 1156 | 1160 | |
| r11160 | r11161 | |
| 1174 | 1178 | |
| 1175 | 1179 | /* reinstall the polling hotspot */ |
| 1176 | 1180 | if (dcs.polling_offset) |
| 1177 | | dcs_polling_base = dcs.cpu->space(AS_DATA)->install_legacy_readwrite_handler(dcs.polling_offset, dcs.polling_offset, FUNC(dcs_polling_r), FUNC(dcs_polling_w)); |
| 1181 | dcs.polling_base = dcs.cpu->space(AS_DATA)->install_legacy_readwrite_handler(dcs.polling_offset, dcs.polling_offset, FUNC(dcs_polling_r), FUNC(dcs_polling_w)); |
| 1178 | 1182 | } |
| 1179 | 1183 | |
| 1180 | 1184 | |
| r11160 | r11161 | |
| 1186 | 1190 | |
| 1187 | 1191 | static void sdrc_reset(running_machine &machine) |
| 1188 | 1192 | { |
| 1189 | | memset(sdrc.reg, 0, sizeof(sdrc.reg)); |
| 1193 | memset(dcs.sdrc.reg, 0, sizeof(dcs.sdrc.reg)); |
| 1190 | 1194 | sdrc_remap_memory(machine); |
| 1191 | 1195 | } |
| 1192 | 1196 | |
| r11160 | r11161 | |
| 1200 | 1204 | |
| 1201 | 1205 | static READ16_HANDLER( sdrc_r ) |
| 1202 | 1206 | { |
| 1207 | sdrc_state &sdrc = dcs.sdrc; |
| 1203 | 1208 | UINT16 result = sdrc.reg[offset]; |
| 1204 | 1209 | |
| 1205 | 1210 | /* offset 3 is for security */ |
| r11160 | r11161 | |
| 1248 | 1253 | |
| 1249 | 1254 | static WRITE16_HANDLER( sdrc_w ) |
| 1250 | 1255 | { |
| 1256 | sdrc_state &sdrc = dcs.sdrc; |
| 1251 | 1257 | UINT16 diff = sdrc.reg[offset] ^ data; |
| 1252 | 1258 | |
| 1253 | 1259 | switch (offset) |
| r11160 | r11161 | |
| 1264 | 1270 | /* offset 1 controls RAM mapping */ |
| 1265 | 1271 | case 1: |
| 1266 | 1272 | sdrc.reg[1] = data; |
| 1267 | | // dmadac_enable(&dcs.dmadac[0], dcs.channels, SDRC_MUTE); |
| 1273 | //dmadac_enable(&dcs.dmadac[0], dcs.channels, SDRC_MUTE); |
| 1268 | 1274 | if (diff & 0x0003) |
| 1269 | 1275 | sdrc_remap_memory(space->machine()); |
| 1270 | 1276 | break; |
| r11160 | r11161 | |
| 1320 | 1326 | * |
| 1321 | 1327 | *************************************/ |
| 1322 | 1328 | |
| 1323 | | static void dsio_reset(void) |
| 1329 | static void dsio_reset(running_machine &machine) |
| 1324 | 1330 | { |
| 1325 | | memset(&dsio, 0, sizeof(dsio)); |
| 1331 | memset(&dcs.dsio, 0, sizeof(dcs.dsio)); |
| 1326 | 1332 | } |
| 1327 | 1333 | |
| 1328 | 1334 | |
| 1329 | 1335 | static READ16_HANDLER( dsio_r ) |
| 1330 | 1336 | { |
| 1337 | dsio_state &dsio = dcs.dsio; |
| 1331 | 1338 | UINT16 result = dsio.reg[offset]; |
| 1332 | 1339 | |
| 1333 | 1340 | if (offset == 1) |
| r11160 | r11161 | |
| 1342 | 1349 | |
| 1343 | 1350 | static WRITE16_HANDLER( dsio_w ) |
| 1344 | 1351 | { |
| 1352 | dsio_state &dsio = dcs.dsio; |
| 1353 | |
| 1345 | 1354 | switch (offset) |
| 1346 | 1355 | { |
| 1347 | 1356 | /* offset 1 controls I/O */ |
| r11160 | r11161 | |
| 1371 | 1380 | * |
| 1372 | 1381 | *************************************/ |
| 1373 | 1382 | |
| 1374 | | static void denver_reset(void) |
| 1383 | static void denver_reset(running_machine &machine) |
| 1375 | 1384 | { |
| 1376 | | memset(&dsio, 0, sizeof(dsio)); |
| 1385 | memset(&dcs.dsio, 0, sizeof(dcs.dsio)); |
| 1377 | 1386 | } |
| 1378 | 1387 | |
| 1379 | 1388 | |
| 1380 | 1389 | static READ16_HANDLER( denver_r ) |
| 1381 | 1390 | { |
| 1382 | | UINT16 result = dsio.reg[offset]; |
| 1391 | UINT16 result = dcs.dsio.reg[offset]; |
| 1383 | 1392 | |
| 1384 | 1393 | if (offset == 3) |
| 1385 | 1394 | { |
| r11160 | r11161 | |
| 1392 | 1401 | |
| 1393 | 1402 | static WRITE16_HANDLER( denver_w ) |
| 1394 | 1403 | { |
| 1404 | dsio_state &dsio = dcs.dsio; |
| 1395 | 1405 | int enable, channels, chan; |
| 1396 | 1406 | |
| 1397 | 1407 | switch (offset) |
| r11160 | r11161 | |
| 1444 | 1454 | |
| 1445 | 1455 | WRITE32_HANDLER( dsio_idma_addr_w ) |
| 1446 | 1456 | { |
| 1457 | dsio_state &dsio = dcs.dsio; |
| 1447 | 1458 | if (LOG_DCS_TRANSFERS) |
| 1448 | 1459 | logerror("%08X:IDMA_addr = %04X\n", cpu_get_pc(&space->device()), data); |
| 1449 | 1460 | downcast<adsp2181_device *>(dcs.cpu)->idma_addr_w(data); |
| r11160 | r11161 | |
| 1454 | 1465 | |
| 1455 | 1466 | WRITE32_HANDLER( dsio_idma_data_w ) |
| 1456 | 1467 | { |
| 1468 | dsio_state &dsio = dcs.dsio; |
| 1457 | 1469 | UINT32 pc = cpu_get_pc(&space->device()); |
| 1458 | 1470 | if (ACCESSING_BITS_0_15) |
| 1459 | 1471 | { |
| r11160 | r11161 | |
| 1504 | 1516 | } |
| 1505 | 1517 | |
| 1506 | 1518 | |
| 1507 | | int dcs_control_r(void) |
| 1519 | int dcs_control_r(running_machine &machine) |
| 1508 | 1520 | { |
| 1509 | 1521 | /* only boost for DCS2 boards */ |
| 1510 | | if (!dcs.auto_ack && !transfer.hle_enabled) |
| 1511 | | dcs.cpu->machine().scheduler().boost_interleave(attotime::from_nsec(500), attotime::from_usec(5)); |
| 1522 | if (!dcs.auto_ack && !dcs.transfer.hle_enabled) |
| 1523 | machine.scheduler().boost_interleave(attotime::from_nsec(500), attotime::from_usec(5)); |
| 1512 | 1524 | return dcs.latch_control; |
| 1513 | 1525 | } |
| 1514 | 1526 | |
| 1515 | 1527 | |
| 1516 | | void dcs_reset_w(int state) |
| 1528 | void dcs_reset_w(running_machine &machine, int state) |
| 1517 | 1529 | { |
| 1518 | 1530 | /* going high halts the CPU */ |
| 1519 | 1531 | if (state) |
| 1520 | 1532 | { |
| 1521 | | logerror("%s: DCS reset = %d\n", dcs.cpu->machine().describe_context(), state); |
| 1533 | logerror("%s: DCS reset = %d\n", machine.describe_context(), state); |
| 1522 | 1534 | |
| 1523 | 1535 | /* just run through the init code again */ |
| 1524 | | dcs.cpu->machine().scheduler().synchronize(FUNC(dcs_reset)); |
| 1536 | machine.scheduler().synchronize(FUNC(dcs_reset)); |
| 1525 | 1537 | device_set_input_line(dcs.cpu, INPUT_LINE_RESET, ASSERT_LINE); |
| 1526 | 1538 | } |
| 1527 | 1539 | |
| r11160 | r11161 | |
| 1538 | 1550 | result |= 0x80; |
| 1539 | 1551 | if (IS_OUTPUT_EMPTY()) |
| 1540 | 1552 | result |= 0x40; |
| 1541 | | if (dcs.fifo_status_r != NULL && (!transfer.hle_enabled || transfer.state == 0)) |
| 1553 | if (dcs.fifo_status_r != NULL && (!dcs.transfer.hle_enabled || dcs.transfer.state == 0)) |
| 1542 | 1554 | result |= (*dcs.fifo_status_r)(dcs.cpu) & 0x38; |
| 1543 | | if (transfer.hle_enabled && transfer.state != 0) |
| 1555 | if (dcs.transfer.hle_enabled && dcs.transfer.state != 0) |
| 1544 | 1556 | result |= 0x08; |
| 1545 | 1557 | return result; |
| 1546 | 1558 | } |
| r11160 | r11161 | |
| 1587 | 1599 | } |
| 1588 | 1600 | |
| 1589 | 1601 | |
| 1590 | | void dcs_data_w(int data) |
| 1602 | void dcs_data_w(running_machine &machine, int data) |
| 1591 | 1603 | { |
| 1592 | 1604 | /* preprocess the write */ |
| 1593 | | if (preprocess_write(dcs.cpu->machine(), data)) |
| 1605 | if (preprocess_write(machine, data)) |
| 1594 | 1606 | return; |
| 1595 | 1607 | |
| 1596 | 1608 | /* if we are DCS1, set a timer to latch the data */ |
| 1597 | 1609 | if (dcs.sport_timer == NULL) |
| 1598 | | dcs.cpu->machine().scheduler().synchronize(FUNC(dcs_delayed_data_w_callback), data); |
| 1610 | machine.scheduler().synchronize(FUNC(dcs_delayed_data_w_callback), data); |
| 1599 | 1611 | else |
| 1600 | | dcs_delayed_data_w(dcs.cpu->machine(), data); |
| 1612 | dcs_delayed_data_w(machine, data); |
| 1601 | 1613 | } |
| 1602 | 1614 | |
| 1603 | 1615 | |
| r11160 | r11161 | |
| 1642 | 1654 | } |
| 1643 | 1655 | |
| 1644 | 1656 | |
| 1645 | | static void delayed_ack_w(void) |
| 1657 | static void delayed_ack_w(running_machine &machine) |
| 1646 | 1658 | { |
| 1647 | 1659 | SET_OUTPUT_EMPTY(); |
| 1648 | 1660 | } |
| r11160 | r11161 | |
| 1650 | 1662 | |
| 1651 | 1663 | static TIMER_CALLBACK( delayed_ack_w_callback ) |
| 1652 | 1664 | { |
| 1653 | | delayed_ack_w(); |
| 1665 | delayed_ack_w(machine); |
| 1654 | 1666 | } |
| 1655 | 1667 | |
| 1656 | 1668 | |
| 1657 | | void dcs_ack_w(void) |
| 1669 | void dcs_ack_w(running_machine &machine) |
| 1658 | 1670 | { |
| 1659 | | dcs.cpu->machine().scheduler().synchronize(FUNC(delayed_ack_w_callback)); |
| 1671 | machine.scheduler().synchronize(FUNC(delayed_ack_w_callback)); |
| 1660 | 1672 | } |
| 1661 | 1673 | |
| 1662 | 1674 | |
| 1663 | | int dcs_data_r(void) |
| 1675 | int dcs_data_r(running_machine &machine) |
| 1664 | 1676 | { |
| 1665 | 1677 | /* data is actually only 8 bit (read from d8-d15) */ |
| 1666 | 1678 | if (dcs.last_output_full && dcs.output_full_cb) |
| 1667 | | (*dcs.output_full_cb)(dcs.cpu->machine(), dcs.last_output_full = 0); |
| 1679 | (*dcs.output_full_cb)(machine, dcs.last_output_full = 0); |
| 1668 | 1680 | if (dcs.auto_ack) |
| 1669 | | delayed_ack_w(); |
| 1681 | delayed_ack_w(machine); |
| 1670 | 1682 | |
| 1671 | 1683 | if (LOG_DCS_IO) |
| 1672 | | logerror("%s:dcs_data_r(%04X)\n", dcs.cpu->machine().describe_context(), dcs.output_data); |
| 1684 | logerror("%s:dcs_data_r(%04X)\n", machine.describe_context(), dcs.output_data); |
| 1673 | 1685 | return dcs.output_data; |
| 1674 | 1686 | } |
| 1675 | 1687 | |
| r11160 | r11161 | |
| 1703 | 1715 | } |
| 1704 | 1716 | |
| 1705 | 1717 | |
| 1706 | | int dcs_data2_r(void) |
| 1718 | int dcs_data2_r(running_machine &machine) |
| 1707 | 1719 | { |
| 1708 | 1720 | return dcs.output_control; |
| 1709 | 1721 | } |
| r11160 | r11161 | |
| 1803 | 1815 | dcs.timer_ignore = 0; |
| 1804 | 1816 | if (enable) |
| 1805 | 1817 | { |
| 1806 | | // mame_printf_debug("Timer enabled @ %d cycles/int, or %f Hz\n", dcs.timer_scale * (dcs.timer_period + 1), 1.0 / dcs.cpu->cycles_to_attotime(dcs.timer_scale * (dcs.timer_period + 1))); |
| 1818 | //mame_printf_debug("Timer enabled @ %d cycles/int, or %f Hz\n", dcs.timer_scale * (dcs.timer_period + 1), 1.0 / dcs.cpu->cycles_to_attotime(dcs.timer_scale * (dcs.timer_period + 1))); |
| 1807 | 1819 | reset_timer(device.machine()); |
| 1808 | 1820 | } |
| 1809 | 1821 | else |
| 1810 | 1822 | { |
| 1811 | | // mame_printf_debug("Timer disabled\n"); |
| 1823 | //mame_printf_debug("Timer disabled\n"); |
| 1812 | 1824 | dcs.internal_timer->reset(); |
| 1813 | 1825 | } |
| 1814 | 1826 | } |
| r11160 | r11161 | |
| 1879 | 1891 | { |
| 1880 | 1892 | logerror("%04X:Rebooting DCS due to SYSCONTROL write\n", cpu_get_pc(&space->device())); |
| 1881 | 1893 | device_set_input_line(dcs.cpu, INPUT_LINE_RESET, PULSE_LINE); |
| 1882 | | dcs_boot(); |
| 1894 | dcs_boot(space->machine()); |
| 1883 | 1895 | dcs.control_regs[SYSCONTROL_REG] = 0; |
| 1884 | 1896 | } |
| 1885 | 1897 | |
| r11160 | r11161 | |
| 2074 | 2086 | { |
| 2075 | 2087 | if (dcs.polling_count++ > 5) |
| 2076 | 2088 | device_eat_cycles(&space->device(), 10000); |
| 2077 | | return *dcs_polling_base; |
| 2089 | return *dcs.polling_base; |
| 2078 | 2090 | } |
| 2079 | 2091 | |
| 2080 | 2092 | |
| 2081 | 2093 | static WRITE16_HANDLER( dcs_polling_w ) |
| 2082 | 2094 | { |
| 2083 | 2095 | dcs.polling_count = 0; |
| 2084 | | COMBINE_DATA(dcs_polling_base); |
| 2096 | COMBINE_DATA(dcs.polling_base); |
| 2085 | 2097 | } |
| 2086 | 2098 | |
| 2087 | 2099 | |
| r11160 | r11161 | |
| 2090 | 2102 | DATA TRANSFER HLE MECHANISM |
| 2091 | 2103 | ****************************************************************************/ |
| 2092 | 2104 | |
| 2093 | | void dcs_fifo_notify(int count, int max) |
| 2105 | void dcs_fifo_notify(running_machine &machine, int count, int max) |
| 2094 | 2106 | { |
| 2107 | hle_transfer_state &transfer = dcs.transfer; |
| 2108 | |
| 2095 | 2109 | /* skip if not in mid-transfer */ |
| 2096 | 2110 | if (!transfer.hle_enabled || transfer.state == 0 || !dcs.fifo_data_r) |
| 2097 | 2111 | { |
| r11160 | r11161 | |
| 2104 | 2118 | if (transfer.state != 5 || transfer.fifo_entries == transfer.writes_left || transfer.fifo_entries >= 256) |
| 2105 | 2119 | { |
| 2106 | 2120 | for ( ; transfer.fifo_entries; transfer.fifo_entries--) |
| 2107 | | preprocess_write(dcs.cpu->machine(), (*dcs.fifo_data_r)(dcs.cpu)); |
| 2121 | preprocess_write(machine, (*dcs.fifo_data_r)(dcs.cpu)); |
| 2108 | 2122 | } |
| 2109 | 2123 | } |
| 2110 | 2124 | |
| 2111 | 2125 | |
| 2112 | 2126 | static TIMER_DEVICE_CALLBACK( transfer_watchdog_callback ) |
| 2113 | 2127 | { |
| 2128 | hle_transfer_state &transfer = dcs.transfer; |
| 2114 | 2129 | int starting_writes_left = param; |
| 2115 | 2130 | |
| 2116 | 2131 | if (transfer.fifo_entries && starting_writes_left == transfer.writes_left) |
| r11160 | r11161 | |
| 2152 | 2167 | |
| 2153 | 2168 | static int preprocess_stage_1(running_machine &machine, UINT16 data) |
| 2154 | 2169 | { |
| 2170 | hle_transfer_state &transfer = dcs.transfer; |
| 2171 | |
| 2155 | 2172 | switch (transfer.state) |
| 2156 | 2173 | { |
| 2157 | 2174 | case 0: |
| r11160 | r11161 | |
| 2223 | 2240 | { |
| 2224 | 2241 | if (transfer.type == 1 && SDRC_SM_BK == 1) |
| 2225 | 2242 | { |
| 2226 | | sdrc.reg[0] &= ~0x1000; |
| 2243 | dcs.sdrc.reg[0] &= ~0x1000; |
| 2227 | 2244 | sdrc_remap_memory(machine); |
| 2228 | 2245 | } |
| 2229 | 2246 | if (transfer.type == 2 && SDRC_SM_BK == 0) |
| 2230 | 2247 | { |
| 2231 | | sdrc.reg[0] |= 0x1000; |
| 2248 | dcs.sdrc.reg[0] |= 0x1000; |
| 2232 | 2249 | sdrc_remap_memory(machine); |
| 2233 | 2250 | } |
| 2234 | 2251 | return 1; |
| r11160 | r11161 | |
| 2288 | 2305 | |
| 2289 | 2306 | static int preprocess_stage_2(running_machine &machine, UINT16 data) |
| 2290 | 2307 | { |
| 2308 | hle_transfer_state &transfer = dcs.transfer; |
| 2309 | |
| 2291 | 2310 | switch (transfer.state) |
| 2292 | 2311 | { |
| 2293 | 2312 | case 0: |
| r11160 | r11161 | |
| 2388 | 2407 | |
| 2389 | 2408 | static int preprocess_write(running_machine &machine, UINT16 data) |
| 2390 | 2409 | { |
| 2410 | hle_transfer_state &transfer = dcs.transfer; |
| 2391 | 2411 | int result; |
| 2392 | 2412 | |
| 2393 | 2413 | /* if we're not DCS2, skip */ |
src/mame/audio/exidy440.c
| r11160 | r11161 | |
| 71 | 71 | |
| 72 | 72 | |
| 73 | 73 | |
| 74 | | /* local allocated storage */ |
| 75 | | static UINT8 sound_command; |
| 76 | | static UINT8 sound_command_ack; |
| 77 | | static UINT8 *sound_banks; |
| 78 | | static UINT8 *m6844_data; |
| 79 | | static UINT8 *sound_volume; |
| 80 | | static INT32 *mixer_buffer_left; |
| 81 | | static INT32 *mixer_buffer_right; |
| 82 | | static sound_cache_entry *sound_cache; |
| 83 | | static sound_cache_entry *sound_cache_end; |
| 84 | | static sound_cache_entry *sound_cache_max; |
| 74 | typedef struct |
| 75 | { |
| 76 | UINT8 sound_command; |
| 77 | UINT8 sound_command_ack; |
| 85 | 78 | |
| 86 | | /* 6844 description */ |
| 87 | | static m6844_channel_data m6844_channel[4]; |
| 88 | | static UINT8 m6844_priority; |
| 89 | | static UINT8 m6844_interrupt; |
| 90 | | static UINT8 m6844_chain; |
| 79 | UINT8 sound_banks[4]; |
| 80 | UINT8 m6844_data[0x20]; |
| 81 | UINT8 sound_volume[0x10]; |
| 82 | INT32 *mixer_buffer_left; |
| 83 | INT32 *mixer_buffer_right; |
| 84 | sound_cache_entry *sound_cache; |
| 85 | sound_cache_entry *sound_cache_end; |
| 86 | sound_cache_entry *sound_cache_max; |
| 91 | 87 | |
| 92 | | /* sound interface parameters */ |
| 93 | | static sound_stream *stream; |
| 94 | | static sound_channel_data sound_channel[4]; |
| 88 | /* 6844 description */ |
| 89 | m6844_channel_data m6844_channel[4]; |
| 90 | UINT8 m6844_priority; |
| 91 | UINT8 m6844_interrupt; |
| 92 | UINT8 m6844_chain; |
| 95 | 93 | |
| 96 | | /* debugging */ |
| 97 | | static FILE *debuglog; |
| 94 | /* sound interface parameters */ |
| 95 | sound_stream *stream; |
| 96 | sound_channel_data sound_channel[4]; |
| 98 | 97 | |
| 99 | | /* channel frequency is configurable */ |
| 100 | | static int channel_frequency[4]; |
| 98 | /* debugging */ |
| 99 | FILE *debuglog; |
| 101 | 100 | |
| 101 | /* channel frequency is configurable */ |
| 102 | int channel_frequency[4]; |
| 103 | } exidy440_audio_state; |
| 104 | |
| 102 | 105 | /* constant channel parameters */ |
| 103 | 106 | static const int channel_bits[4] = |
| 104 | 107 | { |
| r11160 | r11161 | |
| 109 | 112 | |
| 110 | 113 | /* function prototypes */ |
| 111 | 114 | static STREAM_UPDATE( channel_update ); |
| 112 | | static void m6844_finished(int ch); |
| 113 | | static void play_cvsd(running_machine &machine, int ch); |
| 114 | | static void stop_cvsd(int ch); |
| 115 | static void m6844_finished(m6844_channel_data *channel); |
| 116 | static void play_cvsd(device_t *device, int ch); |
| 117 | static void stop_cvsd(device_t *device, int ch); |
| 115 | 118 | |
| 116 | | static void reset_sound_cache(void); |
| 117 | | static INT16 *add_to_sound_cache(UINT8 *input, int address, int length, int bits, int frequency); |
| 118 | | static INT16 *find_or_add_to_sound_cache(running_machine &machine, int address, int length, int bits, int frequency); |
| 119 | static void reset_sound_cache(device_t *device); |
| 120 | static INT16 *add_to_sound_cache(device_t *device, UINT8 *input, int address, int length, int bits, int frequency); |
| 121 | static INT16 *find_or_add_to_sound_cache(device_t *device, int address, int length, int bits, int frequency); |
| 119 | 122 | |
| 120 | | static void decode_and_filter_cvsd(UINT8 *data, int bytes, int maskbits, int frequency, INT16 *dest); |
| 121 | | static void fir_filter(INT32 *input, INT16 *output, int count); |
| 123 | static void decode_and_filter_cvsd(device_t *device, UINT8 *data, int bytes, int maskbits, int frequency, INT16 *dest); |
| 124 | static void fir_filter(device_t *device, INT32 *input, INT16 *output, int count); |
| 122 | 125 | |
| 123 | 126 | |
| 127 | DECLARE_LEGACY_SOUND_DEVICE(EXIDY440, exidy440_sound); |
| 124 | 128 | |
| 125 | 129 | /************************************* |
| 126 | 130 | * |
| r11160 | r11161 | |
| 128 | 132 | * |
| 129 | 133 | *************************************/ |
| 130 | 134 | |
| 135 | INLINE exidy440_audio_state *get_safe_token(device_t *device) |
| 136 | { |
| 137 | assert(device != NULL); |
| 138 | assert(device->type() == EXIDY440); |
| 139 | |
| 140 | return (exidy440_audio_state *)downcast<legacy_device_base *>(device)->token(); |
| 141 | } |
| 142 | |
| 131 | 143 | static DEVICE_START( exidy440_sound ) |
| 132 | 144 | { |
| 145 | exidy440_audio_state *state = get_safe_token(device); |
| 133 | 146 | running_machine &machine = device->machine(); |
| 134 | 147 | int i, length; |
| 135 | 148 | |
| 136 | 149 | /* reset the system */ |
| 137 | | sound_command = 0; |
| 138 | | sound_command_ack = 1; |
| 139 | | state_save_register_global(machine, sound_command); |
| 140 | | state_save_register_global(machine, sound_command_ack); |
| 150 | state->sound_command = 0; |
| 151 | state->sound_command_ack = 1; |
| 152 | state_save_register_global(machine, state->sound_command); |
| 153 | state_save_register_global(machine, state->sound_command_ack); |
| 141 | 154 | |
| 142 | 155 | /* reset the 6844 */ |
| 143 | 156 | for (i = 0; i < 4; i++) |
| 144 | 157 | { |
| 145 | | m6844_channel[i].active = 0; |
| 146 | | m6844_channel[i].control = 0x00; |
| 158 | state->m6844_channel[i].active = 0; |
| 159 | state->m6844_channel[i].control = 0x00; |
| 147 | 160 | } |
| 148 | | m6844_priority = 0x00; |
| 149 | | m6844_interrupt = 0x00; |
| 150 | | m6844_chain = 0x00; |
| 161 | state->m6844_priority = 0x00; |
| 162 | state->m6844_interrupt = 0x00; |
| 163 | state->m6844_chain = 0x00; |
| 151 | 164 | |
| 152 | | state_save_register_global(machine, m6844_priority); |
| 153 | | state_save_register_global(machine, m6844_interrupt); |
| 154 | | state_save_register_global(machine, m6844_chain); |
| 165 | state_save_register_global(machine, state->m6844_priority); |
| 166 | state_save_register_global(machine, state->m6844_interrupt); |
| 167 | state_save_register_global(machine, state->m6844_chain); |
| 155 | 168 | |
| 156 | | channel_frequency[0] = device->clock(); /* channels 0 and 1 are run by FCLK */ |
| 157 | | channel_frequency[1] = device->clock(); |
| 158 | | channel_frequency[2] = device->clock()/2; /* channels 2 and 3 are run by SCLK */ |
| 159 | | channel_frequency[3] = device->clock()/2; |
| 169 | state->channel_frequency[0] = device->clock(); /* channels 0 and 1 are run by FCLK */ |
| 170 | state->channel_frequency[1] = device->clock(); |
| 171 | state->channel_frequency[2] = device->clock()/2; /* channels 2 and 3 are run by SCLK */ |
| 172 | state->channel_frequency[3] = device->clock()/2; |
| 160 | 173 | |
| 161 | 174 | /* get stream channels */ |
| 162 | | stream = device->machine().sound().stream_alloc(*device, 0, 2, device->clock(), NULL, channel_update); |
| 175 | state->stream = device->machine().sound().stream_alloc(*device, 0, 2, device->clock(), NULL, channel_update); |
| 163 | 176 | |
| 164 | 177 | /* allocate the sample cache */ |
| 165 | 178 | length = machine.region("cvsd")->bytes() * 16 + MAX_CACHE_ENTRIES * sizeof(sound_cache_entry); |
| 166 | | sound_cache = (sound_cache_entry *)auto_alloc_array(machine, UINT8, length); |
| 179 | state->sound_cache = (sound_cache_entry *)auto_alloc_array(machine, UINT8, length); |
| 167 | 180 | |
| 168 | 181 | /* determine the hard end of the cache and reset */ |
| 169 | | sound_cache_max = (sound_cache_entry *)((UINT8 *)sound_cache + length); |
| 170 | | reset_sound_cache(); |
| 182 | state->sound_cache_max = (sound_cache_entry *)((UINT8 *)state->sound_cache + length); |
| 183 | reset_sound_cache(device); |
| 171 | 184 | |
| 172 | 185 | /* allocate the mixer buffer */ |
| 173 | | mixer_buffer_left = auto_alloc_array(machine, INT32, 2 * device->clock()); |
| 174 | | mixer_buffer_right = mixer_buffer_left + device->clock(); |
| 186 | state->mixer_buffer_left = auto_alloc_array(machine, INT32, 2 * device->clock()); |
| 187 | state->mixer_buffer_right = state->mixer_buffer_left + device->clock(); |
| 175 | 188 | |
| 176 | 189 | if (SOUND_LOG) |
| 177 | | debuglog = fopen("sound.log", "w"); |
| 190 | state->debuglog = fopen("sound.log", "w"); |
| 178 | 191 | } |
| 179 | 192 | |
| 180 | 193 | |
| r11160 | r11161 | |
| 187 | 200 | |
| 188 | 201 | static DEVICE_STOP( exidy440_sound ) |
| 189 | 202 | { |
| 190 | | if (SOUND_LOG && debuglog) |
| 191 | | fclose(debuglog); |
| 203 | exidy440_audio_state *state = get_safe_token(device); |
| 204 | if (SOUND_LOG && state->debuglog) |
| 205 | fclose(state->debuglog); |
| 192 | 206 | } |
| 193 | 207 | |
| 194 | 208 | |
| r11160 | r11161 | |
| 199 | 213 | * |
| 200 | 214 | *************************************/ |
| 201 | 215 | |
| 202 | | static void add_and_scale_samples(int ch, INT32 *dest, int samples, int volume) |
| 216 | static void add_and_scale_samples(device_t *device, int ch, INT32 *dest, int samples, int volume) |
| 203 | 217 | { |
| 204 | | sound_channel_data *channel = &sound_channel[ch]; |
| 218 | exidy440_audio_state *state = get_safe_token(device); |
| 219 | sound_channel_data *channel = &state->sound_channel[ch]; |
| 205 | 220 | INT16 *srcdata; |
| 206 | 221 | int i; |
| 207 | 222 | |
| r11160 | r11161 | |
| 243 | 258 | * |
| 244 | 259 | *************************************/ |
| 245 | 260 | |
| 246 | | static void mix_to_16(int length, stream_sample_t *dest_left, stream_sample_t *dest_right) |
| 261 | static void mix_to_16(device_t *device, int length, stream_sample_t *dest_left, stream_sample_t *dest_right) |
| 247 | 262 | { |
| 248 | | INT32 *mixer_left = mixer_buffer_left; |
| 249 | | INT32 *mixer_right = mixer_buffer_right; |
| 263 | exidy440_audio_state *state = get_safe_token(device); |
| 264 | INT32 *mixer_left = state->mixer_buffer_left; |
| 265 | INT32 *mixer_right = state->mixer_buffer_right; |
| 250 | 266 | int i, clippers = 0; |
| 251 | 267 | |
| 252 | 268 | for (i = 0; i < length; i++) |
| r11160 | r11161 | |
| 274 | 290 | |
| 275 | 291 | static STREAM_UPDATE( channel_update ) |
| 276 | 292 | { |
| 293 | exidy440_audio_state *state = get_safe_token(device); |
| 277 | 294 | int ch; |
| 278 | 295 | |
| 279 | 296 | /* reset the mixer buffers */ |
| 280 | | memset(mixer_buffer_left, 0, samples * sizeof(INT32)); |
| 281 | | memset(mixer_buffer_right, 0, samples * sizeof(INT32)); |
| 297 | memset(state->mixer_buffer_left, 0, samples * sizeof(INT32)); |
| 298 | memset(state->mixer_buffer_right, 0, samples * sizeof(INT32)); |
| 282 | 299 | |
| 283 | 300 | /* loop over channels */ |
| 284 | 301 | for (ch = 0; ch < 4; ch++) |
| 285 | 302 | { |
| 286 | | sound_channel_data *channel = &sound_channel[ch]; |
| 303 | sound_channel_data *channel = &state->sound_channel[ch]; |
| 287 | 304 | int length, volume, left = samples; |
| 288 | 305 | int effective_offset; |
| 289 | 306 | |
| r11160 | r11161 | |
| 295 | 312 | length = (left > channel->remaining) ? channel->remaining : left; |
| 296 | 313 | |
| 297 | 314 | /* get a pointer to the sample data and copy to the left */ |
| 298 | | volume = sound_volume[2 * ch + 0]; |
| 315 | volume = state->sound_volume[2 * ch + 0]; |
| 299 | 316 | if (volume) |
| 300 | | add_and_scale_samples(ch, mixer_buffer_left, length, volume); |
| 317 | add_and_scale_samples(device, ch, state->mixer_buffer_left, length, volume); |
| 301 | 318 | |
| 302 | 319 | /* get a pointer to the sample data and copy to the left */ |
| 303 | | volume = sound_volume[2 * ch + 1]; |
| 320 | volume = state->sound_volume[2 * ch + 1]; |
| 304 | 321 | if (volume) |
| 305 | | add_and_scale_samples(ch, mixer_buffer_right, length, volume); |
| 322 | add_and_scale_samples(device, ch, state->mixer_buffer_right, length, volume); |
| 306 | 323 | |
| 307 | 324 | /* update our counters */ |
| 308 | 325 | channel->offset += length; |
| r11160 | r11161 | |
| 311 | 328 | |
| 312 | 329 | /* update the MC6844 */ |
| 313 | 330 | effective_offset = (ch & 2) ? channel->offset / 2 : channel->offset; |
| 314 | | m6844_channel[ch].address = m6844_channel[ch].start_address + effective_offset / 8; |
| 315 | | m6844_channel[ch].counter = m6844_channel[ch].start_counter - effective_offset / 8; |
| 316 | | if (m6844_channel[ch].counter <= 0) |
| 331 | state->m6844_channel[ch].address = state->m6844_channel[ch].start_address + effective_offset / 8; |
| 332 | state->m6844_channel[ch].counter = state->m6844_channel[ch].start_counter - effective_offset / 8; |
| 333 | if (state->m6844_channel[ch].counter <= 0) |
| 317 | 334 | { |
| 318 | | if (SOUND_LOG && debuglog) |
| 319 | | fprintf(debuglog, "Channel %d finished\n", ch); |
| 320 | | m6844_finished(ch); |
| 335 | if (SOUND_LOG && state->debuglog) |
| 336 | fprintf(state->debuglog, "Channel %d finished\n", ch); |
| 337 | m6844_finished(&state->m6844_channel[ch]); |
| 321 | 338 | } |
| 322 | 339 | } |
| 323 | 340 | |
| 324 | 341 | /* all done, time to mix it */ |
| 325 | | mix_to_16(samples, outputs[0], outputs[1]); |
| 342 | mix_to_16(device, samples, outputs[0], outputs[1]); |
| 326 | 343 | } |
| 327 | 344 | |
| 328 | 345 | |
| r11160 | r11161 | |
| 333 | 350 | * |
| 334 | 351 | *************************************/ |
| 335 | 352 | |
| 336 | | static READ8_HANDLER( sound_command_r ) |
| 353 | static READ8_DEVICE_HANDLER( sound_command_r ) |
| 337 | 354 | { |
| 355 | exidy440_audio_state *state = get_safe_token(device); |
| 338 | 356 | /* clear the FIRQ that got us here and acknowledge the read to the main CPU */ |
| 339 | | cputag_set_input_line(space->machine(), "audiocpu", 1, CLEAR_LINE); |
| 340 | | sound_command_ack = 1; |
| 357 | cputag_set_input_line(device->machine(), "audiocpu", 1, CLEAR_LINE); |
| 358 | state->sound_command_ack = 1; |
| 341 | 359 | |
| 342 | | return sound_command; |
| 360 | return state->sound_command; |
| 343 | 361 | } |
| 344 | 362 | |
| 345 | 363 | |
| 346 | | void exidy440_sound_command(running_machine &machine, UINT8 param) |
| 364 | void exidy440_sound_command(device_t *device, UINT8 param) |
| 347 | 365 | { |
| 348 | | sound_command = param; |
| 349 | | sound_command_ack = 0; |
| 350 | | cputag_set_input_line(machine, "audiocpu", INPUT_LINE_IRQ1, ASSERT_LINE); |
| 366 | exidy440_audio_state *state = get_safe_token(device); |
| 367 | state->sound_command = param; |
| 368 | state->sound_command_ack = 0; |
| 369 | cputag_set_input_line(device->machine(), "audiocpu", INPUT_LINE_IRQ1, ASSERT_LINE); |
| 351 | 370 | } |
| 352 | 371 | |
| 353 | 372 | |
| 354 | | UINT8 exidy440_sound_command_ack(void) |
| 373 | UINT8 exidy440_sound_command_ack(device_t *device) |
| 355 | 374 | { |
| 356 | | return sound_command_ack; |
| 375 | exidy440_audio_state *state = get_safe_token(device); |
| 376 | return state->sound_command_ack; |
| 357 | 377 | } |
| 358 | 378 | |
| 359 | 379 | |
| r11160 | r11161 | |
| 364 | 384 | * |
| 365 | 385 | *************************************/ |
| 366 | 386 | |
| 367 | | static WRITE8_HANDLER( sound_volume_w ) |
| 387 | static READ8_DEVICE_HANDLER( sound_volume_r ) |
| 368 | 388 | { |
| 369 | | if (SOUND_LOG && debuglog) |
| 370 | | fprintf(debuglog, "Volume %02X=%02X\n", offset, data); |
| 389 | exidy440_audio_state *state = get_safe_token(device); |
| 390 | return state->sound_volume[offset]; |
| 391 | } |
| 371 | 392 | |
| 393 | static WRITE8_DEVICE_HANDLER( sound_volume_w ) |
| 394 | { |
| 395 | exidy440_audio_state *state = get_safe_token(device); |
| 396 | if (SOUND_LOG && state->debuglog) |
| 397 | fprintf(state->debuglog, "Volume %02X=%02X\n", offset, data); |
| 398 | |
| 372 | 399 | /* update the stream */ |
| 373 | | stream->update(); |
| 400 | state->stream->update(); |
| 374 | 401 | |
| 375 | 402 | /* set the new volume */ |
| 376 | | sound_volume[offset] = ~data; |
| 403 | state->sound_volume[offset] = ~data; |
| 377 | 404 | } |
| 378 | 405 | |
| 379 | 406 | |
| r11160 | r11161 | |
| 384 | 411 | * |
| 385 | 412 | *************************************/ |
| 386 | 413 | |
| 387 | | static WRITE8_HANDLER( sound_interrupt_clear_w ) |
| 414 | static WRITE8_DEVICE_HANDLER( sound_interrupt_clear_w ) |
| 388 | 415 | { |
| 389 | | cputag_set_input_line(space->machine(), "audiocpu", 0, CLEAR_LINE); |
| 416 | cputag_set_input_line(device->machine(), "audiocpu", 0, CLEAR_LINE); |
| 390 | 417 | } |
| 391 | 418 | |
| 392 | 419 | |
| r11160 | r11161 | |
| 397 | 424 | * |
| 398 | 425 | *************************************/ |
| 399 | 426 | |
| 400 | | static void m6844_update(void) |
| 427 | static void m6844_update(device_t *device) |
| 401 | 428 | { |
| 429 | exidy440_audio_state *state = get_safe_token(device); |
| 402 | 430 | /* update the stream */ |
| 403 | | stream->update(); |
| 431 | state->stream->update(); |
| 404 | 432 | } |
| 405 | 433 | |
| 406 | 434 | |
| 407 | | static void m6844_finished(int ch) |
| 435 | static void m6844_finished(m6844_channel_data *channel) |
| 408 | 436 | { |
| 409 | | m6844_channel_data *channel = &m6844_channel[ch]; |
| 410 | | |
| 411 | 437 | /* mark us inactive */ |
| 412 | 438 | channel->active = 0; |
| 413 | 439 | |
| r11160 | r11161 | |
| 428 | 454 | * |
| 429 | 455 | *************************************/ |
| 430 | 456 | |
| 431 | | static READ8_HANDLER( m6844_r ) |
| 457 | static READ8_DEVICE_HANDLER( m6844_r ) |
| 432 | 458 | { |
| 459 | exidy440_audio_state *state = get_safe_token(device); |
| 460 | m6844_channel_data *m6844_channel = state->m6844_channel; |
| 433 | 461 | int result = 0; |
| 434 | 462 | |
| 435 | 463 | /* first update the current state of the DMA transfers */ |
| 436 | | m6844_update(); |
| 464 | m6844_update(device); |
| 437 | 465 | |
| 438 | 466 | /* switch off the offset we were given */ |
| 439 | 467 | switch (offset) |
| r11160 | r11161 | |
| 483 | 511 | |
| 484 | 512 | /* priority control */ |
| 485 | 513 | case 0x14: |
| 486 | | result = m6844_priority; |
| 514 | result = state->m6844_priority; |
| 487 | 515 | break; |
| 488 | 516 | |
| 489 | 517 | /* interrupt control */ |
| 490 | 518 | case 0x15: |
| 491 | 519 | |
| 492 | 520 | /* update the global DMA end flag */ |
| 493 | | m6844_interrupt &= ~0x80; |
| 494 | | m6844_interrupt |= (m6844_channel[0].control & 0x80) | |
| 521 | state->m6844_interrupt &= ~0x80; |
| 522 | state->m6844_interrupt |= (m6844_channel[0].control & 0x80) | |
| 495 | 523 | (m6844_channel[1].control & 0x80) | |
| 496 | 524 | (m6844_channel[2].control & 0x80) | |
| 497 | 525 | (m6844_channel[3].control & 0x80); |
| 498 | 526 | |
| 499 | | result = m6844_interrupt; |
| 527 | result = state->m6844_interrupt; |
| 500 | 528 | break; |
| 501 | 529 | |
| 502 | 530 | /* chaining control */ |
| 503 | 531 | case 0x16: |
| 504 | | result = m6844_chain; |
| 532 | result = state->m6844_chain; |
| 505 | 533 | break; |
| 506 | 534 | |
| 507 | 535 | /* 0x17-0x1f not used */ |
| r11160 | r11161 | |
| 512 | 540 | } |
| 513 | 541 | |
| 514 | 542 | |
| 515 | | static WRITE8_HANDLER( m6844_w ) |
| 543 | static WRITE8_DEVICE_HANDLER( m6844_w ) |
| 516 | 544 | { |
| 545 | exidy440_audio_state *state = get_safe_token(device); |
| 546 | m6844_channel_data *m6844_channel = state->m6844_channel; |
| 517 | 547 | int i; |
| 518 | 548 | |
| 519 | 549 | /* first update the current state of the DMA transfers */ |
| 520 | | m6844_update(); |
| 550 | m6844_update(device); |
| 521 | 551 | |
| 522 | 552 | /* switch off the offset we were given */ |
| 523 | 553 | switch (offset) |
| r11160 | r11161 | |
| 564 | 594 | |
| 565 | 595 | /* priority control */ |
| 566 | 596 | case 0x14: |
| 567 | | m6844_priority = data; |
| 597 | state->m6844_priority = data; |
| 568 | 598 | |
| 569 | 599 | /* update the sound playback on each channel */ |
| 570 | 600 | for (i = 0; i < 4; i++) |
| r11160 | r11161 | |
| 584 | 614 | m6844_channel[i].start_counter = m6844_channel[i].counter; |
| 585 | 615 | |
| 586 | 616 | /* generate and play the sample */ |
| 587 | | play_cvsd(space->machine(), i); |
| 617 | play_cvsd(device, i); |
| 588 | 618 | } |
| 589 | 619 | |
| 590 | 620 | /* if we're going inactive... */ |
| r11160 | r11161 | |
| 594 | 624 | m6844_channel[i].active = 0; |
| 595 | 625 | |
| 596 | 626 | /* stop playing the sample */ |
| 597 | | stop_cvsd(i); |
| 627 | stop_cvsd(device, i); |
| 598 | 628 | } |
| 599 | 629 | } |
| 600 | 630 | break; |
| 601 | 631 | |
| 602 | 632 | /* interrupt control */ |
| 603 | 633 | case 0x15: |
| 604 | | m6844_interrupt = (m6844_interrupt & 0x80) | (data & 0x7f); |
| 634 | state->m6844_interrupt = (state->m6844_interrupt & 0x80) | (data & 0x7f); |
| 605 | 635 | break; |
| 606 | 636 | |
| 607 | 637 | /* chaining control */ |
| 608 | 638 | case 0x16: |
| 609 | | m6844_chain = data; |
| 639 | state->m6844_chain = data; |
| 610 | 640 | break; |
| 611 | 641 | |
| 612 | 642 | /* 0x17-0x1f not used */ |
| r11160 | r11161 | |
| 622 | 652 | * |
| 623 | 653 | *************************************/ |
| 624 | 654 | |
| 625 | | static void reset_sound_cache(void) |
| 655 | static void reset_sound_cache(device_t *device) |
| 626 | 656 | { |
| 627 | | sound_cache_end = sound_cache; |
| 657 | exidy440_audio_state *state = get_safe_token(device); |
| 658 | state->sound_cache_end = state->sound_cache; |
| 628 | 659 | } |
| 629 | 660 | |
| 630 | 661 | |
| 631 | | static INT16 *add_to_sound_cache(UINT8 *input, int address, int length, int bits, int frequency) |
| 662 | static INT16 *add_to_sound_cache(device_t *device, UINT8 *input, int address, int length, int bits, int frequency) |
| 632 | 663 | { |
| 633 | | sound_cache_entry *current = sound_cache_end; |
| 664 | exidy440_audio_state *state = get_safe_token(device); |
| 665 | sound_cache_entry *current = state->sound_cache_end; |
| 634 | 666 | |
| 635 | 667 | /* compute where the end will be once we add this entry */ |
| 636 | | sound_cache_end = (sound_cache_entry *)((UINT8 *)current + sizeof(sound_cache_entry) + length * 16); |
| 668 | state->sound_cache_end = (sound_cache_entry *)((UINT8 *)current + sizeof(sound_cache_entry) + length * 16); |
| 637 | 669 | |
| 638 | 670 | /* if this will overflow the cache, reset and re-add */ |
| 639 | | if (sound_cache_end > sound_cache_max) |
| 671 | if (state->sound_cache_end > state->sound_cache_max) |
| 640 | 672 | { |
| 641 | | reset_sound_cache(); |
| 642 | | return add_to_sound_cache(input, address, length, bits, frequency); |
| 673 | reset_sound_cache(device); |
| 674 | return add_to_sound_cache(device, input, address, length, bits, frequency); |
| 643 | 675 | } |
| 644 | 676 | |
| 645 | 677 | /* fill in this entry */ |
| 646 | | current->next = sound_cache_end; |
| 678 | current->next = state->sound_cache_end; |
| 647 | 679 | current->address = address; |
| 648 | 680 | current->length = length; |
| 649 | 681 | current->bits = bits; |
| 650 | 682 | current->frequency = frequency; |
| 651 | 683 | |
| 652 | 684 | /* decode the data into the cache */ |
| 653 | | decode_and_filter_cvsd(input, length, bits, frequency, current->data); |
| 685 | decode_and_filter_cvsd(device, input, length, bits, frequency, current->data); |
| 654 | 686 | return current->data; |
| 655 | 687 | } |
| 656 | 688 | |
| 657 | 689 | |
| 658 | | static INT16 *find_or_add_to_sound_cache(running_machine &machine, int address, int length, int bits, int frequency) |
| 690 | static INT16 *find_or_add_to_sound_cache(device_t *device, int address, int length, int bits, int frequency) |
| 659 | 691 | { |
| 692 | exidy440_audio_state *state = get_safe_token(device); |
| 660 | 693 | sound_cache_entry *current; |
| 661 | 694 | |
| 662 | | for (current = sound_cache; current < sound_cache_end; current = current->next) |
| 695 | for (current = state->sound_cache; current < state->sound_cache_end; current = current->next) |
| 663 | 696 | if (current->address == address && current->length == length && current->bits == bits && current->frequency == frequency) |
| 664 | 697 | return current->data; |
| 665 | 698 | |
| 666 | | return add_to_sound_cache(&machine.region("cvsd")->base()[address], address, length, bits, frequency); |
| 699 | return add_to_sound_cache(device, &device->machine().region("cvsd")->base()[address], address, length, bits, frequency); |
| 667 | 700 | } |
| 668 | 701 | |
| 669 | 702 | |
| r11160 | r11161 | |
| 674 | 707 | * |
| 675 | 708 | *************************************/ |
| 676 | 709 | |
| 677 | | static void play_cvsd(running_machine &machine, int ch) |
| 710 | static void play_cvsd(device_t *device, int ch) |
| 678 | 711 | { |
| 679 | | sound_channel_data *channel = &sound_channel[ch]; |
| 680 | | int address = m6844_channel[ch].address; |
| 681 | | int length = m6844_channel[ch].counter; |
| 712 | exidy440_audio_state *state = get_safe_token(device); |
| 713 | sound_channel_data *channel = &state->sound_channel[ch]; |
| 714 | int address = state->m6844_channel[ch].address; |
| 715 | int length = state->m6844_channel[ch].counter; |
| 682 | 716 | INT16 *base; |
| 683 | 717 | |
| 684 | 718 | /* add the bank number to the address */ |
| 685 | | if (sound_banks[ch] & 1) |
| 719 | if (state->sound_banks[ch] & 1) |
| 686 | 720 | address += 0x00000; |
| 687 | | else if (sound_banks[ch] & 2) |
| 721 | else if (state->sound_banks[ch] & 2) |
| 688 | 722 | address += 0x08000; |
| 689 | | else if (sound_banks[ch] & 4) |
| 723 | else if (state->sound_banks[ch] & 4) |
| 690 | 724 | address += 0x10000; |
| 691 | | else if (sound_banks[ch] & 8) |
| 725 | else if (state->sound_banks[ch] & 8) |
| 692 | 726 | address += 0x18000; |
| 693 | 727 | |
| 694 | 728 | /* compute the base address in the converted samples array */ |
| 695 | | base = find_or_add_to_sound_cache(machine, address, length, channel_bits[ch], channel_frequency[ch]); |
| 729 | base = find_or_add_to_sound_cache(device, address, length, channel_bits[ch], state->channel_frequency[ch]); |
| 696 | 730 | if (!base) |
| 697 | 731 | return; |
| 698 | 732 | |
| r11160 | r11161 | |
| 702 | 736 | channel->base = base; |
| 703 | 737 | channel->offset = length; |
| 704 | 738 | channel->remaining = 0; |
| 705 | | m6844_finished(ch); |
| 739 | m6844_finished(&state->m6844_channel[ch]); |
| 706 | 740 | return; |
| 707 | 741 | } |
| 708 | 742 | |
| 709 | | if (SOUND_LOG && debuglog) |
| 710 | | fprintf(debuglog, "Sound channel %d play at %02X,%04X, length = %04X, volume = %02X/%02X\n", |
| 711 | | ch, sound_banks[ch], m6844_channel[ch].address, |
| 712 | | m6844_channel[ch].counter, sound_volume[ch * 2], sound_volume[ch * 2 + 1]); |
| 743 | if (SOUND_LOG && state->debuglog) |
| 744 | fprintf(state->debuglog, "Sound channel %d play at %02X,%04X, length = %04X, volume = %02X/%02X\n", |
| 745 | ch, state->sound_banks[ch], |
| 746 | state->m6844_channel[ch].address, state->m6844_channel[ch].counter, |
| 747 | state->sound_volume[ch * 2], state->sound_volume[ch * 2 + 1]); |
| 713 | 748 | |
| 714 | 749 | /* set the pointer and count */ |
| 715 | 750 | channel->base = base; |
| r11160 | r11161 | |
| 721 | 756 | } |
| 722 | 757 | |
| 723 | 758 | |
| 724 | | static void stop_cvsd(int ch) |
| 759 | static void stop_cvsd(device_t *device, int ch) |
| 725 | 760 | { |
| 761 | exidy440_audio_state *state = get_safe_token(device); |
| 726 | 762 | /* the DMA channel is marked inactive; that will kill the audio */ |
| 727 | | sound_channel[ch].remaining = 0; |
| 728 | | stream->update(); |
| 763 | state->sound_channel[ch].remaining = 0; |
| 764 | state->stream->update(); |
| 729 | 765 | |
| 730 | | if (SOUND_LOG && debuglog) |
| 731 | | fprintf(debuglog, "Channel %d stop\n", ch); |
| 766 | if (SOUND_LOG && state->debuglog) |
| 767 | fprintf(state->debuglog, "Channel %d stop\n", ch); |
| 732 | 768 | } |
| 733 | 769 | |
| 734 | 770 | |
| r11160 | r11161 | |
| 739 | 775 | * |
| 740 | 776 | *************************************/ |
| 741 | 777 | |
| 742 | | static void fir_filter(INT32 *input, INT16 *output, int count) |
| 778 | static void fir_filter(device_t *device, INT32 *input, INT16 *output, int count) |
| 743 | 779 | { |
| 744 | 780 | while (count--) |
| 745 | 781 | { |
| r11160 | r11161 | |
| 774 | 810 | * |
| 775 | 811 | *************************************/ |
| 776 | 812 | |
| 777 | | static void decode_and_filter_cvsd(UINT8 *input, int bytes, int maskbits, int frequency, INT16 *output) |
| 813 | static void decode_and_filter_cvsd(device_t *device, UINT8 *input, int bytes, int maskbits, int frequency, INT16 *output) |
| 778 | 814 | { |
| 779 | 815 | INT32 buffer[SAMPLE_BUFFER_LENGTH + FIR_HISTORY_LENGTH]; |
| 780 | 816 | int total_samples = bytes * 8; |
| r11160 | r11161 | |
| 873 | 909 | } |
| 874 | 910 | |
| 875 | 911 | /* all done with this chunk, run the filter on it */ |
| 876 | | fir_filter(&buffer[FIR_HISTORY_LENGTH], &output[chunk_start], chunk_bytes * 8); |
| 912 | fir_filter(device, &buffer[FIR_HISTORY_LENGTH], &output[chunk_start], chunk_bytes * 8); |
| 877 | 913 | |
| 878 | 914 | /* copy the last few input samples down to the start for a new history */ |
| 879 | 915 | memcpy(&buffer[0], &buffer[SAMPLE_BUFFER_LENGTH], FIR_HISTORY_LENGTH * sizeof(INT32)); |
| r11160 | r11161 | |
| 895 | 931 | } |
| 896 | 932 | |
| 897 | 933 | |
| 934 | static WRITE8_DEVICE_HANDLER( sound_banks_w ) |
| 935 | { |
| 936 | exidy440_audio_state *state = get_safe_token(device); |
| 937 | state->sound_banks[offset] = data; |
| 938 | } |
| 898 | 939 | |
| 940 | |
| 899 | 941 | /************************************* |
| 900 | 942 | * |
| 901 | 943 | * Memory handlers |
| r11160 | r11161 | |
| 904 | 946 | |
| 905 | 947 | static ADDRESS_MAP_START( exidy440_audio_map, AS_PROGRAM, 8 ) |
| 906 | 948 | AM_RANGE(0x0000, 0x7fff) AM_NOP |
| 907 | | AM_RANGE(0x8000, 0x801f) AM_MIRROR(0x03e0) AM_READWRITE(m6844_r, m6844_w) AM_BASE(&m6844_data) |
| 908 | | AM_RANGE(0x8400, 0x840f) AM_MIRROR(0x03f0) AM_RAM_WRITE(sound_volume_w) AM_BASE(&sound_volume) |
| 909 | | AM_RANGE(0x8800, 0x8800) AM_MIRROR(0x03ff) AM_READ(sound_command_r) AM_WRITENOP |
| 949 | AM_RANGE(0x8000, 0x801f) AM_MIRROR(0x03e0) AM_DEVREADWRITE("custom", m6844_r, m6844_w) |
| 950 | AM_RANGE(0x8400, 0x840f) AM_MIRROR(0x03f0) AM_DEVREADWRITE("custom", sound_volume_r, sound_volume_w) |
| 951 | AM_RANGE(0x8800, 0x8800) AM_MIRROR(0x03ff) AM_DEVREAD("custom", sound_command_r) AM_WRITENOP |
| 910 | 952 | AM_RANGE(0x8c00, 0x93ff) AM_NOP |
| 911 | | AM_RANGE(0x9400, 0x9403) AM_MIRROR(0x03fc) AM_READNOP AM_WRITEONLY AM_BASE(&sound_banks) |
| 912 | | AM_RANGE(0x9800, 0x9800) AM_MIRROR(0x03ff) AM_READNOP AM_WRITE(sound_interrupt_clear_w) |
| 953 | AM_RANGE(0x9400, 0x9403) AM_MIRROR(0x03fc) AM_READNOP AM_DEVWRITE("custom", sound_banks_w) |
| 954 | AM_RANGE(0x9800, 0x9800) AM_MIRROR(0x03ff) AM_READNOP AM_DEVWRITE("custom", sound_interrupt_clear_w) |
| 913 | 955 | AM_RANGE(0x9c00, 0x9fff) AM_NOP |
| 914 | 956 | AM_RANGE(0xa000, 0xbfff) AM_RAM |
| 915 | 957 | AM_RANGE(0xc000, 0xdfff) AM_NOP |
| r11160 | r11161 | |
| 928 | 970 | { |
| 929 | 971 | switch (state) |
| 930 | 972 | { |
| 973 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 974 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(exidy440_audio_state); break; |
| 975 | |
| 931 | 976 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 932 | 977 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(exidy440_sound); break; |
| 933 | 978 | case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME(exidy440_sound); break; |
| r11160 | r11161 | |
| 939 | 984 | } |
| 940 | 985 | |
| 941 | 986 | |
| 942 | | DECLARE_LEGACY_SOUND_DEVICE(EXIDY440, exidy440_sound); |
| 943 | 987 | DEFINE_LEGACY_SOUND_DEVICE(EXIDY440, exidy440_sound); |
| 944 | 988 | |
| 945 | 989 | |
src/mame/machine/kaneko16.c
| r11160 | r11161 | |
| 21 | 21 | |
| 22 | 22 | #define CALC3_VERBOSE_OUTPUT 0 |
| 23 | 23 | |
| 24 | | #define MCU_RESPONSE(d) memcpy(&kaneko16_mcu_ram[mcu_offset], d, sizeof(d)) |
| 24 | #define MCU_RESPONSE(d) memcpy(&state->m_mcu_ram[mcu_offset], d, sizeof(d)) |
| 25 | 25 | |
| 26 | | UINT16 *kaneko16_mcu_ram; |
| 27 | | |
| 28 | 26 | /*************************************************************************** |
| 29 | 27 | Gals Panic (set 2) |
| 30 | 28 | Gals Panic (set 3) |
| r11160 | r11161 | |
| 40 | 38 | static READ16_HANDLER(shogwarr_calc_r); |
| 41 | 39 | static WRITE16_HANDLER(shogwarr_calc_w); |
| 42 | 40 | |
| 43 | | static struct { |
| 44 | | UINT16 x1p, y1p, x1s, y1s; |
| 45 | | UINT16 x2p, y2p, x2s, y2s; |
| 46 | | |
| 47 | | INT16 x12, y12, x21, y21; |
| 48 | | |
| 49 | | UINT16 mult_a, mult_b; |
| 50 | | } hit; |
| 51 | | |
| 52 | 41 | READ16_HANDLER(galpanib_calc_r) /* Simulation of the CALC1 MCU */ |
| 53 | 42 | { |
| 43 | kaneko16_state *state = space->machine().driver_data<kaneko16_state>(); |
| 44 | calc1_hit_t &hit = state->m_hit; |
| 54 | 45 | UINT16 data = 0; |
| 55 | 46 | |
| 56 | 47 | switch (offset) |
| r11160 | r11161 | |
| 103 | 94 | |
| 104 | 95 | WRITE16_HANDLER(galpanib_calc_w) |
| 105 | 96 | { |
| 97 | kaneko16_state *state = space->machine().driver_data<kaneko16_state>(); |
| 98 | calc1_hit_t &hit = state->m_hit; |
| 99 | |
| 106 | 100 | switch (offset) |
| 107 | 101 | { |
| 108 | 102 | // p is position, s is size |
| r11160 | r11161 | |
| 124 | 118 | |
| 125 | 119 | WRITE16_HANDLER(bloodwar_calc_w) |
| 126 | 120 | { |
| 127 | | |
| 121 | kaneko16_state *state = space->machine().driver_data<kaneko16_state>(); |
| 122 | calc1_hit_t &hit = state->m_hit; |
| 128 | 123 | int isbrap = ( !strcmp(space->machine().system().name,"brapboysj") || !strcmp(space->machine().system().name,"brapboys")); |
| 129 | 124 | |
| 130 | 125 | /* our implementation is incomplete, b.rap boys requires some modifications */ |
| r11160 | r11161 | |
| 164 | 159 | result <----------> | <--------> | <----> |
| 165 | 160 | */ |
| 166 | 161 | |
| 167 | | static INT16 calc_compute_x(void) |
| 162 | static INT16 calc_compute_x(calc1_hit_t &hit) |
| 168 | 163 | { |
| 169 | 164 | INT16 x_coll; |
| 170 | 165 | |
| r11160 | r11161 | |
| 179 | 174 | return x_coll; |
| 180 | 175 | } |
| 181 | 176 | |
| 182 | | static INT16 calc_compute_y(void) |
| 177 | static INT16 calc_compute_y(calc1_hit_t &hit) |
| 183 | 178 | { |
| 184 | 179 | INT16 y_coll; |
| 185 | 180 | |
| r11160 | r11161 | |
| 196 | 191 | |
| 197 | 192 | READ16_HANDLER(bloodwar_calc_r) |
| 198 | 193 | { |
| 194 | kaneko16_state *state = space->machine().driver_data<kaneko16_state>(); |
| 195 | calc1_hit_t &hit = state->m_hit; |
| 199 | 196 | UINT16 data = 0; |
| 200 | 197 | INT16 x_coll, y_coll; |
| 201 | 198 | |
| r11160 | r11161 | |
| 207 | 204 | return shogwarr_calc_r(space,offset,mem_mask); |
| 208 | 205 | } |
| 209 | 206 | |
| 210 | | x_coll = calc_compute_x(); |
| 211 | | y_coll = calc_compute_y(); |
| 207 | x_coll = calc_compute_x(hit); |
| 208 | y_coll = calc_compute_y(hit); |
| 212 | 209 | |
| 213 | 210 | switch (offset) |
| 214 | 211 | { |
| r11160 | r11161 | |
| 269 | 266 | */ |
| 270 | 267 | |
| 271 | 268 | |
| 272 | | static struct { |
| 273 | | int x1p, y1p, z1p, x1s, y1s, z1s; |
| 274 | | int x2p, y2p, z2p, x2s, y2s, z2s; |
| 275 | | |
| 276 | | int x1po, y1po, z1po, x1so, y1so, z1so; |
| 277 | | int x2po, y2po, z2po, x2so, y2so, z2so; |
| 278 | | |
| 279 | | int x12, y12, z12, x21, y21, z21; |
| 280 | | |
| 281 | | int x_coll, y_coll, z_coll; |
| 282 | | |
| 283 | | int x1tox2, y1toy2, z1toz2; |
| 284 | | |
| 285 | | UINT16 mult_a, mult_b; |
| 286 | | |
| 287 | | UINT16 flags; |
| 288 | | UINT16 mode; |
| 289 | | |
| 290 | | } shogwarr_hit; |
| 291 | | |
| 292 | | |
| 293 | 269 | //calculate simple intersection of two segments |
| 294 | 270 | |
| 295 | 271 | static int shogwarr_calc_compute(int x1, int w1, int x2, int w2) |
| r11160 | r11161 | |
| 340 | 316 | //x1 is the left most coord, s1 = width |
| 341 | 317 | } |
| 342 | 318 | |
| 343 | | static void shogwarr_recalc_collisions(void) |
| 319 | static void shogwarr_recalc_collisions(calc3_hit_t &hit3) |
| 344 | 320 | { |
| 345 | 321 | //calculate positions and sizes |
| 346 | 322 | |
| 347 | | int mode=shogwarr_hit.mode; |
| 323 | int mode=hit3.mode; |
| 348 | 324 | |
| 349 | | shogwarr_hit.flags=0; |
| 325 | hit3.flags=0; |
| 350 | 326 | |
| 351 | | shogwarr_calc_org(mode&3, shogwarr_hit.x1po, shogwarr_hit.x1so, &shogwarr_hit.x1p, &shogwarr_hit.x1s); |
| 352 | | mode>>=2; |
| 353 | | shogwarr_calc_org(mode&3, shogwarr_hit.y1po, shogwarr_hit.y1so, &shogwarr_hit.y1p, &shogwarr_hit.y1s); |
| 354 | | mode>>=2; |
| 355 | | shogwarr_calc_org(mode&3, shogwarr_hit.z1po, shogwarr_hit.z1so, &shogwarr_hit.z1p, &shogwarr_hit.z1s); |
| 327 | shogwarr_calc_org((mode>>0)&3, hit3.x1po, hit3.x1so, &hit3.x1p, &hit3.x1s); |
| 328 | shogwarr_calc_org((mode>>2)&3, hit3.y1po, hit3.y1so, &hit3.y1p, &hit3.y1s); |
| 329 | shogwarr_calc_org((mode>>4)&3, hit3.z1po, hit3.z1so, &hit3.z1p, &hit3.z1s); |
| 356 | 330 | |
| 357 | | mode>>=4; |
| 331 | shogwarr_calc_org((mode>>8)&3, hit3.x2po, hit3.x2so, &hit3.x2p, &hit3.x2s); |
| 332 | shogwarr_calc_org((mode>>10)&3, hit3.y2po, hit3.y2so, &hit3.y2p, &hit3.y2s); |
| 333 | shogwarr_calc_org((mode>>12)&3, hit3.z2po, hit3.z2so, &hit3.z2p, &hit3.z2s); |
| 358 | 334 | |
| 359 | | shogwarr_calc_org(mode&3, shogwarr_hit.x2po, shogwarr_hit.x2so, &shogwarr_hit.x2p, &shogwarr_hit.x2s); |
| 360 | | mode>>=2; |
| 361 | | shogwarr_calc_org(mode&3, shogwarr_hit.y2po, shogwarr_hit.y2so, &shogwarr_hit.y2p, &shogwarr_hit.y2s); |
| 362 | | mode>>=2; |
| 363 | | shogwarr_calc_org(mode&3, shogwarr_hit.z2po, shogwarr_hit.z2so, &shogwarr_hit.z2p, &shogwarr_hit.z2s); |
| 364 | 335 | |
| 336 | hit3.x1tox2=abs(hit3.x2po-hit3.x1po); |
| 337 | hit3.y1toy2=abs(hit3.y2po-hit3.y1po); |
| 338 | hit3.z1toz2=abs(hit3.z2po-hit3.z1po); |
| 365 | 339 | |
| 366 | | shogwarr_hit.x1tox2=abs(shogwarr_hit.x2po-shogwarr_hit.x1po); |
| 367 | | shogwarr_hit.y1toy2=abs(shogwarr_hit.y2po-shogwarr_hit.y1po); |
| 368 | | shogwarr_hit.z1toz2=abs(shogwarr_hit.z2po-shogwarr_hit.z1po); |
| 369 | 340 | |
| 341 | hit3.x_coll = shogwarr_calc_compute(hit3.x1p, hit3.x1s, hit3.x2p, hit3.x2s); |
| 342 | hit3.y_coll = shogwarr_calc_compute(hit3.y1p, hit3.y1s, hit3.y2p, hit3.y2s); |
| 343 | hit3.z_coll = shogwarr_calc_compute(hit3.z1p, hit3.z1s, hit3.z2p, hit3.z2s); |
| 370 | 344 | |
| 371 | | shogwarr_hit.x_coll = shogwarr_calc_compute(shogwarr_hit.x1p, shogwarr_hit.x1s, shogwarr_hit.x2p, shogwarr_hit.x2s); |
| 372 | | shogwarr_hit.y_coll = shogwarr_calc_compute(shogwarr_hit.y1p, shogwarr_hit.y1s, shogwarr_hit.y2p, shogwarr_hit.y2s); |
| 373 | | shogwarr_hit.z_coll = shogwarr_calc_compute(shogwarr_hit.z1p, shogwarr_hit.z1s, shogwarr_hit.z2p, shogwarr_hit.z2s); |
| 374 | 345 | |
| 375 | | |
| 376 | 346 | // 4th nibble: Y Absolute Collision -> possible values = 9,8,4,3,2 |
| 377 | | if (shogwarr_hit.y1p > shogwarr_hit.y2p) shogwarr_hit.flags |= 0x2000; |
| 378 | | else if (shogwarr_hit.y1p == shogwarr_hit.y2p) shogwarr_hit.flags |= 0x4000; |
| 379 | | else if (shogwarr_hit.y1p < shogwarr_hit.y2p) shogwarr_hit.flags |= 0x8000; |
| 380 | | if (shogwarr_hit.y_coll<0) shogwarr_hit.flags |= 0x1000; |
| 347 | if (hit3.y1p > hit3.y2p) hit3.flags |= 0x2000; |
| 348 | else if (hit3.y1p == hit3.y2p) hit3.flags |= 0x4000; |
| 349 | else if (hit3.y1p < hit3.y2p) hit3.flags |= 0x8000; |
| 350 | if (hit3.y_coll<0) hit3.flags |= 0x1000; |
| 381 | 351 | |
| 382 | 352 | // 3rd nibble: X Absolute Collision -> possible values = 9,8,4,3,2 |
| 383 | | if (shogwarr_hit.x1p > shogwarr_hit.x2p) shogwarr_hit.flags |= 0x0200; |
| 384 | | else if (shogwarr_hit.x1p == shogwarr_hit.x2p) shogwarr_hit.flags |= 0x0400; |
| 385 | | else if (shogwarr_hit.x1p < shogwarr_hit.x2p) shogwarr_hit.flags |= 0x0800; |
| 386 | | if (shogwarr_hit.x_coll<0) shogwarr_hit.flags |= 0x0100; |
| 353 | if (hit3.x1p > hit3.x2p) hit3.flags |= 0x0200; |
| 354 | else if (hit3.x1p == hit3.x2p) hit3.flags |= 0x0400; |
| 355 | else if (hit3.x1p < hit3.x2p) hit3.flags |= 0x0800; |
| 356 | if (hit3.x_coll<0) hit3.flags |= 0x0100; |
| 387 | 357 | |
| 388 | 358 | // 2nd nibble: Z Absolute Collision -> possible values = 9,8,4,3,2 |
| 389 | | if (shogwarr_hit.z1p > shogwarr_hit.z2p) shogwarr_hit.flags |= 0x0020; |
| 390 | | else if (shogwarr_hit.z1p == shogwarr_hit.z2p) shogwarr_hit.flags |= 0x0040; |
| 391 | | else if (shogwarr_hit.z1p < shogwarr_hit.z2p) shogwarr_hit.flags |= 0x0080; |
| 392 | | if (shogwarr_hit.z_coll<0) shogwarr_hit.flags |= 0x0010; |
| 359 | if (hit3.z1p > hit3.z2p) hit3.flags |= 0x0020; |
| 360 | else if (hit3.z1p == hit3.z2p) hit3.flags |= 0x0040; |
| 361 | else if (hit3.z1p < hit3.z2p) hit3.flags |= 0x0080; |
| 362 | if (hit3.z_coll<0) hit3.flags |= 0x0010; |
| 393 | 363 | |
| 394 | 364 | // 1st nibble: XYZ Overlap Collision |
| 395 | | if ((shogwarr_hit.x_coll>=0)&&(shogwarr_hit.y_coll>=0)&&(shogwarr_hit.z_coll>=0)) shogwarr_hit.flags |= 0x0008; |
| 396 | | if ((shogwarr_hit.x_coll>=0)&&(shogwarr_hit.z_coll>=0)) shogwarr_hit.flags |= 0x0004; |
| 397 | | if ((shogwarr_hit.y_coll>=0)&&(shogwarr_hit.z_coll>=0)) shogwarr_hit.flags |= 0x0002; |
| 398 | | if ((shogwarr_hit.x_coll>=0)&&(shogwarr_hit.y_coll>=0)) shogwarr_hit.flags |= 0x0001; |
| 365 | if ((hit3.x_coll>=0)&&(hit3.y_coll>=0)&&(hit3.z_coll>=0)) hit3.flags |= 0x0008; |
| 366 | if ((hit3.x_coll>=0)&&(hit3.z_coll>=0)) hit3.flags |= 0x0004; |
| 367 | if ((hit3.y_coll>=0)&&(hit3.z_coll>=0)) hit3.flags |= 0x0002; |
| 368 | if ((hit3.x_coll>=0)&&(hit3.y_coll>=0)) hit3.flags |= 0x0001; |
| 399 | 369 | } |
| 400 | 370 | |
| 401 | 371 | |
| 402 | 372 | static WRITE16_HANDLER(shogwarr_calc_w) |
| 403 | 373 | { |
| 374 | kaneko16_state *state = space->machine().driver_data<kaneko16_state>(); |
| 375 | calc3_hit_t &hit3 = state->m_hit3; |
| 404 | 376 | int idx=offset*4; |
| 405 | 377 | switch (idx) |
| 406 | 378 | { |
| r11160 | r11161 | |
| 408 | 380 | case 0x00: |
| 409 | 381 | case 0x28: |
| 410 | 382 | |
| 411 | | shogwarr_hit.x1po = data; break; |
| 383 | hit3.x1po = data; break; |
| 412 | 384 | |
| 413 | 385 | case 0x04: |
| 414 | 386 | case 0x2c: |
| 415 | | shogwarr_hit.x1so = data; break; |
| 387 | hit3.x1so = data; break; |
| 416 | 388 | |
| 417 | 389 | case 0x08: |
| 418 | 390 | case 0x30: |
| 419 | | shogwarr_hit.y1po = data; break; |
| 391 | hit3.y1po = data; break; |
| 420 | 392 | |
| 421 | 393 | case 0x0c: |
| 422 | 394 | case 0x34: |
| 423 | | shogwarr_hit.y1so = data; break; |
| 395 | hit3.y1so = data; break; |
| 424 | 396 | |
| 425 | 397 | case 0x10: |
| 426 | 398 | case 0x58: |
| 427 | | shogwarr_hit.x2po = data; break; |
| 399 | hit3.x2po = data; break; |
| 428 | 400 | |
| 429 | 401 | case 0x14: |
| 430 | 402 | case 0x5c: |
| 431 | | shogwarr_hit.x2so = data; break; |
| 403 | hit3.x2so = data; break; |
| 432 | 404 | |
| 433 | 405 | case 0x18: |
| 434 | 406 | case 0x60: |
| 435 | | shogwarr_hit.y2po = data; break; |
| 407 | hit3.y2po = data; break; |
| 436 | 408 | |
| 437 | 409 | case 0x1c: |
| 438 | 410 | case 0x64: |
| 439 | | shogwarr_hit.y2so = data; break; |
| 411 | hit3.y2so = data; break; |
| 440 | 412 | |
| 441 | 413 | case 0x38: |
| 442 | 414 | case 0x50: |
| 443 | | shogwarr_hit.z1po = data; break; |
| 415 | hit3.z1po = data; break; |
| 444 | 416 | case 0x3c: |
| 445 | 417 | case 0x54: |
| 446 | | shogwarr_hit.z1so = data; break; |
| 418 | hit3.z1so = data; break; |
| 447 | 419 | |
| 448 | 420 | case 0x20: |
| 449 | 421 | case 0x68: |
| 450 | | shogwarr_hit.z2po = data; break; |
| 422 | hit3.z2po = data; break; |
| 451 | 423 | |
| 452 | 424 | case 0x24: |
| 453 | 425 | case 0x6c: |
| 454 | | shogwarr_hit.z2so = data; break; |
| 426 | hit3.z2so = data; break; |
| 455 | 427 | |
| 456 | 428 | case 0x70: |
| 457 | | shogwarr_hit.mode=data;break; |
| 429 | hit3.mode=data;break; |
| 458 | 430 | |
| 459 | 431 | default: |
| 460 | 432 | logerror("CPU #0 PC %06x: warning - write unmapped hit address %06x [ %06x] = %06x\n",cpu_get_pc(&space->device()),offset<<1, idx, data); |
| 461 | 433 | } |
| 462 | 434 | |
| 463 | | shogwarr_recalc_collisions(); |
| 435 | shogwarr_recalc_collisions(hit3); |
| 464 | 436 | } |
| 465 | 437 | |
| 466 | 438 | |
| 467 | 439 | static READ16_HANDLER(shogwarr_calc_r) |
| 468 | 440 | { |
| 469 | | |
| 441 | kaneko16_state *state = space->machine().driver_data<kaneko16_state>(); |
| 442 | calc3_hit_t &hit3 = state->m_hit3; |
| 470 | 443 | int idx=offset*4; |
| 471 | 444 | |
| 472 | 445 | switch (idx) |
| 473 | 446 | { |
| 474 | 447 | case 0x00: // X distance |
| 475 | 448 | case 0x10: |
| 476 | | return shogwarr_hit.x_coll; |
| 449 | return hit3.x_coll; |
| 477 | 450 | |
| 478 | 451 | case 0x04: // Y distance |
| 479 | 452 | case 0x14: |
| 480 | | return shogwarr_hit.y_coll; |
| 453 | return hit3.y_coll; |
| 481 | 454 | |
| 482 | 455 | case 0x18: // Z distance |
| 483 | | return shogwarr_hit.z_coll; |
| 456 | return hit3.z_coll; |
| 484 | 457 | |
| 485 | 458 | case 0x08: |
| 486 | 459 | case 0x1c: |
| 487 | 460 | |
| 488 | | return shogwarr_hit.flags; |
| 461 | return hit3.flags; |
| 489 | 462 | |
| 490 | 463 | case 0x28: |
| 491 | 464 | return (space->machine().rand() & 0xffff); |
| 492 | 465 | |
| 493 | | case 0x40: return shogwarr_hit.x1po; |
| 494 | | case 0x44: return shogwarr_hit.x1so; |
| 495 | | case 0x48: return shogwarr_hit.y1po; |
| 496 | | case 0x4c: return shogwarr_hit.y1so; |
| 497 | | case 0x50: return shogwarr_hit.z1po; |
| 498 | | case 0x54: return shogwarr_hit.z1so; |
| 466 | case 0x40: return hit3.x1po; |
| 467 | case 0x44: return hit3.x1so; |
| 468 | case 0x48: return hit3.y1po; |
| 469 | case 0x4c: return hit3.y1so; |
| 470 | case 0x50: return hit3.z1po; |
| 471 | case 0x54: return hit3.z1so; |
| 499 | 472 | |
| 500 | | case 0x58: return shogwarr_hit.x2po; |
| 501 | | case 0x5c: return shogwarr_hit.x2so; |
| 502 | | case 0x60: return shogwarr_hit.y2po; |
| 503 | | case 0x64: return shogwarr_hit.y2so; |
| 504 | | case 0x68: return shogwarr_hit.z2po; |
| 505 | | case 0x6c: return shogwarr_hit.z2so; |
| 473 | case 0x58: return hit3.x2po; |
| 474 | case 0x5c: return hit3.x2so; |
| 475 | case 0x60: return hit3.y2po; |
| 476 | case 0x64: return hit3.y2so; |
| 477 | case 0x68: return hit3.z2po; |
| 478 | case 0x6c: return hit3.z2so; |
| 506 | 479 | |
| 507 | | case 0x80: return shogwarr_hit.x1tox2; |
| 508 | | case 0x84: return shogwarr_hit.y1toy2; |
| 509 | | case 0x88: return shogwarr_hit.z1toz2; |
| 480 | case 0x80: return hit3.x1tox2; |
| 481 | case 0x84: return hit3.y1toy2; |
| 482 | case 0x88: return hit3.z1toz2; |
| 510 | 483 | |
| 511 | 484 | default: |
| 512 | 485 | logerror("CPU #0 PC %06x: warning - read unmapped calc address %06x [ %06x]\n",cpu_get_pc(&space->device()),offset<<1, idx); |
| r11160 | r11161 | |
| 549 | 522 | */ |
| 550 | 523 | |
| 551 | 524 | |
| 552 | | static int calc3_mcu_status, calc3_mcu_command_offset; |
| 553 | | |
| 554 | | |
| 555 | | void calc3_mcu_init(void) |
| 525 | void calc3_mcu_init(running_machine &machine) |
| 556 | 526 | { |
| 557 | | calc3_mcu_status = 0; |
| 558 | | calc3_mcu_command_offset = 0; |
| 527 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 528 | calc3_t &calc3 = state->m_calc3; |
| 529 | calc3.mcu_status = 0; |
| 530 | calc3.mcu_command_offset = 0; |
| 559 | 531 | } |
| 560 | 532 | |
| 561 | 533 | WRITE16_HANDLER( calc3_mcu_ram_w ) |
| 562 | 534 | { |
| 563 | | COMBINE_DATA(&kaneko16_mcu_ram[offset]); |
| 564 | | //calc3_mcu_run(space->machine()); |
| 535 | kaneko16_state *state = space->machine().driver_data<kaneko16_state>(); |
| 536 | COMBINE_DATA(&state->m_mcu_ram[offset]); |
| 537 | //calc3_mcu_run(space->machine); |
| 565 | 538 | } |
| 566 | 539 | |
| 567 | | #define CALC3_MCU_COM_W(_n_) \ |
| 568 | | WRITE16_HANDLER( calc3_mcu_com##_n_##_w ) \ |
| 569 | | { \ |
| 570 | | logerror("calc3w %d %04x %04x\n",_n_, data,mem_mask); \ |
| 571 | | calc3_mcu_status |= (1 << _n_); \ |
| 540 | INLINE void calc3_mcu_com_w(address_space *space, offs_t offset, UINT16 data, UINT16 mem_mask, int _n_) |
| 541 | { |
| 542 | kaneko16_state *state = space->machine().driver_data<kaneko16_state>(); |
| 543 | calc3_t &calc3 = state->m_calc3; |
| 544 | logerror("calc3w %d %04x %04x\n", _n_, data, mem_mask); |
| 545 | calc3.mcu_status |= (1 << _n_); |
| 572 | 546 | } |
| 573 | 547 | |
| 574 | | CALC3_MCU_COM_W(0) |
| 575 | | CALC3_MCU_COM_W(1) |
| 576 | | CALC3_MCU_COM_W(2) |
| 577 | | CALC3_MCU_COM_W(3) |
| 548 | WRITE16_HANDLER( calc3_mcu_com0_w) { calc3_mcu_com_w(space, offset, data, mem_mask, 0); } |
| 549 | WRITE16_HANDLER( calc3_mcu_com1_w) { calc3_mcu_com_w(space, offset, data, mem_mask, 1); } |
| 550 | WRITE16_HANDLER( calc3_mcu_com2_w) { calc3_mcu_com_w(space, offset, data, mem_mask, 2); } |
| 551 | WRITE16_HANDLER( calc3_mcu_com3_w) { calc3_mcu_com_w(space, offset, data, mem_mask, 3); } |
| 578 | 552 | |
| 579 | 553 | |
| 580 | 554 | /*************************************************************************** |
| r11160 | r11161 | |
| 632 | 606 | */ |
| 633 | 607 | |
| 634 | 608 | |
| 635 | | static UINT16 calc3_mcu_crc; |
| 636 | 609 | |
| 637 | 610 | /* decryption tables */ |
| 638 | 611 | |
| r11160 | r11161 | |
| 1672 | 1645 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 1673 | 1646 | }; |
| 1674 | 1647 | |
| 1675 | | // global so we can use them in the filename when we save out the data (debug..) |
| 1676 | | static UINT8 calc3_decryption_key_byte; |
| 1677 | | static UINT8 calc3_alternateswaps; |
| 1678 | | static UINT8 calc3_shift; |
| 1679 | | static UINT8 calc3_subtracttype; |
| 1680 | | static UINT8 calc3_mode; |
| 1681 | | static UINT8 calc3_blocksize_offset; |
| 1682 | | static UINT16 calc3_dataend; |
| 1683 | | static UINT16 calc3_database; |
| 1684 | | |
| 1685 | | static int data_header[2]; |
| 1686 | | |
| 1687 | | static UINT32 calc3_writeaddress; |
| 1688 | | static UINT32 calc3_writeaddress_current; |
| 1689 | | static UINT16 calc3_dsw_addr = 0x00; |
| 1690 | | static UINT16 calc3_eeprom_addr; |
| 1691 | | static UINT16 calc3_poll_addr; |
| 1692 | | static UINT16 cakc3_checkumaddress; |
| 1693 | | |
| 1694 | 1648 | static UINT8 shift_bits(UINT8 dat, int bits) |
| 1695 | 1649 | { |
| 1696 | 1650 | bits &=0x7; |
| r11160 | r11161 | |
| 1710 | 1664 | // endian safe? you're having a laugh |
| 1711 | 1665 | static int calc3_decompress_table(running_machine& machine, int tabnum, UINT8* dstram, int dstoffset) |
| 1712 | 1666 | { |
| 1713 | | |
| 1714 | | |
| 1715 | | |
| 1716 | | |
| 1667 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 1668 | calc3_t &calc3 = state->m_calc3; |
| 1717 | 1669 | address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM); |
| 1718 | 1670 | UINT8* rom = machine.region("cpu1")->base(); |
| 1719 | 1671 | UINT8 numregions; |
| r11160 | r11161 | |
| 1745 | 1697 | { |
| 1746 | 1698 | UINT16 inline_table_base = 0; |
| 1747 | 1699 | UINT16 inline_table_size = 0; |
| 1748 | | calc3_database = offset; |
| 1749 | | calc3_blocksize_offset = rom[offset+0]; // location of the 'block length' |
| 1750 | | calc3_mode = rom[offset+1]; |
| 1751 | | calc3_alternateswaps = rom[offset+2]; |
| 1752 | | calc3_shift = (calc3_alternateswaps &0xf0)>>4; |
| 1753 | | calc3_subtracttype = (calc3_alternateswaps &0x03); |
| 1754 | | calc3_alternateswaps &= 0x0c; |
| 1755 | | calc3_alternateswaps >>=2; |
| 1700 | calc3.database = offset; |
| 1701 | calc3.blocksize_offset = rom[offset+0]; // location of the 'block length' |
| 1702 | calc3.mode = rom[offset+1]; |
| 1703 | calc3.alternateswaps = rom[offset+2]; |
| 1704 | calc3.shift = (calc3.alternateswaps &0xf0)>>4; |
| 1705 | calc3.subtracttype = (calc3.alternateswaps &0x03); |
| 1706 | calc3.alternateswaps &= 0x0c; |
| 1707 | calc3.alternateswaps >>=2; |
| 1756 | 1708 | |
| 1757 | | calc3_decryption_key_byte = rom[offset+3]; |
| 1709 | calc3.decryption_key_byte = rom[offset+3]; |
| 1758 | 1710 | |
| 1759 | 1711 | |
| 1760 | 1712 | // if blocksize_offset > 3, it appears to specify the encryption table as 'inline' which can be of any size (odd or even) and loops over the bytes to decrypt |
| 1761 | 1713 | // the decryption key specified seems to be ignored? |
| 1762 | | if (calc3_blocksize_offset>3) |
| 1714 | if (calc3.blocksize_offset>3) |
| 1763 | 1715 | { |
| 1764 | 1716 | inline_table_base = offset+4; |
| 1765 | | inline_table_size = calc3_blocksize_offset-3; |
| 1717 | inline_table_size = calc3.blocksize_offset-3; |
| 1766 | 1718 | } |
| 1767 | 1719 | |
| 1768 | | offset+= calc3_blocksize_offset+1; |
| 1720 | offset+= calc3.blocksize_offset+1; |
| 1769 | 1721 | length = rom[offset+0] | (rom[offset+1]<<8); |
| 1770 | 1722 | offset+=2; |
| 1771 | 1723 | |
| 1772 | 1724 | #if CALC3_VERBOSE_OUTPUT |
| 1773 | 1725 | if (inline_table_size) |
| 1774 | 1726 | { |
| 1775 | | printf("Block %02x Found Base %04x - Inline Encryption (size %02x) - Mode? %02x Shift %01x Subtract Type %01x AltSwaps %01x Key (unused?) %02x Length %04x\n", tabnum, calc3_database, inline_table_size, calc3_shift, calc3_mode, calc3_subtracttype, calc3_alternateswaps, calc3_decryption_key_byte, length); |
| 1727 | printf("Block %02x Found Base %04x - Inline Encryption (size %02x) - Mode? %02x Shift %01x Subtract Type %01x AltSwaps %01x Key (unused?) %02x Length %04x\n", tabnum, calc3.database, inline_table_size, calc3.shift, calc3.mode, calc3.subtracttype, calc3.alternateswaps, calc3.decryption_key_byte, length); |
| 1776 | 1728 | } |
| 1777 | 1729 | else |
| 1778 | 1730 | { |
| 1779 | | printf("Block %02x Found Base %04x - Mode? %02x Shift %01x Subtract Type %01x AltSwaps %01x Key %02x Length %04x\n", tabnum, calc3_database, calc3_mode, calc3_shift, calc3_subtracttype, calc3_alternateswaps, calc3_decryption_key_byte, length); |
| 1731 | printf("Block %02x Found Base %04x - Mode? %02x Shift %01x Subtract Type %01x AltSwaps %01x Key %02x Length %04x\n", tabnum, calc3.database, calc3.mode, calc3.shift, calc3.subtracttype, calc3.alternateswaps, calc3.decryption_key_byte, length); |
| 1780 | 1732 | } |
| 1781 | 1733 | #endif |
| 1782 | 1734 | // copy + decrypt the table to the specified memory area |
| r11160 | r11161 | |
| 1799 | 1751 | |
| 1800 | 1752 | // !dstram is used because we don't want to process these during our initial table scan, only when the game asks! |
| 1801 | 1753 | |
| 1802 | | if (calc3_mode==0x06) |
| 1754 | if (calc3.mode==0x06) |
| 1803 | 1755 | { |
| 1804 | | calc3_writeaddress_current = 0x202000; // this is reasoanble for brapboys, not sure about shogun, needs emulating properly! |
| 1805 | | //calc3_writeaddress_current = 0x20c000; |
| 1756 | calc3.writeaddress_current = 0x202000; // this is reasoanble for brapboys, not sure about shogun, needs emulating properly! |
| 1757 | //calc3.writeaddress_current = 0x20c000; |
| 1806 | 1758 | } |
| 1807 | | else if (calc3_mode==0x07) |
| 1759 | else if (calc3.mode==0x07) |
| 1808 | 1760 | { |
| 1809 | 1761 | // also calls empty table with Mode? 07 |
| 1810 | 1762 | // maybe they reset to different points? |
| 1811 | 1763 | } |
| 1812 | | else if (calc3_mode==0x08 && !dstram) |
| 1764 | else if (calc3.mode==0x08 && !dstram) |
| 1813 | 1765 | { |
| 1814 | 1766 | //printf("save to eeprom\n"); |
| 1815 | 1767 | |
| r11160 | r11161 | |
| 1818 | 1770 | |
| 1819 | 1771 | for (i=0;i<0x80;i++) |
| 1820 | 1772 | { |
| 1821 | | eeprom_space->write_byte(i, space->read_byte(calc3_eeprom_addr+0x200000+i)); |
| 1773 | eeprom_space->write_byte(i, space->read_byte(calc3.eeprom_addr+0x200000+i)); |
| 1822 | 1774 | } |
| 1823 | 1775 | |
| 1824 | 1776 | } |
| r11160 | r11161 | |
| 1845 | 1797 | |
| 1846 | 1798 | |
| 1847 | 1799 | /* special case for Shogun Warriors table 0x40 */ |
| 1848 | | if (calc3_subtracttype==3 && calc3_alternateswaps ==0) |
| 1800 | if (calc3.subtracttype==3 && calc3.alternateswaps ==0) |
| 1849 | 1801 | { |
| 1850 | 1802 | UINT8 inlinet = rom[inline_table_base + (i%inline_table_size)]; |
| 1851 | 1803 | dat = rom[offset+i]; |
| r11160 | r11161 | |
| 1866 | 1818 | UINT8 inlinet = rom[inline_table_base + (i%inline_table_size)]; |
| 1867 | 1819 | dat = rom[offset+i]; |
| 1868 | 1820 | dat -= inlinet; |
| 1869 | | dat = shift_bits(dat, calc3_shift); |
| 1821 | dat = shift_bits(dat, calc3.shift); |
| 1870 | 1822 | } |
| 1871 | 1823 | else |
| 1872 | 1824 | { |
| r11160 | r11161 | |
| 1874 | 1826 | UINT8 inlinet = rom[inline_table_base + (i%inline_table_size)]; |
| 1875 | 1827 | dat = rom[offset+i]; |
| 1876 | 1828 | |
| 1877 | | if (calc3_subtracttype!=0x02) |
| 1829 | if (calc3.subtracttype!=0x02) |
| 1878 | 1830 | { |
| 1879 | 1831 | dat -= inlinet; |
| 1880 | 1832 | dat -= extra[(i%inline_table_size)>>1]; |
| r11160 | r11161 | |
| 1885 | 1837 | dat += extra[(i%inline_table_size)>>1]; |
| 1886 | 1838 | } |
| 1887 | 1839 | |
| 1888 | | dat = shift_bits(dat, 8-calc3_shift); |
| 1840 | dat = shift_bits(dat, 8-calc3.shift); |
| 1889 | 1841 | } |
| 1890 | 1842 | } |
| 1891 | 1843 | else |
| r11160 | r11161 | |
| 1895 | 1847 | UINT8 inlinet = rom[inline_table_base + (i%inline_table_size)]; |
| 1896 | 1848 | dat = rom[offset+i]; |
| 1897 | 1849 | dat -= inlinet; |
| 1898 | | dat = shift_bits(dat, calc3_shift); |
| 1850 | dat = shift_bits(dat, calc3.shift); |
| 1899 | 1851 | } |
| 1900 | 1852 | else |
| 1901 | 1853 | { |
| 1902 | 1854 | dat = rom[offset+i]; |
| 1903 | 1855 | |
| 1904 | | if (calc3_subtracttype!=0x02) |
| 1856 | if (calc3.subtracttype!=0x02) |
| 1905 | 1857 | { |
| 1906 | 1858 | dat -= extra2[(i%inline_table_size)>>1]; |
| 1907 | 1859 | } |
| r11160 | r11161 | |
| 1909 | 1861 | { |
| 1910 | 1862 | dat += extra2[(i%inline_table_size)>>1]; |
| 1911 | 1863 | } |
| 1912 | | dat = shift_bits(dat, 8-calc3_shift); |
| 1864 | dat = shift_bits(dat, 8-calc3.shift); |
| 1913 | 1865 | } |
| 1914 | 1866 | } |
| 1915 | 1867 | } |
| r11160 | r11161 | |
| 1928 | 1880 | } |
| 1929 | 1881 | } |
| 1930 | 1882 | else |
| 1931 | | data_header[local_counter]=dat; |
| 1883 | calc3.data_header[local_counter]=dat; |
| 1932 | 1884 | |
| 1933 | 1885 | ++local_counter; |
| 1934 | 1886 | } |
| 1935 | 1887 | } |
| 1936 | 1888 | else |
| 1937 | 1889 | { |
| 1938 | | const INT16* key = calc3_keydata+(calc3_decryption_key_byte*0x40); |
| 1890 | const INT16* key = calc3_keydata+(calc3.decryption_key_byte*0x40); |
| 1939 | 1891 | |
| 1940 | 1892 | if (key[0] == -1) |
| 1941 | 1893 | { |
| r11160 | r11161 | |
| 1948 | 1900 | UINT8 keydat = (UINT8)key[i&0x3f]; |
| 1949 | 1901 | |
| 1950 | 1902 | { |
| 1951 | | if (calc3_subtracttype==0) |
| 1903 | if (calc3.subtracttype==0) |
| 1952 | 1904 | { |
| 1953 | 1905 | //dat = dat; |
| 1954 | 1906 | } |
| 1955 | | else if (calc3_subtracttype==1) |
| 1907 | else if (calc3.subtracttype==1) |
| 1956 | 1908 | { |
| 1957 | 1909 | if ((i&1)==1) dat += keydat; |
| 1958 | 1910 | else dat -= keydat; |
| 1959 | 1911 | } |
| 1960 | | else if (calc3_subtracttype==2) |
| 1912 | else if (calc3.subtracttype==2) |
| 1961 | 1913 | { |
| 1962 | 1914 | if ((i&1)==0) dat += keydat; |
| 1963 | 1915 | else dat -= keydat; |
| 1964 | 1916 | } |
| 1965 | | else if (calc3_subtracttype==3) |
| 1917 | else if (calc3.subtracttype==3) |
| 1966 | 1918 | { |
| 1967 | 1919 | dat -= keydat; |
| 1968 | 1920 | } |
| 1969 | 1921 | |
| 1970 | | if (calc3_alternateswaps == 0) |
| 1922 | if (calc3.alternateswaps == 0) |
| 1971 | 1923 | { |
| 1972 | | if ((i&1)==0) dat = shift_bits(dat, 8-calc3_shift); |
| 1973 | | else dat = shift_bits(dat, calc3_shift); |
| 1924 | if ((i&1)==0) dat = shift_bits(dat, 8-calc3.shift); |
| 1925 | else dat = shift_bits(dat, calc3.shift); |
| 1974 | 1926 | } |
| 1975 | | else if (calc3_alternateswaps==1) |
| 1927 | else if (calc3.alternateswaps==1) |
| 1976 | 1928 | { |
| 1977 | | dat = shift_bits(dat, 8-calc3_shift); |
| 1929 | dat = shift_bits(dat, 8-calc3.shift); |
| 1978 | 1930 | } |
| 1979 | | else if (calc3_alternateswaps==2) |
| 1931 | else if (calc3.alternateswaps==2) |
| 1980 | 1932 | { |
| 1981 | | dat = shift_bits(dat, calc3_shift); |
| 1933 | dat = shift_bits(dat, calc3.shift); |
| 1982 | 1934 | } |
| 1983 | | else if (calc3_alternateswaps==3) |
| 1935 | else if (calc3.alternateswaps==3) |
| 1984 | 1936 | { |
| 1985 | 1937 | // same as 0 |
| 1986 | | if ((i&1)==0) dat = shift_bits(dat, 8-calc3_shift); |
| 1987 | | else dat = shift_bits(dat, calc3_shift); |
| 1938 | if ((i&1)==0) dat = shift_bits(dat, 8-calc3.shift); |
| 1939 | else dat = shift_bits(dat, calc3.shift); |
| 1988 | 1940 | } |
| 1989 | 1941 | } |
| 1990 | 1942 | |
| r11160 | r11161 | |
| 2002 | 1954 | } |
| 2003 | 1955 | } |
| 2004 | 1956 | else |
| 2005 | | data_header[local_counter]=dat; |
| 1957 | calc3.data_header[local_counter]=dat; |
| 2006 | 1958 | |
| 2007 | 1959 | ++local_counter; |
| 2008 | 1960 | |
| r11160 | r11161 | |
| 2011 | 1963 | } |
| 2012 | 1964 | } |
| 2013 | 1965 | |
| 2014 | | calc3_dataend = offset+length+1; |
| 1966 | calc3.dataend = offset+length+1; |
| 2015 | 1967 | } |
| 2016 | 1968 | |
| 2017 | | //printf("data base %04x data end %04x\n", calc3_database, calc3_dataend); |
| 1969 | //printf("data base %04x data end %04x\n", calc3.database, calc3.dataend); |
| 2018 | 1970 | |
| 2019 | 1971 | return length; |
| 2020 | 1972 | |
| r11160 | r11161 | |
| 2024 | 1976 | |
| 2025 | 1977 | DRIVER_INIT(calc3_scantables) |
| 2026 | 1978 | { |
| 1979 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 1980 | calc3_t &calc3 = state->m_calc3; |
| 2027 | 1981 | UINT8* rom = machine.region("cpu1")->base(); |
| 2028 | 1982 | UINT8 numregions; |
| 2029 | 1983 | |
| 2030 | 1984 | int x; |
| 2031 | 1985 | |
| 2032 | | calc3_mcu_crc = 0; |
| 1986 | calc3.mcu_crc = 0; |
| 2033 | 1987 | for (x=0;x<0x20000;x++) |
| 2034 | 1988 | { |
| 2035 | | calc3_mcu_crc+=rom[x]; |
| 1989 | calc3.mcu_crc+=rom[x]; |
| 2036 | 1990 | } |
| 2037 | | //printf("crc %04x\n",calc3_mcu_crc); |
| 1991 | //printf("crc %04x\n",calc3.mcu_crc); |
| 2038 | 1992 | numregions = rom[0]; |
| 2039 | 1993 | |
| 2040 | 1994 | for (x=0;x<numregions;x++) |
| r11160 | r11161 | |
| 2054 | 2008 | FILE *fp; |
| 2055 | 2009 | char filename[256]; |
| 2056 | 2010 | |
| 2057 | | if (calc3_blocksize_offset==3) |
| 2011 | if (calc3.blocksize_offset==3) |
| 2058 | 2012 | { |
| 2059 | 2013 | sprintf(filename,"data_%s_table_%04x k%02x m%02x u%02x length %04x", |
| 2060 | | machine.system().name, |
| 2061 | | x, calc3_decryption_key_byte, calc3_mode, calc3_alternateswaps, length); |
| 2014 | machine().system().name, |
| 2015 | x, calc3.decryption_key_byte, calc3.mode, calc3.alternateswaps, length); |
| 2062 | 2016 | } |
| 2063 | 2017 | else |
| 2064 | 2018 | { |
| 2065 | 2019 | sprintf(filename,"data_%s_table_%04x k%02x (use indirect size %02x) m%02x u%02x length %04x", |
| 2066 | | machine.system().name, |
| 2067 | | x, calc3_decryption_key_byte, calc3_blocksize_offset-3, calc3_mode, calc3_alternateswaps, length); |
| 2020 | machine().system().name, |
| 2021 | x, calc3.decryption_key_byte, calc3.blocksize_offset-3, calc3.mode, calc3.alternateswaps, length); |
| 2068 | 2022 | } |
| 2069 | 2023 | |
| 2070 | 2024 | fp=fopen(filename, "w+b"); |
| r11160 | r11161 | |
| 2094 | 2048 | fp=fopen(filename, "w+b"); |
| 2095 | 2049 | if (fp) |
| 2096 | 2050 | { |
| 2097 | | fwrite(&rom[calc3_dataend], 0x1000, 1, fp); |
| 2051 | fwrite(&rom[calc3.dataend], 0x1000, 1, fp); |
| 2098 | 2052 | fclose(fp); |
| 2099 | 2053 | } |
| 2100 | 2054 | } |
| r11160 | r11161 | |
| 2105 | 2059 | |
| 2106 | 2060 | void calc3_mcu_run(running_machine &machine) |
| 2107 | 2061 | { |
| 2062 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 2063 | calc3_t &calc3 = state->m_calc3; |
| 2108 | 2064 | UINT16 mcu_command; |
| 2109 | 2065 | int i; |
| 2110 | 2066 | address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM); |
| 2111 | 2067 | |
| 2112 | | if ( calc3_mcu_status != (1|2|4|8) ) return; |
| 2068 | if ( calc3.mcu_status != (1|2|4|8) ) return; |
| 2113 | 2069 | |
| 2114 | | if (calc3_dsw_addr) space->write_byte(calc3_dsw_addr+0x200000, ( ~input_port_read(machine, "DSW1"))&0xff); // // DSW // dsw actually updates in realtime - mcu reads+writes it every frame |
| 2070 | if (calc3.dsw_addr) space->write_byte(calc3.dsw_addr+0x200000, ( ~input_port_read(machine, "DSW1"))&0xff); // // DSW // dsw actually updates in realtime - mcu reads+writes it every frame |
| 2115 | 2071 | |
| 2116 | 2072 | |
| 2117 | | //calc3_mcu_status = 0; |
| 2073 | //calc3.mcu_status = 0; |
| 2118 | 2074 | |
| 2119 | | mcu_command = kaneko16_mcu_ram[calc3_mcu_command_offset/2 + 0]; |
| 2075 | mcu_command = state->m_mcu_ram[calc3.mcu_command_offset/2 + 0]; |
| 2120 | 2076 | |
| 2121 | 2077 | if (mcu_command == 0) return; |
| 2122 | 2078 | |
| 2123 | 2079 | logerror("%s : MCU executed command at %04X: %04X\n", |
| 2124 | | machine.describe_context(),calc3_mcu_command_offset,mcu_command); |
| 2080 | machine.describe_context(),calc3.mcu_command_offset,mcu_command); |
| 2125 | 2081 | |
| 2126 | 2082 | |
| 2127 | 2083 | if (mcu_command>0) |
| r11160 | r11161 | |
| 2131 | 2087 | { |
| 2132 | 2088 | |
| 2133 | 2089 | // clear old command (handshake to main cpu) |
| 2134 | | kaneko16_mcu_ram[(calc3_mcu_command_offset>>1)+0] = 0x0000; |
| 2090 | state->m_mcu_ram[(calc3.mcu_command_offset>>1)+0] = 0x0000; |
| 2135 | 2091 | |
| 2136 | 2092 | |
| 2137 | | calc3_dsw_addr = kaneko16_mcu_ram[(0>>1) + 1]; |
| 2138 | | calc3_eeprom_addr = kaneko16_mcu_ram[(0>>1) + 2]; |
| 2139 | | calc3_mcu_command_offset = kaneko16_mcu_ram[(0>>1) + 3]; |
| 2140 | | calc3_poll_addr = kaneko16_mcu_ram[(0>>1) + 4]; |
| 2141 | | cakc3_checkumaddress = kaneko16_mcu_ram[(0>>1) + 5]; |
| 2142 | | calc3_writeaddress = (kaneko16_mcu_ram[(0>>1) + 6] << 16) | |
| 2143 | | (kaneko16_mcu_ram[(0>>1) + 7]); |
| 2093 | calc3.dsw_addr = state->m_mcu_ram[(0>>1) + 1]; |
| 2094 | calc3.eeprom_addr = state->m_mcu_ram[(0>>1) + 2]; |
| 2095 | calc3.mcu_command_offset = state->m_mcu_ram[(0>>1) + 3]; |
| 2096 | calc3.poll_addr = state->m_mcu_ram[(0>>1) + 4]; |
| 2097 | calc3.checksumaddress = state->m_mcu_ram[(0>>1) + 5]; |
| 2098 | calc3.writeaddress = (state->m_mcu_ram[(0>>1) + 6] << 16) | |
| 2099 | (state->m_mcu_ram[(0>>1) + 7]); |
| 2144 | 2100 | |
| 2145 | 2101 | // set our current write / stack pointer to the address specified |
| 2146 | | calc3_writeaddress_current = calc3_writeaddress; |
| 2102 | calc3.writeaddress_current = calc3.writeaddress; |
| 2147 | 2103 | #if CALC3_VERBOSE_OUTPUT |
| 2148 | | printf("Calc 3 Init Command - %04x DSW addr\n", calc3_dsw_addr); |
| 2149 | | printf("Calc 3 Init Command - %04x Eeprom Address\n", calc3_eeprom_addr); |
| 2150 | | printf("Calc 3 Init Command - %04x Future Commands Base\n", calc3_mcu_command_offset); |
| 2151 | | printf("Calc 3 Init Command - %04x Poll / Busy Address\n", calc3_poll_addr); |
| 2152 | | printf("Calc 3 Init Command - %04x ROM Checksum Address\n", cakc3_checkumaddress); |
| 2153 | | printf("Calc 3 Init Command - %08x Data Write Address\n", calc3_writeaddress); |
| 2104 | printf("Calc 3 Init Command - %04x DSW addr\n", calc3.dsw_addr); |
| 2105 | printf("Calc 3 Init Command - %04x Eeprom Address\n", calc3.eeprom_addr); |
| 2106 | printf("Calc 3 Init Command - %04x Future Commands Base\n", calc3.mcu_command_offset); |
| 2107 | printf("Calc 3 Init Command - %04x Poll / Busy Address\n", calc3.poll_addr); |
| 2108 | printf("Calc 3 Init Command - %04x ROM Checksum Address\n", calc3.checksumaddress); |
| 2109 | printf("Calc 3 Init Command - %08x Data Write Address\n", calc3.writeaddress); |
| 2154 | 2110 | #endif |
| 2155 | | // space->write_byte(calc3_dsw_addr+0x200000, ( ~input_port_read(machine, "DSW1"))&0xff); // // DSW // dsw actually updates in realtime - mcu reads+writes it every frame |
| 2111 | // space->write_byte(calc3.dsw_addr+0x200000, ( ~input_port_read(machine, "DSW1"))&0xff); // // DSW // dsw actually updates in realtime - mcu reads+writes it every frame |
| 2156 | 2112 | |
| 2157 | | kaneko16_mcu_ram[cakc3_checkumaddress / 2] = calc3_mcu_crc; // MCU Rom Checksum! |
| 2113 | state->m_mcu_ram[calc3.checksumaddress / 2] = calc3.mcu_crc; // MCU Rom Checksum! |
| 2158 | 2114 | |
| 2159 | | /* |
| 2160 | | for (i=0;i<0x40;i++) |
| 2161 | | { |
| 2162 | | kaneko16_mcu_ram[(calc3_eeprom_addr / 2)+i] = kaneko16_eeprom_data[i];//((eepromData[i]&0xff00)>>8) | ((eepromData[i]&0x00ff)<<8); |
| 2163 | | } |
| 2164 | | */ |
| 2165 | | |
| 2115 | #if 0 |
| 2116 | for (i=0;i<0x40;i++) |
| 2166 | 2117 | { |
| 2118 | state->m_mcu_ram[(calc3.eeprom_addr / 2)+i] = kaneko16_eeprom_data[i];//((eepromData[i]&0xff00)>>8) | ((eepromData[i]&0x00ff)<<8); |
| 2119 | } |
| 2120 | #endif |
| 2121 | { |
| 2167 | 2122 | address_space *eeprom_space = space->machine().device<eeprom_device>("eeprom")->space(); |
| 2168 | 2123 | |
| 2169 | 2124 | for (i=0;i<0x80;i++) |
| 2170 | 2125 | { |
| 2171 | | space->write_byte(calc3_eeprom_addr+0x200000+i, eeprom_space->read_byte(i)); |
| 2126 | space->write_byte(calc3.eeprom_addr+0x200000+i, eeprom_space->read_byte(i)); |
| 2172 | 2127 | } |
| 2173 | 2128 | |
| 2174 | 2129 | } |
| r11160 | r11161 | |
| 2181 | 2136 | int i; |
| 2182 | 2137 | |
| 2183 | 2138 | // clear old command (handshake to main cpu) |
| 2184 | | kaneko16_mcu_ram[calc3_mcu_command_offset>>1] = 0x0000;; |
| 2139 | state->m_mcu_ram[calc3.mcu_command_offset>>1] = 0x0000;; |
| 2185 | 2140 | |
| 2186 | 2141 | logerror("Calc3 transfer request, %d transfers\n", num_transfers); |
| 2187 | 2142 | |
| 2188 | 2143 | for (i=0;i<num_transfers;i++) |
| 2189 | 2144 | { |
| 2190 | | int param1 = kaneko16_mcu_ram[(calc3_mcu_command_offset>>1) + 1 + (2*i)]; |
| 2191 | | int param2 = kaneko16_mcu_ram[(calc3_mcu_command_offset>>1) + 2 + (2*i)]; |
| 2145 | int param1 = state->m_mcu_ram[(calc3.mcu_command_offset>>1) + 1 + (2*i)]; |
| 2146 | int param2 = state->m_mcu_ram[(calc3.mcu_command_offset>>1) + 2 + (2*i)]; |
| 2192 | 2147 | UINT8 commandtabl = (param1&0xff00) >> 8; |
| 2193 | 2148 | UINT16 commandaddr =param2;// (param1&0x00ff) | (param2&0xff00); |
| 2194 | 2149 | UINT8 commandunk = (param1&0x00ff); // brap boys sets.. seems to cause further writebasck address displacement?? (when tested on hw it looked like a simple +, but that doesn't work for brapboys...) |
| r11160 | r11161 | |
| 2198 | 2153 | { |
| 2199 | 2154 | int length; |
| 2200 | 2155 | |
| 2201 | | length = calc3_decompress_table(machine, commandtabl, 0, calc3_writeaddress_current-2); |
| 2156 | length = calc3_decompress_table(machine, commandtabl, 0, calc3.writeaddress_current-2); |
| 2202 | 2157 | |
| 2203 | 2158 | if (length) |
| 2204 | 2159 | { |
| 2205 | 2160 | int write=commandaddr; |
| 2206 | 2161 | #if CALC3_VERBOSE_OUTPUT |
| 2207 | | printf("writing back address %08x to %08x %08x\n", calc3_writeaddress_current, commandaddr,write); |
| 2162 | printf("writing back address %08x to %08x %08x\n", calc3.writeaddress_current, commandaddr,write); |
| 2208 | 2163 | #endif |
| 2209 | 2164 | |
| 2210 | | space->write_byte(write+0x200000, data_header[0]); |
| 2211 | | space->write_byte(write+0x200001, data_header[1]); |
| 2165 | space->write_byte(write+0x200000, calc3.data_header[0]); |
| 2166 | space->write_byte(write+0x200001, calc3.data_header[1]); |
| 2212 | 2167 | |
| 2213 | 2168 | write=commandaddr+(char)commandunk; |
| 2214 | | space->write_word(write+0x200000, (calc3_writeaddress_current>>16)&0xffff); |
| 2215 | | space->write_word(write+0x200002, (calc3_writeaddress_current&0xffff)); |
| 2169 | space->write_word(write+0x200000, (calc3.writeaddress_current>>16)&0xffff); |
| 2170 | space->write_word(write+0x200002, (calc3.writeaddress_current&0xffff)); |
| 2216 | 2171 | |
| 2217 | | calc3_writeaddress_current += ((length+3)&(~1)); |
| 2172 | calc3.writeaddress_current += ((length+3)&(~1)); |
| 2218 | 2173 | } |
| 2219 | 2174 | |
| 2220 | 2175 | } |
| r11160 | r11161 | |
| 2396 | 2351 | } |
| 2397 | 2352 | |
| 2398 | 2353 | |
| 2399 | | void (*toybox_mcu_run)(running_machine &machine); |
| 2400 | | |
| 2401 | | static UINT16 toybox_mcu_com[4]; |
| 2402 | | |
| 2403 | | void toybox_mcu_init(void) |
| 2354 | void toybox_mcu_init(running_machine &machine) |
| 2404 | 2355 | { |
| 2405 | | memset(toybox_mcu_com, 0, 4 * sizeof( UINT16) ); |
| 2356 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 2357 | memset(state->m_toybox_mcu_com, 0, 4 * sizeof( UINT16) ); |
| 2406 | 2358 | } |
| 2407 | 2359 | |
| 2408 | | #define TOYBOX_MCU_COM_W(_n_) \ |
| 2409 | | WRITE16_HANDLER( toybox_mcu_com##_n_##_w ) \ |
| 2410 | | { \ |
| 2411 | | COMBINE_DATA(&toybox_mcu_com[_n_]); \ |
| 2412 | | if (toybox_mcu_com[0] != 0xFFFF) return; \ |
| 2413 | | if (toybox_mcu_com[1] != 0xFFFF) return; \ |
| 2414 | | if (toybox_mcu_com[2] != 0xFFFF) return; \ |
| 2415 | | if (toybox_mcu_com[3] != 0xFFFF) return; \ |
| 2416 | | \ |
| 2417 | | memset(toybox_mcu_com, 0, 4 * sizeof( UINT16 ) ); \ |
| 2418 | | toybox_mcu_run(space->machine()); \ |
| 2360 | INLINE void toybox_mcu_com_w(address_space *space, offs_t offset, UINT16 data, UINT16 mem_mask, int _n_) |
| 2361 | { |
| 2362 | kaneko16_state *state = space->machine().driver_data<kaneko16_state>(); |
| 2363 | COMBINE_DATA(&state->m_toybox_mcu_com[_n_]); |
| 2364 | if (state->m_toybox_mcu_com[0] != 0xFFFF) return; |
| 2365 | if (state->m_toybox_mcu_com[1] != 0xFFFF) return; |
| 2366 | if (state->m_toybox_mcu_com[2] != 0xFFFF) return; |
| 2367 | if (state->m_toybox_mcu_com[3] != 0xFFFF) return; |
| 2368 | |
| 2369 | memset(state->m_toybox_mcu_com, 0, 4 * sizeof( UINT16 ) ); |
| 2370 | (*state->m_toybox_mcu_run)(space->machine()); |
| 2419 | 2371 | } |
| 2420 | 2372 | |
| 2421 | | TOYBOX_MCU_COM_W(0) |
| 2422 | | TOYBOX_MCU_COM_W(1) |
| 2423 | | TOYBOX_MCU_COM_W(2) |
| 2424 | | TOYBOX_MCU_COM_W(3) |
| 2373 | WRITE16_HANDLER( toybox_mcu_com0_w ) { toybox_mcu_com_w(space, offset, data, mem_mask, 0); } |
| 2374 | WRITE16_HANDLER( toybox_mcu_com1_w ) { toybox_mcu_com_w(space, offset, data, mem_mask, 1); } |
| 2375 | WRITE16_HANDLER( toybox_mcu_com2_w ) { toybox_mcu_com_w(space, offset, data, mem_mask, 2); } |
| 2376 | WRITE16_HANDLER( toybox_mcu_com3_w ) { toybox_mcu_com_w(space, offset, data, mem_mask, 3); } |
| 2425 | 2377 | |
| 2426 | 2378 | /* |
| 2427 | 2379 | bonkadv and bloodwar test bit 0 |
| r11160 | r11161 | |
| 2439 | 2391 | |
| 2440 | 2392 | void bloodwar_mcu_run(running_machine &machine) |
| 2441 | 2393 | { |
| 2394 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 2395 | UINT16 *kaneko16_mcu_ram = state->m_mcu_ram; |
| 2442 | 2396 | UINT16 mcu_command = kaneko16_mcu_ram[0x0010/2]; |
| 2443 | 2397 | UINT16 mcu_offset = kaneko16_mcu_ram[0x0012/2] / 2; |
| 2444 | 2398 | UINT16 mcu_data = kaneko16_mcu_ram[0x0014/2]; |
| r11160 | r11161 | |
| 2447 | 2401 | { |
| 2448 | 2402 | case 0x02: // Read from NVRAM |
| 2449 | 2403 | { |
| 2450 | | memcpy(&kaneko16_mcu_ram[mcu_offset], kaneko16_nvram_save, sizeof(kaneko16_nvram_save)); |
| 2404 | memcpy(&kaneko16_mcu_ram[mcu_offset], state->m_nvram_save, sizeof(state->m_nvram_save)); |
| 2451 | 2405 | logerror("%s : MCU executed command: %04X %04X (load NVRAM settings)\n", machine.describe_context(), mcu_command, mcu_offset*2); |
| 2452 | 2406 | } |
| 2453 | 2407 | break; |
| 2454 | 2408 | |
| 2455 | 2409 | case 0x42: // Write to NVRAM |
| 2456 | 2410 | { |
| 2457 | | memcpy(kaneko16_nvram_save, &kaneko16_mcu_ram[mcu_offset], sizeof(kaneko16_nvram_save)); |
| 2411 | memcpy(state->m_nvram_save, &kaneko16_mcu_ram[mcu_offset], sizeof(state->m_nvram_save)); |
| 2458 | 2412 | logerror("%s : MCU executed command: %04X %04X (save NVRAM settings)\n", machine.describe_context(), mcu_command, mcu_offset*2); |
| 2459 | 2413 | } |
| 2460 | 2414 | break; |
| r11160 | r11161 | |
| 2487 | 2441 | |
| 2488 | 2442 | void bonkadv_mcu_run(running_machine &machine) |
| 2489 | 2443 | { |
| 2444 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 2445 | UINT16 *kaneko16_mcu_ram = state->m_mcu_ram; |
| 2490 | 2446 | UINT16 mcu_command = kaneko16_mcu_ram[0x0010/2]; |
| 2491 | 2447 | UINT16 mcu_offset = kaneko16_mcu_ram[0x0012/2] / 2; |
| 2492 | 2448 | UINT16 mcu_data = kaneko16_mcu_ram[0x0014/2]; |
| r11160 | r11161 | |
| 2496 | 2452 | |
| 2497 | 2453 | case 0x02: // Read from NVRAM |
| 2498 | 2454 | { |
| 2499 | | memcpy(&kaneko16_mcu_ram[mcu_offset], kaneko16_nvram_save, sizeof(kaneko16_nvram_save)); |
| 2455 | memcpy(&kaneko16_mcu_ram[mcu_offset], state->m_nvram_save, sizeof(state->m_nvram_save)); |
| 2500 | 2456 | logerror("%s : MCU executed command: %04X %04X (load NVRAM settings)\n", machine.describe_context(), mcu_command, mcu_offset*2); |
| 2501 | 2457 | } |
| 2502 | 2458 | break; |
| 2503 | 2459 | |
| 2504 | 2460 | case 0x42: // Write to NVRAM |
| 2505 | 2461 | { |
| 2506 | | memcpy(kaneko16_nvram_save, &kaneko16_mcu_ram[mcu_offset], sizeof(kaneko16_nvram_save)); |
| 2462 | memcpy(state->m_nvram_save, &kaneko16_mcu_ram[mcu_offset], sizeof(state->m_nvram_save)); |
| 2507 | 2463 | logerror("%s : MCU executed command: %04X %04X (save NVRAM settings)\n", machine.describe_context(), mcu_command, mcu_offset*2); |
| 2508 | 2464 | } |
| 2509 | 2465 | break; |
| 2510 | 2466 | |
| 2511 | 2467 | case 0x43: // Initialize NVRAM - MCU writes Default Data Set directly to NVRAM |
| 2512 | 2468 | { |
| 2513 | | memcpy(kaneko16_nvram_save, bonkadv_mcu_43, sizeof(bonkadv_mcu_43)); |
| 2469 | memcpy(state->m_nvram_save, bonkadv_mcu_43, sizeof(bonkadv_mcu_43)); |
| 2514 | 2470 | logerror("%s : MCU executed command: %04X %04X (restore default NVRAM settings)\n", machine.describe_context(), mcu_command, mcu_offset*2); |
| 2515 | 2471 | } |
| 2516 | 2472 | break; |
| r11160 | r11161 | |
| 2565 | 2521 | |
| 2566 | 2522 | void gtmr_mcu_run(running_machine &machine) |
| 2567 | 2523 | { |
| 2524 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 2525 | UINT16 *kaneko16_mcu_ram = state->m_mcu_ram; |
| 2568 | 2526 | UINT16 mcu_command = kaneko16_mcu_ram[0x0010/2]; |
| 2569 | 2527 | UINT16 mcu_offset = kaneko16_mcu_ram[0x0012/2] / 2; |
| 2570 | 2528 | UINT16 mcu_data = kaneko16_mcu_ram[0x0014/2]; |
| r11160 | r11161 | |
| 2576 | 2534 | |
| 2577 | 2535 | case 0x02: // Read from NVRAM |
| 2578 | 2536 | { |
| 2579 | | memcpy(&kaneko16_mcu_ram[mcu_offset], kaneko16_nvram_save, sizeof(kaneko16_nvram_save)); |
| 2537 | memcpy(&kaneko16_mcu_ram[mcu_offset], state->m_nvram_save, sizeof(state->m_nvram_save)); |
| 2580 | 2538 | } |
| 2581 | 2539 | break; |
| 2582 | 2540 | |
| 2583 | 2541 | case 0x42: // Write to NVRAM |
| 2584 | 2542 | { |
| 2585 | | memcpy(kaneko16_nvram_save, &kaneko16_mcu_ram[mcu_offset], sizeof(kaneko16_nvram_save)); |
| 2543 | memcpy(state->m_nvram_save, &kaneko16_mcu_ram[mcu_offset], sizeof(state->m_nvram_save)); |
| 2586 | 2544 | } |
| 2587 | 2545 | break; |
| 2588 | 2546 | |
src/mame/video/suprnova.c
| r11160 | r11161 | |
| 4 | 4 | #include "video/sknsspr.h" |
| 5 | 5 | #include "includes/suprnova.h" |
| 6 | 6 | |
| 7 | | static bitmap_t *sprite_bitmap; |
| 8 | 7 | |
| 9 | | static bitmap_t *tilemap_bitmap_lower; |
| 10 | | static bitmap_t *tilemap_bitmapflags_lower; |
| 11 | | |
| 12 | | static bitmap_t *tilemap_bitmap_higher; |
| 13 | | static bitmap_t *tilemap_bitmapflags_higher; |
| 14 | | |
| 15 | | |
| 16 | 8 | /* draws ROZ with linescroll OR columnscroll to 16-bit indexed bitmap */ |
| 17 | 9 | static void suprnova_draw_roz(bitmap_t* bitmap, bitmap_t* bitmapflags, const rectangle *cliprect, tilemap_t *tmap, UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, int wraparound, int columnscroll, UINT32* scrollram) |
| 18 | 10 | { |
| r11160 | r11161 | |
| 96 | 88 | } |
| 97 | 89 | |
| 98 | 90 | |
| 99 | | static int depthA=0; |
| 100 | | static int depthB=0; |
| 101 | | |
| 102 | | |
| 103 | | static int use_spc_bright, use_v3_bright; // makes sarukani rather dark, but should be default.. |
| 104 | | static UINT8 bright_spc_b=0x00, bright_spc_g=0x00, bright_spc_r=0x00; |
| 105 | | |
| 106 | | static UINT8 bright_spc_b_trans=0x00, bright_spc_g_trans=0x00, bright_spc_r_trans=0x00; |
| 107 | | |
| 108 | | |
| 109 | | static UINT8 bright_v3_b=0x00, bright_v3_g=0x00, bright_v3_r=0x00; |
| 110 | | static UINT8 bright_v3_b_trans = 0x00, bright_v3_g_trans = 0x00, bright_v3_r_trans = 0x00; |
| 111 | | |
| 112 | | // This ignores the alpha values atm. |
| 113 | | static int spc_changed=0, v3_changed=0, palette_updated=0; |
| 114 | | static int suprnova_alt_enable_background; |
| 115 | | int suprnova_alt_enable_sprites; |
| 116 | | |
| 117 | 91 | WRITE32_HANDLER ( skns_pal_regs_w ) |
| 118 | 92 | { |
| 119 | | COMBINE_DATA(&skns_pal_regs[offset]); |
| 120 | | palette_updated =1; |
| 93 | skns_state *state = space->machine().driver_data<skns_state>(); |
| 94 | COMBINE_DATA(&state->m_pal_regs[offset]); |
| 95 | state->m_palette_updated =1; |
| 121 | 96 | |
| 122 | 97 | switch ( offset ) |
| 123 | 98 | { |
| 124 | 99 | /* RWRA regs are for SPRITES */ |
| 125 | 100 | |
| 126 | 101 | case (0x00/4): // RWRA0 |
| 127 | | if( use_spc_bright != (data&1) ) { |
| 128 | | use_spc_bright = data&1; |
| 129 | | spc_changed = 1; |
| 102 | if( state->m_use_spc_bright != (data&1) ) { |
| 103 | state->m_use_spc_bright = data&1; |
| 104 | state->m_spc_changed = 1; |
| 130 | 105 | } |
| 131 | | suprnova_alt_enable_sprites = (data>>8)&1; |
| 106 | state->m_alt_enable_sprites = (data>>8)&1; |
| 132 | 107 | |
| 133 | 108 | |
| 134 | 109 | break; |
| 135 | 110 | case (0x04/4): // RWRA1 |
| 136 | | if( bright_spc_g != (data&0xff) ) { |
| 137 | | bright_spc_g = data&0xff; |
| 138 | | spc_changed = 1; |
| 111 | if( state->m_bright_spc_g != (data&0xff) ) { |
| 112 | state->m_bright_spc_g = data&0xff; |
| 113 | state->m_spc_changed = 1; |
| 139 | 114 | } |
| 140 | | bright_spc_g_trans = (data>>8) &0xff; |
| 115 | state->m_bright_spc_g_trans = (data>>8) &0xff; |
| 141 | 116 | |
| 142 | 117 | |
| 143 | 118 | break; |
| 144 | 119 | case (0x08/4): // RWRA2 |
| 145 | | if( bright_spc_r != (data&0xff) ) { |
| 146 | | bright_spc_r = data&0xff; |
| 147 | | spc_changed = 1; |
| 120 | if( state->m_bright_spc_r != (data&0xff) ) { |
| 121 | state->m_bright_spc_r = data&0xff; |
| 122 | state->m_spc_changed = 1; |
| 148 | 123 | } |
| 149 | | bright_spc_r_trans = (data>>8) &0xff; |
| 124 | state->m_bright_spc_r_trans = (data>>8) &0xff; |
| 150 | 125 | |
| 151 | 126 | break; |
| 152 | 127 | case (0x0C/4): // RWRA3 |
| 153 | | if( bright_spc_b != (data&0xff) ) { |
| 154 | | bright_spc_b = data&0xff; |
| 155 | | spc_changed = 1; |
| 128 | if( state->m_bright_spc_b != (data&0xff) ) { |
| 129 | state->m_bright_spc_b = data&0xff; |
| 130 | state->m_spc_changed = 1; |
| 156 | 131 | } |
| 157 | | bright_spc_b_trans = (data>>8)&0xff; |
| 132 | state->m_bright_spc_b_trans = (data>>8)&0xff; |
| 158 | 133 | |
| 159 | 134 | |
| 160 | 135 | break; |
| r11160 | r11161 | |
| 162 | 137 | /* RWRB regs are for BACKGROUND */ |
| 163 | 138 | |
| 164 | 139 | case (0x10/4): // RWRB0 |
| 165 | | if( use_v3_bright != (data&1) ) { |
| 166 | | use_v3_bright = data&1; |
| 167 | | v3_changed = 1; |
| 140 | if( state->m_use_v3_bright != (data&1) ) { |
| 141 | state->m_use_v3_bright = data&1; |
| 142 | state->m_v3_changed = 1; |
| 168 | 143 | } |
| 169 | 144 | |
| 170 | | suprnova_alt_enable_background = (data>>8)&1; |
| 145 | state->m_alt_enable_background = (data>>8)&1; |
| 171 | 146 | |
| 172 | 147 | break; |
| 173 | 148 | case (0x14/4): // RWRB1 |
| 174 | | if( bright_v3_g != (data&0xff) ) { |
| 175 | | bright_v3_g = data&0xff; |
| 176 | | v3_changed = 1; |
| 149 | if( state->m_bright_v3_g != (data&0xff) ) { |
| 150 | state->m_bright_v3_g = data&0xff; |
| 151 | state->m_v3_changed = 1; |
| 177 | 152 | } |
| 178 | 153 | |
| 179 | | bright_v3_g_trans = (data>>8)&0xff; |
| 154 | state->m_bright_v3_g_trans = (data>>8)&0xff; |
| 180 | 155 | |
| 181 | 156 | break; |
| 182 | 157 | case (0x18/4): // RWRB2 |
| 183 | | if( bright_v3_r != (data&0xff) ) { |
| 184 | | bright_v3_r = data&0xff; |
| 185 | | v3_changed = 1; |
| 158 | if( state->m_bright_v3_r != (data&0xff) ) { |
| 159 | state->m_bright_v3_r = data&0xff; |
| 160 | state->m_v3_changed = 1; |
| 186 | 161 | } |
| 187 | 162 | |
| 188 | | bright_v3_r_trans = (data>>8)&0xff; |
| 163 | state->m_bright_v3_r_trans = (data>>8)&0xff; |
| 189 | 164 | |
| 190 | 165 | break; |
| 191 | 166 | case (0x1C/4): // RWRB3 |
| 192 | | if( bright_v3_b != (data&0xff) ) { |
| 193 | | bright_v3_b = data&0xff; |
| 194 | | v3_changed = 1; |
| 167 | if( state->m_bright_v3_b != (data&0xff) ) { |
| 168 | state->m_bright_v3_b = data&0xff; |
| 169 | state->m_v3_changed = 1; |
| 195 | 170 | } |
| 196 | 171 | |
| 197 | | bright_v3_b_trans = (data>>8)&0xff; |
| 172 | state->m_bright_v3_b_trans = (data>>8)&0xff; |
| 198 | 173 | |
| 199 | 174 | break; |
| 200 | 175 | } |
| r11160 | r11161 | |
| 203 | 178 | |
| 204 | 179 | WRITE32_HANDLER ( skns_palette_ram_w ) |
| 205 | 180 | { |
| 181 | skns_state *state = space->machine().driver_data<skns_state>(); |
| 206 | 182 | int r,g,b; |
| 207 | 183 | int brightness_r, brightness_g, brightness_b/*, alpha*/; |
| 208 | 184 | int use_bright; |
| 209 | 185 | |
| 210 | | COMBINE_DATA(&skns_palette_ram[offset]); |
| 186 | COMBINE_DATA(&state->m_palette_ram[offset]); |
| 211 | 187 | |
| 212 | | b = ((skns_palette_ram[offset] >> 0 ) & 0x1f); |
| 213 | | g = ((skns_palette_ram[offset] >> 5 ) & 0x1f); |
| 214 | | r = ((skns_palette_ram[offset] >> 10 ) & 0x1f); |
| 188 | b = ((state->m_palette_ram[offset] >> 0 ) & 0x1f); |
| 189 | g = ((state->m_palette_ram[offset] >> 5 ) & 0x1f); |
| 190 | r = ((state->m_palette_ram[offset] >> 10 ) & 0x1f); |
| 215 | 191 | |
| 216 | | //alpha = ((skns_palette_ram[offset] >> 15 ) & 0x1); |
| 192 | //alpha = ((state->m_palette_ram[offset] >> 15 ) & 0x1); |
| 217 | 193 | |
| 218 | 194 | if(offset<(0x40*256)) { // 1st half is for Sprites |
| 219 | | use_bright = use_spc_bright; |
| 220 | | brightness_b = bright_spc_b; |
| 221 | | brightness_g = bright_spc_g; |
| 222 | | brightness_r = bright_spc_r; |
| 195 | use_bright = state->m_use_spc_bright; |
| 196 | brightness_b = state->m_bright_spc_b; |
| 197 | brightness_g = state->m_bright_spc_g; |
| 198 | brightness_r = state->m_bright_spc_r; |
| 223 | 199 | } else { // V3 bg's |
| 224 | | use_bright = use_v3_bright; |
| 225 | | brightness_b = bright_v3_b; |
| 226 | | brightness_g = bright_v3_g; |
| 227 | | brightness_r = bright_v3_r; |
| 200 | use_bright = state->m_use_v3_bright; |
| 201 | brightness_b = state->m_bright_v3_b; |
| 202 | brightness_g = state->m_bright_v3_g; |
| 203 | brightness_r = state->m_bright_v3_r; |
| 228 | 204 | } |
| 229 | 205 | |
| 230 | 206 | if(use_bright) { |
| r11160 | r11161 | |
| 246 | 222 | |
| 247 | 223 | static void palette_set_rgb_brightness (running_machine &machine, int offset, UINT8 brightness_r, UINT8 brightness_g, UINT8 brightness_b) |
| 248 | 224 | { |
| 225 | skns_state *state = machine.driver_data<skns_state>(); |
| 249 | 226 | int use_bright, r, g, b/*, alpha*/; |
| 250 | 227 | |
| 251 | | b = ((skns_palette_ram[offset] >> 0 ) & 0x1f); |
| 252 | | g = ((skns_palette_ram[offset] >> 5 ) & 0x1f); |
| 253 | | r = ((skns_palette_ram[offset] >> 10 ) & 0x1f); |
| 228 | b = ((state->m_palette_ram[offset] >> 0 ) & 0x1f); |
| 229 | g = ((state->m_palette_ram[offset] >> 5 ) & 0x1f); |
| 230 | r = ((state->m_palette_ram[offset] >> 10 ) & 0x1f); |
| 254 | 231 | |
| 255 | | //alpha = ((skns_palette_ram[offset] >> 15 ) & 0x1); |
| 232 | //alpha = ((state->m_palette_ram[offset] >> 15 ) & 0x1); |
| 256 | 233 | |
| 257 | 234 | if(offset<(0x40*256)) { // 1st half is for Sprites |
| 258 | | use_bright = use_spc_bright; |
| 235 | use_bright = state->m_use_spc_bright; |
| 259 | 236 | } else { // V3 bg's |
| 260 | | use_bright = use_v3_bright; |
| 237 | use_bright = state->m_use_v3_bright; |
| 261 | 238 | } |
| 262 | 239 | |
| 263 | 240 | if(use_bright) { |
| r11160 | r11161 | |
| 279 | 256 | |
| 280 | 257 | static void palette_update(running_machine &machine) |
| 281 | 258 | { |
| 259 | skns_state *state = machine.driver_data<skns_state>(); |
| 282 | 260 | int i; |
| 283 | 261 | |
| 284 | | if (palette_updated) |
| 262 | if (state->m_palette_updated) |
| 285 | 263 | { |
| 286 | | if(spc_changed) |
| 264 | if(state->m_spc_changed) |
| 287 | 265 | for(i=0; i<=((0x40*256)-1); i++) |
| 288 | | palette_set_rgb_brightness (machine, i, bright_spc_r, bright_spc_g, bright_spc_b); |
| 266 | palette_set_rgb_brightness (machine, i, state->m_bright_spc_r, state->m_bright_spc_g, state->m_bright_spc_b); |
| 289 | 267 | |
| 290 | | if(v3_changed) |
| 268 | if(state->m_v3_changed) |
| 291 | 269 | for(i=(0x40*256); i<=((0x80*256)-1); i++) |
| 292 | | palette_set_rgb_brightness (machine, i, bright_v3_r, bright_v3_g, bright_v3_b); |
| 293 | | palette_updated =0; |
| 270 | palette_set_rgb_brightness (machine, i, state->m_bright_v3_r, state->m_bright_v3_g, state->m_bright_v3_b); |
| 271 | state->m_palette_updated =0; |
| 294 | 272 | } |
| 295 | 273 | } |
| 296 | 274 | |
| 297 | 275 | |
| 298 | | static tilemap_t *skns_tilemap_A; |
| 299 | | static tilemap_t *skns_tilemap_B; |
| 300 | 276 | |
| 301 | 277 | static TILE_GET_INFO( get_tilemap_A_tile_info ) |
| 302 | 278 | { |
| 303 | | int code = ((skns_tilemapA_ram[tile_index] & 0x001fffff) >> 0 ); |
| 304 | | int colr = ((skns_tilemapA_ram[tile_index] & 0x3f000000) >> 24 ); |
| 305 | | int pri = ((skns_tilemapA_ram[tile_index] & 0x00e00000) >> 21 ); |
| 306 | | int depth = (skns_v3_regs[0x0c/4] & 0x0001) << 1; |
| 279 | skns_state *state = machine.driver_data<skns_state>(); |
| 280 | int code = ((state->m_tilemapA_ram[tile_index] & 0x001fffff) >> 0 ); |
| 281 | int colr = ((state->m_tilemapA_ram[tile_index] & 0x3f000000) >> 24 ); |
| 282 | int pri = ((state->m_tilemapA_ram[tile_index] & 0x00e00000) >> 21 ); |
| 283 | int depth = (state->m_v3_regs[0x0c/4] & 0x0001) << 1; |
| 307 | 284 | int flags = 0; |
| 308 | 285 | |
| 309 | | if(skns_tilemapA_ram[tile_index] & 0x80000000) flags |= TILE_FLIPX; |
| 310 | | if(skns_tilemapA_ram[tile_index] & 0x40000000) flags |= TILE_FLIPY; |
| 286 | if(state->m_tilemapA_ram[tile_index] & 0x80000000) flags |= TILE_FLIPX; |
| 287 | if(state->m_tilemapA_ram[tile_index] & 0x40000000) flags |= TILE_FLIPY; |
| 311 | 288 | |
| 312 | 289 | SET_TILE_INFO( |
| 313 | 290 | 0+depth, |
| r11160 | r11161 | |
| 321 | 298 | |
| 322 | 299 | WRITE32_HANDLER ( skns_tilemapA_w ) |
| 323 | 300 | { |
| 324 | | COMBINE_DATA(&skns_tilemapA_ram[offset]); |
| 325 | | tilemap_mark_tile_dirty(skns_tilemap_A,offset); |
| 301 | skns_state *state = space->machine().driver_data<skns_state>(); |
| 302 | COMBINE_DATA(&state->m_tilemapA_ram[offset]); |
| 303 | tilemap_mark_tile_dirty(state->m_tilemap_A,offset); |
| 326 | 304 | } |
| 327 | 305 | |
| 328 | 306 | static TILE_GET_INFO( get_tilemap_B_tile_info ) |
| 329 | 307 | { |
| 330 | | int code = ((skns_tilemapB_ram[tile_index] & 0x001fffff) >> 0 ); |
| 331 | | int colr = ((skns_tilemapB_ram[tile_index] & 0x3f000000) >> 24 ); |
| 332 | | int pri = ((skns_tilemapB_ram[tile_index] & 0x00e00000) >> 21 ); |
| 333 | | int depth = (skns_v3_regs[0x0c/4] & 0x0100) >> 7; |
| 308 | skns_state *state = machine.driver_data<skns_state>(); |
| 309 | int code = ((state->m_tilemapB_ram[tile_index] & 0x001fffff) >> 0 ); |
| 310 | int colr = ((state->m_tilemapB_ram[tile_index] & 0x3f000000) >> 24 ); |
| 311 | int pri = ((state->m_tilemapB_ram[tile_index] & 0x00e00000) >> 21 ); |
| 312 | int depth = (state->m_v3_regs[0x0c/4] & 0x0100) >> 7; |
| 334 | 313 | int flags = 0; |
| 335 | 314 | |
| 336 | | if(skns_tilemapB_ram[tile_index] & 0x80000000) flags |= TILE_FLIPX; |
| 337 | | if(skns_tilemapB_ram[tile_index] & 0x40000000) flags |= TILE_FLIPY; |
| 315 | if(state->m_tilemapB_ram[tile_index] & 0x80000000) flags |= TILE_FLIPX; |
| 316 | if(state->m_tilemapB_ram[tile_index] & 0x40000000) flags |= TILE_FLIPY; |
| 338 | 317 | |
| 339 | 318 | SET_TILE_INFO( |
| 340 | 319 | 1+depth, |
| r11160 | r11161 | |
| 348 | 327 | |
| 349 | 328 | WRITE32_HANDLER ( skns_tilemapB_w ) |
| 350 | 329 | { |
| 351 | | COMBINE_DATA(&skns_tilemapB_ram[offset]); |
| 352 | | tilemap_mark_tile_dirty(skns_tilemap_B,offset); |
| 330 | skns_state *state = space->machine().driver_data<skns_state>(); |
| 331 | COMBINE_DATA(&state->m_tilemapB_ram[offset]); |
| 332 | tilemap_mark_tile_dirty(state->m_tilemap_B,offset); |
| 353 | 333 | } |
| 354 | 334 | |
| 355 | 335 | WRITE32_HANDLER ( skns_v3_regs_w ) |
| 356 | 336 | { |
| 357 | | COMBINE_DATA(&skns_v3_regs[offset]); |
| 337 | skns_state *state = space->machine().driver_data<skns_state>(); |
| 338 | COMBINE_DATA(&state->m_v3_regs[offset]); |
| 358 | 339 | |
| 359 | 340 | /* if the depth changes we need to dirty the tilemap */ |
| 360 | 341 | if (offset == 0x0c/4) |
| 361 | 342 | { |
| 362 | | int old_depthA = depthA; |
| 363 | | int old_depthB = depthB; |
| 343 | int old_depthA = state->m_depthA; |
| 344 | int old_depthB = state->m_depthB; |
| 364 | 345 | |
| 365 | | depthA = (skns_v3_regs[0x0c/4] & 0x0001) << 1; |
| 366 | | depthB = (skns_v3_regs[0x0c/4] & 0x0100) >> 7; |
| 346 | state->m_depthA = (state->m_v3_regs[0x0c/4] & 0x0001) << 1; |
| 347 | state->m_depthB = (state->m_v3_regs[0x0c/4] & 0x0100) >> 7; |
| 367 | 348 | |
| 368 | | if (old_depthA != depthA) tilemap_mark_all_tiles_dirty (skns_tilemap_A); |
| 369 | | if (old_depthB != depthB) tilemap_mark_all_tiles_dirty (skns_tilemap_B); |
| 349 | if (old_depthA != state->m_depthA) tilemap_mark_all_tiles_dirty (state->m_tilemap_A); |
| 350 | if (old_depthB != state->m_depthB) tilemap_mark_all_tiles_dirty (state->m_tilemap_B); |
| 370 | 351 | |
| 371 | 352 | } |
| 372 | 353 | } |
| r11160 | r11161 | |
| 378 | 359 | |
| 379 | 360 | state->m_spritegen = machine.device<sknsspr_device>("spritegen"); |
| 380 | 361 | |
| 381 | | skns_tilemap_A = tilemap_create(machine, get_tilemap_A_tile_info,tilemap_scan_rows,16,16,64, 64); |
| 382 | | tilemap_set_transparent_pen(skns_tilemap_A,0); |
| 362 | state->m_tilemap_A = tilemap_create(machine, get_tilemap_A_tile_info,tilemap_scan_rows,16,16,64, 64); |
| 363 | tilemap_set_transparent_pen(state->m_tilemap_A,0); |
| 383 | 364 | |
| 384 | | skns_tilemap_B = tilemap_create(machine, get_tilemap_B_tile_info,tilemap_scan_rows,16,16,64, 64); |
| 385 | | tilemap_set_transparent_pen(skns_tilemap_B,0); |
| 365 | state->m_tilemap_B = tilemap_create(machine, get_tilemap_B_tile_info,tilemap_scan_rows,16,16,64, 64); |
| 366 | tilemap_set_transparent_pen(state->m_tilemap_B,0); |
| 386 | 367 | |
| 387 | | sprite_bitmap = auto_bitmap_alloc(machine,1024,1024,BITMAP_FORMAT_INDEXED16); |
| 368 | state->m_sprite_bitmap = auto_bitmap_alloc(machine,1024,1024,BITMAP_FORMAT_INDEXED16); |
| 388 | 369 | |
| 389 | | tilemap_bitmap_lower = auto_bitmap_alloc(machine,320,240,BITMAP_FORMAT_INDEXED16); |
| 390 | | tilemap_bitmapflags_lower = auto_bitmap_alloc(machine,320,240,BITMAP_FORMAT_INDEXED8); |
| 370 | state->m_tilemap_bitmap_lower = auto_bitmap_alloc(machine,320,240,BITMAP_FORMAT_INDEXED16); |
| 371 | state->m_tilemap_bitmapflags_lower = auto_bitmap_alloc(machine,320,240,BITMAP_FORMAT_INDEXED8); |
| 391 | 372 | |
| 392 | | tilemap_bitmap_higher = auto_bitmap_alloc(machine,320,240,BITMAP_FORMAT_INDEXED16); |
| 393 | | tilemap_bitmapflags_higher = auto_bitmap_alloc(machine,320,240,BITMAP_FORMAT_INDEXED8); |
| 373 | state->m_tilemap_bitmap_higher = auto_bitmap_alloc(machine,320,240,BITMAP_FORMAT_INDEXED16); |
| 374 | state->m_tilemap_bitmapflags_higher = auto_bitmap_alloc(machine,320,240,BITMAP_FORMAT_INDEXED8); |
| 394 | 375 | |
| 395 | 376 | machine.gfx[2]->color_granularity=256; |
| 396 | 377 | machine.gfx[3]->color_granularity=256; |
| r11160 | r11161 | |
| 398 | 379 | |
| 399 | 380 | VIDEO_RESET( skns ) |
| 400 | 381 | { |
| 401 | | depthA = depthB = 0; |
| 402 | | use_spc_bright = use_v3_bright = 1; |
| 403 | | bright_spc_b= bright_spc_g = bright_spc_r = 0x00; |
| 404 | | bright_spc_b_trans = bright_spc_g_trans = bright_spc_r_trans = 0x00; |
| 405 | | bright_v3_b = bright_v3_g = bright_v3_r = 0x00; |
| 406 | | bright_v3_b_trans = bright_v3_g_trans = bright_v3_r_trans = 0x00; |
| 382 | skns_state *state = machine.driver_data<skns_state>(); |
| 383 | state->m_depthA = state->m_depthB = 0; |
| 384 | state->m_use_spc_bright = state->m_use_v3_bright = 1; |
| 385 | state->m_bright_spc_b= state->m_bright_spc_g = state->m_bright_spc_r = 0x00; |
| 386 | state->m_bright_spc_b_trans = state->m_bright_spc_g_trans = state->m_bright_spc_r_trans = 0x00; |
| 387 | state->m_bright_v3_b = state->m_bright_v3_g = state->m_bright_v3_r = 0x00; |
| 388 | state->m_bright_v3_b_trans = state->m_bright_v3_g_trans = state->m_bright_v3_r_trans = 0x00; |
| 407 | 389 | |
| 408 | | spc_changed = v3_changed = palette_updated = 0; |
| 409 | | suprnova_alt_enable_background = suprnova_alt_enable_sprites = 1; |
| 390 | state->m_spc_changed = state->m_v3_changed = state->m_palette_updated = 0; |
| 391 | state->m_alt_enable_background = state->m_alt_enable_sprites = 1; |
| 410 | 392 | } |
| 411 | 393 | |
| 412 | | static void supernova_draw_a( bitmap_t *bitmap, bitmap_t* bitmap_flags, const rectangle *cliprect, int tran ) |
| 394 | static void supernova_draw_a( running_machine &machine, bitmap_t *bitmap, bitmap_t* bitmap_flags, const rectangle *cliprect, int tran ) |
| 413 | 395 | { |
| 414 | | int enable_a = (skns_v3_regs[0x10/4] >> 0) & 0x0001; |
| 415 | | int nowrap_a = (skns_v3_regs[0x10/4] >> 0) & 0x0004; |
| 396 | skns_state *state = machine.driver_data<skns_state>(); |
| 397 | int enable_a = (state->m_v3_regs[0x10/4] >> 0) & 0x0001; |
| 398 | int nowrap_a = (state->m_v3_regs[0x10/4] >> 0) & 0x0004; |
| 416 | 399 | |
| 417 | 400 | |
| 418 | 401 | UINT32 startx,starty; |
| r11160 | r11161 | |
| 421 | 404 | |
| 422 | 405 | //if(nowrap_a) printf("a\n"); |
| 423 | 406 | |
| 424 | | if (enable_a && suprnova_alt_enable_background) |
| 407 | if (enable_a && state->m_alt_enable_background) |
| 425 | 408 | { |
| 426 | | startx = skns_v3_regs[0x1c/4]; |
| 427 | | incyy = skns_v3_regs[0x30/4]&0x7ffff; |
| 409 | startx = state->m_v3_regs[0x1c/4]; |
| 410 | incyy = state->m_v3_regs[0x30/4]&0x7ffff; |
| 428 | 411 | if (incyy&0x40000) incyy = incyy-0x80000; // level 3 boss in sengekis |
| 429 | | incyx = skns_v3_regs[0x2c/4]; |
| 430 | | starty = skns_v3_regs[0x20/4]; |
| 431 | | incxy = skns_v3_regs[0x28/4]; |
| 432 | | incxx = skns_v3_regs[0x24/4]&0x7ffff; |
| 412 | incyx = state->m_v3_regs[0x2c/4]; |
| 413 | starty = state->m_v3_regs[0x20/4]; |
| 414 | incxy = state->m_v3_regs[0x28/4]; |
| 415 | incxx = state->m_v3_regs[0x24/4]&0x7ffff; |
| 433 | 416 | if (incxx&0x40000) incxx = incxx-0x80000; |
| 434 | 417 | |
| 435 | | columnscroll = (skns_v3_regs[0x0c/4] >> 1) & 0x0001; |
| 418 | columnscroll = (state->m_v3_regs[0x0c/4] >> 1) & 0x0001; |
| 436 | 419 | |
| 437 | | suprnova_draw_roz(bitmap,bitmap_flags,cliprect, skns_tilemap_A, startx << 8,starty << 8, incxx << 8,incxy << 8,incyx << 8,incyy << 8, !nowrap_a, columnscroll, &skns_v3slc_ram[0]); |
| 438 | | //tilemap_copy_bitmap(bitmap, tilemap_bitmap_lower, tilemap_bitmapflags_lower); |
| 420 | suprnova_draw_roz(bitmap,bitmap_flags,cliprect, state->m_tilemap_A, startx << 8,starty << 8, incxx << 8,incxy << 8,incyx << 8,incyy << 8, !nowrap_a, columnscroll, &state->m_v3slc_ram[0]); |
| 421 | //tilemap_copy_bitmap(bitmap, state->m_tilemap_bitmap_lower, state->m_tilemap_bitmapflags_lower); |
| 439 | 422 | } |
| 440 | 423 | } |
| 441 | 424 | |
| 442 | | static void supernova_draw_b( bitmap_t *bitmap, bitmap_t* bitmap_flags, const rectangle *cliprect, int tran ) |
| 425 | static void supernova_draw_b( running_machine &machine, bitmap_t *bitmap, bitmap_t* bitmap_flags, const rectangle *cliprect, int tran ) |
| 443 | 426 | { |
| 444 | | int enable_b = (skns_v3_regs[0x34/4] >> 0) & 0x0001; |
| 445 | | int nowrap_b = (skns_v3_regs[0x34/4] >> 0) & 0x0004; |
| 427 | skns_state *state = machine.driver_data<skns_state>(); |
| 428 | int enable_b = (state->m_v3_regs[0x34/4] >> 0) & 0x0001; |
| 429 | int nowrap_b = (state->m_v3_regs[0x34/4] >> 0) & 0x0004; |
| 446 | 430 | |
| 447 | 431 | |
| 448 | 432 | UINT32 startx,starty; |
| r11160 | r11161 | |
| 451 | 435 | |
| 452 | 436 | //if(nowrap_b) printf("b\n"); |
| 453 | 437 | |
| 454 | | if (enable_b && suprnova_alt_enable_background) |
| 438 | if (enable_b && state->m_alt_enable_background) |
| 455 | 439 | { |
| 456 | | startx = skns_v3_regs[0x40/4]; |
| 457 | | incyy = skns_v3_regs[0x54/4]&0x7ffff; |
| 440 | startx = state->m_v3_regs[0x40/4]; |
| 441 | incyy = state->m_v3_regs[0x54/4]&0x7ffff; |
| 458 | 442 | if (incyy&0x40000) incyy = incyy-0x80000; |
| 459 | | incyx = skns_v3_regs[0x50/4]; |
| 460 | | starty = skns_v3_regs[0x44/4]; |
| 461 | | incxy = skns_v3_regs[0x4c/4]; |
| 462 | | incxx = skns_v3_regs[0x48/4]&0x7ffff; |
| 443 | incyx = state->m_v3_regs[0x50/4]; |
| 444 | starty = state->m_v3_regs[0x44/4]; |
| 445 | incxy = state->m_v3_regs[0x4c/4]; |
| 446 | incxx = state->m_v3_regs[0x48/4]&0x7ffff; |
| 463 | 447 | if (incxx&0x40000) incxx = incxx-0x80000; |
| 464 | | columnscroll = (skns_v3_regs[0x0c/4] >> 9) & 0x0001; // selects column scroll or rowscroll |
| 465 | | suprnova_draw_roz(bitmap,bitmap_flags, cliprect, skns_tilemap_B, startx << 8,starty << 8, incxx << 8,incxy << 8,incyx << 8,incyy << 8, !nowrap_b, columnscroll, &skns_v3slc_ram[0x1000/4]); |
| 448 | columnscroll = (state->m_v3_regs[0x0c/4] >> 9) & 0x0001; // selects column scroll or rowscroll |
| 449 | suprnova_draw_roz(bitmap,bitmap_flags, cliprect, state->m_tilemap_B, startx << 8,starty << 8, incxx << 8,incxy << 8,incyx << 8,incyy << 8, !nowrap_b, columnscroll, &state->m_v3slc_ram[0x1000/4]); |
| 466 | 450 | |
| 467 | 451 | //popmessage("%08x %08x %08x %08x %08x %08x", startx, starty, incxx, incyy, incxy, incyx); |
| 468 | 452 | |
| r11160 | r11161 | |
| 476 | 460 | palette_update(screen->machine()); |
| 477 | 461 | |
| 478 | 462 | bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine())); |
| 479 | | bitmap_fill(tilemap_bitmap_lower, NULL, 0); |
| 480 | | bitmap_fill(tilemap_bitmapflags_lower, NULL, 0); |
| 481 | | bitmap_fill(tilemap_bitmap_higher, NULL, 0); |
| 482 | | bitmap_fill(tilemap_bitmapflags_higher, NULL, 0); |
| 463 | bitmap_fill(state->m_tilemap_bitmap_lower, NULL, 0); |
| 464 | bitmap_fill(state->m_tilemap_bitmapflags_lower, NULL, 0); |
| 465 | bitmap_fill(state->m_tilemap_bitmap_higher, NULL, 0); |
| 466 | bitmap_fill(state->m_tilemap_bitmapflags_higher, NULL, 0); |
| 483 | 467 | |
| 484 | 468 | { |
| 485 | 469 | int supernova_pri_a; |
| 486 | 470 | int supernova_pri_b; |
| 487 | 471 | int tran = 0; |
| 488 | 472 | |
| 489 | | supernova_pri_a = (skns_v3_regs[0x10/4] & 0x0002)>>1; |
| 490 | | supernova_pri_b = (skns_v3_regs[0x34/4] & 0x0002)>>1; |
| 473 | supernova_pri_a = (state->m_v3_regs[0x10/4] & 0x0002)>>1; |
| 474 | supernova_pri_b = (state->m_v3_regs[0x34/4] & 0x0002)>>1; |
| 491 | 475 | |
| 492 | 476 | //popmessage("pri %d %d\n", supernova_pri_a, supernova_pri_b); |
| 493 | 477 | |
| 494 | 478 | /*if (!supernova_pri_b) { */ |
| 495 | | supernova_draw_b(tilemap_bitmap_lower, tilemap_bitmapflags_lower, cliprect,tran);// tran = 1; |
| 496 | | supernova_draw_a(tilemap_bitmap_higher,tilemap_bitmapflags_higher,cliprect,tran);// tran = 1; |
| 479 | supernova_draw_b(screen->machine(), state->m_tilemap_bitmap_lower, state->m_tilemap_bitmapflags_lower, cliprect,tran);// tran = 1; |
| 480 | supernova_draw_a(screen->machine(), state->m_tilemap_bitmap_higher,state->m_tilemap_bitmapflags_higher,cliprect,tran);// tran = 1; |
| 497 | 481 | |
| 498 | 482 | { |
| 499 | 483 | int x,y; |
| r11160 | r11161 | |
| 508 | 492 | |
| 509 | 493 | for (y=0;y<240;y++) |
| 510 | 494 | { |
| 511 | | src = BITMAP_ADDR16(tilemap_bitmap_lower, y, 0); |
| 512 | | srcflags = BITMAP_ADDR8(tilemap_bitmapflags_lower, y, 0); |
| 495 | src = BITMAP_ADDR16(state->m_tilemap_bitmap_lower, y, 0); |
| 496 | srcflags = BITMAP_ADDR8(state->m_tilemap_bitmapflags_lower, y, 0); |
| 513 | 497 | |
| 514 | | src2 = BITMAP_ADDR16(tilemap_bitmap_higher, y, 0); |
| 515 | | src2flags = BITMAP_ADDR8(tilemap_bitmapflags_higher, y, 0); |
| 498 | src2 = BITMAP_ADDR16(state->m_tilemap_bitmap_higher, y, 0); |
| 499 | src2flags = BITMAP_ADDR8(state->m_tilemap_bitmapflags_higher, y, 0); |
| 516 | 500 | |
| 517 | | src3 = BITMAP_ADDR16(sprite_bitmap, y, 0); |
| 501 | src3 = BITMAP_ADDR16(state->m_sprite_bitmap, y, 0); |
| 518 | 502 | |
| 519 | 503 | dst = BITMAP_ADDR32(bitmap, y, 0); |
| 520 | 504 | |
| r11160 | r11161 | |
| 583 | 567 | if (pendata3&0xff) |
| 584 | 568 | { |
| 585 | 569 | |
| 586 | | UINT16 palvalue = skns_palette_ram[pendata3]; |
| 570 | UINT16 palvalue = state->m_palette_ram[pendata3]; |
| 587 | 571 | |
| 588 | 572 | coldat = clut[pendata3]; |
| 589 | 573 | |
| r11160 | r11161 | |
| 603 | 587 | g2 = (dstcolour & 0x0000ff00)>> 8; |
| 604 | 588 | b2 = (dstcolour & 0x00ff0000)>> 16; |
| 605 | 589 | |
| 606 | | r2 = (r2 * bright_spc_r_trans) >> 8; |
| 607 | | g2 = (g2 * bright_spc_g_trans) >> 8; |
| 608 | | b2 = (b2 * bright_spc_b_trans) >> 8; |
| 590 | r2 = (r2 * state->m_bright_spc_r_trans) >> 8; |
| 591 | g2 = (g2 * state->m_bright_spc_g_trans) >> 8; |
| 592 | b2 = (b2 * state->m_bright_spc_b_trans) >> 8; |
| 609 | 593 | |
| 610 | 594 | r = (r+r2); |
| 611 | 595 | if (r>255) r = 255; |
| r11160 | r11161 | |
| 644 | 628 | } |
| 645 | 629 | } |
| 646 | 630 | |
| 647 | | bitmap_fill(sprite_bitmap, cliprect, 0x0000); |
| 631 | bitmap_fill(state->m_sprite_bitmap, cliprect, 0x0000); |
| 648 | 632 | |
| 649 | | if (suprnova_alt_enable_sprites) |
| 650 | | state->m_spritegen->skns_draw_sprites(screen->machine(), sprite_bitmap, cliprect, screen->machine().generic.spriteram.u32, screen->machine().generic.spriteram_size, screen->machine().region("gfx1")->base(), screen->machine().region ("gfx1")->bytes(), skns_spc_regs ); |
| 633 | if (state->m_alt_enable_sprites) |
| 634 | state->m_spritegen->skns_draw_sprites(screen->machine(), state->m_sprite_bitmap, cliprect, screen->machine().generic.spriteram.u32, screen->machine().generic.spriteram_size, screen->machine().region("gfx1")->base(), screen->machine().region ("gfx1")->bytes(), state->m_spc_regs ); |
| 651 | 635 | |
| 652 | 636 | |
| 653 | 637 | return 0; |
src/mame/video/kaneko16.c
| r11160 | r11161 | |
| 35 | 35 | #include "includes/kaneko16.h" |
| 36 | 36 | #include "kan_pand.h" |
| 37 | 37 | |
| 38 | | static UINT16 kaneko16_disp_enable; |
| 39 | 38 | |
| 40 | | |
| 41 | | static tilemap_t *kaneko16_tmap_0, *kaneko16_tmap_1; |
| 42 | | static tilemap_t *kaneko16_tmap_2, *kaneko16_tmap_3; |
| 43 | | UINT16 *kaneko16_vram_0, *kaneko16_vram_1, *kaneko16_layers_0_regs; |
| 44 | | UINT16 *kaneko16_vscroll_0, *kaneko16_vscroll_1; |
| 45 | | UINT16 *kaneko16_vram_2, *kaneko16_vram_3, *kaneko16_layers_1_regs; |
| 46 | | UINT16 *kaneko16_vscroll_2, *kaneko16_vscroll_3; |
| 47 | | |
| 48 | | UINT16* galsnew_bg_pixram; |
| 49 | | UINT16* galsnew_fg_pixram; |
| 50 | | |
| 51 | | int kaneko16_sprite_type; |
| 52 | | int kaneko16_sprite_fliptype; |
| 53 | | static int kaneko16_keep_sprites; |
| 54 | | UINT16 kaneko16_sprite_xoffs, kaneko16_sprite_flipx; |
| 55 | | UINT16 kaneko16_sprite_yoffs, kaneko16_sprite_flipy; |
| 56 | | UINT16 *kaneko16_sprites_regs; |
| 57 | | |
| 58 | | UINT8 kaneko16_nvram_save[128]; |
| 59 | | |
| 60 | | UINT16 *kaneko16_bg15_select, *kaneko16_bg15_reg; |
| 61 | | static bitmap_t *kaneko16_bg15_bitmap; |
| 62 | | static bitmap_t *sprites_bitmap; /* bitmap used for to keep sprites on screen (mgcrystl 1st boss) */ |
| 63 | | |
| 64 | 39 | struct tempsprite |
| 65 | 40 | { |
| 66 | 41 | int code,color; |
| r11160 | r11161 | |
| 70 | 45 | int priority; |
| 71 | 46 | }; |
| 72 | 47 | |
| 73 | | static struct |
| 74 | | { |
| 75 | | struct tempsprite *first_sprite; |
| 76 | | } spritelist; |
| 77 | 48 | |
| 78 | | |
| 79 | | kaneko16_priority_t kaneko16_priority; |
| 80 | | |
| 81 | | |
| 82 | 49 | WRITE16_HANDLER( kaneko16_display_enable ) |
| 83 | 50 | { |
| 84 | | COMBINE_DATA(&kaneko16_disp_enable); |
| 51 | kaneko16_state *state = space->machine().driver_data<kaneko16_state>(); |
| 52 | COMBINE_DATA(&state->m_disp_enable); |
| 85 | 53 | } |
| 86 | 54 | |
| 87 | 55 | /*************************************************************************** |
| r11160 | r11161 | |
| 103 | 71 | |
| 104 | 72 | ***************************************************************************/ |
| 105 | 73 | |
| 106 | | #define KANEKO16_LAYER(_N_) \ |
| 107 | | static TILE_GET_INFO( get_tile_info_##_N_ ) \ |
| 108 | | { \ |
| 109 | | UINT16 code_hi = kaneko16_vram_##_N_[ 2 * tile_index + 0]; \ |
| 110 | | UINT16 code_lo = kaneko16_vram_##_N_[ 2 * tile_index + 1]; \ |
| 111 | | SET_TILE_INFO(1 + _N_/2, code_lo, (code_hi >> 2) & 0x3f, TILE_FLIPXY( code_hi & 3 )); \ |
| 112 | | tileinfo->category = (code_hi >> 8) & 7; \ |
| 113 | | } \ |
| 114 | | \ |
| 115 | | WRITE16_HANDLER( kaneko16_vram_##_N_##_w ) \ |
| 116 | | { \ |
| 117 | | COMBINE_DATA(&kaneko16_vram_##_N_[offset]); \ |
| 118 | | tilemap_mark_tile_dirty(kaneko16_tmap_##_N_, offset/2); \ |
| 74 | INLINE void get_tile_info(running_machine &machine, tile_data *tileinfo, tilemap_memory_index tile_index, int _N_) |
| 75 | { |
| 76 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 77 | UINT16 code_hi = state->m_vram[_N_][ 2 * tile_index + 0]; |
| 78 | UINT16 code_lo = state->m_vram[_N_][ 2 * tile_index + 1]; |
| 79 | SET_TILE_INFO(1 + _N_/2, code_lo, (code_hi >> 2) & 0x3f, TILE_FLIPXY( code_hi & 3 )); |
| 80 | tileinfo->category = (code_hi >> 8) & 7; |
| 119 | 81 | } |
| 120 | 82 | |
| 83 | static TILE_GET_INFO( get_tile_info_0 ) { get_tile_info(machine, tileinfo, tile_index, 0); } |
| 84 | static TILE_GET_INFO( get_tile_info_1 ) { get_tile_info(machine, tileinfo, tile_index, 1); } |
| 85 | static TILE_GET_INFO( get_tile_info_2 ) { get_tile_info(machine, tileinfo, tile_index, 2); } |
| 86 | static TILE_GET_INFO( get_tile_info_3 ) { get_tile_info(machine, tileinfo, tile_index, 3); } |
| 121 | 87 | |
| 122 | | KANEKO16_LAYER(0) |
| 123 | | KANEKO16_LAYER(1) |
| 124 | | KANEKO16_LAYER(2) |
| 125 | | KANEKO16_LAYER(3) |
| 88 | INLINE void kaneko16_vram_w(address_space *space, offs_t offset, UINT16 data, UINT16 mem_mask, int _N_) |
| 89 | { |
| 90 | kaneko16_state *state = space->machine().driver_data<kaneko16_state>(); |
| 91 | COMBINE_DATA(&state->m_vram[_N_][offset]); |
| 92 | tilemap_mark_tile_dirty(state->m_tmap[_N_], offset/2); |
| 93 | } |
| 126 | 94 | |
| 95 | WRITE16_HANDLER( kaneko16_vram_0_w ) { kaneko16_vram_w(space, offset, data, mem_mask, 0); } |
| 96 | WRITE16_HANDLER( kaneko16_vram_1_w ) { kaneko16_vram_w(space, offset, data, mem_mask, 1); } |
| 97 | WRITE16_HANDLER( kaneko16_vram_2_w ) { kaneko16_vram_w(space, offset, data, mem_mask, 2); } |
| 98 | WRITE16_HANDLER( kaneko16_vram_3_w ) { kaneko16_vram_w(space, offset, data, mem_mask, 3); } |
| 99 | |
| 127 | 100 | VIDEO_START( kaneko16_sprites ) |
| 128 | 101 | { |
| 129 | | kaneko16_disp_enable = 1; // default enabled for games not using it |
| 130 | | kaneko16_keep_sprites = 0; // default disabled for games not using it |
| 102 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 103 | state->m_disp_enable = 1; // default enabled for games not using it |
| 104 | state->m_keep_sprites = 0; // default disabled for games not using it |
| 131 | 105 | |
| 132 | 106 | /* 0x400 sprites max */ |
| 133 | | spritelist.first_sprite = auto_alloc_array(machine, struct tempsprite, 0x400); |
| 107 | state->m_first_sprite = auto_alloc_array(machine, struct tempsprite, 0x400); |
| 134 | 108 | } |
| 135 | 109 | |
| 136 | 110 | VIDEO_START( kaneko16_1xVIEW2_tilemaps ) |
| 137 | 111 | { |
| 138 | | kaneko16_disp_enable = 1; // default enabled for games not using it |
| 139 | | kaneko16_keep_sprites = 0; // default disabled for games not using it |
| 112 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 113 | state->m_disp_enable = 1; // default enabled for games not using it |
| 114 | state->m_keep_sprites = 0; // default disabled for games not using it |
| 140 | 115 | |
| 141 | | kaneko16_tmap_0 = tilemap_create( machine, get_tile_info_0, tilemap_scan_rows, |
| 116 | state->m_tmap[0] = tilemap_create( machine, get_tile_info_0, tilemap_scan_rows, |
| 142 | 117 | 16,16, 0x20,0x20 ); |
| 143 | | kaneko16_tmap_1 = tilemap_create( machine, get_tile_info_1, tilemap_scan_rows, |
| 118 | state->m_tmap[1] = tilemap_create( machine, get_tile_info_1, tilemap_scan_rows, |
| 144 | 119 | 16,16, 0x20,0x20 ); |
| 145 | 120 | |
| 146 | | kaneko16_tmap_2 = 0; |
| 121 | state->m_tmap[2] = 0; |
| 147 | 122 | |
| 148 | | kaneko16_tmap_3 = 0; |
| 123 | state->m_tmap[3] = 0; |
| 149 | 124 | |
| 150 | | sprites_bitmap = machine.primary_screen->alloc_compatible_bitmap(); |
| 125 | state->m_sprites_bitmap = machine.primary_screen->alloc_compatible_bitmap(); |
| 151 | 126 | |
| 152 | 127 | { |
| 153 | 128 | int dx, dy; |
| r11160 | r11161 | |
| 168 | 143 | default: dy = 0; |
| 169 | 144 | } |
| 170 | 145 | |
| 171 | | tilemap_set_scrolldx( kaneko16_tmap_0, -dx, xdim + dx -1 ); |
| 172 | | tilemap_set_scrolldx( kaneko16_tmap_1, -(dx+2), xdim + (dx + 2) - 1 ); |
| 146 | tilemap_set_scrolldx( state->m_tmap[0], -dx, xdim + dx -1 ); |
| 147 | tilemap_set_scrolldx( state->m_tmap[1], -(dx+2), xdim + (dx + 2) - 1 ); |
| 173 | 148 | |
| 174 | | tilemap_set_scrolldy( kaneko16_tmap_0, -dy, ydim + dy -1 ); |
| 175 | | tilemap_set_scrolldy( kaneko16_tmap_1, -dy, ydim + dy -1 ); |
| 149 | tilemap_set_scrolldy( state->m_tmap[0], -dy, ydim + dy -1 ); |
| 150 | tilemap_set_scrolldy( state->m_tmap[1], -dy, ydim + dy -1 ); |
| 176 | 151 | |
| 177 | | tilemap_set_transparent_pen(kaneko16_tmap_0, 0); |
| 178 | | tilemap_set_transparent_pen(kaneko16_tmap_1, 0); |
| 152 | tilemap_set_transparent_pen(state->m_tmap[0], 0); |
| 153 | tilemap_set_transparent_pen(state->m_tmap[1], 0); |
| 179 | 154 | |
| 180 | | tilemap_set_scroll_rows(kaneko16_tmap_0, 0x200); // Line Scroll |
| 181 | | tilemap_set_scroll_rows(kaneko16_tmap_1, 0x200); |
| 155 | tilemap_set_scroll_rows(state->m_tmap[0], 0x200); // Line Scroll |
| 156 | tilemap_set_scroll_rows(state->m_tmap[1], 0x200); |
| 182 | 157 | } |
| 183 | 158 | |
| 184 | 159 | } |
| r11160 | r11161 | |
| 193 | 168 | |
| 194 | 169 | VIDEO_START( kaneko16_2xVIEW2 ) |
| 195 | 170 | { |
| 171 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 196 | 172 | VIDEO_START_CALL(kaneko16_1xVIEW2); |
| 197 | 173 | |
| 198 | | kaneko16_tmap_2 = tilemap_create( machine, get_tile_info_2, tilemap_scan_rows, |
| 174 | state->m_tmap[2] = tilemap_create( machine, get_tile_info_2, tilemap_scan_rows, |
| 199 | 175 | 16,16, 0x20,0x20 ); |
| 200 | | kaneko16_tmap_3 = tilemap_create( machine, get_tile_info_3, tilemap_scan_rows, |
| 176 | state->m_tmap[3] = tilemap_create( machine, get_tile_info_3, tilemap_scan_rows, |
| 201 | 177 | 16,16, 0x20,0x20 ); |
| 202 | 178 | |
| 203 | 179 | { |
| r11160 | r11161 | |
| 219 | 195 | default: dy = 0; |
| 220 | 196 | } |
| 221 | 197 | |
| 222 | | tilemap_set_scrolldx( kaneko16_tmap_2, -dx, xdim + dx -1 ); |
| 223 | | tilemap_set_scrolldx( kaneko16_tmap_3, -(dx+2), xdim + (dx + 2) - 1 ); |
| 198 | tilemap_set_scrolldx( state->m_tmap[2], -dx, xdim + dx -1 ); |
| 199 | tilemap_set_scrolldx( state->m_tmap[3], -(dx+2), xdim + (dx + 2) - 1 ); |
| 224 | 200 | |
| 225 | | tilemap_set_scrolldy( kaneko16_tmap_2, -dy, ydim + dy -1 ); |
| 226 | | tilemap_set_scrolldy( kaneko16_tmap_3, -dy, ydim + dy -1 ); |
| 201 | tilemap_set_scrolldy( state->m_tmap[2], -dy, ydim + dy -1 ); |
| 202 | tilemap_set_scrolldy( state->m_tmap[3], -dy, ydim + dy -1 ); |
| 227 | 203 | |
| 228 | | tilemap_set_transparent_pen(kaneko16_tmap_2, 0); |
| 229 | | tilemap_set_transparent_pen(kaneko16_tmap_3, 0); |
| 204 | tilemap_set_transparent_pen(state->m_tmap[2], 0); |
| 205 | tilemap_set_transparent_pen(state->m_tmap[3], 0); |
| 230 | 206 | |
| 231 | | tilemap_set_scroll_rows(kaneko16_tmap_2, 0x200); // Line Scroll |
| 232 | | tilemap_set_scroll_rows(kaneko16_tmap_3, 0x200); |
| 207 | tilemap_set_scroll_rows(state->m_tmap[2], 0x200); // Line Scroll |
| 208 | tilemap_set_scroll_rows(state->m_tmap[3], 0x200); |
| 233 | 209 | } |
| 234 | 210 | } |
| 235 | 211 | |
| 236 | 212 | VIDEO_START( sandscrp_1xVIEW2 ) |
| 237 | 213 | { |
| 214 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 238 | 215 | VIDEO_START_CALL(kaneko16_1xVIEW2); |
| 239 | 216 | |
| 240 | | tilemap_set_scrolldy( kaneko16_tmap_0, 0, 256 - 1 ); |
| 241 | | tilemap_set_scrolldy( kaneko16_tmap_1, 0, 256 - 1 ); |
| 217 | tilemap_set_scrolldy( state->m_tmap[0], 0, 256 - 1 ); |
| 218 | tilemap_set_scrolldy( state->m_tmap[1], 0, 256 - 1 ); |
| 242 | 219 | } |
| 243 | 220 | |
| 244 | 221 | |
| r11160 | r11161 | |
| 258 | 235 | |
| 259 | 236 | VIDEO_START( berlwall ) |
| 260 | 237 | { |
| 238 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 261 | 239 | int sx, x,y; |
| 262 | 240 | UINT8 *RAM = machine.region("gfx3")->base(); |
| 263 | 241 | |
| 264 | 242 | /* Render the hi-color static backgrounds held in the ROMs */ |
| 265 | 243 | |
| 266 | | kaneko16_bg15_bitmap = auto_bitmap_alloc(machine, 256 * 32, 256 * 1, BITMAP_FORMAT_INDEXED16); |
| 244 | state->m_bg15_bitmap = auto_bitmap_alloc(machine, 256 * 32, 256 * 1, BITMAP_FORMAT_INDEXED16); |
| 267 | 245 | |
| 268 | 246 | /* |
| 269 | 247 | 8aba is used as background color |
| r11160 | r11161 | |
| 296 | 274 | if ((r & 0x10) && (b & 0x10)) |
| 297 | 275 | g = (g - 1) & 0x1f; /* decrease with wraparound */ |
| 298 | 276 | |
| 299 | | *BITMAP_ADDR16(kaneko16_bg15_bitmap, y, sx * 256 + x) = 2048 + ((g << 10) | (r << 5) | b); |
| 277 | *BITMAP_ADDR16(state->m_bg15_bitmap, y, sx * 256 + x) = 2048 + ((g << 10) | (r << 5) | b); |
| 300 | 278 | } |
| 301 | 279 | |
| 302 | 280 | VIDEO_START_CALL(kaneko16_1xVIEW2); |
| r11160 | r11161 | |
| 304 | 282 | |
| 305 | 283 | VIDEO_START( galsnew ) |
| 306 | 284 | { |
| 285 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 307 | 286 | VIDEO_START_CALL(kaneko16_sprites); |
| 308 | 287 | |
| 309 | | kaneko16_tmap_0 = tilemap_create( machine, get_tile_info_0, tilemap_scan_rows, |
| 288 | state->m_tmap[0] = tilemap_create( machine, get_tile_info_0, tilemap_scan_rows, |
| 310 | 289 | 16,16, 0x20,0x20 ); |
| 311 | | kaneko16_tmap_1 = tilemap_create( machine, get_tile_info_1, tilemap_scan_rows, |
| 290 | state->m_tmap[1] = tilemap_create( machine, get_tile_info_1, tilemap_scan_rows, |
| 312 | 291 | 16,16, 0x20,0x20 ); |
| 313 | 292 | |
| 314 | | kaneko16_tmap_2 = 0; |
| 293 | state->m_tmap[2] = 0; |
| 315 | 294 | |
| 316 | | kaneko16_tmap_3 = 0; |
| 295 | state->m_tmap[3] = 0; |
| 317 | 296 | |
| 318 | | sprites_bitmap = machine.primary_screen->alloc_compatible_bitmap(); |
| 297 | state->m_sprites_bitmap = machine.primary_screen->alloc_compatible_bitmap(); |
| 319 | 298 | |
| 320 | 299 | { |
| 321 | 300 | int dx = 0x5b, dy = 8; |
| r11160 | r11161 | |
| 323 | 302 | int xdim = machine.primary_screen->width(); |
| 324 | 303 | int ydim = machine.primary_screen->height(); |
| 325 | 304 | |
| 326 | | tilemap_set_scrolldx( kaneko16_tmap_0, -dx, xdim + dx -1 ); |
| 327 | | tilemap_set_scrolldx( kaneko16_tmap_1, -(dx+2), xdim + (dx + 2) - 1 ); |
| 305 | tilemap_set_scrolldx( state->m_tmap[0], -dx, xdim + dx -1 ); |
| 306 | tilemap_set_scrolldx( state->m_tmap[1], -(dx+2), xdim + (dx + 2) - 1 ); |
| 328 | 307 | |
| 329 | | tilemap_set_scrolldy( kaneko16_tmap_0, -dy, ydim + dy -1 ); |
| 330 | | tilemap_set_scrolldy( kaneko16_tmap_1, -dy, ydim + dy -1 ); |
| 308 | tilemap_set_scrolldy( state->m_tmap[0], -dy, ydim + dy -1 ); |
| 309 | tilemap_set_scrolldy( state->m_tmap[1], -dy, ydim + dy -1 ); |
| 331 | 310 | |
| 332 | | tilemap_set_transparent_pen(kaneko16_tmap_0, 0); |
| 333 | | tilemap_set_transparent_pen(kaneko16_tmap_1, 0); |
| 311 | tilemap_set_transparent_pen(state->m_tmap[0], 0); |
| 312 | tilemap_set_transparent_pen(state->m_tmap[1], 0); |
| 334 | 313 | |
| 335 | | tilemap_set_scroll_rows(kaneko16_tmap_0, 0x200); // Line Scroll |
| 336 | | tilemap_set_scroll_rows(kaneko16_tmap_1, 0x200); |
| 314 | tilemap_set_scroll_rows(state->m_tmap[0], 0x200); // Line Scroll |
| 315 | tilemap_set_scroll_rows(state->m_tmap[1], 0x200); |
| 337 | 316 | } |
| 338 | 317 | } |
| 339 | 318 | |
| r11160 | r11161 | |
| 391 | 370 | |
| 392 | 371 | static int kaneko16_parse_sprite_type012(running_machine &machine, int i, struct tempsprite *s) |
| 393 | 372 | { |
| 373 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 394 | 374 | UINT16 *spriteram16 = machine.generic.spriteram.u16; |
| 395 | 375 | int attr, xoffs, offs; |
| 396 | 376 | |
| 397 | | if (kaneko16_sprite_type == 2) offs = i * 16/2 + 0x8/2; |
| 377 | if (state->m_sprite_type == 2) offs = i * 16/2 + 0x8/2; |
| 398 | 378 | else offs = i * 8/2; |
| 399 | 379 | |
| 400 | 380 | if (offs >= (machine.generic.spriteram_size/2)) return -1; |
| r11160 | r11161 | |
| 404 | 384 | s->x = spriteram16[offs + 2]; |
| 405 | 385 | s->y = spriteram16[offs + 3]; |
| 406 | 386 | |
| 407 | | if (kaneko16_sprite_type == 1) |
| 387 | if (state->m_sprite_type == 1) |
| 408 | 388 | { |
| 409 | 389 | s->color = (attr & 0x003f); |
| 410 | 390 | s->priority = (attr & 0x00c0) >> 6; |
| r11160 | r11161 | |
| 420 | 400 | s->priority = (attr & 0x0300) >> 8; |
| 421 | 401 | } |
| 422 | 402 | xoffs = (attr & 0x1800) >> 11; |
| 423 | | s->yoffs = kaneko16_sprites_regs[0x10/2 + xoffs*2 + 1]; |
| 424 | | s->xoffs = kaneko16_sprites_regs[0x10/2 + xoffs*2 + 0]; |
| 403 | s->yoffs = state->m_sprites_regs[0x10/2 + xoffs*2 + 1]; |
| 404 | s->xoffs = state->m_sprites_regs[0x10/2 + xoffs*2 + 0]; |
| 425 | 405 | |
| 426 | | if (kaneko16_sprite_flipy) |
| 406 | if (state->m_sprite_flipy) |
| 427 | 407 | { |
| 428 | | s->yoffs -= kaneko16_sprites_regs[0x2/2]; |
| 408 | s->yoffs -= state->m_sprites_regs[0x2/2]; |
| 429 | 409 | s->yoffs -= machine.primary_screen->visible_area().min_y<<6; |
| 430 | 410 | } |
| 431 | 411 | else |
| 432 | 412 | { |
| 433 | | s->yoffs -= kaneko16_sprites_regs[0x2/2]; |
| 413 | s->yoffs -= state->m_sprites_regs[0x2/2]; |
| 434 | 414 | s->yoffs += machine.primary_screen->visible_area().min_y<<6; |
| 435 | 415 | } |
| 436 | 416 | |
| r11160 | r11161 | |
| 542 | 522 | |
| 543 | 523 | void kaneko16_draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 544 | 524 | { |
| 525 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 545 | 526 | /* Sprites *must* be parsed from the first in RAM to the last, |
| 546 | 527 | because of the multisprite feature. But they *must* be drawn |
| 547 | 528 | from the last in RAM (frontmost) to the first in order to |
| r11160 | r11161 | |
| 554 | 535 | int max = (machine.primary_screen->width() > 0x100) ? (0x200<<6) : (0x100<<6); |
| 555 | 536 | |
| 556 | 537 | int i = 0; |
| 557 | | struct tempsprite *s = spritelist.first_sprite; |
| 538 | struct tempsprite *s = state->m_first_sprite; |
| 558 | 539 | |
| 559 | 540 | /* These values are latched from the last sprite. */ |
| 560 | 541 | int x = 0; |
| r11160 | r11161 | |
| 571 | 552 | { |
| 572 | 553 | int flags; |
| 573 | 554 | |
| 574 | | switch( kaneko16_sprite_type ) |
| 555 | switch( state->m_sprite_type ) |
| 575 | 556 | { |
| 576 | 557 | case 0: |
| 577 | 558 | case 1: |
| r11160 | r11161 | |
| 595 | 576 | s->xoffs = xoffs; |
| 596 | 577 | s->yoffs = yoffs; |
| 597 | 578 | |
| 598 | | if (kaneko16_sprite_fliptype==0) |
| 579 | if (state->m_sprite_fliptype==0) |
| 599 | 580 | { |
| 600 | 581 | s->flipx = flipx; |
| 601 | 582 | s->flipy = flipy; |
| r11160 | r11161 | |
| 608 | 589 | xoffs = s->xoffs; |
| 609 | 590 | yoffs = s->yoffs; |
| 610 | 591 | |
| 611 | | if (kaneko16_sprite_fliptype==0) |
| 592 | if (state->m_sprite_fliptype==0) |
| 612 | 593 | { |
| 613 | 594 | flipx = s->flipx; |
| 614 | 595 | flipy = s->flipy; |
| r11160 | r11161 | |
| 616 | 597 | } |
| 617 | 598 | |
| 618 | 599 | // brap boys explicitly doesn't want the flip to be latched, maybe there is a different bit to enable that behavior? |
| 619 | | if (kaneko16_sprite_fliptype==1) |
| 600 | if (state->m_sprite_fliptype==1) |
| 620 | 601 | { |
| 621 | 602 | flipx = s->flipx; |
| 622 | 603 | flipy = s->flipy; |
| r11160 | r11161 | |
| 636 | 617 | s->x = s->xoffs + s->x; |
| 637 | 618 | s->y = s->yoffs + s->y; |
| 638 | 619 | |
| 639 | | s->x += kaneko16_sprite_xoffs; |
| 640 | | s->y += kaneko16_sprite_yoffs; |
| 620 | s->x += state->m_sprite_xoffs; |
| 621 | s->y += state->m_sprite_yoffs; |
| 641 | 622 | |
| 642 | | if (kaneko16_sprite_flipx) { s->x = max - s->x - (16<<6); s->flipx = !s->flipx; } |
| 643 | | if (kaneko16_sprite_flipy) { s->y = max - s->y - (16<<6); s->flipy = !s->flipy; } |
| 623 | if (state->m_sprite_flipx) { s->x = max - s->x - (16<<6); s->flipx = !s->flipx; } |
| 624 | if (state->m_sprite_flipy) { s->y = max - s->y - (16<<6); s->flipy = !s->flipy; } |
| 644 | 625 | |
| 645 | 626 | s->x = ( (s->x & 0x7fc0) - (s->x & 0x8000) ) / 0x40; |
| 646 | 627 | s->y = ( (s->y & 0x7fc0) - (s->y & 0x8000) ) / 0x40; |
| r11160 | r11161 | |
| 653 | 634 | /* Let's finally draw the sprites we buffered, in reverse order |
| 654 | 635 | (for pdrawgfx) */ |
| 655 | 636 | |
| 656 | | for (s--; s >= spritelist.first_sprite; s--) |
| 637 | for (s--; s >= state->m_first_sprite; s--) |
| 657 | 638 | { |
| 658 | 639 | int curr_pri = s->priority; |
| 659 | 640 | |
| 660 | | UINT32 primask = kaneko16_priority.sprite[curr_pri]; |
| 641 | UINT32 primask = state->m_priority.sprite[curr_pri]; |
| 661 | 642 | |
| 662 | 643 | kaneko16_draw_sprites_custom( |
| 663 | 644 | bitmap,cliprect,machine.gfx[0], |
| r11160 | r11161 | |
| 741 | 722 | |
| 742 | 723 | READ16_HANDLER( kaneko16_sprites_regs_r ) |
| 743 | 724 | { |
| 744 | | return kaneko16_sprites_regs[offset]; |
| 725 | kaneko16_state *state = space->machine().driver_data<kaneko16_state>(); |
| 726 | return state->m_sprites_regs[offset]; |
| 745 | 727 | } |
| 746 | 728 | |
| 747 | 729 | WRITE16_HANDLER( kaneko16_sprites_regs_w ) |
| 748 | 730 | { |
| 731 | kaneko16_state *state = space->machine().driver_data<kaneko16_state>(); |
| 749 | 732 | UINT16 new_data; |
| 750 | 733 | |
| 751 | | COMBINE_DATA(&kaneko16_sprites_regs[offset]); |
| 752 | | new_data = kaneko16_sprites_regs[offset]; |
| 734 | COMBINE_DATA(&state->m_sprites_regs[offset]); |
| 735 | new_data = state->m_sprites_regs[offset]; |
| 753 | 736 | |
| 754 | 737 | switch (offset) |
| 755 | 738 | { |
| 756 | 739 | case 0: |
| 757 | 740 | if (ACCESSING_BITS_0_7) |
| 758 | 741 | { |
| 759 | | kaneko16_sprite_flipx = new_data & 2; |
| 760 | | kaneko16_sprite_flipy = new_data & 1; |
| 742 | state->m_sprite_flipx = new_data & 2; |
| 743 | state->m_sprite_flipy = new_data & 1; |
| 761 | 744 | |
| 762 | | if(kaneko16_sprite_type == 0 || kaneko16_sprite_type == 2) |
| 763 | | kaneko16_keep_sprites = ~new_data & 4; |
| 745 | if(state->m_sprite_type == 0 || state->m_sprite_type == 2) |
| 746 | state->m_keep_sprites = ~new_data & 4; |
| 764 | 747 | } |
| 765 | 748 | |
| 766 | 749 | break; |
| r11160 | r11161 | |
| 824 | 807 | |
| 825 | 808 | WRITE16_HANDLER( kaneko16_layers_0_regs_w ) |
| 826 | 809 | { |
| 827 | | COMBINE_DATA(&kaneko16_layers_0_regs[offset]); |
| 810 | kaneko16_state *state = space->machine().driver_data<kaneko16_state>(); |
| 811 | COMBINE_DATA(&state->m_layers_0_regs[offset]); |
| 828 | 812 | } |
| 829 | 813 | |
| 830 | 814 | WRITE16_HANDLER( kaneko16_layers_1_regs_w ) |
| 831 | 815 | { |
| 832 | | COMBINE_DATA(&kaneko16_layers_1_regs[offset]); |
| 816 | kaneko16_state *state = space->machine().driver_data<kaneko16_state>(); |
| 817 | COMBINE_DATA(&state->m_layers_1_regs[offset]); |
| 833 | 818 | } |
| 834 | 819 | |
| 835 | 820 | |
| r11160 | r11161 | |
| 838 | 823 | /* Select the high color background image (out of 32 in the ROMs) */ |
| 839 | 824 | READ16_HANDLER( kaneko16_bg15_select_r ) |
| 840 | 825 | { |
| 841 | | return kaneko16_bg15_select[0]; |
| 826 | kaneko16_state *state = space->machine().driver_data<kaneko16_state>(); |
| 827 | return state->m_bg15_select[0]; |
| 842 | 828 | } |
| 843 | 829 | WRITE16_HANDLER( kaneko16_bg15_select_w ) |
| 844 | 830 | { |
| 845 | | COMBINE_DATA(&kaneko16_bg15_select[0]); |
| 831 | kaneko16_state *state = space->machine().driver_data<kaneko16_state>(); |
| 832 | COMBINE_DATA(&state->m_bg15_select[0]); |
| 846 | 833 | } |
| 847 | 834 | |
| 848 | 835 | /* ? */ |
| 849 | 836 | READ16_HANDLER( kaneko16_bg15_reg_r ) |
| 850 | 837 | { |
| 851 | | return kaneko16_bg15_reg[0]; |
| 838 | kaneko16_state *state = space->machine().driver_data<kaneko16_state>(); |
| 839 | return state->m_bg15_reg[0]; |
| 852 | 840 | } |
| 853 | 841 | WRITE16_HANDLER( kaneko16_bg15_reg_w ) |
| 854 | 842 | { |
| 855 | | COMBINE_DATA(&kaneko16_bg15_reg[0]); |
| 843 | kaneko16_state *state = space->machine().driver_data<kaneko16_state>(); |
| 844 | COMBINE_DATA(&state->m_bg15_reg[0]); |
| 856 | 845 | } |
| 857 | 846 | |
| 858 | 847 | |
| r11160 | r11161 | |
| 868 | 857 | |
| 869 | 858 | static void kaneko16_prepare_first_tilemap_chip(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 870 | 859 | { |
| 860 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 871 | 861 | /* Set Up FIRST Tilemap chip */ |
| 872 | 862 | int layers_flip_0; |
| 873 | 863 | UINT16 layer0_scrollx, layer0_scrolly; |
| 874 | 864 | UINT16 layer1_scrollx, layer1_scrolly; |
| 875 | 865 | int i; |
| 876 | 866 | |
| 877 | | layers_flip_0 = kaneko16_layers_0_regs[ 4 ]; |
| 867 | layers_flip_0 = state->m_layers_0_regs[ 4 ]; |
| 878 | 868 | |
| 879 | 869 | /* Enable layers */ |
| 880 | | tilemap_set_enable(kaneko16_tmap_0, ~layers_flip_0 & 0x1000); |
| 881 | | tilemap_set_enable(kaneko16_tmap_1, ~layers_flip_0 & 0x0010); |
| 870 | tilemap_set_enable(state->m_tmap[0], ~layers_flip_0 & 0x1000); |
| 871 | tilemap_set_enable(state->m_tmap[1], ~layers_flip_0 & 0x0010); |
| 882 | 872 | |
| 883 | 873 | /* Flip layers */ |
| 884 | | tilemap_set_flip(kaneko16_tmap_0, ((layers_flip_0 & 0x0100) ? TILEMAP_FLIPY : 0) | |
| 874 | tilemap_set_flip(state->m_tmap[0], ((layers_flip_0 & 0x0100) ? TILEMAP_FLIPY : 0) | |
| 885 | 875 | ((layers_flip_0 & 0x0200) ? TILEMAP_FLIPX : 0) ); |
| 886 | | tilemap_set_flip(kaneko16_tmap_1, ((layers_flip_0 & 0x0100) ? TILEMAP_FLIPY : 0) | |
| 876 | tilemap_set_flip(state->m_tmap[1], ((layers_flip_0 & 0x0100) ? TILEMAP_FLIPY : 0) | |
| 887 | 877 | ((layers_flip_0 & 0x0200) ? TILEMAP_FLIPX : 0) ); |
| 888 | 878 | |
| 889 | 879 | /* Scroll layers */ |
| 890 | | layer0_scrollx = kaneko16_layers_0_regs[ 2 ]; |
| 891 | | layer0_scrolly = kaneko16_layers_0_regs[ 3 ] >> 6; |
| 892 | | layer1_scrollx = kaneko16_layers_0_regs[ 0 ]; |
| 893 | | layer1_scrolly = kaneko16_layers_0_regs[ 1 ] >> 6; |
| 880 | layer0_scrollx = state->m_layers_0_regs[ 2 ]; |
| 881 | layer0_scrolly = state->m_layers_0_regs[ 3 ] >> 6; |
| 882 | layer1_scrollx = state->m_layers_0_regs[ 0 ]; |
| 883 | layer1_scrolly = state->m_layers_0_regs[ 1 ] >> 6; |
| 894 | 884 | |
| 895 | | tilemap_set_scrolly(kaneko16_tmap_0,0,layer0_scrolly); |
| 896 | | tilemap_set_scrolly(kaneko16_tmap_1,0,layer1_scrolly); |
| 885 | tilemap_set_scrolly(state->m_tmap[0],0,layer0_scrolly); |
| 886 | tilemap_set_scrolly(state->m_tmap[1],0,layer1_scrolly); |
| 897 | 887 | |
| 898 | 888 | for (i=0; i<0x200; i++) |
| 899 | 889 | { |
| 900 | 890 | UINT16 scroll; |
| 901 | | scroll = (layers_flip_0 & 0x0800) ? kaneko16_vscroll_0[i] : 0; |
| 902 | | tilemap_set_scrollx(kaneko16_tmap_0,i,(layer0_scrollx + scroll) >> 6 ); |
| 903 | | scroll = (layers_flip_0 & 0x0008) ? kaneko16_vscroll_1[i] : 0; |
| 904 | | tilemap_set_scrollx(kaneko16_tmap_1,i,(layer1_scrollx + scroll) >> 6 ); |
| 891 | scroll = (layers_flip_0 & 0x0800) ? state->m_vscroll[0][i] : 0; |
| 892 | tilemap_set_scrollx(state->m_tmap[0],i,(layer0_scrollx + scroll) >> 6 ); |
| 893 | scroll = (layers_flip_0 & 0x0008) ? state->m_vscroll[1][i] : 0; |
| 894 | tilemap_set_scrollx(state->m_tmap[1],i,(layer1_scrollx + scroll) >> 6 ); |
| 905 | 895 | } |
| 906 | 896 | |
| 907 | 897 | } |
| 908 | 898 | |
| 909 | 899 | static void kaneko16_prepare_second_tilemap_chip(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 910 | 900 | { |
| 901 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 911 | 902 | /* Set Up SECOND Tilemap chip */ |
| 912 | 903 | int layers_flip_1 = 0; |
| 913 | 904 | UINT16 layer0_scrollx, layer0_scrolly; |
| 914 | 905 | UINT16 layer1_scrollx, layer1_scrolly; |
| 915 | 906 | int i; |
| 916 | 907 | |
| 917 | | if (kaneko16_tmap_2) |
| 908 | if (state->m_tmap[2]) |
| 918 | 909 | { |
| 919 | | layers_flip_1 = kaneko16_layers_1_regs[ 4 ]; |
| 910 | layers_flip_1 = state->m_layers_1_regs[ 4 ]; |
| 920 | 911 | |
| 921 | | tilemap_set_enable(kaneko16_tmap_2, ~layers_flip_1 & 0x1000); |
| 922 | | tilemap_set_enable(kaneko16_tmap_3, ~layers_flip_1 & 0x0010); |
| 912 | tilemap_set_enable(state->m_tmap[2], ~layers_flip_1 & 0x1000); |
| 913 | tilemap_set_enable(state->m_tmap[3], ~layers_flip_1 & 0x0010); |
| 923 | 914 | |
| 924 | | tilemap_set_flip(kaneko16_tmap_2, ((layers_flip_1 & 0x0100) ? TILEMAP_FLIPY : 0) | |
| 915 | tilemap_set_flip(state->m_tmap[2], ((layers_flip_1 & 0x0100) ? TILEMAP_FLIPY : 0) | |
| 925 | 916 | ((layers_flip_1 & 0x0200) ? TILEMAP_FLIPX : 0) ); |
| 926 | | tilemap_set_flip(kaneko16_tmap_3, ((layers_flip_1 & 0x0100) ? TILEMAP_FLIPY : 0) | |
| 917 | tilemap_set_flip(state->m_tmap[3], ((layers_flip_1 & 0x0100) ? TILEMAP_FLIPY : 0) | |
| 927 | 918 | ((layers_flip_1 & 0x0200) ? TILEMAP_FLIPX : 0) ); |
| 928 | 919 | |
| 929 | | layer0_scrollx = kaneko16_layers_1_regs[ 2 ]; |
| 930 | | layer0_scrolly = kaneko16_layers_1_regs[ 3 ] >> 6; |
| 931 | | layer1_scrollx = kaneko16_layers_1_regs[ 0 ]; |
| 932 | | layer1_scrolly = kaneko16_layers_1_regs[ 1 ] >> 6; |
| 920 | layer0_scrollx = state->m_layers_1_regs[ 2 ]; |
| 921 | layer0_scrolly = state->m_layers_1_regs[ 3 ] >> 6; |
| 922 | layer1_scrollx = state->m_layers_1_regs[ 0 ]; |
| 923 | layer1_scrolly = state->m_layers_1_regs[ 1 ] >> 6; |
| 933 | 924 | |
| 934 | | tilemap_set_scrolly(kaneko16_tmap_2,0,layer0_scrolly); |
| 935 | | tilemap_set_scrolly(kaneko16_tmap_3,0,layer1_scrolly); |
| 925 | tilemap_set_scrolly(state->m_tmap[2],0,layer0_scrolly); |
| 926 | tilemap_set_scrolly(state->m_tmap[3],0,layer1_scrolly); |
| 936 | 927 | |
| 937 | 928 | for (i=0; i<0x200; i++) |
| 938 | 929 | { |
| 939 | 930 | UINT16 scroll; |
| 940 | | scroll = (layers_flip_1 & 0x0800) ? kaneko16_vscroll_2[i] : 0; |
| 941 | | tilemap_set_scrollx(kaneko16_tmap_2,i,(layer0_scrollx + scroll) >> 6 ); |
| 942 | | scroll = (layers_flip_1 & 0x0008) ? kaneko16_vscroll_3[i] : 0; |
| 943 | | tilemap_set_scrollx(kaneko16_tmap_3,i,(layer1_scrollx + scroll) >> 6 ); |
| 931 | scroll = (layers_flip_1 & 0x0800) ? state->m_vscroll[2][i] : 0; |
| 932 | tilemap_set_scrollx(state->m_tmap[2],i,(layer0_scrollx + scroll) >> 6 ); |
| 933 | scroll = (layers_flip_1 & 0x0008) ? state->m_vscroll[3][i] : 0; |
| 934 | tilemap_set_scrollx(state->m_tmap[3],i,(layer1_scrollx + scroll) >> 6 ); |
| 944 | 935 | } |
| 945 | 936 | } |
| 946 | 937 | } |
| 947 | 938 | |
| 948 | 939 | static void kaneko16_render_first_tilemap_chip(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int pri) |
| 949 | 940 | { |
| 950 | | tilemap_draw_primask(bitmap,cliprect, kaneko16_tmap_0, pri, pri, 0); |
| 951 | | tilemap_draw_primask(bitmap,cliprect, kaneko16_tmap_1, pri, pri, 0); |
| 941 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 942 | tilemap_draw_primask(bitmap,cliprect, state->m_tmap[0], pri, pri, 0); |
| 943 | tilemap_draw_primask(bitmap,cliprect, state->m_tmap[1], pri, pri, 0); |
| 952 | 944 | } |
| 953 | 945 | |
| 954 | 946 | static void kaneko16_render_second_tilemap_chip(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int pri) |
| 955 | 947 | { |
| 956 | | if (kaneko16_tmap_2) |
| 948 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 949 | if (state->m_tmap[2]) |
| 957 | 950 | { |
| 958 | | tilemap_draw_primask(bitmap,cliprect, kaneko16_tmap_2, pri, kaneko16_priority.VIEW2_2_pri ? pri : 0, 0); |
| 959 | | tilemap_draw_primask(bitmap,cliprect, kaneko16_tmap_3, pri, kaneko16_priority.VIEW2_2_pri ? pri : 0, 0); |
| 951 | tilemap_draw_primask(bitmap,cliprect, state->m_tmap[2], pri, state->m_priority.VIEW2_2_pri ? pri : 0, 0); |
| 952 | tilemap_draw_primask(bitmap,cliprect, state->m_tmap[3], pri, state->m_priority.VIEW2_2_pri ? pri : 0, 0); |
| 960 | 953 | } |
| 961 | 954 | } |
| 962 | 955 | |
| 963 | 956 | static void kaneko16_render_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 964 | 957 | { |
| 958 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 965 | 959 | /* Sprites last (rendered with pdrawgfx, so they can slip |
| 966 | 960 | in between the layers) */ |
| 967 | 961 | |
| 968 | | if(kaneko16_keep_sprites) |
| 962 | if(state->m_keep_sprites) |
| 969 | 963 | { |
| 970 | 964 | /* keep sprites on screen */ |
| 971 | | kaneko16_draw_sprites(machine,sprites_bitmap,cliprect); |
| 972 | | copybitmap_trans(bitmap,sprites_bitmap,0,0,0,0,cliprect,0); |
| 965 | kaneko16_draw_sprites(machine,state->m_sprites_bitmap,cliprect); |
| 966 | copybitmap_trans(bitmap,state->m_sprites_bitmap,0,0,0,0,cliprect,0); |
| 973 | 967 | } |
| 974 | 968 | else |
| 975 | 969 | { |
| 976 | | bitmap_fill(sprites_bitmap,cliprect,0); |
| 970 | bitmap_fill(state->m_sprites_bitmap,cliprect,0); |
| 977 | 971 | kaneko16_draw_sprites(machine,bitmap,cliprect); |
| 978 | 972 | } |
| 979 | 973 | } |
| 980 | 974 | |
| 981 | 975 | static void kaneko16_render_15bpp_bitmap(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 982 | 976 | { |
| 983 | | if (kaneko16_bg15_bitmap) |
| 977 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 978 | if (state->m_bg15_bitmap) |
| 984 | 979 | { |
| 985 | | int select = kaneko16_bg15_select[ 0 ]; |
| 986 | | // int reg = kaneko16_bg15_reg[ 0 ]; |
| 980 | int select = state->m_bg15_select[ 0 ]; |
| 981 | // int reg = state->m_bg15_reg[ 0 ]; |
| 987 | 982 | int flip = select & 0x20; |
| 988 | 983 | int sx, sy; |
| 989 | 984 | |
| r11160 | r11161 | |
| 992 | 987 | sx = (select & 0x1f) * 256; |
| 993 | 988 | sy = 0; |
| 994 | 989 | |
| 995 | | copybitmap(bitmap, kaneko16_bg15_bitmap, flip, flip, -sx, -sy, cliprect); |
| 990 | copybitmap(bitmap, state->m_bg15_bitmap, flip, flip, -sx, -sy, cliprect); |
| 996 | 991 | |
| 997 | 992 | // flag = 0; |
| 998 | 993 | } |
| r11160 | r11161 | |
| 1000 | 995 | |
| 1001 | 996 | static void kaneko16_fill_bitmap(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 1002 | 997 | { |
| 1003 | | if(kaneko16_sprite_type == 1) |
| 998 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 999 | if(state->m_sprite_type == 1) |
| 1004 | 1000 | bitmap_fill(bitmap,cliprect,0x7f00); |
| 1005 | 1001 | else |
| 1006 | 1002 | /* Fill the bitmap with pen 0. This is wrong, but will work most of |
| r11160 | r11161 | |
| 1029 | 1025 | |
| 1030 | 1026 | SCREEN_UPDATE(berlwall) |
| 1031 | 1027 | { |
| 1028 | kaneko16_state *state = screen->machine().driver_data<kaneko16_state>(); |
| 1032 | 1029 | // berlwall uses a 15bpp bitmap as a bg, not a solid fill |
| 1033 | 1030 | kaneko16_render_15bpp_bitmap(screen->machine(),bitmap,cliprect); |
| 1034 | 1031 | |
| 1035 | 1032 | // if the display is disabled, do nothing? |
| 1036 | | if (!kaneko16_disp_enable) return 0; |
| 1033 | if (!state->m_disp_enable) return 0; |
| 1037 | 1034 | |
| 1038 | 1035 | SCREEN_UPDATE_CALL(common); |
| 1039 | 1036 | kaneko16_render_sprites(screen->machine(),bitmap,cliprect); |
| r11160 | r11161 | |
| 1043 | 1040 | |
| 1044 | 1041 | SCREEN_UPDATE( jchan_view2 ) |
| 1045 | 1042 | { |
| 1043 | kaneko16_state *state = screen->machine().driver_data<kaneko16_state>(); |
| 1046 | 1044 | int dx,dy; |
| 1047 | 1045 | |
| 1048 | 1046 | SCREEN_UPDATE_CALL(common); |
| r11160 | r11161 | |
| 1050 | 1048 | /* override the offsets set in common - tuned to char select in jchan2 */ |
| 1051 | 1049 | dx = 25;dy = 11; |
| 1052 | 1050 | |
| 1053 | | tilemap_set_scrolldx( kaneko16_tmap_0, -dx, 320 + dx -1 ); |
| 1054 | | tilemap_set_scrolldx( kaneko16_tmap_1, -(dx+2), 320 + (dx + 2) - 1 ); |
| 1051 | tilemap_set_scrolldx( state->m_tmap[0], -dx, 320 + dx -1 ); |
| 1052 | tilemap_set_scrolldx( state->m_tmap[1], -(dx+2), 320 + (dx + 2) - 1 ); |
| 1055 | 1053 | |
| 1056 | | tilemap_set_scrolldy( kaneko16_tmap_0, -dy, 240 + dy -1 ); |
| 1057 | | tilemap_set_scrolldy( kaneko16_tmap_1, -dy, 240 + dy -1 ); |
| 1054 | tilemap_set_scrolldy( state->m_tmap[0], -dy, 240 + dy -1 ); |
| 1055 | tilemap_set_scrolldy( state->m_tmap[1], -dy, 240 + dy -1 ); |
| 1058 | 1056 | |
| 1059 | 1057 | return 0; |
| 1060 | 1058 | } |
| r11160 | r11161 | |
| 1062 | 1060 | |
| 1063 | 1061 | SCREEN_UPDATE( kaneko16 ) |
| 1064 | 1062 | { |
| 1063 | kaneko16_state *state = screen->machine().driver_data<kaneko16_state>(); |
| 1065 | 1064 | kaneko16_fill_bitmap(screen->machine(),bitmap,cliprect); |
| 1066 | 1065 | |
| 1067 | 1066 | // if the display is disabled, do nothing? |
| 1068 | | if (!kaneko16_disp_enable) return 0; |
| 1067 | if (!state->m_disp_enable) return 0; |
| 1069 | 1068 | |
| 1070 | 1069 | SCREEN_UPDATE_CALL(common); |
| 1071 | 1070 | kaneko16_render_sprites(screen->machine(),bitmap,cliprect); |
| r11160 | r11161 | |
| 1074 | 1073 | |
| 1075 | 1074 | SCREEN_UPDATE( galsnew ) |
| 1076 | 1075 | { |
| 1076 | kaneko16_state *state = screen->machine().driver_data<kaneko16_state>(); |
| 1077 | 1077 | // kaneko16_fill_bitmap(screen->machine(),bitmap,cliprect); |
| 1078 | 1078 | int y,x; |
| 1079 | 1079 | int count; |
| r11160 | r11161 | |
| 1086 | 1086 | |
| 1087 | 1087 | for (x=0;x<256;x++) |
| 1088 | 1088 | { |
| 1089 | | UINT16 dat = (galsnew_fg_pixram[count] & 0xfffe)>>1; |
| 1089 | UINT16 dat = (state->m_galsnew_fg_pixram[count] & 0xfffe)>>1; |
| 1090 | 1090 | dat+=2048; |
| 1091 | 1091 | dest[x] = dat; |
| 1092 | 1092 | count++; |
| r11160 | r11161 | |
| 1100 | 1100 | |
| 1101 | 1101 | for (x=0;x<256;x++) |
| 1102 | 1102 | { |
| 1103 | | UINT16 dat = (galsnew_bg_pixram[count]); |
| 1103 | UINT16 dat = (state->m_galsnew_bg_pixram[count]); |
| 1104 | 1104 | //dat &=0x3ff; |
| 1105 | 1105 | if (dat) |
| 1106 | 1106 | dest[x] = dat; |
| r11160 | r11161 | |
| 1111 | 1111 | |
| 1112 | 1112 | |
| 1113 | 1113 | // if the display is disabled, do nothing? |
| 1114 | | if (!kaneko16_disp_enable) return 0; |
| 1114 | if (!state->m_disp_enable) return 0; |
| 1115 | 1115 | |
| 1116 | 1116 | SCREEN_UPDATE_CALL(common); |
| 1117 | 1117 | |
| r11160 | r11161 | |
| 1122 | 1122 | |
| 1123 | 1123 | SCREEN_UPDATE( sandscrp ) |
| 1124 | 1124 | { |
| 1125 | kaneko16_state *state = screen->machine().driver_data<kaneko16_state>(); |
| 1125 | 1126 | device_t *pandora = screen->machine().device("pandora"); |
| 1126 | 1127 | kaneko16_fill_bitmap(screen->machine(),bitmap,cliprect); |
| 1127 | 1128 | |
| 1128 | 1129 | // if the display is disabled, do nothing? |
| 1129 | | if (!kaneko16_disp_enable) return 0; |
| 1130 | if (!state->m_disp_enable) return 0; |
| 1130 | 1131 | |
| 1131 | 1132 | SCREEN_UPDATE_CALL(common); |
| 1132 | 1133 | |
src/mame/video/galaxian.c
| r11160 | r11161 | |
| 230 | 230 | |
| 231 | 231 | /************************************* |
| 232 | 232 | * |
| 233 | | * Global variables |
| 234 | | * |
| 235 | | *************************************/ |
| 236 | | |
| 237 | | /* rendering callbacks */ |
| 238 | | galaxian_draw_bullet_func galaxian_draw_bullet_ptr; |
| 239 | | galaxian_draw_background_func galaxian_draw_background_ptr; |
| 240 | | |
| 241 | | /* tile/sprite modification callbacks */ |
| 242 | | galaxian_extend_tile_info_func galaxian_extend_tile_info_ptr; |
| 243 | | galaxian_extend_sprite_info_func galaxian_extend_sprite_info_ptr; |
| 244 | | |
| 245 | | /* global tweaks */ |
| 246 | | UINT8 galaxian_frogger_adjust; |
| 247 | | UINT8 galaxian_sfx_tilemap; |
| 248 | | |
| 249 | | |
| 250 | | |
| 251 | | /************************************* |
| 252 | | * |
| 253 | | * Local variables |
| 254 | | * |
| 255 | | *************************************/ |
| 256 | | |
| 257 | | static tilemap_t *bg_tilemap; |
| 258 | | |
| 259 | | static UINT8 flipscreen_x; |
| 260 | | static UINT8 flipscreen_y; |
| 261 | | |
| 262 | | static UINT8 background_enable; |
| 263 | | static UINT8 background_red; |
| 264 | | static UINT8 background_green; |
| 265 | | static UINT8 background_blue; |
| 266 | | |
| 267 | | static UINT32 star_rng_origin; |
| 268 | | static UINT32 star_rng_origin_frame; |
| 269 | | static rgb_t star_color[64]; |
| 270 | | static UINT8 *stars; |
| 271 | | static UINT8 stars_enabled; |
| 272 | | static UINT8 stars_blink_state; |
| 273 | | |
| 274 | | static rgb_t bullet_color[8]; |
| 275 | | |
| 276 | | static UINT8 gfxbank[5]; |
| 277 | | |
| 278 | | |
| 279 | | |
| 280 | | /************************************* |
| 281 | | * |
| 282 | 233 | * Function prototypes |
| 283 | 234 | * |
| 284 | 235 | *************************************/ |
| r11160 | r11161 | |
| 290 | 241 | |
| 291 | 242 | static void stars_init(running_machine &machine); |
| 292 | 243 | static void stars_update_origin(running_machine &machine); |
| 293 | | static void stars_draw_row(bitmap_t *bitmap, int maxx, int y, UINT32 star_offs, UINT8 starmask); |
| 244 | static void stars_draw_row(galaxian_state *state, bitmap_t *bitmap, int maxx, int y, UINT32 star_offs, UINT8 starmask); |
| 294 | 245 | |
| 295 | 246 | static void bullets_draw(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT8 *base); |
| 296 | 247 | |
| r11160 | r11161 | |
| 304 | 255 | |
| 305 | 256 | PALETTE_INIT( galaxian ) |
| 306 | 257 | { |
| 258 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 307 | 259 | static const int rgb_resistances[3] = { 1000, 470, 220 }; |
| 308 | 260 | double rweights[3], gweights[3], bweights[2]; |
| 309 | 261 | int i, minval, midval, maxval, len; |
| r11160 | r11161 | |
| 412 | 364 | b = starmap[(bit1 << 1) | bit0]; |
| 413 | 365 | |
| 414 | 366 | /* set the RGB color */ |
| 415 | | star_color[i] = MAKE_RGB(r, g, b); |
| 367 | state->m_star_color[i] = MAKE_RGB(r, g, b); |
| 416 | 368 | } |
| 417 | 369 | |
| 418 | 370 | /* default bullet colors are white for the first 7, and yellow for the last one */ |
| 419 | 371 | for (i = 0; i < 7; i++) |
| 420 | | bullet_color[i] = MAKE_RGB(0xff,0xff,0xff); |
| 421 | | bullet_color[7] = MAKE_RGB(0xff,0xff,0x00); |
| 372 | state->m_bullet_color[i] = MAKE_RGB(0xff,0xff,0xff); |
| 373 | state->m_bullet_color[7] = MAKE_RGB(0xff,0xff,0x00); |
| 422 | 374 | } |
| 423 | 375 | |
| 424 | 376 | PALETTE_INIT( moonwar ) |
| 425 | 377 | { |
| 378 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 426 | 379 | PALETTE_INIT_CALL(galaxian); |
| 427 | 380 | |
| 428 | 381 | /* wire mod to connect the bullet blue output to the 220 ohm resistor */ |
| 429 | | bullet_color[7] = MAKE_RGB(0xef,0xef,0x97); |
| 382 | state->m_bullet_color[7] = MAKE_RGB(0xef,0xef,0x97); |
| 430 | 383 | } |
| 431 | 384 | |
| 432 | 385 | /************************************* |
| r11160 | r11161 | |
| 437 | 390 | |
| 438 | 391 | VIDEO_START( galaxian ) |
| 439 | 392 | { |
| 393 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 440 | 394 | /* create a tilemap for the background */ |
| 441 | | if (!galaxian_sfx_tilemap) |
| 395 | if (!state->m_sfx_tilemap) |
| 442 | 396 | { |
| 443 | 397 | /* normal galaxian hardware is row-based and individually scrolling columns */ |
| 444 | | bg_tilemap = tilemap_create(machine, bg_get_tile_info, tilemap_scan_rows, GALAXIAN_XSCALE*8,8, 32,32); |
| 445 | | tilemap_set_scroll_cols(bg_tilemap, 32); |
| 446 | | tilemap_set_scrolldx(bg_tilemap, 0, -GALAXIAN_XSCALE * 128); |
| 447 | | tilemap_set_scrolldy(bg_tilemap, 0, 8); |
| 398 | state->m_bg_tilemap = tilemap_create(machine, bg_get_tile_info, tilemap_scan_rows, GALAXIAN_XSCALE*8,8, 32,32); |
| 399 | tilemap_set_scroll_cols(state->m_bg_tilemap, 32); |
| 400 | tilemap_set_scrolldx(state->m_bg_tilemap, 0, -GALAXIAN_XSCALE * 128); |
| 401 | tilemap_set_scrolldy(state->m_bg_tilemap, 0, 8); |
| 448 | 402 | } |
| 449 | 403 | else |
| 450 | 404 | { |
| 451 | 405 | /* sfx hardware is column-based and individually scrolling rows */ |
| 452 | | bg_tilemap = tilemap_create(machine, bg_get_tile_info, tilemap_scan_cols, GALAXIAN_XSCALE*8,8, 32,32); |
| 453 | | tilemap_set_scroll_rows(bg_tilemap, 32); |
| 454 | | tilemap_set_scrolldx(bg_tilemap, 0, -GALAXIAN_XSCALE * 128); |
| 455 | | tilemap_set_scrolldy(bg_tilemap, 0, 8); |
| 406 | state->m_bg_tilemap = tilemap_create(machine, bg_get_tile_info, tilemap_scan_cols, GALAXIAN_XSCALE*8,8, 32,32); |
| 407 | tilemap_set_scroll_rows(state->m_bg_tilemap, 32); |
| 408 | tilemap_set_scrolldx(state->m_bg_tilemap, 0, -GALAXIAN_XSCALE * 128); |
| 409 | tilemap_set_scrolldy(state->m_bg_tilemap, 0, 8); |
| 456 | 410 | } |
| 457 | | tilemap_set_transparent_pen(bg_tilemap, 0); |
| 411 | tilemap_set_transparent_pen(state->m_bg_tilemap, 0); |
| 458 | 412 | |
| 459 | 413 | /* initialize globals */ |
| 460 | | flipscreen_x = 0; |
| 461 | | flipscreen_y = 0; |
| 462 | | background_enable = 0; |
| 463 | | background_blue = 0; |
| 464 | | background_red = 0; |
| 465 | | background_green = 0; |
| 414 | state->m_flipscreen_x = 0; |
| 415 | state->m_flipscreen_y = 0; |
| 416 | state->m_background_enable = 0; |
| 417 | state->m_background_blue = 0; |
| 418 | state->m_background_red = 0; |
| 419 | state->m_background_green = 0; |
| 466 | 420 | |
| 467 | 421 | /* initialize stars */ |
| 468 | 422 | stars_init(machine); |
| r11160 | r11161 | |
| 474 | 428 | |
| 475 | 429 | static void state_save_register(running_machine &machine) |
| 476 | 430 | { |
| 477 | | state_save_register_global(machine, flipscreen_x); |
| 478 | | state_save_register_global(machine, flipscreen_y); |
| 479 | | state_save_register_global(machine, background_enable); |
| 480 | | state_save_register_global(machine, background_red); |
| 481 | | state_save_register_global(machine, background_green); |
| 482 | | state_save_register_global(machine, background_blue); |
| 431 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 432 | state_save_register_global(machine, state->m_flipscreen_x); |
| 433 | state_save_register_global(machine, state->m_flipscreen_y); |
| 434 | state_save_register_global(machine, state->m_background_enable); |
| 435 | state_save_register_global(machine, state->m_background_red); |
| 436 | state_save_register_global(machine, state->m_background_green); |
| 437 | state_save_register_global(machine, state->m_background_blue); |
| 483 | 438 | |
| 484 | | state_save_register_global_array(machine, gfxbank); |
| 439 | state_save_register_global_array(machine, state->m_gfxbank); |
| 485 | 440 | |
| 486 | | state_save_register_global(machine, stars_enabled); |
| 487 | | state_save_register_global(machine, star_rng_origin); |
| 488 | | state_save_register_global(machine, star_rng_origin_frame); |
| 489 | | state_save_register_global(machine, stars_blink_state); |
| 441 | state_save_register_global(machine, state->m_stars_enabled); |
| 442 | state_save_register_global(machine, state->m_star_rng_origin); |
| 443 | state_save_register_global(machine, state->m_star_rng_origin_frame); |
| 444 | state_save_register_global(machine, state->m_stars_blink_state); |
| 490 | 445 | } |
| 491 | 446 | |
| 492 | 447 | |
| r11160 | r11161 | |
| 499 | 454 | |
| 500 | 455 | SCREEN_UPDATE( galaxian ) |
| 501 | 456 | { |
| 457 | galaxian_state *state = screen->machine().driver_data<galaxian_state>(); |
| 502 | 458 | /* draw the background layer (including stars) */ |
| 503 | | (*galaxian_draw_background_ptr)(screen->machine(), bitmap, cliprect); |
| 459 | (*state->m_draw_background_ptr)(screen->machine(), bitmap, cliprect); |
| 504 | 460 | |
| 505 | 461 | /* draw the tilemap characters over top */ |
| 506 | | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); |
| 462 | tilemap_draw(bitmap, cliprect, state->m_bg_tilemap, 0, 0); |
| 507 | 463 | |
| 508 | 464 | /* render the sprites next */ |
| 509 | 465 | sprites_draw(screen->machine(), bitmap, cliprect, &screen->machine().generic.spriteram.u8[0x40]); |
| 510 | 466 | |
| 511 | 467 | /* if we have bullets to draw, render them following */ |
| 512 | | if (galaxian_draw_bullet_ptr != NULL) |
| 468 | if (state->m_draw_bullet_ptr != NULL) |
| 513 | 469 | bullets_draw(screen->machine(), bitmap, cliprect, &screen->machine().generic.spriteram.u8[0x60]); |
| 514 | 470 | |
| 515 | 471 | return 0; |
| r11160 | r11161 | |
| 544 | 500 | UINT8 attrib = machine.generic.spriteram.u8[x*2+1]; |
| 545 | 501 | UINT8 color = attrib & 7; |
| 546 | 502 | |
| 547 | | if (galaxian_extend_tile_info_ptr != NULL) |
| 548 | | (*galaxian_extend_tile_info_ptr)(&code, &color, attrib, x); |
| 503 | if (state->m_extend_tile_info_ptr != NULL) |
| 504 | (*state->m_extend_tile_info_ptr)(machine, &code, &color, attrib, x); |
| 549 | 505 | |
| 550 | 506 | SET_TILE_INFO(0, code, color, 0); |
| 551 | 507 | } |
| r11160 | r11161 | |
| 560 | 516 | |
| 561 | 517 | /* store the data and mark the corresponding tile dirty */ |
| 562 | 518 | videoram[offset] = data; |
| 563 | | tilemap_mark_tile_dirty(bg_tilemap, offset); |
| 519 | tilemap_mark_tile_dirty(state->m_bg_tilemap, offset); |
| 564 | 520 | } |
| 565 | 521 | |
| 566 | 522 | |
| 567 | 523 | WRITE8_HANDLER( galaxian_objram_w ) |
| 568 | 524 | { |
| 525 | galaxian_state *state = space->machine().driver_data<galaxian_state>(); |
| 569 | 526 | /* update any video up to the current scanline */ |
| 570 | 527 | space->machine().primary_screen->update_now(); |
| 571 | 528 | |
| r11160 | r11161 | |
| 579 | 536 | if ((offset & 0x01) == 0) |
| 580 | 537 | { |
| 581 | 538 | /* Frogger: top and bottom 4 bits swapped entering the adder */ |
| 582 | | if (galaxian_frogger_adjust) |
| 539 | if (state->m_frogger_adjust) |
| 583 | 540 | data = (data >> 4) | (data << 4); |
| 584 | | if (!galaxian_sfx_tilemap) |
| 585 | | tilemap_set_scrolly(bg_tilemap, offset >> 1, data); |
| 541 | if (!state->m_sfx_tilemap) |
| 542 | tilemap_set_scrolly(state->m_bg_tilemap, offset >> 1, data); |
| 586 | 543 | else |
| 587 | | tilemap_set_scrollx(bg_tilemap, offset >> 1, GALAXIAN_XSCALE*data); |
| 544 | tilemap_set_scrollx(state->m_bg_tilemap, offset >> 1, GALAXIAN_XSCALE*data); |
| 588 | 545 | } |
| 589 | 546 | |
| 590 | 547 | /* odd entries control the color base for the row */ |
| 591 | 548 | else |
| 592 | 549 | { |
| 593 | 550 | for (offset >>= 1; offset < 0x0400; offset += 32) |
| 594 | | tilemap_mark_tile_dirty(bg_tilemap, offset); |
| 551 | tilemap_mark_tile_dirty(state->m_bg_tilemap, offset); |
| 595 | 552 | } |
| 596 | 553 | } |
| 597 | 554 | } |
| r11160 | r11161 | |
| 606 | 563 | |
| 607 | 564 | static void sprites_draw(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT8 *spritebase) |
| 608 | 565 | { |
| 566 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 609 | 567 | rectangle clip = *cliprect; |
| 610 | 568 | int sprnum; |
| 611 | 569 | |
| 612 | 570 | /* 16 of the 256 pixels of the sprites are hard-clipped at the line buffer */ |
| 613 | 571 | /* according to the schematics, it should be the first 16 pixels */ |
| 614 | | clip.min_x = MAX(clip.min_x, (!flipscreen_x) * 16 * GALAXIAN_XSCALE); |
| 615 | | clip.max_x = MIN(clip.max_x, (256 - flipscreen_x * 16) * GALAXIAN_XSCALE - 1); |
| 572 | clip.min_x = MAX(clip.min_x, (!state->m_flipscreen_x) * 16 * GALAXIAN_XSCALE); |
| 573 | clip.max_x = MIN(clip.max_x, (256 - state->m_flipscreen_x * 16) * GALAXIAN_XSCALE - 1); |
| 616 | 574 | |
| 617 | 575 | /* The line buffer is only written if it contains a '0' currently; */ |
| 618 | 576 | /* it is cleared during the visible area, and populated during HBLANK */ |
| r11160 | r11161 | |
| 622 | 580 | { |
| 623 | 581 | const UINT8 *base = &spritebase[sprnum * 4]; |
| 624 | 582 | /* Frogger: top and bottom 4 bits swapped entering the adder */ |
| 625 | | UINT8 base0 = galaxian_frogger_adjust ? ((base[0] >> 4) | (base[0] << 4)) : base[0]; |
| 583 | UINT8 base0 = state->m_frogger_adjust ? ((base[0] >> 4) | (base[0] << 4)) : base[0]; |
| 626 | 584 | /* the first three sprites match against y-1 */ |
| 627 | 585 | UINT8 sy = 240 - (base0 - (sprnum < 3)); |
| 628 | 586 | UINT16 code = base[1] & 0x3f; |
| r11160 | r11161 | |
| 632 | 590 | UINT8 sx = base[3] + 1; |
| 633 | 591 | |
| 634 | 592 | /* extend the sprite information */ |
| 635 | | if (galaxian_extend_sprite_info_ptr != NULL) |
| 636 | | (*galaxian_extend_sprite_info_ptr)(base, &sx, &sy, &flipx, &flipy, &code, &color); |
| 593 | if (state->m_extend_sprite_info_ptr != NULL) |
| 594 | (*state->m_extend_sprite_info_ptr)(machine, base, &sx, &sy, &flipx, &flipy, &code, &color); |
| 637 | 595 | |
| 638 | 596 | /* apply flipscreen in X direction */ |
| 639 | | if (flipscreen_x) |
| 597 | if (state->m_flipscreen_x) |
| 640 | 598 | { |
| 641 | 599 | sx = 240 - sx; |
| 642 | 600 | flipx = !flipx; |
| 643 | 601 | } |
| 644 | 602 | |
| 645 | 603 | /* apply flipscreen in Y direction */ |
| 646 | | if (flipscreen_y) |
| 604 | if (state->m_flipscreen_y) |
| 647 | 605 | { |
| 648 | 606 | sy = 240 - sy; |
| 649 | 607 | flipy = !flipy; |
| r11160 | r11161 | |
| 668 | 626 | |
| 669 | 627 | static void bullets_draw(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT8 *base) |
| 670 | 628 | { |
| 629 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 671 | 630 | int y; |
| 672 | 631 | |
| 673 | 632 | /* iterate over scanlines */ |
| r11160 | r11161 | |
| 678 | 637 | int which; |
| 679 | 638 | |
| 680 | 639 | /* the first 3 entries match Y-1 */ |
| 681 | | effy = flipscreen_y ? ((y - 1) ^ 255) : (y - 1); |
| 640 | effy = state->m_flipscreen_y ? ((y - 1) ^ 255) : (y - 1); |
| 682 | 641 | for (which = 0; which < 3; which++) |
| 683 | 642 | if ((UINT8)(base[which*4+1] + effy) == 0xff) |
| 684 | 643 | shell = which; |
| 685 | 644 | |
| 686 | 645 | /* remaining entries match Y */ |
| 687 | | effy = flipscreen_y ? (y ^ 255) : y; |
| 646 | effy = state->m_flipscreen_y ? (y ^ 255) : y; |
| 688 | 647 | for (which = 3; which < 8; which++) |
| 689 | 648 | if ((UINT8)(base[which*4+1] + effy) == 0xff) |
| 690 | 649 | { |
| r11160 | r11161 | |
| 696 | 655 | |
| 697 | 656 | /* draw the shell */ |
| 698 | 657 | if (shell != 0xff) |
| 699 | | (*galaxian_draw_bullet_ptr)(machine, bitmap, cliprect, shell, 255 - base[shell*4+3], y); |
| 658 | (*state->m_draw_bullet_ptr)(machine, bitmap, cliprect, shell, 255 - base[shell*4+3], y); |
| 700 | 659 | if (missile != 0xff) |
| 701 | | (*galaxian_draw_bullet_ptr)(machine, bitmap, cliprect, missile, 255 - base[missile*4+3], y); |
| 660 | (*state->m_draw_bullet_ptr)(machine, bitmap, cliprect, missile, 255 - base[missile*4+3], y); |
| 702 | 661 | } |
| 703 | 662 | } |
| 704 | 663 | |
| r11160 | r11161 | |
| 712 | 671 | |
| 713 | 672 | WRITE8_HANDLER( galaxian_flip_screen_x_w ) |
| 714 | 673 | { |
| 715 | | if (flipscreen_x != (data & 0x01)) |
| 674 | galaxian_state *state = space->machine().driver_data<galaxian_state>(); |
| 675 | if (state->m_flipscreen_x != (data & 0x01)) |
| 716 | 676 | { |
| 717 | 677 | space->machine().primary_screen->update_now(); |
| 718 | 678 | |
| r11160 | r11161 | |
| 721 | 681 | /* frame before we flip */ |
| 722 | 682 | stars_update_origin(space->machine()); |
| 723 | 683 | |
| 724 | | flipscreen_x = data & 0x01; |
| 725 | | tilemap_set_flip(bg_tilemap, (flipscreen_x ? TILEMAP_FLIPX : 0) | (flipscreen_y ? TILEMAP_FLIPY : 0)); |
| 684 | state->m_flipscreen_x = data & 0x01; |
| 685 | tilemap_set_flip(state->m_bg_tilemap, (state->m_flipscreen_x ? TILEMAP_FLIPX : 0) | (state->m_flipscreen_y ? TILEMAP_FLIPY : 0)); |
| 726 | 686 | } |
| 727 | 687 | } |
| 728 | 688 | |
| 729 | 689 | WRITE8_HANDLER( galaxian_flip_screen_y_w ) |
| 730 | 690 | { |
| 731 | | if (flipscreen_y != (data & 0x01)) |
| 691 | galaxian_state *state = space->machine().driver_data<galaxian_state>(); |
| 692 | if (state->m_flipscreen_y != (data & 0x01)) |
| 732 | 693 | { |
| 733 | 694 | space->machine().primary_screen->update_now(); |
| 734 | | flipscreen_y = data & 0x01; |
| 735 | | tilemap_set_flip(bg_tilemap, (flipscreen_x ? TILEMAP_FLIPX : 0) | (flipscreen_y ? TILEMAP_FLIPY : 0)); |
| 695 | state->m_flipscreen_y = data & 0x01; |
| 696 | tilemap_set_flip(state->m_bg_tilemap, (state->m_flipscreen_x ? TILEMAP_FLIPX : 0) | (state->m_flipscreen_y ? TILEMAP_FLIPY : 0)); |
| 736 | 697 | } |
| 737 | 698 | } |
| 738 | 699 | |
| r11160 | r11161 | |
| 752 | 713 | |
| 753 | 714 | WRITE8_HANDLER( galaxian_stars_enable_w ) |
| 754 | 715 | { |
| 755 | | if ((stars_enabled ^ data) & 0x01) |
| 716 | galaxian_state *state = space->machine().driver_data<galaxian_state>(); |
| 717 | if ((state->m_stars_enabled ^ data) & 0x01) |
| 756 | 718 | space->machine().primary_screen->update_now(); |
| 757 | 719 | |
| 758 | | if (!stars_enabled && (data & 0x01)) |
| 720 | if (!state->m_stars_enabled && (data & 0x01)) |
| 759 | 721 | { |
| 760 | 722 | /* on the rising edge of this, the CLR on the shift registers is released */ |
| 761 | 723 | /* this resets the "origin" of this frame to 0 minus the number of clocks */ |
| 762 | 724 | /* we have counted so far */ |
| 763 | | star_rng_origin = STAR_RNG_PERIOD - (space->machine().primary_screen->vpos() * 512 + space->machine().primary_screen->hpos()); |
| 764 | | star_rng_origin_frame = space->machine().primary_screen->frame_number(); |
| 725 | state->m_star_rng_origin = STAR_RNG_PERIOD - (space->machine().primary_screen->vpos() * 512 + space->machine().primary_screen->hpos()); |
| 726 | state->m_star_rng_origin_frame = space->machine().primary_screen->frame_number(); |
| 765 | 727 | } |
| 766 | | stars_enabled = data & 0x01; |
| 728 | state->m_stars_enabled = data & 0x01; |
| 767 | 729 | } |
| 768 | 730 | |
| 769 | 731 | |
| 770 | 732 | WRITE8_HANDLER( scramble_background_enable_w ) |
| 771 | 733 | { |
| 772 | | if ((background_enable ^ data) & 0x01) |
| 734 | galaxian_state *state = space->machine().driver_data<galaxian_state>(); |
| 735 | if ((state->m_background_enable ^ data) & 0x01) |
| 773 | 736 | space->machine().primary_screen->update_now(); |
| 774 | 737 | |
| 775 | | background_enable = data & 0x01; |
| 738 | state->m_background_enable = data & 0x01; |
| 776 | 739 | } |
| 777 | 740 | |
| 778 | 741 | |
| 779 | 742 | WRITE8_HANDLER( scramble_background_red_w ) |
| 780 | 743 | { |
| 781 | | if ((background_red ^ data) & 0x01) |
| 744 | galaxian_state *state = space->machine().driver_data<galaxian_state>(); |
| 745 | if ((state->m_background_red ^ data) & 0x01) |
| 782 | 746 | space->machine().primary_screen->update_now(); |
| 783 | 747 | |
| 784 | | background_red = data & 0x01; |
| 748 | state->m_background_red = data & 0x01; |
| 785 | 749 | } |
| 786 | 750 | |
| 787 | 751 | |
| 788 | 752 | WRITE8_HANDLER( scramble_background_green_w ) |
| 789 | 753 | { |
| 790 | | if ((background_green ^ data) & 0x01) |
| 754 | galaxian_state *state = space->machine().driver_data<galaxian_state>(); |
| 755 | if ((state->m_background_green ^ data) & 0x01) |
| 791 | 756 | space->machine().primary_screen->update_now(); |
| 792 | 757 | |
| 793 | | background_green = data & 0x01; |
| 758 | state->m_background_green = data & 0x01; |
| 794 | 759 | } |
| 795 | 760 | |
| 796 | 761 | |
| 797 | 762 | WRITE8_HANDLER( scramble_background_blue_w ) |
| 798 | 763 | { |
| 799 | | if ((background_blue ^ data) & 0x01) |
| 764 | galaxian_state *state = space->machine().driver_data<galaxian_state>(); |
| 765 | if ((state->m_background_blue ^ data) & 0x01) |
| 800 | 766 | space->machine().primary_screen->update_now(); |
| 801 | 767 | |
| 802 | | background_blue = data & 0x01; |
| 768 | state->m_background_blue = data & 0x01; |
| 803 | 769 | } |
| 804 | 770 | |
| 805 | 771 | |
| r11160 | r11161 | |
| 812 | 778 | |
| 813 | 779 | WRITE8_HANDLER( galaxian_gfxbank_w ) |
| 814 | 780 | { |
| 815 | | if (gfxbank[offset] != data) |
| 781 | galaxian_state *state = space->machine().driver_data<galaxian_state>(); |
| 782 | if (state->m_gfxbank[offset] != data) |
| 816 | 783 | { |
| 817 | 784 | space->machine().primary_screen->update_now(); |
| 818 | | gfxbank[offset] = data; |
| 819 | | tilemap_mark_all_tiles_dirty(bg_tilemap); |
| 785 | state->m_gfxbank[offset] = data; |
| 786 | tilemap_mark_all_tiles_dirty(state->m_bg_tilemap); |
| 820 | 787 | } |
| 821 | 788 | } |
| 822 | 789 | |
| r11160 | r11161 | |
| 830 | 797 | |
| 831 | 798 | static void stars_init(running_machine &machine) |
| 832 | 799 | { |
| 800 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 833 | 801 | UINT32 shiftreg; |
| 834 | 802 | int i; |
| 835 | 803 | |
| 836 | 804 | /* reset the blink and enabled states */ |
| 837 | | stars_enabled = FALSE; |
| 838 | | stars_blink_state = 0; |
| 805 | state->m_stars_enabled = FALSE; |
| 806 | state->m_stars_blink_state = 0; |
| 839 | 807 | |
| 840 | 808 | /* precalculate the RNG */ |
| 841 | | stars = auto_alloc_array(machine, UINT8, STAR_RNG_PERIOD); |
| 809 | state->m_stars = auto_alloc_array(machine, UINT8, STAR_RNG_PERIOD); |
| 842 | 810 | shiftreg = 0; |
| 843 | 811 | for (i = 0; i < STAR_RNG_PERIOD; i++) |
| 844 | 812 | { |
| r11160 | r11161 | |
| 849 | 817 | int color = (~shiftreg & 0x1f8) >> 3; |
| 850 | 818 | |
| 851 | 819 | /* store the color value in the low 6 bits and the enable in the upper bit */ |
| 852 | | stars[i] = color | (enabled << 7); |
| 820 | state->m_stars[i] = color | (enabled << 7); |
| 853 | 821 | |
| 854 | 822 | /* the LFSR is fed based on the XOR of bit 12 and the inverse of bit 0 */ |
| 855 | 823 | shiftreg = (shiftreg >> 1) | ((((shiftreg >> 12) ^ ~shiftreg) & 1) << 16); |
| r11160 | r11161 | |
| 866 | 834 | |
| 867 | 835 | static void stars_update_origin(running_machine &machine) |
| 868 | 836 | { |
| 837 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 869 | 838 | int curframe = machine.primary_screen->frame_number(); |
| 870 | 839 | |
| 871 | 840 | /* only update on a different frame */ |
| 872 | | if (curframe != star_rng_origin_frame) |
| 841 | if (curframe != state->m_star_rng_origin_frame) |
| 873 | 842 | { |
| 874 | 843 | /* The RNG period is 2^17-1; each frame, the shift register is clocked */ |
| 875 | 844 | /* 512*256 = 2^17 times. This means that we clock one extra time each */ |
| r11160 | r11161 | |
| 877 | 846 | /* at 6B which delay the count so that we count 512*256-2 = 2^17-2 times. */ |
| 878 | 847 | /* In this case, we only one time less than the period each frame. Both */ |
| 879 | 848 | /* of these off-by-one countings produce the horizontal star scrolling. */ |
| 880 | | int per_frame_delta = flipscreen_x ? 1 : -1; |
| 881 | | int total_delta = per_frame_delta * (curframe - star_rng_origin_frame); |
| 849 | int per_frame_delta = state->m_flipscreen_x ? 1 : -1; |
| 850 | int total_delta = per_frame_delta * (curframe - state->m_star_rng_origin_frame); |
| 882 | 851 | |
| 883 | 852 | /* we can't just use % here because mod of a negative number is undefined */ |
| 884 | 853 | while (total_delta < 0) |
| 885 | 854 | total_delta += STAR_RNG_PERIOD; |
| 886 | 855 | |
| 887 | 856 | /* now that everything is positive, do the mod */ |
| 888 | | star_rng_origin = (star_rng_origin + total_delta) % STAR_RNG_PERIOD; |
| 889 | | star_rng_origin_frame = curframe; |
| 857 | state->m_star_rng_origin = (state->m_star_rng_origin + total_delta) % STAR_RNG_PERIOD; |
| 858 | state->m_star_rng_origin_frame = curframe; |
| 890 | 859 | } |
| 891 | 860 | } |
| 892 | 861 | |
| r11160 | r11161 | |
| 900 | 869 | |
| 901 | 870 | TIMER_DEVICE_CALLBACK( galaxian_stars_blink_timer ) |
| 902 | 871 | { |
| 903 | | stars_blink_state++; |
| 872 | galaxian_state *state = timer.machine().driver_data<galaxian_state>(); |
| 873 | state->m_stars_blink_state++; |
| 904 | 874 | } |
| 905 | 875 | |
| 906 | 876 | |
| r11160 | r11161 | |
| 911 | 881 | * |
| 912 | 882 | *************************************/ |
| 913 | 883 | |
| 914 | | static void stars_draw_row(bitmap_t *bitmap, int maxx, int y, UINT32 star_offs, UINT8 starmask) |
| 884 | static void stars_draw_row(galaxian_state *state, bitmap_t *bitmap, int maxx, int y, UINT32 star_offs, UINT8 starmask) |
| 915 | 885 | { |
| 916 | 886 | int x; |
| 917 | 887 | |
| r11160 | r11161 | |
| 943 | 913 | */ |
| 944 | 914 | |
| 945 | 915 | /* first RNG clock: one pixel */ |
| 946 | | star = stars[star_offs++]; |
| 916 | star = state->m_stars[star_offs++]; |
| 947 | 917 | if (star_offs >= STAR_RNG_PERIOD) |
| 948 | 918 | star_offs = 0; |
| 949 | 919 | if (enable_star && (star & 0x80) != 0 && (star & starmask) != 0) |
| 950 | | *BITMAP_ADDR32(bitmap, y, GALAXIAN_XSCALE*x + 0) = star_color[star & 0x3f]; |
| 920 | *BITMAP_ADDR32(bitmap, y, GALAXIAN_XSCALE*x + 0) = state->m_star_color[star & 0x3f]; |
| 951 | 921 | |
| 952 | 922 | /* second RNG clock: two pixels */ |
| 953 | | star = stars[star_offs++]; |
| 923 | star = state->m_stars[star_offs++]; |
| 954 | 924 | if (star_offs >= STAR_RNG_PERIOD) |
| 955 | 925 | star_offs = 0; |
| 956 | 926 | if (enable_star && (star & 0x80) != 0 && (star & starmask) != 0) |
| 957 | 927 | { |
| 958 | | *BITMAP_ADDR32(bitmap, y, GALAXIAN_XSCALE*x + 1) = star_color[star & 0x3f]; |
| 959 | | *BITMAP_ADDR32(bitmap, y, GALAXIAN_XSCALE*x + 2) = star_color[star & 0x3f]; |
| 928 | *BITMAP_ADDR32(bitmap, y, GALAXIAN_XSCALE*x + 1) = state->m_star_color[star & 0x3f]; |
| 929 | *BITMAP_ADDR32(bitmap, y, GALAXIAN_XSCALE*x + 2) = state->m_star_color[star & 0x3f]; |
| 960 | 930 | } |
| 961 | 931 | } |
| 962 | 932 | } |
| r11160 | r11161 | |
| 971 | 941 | |
| 972 | 942 | void galaxian_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 973 | 943 | { |
| 944 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 974 | 945 | /* erase the background to black first */ |
| 975 | 946 | bitmap_fill(bitmap, cliprect, RGB_BLACK); |
| 976 | 947 | |
| r11160 | r11161 | |
| 978 | 949 | stars_update_origin(machine); |
| 979 | 950 | |
| 980 | 951 | /* render stars if enabled */ |
| 981 | | if (stars_enabled) |
| 952 | if (state->m_stars_enabled) |
| 982 | 953 | { |
| 983 | 954 | int y; |
| 984 | 955 | |
| 985 | 956 | /* iterate over scanlines */ |
| 986 | 957 | for (y = cliprect->min_y; y <= cliprect->max_y; y++) |
| 987 | 958 | { |
| 988 | | UINT32 star_offs = star_rng_origin + y * 512; |
| 989 | | stars_draw_row(bitmap, 256, y, star_offs, 0xff); |
| 959 | UINT32 star_offs = state->m_star_rng_origin + y * 512; |
| 960 | stars_draw_row(state, bitmap, 256, y, star_offs, 0xff); |
| 990 | 961 | } |
| 991 | 962 | } |
| 992 | 963 | } |
| r11160 | r11161 | |
| 994 | 965 | |
| 995 | 966 | static void background_draw_colorsplit(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, rgb_t color, int split, int split_flipped) |
| 996 | 967 | { |
| 968 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 997 | 969 | /* horizontal bgcolor split */ |
| 998 | | if (flipscreen_x) |
| 970 | if (state->m_flipscreen_x) |
| 999 | 971 | { |
| 1000 | 972 | rectangle draw = *cliprect; |
| 1001 | 973 | draw.max_x = MIN(draw.max_x, split_flipped * GALAXIAN_XSCALE - 1); |
| r11160 | r11161 | |
| 1024 | 996 | |
| 1025 | 997 | static void scramble_draw_stars(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int maxx) |
| 1026 | 998 | { |
| 999 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1027 | 1000 | /* update the star origin to the current frame */ |
| 1028 | 1001 | stars_update_origin(machine); |
| 1029 | 1002 | |
| 1030 | 1003 | /* render stars if enabled */ |
| 1031 | | if (stars_enabled) |
| 1004 | if (state->m_stars_enabled) |
| 1032 | 1005 | { |
| 1033 | | int blink_state = stars_blink_state & 3; |
| 1006 | int blink_state = state->m_stars_blink_state & 3; |
| 1034 | 1007 | int y; |
| 1035 | 1008 | |
| 1036 | 1009 | /* iterate over scanlines */ |
| r11160 | r11161 | |
| 1041 | 1014 | { |
| 1042 | 1015 | /* blink states 0 and 1 suppress stars when certain bits of the color == 0 */ |
| 1043 | 1016 | static const UINT8 colormask_table[4] = { 0x20, 0x08, 0xff, 0xff }; |
| 1044 | | stars_draw_row(bitmap, maxx, y, y * 512, colormask_table[blink_state]); |
| 1017 | stars_draw_row(state, bitmap, maxx, y, y * 512, colormask_table[blink_state]); |
| 1045 | 1018 | } |
| 1046 | 1019 | } |
| 1047 | 1020 | } |
| r11160 | r11161 | |
| 1050 | 1023 | |
| 1051 | 1024 | void scramble_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 1052 | 1025 | { |
| 1026 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1053 | 1027 | /* blue background - 390 ohm resistor */ |
| 1054 | | bitmap_fill(bitmap, cliprect, background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK); |
| 1028 | bitmap_fill(bitmap, cliprect, state->m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK); |
| 1055 | 1029 | |
| 1056 | 1030 | scramble_draw_stars(machine, bitmap, cliprect, 256); |
| 1057 | 1031 | } |
| r11160 | r11161 | |
| 1059 | 1033 | |
| 1060 | 1034 | void anteater_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 1061 | 1035 | { |
| 1036 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1062 | 1037 | /* blue background, horizontal split as seen on flyer and real cabinet */ |
| 1063 | | background_draw_colorsplit(machine, bitmap, cliprect, background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, 56, 256-56); |
| 1038 | background_draw_colorsplit(machine, bitmap, cliprect, state->m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, 56, 256-56); |
| 1064 | 1039 | |
| 1065 | 1040 | scramble_draw_stars(machine, bitmap, cliprect, 256); |
| 1066 | 1041 | } |
| r11160 | r11161 | |
| 1068 | 1043 | |
| 1069 | 1044 | void jumpbug_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 1070 | 1045 | { |
| 1046 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1071 | 1047 | /* blue background - 390 ohm resistor */ |
| 1072 | | bitmap_fill(bitmap, cliprect, background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK); |
| 1048 | bitmap_fill(bitmap, cliprect, state->m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK); |
| 1073 | 1049 | |
| 1074 | 1050 | /* render stars same as scramble but nothing in the status area */ |
| 1075 | 1051 | scramble_draw_stars(machine, bitmap, cliprect, 240); |
| r11160 | r11161 | |
| 1078 | 1054 | |
| 1079 | 1055 | void turtles_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 1080 | 1056 | { |
| 1057 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1081 | 1058 | /* |
| 1082 | 1059 | The background color generator is connected this way: |
| 1083 | 1060 | |
| r11160 | r11161 | |
| 1085 | 1062 | GREEN - 470 ohm resistor |
| 1086 | 1063 | BLUE - 390 ohm resistor |
| 1087 | 1064 | */ |
| 1088 | | bitmap_fill(bitmap, cliprect, MAKE_RGB(background_red * 0x55, background_green * 0x47, background_blue * 0x55)); |
| 1065 | bitmap_fill(bitmap, cliprect, MAKE_RGB(state->m_background_red * 0x55, state->m_background_green * 0x47, state->m_background_blue * 0x55)); |
| 1089 | 1066 | } |
| 1090 | 1067 | |
| 1091 | 1068 | |
| r11160 | r11161 | |
| 1100 | 1077 | #ifdef UNUSED_FUNCTION |
| 1101 | 1078 | static int flip_and_clip(rectangle *draw, int xstart, int xend, const rectangle *cliprect) |
| 1102 | 1079 | { |
| 1080 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1103 | 1081 | *draw = *cliprect; |
| 1104 | | if (!flipscreen_x) |
| 1082 | if (!state->m_flipscreen_x) |
| 1105 | 1083 | { |
| 1106 | 1084 | draw->min_x = xstart * GALAXIAN_XSCALE; |
| 1107 | 1085 | draw->max_x = xend * GALAXIAN_XSCALE + (GALAXIAN_XSCALE - 1); |
| r11160 | r11161 | |
| 1117 | 1095 | |
| 1118 | 1096 | void amidar_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 1119 | 1097 | { |
| 1098 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1120 | 1099 | const UINT8 *prom = machine.region("user1")->base(); |
| 1121 | 1100 | rectangle draw; |
| 1122 | 1101 | int x; |
| r11160 | r11161 | |
| 1138 | 1117 | GREEN - 560 ohm resistor |
| 1139 | 1118 | BLUE - 470 ohm resistor |
| 1140 | 1119 | */ |
| 1141 | | UINT8 red = ((~prom[x] & 0x02) && background_red) ? 0x7c : 0x00; |
| 1142 | | UINT8 green = ((~prom[x] & 0x02) && background_green) ? 0x3c : 0x00; |
| 1143 | | UINT8 blue = ((~prom[x] & 0x01) && background_blue) ? 0x47 : 0x00; |
| 1120 | UINT8 red = ((~prom[x] & 0x02) && state->m_background_red) ? 0x7c : 0x00; |
| 1121 | UINT8 green = ((~prom[x] & 0x02) && state->m_background_green) ? 0x3c : 0x00; |
| 1122 | UINT8 blue = ((~prom[x] & 0x01) && state->m_background_blue) ? 0x47 : 0x00; |
| 1144 | 1123 | bitmap_fill(bitmap, &draw, MAKE_RGB(red, green, blue)); |
| 1145 | 1124 | } |
| 1146 | 1125 | } |
| r11160 | r11161 | |
| 1176 | 1155 | |
| 1177 | 1156 | void galaxian_draw_bullet(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y) |
| 1178 | 1157 | { |
| 1158 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1179 | 1159 | /* |
| 1180 | 1160 | Both "shells" and "missiles" begin displaying when the horizontal counter |
| 1181 | 1161 | reaches $FC, and they stop displaying when it reaches $00, resulting in |
| r11160 | r11161 | |
| 1183 | 1163 | white; the final entry is called a "missile" and renders as yellow. |
| 1184 | 1164 | */ |
| 1185 | 1165 | x -= 4; |
| 1186 | | galaxian_draw_pixel(bitmap, cliprect, y, x++, bullet_color[offs]); |
| 1187 | | galaxian_draw_pixel(bitmap, cliprect, y, x++, bullet_color[offs]); |
| 1188 | | galaxian_draw_pixel(bitmap, cliprect, y, x++, bullet_color[offs]); |
| 1189 | | galaxian_draw_pixel(bitmap, cliprect, y, x++, bullet_color[offs]); |
| 1166 | galaxian_draw_pixel(bitmap, cliprect, y, x++, state->m_bullet_color[offs]); |
| 1167 | galaxian_draw_pixel(bitmap, cliprect, y, x++, state->m_bullet_color[offs]); |
| 1168 | galaxian_draw_pixel(bitmap, cliprect, y, x++, state->m_bullet_color[offs]); |
| 1169 | galaxian_draw_pixel(bitmap, cliprect, y, x++, state->m_bullet_color[offs]); |
| 1190 | 1170 | } |
| 1191 | 1171 | |
| 1192 | 1172 | |
| r11160 | r11161 | |
| 1233 | 1213 | |
| 1234 | 1214 | void theend_draw_bullet(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y) |
| 1235 | 1215 | { |
| 1216 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1236 | 1217 | /* Same as galaxian except blue/green are swapped */ |
| 1237 | 1218 | x -= 4; |
| 1238 | | galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(bullet_color[offs]), RGB_BLUE(bullet_color[offs]), RGB_GREEN(bullet_color[offs]))); |
| 1239 | | galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(bullet_color[offs]), RGB_BLUE(bullet_color[offs]), RGB_GREEN(bullet_color[offs]))); |
| 1240 | | galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(bullet_color[offs]), RGB_BLUE(bullet_color[offs]), RGB_GREEN(bullet_color[offs]))); |
| 1241 | | galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(bullet_color[offs]), RGB_BLUE(bullet_color[offs]), RGB_GREEN(bullet_color[offs]))); |
| 1219 | galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(state->m_bullet_color[offs]), RGB_BLUE(state->m_bullet_color[offs]), RGB_GREEN(state->m_bullet_color[offs]))); |
| 1220 | galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(state->m_bullet_color[offs]), RGB_BLUE(state->m_bullet_color[offs]), RGB_GREEN(state->m_bullet_color[offs]))); |
| 1221 | galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(state->m_bullet_color[offs]), RGB_BLUE(state->m_bullet_color[offs]), RGB_GREEN(state->m_bullet_color[offs]))); |
| 1222 | galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(state->m_bullet_color[offs]), RGB_BLUE(state->m_bullet_color[offs]), RGB_GREEN(state->m_bullet_color[offs]))); |
| 1242 | 1223 | } |
| 1243 | 1224 | |
| 1244 | 1225 | |
| r11160 | r11161 | |
| 1250 | 1231 | *************************************/ |
| 1251 | 1232 | |
| 1252 | 1233 | /*** generic ***/ |
| 1253 | | void upper_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1234 | void upper_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1254 | 1235 | { |
| 1255 | 1236 | /* tiles are in the upper half of a larger ROM */ |
| 1256 | 1237 | *code += 0x100; |
| 1257 | 1238 | } |
| 1258 | 1239 | |
| 1259 | | void upper_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1240 | void upper_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1260 | 1241 | { |
| 1261 | 1242 | /* sprites are in the upper half of a larger ROM */ |
| 1262 | 1243 | *code += 0x40; |
| r11160 | r11161 | |
| 1264 | 1245 | |
| 1265 | 1246 | |
| 1266 | 1247 | /*** Frogger ***/ |
| 1267 | | void frogger_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1248 | void frogger_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1268 | 1249 | { |
| 1269 | 1250 | *color = ((*color >> 1) & 0x03) | ((*color << 2) & 0x04); |
| 1270 | 1251 | } |
| 1271 | 1252 | |
| 1272 | | void frogger_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1253 | void frogger_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1273 | 1254 | { |
| 1274 | 1255 | *color = ((*color >> 1) & 0x03) | ((*color << 2) & 0x04); |
| 1275 | 1256 | } |
| 1276 | 1257 | |
| 1277 | 1258 | |
| 1278 | 1259 | /*** Ghostmuncher Galaxian ***/ |
| 1279 | | void gmgalax_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1260 | void gmgalax_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1280 | 1261 | { |
| 1281 | | *code |= gfxbank[0] << 9; |
| 1282 | | // *color |= gfxbank[0] << 3; |
| 1262 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1263 | *code |= state->m_gfxbank[0] << 9; |
| 1264 | // *color |= state->m_gfxbank[0] << 3; |
| 1283 | 1265 | } |
| 1284 | 1266 | |
| 1285 | | void gmgalax_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1267 | void gmgalax_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1286 | 1268 | { |
| 1287 | | *code |= (gfxbank[0] << 7) | 0x40; |
| 1288 | | *color |= gfxbank[0] << 3; |
| 1269 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1270 | *code |= (state->m_gfxbank[0] << 7) | 0x40; |
| 1271 | *color |= state->m_gfxbank[0] << 3; |
| 1289 | 1272 | } |
| 1290 | 1273 | |
| 1291 | 1274 | |
| 1292 | 1275 | /*** Pisces ***/ |
| 1293 | | void pisces_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1276 | void pisces_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1294 | 1277 | { |
| 1295 | | *code |= gfxbank[0] << 8; |
| 1278 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1279 | *code |= state->m_gfxbank[0] << 8; |
| 1296 | 1280 | } |
| 1297 | 1281 | |
| 1298 | | void pisces_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1282 | void pisces_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1299 | 1283 | { |
| 1300 | | *code |= gfxbank[0] << 6; |
| 1284 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1285 | *code |= state->m_gfxbank[0] << 6; |
| 1301 | 1286 | } |
| 1302 | 1287 | |
| 1303 | 1288 | |
| 1304 | 1289 | /*** Batman Part 2 ***/ |
| 1305 | | void batman2_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1290 | void batman2_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1306 | 1291 | { |
| 1292 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1307 | 1293 | if (*code & 0x80) |
| 1308 | | *code |= gfxbank[0] << 8; |
| 1294 | *code |= state->m_gfxbank[0] << 8; |
| 1309 | 1295 | } |
| 1310 | 1296 | |
| 1311 | 1297 | |
| 1312 | 1298 | /*** Moon Cresta ***/ |
| 1313 | | void mooncrst_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1299 | void mooncrst_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1314 | 1300 | { |
| 1315 | | if (gfxbank[2] && (*code & 0xc0) == 0x80) |
| 1316 | | *code = (*code & 0x3f) | (gfxbank[0] << 6) | (gfxbank[1] << 7) | 0x0100; |
| 1301 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1302 | if (state->m_gfxbank[2] && (*code & 0xc0) == 0x80) |
| 1303 | *code = (*code & 0x3f) | (state->m_gfxbank[0] << 6) | (state->m_gfxbank[1] << 7) | 0x0100; |
| 1317 | 1304 | } |
| 1318 | 1305 | |
| 1319 | | void mooncrst_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1306 | void mooncrst_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1320 | 1307 | { |
| 1321 | | if (gfxbank[2] && (*code & 0x30) == 0x20) |
| 1322 | | *code = (*code & 0x0f) | (gfxbank[0] << 4) | (gfxbank[1] << 5) | 0x40; |
| 1308 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1309 | if (state->m_gfxbank[2] && (*code & 0x30) == 0x20) |
| 1310 | *code = (*code & 0x0f) | (state->m_gfxbank[0] << 4) | (state->m_gfxbank[1] << 5) | 0x40; |
| 1323 | 1311 | } |
| 1324 | 1312 | |
| 1325 | 1313 | |
| 1326 | 1314 | /*** Moon Quasar ***/ |
| 1327 | | void moonqsr_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1315 | void moonqsr_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1328 | 1316 | { |
| 1329 | 1317 | *code |= (attrib & 0x20) << 3; |
| 1330 | 1318 | } |
| 1331 | 1319 | |
| 1332 | | void moonqsr_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1320 | void moonqsr_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1333 | 1321 | { |
| 1334 | 1322 | *code |= (base[2] & 0x20) << 1; |
| 1335 | 1323 | } |
| 1336 | 1324 | |
| 1337 | 1325 | |
| 1338 | 1326 | /*** Moon Shuttle ***/ |
| 1339 | | void mshuttle_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1327 | void mshuttle_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1340 | 1328 | { |
| 1341 | 1329 | *code |= (attrib & 0x30) << 4; |
| 1342 | 1330 | } |
| 1343 | 1331 | |
| 1344 | | void mshuttle_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1332 | void mshuttle_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1345 | 1333 | { |
| 1346 | 1334 | *code |= (base[2] & 0x30) << 2; |
| 1347 | 1335 | } |
| 1348 | 1336 | |
| 1349 | 1337 | |
| 1350 | 1338 | /*** Calipso ***/ |
| 1351 | | void calipso_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1339 | void calipso_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1352 | 1340 | { |
| 1353 | 1341 | /* same as the others, but no sprite flipping, but instead the bits are used |
| 1354 | 1342 | as extra sprite code bits, giving 256 sprite images */ |
| r11160 | r11161 | |
| 1360 | 1348 | |
| 1361 | 1349 | |
| 1362 | 1350 | /*** Jumpbug ***/ |
| 1363 | | void jumpbug_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1351 | void jumpbug_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1364 | 1352 | { |
| 1365 | | if ((*code & 0xc0) == 0x80 && (gfxbank[2] & 0x01)) |
| 1366 | | *code += 128 + (( gfxbank[0] & 0x01) << 6) + |
| 1367 | | (( gfxbank[1] & 0x01) << 7) + |
| 1368 | | ((~gfxbank[4] & 0x01) << 8); |
| 1353 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1354 | if ((*code & 0xc0) == 0x80 && (state->m_gfxbank[2] & 0x01)) |
| 1355 | *code += 128 + (( state->m_gfxbank[0] & 0x01) << 6) + |
| 1356 | (( state->m_gfxbank[1] & 0x01) << 7) + |
| 1357 | ((~state->m_gfxbank[4] & 0x01) << 8); |
| 1369 | 1358 | } |
| 1370 | 1359 | |
| 1371 | | void jumpbug_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1360 | void jumpbug_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1372 | 1361 | { |
| 1373 | | if ((*code & 0x30) == 0x20 && (gfxbank[2] & 0x01) != 0) |
| 1362 | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1363 | if ((*code & 0x30) == 0x20 && (state->m_gfxbank[2] & 0x01) != 0) |
| 1374 | 1364 | { |
| 1375 | | *code += 32 + (( gfxbank[0] & 0x01) << 4) + |
| 1376 | | (( gfxbank[1] & 0x01) << 5) + |
| 1377 | | ((~gfxbank[4] & 0x01) << 6); |
| 1365 | *code += 32 + (( state->m_gfxbank[0] & 0x01) << 4) + |
| 1366 | (( state->m_gfxbank[1] & 0x01) << 5) + |
| 1367 | ((~state->m_gfxbank[4] & 0x01) << 6); |
| 1378 | 1368 | } |
| 1379 | 1369 | } |
src/mame/video/namcos22.c
| r11160 | r11161 | |
| 41 | 41 | // uncomment this line to render everything as quads |
| 42 | 42 | //#define RENDER_AS_QUADS |
| 43 | 43 | |
| 44 | | static int mbSuperSystem22; /* used to conditionally support Super System22-specific features */ |
| 45 | | static int mbSpotlightEnable; |
| 46 | | static UINT16 *namcos22_czram[4]; |
| 47 | 44 | |
| 48 | | static poly_manager *poly; |
| 49 | 45 | |
| 50 | 46 | static UINT8 |
| 51 | 47 | nthbyte( const UINT32 *pSource, int offs ) |
| r11160 | r11161 | |
| 84 | 80 | } mixer; |
| 85 | 81 | |
| 86 | 82 | static void |
| 87 | | UpdateVideoMixer( void ) |
| 83 | UpdateVideoMixer( running_machine &machine ) |
| 88 | 84 | { |
| 89 | | poly_wait(poly, "UpdateVideoMixer"); |
| 85 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 86 | poly_wait(state->m_poly, "UpdateVideoMixer"); |
| 90 | 87 | memset( &mixer, 0, sizeof(mixer) ); |
| 91 | | if( mbSuperSystem22 ) |
| 88 | if( state->m_mbSuperSystem22 ) |
| 92 | 89 | { |
| 93 | 90 | /* |
| 94 | 91 | 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 14 18 1c |
| r11160 | r11161 | |
| 98 | 95 | 00824000: ffffff00 00000000 1800187f 00800000 0080007f 0f000000 0000037f 00010007 // trans poly(2) |
| 99 | 96 | 00824000: ffffff00 00000000 1800187f 00000000 0000007f 0f800000 0000037f 00010007 // trans text |
| 100 | 97 | */ |
| 101 | | mixer.rFogColor = nthbyte( namcos22_gamma, 0x05 ); |
| 102 | | mixer.gFogColor = nthbyte( namcos22_gamma, 0x06 ); |
| 103 | | mixer.bFogColor = nthbyte( namcos22_gamma, 0x07 ); |
| 104 | | mixer.rBackColor = nthbyte( namcos22_gamma, 0x08 ); |
| 105 | | mixer.gBackColor = nthbyte( namcos22_gamma, 0x09 ); |
| 106 | | mixer.bBackColor = nthbyte( namcos22_gamma, 0x0a ); |
| 107 | | mixer.spot_translucency = nthbyte( namcos22_gamma, 0x0d ); |
| 108 | | mixer.poly_translucency = nthbyte( namcos22_gamma, 0x11 ); |
| 109 | | mixer.text_translucency = nthbyte( namcos22_gamma, 0x15 ); |
| 110 | | mixer.rFadeColor = nthbyte( namcos22_gamma, 0x16 ); |
| 111 | | mixer.gFadeColor = nthbyte( namcos22_gamma, 0x17 ); |
| 112 | | mixer.bFadeColor = nthbyte( namcos22_gamma, 0x18 ); |
| 113 | | mixer.fadeFactor = nthbyte( namcos22_gamma, 0x19 ); |
| 114 | | mixer.target = nthbyte( namcos22_gamma, 0x1a ); |
| 115 | | mixer.palBase = nthbyte( namcos22_gamma, 0x1b ); |
| 98 | mixer.rFogColor = nthbyte( state->m_gamma, 0x05 ); |
| 99 | mixer.gFogColor = nthbyte( state->m_gamma, 0x06 ); |
| 100 | mixer.bFogColor = nthbyte( state->m_gamma, 0x07 ); |
| 101 | mixer.rBackColor = nthbyte( state->m_gamma, 0x08 ); |
| 102 | mixer.gBackColor = nthbyte( state->m_gamma, 0x09 ); |
| 103 | mixer.bBackColor = nthbyte( state->m_gamma, 0x0a ); |
| 104 | mixer.spot_translucency = nthbyte( state->m_gamma, 0x0d ); |
| 105 | mixer.poly_translucency = nthbyte( state->m_gamma, 0x11 ); |
| 106 | mixer.text_translucency = nthbyte( state->m_gamma, 0x15 ); |
| 107 | mixer.rFadeColor = nthbyte( state->m_gamma, 0x16 ); |
| 108 | mixer.gFadeColor = nthbyte( state->m_gamma, 0x17 ); |
| 109 | mixer.bFadeColor = nthbyte( state->m_gamma, 0x18 ); |
| 110 | mixer.fadeFactor = nthbyte( state->m_gamma, 0x19 ); |
| 111 | mixer.target = nthbyte( state->m_gamma, 0x1a ); |
| 112 | mixer.palBase = nthbyte( state->m_gamma, 0x1b ); |
| 116 | 113 | } |
| 117 | 114 | else |
| 118 | 115 | { |
| r11160 | r11161 | |
| 126 | 123 | 90020200: ff100000 00000000 00000000 00000000 |
| 127 | 124 | */ |
| 128 | 125 | mixer.palBase = 0x7f; |
| 129 | | mixer.target = 0x7;//nthbyte( namcos22_gamma, 0x0002 )*256 + nthbyte( namcos22_gamma, 0x0003 ); |
| 130 | | mixer.rFadeColor = nthbyte( namcos22_gamma, 0x0011 )*256 + nthbyte( namcos22_gamma, 0x0012 ); |
| 131 | | mixer.gFadeColor = nthbyte( namcos22_gamma, 0x0013 )*256 + nthbyte( namcos22_gamma, 0x0014 ); |
| 132 | | mixer.bFadeColor = nthbyte( namcos22_gamma, 0x0015 )*256 + nthbyte( namcos22_gamma, 0x0016 ); |
| 126 | mixer.target = 0x7;//nthbyte( state->m_gamma, 0x0002 )*256 + nthbyte( state->m_gamma, 0x0003 ); |
| 127 | mixer.rFadeColor = nthbyte( state->m_gamma, 0x0011 )*256 + nthbyte( state->m_gamma, 0x0012 ); |
| 128 | mixer.gFadeColor = nthbyte( state->m_gamma, 0x0013 )*256 + nthbyte( state->m_gamma, 0x0014 ); |
| 129 | mixer.bFadeColor = nthbyte( state->m_gamma, 0x0015 )*256 + nthbyte( state->m_gamma, 0x0016 ); |
| 133 | 130 | |
| 134 | 131 | mixer.fadeFactor = 0x100 - mixer.rFadeColor; // hack |
| 135 | 132 | mixer.rFadeColor = 0; |
| 136 | 133 | mixer.gFadeColor = 0; |
| 137 | 134 | mixer.bFadeColor = 0; |
| 138 | 135 | |
| 139 | | mixer.rFogColor = nthbyte( namcos22_gamma, 0x0100 ); |
| 140 | | mixer.rFogColor2 = nthbyte( namcos22_gamma, 0x0101 ); |
| 141 | | mixer.gFogColor = nthbyte( namcos22_gamma, 0x0180 ); |
| 142 | | mixer.gFogColor2 = nthbyte( namcos22_gamma, 0x0181 ); |
| 143 | | mixer.bFogColor = nthbyte( namcos22_gamma, 0x0200 ); |
| 144 | | mixer.bFogColor2 = nthbyte( namcos22_gamma, 0x0201 ); |
| 136 | mixer.rFogColor = nthbyte( state->m_gamma, 0x0100 ); |
| 137 | mixer.rFogColor2 = nthbyte( state->m_gamma, 0x0101 ); |
| 138 | mixer.gFogColor = nthbyte( state->m_gamma, 0x0180 ); |
| 139 | mixer.gFogColor2 = nthbyte( state->m_gamma, 0x0181 ); |
| 140 | mixer.bFogColor = nthbyte( state->m_gamma, 0x0200 ); |
| 141 | mixer.bFogColor2 = nthbyte( state->m_gamma, 0x0201 ); |
| 145 | 142 | |
| 146 | 143 | /* +0x0002.w Fader Enable(?) (0: disabled) |
| 147 | 144 | * +0x0011.w Display Fader (R) (0x0100 = 1.0) |
| r11160 | r11161 | |
| 160 | 157 | INLINE UINT8 |
| 161 | 158 | Clamp256( int v ) |
| 162 | 159 | { |
| 163 | | if( v<0 ) |
| 164 | | { |
| 165 | | v = 0; |
| 166 | | } |
| 167 | | else if( v>255 ) |
| 168 | | { |
| 169 | | v = 255; |
| 170 | | } |
| 171 | | return v; |
| 160 | if( v<0 ) |
| 161 | { |
| 162 | v = 0; |
| 163 | } |
| 164 | else if( v>255 ) |
| 165 | { |
| 166 | v = 255; |
| 167 | } |
| 168 | return v; |
| 172 | 169 | } /* Clamp256 */ |
| 173 | 170 | |
| 174 | 171 | #ifdef MAME_DEBUG |
| r11160 | r11161 | |
| 177 | 174 | |
| 178 | 175 | static struct |
| 179 | 176 | { |
| 180 | | int cx,cy; |
| 181 | | rectangle scissor; |
| 177 | int cx,cy; |
| 178 | rectangle scissor; |
| 182 | 179 | } mClip; |
| 183 | 180 | |
| 184 | 181 | static void |
| 185 | 182 | poly3d_Clip( float vx, float vy, float vw, float vh ) |
| 186 | 183 | { |
| 187 | | int cx = 320+vx; |
| 188 | | int cy = 240+vy; |
| 189 | | mClip.cx = cx; |
| 190 | | mClip.cy = cy; |
| 191 | | mClip.scissor.min_x = cx + vw; |
| 192 | | mClip.scissor.min_y = cy + vh; |
| 193 | | mClip.scissor.max_x = cx - vw; |
| 194 | | mClip.scissor.max_y = cy - vh; |
| 195 | | if( mClip.scissor.min_x<0 ) mClip.scissor.min_x = 0; |
| 196 | | if( mClip.scissor.min_y<0 ) mClip.scissor.min_y = 0; |
| 197 | | if( mClip.scissor.max_x>639 ) mClip.scissor.max_x = 639; |
| 198 | | if( mClip.scissor.max_y>479 ) mClip.scissor.max_y = 479; |
| 184 | int cx = 320+vx; |
| 185 | int cy = 240+vy; |
| 186 | mClip.cx = cx; |
| 187 | mClip.cy = cy; |
| 188 | mClip.scissor.min_x = cx + vw; |
| 189 | mClip.scissor.min_y = cy + vh; |
| 190 | mClip.scissor.max_x = cx - vw; |
| 191 | mClip.scissor.max_y = cy - vh; |
| 192 | if( mClip.scissor.min_x<0 ) mClip.scissor.min_x = 0; |
| 193 | if( mClip.scissor.min_y<0 ) mClip.scissor.min_y = 0; |
| 194 | if( mClip.scissor.max_x>639 ) mClip.scissor.max_x = 639; |
| 195 | if( mClip.scissor.max_y>479 ) mClip.scissor.max_y = 479; |
| 199 | 196 | } |
| 200 | 197 | |
| 201 | 198 | static void |
| 202 | 199 | poly3d_NoClip( void ) |
| 203 | 200 | { |
| 204 | | mClip.cx = 640/2; |
| 205 | | mClip.cy = 480/2; |
| 206 | | mClip.scissor.min_x = 0; |
| 207 | | mClip.scissor.max_x = 639; |
| 208 | | mClip.scissor.min_y = 0; |
| 209 | | mClip.scissor.max_x = 479; |
| 201 | mClip.cx = 640/2; |
| 202 | mClip.cy = 480/2; |
| 203 | mClip.scissor.min_x = 0; |
| 204 | mClip.scissor.max_x = 639; |
| 205 | mClip.scissor.min_y = 0; |
| 206 | mClip.scissor.max_x = 479; |
| 210 | 207 | } |
| 211 | 208 | |
| 212 | 209 | typedef struct |
| 213 | 210 | { |
| 214 | | float x,y,z; |
| 215 | | int u,v; /* 0..0xfff */ |
| 216 | | int bri; /* 0..0xff */ |
| 211 | float x,y,z; |
| 212 | int u,v; /* 0..0xfff */ |
| 213 | int bri; /* 0..0xff */ |
| 217 | 214 | } Poly3dVertex; |
| 218 | 215 | |
| 219 | 216 | #define MIN_Z (10.0f) |
| r11160 | r11161 | |
| 232 | 229 | |
| 233 | 230 | #define SWAP(A,B) { const void *temp = A; A = B; B = temp; } |
| 234 | 231 | |
| 235 | | static UINT16 *mpTextureTileMap16; |
| 236 | | static UINT8 *mpTextureTileMapAttr; |
| 237 | | static UINT8 *mpTextureTileData; |
| 238 | | static UINT8 mXYAttrToPixel[16][16][16]; |
| 239 | 232 | |
| 240 | | INLINE unsigned texel( unsigned x, unsigned y ) |
| 233 | INLINE unsigned texel( namcos22_state *state, unsigned x, unsigned y ) |
| 241 | 234 | { |
| 242 | 235 | unsigned offs = ((y&0xfff0)<<4)|((x&0xff0)>>4); |
| 243 | | unsigned tile = mpTextureTileMap16[offs]; |
| 244 | | return mpTextureTileData[(tile<<8)|mXYAttrToPixel[mpTextureTileMapAttr[offs]][x&0xf][y&0xf]]; |
| 236 | unsigned tile = state->m_mpTextureTileMap16[offs]; |
| 237 | return state->m_mpTextureTileData[(tile<<8)|state->m_mXYAttrToPixel[state->m_mpTextureTileMapAttr[offs]][x&0xf][y&0xf]]; |
| 245 | 238 | } /* texel */ |
| 246 | 239 | |
| 247 | 240 | |
| r11160 | r11161 | |
| 249 | 242 | typedef struct _poly_extra_data poly_extra_data; |
| 250 | 243 | struct _poly_extra_data |
| 251 | 244 | { |
| 245 | running_machine *machine; |
| 252 | 246 | rgbint fogColor; |
| 253 | 247 | rgbint fadeColor; |
| 254 | 248 | const pen_t *pens; |
| r11160 | r11161 | |
| 278 | 272 | float di = extent->param[3].dpdx; |
| 279 | 273 | bitmap_t *bitmap = (bitmap_t *)dest; |
| 280 | 274 | const poly_extra_data *extra = (const poly_extra_data *)extradata; |
| 275 | namcos22_state *state = extra->machine->driver_data<namcos22_state>(); |
| 281 | 276 | int bn = extra->bn * 0x1000; |
| 282 | 277 | const pen_t *pens = extra->pens; |
| 283 | 278 | int fogFactor = 0xff - extra->fogFactor; |
| r11160 | r11161 | |
| 324 | 319 | for( x=extent->startx; x<extent->stopx; x++ ) |
| 325 | 320 | { |
| 326 | 321 | float ooz = 1.0f / z; |
| 327 | | int pen = texel((int)(u * ooz),bn+(int)(v*ooz)); |
| 322 | int pen = texel(state, (int)(u * ooz),bn+(int)(v*ooz)); |
| 328 | 323 | int shade = i*ooz; |
| 329 | 324 | rgbint rgb; |
| 330 | 325 | |
| r11160 | r11161 | |
| 359 | 354 | if( pCharPri[x]==0 ) |
| 360 | 355 | { |
| 361 | 356 | float ooz = 1.0f / z; |
| 362 | | int pen = texel((int)(u * ooz),bn+(int)(v*ooz)); |
| 357 | int pen = texel(state, (int)(u * ooz),bn+(int)(v*ooz)); |
| 363 | 358 | int shade = i*ooz; |
| 364 | 359 | rgbint rgb; |
| 365 | 360 | |
| r11160 | r11161 | |
| 385 | 380 | |
| 386 | 381 | static void poly3d_DrawQuad(running_machine &machine, bitmap_t *bitmap, int textureBank, int color, Poly3dVertex pv[4], UINT16 flags, int direct, int cmode ) |
| 387 | 382 | { |
| 383 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 388 | 384 | poly_extra_data *extra; |
| 389 | 385 | poly_vertex v[4], clipv[6]; |
| 390 | 386 | int clipverts; |
| r11160 | r11161 | |
| 434 | 430 | } |
| 435 | 431 | } |
| 436 | 432 | |
| 437 | | extra = (poly_extra_data *)poly_get_extra_data(poly); |
| 433 | extra = (poly_extra_data *)poly_get_extra_data(state->m_poly); |
| 438 | 434 | |
| 435 | extra->machine = &machine; |
| 439 | 436 | extra->pens = &machine.pens[(color&0x7f)<<8]; |
| 440 | 437 | extra->priority_bitmap = machine.priority_bitmap; |
| 441 | 438 | extra->bn = textureBank; |
| r11160 | r11161 | |
| 450 | 447 | rgb_comp_to_rgbint(&extra->fadeColor, mixer.rFadeColor, mixer.gFadeColor, mixer.bFadeColor); |
| 451 | 448 | } |
| 452 | 449 | |
| 453 | | if( mbSuperSystem22 ) |
| 450 | if( state->m_mbSuperSystem22 ) |
| 454 | 451 | { |
| 455 | 452 | if( !(color&0x80) ) |
| 456 | 453 | { |
| 457 | 454 | int cz = flags>>8; |
| 458 | 455 | static const int cztype_remap[4] = { 3,1,2,0 }; |
| 459 | 456 | int cztype = flags&3; |
| 460 | | if( nthword(namcos22_czattr,4)&(0x4000>>(cztype*4)) ) |
| 457 | if( nthword(state->m_czattr,4)&(0x4000>>(cztype*4)) ) |
| 461 | 458 | { |
| 462 | | int fogDelta = (INT16)nthword(namcos22_czattr, cztype); |
| 463 | | int fogDensity = fogDelta + namcos22_czram[cztype_remap[cztype]][cz]; |
| 464 | | // if( fogDelta == 0x8000 ) fogDelta = -0x7fff; |
| 459 | int fogDelta = (INT16)nthword(state->m_czattr, cztype); |
| 460 | int fogDensity = fogDelta + state->m_czram[cztype_remap[cztype]][cz]; |
| 461 | //if( fogDelta == 0x8000 ) fogDelta = -0x7fff; |
| 465 | 462 | //cz = Clamp256(cz+fogDelta); |
| 466 | 463 | if( fogDensity<0x0000 ) |
| 467 | 464 | { |
| r11160 | r11161 | |
| 478 | 475 | } |
| 479 | 476 | |
| 480 | 477 | #ifdef RENDER_AS_QUADS |
| 481 | | poly_render_quad_fan(poly, bitmap, &mClip.scissor, renderscanline_uvi_full, 4, clipverts, clipv); |
| 478 | poly_render_quad_fan(state->m_poly, bitmap, &mClip.scissor, renderscanline_uvi_full, 4, clipverts, clipv); |
| 482 | 479 | #else |
| 483 | | poly_render_triangle_fan(poly, bitmap, &mClip.scissor, renderscanline_uvi_full, 4, clipverts, clipv); |
| 480 | poly_render_triangle_fan(state->m_poly, bitmap, &mClip.scissor, renderscanline_uvi_full, 4, clipverts, clipv); |
| 484 | 481 | #endif |
| 485 | 482 | } |
| 486 | 483 | |
| r11160 | r11161 | |
| 490 | 487 | int y_index = extent->param[1].start * 65536.0f; |
| 491 | 488 | int dx = extent->param[0].dpdx * 65536.0f; |
| 492 | 489 | const poly_extra_data *extra = (const poly_extra_data *)extradata; |
| 490 | namcos22_state *state = extra->machine->driver_data<namcos22_state>(); |
| 493 | 491 | bitmap_t *destmap = (bitmap_t *)destbase; |
| 494 | 492 | const pen_t *pal = extra->pens; |
| 495 | 493 | int prioverchar = extra->prioverchar; |
| r11160 | r11161 | |
| 504 | 502 | INT16 fogDelta = 0; |
| 505 | 503 | int fadeEnable = (mixer.target&2) && mixer.fadeFactor; |
| 506 | 504 | |
| 507 | | if( mbSuperSystem22 ) |
| 505 | if( state->m_mbSuperSystem22 ) |
| 508 | 506 | { |
| 509 | | fogDelta = nthword(namcos22_czattr, 0 ); |
| 510 | | bFogEnable = nthword(namcos22_czattr,4)&0x4000; /* ? */ |
| 507 | fogDelta = nthword(state->m_czattr, 0 ); |
| 508 | bFogEnable = nthword(state->m_czattr,4)&0x4000; /* ? */ |
| 511 | 509 | } |
| 512 | 510 | else |
| 513 | 511 | { |
| r11160 | r11161 | |
| 528 | 526 | if( bFogEnable && z!=0xffff ) |
| 529 | 527 | { |
| 530 | 528 | int zc = Clamp256(fogDelta + z); |
| 531 | | UINT16 fogDensity = namcos22_czram[3][zc]; |
| 529 | UINT16 fogDensity = state->m_czram[3][zc]; |
| 532 | 530 | if( fogDensity>0 ) |
| 533 | 531 | { |
| 534 | 532 | int fogDensity2 = 0x2000 - fogDensity; |
| r11160 | r11161 | |
| 561 | 559 | UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy, |
| 562 | 560 | int scalex, int scaley, int z, int prioverchar, int alpha ) |
| 563 | 561 | { |
| 562 | namcos22_state *state = gfx->machine().driver_data<namcos22_state>(); |
| 564 | 563 | int sprite_screen_height = (scaley*gfx->height+0x8000)>>16; |
| 565 | 564 | int sprite_screen_width = (scalex*gfx->width+0x8000)>>16; |
| 566 | 565 | if (sprite_screen_width && sprite_screen_height && gfx) |
| r11160 | r11161 | |
| 591 | 590 | vert[3].p[0] = flipx ? fwidth : 0; |
| 592 | 591 | vert[3].p[1] = flipy ? 0 : fheight; |
| 593 | 592 | |
| 594 | | extra = (poly_extra_data *)poly_get_extra_data(poly); |
| 593 | extra = (poly_extra_data *)poly_get_extra_data(state->m_poly); |
| 594 | extra->machine = &gfx->machine(); |
| 595 | 595 | extra->z = z; |
| 596 | 596 | extra->alpha = alpha; |
| 597 | 597 | extra->prioverchar = prioverchar; |
| r11160 | r11161 | |
| 600 | 600 | extra->priority_bitmap = gfx->machine().priority_bitmap; |
| 601 | 601 | extra->source = gfx_element_get_data(gfx, code % gfx->total_elements); |
| 602 | 602 | #ifdef RENDER_AS_QUADS |
| 603 | | poly_render_quad_fan(poly, dest_bmp, clip, renderscanline_sprite, 2, 4, &vert[0]); |
| 603 | poly_render_quad_fan(state->m_poly, dest_bmp, clip, renderscanline_sprite, 2, 4, &vert[0]); |
| 604 | 604 | #else |
| 605 | | poly_render_triangle_fan(poly, dest_bmp, clip, renderscanline_sprite, 2, 4, &vert[0]); |
| 605 | poly_render_triangle_fan(state->m_poly, dest_bmp, clip, renderscanline_sprite, 2, 4, &vert[0]); |
| 606 | 606 | #endif |
| 607 | 607 | } |
| 608 | 608 | } /* mydrawgfxzoom */ |
| r11160 | r11161 | |
| 610 | 610 | static void |
| 611 | 611 | ApplyGamma( running_machine &machine, bitmap_t *bitmap ) |
| 612 | 612 | { |
| 613 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 613 | 614 | int x,y; |
| 614 | | if( mbSuperSystem22 ) |
| 615 | if( state->m_mbSuperSystem22 ) |
| 615 | 616 | { /* super system 22 */ |
| 616 | 617 | #define XORPAT NATIVE_ENDIAN_VALUE_LE_BE(3,0) |
| 617 | | const UINT8 *rlut = (const UINT8 *)&namcos22_gamma[0x100/4]; |
| 618 | | const UINT8 *glut = (const UINT8 *)&namcos22_gamma[0x200/4]; |
| 619 | | const UINT8 *blut = (const UINT8 *)&namcos22_gamma[0x300/4]; |
| 618 | const UINT8 *rlut = (const UINT8 *)&state->m_gamma[0x100/4]; |
| 619 | const UINT8 *glut = (const UINT8 *)&state->m_gamma[0x200/4]; |
| 620 | const UINT8 *blut = (const UINT8 *)&state->m_gamma[0x300/4]; |
| 620 | 621 | for( y=0; y<bitmap->height; y++ ) |
| 621 | 622 | { |
| 622 | 623 | UINT32 *dest = BITMAP_ADDR32(bitmap, y, 0); |
| r11160 | r11161 | |
| 653 | 654 | static void |
| 654 | 655 | poly3d_Draw3dSprite( bitmap_t *bitmap, const gfx_element *gfx, int tileNumber, int color, int sx, int sy, int width, int height, int translucency, int zc, UINT32 pri ) |
| 655 | 656 | { |
| 656 | | int flipx = 0; |
| 657 | | int flipy = 0; |
| 658 | | rectangle clip; |
| 659 | | clip.min_x = 0; |
| 660 | | clip.min_y = 0; |
| 661 | | clip.max_x = 640-1; |
| 662 | | clip.max_y = 480-1; |
| 663 | | mydrawgfxzoom( |
| 664 | | bitmap, |
| 665 | | &clip, |
| 666 | | gfx, |
| 667 | | tileNumber, |
| 668 | | color, |
| 669 | | flipx, flipy, |
| 670 | | sx, sy, |
| 671 | | (width<<16)/32, |
| 672 | | (height<<16)/32, |
| 673 | | zc, pri, 0xff - translucency ); |
| 657 | int flipx = 0; |
| 658 | int flipy = 0; |
| 659 | rectangle clip; |
| 660 | clip.min_x = 0; |
| 661 | clip.min_y = 0; |
| 662 | clip.max_x = 640-1; |
| 663 | clip.max_y = 480-1; |
| 664 | mydrawgfxzoom( |
| 665 | bitmap, |
| 666 | &clip, |
| 667 | gfx, |
| 668 | tileNumber, |
| 669 | color, |
| 670 | flipx, flipy, |
| 671 | sx, sy, |
| 672 | (width<<16)/32, |
| 673 | (height<<16)/32, |
| 674 | zc, pri, 0xff - translucency ); |
| 674 | 675 | } |
| 675 | 676 | |
| 676 | 677 | #define DSP_FIXED_TO_FLOAT( X ) (((INT16)(X))/(float)0x7fff) |
| r11160 | r11161 | |
| 679 | 680 | #define NUM_CG_CHARS ((CGRAM_SIZE*8)/(64*16)) /* 0x3c0 */ |
| 680 | 681 | |
| 681 | 682 | /* 16 bit access to DSP RAM */ |
| 682 | | static UINT16 namcos22_dspram_bank; |
| 683 | | static UINT16 mUpperWordLatch; |
| 684 | 683 | |
| 685 | | static int mbDSPisActive; |
| 686 | 684 | |
| 687 | 685 | /* modal rendering properties */ |
| 688 | | static INT32 mAbsolutePriority; |
| 689 | | static INT32 mObjectShiftValue22; |
| 690 | 686 | |
| 691 | | static UINT16 mPrimitiveID; /* 3d primitive to render */ |
| 692 | 687 | |
| 693 | | static float mViewMatrix[4][4]; |
| 694 | 688 | |
| 695 | 689 | static void |
| 696 | 690 | matrix3d_Multiply( float A[4][4], float B[4][4] ) |
| r11160 | r11161 | |
| 750 | 744 | *nz = m[0][2]*x + m[1][2]*y + m[2][2]*z; |
| 751 | 745 | } |
| 752 | 746 | |
| 753 | | #define MAX_LIT_SURFACES 32 |
| 754 | | static UINT8 mLitSurfaceInfo[MAX_LIT_SURFACES]; |
| 755 | | static INT32 mSurfaceNormalFormat; |
| 756 | 747 | |
| 757 | | static unsigned mLitSurfaceCount; |
| 758 | | static unsigned mLitSurfaceIndex; |
| 759 | 748 | |
| 760 | | static int mPtRomSize; |
| 761 | | static const UINT8 *mpPolyH; |
| 762 | | static const UINT8 *mpPolyM; |
| 763 | | static const UINT8 *mpPolyL; |
| 764 | | |
| 765 | 749 | static struct |
| 766 | 750 | { |
| 767 | 751 | float zoom, vx, vy, vw, vh; |
| r11160 | r11161 | |
| 772 | 756 | |
| 773 | 757 | typedef enum |
| 774 | 758 | { |
| 775 | | eSCENENODE_NONLEAF, |
| 776 | | eSCENENODE_QUAD3D, |
| 777 | | eSCENENODE_SPRITE |
| 759 | eSCENENODE_NONLEAF, |
| 760 | eSCENENODE_QUAD3D, |
| 761 | eSCENENODE_SPRITE |
| 778 | 762 | } SceneNodeType; |
| 779 | 763 | |
| 780 | 764 | #define RADIX_BITS 4 |
| r11160 | r11161 | |
| 783 | 767 | |
| 784 | 768 | struct SceneNode |
| 785 | 769 | { |
| 786 | | SceneNodeType type; |
| 787 | | struct SceneNode *nextInBucket; |
| 788 | | union |
| 789 | | { |
| 790 | | struct |
| 791 | | { |
| 792 | | struct SceneNode *next[RADIX_BUCKETS]; |
| 793 | | } nonleaf; |
| 770 | SceneNodeType type; |
| 771 | struct SceneNode *nextInBucket; |
| 772 | union |
| 773 | { |
| 774 | struct |
| 775 | { |
| 776 | struct SceneNode *next[RADIX_BUCKETS]; |
| 777 | } nonleaf; |
| 794 | 778 | |
| 795 | | struct |
| 796 | | { |
| 797 | | float vx,vy,vw,vh; |
| 798 | | int textureBank; |
| 799 | | int color; |
| 800 | | int cmode; |
| 801 | | int flags; |
| 802 | | int direct; |
| 803 | | Poly3dVertex v[4]; |
| 804 | | } quad3d; |
| 779 | struct |
| 780 | { |
| 781 | float vx,vy,vw,vh; |
| 782 | int textureBank; |
| 783 | int color; |
| 784 | int cmode; |
| 785 | int flags; |
| 786 | int direct; |
| 787 | Poly3dVertex v[4]; |
| 788 | } quad3d; |
| 805 | 789 | |
| 806 | | struct |
| 807 | | { |
| 808 | | int tile, color, pri; |
| 809 | | int flipx, flipy; |
| 790 | struct |
| 791 | { |
| 792 | int tile, color, pri; |
| 793 | int flipx, flipy; |
| 810 | 794 | int linkType; |
| 811 | | int numcols, numrows; |
| 812 | | int xpos, ypos; |
| 813 | | int sizex, sizey; |
| 814 | | int translucency; |
| 815 | | int cz; |
| 816 | | } sprite; |
| 817 | | } data; |
| 795 | int numcols, numrows; |
| 796 | int xpos, ypos; |
| 797 | int sizex, sizey; |
| 798 | int translucency; |
| 799 | int cz; |
| 800 | } sprite; |
| 801 | } data; |
| 818 | 802 | }; |
| 819 | 803 | static struct SceneNode mSceneRoot; |
| 820 | 804 | static struct SceneNode *mpFreeSceneNode; |
| r11160 | r11161 | |
| 822 | 806 | static void |
| 823 | 807 | FreeSceneNode( struct SceneNode *node ) |
| 824 | 808 | { |
| 825 | | node->nextInBucket = mpFreeSceneNode; |
| 826 | | mpFreeSceneNode = node; |
| 809 | node->nextInBucket = mpFreeSceneNode; |
| 810 | mpFreeSceneNode = node; |
| 827 | 811 | } /* FreeSceneNode */ |
| 828 | 812 | |
| 829 | 813 | static struct SceneNode * |
| 830 | 814 | MallocSceneNode( running_machine &machine ) |
| 831 | 815 | { |
| 832 | | struct SceneNode *node = mpFreeSceneNode; |
| 833 | | if( node ) |
| 834 | | { /* use free pool */ |
| 835 | | mpFreeSceneNode = node->nextInBucket; |
| 836 | | } |
| 837 | | else |
| 838 | | { |
| 839 | | node = auto_alloc(machine, struct SceneNode); |
| 840 | | } |
| 841 | | memset( node, 0, sizeof(*node) ); |
| 842 | | return node; |
| 816 | struct SceneNode *node = mpFreeSceneNode; |
| 817 | if( node ) |
| 818 | { /* use free pool */ |
| 819 | mpFreeSceneNode = node->nextInBucket; |
| 820 | } |
| 821 | else |
| 822 | { |
| 823 | node = auto_alloc(machine, struct SceneNode); |
| 824 | } |
| 825 | memset( node, 0, sizeof(*node) ); |
| 826 | return node; |
| 843 | 827 | } /* MallocSceneNode */ |
| 844 | 828 | |
| 845 | 829 | static struct SceneNode * |
| 846 | 830 | NewSceneNode( running_machine &machine, UINT32 zsortvalue24, SceneNodeType type ) |
| 847 | 831 | { |
| 848 | | struct SceneNode *node = &mSceneRoot; |
| 849 | | int i; |
| 850 | | for( i=0; i<24; i+=RADIX_BITS ) |
| 851 | | { |
| 852 | | int hash = (zsortvalue24>>20)&RADIX_MASK; |
| 853 | | struct SceneNode *next = node->data.nonleaf.next[hash]; |
| 854 | | if( !next ) |
| 855 | | { /* lazily allocate tree node for this radix */ |
| 856 | | next = MallocSceneNode(machine); |
| 857 | | next->type = eSCENENODE_NONLEAF; |
| 858 | | node->data.nonleaf.next[hash] = next; |
| 859 | | } |
| 860 | | node = next; |
| 861 | | zsortvalue24 <<= RADIX_BITS; |
| 862 | | } |
| 832 | struct SceneNode *node = &mSceneRoot; |
| 833 | int i; |
| 834 | for( i=0; i<24; i+=RADIX_BITS ) |
| 835 | { |
| 836 | int hash = (zsortvalue24>>20)&RADIX_MASK; |
| 837 | struct SceneNode *next = node->data.nonleaf.next[hash]; |
| 838 | if( !next ) |
| 839 | { /* lazily allocate tree node for this radix */ |
| 840 | next = MallocSceneNode(machine); |
| 841 | next->type = eSCENENODE_NONLEAF; |
| 842 | node->data.nonleaf.next[hash] = next; |
| 843 | } |
| 844 | node = next; |
| 845 | zsortvalue24 <<= RADIX_BITS; |
| 846 | } |
| 863 | 847 | |
| 864 | | if( node->type == eSCENENODE_NONLEAF ) |
| 865 | | { /* first leaf allocation on this branch */ |
| 866 | | node->type = type; |
| 867 | | return node; |
| 868 | | } |
| 869 | | else |
| 870 | | { |
| 871 | | struct SceneNode *leaf = MallocSceneNode(machine); |
| 872 | | leaf->type = type; |
| 848 | if( node->type == eSCENENODE_NONLEAF ) |
| 849 | { /* first leaf allocation on this branch */ |
| 850 | node->type = type; |
| 851 | return node; |
| 852 | } |
| 853 | else |
| 854 | { |
| 855 | struct SceneNode *leaf = MallocSceneNode(machine); |
| 856 | leaf->type = type; |
| 873 | 857 | #if 0 |
| 874 | | leaf->nextInBucket = node->nextInBucket; |
| 875 | | node->nextInBucket = leaf; |
| 858 | leaf->nextInBucket = node->nextInBucket; |
| 859 | node->nextInBucket = leaf; |
| 876 | 860 | #else |
| 877 | 861 | /* stable insertion sort */ |
| 878 | 862 | leaf->nextInBucket = NULL; |
| r11160 | r11161 | |
| 882 | 866 | } |
| 883 | 867 | node->nextInBucket = leaf; |
| 884 | 868 | #endif |
| 885 | | return leaf; |
| 886 | | } |
| 869 | return leaf; |
| 870 | } |
| 887 | 871 | } /* NewSceneNode */ |
| 888 | 872 | |
| 889 | 873 | |
| 890 | 874 | static void RenderSprite(running_machine &machine, bitmap_t *bitmap, struct SceneNode *node ) |
| 891 | 875 | { |
| 892 | 876 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 893 | | int tile = node->data.sprite.tile; |
| 894 | | int col,row; |
| 877 | int tile = node->data.sprite.tile; |
| 878 | int col,row; |
| 895 | 879 | int i = 0; |
| 896 | | for( row=0; row<node->data.sprite.numrows; row++ ) |
| 897 | | { |
| 898 | | for( col=0; col<node->data.sprite.numcols; col++ ) |
| 880 | for( row=0; row<node->data.sprite.numrows; row++ ) |
| 899 | 881 | { |
| 900 | | int code = tile; |
| 901 | | if( node->data.sprite.linkType == 0xff ) |
| 902 | | { |
| 903 | | code += i; |
| 904 | | } |
| 905 | | else |
| 906 | | { |
| 907 | | code += nthword( &state->m_spriteram[0x800/4], i+node->data.sprite.linkType*4 ); |
| 908 | | } |
| 909 | | poly3d_Draw3dSprite( |
| 910 | | bitmap, |
| 911 | | machine.gfx[GFX_SPRITE], |
| 912 | | code, |
| 913 | | node->data.sprite.color, |
| 914 | | node->data.sprite.xpos+col*node->data.sprite.sizex, |
| 915 | | node->data.sprite.ypos+row*node->data.sprite.sizey, |
| 916 | | node->data.sprite.sizex, |
| 917 | | node->data.sprite.sizey, |
| 918 | | node->data.sprite.translucency, |
| 919 | | node->data.sprite.cz, |
| 920 | | node->data.sprite.pri ); |
| 921 | | i++; |
| 922 | | } /* next col */ |
| 923 | | } /* next row */ |
| 882 | for( col=0; col<node->data.sprite.numcols; col++ ) |
| 883 | { |
| 884 | int code = tile; |
| 885 | if( node->data.sprite.linkType == 0xff ) |
| 886 | { |
| 887 | code += i; |
| 888 | } |
| 889 | else |
| 890 | { |
| 891 | code += nthword( &state->m_spriteram[0x800/4], i+node->data.sprite.linkType*4 ); |
| 892 | } |
| 893 | poly3d_Draw3dSprite( |
| 894 | bitmap, |
| 895 | machine.gfx[GFX_SPRITE], |
| 896 | code, |
| 897 | node->data.sprite.color, |
| 898 | node->data.sprite.xpos+col*node->data.sprite.sizex, |
| 899 | node->data.sprite.ypos+row*node->data.sprite.sizey, |
| 900 | node->data.sprite.sizex, |
| 901 | node->data.sprite.sizey, |
| 902 | node->data.sprite.translucency, |
| 903 | node->data.sprite.cz, |
| 904 | node->data.sprite.pri ); |
| 905 | i++; |
| 906 | } /* next col */ |
| 907 | } /* next row */ |
| 924 | 908 | } /* RenderSprite */ |
| 925 | 909 | |
| 926 | 910 | static void RenderSceneHelper(running_machine &machine, bitmap_t *bitmap, struct SceneNode *node ) |
| 927 | 911 | { |
| 928 | | if( node ) |
| 929 | | { |
| 930 | | if( node->type == eSCENENODE_NONLEAF ) |
| 931 | | { |
| 932 | | int i; |
| 933 | | for( i=RADIX_BUCKETS-1; i>=0; i-- ) |
| 934 | | { |
| 935 | | RenderSceneHelper(machine, bitmap, node->data.nonleaf.next[i] ); |
| 936 | | } |
| 937 | | FreeSceneNode( node ); |
| 938 | | } |
| 939 | | else |
| 940 | | { |
| 941 | | while( node ) |
| 942 | | { |
| 943 | | struct SceneNode *next = node->nextInBucket; |
| 912 | if( node ) |
| 913 | { |
| 914 | if( node->type == eSCENENODE_NONLEAF ) |
| 915 | { |
| 916 | int i; |
| 917 | for( i=RADIX_BUCKETS-1; i>=0; i-- ) |
| 918 | { |
| 919 | RenderSceneHelper(machine, bitmap, node->data.nonleaf.next[i] ); |
| 920 | } |
| 921 | FreeSceneNode( node ); |
| 922 | } |
| 923 | else |
| 924 | { |
| 925 | while( node ) |
| 926 | { |
| 927 | struct SceneNode *next = node->nextInBucket; |
| 944 | 928 | |
| 945 | | switch( node->type ) |
| 946 | | { |
| 947 | | case eSCENENODE_QUAD3D: |
| 948 | | poly3d_Clip( |
| 949 | | node->data.quad3d.vx, |
| 950 | | node->data.quad3d.vy, |
| 951 | | node->data.quad3d.vw, |
| 952 | | node->data.quad3d.vh ); |
| 953 | | poly3d_DrawQuad(machine, |
| 954 | | bitmap, |
| 955 | | node->data.quad3d.textureBank, |
| 956 | | node->data.quad3d.color, |
| 957 | | node->data.quad3d.v, |
| 958 | | node->data.quad3d.flags, |
| 959 | | node->data.quad3d.direct, |
| 960 | | node->data.quad3d.cmode ); |
| 961 | | break; |
| 929 | switch( node->type ) |
| 930 | { |
| 931 | case eSCENENODE_QUAD3D: |
| 932 | poly3d_Clip( |
| 933 | node->data.quad3d.vx, |
| 934 | node->data.quad3d.vy, |
| 935 | node->data.quad3d.vw, |
| 936 | node->data.quad3d.vh ); |
| 937 | poly3d_DrawQuad(machine, |
| 938 | bitmap, |
| 939 | node->data.quad3d.textureBank, |
| 940 | node->data.quad3d.color, |
| 941 | node->data.quad3d.v, |
| 942 | node->data.quad3d.flags, |
| 943 | node->data.quad3d.direct, |
| 944 | node->data.quad3d.cmode ); |
| 945 | break; |
| 962 | 946 | |
| 963 | | case eSCENENODE_SPRITE: |
| 964 | | poly3d_NoClip(); |
| 965 | | RenderSprite(machine, bitmap,node ); |
| 966 | | break; |
| 947 | case eSCENENODE_SPRITE: |
| 948 | poly3d_NoClip(); |
| 949 | RenderSprite(machine, bitmap,node ); |
| 950 | break; |
| 967 | 951 | |
| 968 | | default: |
| 969 | | fatalerror("invalid node->type"); |
| 970 | | break; |
| 971 | | } |
| 972 | | FreeSceneNode( node ); |
| 973 | | node = next; |
| 974 | | } |
| 975 | | } |
| 976 | | } |
| 952 | default: |
| 953 | fatalerror("invalid node->type"); |
| 954 | break; |
| 955 | } |
| 956 | FreeSceneNode( node ); |
| 957 | node = next; |
| 958 | } |
| 959 | } |
| 960 | } |
| 977 | 961 | } /* RenderSceneHelper */ |
| 978 | 962 | |
| 979 | 963 | static void RenderScene(running_machine &machine, bitmap_t *bitmap ) |
| 980 | 964 | { |
| 981 | | struct SceneNode *node = &mSceneRoot; |
| 982 | | int i; |
| 983 | | for( i=RADIX_BUCKETS-1; i>=0; i-- ) |
| 984 | | { |
| 985 | | RenderSceneHelper(machine, bitmap, node->data.nonleaf.next[i] ); |
| 986 | | node->data.nonleaf.next[i] = NULL; |
| 987 | | } |
| 988 | | poly3d_NoClip(); |
| 989 | | poly_wait(poly, "DrawPolygons"); |
| 965 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 966 | struct SceneNode *node = &mSceneRoot; |
| 967 | int i; |
| 968 | for( i=RADIX_BUCKETS-1; i>=0; i-- ) |
| 969 | { |
| 970 | RenderSceneHelper(machine, bitmap, node->data.nonleaf.next[i] ); |
| 971 | node->data.nonleaf.next[i] = NULL; |
| 972 | } |
| 973 | poly3d_NoClip(); |
| 974 | poly_wait(state->m_poly, "DrawPolygons"); |
| 990 | 975 | } /* RenderScene */ |
| 991 | 976 | |
| 992 | 977 | static float |
| 993 | 978 | DspFloatToNativeFloat( UINT32 iVal ) |
| 994 | 979 | { |
| 995 | | INT16 mantissa = (INT16)iVal; |
| 996 | | float result = mantissa;//?((float)mantissa):((float)0x10000); |
| 980 | INT16 mantissa = (INT16)iVal; |
| 981 | float result = mantissa;//?((float)mantissa):((float)0x10000); |
| 997 | 982 | int exponent = (iVal>>16)&0xff; |
| 998 | 983 | while( exponent<0x2e ) |
| 999 | 984 | { |
| r11160 | r11161 | |
| 1004 | 989 | } /* DspFloatToNativeFloat */ |
| 1005 | 990 | |
| 1006 | 991 | static INT32 |
| 1007 | | GetPolyData( INT32 addr ) |
| 992 | GetPolyData( namcos22_state *state, INT32 addr ) |
| 1008 | 993 | { |
| 1009 | 994 | INT32 result; |
| 1010 | | if( addr<0 || addr>=mPtRomSize ) |
| 995 | if( addr<0 || addr>=state->m_mPtRomSize ) |
| 1011 | 996 | { |
| 1012 | 997 | return -1; /* HACK */ |
| 1013 | 998 | } |
| 1014 | | result = (mpPolyH[addr]<<16)|(mpPolyM[addr]<<8)|mpPolyL[addr]; |
| 999 | result = (state->m_mpPolyH[addr]<<16)|(state->m_mpPolyM[addr]<<8)|state->m_mpPolyL[addr]; |
| 1015 | 1000 | if( result&0x00800000 ) |
| 1016 | 1001 | { |
| 1017 | 1002 | result |= 0xff000000; /* sign extend */ |
| r11160 | r11161 | |
| 1020 | 1005 | } /* GetPolyData */ |
| 1021 | 1006 | |
| 1022 | 1007 | UINT32 |
| 1023 | | namcos22_point_rom_r( offs_t offs ) |
| 1008 | namcos22_point_rom_r( running_machine &machine, offs_t offs ) |
| 1024 | 1009 | { |
| 1025 | | return GetPolyData(offs); |
| 1010 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 1011 | return GetPolyData(state, offs); |
| 1026 | 1012 | } |
| 1027 | 1013 | |
| 1028 | | UINT32 *namcos22_cgram; |
| 1029 | | UINT32 *namcos22_textram; |
| 1030 | | UINT32 *namcos22_polygonram; |
| 1031 | | UINT32 *namcos22_gamma; |
| 1032 | | UINT32 *namcos22_vics_data; |
| 1033 | | UINT32 *namcos22_vics_control; |
| 1034 | 1014 | |
| 1035 | 1015 | /* |
| 1036 | 1016 | 0 2 4 6 8 a b |
| r11160 | r11161 | |
| 1047 | 1027 | //00810000: ff80 ff80 ff80 ff80 0000 0000 0000 0000 // hs entry |
| 1048 | 1028 | //00810000: ff01 ff01 0000 0000 0000 0000 00e4 0000 // alpine racer |
| 1049 | 1029 | */ |
| 1050 | | UINT32 *namcos22_czattr; |
| 1051 | 1030 | |
| 1052 | | UINT32 *namcos22_tilemapattr; |
| 1053 | 1031 | |
| 1054 | | static UINT8 *dirtypal; |
| 1055 | 1032 | |
| 1056 | 1033 | READ32_HANDLER( namcos22_czram_r ) |
| 1057 | 1034 | { |
| 1058 | | int bank = nthword(namcos22_czattr,0xa/2); |
| 1059 | | const UINT16 *czram = namcos22_czram[bank&3]; |
| 1060 | | return (czram[offset*2]<<16)|czram[offset*2+1]; |
| 1035 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1036 | int bank = nthword(state->m_czattr,0xa/2); |
| 1037 | const UINT16 *czram = state->m_czram[bank&3]; |
| 1038 | return (czram[offset*2]<<16)|czram[offset*2+1]; |
| 1061 | 1039 | } |
| 1062 | 1040 | |
| 1063 | 1041 | WRITE32_HANDLER( namcos22_czram_w ) |
| 1064 | 1042 | { |
| 1065 | | int bank = nthword(namcos22_czattr,0xa/2); |
| 1066 | | UINT16 *czram = namcos22_czram[bank&3]; |
| 1067 | | UINT32 dat = (czram[offset*2]<<16)|czram[offset*2+1]; |
| 1068 | | COMBINE_DATA( &dat ); |
| 1069 | | czram[offset*2] = dat>>16; |
| 1070 | | czram[offset*2+1] = dat&0xffff; |
| 1043 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1044 | int bank = nthword(state->m_czattr,0xa/2); |
| 1045 | UINT16 *czram = state->m_czram[bank&3]; |
| 1046 | UINT32 dat = (czram[offset*2]<<16)|czram[offset*2+1]; |
| 1047 | COMBINE_DATA( &dat ); |
| 1048 | czram[offset*2] = dat>>16; |
| 1049 | czram[offset*2+1] = dat&0xffff; |
| 1071 | 1050 | } |
| 1072 | 1051 | |
| 1073 | 1052 | static void |
| 1074 | | InitXYAttrToPixel( void ) |
| 1053 | InitXYAttrToPixel( namcos22_state *state ) |
| 1075 | 1054 | { |
| 1076 | 1055 | unsigned attr,x,y,ix,iy,temp; |
| 1077 | 1056 | for( attr=0; attr<16; attr++ ) |
| r11160 | r11161 | |
| 1084 | 1063 | if( attr&4 ) ix = 15-ix; |
| 1085 | 1064 | if( attr&2 ) iy = 15-iy; |
| 1086 | 1065 | if( attr&8 ){ temp = ix; ix = iy; iy = temp; } |
| 1087 | | mXYAttrToPixel[attr][x][y] = (iy<<4)|ix; |
| 1066 | state->m_mXYAttrToPixel[attr][x][y] = (iy<<4)|ix; |
| 1088 | 1067 | } |
| 1089 | 1068 | } |
| 1090 | 1069 | } |
| 1091 | 1070 | } /* InitXYAttrToPixel */ |
| 1092 | 1071 | |
| 1093 | 1072 | static void |
| 1094 | | PatchTexture( void ) |
| 1073 | PatchTexture( namcos22_state *state ) |
| 1095 | 1074 | { |
| 1096 | 1075 | int i; |
| 1097 | | switch( namcos22_gametype ) |
| 1076 | switch( state->m_gametype ) |
| 1098 | 1077 | { |
| 1099 | 1078 | case NAMCOS22_RIDGE_RACER: |
| 1100 | 1079 | case NAMCOS22_RIDGE_RACER2: |
| r11160 | r11161 | |
| 1102 | 1081 | case NAMCOS22_CYBER_COMMANDO: |
| 1103 | 1082 | for( i=0; i<0x100000; i++ ) |
| 1104 | 1083 | { |
| 1105 | | int tile = mpTextureTileMap16[i]; |
| 1106 | | int attr = mpTextureTileMapAttr[i]; |
| 1084 | int tile = state->m_mpTextureTileMap16[i]; |
| 1085 | int attr = state->m_mpTextureTileMapAttr[i]; |
| 1107 | 1086 | if( (attr&0x1)==0 ) |
| 1108 | 1087 | { |
| 1109 | 1088 | tile = (tile&0x3fff)|0x8000; |
| 1110 | | mpTextureTileMap16[i] = tile; |
| 1089 | state->m_mpTextureTileMap16[i] = tile; |
| 1111 | 1090 | } |
| 1112 | 1091 | } |
| 1113 | 1092 | break; |
| r11160 | r11161 | |
| 1120 | 1099 | void |
| 1121 | 1100 | namcos22_draw_direct_poly( running_machine &machine, const UINT16 *pSource ) |
| 1122 | 1101 | { |
| 1102 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 1123 | 1103 | /** |
| 1124 | 1104 | * word#0: |
| 1125 | 1105 | * x--------------- end-of-display-list marker |
| r11160 | r11161 | |
| 1131 | 1111 | * word#2: |
| 1132 | 1112 | * xxxxxxxx-------- PAL (high bit is fog enable) |
| 1133 | 1113 | * --------xxxx---- CMODE (color mode for texture unpack) |
| 1134 | | * ------------xxxx BN (texture bank) |
| 1114 | * ------------xxxx BN (texture bank) |
| 1135 | 1115 | * |
| 1136 | 1116 | * word#3: |
| 1137 | 1117 | * xxxxxxxx-------- ZC |
| r11160 | r11161 | |
| 1139 | 1119 | * |
| 1140 | 1120 | * for each vertex: |
| 1141 | 1121 | * xxxx xxxx // u,v |
| 1142 | | * |
| 1122 | * |
| 1143 | 1123 | * xxxx xxxx // sx,sy |
| 1144 | | * |
| 1124 | * |
| 1145 | 1125 | * xx-- ---- // BRI |
| 1146 | | * --xx xxxx // zpos |
| 1147 | | */ |
| 1126 | * --xx xxxx // zpos |
| 1127 | */ |
| 1148 | 1128 | INT32 zsortvalue24 = ((pSource[1]&0xfff)<<12)|(pSource[0]&0xfff); |
| 1149 | 1129 | struct SceneNode *node = NewSceneNode(machine, zsortvalue24,eSCENENODE_QUAD3D); |
| 1150 | 1130 | int i; |
| r11160 | r11161 | |
| 1159 | 1139 | |
| 1160 | 1140 | p->u = pSource[0]; |
| 1161 | 1141 | p->v = pSource[1]; |
| 1162 | | if( mbSuperSystem22 ) |
| 1142 | if( state->m_mbSuperSystem22 ) |
| 1163 | 1143 | { |
| 1164 | 1144 | p->u >>= 4; |
| 1165 | 1145 | p->v >>= 4; |
| r11160 | r11161 | |
| 1178 | 1158 | zf /= 2.0; |
| 1179 | 1159 | exponent++; |
| 1180 | 1160 | } |
| 1181 | | if( mbSuperSystem22 ) |
| 1161 | if( state->m_mbSuperSystem22 ) |
| 1182 | 1162 | p->z = zf; |
| 1183 | 1163 | else |
| 1184 | 1164 | p->z = 1.0f/zf; |
| r11160 | r11161 | |
| 1211 | 1191 | static void |
| 1212 | 1192 | Prepare3dTexture( running_machine &machine, void *pTilemapROM, void *pTextureROM ) |
| 1213 | 1193 | { |
| 1214 | | int i; |
| 1215 | | assert( pTilemapROM && pTextureROM ); |
| 1216 | | { /* following setup is Namco System 22 specific */ |
| 1217 | | const UINT8 *pPackedTileAttr = 0x200000 + (UINT8 *)pTilemapROM; |
| 1218 | | UINT8 *pUnpackedTileAttr = auto_alloc_array(machine, UINT8, 0x080000*2); |
| 1219 | | { |
| 1220 | | InitXYAttrToPixel(); |
| 1221 | | mpTextureTileMapAttr = pUnpackedTileAttr; |
| 1222 | | for( i=0; i<0x80000; i++ ) |
| 1223 | | { |
| 1224 | | *pUnpackedTileAttr++ = (*pPackedTileAttr)>>4; |
| 1225 | | *pUnpackedTileAttr++ = (*pPackedTileAttr)&0xf; |
| 1226 | | pPackedTileAttr++; |
| 1227 | | } |
| 1228 | | mpTextureTileMap16 = (UINT16 *)pTilemapROM; |
| 1229 | | mpTextureTileData = (UINT8 *)pTextureROM; |
| 1230 | | PatchTexture(); |
| 1231 | | } |
| 1232 | | } |
| 1194 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 1195 | int i; |
| 1196 | assert( pTilemapROM && pTextureROM ); |
| 1197 | { /* following setup is Namco System 22 specific */ |
| 1198 | const UINT8 *pPackedTileAttr = 0x200000 + (UINT8 *)pTilemapROM; |
| 1199 | UINT8 *pUnpackedTileAttr = auto_alloc_array(machine, UINT8, 0x080000*2); |
| 1200 | { |
| 1201 | InitXYAttrToPixel(state); |
| 1202 | state->m_mpTextureTileMapAttr = pUnpackedTileAttr; |
| 1203 | for( i=0; i<0x80000; i++ ) |
| 1204 | { |
| 1205 | *pUnpackedTileAttr++ = (*pPackedTileAttr)>>4; |
| 1206 | *pUnpackedTileAttr++ = (*pPackedTileAttr)&0xf; |
| 1207 | pPackedTileAttr++; |
| 1208 | } |
| 1209 | state->m_mpTextureTileMap16 = (UINT16 *)pTilemapROM; |
| 1210 | state->m_mpTextureTileData = (UINT8 *)pTextureROM; |
| 1211 | PatchTexture(state); |
| 1212 | } |
| 1213 | } |
| 1233 | 1214 | } /* Prepare3dTexture */ |
| 1234 | 1215 | |
| 1235 | 1216 | static void |
| r11160 | r11161 | |
| 1308 | 1289 | { |
| 1309 | 1290 | struct SceneNode *node = NewSceneNode(machine, zcoord,eSCENENODE_SPRITE); |
| 1310 | 1291 | |
| 1311 | | // printf("[%02d]: tile %x pri %x color %x flipX %d flipY %d cols %d rows %d link %d X %d Y %d sX %d sY %d trans %d cz %d\n", |
| 1312 | | // i, tile, cz&0x80, color&0x7f, flipx, flipy, numcols, numrows, linkType, xpos, ypos, sizex, sizey, translucency, cz); |
| 1292 | //printf("[%02d]: tile %x pri %x color %x flipX %d flipY %d cols %d rows %d link %d X %d Y %d sX %d sY %d trans %d cz %d\n", |
| 1293 | //i, tile, cz&0x80, color&0x7f, flipx, flipy, numcols, numrows, linkType, xpos, ypos, sizex, sizey, translucency, cz); |
| 1313 | 1294 | |
| 1314 | 1295 | if (color == 0) color = 0x67; // extreme hack for Tokyo Wars |
| 1315 | 1296 | |
| 1316 | 1297 | node->data.sprite.tile = tile; |
| 1317 | 1298 | node->data.sprite.pri = cz&0x80; |
| 1318 | | // node->data.sprite.pri = (color&0x80); |
| 1299 | //node->data.sprite.pri = (color&0x80); |
| 1319 | 1300 | node->data.sprite.color = color&0x7f; |
| 1320 | 1301 | node->data.sprite.flipx = flipx; |
| 1321 | 1302 | node->data.sprite.flipy = flipy; |
| r11160 | r11161 | |
| 1429 | 1410 | deltay = 43; |
| 1430 | 1411 | } |
| 1431 | 1412 | |
| 1432 | | if( enable==6 /*&& namcos22_gametype!=NAMCOS22_AIR_COMBAT22*/ ) |
| 1413 | if( enable==6 /*&& state->m_gametype!=NAMCOS22_AIR_COMBAT22*/ ) |
| 1433 | 1414 | { |
| 1434 | 1415 | DrawSpritesHelper( machine, bitmap, cliprect, pSource, pPal, num_sprites, deltax, deltay ); |
| 1435 | 1416 | } |
| r11160 | r11161 | |
| 1449 | 1430 | 0x940060..0x94007c set#2 |
| 1450 | 1431 | */ |
| 1451 | 1432 | |
| 1452 | | num_sprites = (namcos22_vics_control[0x40/4]&0xffff)/0x10; |
| 1433 | num_sprites = (state->m_vics_control[0x40/4]&0xffff)/0x10; |
| 1453 | 1434 | if( num_sprites>=1 ) |
| 1454 | 1435 | { |
| 1455 | | pSource = &namcos22_vics_data[(namcos22_vics_control[0x48/4]&0xffff)/4]; |
| 1456 | | pPal = &namcos22_vics_data[(namcos22_vics_control[0x58/4]&0xffff)/4]; |
| 1436 | pSource = &state->m_vics_data[(state->m_vics_control[0x48/4]&0xffff)/4]; |
| 1437 | pPal = &state->m_vics_data[(state->m_vics_control[0x58/4]&0xffff)/4]; |
| 1457 | 1438 | DrawSpritesHelper( machine, bitmap, cliprect, pSource, pPal, num_sprites, deltax, deltay ); |
| 1458 | 1439 | } |
| 1459 | 1440 | |
| 1460 | | num_sprites = (namcos22_vics_control[0x60/4]&0xffff)/0x10; |
| 1441 | num_sprites = (state->m_vics_control[0x60/4]&0xffff)/0x10; |
| 1461 | 1442 | if( num_sprites>=1 ) |
| 1462 | 1443 | { |
| 1463 | | pSource = &namcos22_vics_data[(namcos22_vics_control[0x68/4]&0xffff)/4]; |
| 1464 | | pPal = &namcos22_vics_data[(namcos22_vics_control[0x78/4]&0xffff)/4]; |
| 1444 | pSource = &state->m_vics_data[(state->m_vics_control[0x68/4]&0xffff)/4]; |
| 1445 | pPal = &state->m_vics_data[(state->m_vics_control[0x78/4]&0xffff)/4]; |
| 1465 | 1446 | DrawSpritesHelper( machine, bitmap, cliprect, pSource, pPal, num_sprites, deltax, deltay ); |
| 1466 | 1447 | } |
| 1467 | 1448 | } /* DrawSprites */ |
| 1468 | 1449 | |
| 1469 | 1450 | static void UpdatePaletteS(running_machine &machine) /* for Super System22 - apply gamma correction and preliminary fader support */ |
| 1470 | 1451 | { |
| 1452 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 1471 | 1453 | int i; |
| 1472 | 1454 | for( i=0; i<NAMCOS22_PALETTE_SIZE/4; i++ ) |
| 1473 | 1455 | { |
| 1474 | | if( dirtypal[i] ) |
| 1456 | if( state->m_dirtypal[i] ) |
| 1475 | 1457 | { |
| 1476 | 1458 | int j; |
| 1477 | 1459 | for( j=0; j<4; j++ ) |
| r11160 | r11161 | |
| 1482 | 1464 | int b = nthbyte(machine.generic.paletteram.u32,which+0x10000); |
| 1483 | 1465 | palette_set_color( machine,which,MAKE_RGB(r,g,b) ); |
| 1484 | 1466 | } |
| 1485 | | dirtypal[i] = 0; |
| 1467 | state->m_dirtypal[i] = 0; |
| 1486 | 1468 | } |
| 1487 | 1469 | } |
| 1488 | 1470 | } /* UpdatePaletteS */ |
| 1489 | 1471 | |
| 1490 | 1472 | static void UpdatePalette(running_machine &machine) /* for System22 - ignore gamma/fader effects for now */ |
| 1491 | 1473 | { |
| 1474 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 1492 | 1475 | int i,j; |
| 1493 | 1476 | for( i=0; i<NAMCOS22_PALETTE_SIZE/4; i++ ) |
| 1494 | 1477 | { |
| 1495 | | if( dirtypal[i] ) |
| 1478 | if( state->m_dirtypal[i] ) |
| 1496 | 1479 | { |
| 1497 | 1480 | for( j=0; j<4; j++ ) |
| 1498 | 1481 | { |
| r11160 | r11161 | |
| 1502 | 1485 | int b = nthbyte(machine.generic.paletteram.u32,which+0x10000); |
| 1503 | 1486 | palette_set_color( machine,which,MAKE_RGB(r,g,b) ); |
| 1504 | 1487 | } |
| 1505 | | dirtypal[i] = 0; |
| 1488 | state->m_dirtypal[i] = 0; |
| 1506 | 1489 | } |
| 1507 | 1490 | } |
| 1508 | 1491 | } /* UpdatePalette */ |
| 1509 | 1492 | |
| 1510 | | static tilemap_t *bgtilemap; |
| 1511 | 1493 | |
| 1512 | 1494 | static TILE_GET_INFO( TextTilemapGetInfo ) |
| 1513 | 1495 | { |
| 1514 | | UINT16 data = nthword( namcos22_textram,tile_index ); |
| 1515 | | /** |
| 1516 | | * x---.----.----.---- blend |
| 1496 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 1497 | UINT16 data = nthword( state->m_textram,tile_index ); |
| 1498 | /** |
| 1499 | * x---.----.----.---- blend |
| 1517 | 1500 | * xxxx.----.----.---- palette select |
| 1518 | 1501 | * ----.xx--.----.---- flip |
| 1519 | 1502 | * ----.--xx.xxxx.xxxx code |
| r11160 | r11161 | |
| 1527 | 1510 | |
| 1528 | 1511 | READ32_HANDLER( namcos22_textram_r ) |
| 1529 | 1512 | { |
| 1530 | | return namcos22_textram[offset]; |
| 1513 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1514 | return state->m_textram[offset]; |
| 1531 | 1515 | } |
| 1532 | 1516 | |
| 1533 | 1517 | WRITE32_HANDLER( namcos22_textram_w ) |
| 1534 | 1518 | { |
| 1535 | | COMBINE_DATA( &namcos22_textram[offset] ); |
| 1536 | | tilemap_mark_tile_dirty( bgtilemap, offset*2 ); |
| 1537 | | tilemap_mark_tile_dirty( bgtilemap, offset*2+1 ); |
| 1519 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1520 | COMBINE_DATA( &state->m_textram[offset] ); |
| 1521 | tilemap_mark_tile_dirty( state->m_bgtilemap, offset*2 ); |
| 1522 | tilemap_mark_tile_dirty( state->m_bgtilemap, offset*2+1 ); |
| 1538 | 1523 | } |
| 1539 | 1524 | |
| 1540 | 1525 | static void |
| 1541 | | DrawTranslucentCharacters( bitmap_t *bitmap, const rectangle *cliprect ) |
| 1526 | DrawTranslucentCharacters( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect ) |
| 1542 | 1527 | { |
| 1528 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 1543 | 1529 | UINT8 alpha = 0xff-mixer.text_translucency; /* ? */ |
| 1544 | | tilemap_draw( bitmap, cliprect, bgtilemap, TILEMAP_DRAW_ALPHA(alpha)|1, 0 ); |
| 1530 | tilemap_draw( bitmap, cliprect, state->m_bgtilemap, TILEMAP_DRAW_ALPHA(alpha)|1, 0 ); |
| 1545 | 1531 | } |
| 1546 | 1532 | |
| 1547 | 1533 | static void DrawCharacterLayer(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect ) |
| 1548 | 1534 | { |
| 1549 | | INT32 dx = namcos22_tilemapattr[0]>>16; |
| 1550 | | INT32 dy = namcos22_tilemapattr[0]&0xffff; |
| 1551 | | /** |
| 1552 | | * namcos22_tilemapattr[0x4/4] == 0x006e0000 |
| 1553 | | * namcos22_tilemapattr[0x8/4] == 0x01ff0000 |
| 1554 | | * namcos22_tilemapattr[0xe/4] == ? |
| 1535 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 1536 | INT32 dx = state->m_tilemapattr[0]>>16; |
| 1537 | INT32 dy = state->m_tilemapattr[0]&0xffff; |
| 1538 | /** |
| 1539 | * state->m_tilemapattr[0x4/4] == 0x006e0000 |
| 1540 | * state->m_tilemapattr[0x8/4] == 0x01ff0000 |
| 1541 | * state->m_tilemapattr[0xe/4] == ? |
| 1555 | 1542 | */ |
| 1556 | 1543 | bitmap_fill(machine.priority_bitmap,cliprect,0); |
| 1557 | | tilemap_set_scrollx( bgtilemap,0, (dx-0x35c)&0x3ff ); |
| 1558 | | tilemap_set_scrolly( bgtilemap,0, dy&0x3ff ); |
| 1559 | | tilemap_set_palette_offset( bgtilemap, mixer.palBase*256 ); |
| 1560 | | tilemap_draw( bitmap, cliprect, bgtilemap, 0/*flags*/, 0x1/*priority*/ ); /* opaque */ |
| 1544 | tilemap_set_scrollx( state->m_bgtilemap,0, (dx-0x35c)&0x3ff ); |
| 1545 | tilemap_set_scrolly( state->m_bgtilemap,0, dy&0x3ff ); |
| 1546 | tilemap_set_palette_offset( state->m_bgtilemap, mixer.palBase*256 ); |
| 1547 | tilemap_draw( bitmap, cliprect, state->m_bgtilemap, 0/*flags*/, 0x1/*priority*/ ); /* opaque */ |
| 1561 | 1548 | } /* DrawCharacterLayer */ |
| 1562 | 1549 | |
| 1563 | 1550 | /*********************************************************************************************/ |
| r11160 | r11161 | |
| 1565 | 1552 | static int |
| 1566 | 1553 | Cap( int val, int minval, int maxval ) |
| 1567 | 1554 | { |
| 1568 | | if( val<minval ) |
| 1569 | | { |
| 1570 | | val = minval; |
| 1571 | | } |
| 1572 | | else if( val>maxval ) |
| 1573 | | { |
| 1574 | | val = maxval; |
| 1575 | | } |
| 1576 | | return val; |
| 1555 | if( val<minval ) |
| 1556 | { |
| 1557 | val = minval; |
| 1558 | } |
| 1559 | else if( val>maxval ) |
| 1560 | { |
| 1561 | val = maxval; |
| 1562 | } |
| 1563 | return val; |
| 1577 | 1564 | } |
| 1578 | 1565 | |
| 1579 | 1566 | #define LSB21 (0x1fffff) |
| r11160 | r11161 | |
| 1582 | 1569 | static INT32 |
| 1583 | 1570 | Signed18( UINT32 value ) |
| 1584 | 1571 | { |
| 1585 | | INT32 offset = value&LSB18; |
| 1586 | | if( offset&0x20000 ) |
| 1587 | | { /* sign extend */ |
| 1572 | INT32 offset = value&LSB18; |
| 1573 | if( offset&0x20000 ) |
| 1574 | { /* sign extend */ |
| 1588 | 1575 | offset |= ~LSB18; |
| 1589 | | } |
| 1590 | | return offset; |
| 1576 | } |
| 1577 | return offset; |
| 1591 | 1578 | } |
| 1592 | 1579 | |
| 1593 | 1580 | /** |
| r11160 | r11161 | |
| 1631 | 1618 | int flags, |
| 1632 | 1619 | int packetFormat ) |
| 1633 | 1620 | { |
| 1634 | | int absolutePriority = mAbsolutePriority; |
| 1621 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 1622 | int absolutePriority = state->m_mAbsolutePriority; |
| 1635 | 1623 | UINT32 zsortvalue24; |
| 1636 | 1624 | float zmin = 0.0f; |
| 1637 | 1625 | float zmax = 0.0f; |
| r11160 | r11161 | |
| 1642 | 1630 | for( i=0; i<4; i++ ) |
| 1643 | 1631 | { |
| 1644 | 1632 | Poly3dVertex *pVerTex = &v[i]; |
| 1645 | | pVerTex->x = GetPolyData( 8+i*3+addr ); |
| 1646 | | pVerTex->y = GetPolyData( 9+i*3+addr ); |
| 1647 | | pVerTex->z = GetPolyData( 10+i*3+addr ); |
| 1633 | pVerTex->x = GetPolyData( state, 8+i*3+addr ); |
| 1634 | pVerTex->y = GetPolyData( state, 9+i*3+addr ); |
| 1635 | pVerTex->z = GetPolyData( state, 10+i*3+addr ); |
| 1648 | 1636 | TransformPoint( &pVerTex->x, &pVerTex->y, &pVerTex->z, m ); |
| 1649 | 1637 | } /* for( i=0; i<4; i++ ) */ |
| 1650 | 1638 | |
| r11160 | r11161 | |
| 1668 | 1656 | Poly3dVertex *pVerTex = &v[i]; |
| 1669 | 1657 | int bri; |
| 1670 | 1658 | |
| 1671 | | pVerTex->u = GetPolyData( 0+i*2+addr ); |
| 1672 | | pVerTex->v = GetPolyData( 1+i*2+addr ); |
| 1659 | pVerTex->u = GetPolyData( state, 0+i*2+addr ); |
| 1660 | pVerTex->v = GetPolyData( state, 1+i*2+addr ); |
| 1673 | 1661 | |
| 1674 | 1662 | if( i==0 || pVerTex->z > zmax ) zmax = pVerTex->z; |
| 1675 | 1663 | if( i==0 || pVerTex->z < zmin ) zmin = pVerTex->z; |
| 1676 | 1664 | |
| 1677 | | if( mLitSurfaceCount ) |
| 1665 | if( state->m_mLitSurfaceCount ) |
| 1678 | 1666 | { |
| 1679 | | bri = mLitSurfaceInfo[mLitSurfaceIndex%mLitSurfaceCount]; |
| 1680 | | if( mSurfaceNormalFormat == 0x6666 ) |
| 1667 | bri = state->m_mLitSurfaceInfo[state->m_mLitSurfaceIndex%state->m_mLitSurfaceCount]; |
| 1668 | if( state->m_mSurfaceNormalFormat == 0x6666 ) |
| 1681 | 1669 | { |
| 1682 | 1670 | if( i==3 ) |
| 1683 | | mLitSurfaceIndex++; |
| 1671 | state->m_mLitSurfaceIndex++; |
| 1684 | 1672 | } |
| 1685 | | else if( mSurfaceNormalFormat == 0x4000 ) |
| 1686 | | mLitSurfaceIndex++; |
| 1673 | else if( state->m_mSurfaceNormalFormat == 0x4000 ) |
| 1674 | state->m_mLitSurfaceIndex++; |
| 1687 | 1675 | else |
| 1688 | | logerror( "unknown normal format: 0x%x\n", mSurfaceNormalFormat ); |
| 1676 | logerror( "unknown normal format: 0x%x\n", state->m_mSurfaceNormalFormat ); |
| 1689 | 1677 | } /* pLitSurfaceInfo */ |
| 1690 | 1678 | else if( packetFormat & 0x40 ) |
| 1691 | | bri = (GetPolyData(i+addr)>>16)&0xff; |
| 1679 | bri = (GetPolyData(state, i+addr)>>16)&0xff; |
| 1692 | 1680 | else |
| 1693 | 1681 | bri = 0x40; |
| 1694 | 1682 | pVerTex->bri = bri; |
| r11160 | r11161 | |
| 1726 | 1714 | absolutePriority += (polygonShiftValue22&0x1c0000)>>18; |
| 1727 | 1715 | } |
| 1728 | 1716 | |
| 1729 | | if( mObjectShiftValue22 & 0x200000 ) |
| 1730 | | zsortvalue24 = mObjectShiftValue22 & LSB21; |
| 1717 | if( state->m_mObjectShiftValue22 & 0x200000 ) |
| 1718 | zsortvalue24 = state->m_mObjectShiftValue22 & LSB21; |
| 1731 | 1719 | else |
| 1732 | 1720 | { |
| 1733 | | zsortvalue24 += Signed18( mObjectShiftValue22 ); |
| 1734 | | absolutePriority += (mObjectShiftValue22&0x1c0000)>>18; |
| 1721 | zsortvalue24 += Signed18( state->m_mObjectShiftValue22 ); |
| 1722 | absolutePriority += (state->m_mObjectShiftValue22&0x1c0000)>>18; |
| 1735 | 1723 | } |
| 1736 | 1724 | |
| 1737 | 1725 | absolutePriority &= 7; |
| r11160 | r11161 | |
| 1769 | 1757 | } /* BlitQuadHelper */ |
| 1770 | 1758 | |
| 1771 | 1759 | static void |
| 1772 | | RegisterNormals( INT32 addr, float m[4][4] ) |
| 1760 | RegisterNormals( namcos22_state *state, INT32 addr, float m[4][4] ) |
| 1773 | 1761 | { |
| 1774 | 1762 | int i; |
| 1775 | 1763 | for( i=0; i<4; i++ ) |
| 1776 | 1764 | { |
| 1777 | | float nx = DSP_FIXED_TO_FLOAT(GetPolyData(addr+i*3+0)); |
| 1778 | | float ny = DSP_FIXED_TO_FLOAT(GetPolyData(addr+i*3+1)); |
| 1779 | | float nz = DSP_FIXED_TO_FLOAT(GetPolyData(addr+i*3+2)); |
| 1765 | float nx = DSP_FIXED_TO_FLOAT(GetPolyData(state, addr+i*3+0)); |
| 1766 | float ny = DSP_FIXED_TO_FLOAT(GetPolyData(state, addr+i*3+1)); |
| 1767 | float nz = DSP_FIXED_TO_FLOAT(GetPolyData(state, addr+i*3+2)); |
| 1780 | 1768 | float dotproduct; |
| 1781 | 1769 | |
| 1782 | 1770 | /* transform normal vector */ |
| r11160 | r11161 | |
| 1784 | 1772 | dotproduct = nx*mCamera.lx + ny*mCamera.ly + nz*mCamera.lz; |
| 1785 | 1773 | if( dotproduct<0.0f ) |
| 1786 | 1774 | dotproduct = 0.0f; |
| 1787 | | mLitSurfaceInfo[mLitSurfaceCount++] = mCamera.ambient + mCamera.power*dotproduct; |
| 1775 | state->m_mLitSurfaceInfo[state->m_mLitSurfaceCount++] = mCamera.ambient + mCamera.power*dotproduct; |
| 1788 | 1776 | } |
| 1789 | 1777 | } /* RegisterNormals */ |
| 1790 | 1778 | |
| 1791 | 1779 | static void |
| 1792 | 1780 | BlitQuads( running_machine &machine, bitmap_t *bitmap, INT32 addr, float m[4][4], INT32 base ) |
| 1793 | 1781 | { |
| 1782 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 1794 | 1783 | int numAdditionalNormals = 0; |
| 1795 | | int chunkLength = GetPolyData(addr++); |
| 1784 | int chunkLength = GetPolyData(state, addr++); |
| 1796 | 1785 | int finish = addr + chunkLength; |
| 1797 | 1786 | |
| 1798 | 1787 | if( chunkLength>0x100 ) |
| r11160 | r11161 | |
| 1800 | 1789 | |
| 1801 | 1790 | while( addr<finish ) |
| 1802 | 1791 | { |
| 1803 | | int packetLength = GetPolyData( addr++ ); |
| 1804 | | int packetFormat = GetPolyData( addr+0 ); |
| 1792 | int packetLength = GetPolyData( state, addr++ ); |
| 1793 | int packetFormat = GetPolyData( state, addr+0 ); |
| 1805 | 1794 | int flags, color, bias; |
| 1806 | 1795 | |
| 1807 | 1796 | /** |
| r11160 | r11161 | |
| 1840 | 1829 | * word 1: flags |
| 1841 | 1830 | * word 2: color |
| 1842 | 1831 | */ |
| 1843 | | flags = GetPolyData(addr+1); |
| 1844 | | color = GetPolyData(addr+2); |
| 1832 | flags = GetPolyData(state, addr+1); |
| 1833 | color = GetPolyData(state, addr+2); |
| 1845 | 1834 | bias = 0; |
| 1846 | 1835 | BlitQuadHelper( machine,bitmap,color,addr+3,m,bias,flags,packetFormat ); |
| 1847 | 1836 | break; |
| r11160 | r11161 | |
| 1853 | 1842 | * word 2: color |
| 1854 | 1843 | * word 3: depth bias |
| 1855 | 1844 | */ |
| 1856 | | flags = GetPolyData(addr+1); |
| 1857 | | color = GetPolyData(addr+2); |
| 1858 | | bias = GetPolyData(addr+3); |
| 1845 | flags = GetPolyData(state, addr+1); |
| 1846 | color = GetPolyData(state, addr+2); |
| 1847 | bias = GetPolyData(state, addr+3); |
| 1859 | 1848 | BlitQuadHelper( machine,bitmap,color,addr+4,m,bias,flags,packetFormat ); |
| 1860 | 1849 | break; |
| 1861 | 1850 | |
| r11160 | r11161 | |
| 1868 | 1857 | 000000 000000 007fff // normal vector |
| 1869 | 1858 | 000000 000000 007fff // normal vector |
| 1870 | 1859 | */ |
| 1871 | | numAdditionalNormals = GetPolyData(addr+2); |
| 1872 | | mSurfaceNormalFormat = GetPolyData(addr+3); |
| 1873 | | mLitSurfaceCount = 0; |
| 1874 | | mLitSurfaceIndex = 0; |
| 1875 | | RegisterNormals( addr+4, m ); |
| 1860 | numAdditionalNormals = GetPolyData(state, addr+2); |
| 1861 | state->m_mSurfaceNormalFormat = GetPolyData(state, addr+3); |
| 1862 | state->m_mLitSurfaceCount = 0; |
| 1863 | state->m_mLitSurfaceIndex = 0; |
| 1864 | RegisterNormals( state, addr+4, m ); |
| 1876 | 1865 | break; |
| 1877 | 1866 | |
| 1878 | 1867 | case 0x0d: /* additional normals */ |
| r11160 | r11161 | |
| 1883 | 1872 | ff8354 ffe401 000790 |
| 1884 | 1873 | ff84f7 ffdd04 0004c2 |
| 1885 | 1874 | */ |
| 1886 | | RegisterNormals( addr+1, m ); |
| 1875 | RegisterNormals( state, addr+1, m ); |
| 1887 | 1876 | break; |
| 1888 | 1877 | |
| 1889 | 1878 | default: |
| r11160 | r11161 | |
| 1896 | 1885 | static void |
| 1897 | 1886 | BlitPolyObject( running_machine &machine, bitmap_t *bitmap, int code, float M[4][4] ) |
| 1898 | 1887 | { |
| 1899 | | unsigned addr1 = GetPolyData(code); |
| 1900 | | mLitSurfaceCount = 0; |
| 1901 | | mLitSurfaceIndex = 0; |
| 1888 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 1889 | unsigned addr1 = GetPolyData(state, code); |
| 1890 | state->m_mLitSurfaceCount = 0; |
| 1891 | state->m_mLitSurfaceIndex = 0; |
| 1902 | 1892 | for(;;) |
| 1903 | 1893 | { |
| 1904 | | INT32 addr2 = GetPolyData(addr1++); |
| 1894 | INT32 addr2 = GetPolyData(state, addr1++); |
| 1905 | 1895 | if( addr2<0 ) |
| 1906 | 1896 | break; |
| 1907 | 1897 | BlitQuads( machine, bitmap, addr2, M, code ); |
| r11160 | r11161 | |
| 1912 | 1902 | |
| 1913 | 1903 | READ32_HANDLER( namcos22_dspram_r ) |
| 1914 | 1904 | { |
| 1915 | | return namcos22_polygonram[offset]; |
| 1905 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1906 | return state->m_polygonram[offset]; |
| 1916 | 1907 | } |
| 1917 | 1908 | |
| 1918 | 1909 | WRITE32_HANDLER( namcos22_dspram_w ) |
| 1919 | 1910 | { |
| 1920 | | COMBINE_DATA( &namcos22_polygonram[offset] ); |
| 1911 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1912 | COMBINE_DATA( &state->m_polygonram[offset] ); |
| 1921 | 1913 | } |
| 1922 | 1914 | |
| 1923 | 1915 | /*******************************************************************************/ |
| r11160 | r11161 | |
| 1962 | 1954 | * >=0x45: draw primitive |
| 1963 | 1955 | */ |
| 1964 | 1956 | static void |
| 1965 | | HandleBB0003( const INT32 *pSource ) |
| 1957 | HandleBB0003( namcos22_state *state, const INT32 *pSource ) |
| 1966 | 1958 | { |
| 1967 | 1959 | /* |
| 1968 | 1960 | bb0003 or 3b0003 |
| r11160 | r11161 | |
| 1989 | 1981 | mCamera.ly = DSP_FIXED_TO_FLOAT(pSource[0x3]); |
| 1990 | 1982 | mCamera.lz = DSP_FIXED_TO_FLOAT(pSource[0x4]); |
| 1991 | 1983 | |
| 1992 | | mAbsolutePriority = pSource[0x3]>>16; |
| 1993 | | mCamera.vx = (INT16)(pSource[5]>>16); |
| 1994 | | mCamera.vy = (INT16)pSource[5]; |
| 1995 | | mCamera.zoom = DspFloatToNativeFloat(pSource[6]); |
| 1996 | | mCamera.vw = DspFloatToNativeFloat(pSource[7])*mCamera.zoom; |
| 1997 | | mCamera.vh = DspFloatToNativeFloat(pSource[9])*mCamera.zoom; |
| 1984 | state->m_mAbsolutePriority = pSource[0x3]>>16; |
| 1985 | mCamera.vx = (INT16)(pSource[5]>>16); |
| 1986 | mCamera.vy = (INT16)pSource[5]; |
| 1987 | mCamera.zoom = DspFloatToNativeFloat(pSource[6]); |
| 1988 | mCamera.vw = DspFloatToNativeFloat(pSource[7])*mCamera.zoom; |
| 1989 | mCamera.vh = DspFloatToNativeFloat(pSource[9])*mCamera.zoom; |
| 1998 | 1990 | |
| 1999 | | mViewMatrix[0][0] = DSP_FIXED_TO_FLOAT(pSource[0x0c]); |
| 2000 | | mViewMatrix[1][0] = DSP_FIXED_TO_FLOAT(pSource[0x0d]); |
| 2001 | | mViewMatrix[2][0] = DSP_FIXED_TO_FLOAT(pSource[0x0e]); |
| 1991 | state->m_mViewMatrix[0][0] = DSP_FIXED_TO_FLOAT(pSource[0x0c]); |
| 1992 | state->m_mViewMatrix[1][0] = DSP_FIXED_TO_FLOAT(pSource[0x0d]); |
| 1993 | state->m_mViewMatrix[2][0] = DSP_FIXED_TO_FLOAT(pSource[0x0e]); |
| 2002 | 1994 | |
| 2003 | | mViewMatrix[0][1] = DSP_FIXED_TO_FLOAT(pSource[0x0f]); |
| 2004 | | mViewMatrix[1][1] = DSP_FIXED_TO_FLOAT(pSource[0x10]); |
| 2005 | | mViewMatrix[2][1] = DSP_FIXED_TO_FLOAT(pSource[0x11]); |
| 1995 | state->m_mViewMatrix[0][1] = DSP_FIXED_TO_FLOAT(pSource[0x0f]); |
| 1996 | state->m_mViewMatrix[1][1] = DSP_FIXED_TO_FLOAT(pSource[0x10]); |
| 1997 | state->m_mViewMatrix[2][1] = DSP_FIXED_TO_FLOAT(pSource[0x11]); |
| 2006 | 1998 | |
| 2007 | | mViewMatrix[0][2] = DSP_FIXED_TO_FLOAT(pSource[0x12]); |
| 2008 | | mViewMatrix[1][2] = DSP_FIXED_TO_FLOAT(pSource[0x13]); |
| 2009 | | mViewMatrix[2][2] = DSP_FIXED_TO_FLOAT(pSource[0x14]); |
| 1999 | state->m_mViewMatrix[0][2] = DSP_FIXED_TO_FLOAT(pSource[0x12]); |
| 2000 | state->m_mViewMatrix[1][2] = DSP_FIXED_TO_FLOAT(pSource[0x13]); |
| 2001 | state->m_mViewMatrix[2][2] = DSP_FIXED_TO_FLOAT(pSource[0x14]); |
| 2010 | 2002 | |
| 2011 | | TransformNormal( &mCamera.lx, &mCamera.ly, &mCamera.lz, mViewMatrix ); |
| 2003 | TransformNormal( &mCamera.lx, &mCamera.ly, &mCamera.lz, state->m_mViewMatrix ); |
| 2012 | 2004 | } /* HandleBB0003 */ |
| 2013 | 2005 | |
| 2014 | 2006 | static void |
| 2015 | 2007 | Handle200002( running_machine &machine, bitmap_t *bitmap, const INT32 *pSource ) |
| 2016 | 2008 | { |
| 2017 | | if( mPrimitiveID>=0x45 ) |
| 2009 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 2010 | if( state->m_mPrimitiveID>=0x45 ) |
| 2018 | 2011 | { |
| 2019 | 2012 | float m[4][4]; /* row major */ |
| 2020 | 2013 | |
| r11160 | r11161 | |
| 2036 | 2029 | m[3][1] = pSource[0xb]; /* ypos */ |
| 2037 | 2030 | m[3][2] = pSource[0xc]; /* zpos */ |
| 2038 | 2031 | |
| 2039 | | matrix3d_Multiply( m, mViewMatrix ); |
| 2040 | | BlitPolyObject( machine, bitmap, mPrimitiveID, m ); |
| 2032 | matrix3d_Multiply( m, state->m_mViewMatrix ); |
| 2033 | BlitPolyObject( machine, bitmap, state->m_mPrimitiveID, m ); |
| 2041 | 2034 | } |
| 2042 | | else if( mPrimitiveID !=0 && mPrimitiveID !=2 ) |
| 2043 | | { |
| 2044 | | logerror( "Handle200002:unk code=0x%x\n", mPrimitiveID ); |
| 2045 | | } |
| 2035 | else if( state->m_mPrimitiveID !=0 && state->m_mPrimitiveID !=2 ) |
| 2036 | { |
| 2037 | logerror( "Handle200002:unk code=0x%x\n", state->m_mPrimitiveID ); |
| 2038 | } |
| 2046 | 2039 | } /* Handle200002 */ |
| 2047 | 2040 | |
| 2048 | 2041 | static void |
| 2049 | | Handle300000( const INT32 *pSource ) |
| 2050 | | { /* set view transform */ |
| 2051 | | mViewMatrix[0][0] = DSP_FIXED_TO_FLOAT(pSource[1]); |
| 2052 | | mViewMatrix[1][0] = DSP_FIXED_TO_FLOAT(pSource[2]); |
| 2053 | | mViewMatrix[2][0] = DSP_FIXED_TO_FLOAT(pSource[3]); |
| 2042 | Handle300000( namcos22_state *state, const INT32 *pSource ) |
| 2043 | { |
| 2044 | state->m_mViewMatrix[0][0] = DSP_FIXED_TO_FLOAT(pSource[1]); |
| 2045 | state->m_mViewMatrix[1][0] = DSP_FIXED_TO_FLOAT(pSource[2]); |
| 2046 | state->m_mViewMatrix[2][0] = DSP_FIXED_TO_FLOAT(pSource[3]); |
| 2054 | 2047 | |
| 2055 | | mViewMatrix[0][1] = DSP_FIXED_TO_FLOAT(pSource[4]); |
| 2056 | | mViewMatrix[1][1] = DSP_FIXED_TO_FLOAT(pSource[5]); |
| 2057 | | mViewMatrix[2][1] = DSP_FIXED_TO_FLOAT(pSource[6]); |
| 2048 | state->m_mViewMatrix[0][1] = DSP_FIXED_TO_FLOAT(pSource[4]); |
| 2049 | state->m_mViewMatrix[1][1] = DSP_FIXED_TO_FLOAT(pSource[5]); |
| 2050 | state->m_mViewMatrix[2][1] = DSP_FIXED_TO_FLOAT(pSource[6]); |
| 2058 | 2051 | |
| 2059 | | mViewMatrix[0][2] = DSP_FIXED_TO_FLOAT(pSource[7]); |
| 2060 | | mViewMatrix[1][2] = DSP_FIXED_TO_FLOAT(pSource[8]); |
| 2061 | | mViewMatrix[2][2] = DSP_FIXED_TO_FLOAT(pSource[9]); |
| 2052 | state->m_mViewMatrix[0][2] = DSP_FIXED_TO_FLOAT(pSource[7]); |
| 2053 | state->m_mViewMatrix[1][2] = DSP_FIXED_TO_FLOAT(pSource[8]); |
| 2054 | state->m_mViewMatrix[2][2] = DSP_FIXED_TO_FLOAT(pSource[9]); |
| 2062 | 2055 | } /* Handle300000 */ |
| 2063 | 2056 | |
| 2064 | 2057 | static void |
| 2065 | | Handle233002( const INT32 *pSource ) |
| 2066 | | { /* set modal rendering options */ |
| 2058 | Handle233002( namcos22_state *state, const INT32 *pSource ) |
| 2059 | { |
| 2067 | 2060 | /* |
| 2068 | 2061 | 00233002 |
| 2069 | 2062 | 00000000 // zc adjust? |
| r11160 | r11161 | |
| 2074 | 2067 | 00000000 00000000 00007fff |
| 2075 | 2068 | 00000000 00000000 00000000 |
| 2076 | 2069 | */ |
| 2077 | | mObjectShiftValue22 = pSource[2]; |
| 2070 | state->m_mObjectShiftValue22 = pSource[2]; |
| 2078 | 2071 | } /* Handle233002 */ |
| 2079 | 2072 | |
| 2080 | 2073 | static void |
| 2081 | 2074 | SimulateSlaveDSP( running_machine &machine, bitmap_t *bitmap ) |
| 2082 | 2075 | { |
| 2083 | | const INT32 *pSource = 0x300 + (INT32 *)namcos22_polygonram; |
| 2076 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 2077 | const INT32 *pSource = 0x300 + (INT32 *)state->m_polygonram; |
| 2084 | 2078 | INT16 len; |
| 2085 | 2079 | |
| 2086 | | matrix3d_Identity( mViewMatrix ); |
| 2080 | matrix3d_Identity( state->m_mViewMatrix ); |
| 2087 | 2081 | |
| 2088 | | if( mbSuperSystem22 ) |
| 2082 | if( state->m_mbSuperSystem22 ) |
| 2089 | 2083 | { |
| 2090 | 2084 | pSource += 4; /* FFFE 0400 */ |
| 2091 | 2085 | } |
| r11160 | r11161 | |
| 2097 | 2091 | for(;;) |
| 2098 | 2092 | { |
| 2099 | 2093 | INT16 marker, next; |
| 2100 | | mPrimitiveID = *pSource++; |
| 2094 | state->m_mPrimitiveID = *pSource++; |
| 2101 | 2095 | len = (INT16)*pSource++; |
| 2102 | 2096 | |
| 2103 | 2097 | switch( len ) |
| 2104 | 2098 | { |
| 2105 | 2099 | case 0x15: |
| 2106 | | HandleBB0003( pSource ); /* define viewport */ |
| 2100 | HandleBB0003( state, pSource ); /* define viewport */ |
| 2107 | 2101 | break; |
| 2108 | 2102 | |
| 2109 | 2103 | case 0x10: |
| 2110 | | Handle233002( pSource ); /* set modal rendering options */ |
| 2104 | Handle233002( state, pSource ); /* set modal rendering options */ |
| 2111 | 2105 | break; |
| 2112 | 2106 | |
| 2113 | 2107 | case 0x0a: |
| 2114 | | Handle300000( pSource ); /* modify view transform */ |
| 2108 | Handle300000( state, pSource ); /* modify view transform */ |
| 2115 | 2109 | break; |
| 2116 | 2110 | |
| 2117 | 2111 | case 0x0d: |
| r11160 | r11161 | |
| 2119 | 2113 | break; |
| 2120 | 2114 | |
| 2121 | 2115 | default: |
| 2122 | | logerror( "unk 3d data(%d) addr=0x%x!", len, (int)(pSource-(INT32*)namcos22_polygonram) ); |
| 2123 | | { |
| 2124 | | int i; |
| 2125 | | for( i=0; i<len; i++ ) |
| 2126 | | { |
| 2127 | | logerror( " %06x", pSource[i]&0xffffff ); |
| 2128 | | } |
| 2129 | | logerror( "\n" ); |
| 2130 | | } |
| 2116 | logerror( "unk 3d data(%d) addr=0x%x!", len, (int)(pSource-(INT32*)state->m_polygonram) ); |
| 2117 | { |
| 2118 | int i; |
| 2119 | for( i=0; i<len; i++ ) |
| 2120 | { |
| 2121 | logerror( " %06x", pSource[i]&0xffffff ); |
| 2122 | } |
| 2123 | logerror( "\n" ); |
| 2124 | } |
| 2131 | 2125 | return; |
| 2132 | 2126 | } |
| 2133 | 2127 | |
| r11160 | r11161 | |
| 2135 | 2129 | pSource += len; |
| 2136 | 2130 | marker = (INT16)*pSource++; /* always 0xffff */ |
| 2137 | 2131 | next = (INT16)*pSource++; /* link to next command */ |
| 2138 | | if( (next&0x7fff) != (pSource - (INT32 *)namcos22_polygonram) ) |
| 2132 | if( (next&0x7fff) != (pSource - (INT32 *)state->m_polygonram) ) |
| 2139 | 2133 | { /* end of list */ |
| 2140 | 2134 | break; |
| 2141 | 2135 | } |
| r11160 | r11161 | |
| 2145 | 2139 | static void |
| 2146 | 2140 | DrawPolygons( running_machine &machine, bitmap_t *bitmap ) |
| 2147 | 2141 | { |
| 2148 | | if( mbDSPisActive ) |
| 2142 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 2143 | if( state->m_mbDSPisActive ) |
| 2149 | 2144 | { |
| 2150 | 2145 | SimulateSlaveDSP( machine, bitmap ); |
| 2151 | | poly_wait(poly, "DrawPolygons"); |
| 2146 | poly_wait(state->m_poly, "DrawPolygons"); |
| 2152 | 2147 | } |
| 2153 | 2148 | } /* DrawPolygons */ |
| 2154 | 2149 | |
| 2155 | 2150 | void |
| 2156 | | namcos22_enable_slave_simulation( void ) |
| 2151 | namcos22_enable_slave_simulation( running_machine &machine ) |
| 2157 | 2152 | { |
| 2158 | | mbDSPisActive = 1; |
| 2153 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 2154 | state->m_mbDSPisActive = 1; |
| 2159 | 2155 | } |
| 2160 | 2156 | |
| 2161 | 2157 | /*********************************************************************************************/ |
| 2162 | 2158 | |
| 2163 | 2159 | READ32_HANDLER( namcos22_cgram_r ) |
| 2164 | 2160 | { |
| 2165 | | return namcos22_cgram[offset]; |
| 2161 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2162 | return state->m_cgram[offset]; |
| 2166 | 2163 | } |
| 2167 | 2164 | |
| 2168 | 2165 | WRITE32_HANDLER( namcos22_cgram_w ) |
| 2169 | 2166 | { |
| 2170 | | COMBINE_DATA( &namcos22_cgram[offset] ); |
| 2167 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2168 | COMBINE_DATA( &state->m_cgram[offset] ); |
| 2171 | 2169 | gfx_element_mark_dirty(space->machine().gfx[GFX_CHAR],offset/32); |
| 2172 | 2170 | } |
| 2173 | 2171 | |
| 2174 | 2172 | READ32_HANDLER( namcos22_gamma_r ) |
| 2175 | 2173 | { |
| 2176 | | return namcos22_gamma[offset]; |
| 2174 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2175 | return state->m_gamma[offset]; |
| 2177 | 2176 | } |
| 2178 | 2177 | |
| 2179 | 2178 | WRITE32_HANDLER( namcos22_gamma_w ) |
| 2180 | 2179 | { |
| 2181 | | COMBINE_DATA( &namcos22_gamma[offset] ); |
| 2180 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2181 | COMBINE_DATA( &state->m_gamma[offset] ); |
| 2182 | 2182 | } |
| 2183 | 2183 | |
| 2184 | 2184 | READ32_HANDLER( namcos22_paletteram_r ) |
| r11160 | r11161 | |
| 2188 | 2188 | |
| 2189 | 2189 | WRITE32_HANDLER( namcos22_paletteram_w ) |
| 2190 | 2190 | { |
| 2191 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2191 | 2192 | COMBINE_DATA( &space->machine().generic.paletteram.u32[offset] ); |
| 2192 | | dirtypal[offset&(0x7fff/4)] = 1; |
| 2193 | state->m_dirtypal[offset&(0x7fff/4)] = 1; |
| 2193 | 2194 | } |
| 2194 | 2195 | |
| 2195 | 2196 | static void namcos22_reset(running_machine &machine) |
| r11160 | r11161 | |
| 2200 | 2201 | |
| 2201 | 2202 | static void namcos22_exit(running_machine &machine) |
| 2202 | 2203 | { |
| 2203 | | poly_free(poly); |
| 2204 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 2205 | poly_free(state->m_poly); |
| 2204 | 2206 | } |
| 2205 | 2207 | |
| 2206 | 2208 | static VIDEO_START( common ) |
| 2207 | 2209 | { |
| 2210 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 2208 | 2211 | int code; |
| 2209 | 2212 | |
| 2210 | | bgtilemap = tilemap_create( machine, TextTilemapGetInfo,tilemap_scan_rows,16,16,64,64 ); |
| 2211 | | tilemap_set_transparent_pen( bgtilemap, 0xf ); |
| 2213 | state->m_bgtilemap = tilemap_create( machine, TextTilemapGetInfo,tilemap_scan_rows,16,16,64,64 ); |
| 2214 | tilemap_set_transparent_pen( state->m_bgtilemap, 0xf ); |
| 2212 | 2215 | |
| 2213 | | mbDSPisActive = 0; |
| 2214 | | memset( namcos22_polygonram, 0xcc, 0x20000 ); |
| 2216 | state->m_mbDSPisActive = 0; |
| 2217 | memset( state->m_polygonram, 0xcc, 0x20000 ); |
| 2215 | 2218 | |
| 2216 | 2219 | for (code = 0; code < machine.gfx[GFX_TEXTURE_TILE]->total_elements; code++) |
| 2217 | 2220 | gfx_element_decode(machine.gfx[GFX_TEXTURE_TILE], code); |
| 2218 | 2221 | Prepare3dTexture(machine, machine.region("textilemap")->base(), machine.gfx[GFX_TEXTURE_TILE]->gfxdata ); |
| 2219 | | dirtypal = auto_alloc_array(machine, UINT8, NAMCOS22_PALETTE_SIZE/4); |
| 2220 | | mPtRomSize = machine.region("pointrom")->bytes()/3; |
| 2221 | | mpPolyL = machine.region("pointrom")->base(); |
| 2222 | | mpPolyM = mpPolyL + mPtRomSize; |
| 2223 | | mpPolyH = mpPolyM + mPtRomSize; |
| 2222 | state->m_dirtypal = auto_alloc_array(machine, UINT8, NAMCOS22_PALETTE_SIZE/4); |
| 2223 | state->m_mPtRomSize = machine.region("pointrom")->bytes()/3; |
| 2224 | state->m_mpPolyL = machine.region("pointrom")->base(); |
| 2225 | state->m_mpPolyM = state->m_mpPolyL + state->m_mPtRomSize; |
| 2226 | state->m_mpPolyH = state->m_mpPolyM + state->m_mPtRomSize; |
| 2224 | 2227 | |
| 2225 | 2228 | #ifdef RENDER_AS_QUADS |
| 2226 | | poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS); |
| 2229 | state->m_poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS); |
| 2227 | 2230 | #else |
| 2228 | | poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), 0); |
| 2231 | state->m_poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), 0); |
| 2229 | 2232 | #endif |
| 2230 | 2233 | machine.add_notifier(MACHINE_NOTIFY_RESET, namcos22_reset); |
| 2231 | 2234 | machine.add_notifier(MACHINE_NOTIFY_EXIT, namcos22_exit); |
| 2232 | 2235 | |
| 2233 | | gfx_element_set_source(machine.gfx[GFX_CHAR], (UINT8 *)namcos22_cgram); |
| 2236 | gfx_element_set_source(machine.gfx[GFX_CHAR], (UINT8 *)state->m_cgram); |
| 2234 | 2237 | } |
| 2235 | 2238 | |
| 2236 | 2239 | VIDEO_START( namcos22 ) |
| 2237 | 2240 | { |
| 2238 | | mbSuperSystem22 = 0; |
| 2239 | | VIDEO_START_CALL(common); |
| 2241 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 2242 | state->m_mbSuperSystem22 = 0; |
| 2243 | VIDEO_START_CALL(common); |
| 2240 | 2244 | } |
| 2241 | 2245 | |
| 2242 | 2246 | VIDEO_START( namcos22s ) |
| 2243 | 2247 | { |
| 2244 | | mbSuperSystem22 = 1; |
| 2245 | | namcos22_czram[0] = auto_alloc_array(machine, UINT16, 0x200/2 ); |
| 2246 | | namcos22_czram[1] = auto_alloc_array(machine, UINT16, 0x200/2 ); |
| 2247 | | namcos22_czram[2] = auto_alloc_array(machine, UINT16, 0x200/2 ); |
| 2248 | | namcos22_czram[3] = auto_alloc_array(machine, UINT16, 0x200/2 ); |
| 2248 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 2249 | state->m_mbSuperSystem22 = 1; |
| 2250 | state->m_czram[0] = auto_alloc_array(machine, UINT16, 0x200/2 ); |
| 2251 | state->m_czram[1] = auto_alloc_array(machine, UINT16, 0x200/2 ); |
| 2252 | state->m_czram[2] = auto_alloc_array(machine, UINT16, 0x200/2 ); |
| 2253 | state->m_czram[3] = auto_alloc_array(machine, UINT16, 0x200/2 ); |
| 2249 | 2254 | |
| 2250 | | memset(namcos22_czram[0], 0, 0x200); |
| 2251 | | memset(namcos22_czram[1], 0, 0x200); |
| 2252 | | memset(namcos22_czram[2], 0, 0x200); |
| 2253 | | memset(namcos22_czram[3], 0, 0x200); |
| 2255 | memset(state->m_czram[0], 0, 0x200); |
| 2256 | memset(state->m_czram[1], 0, 0x200); |
| 2257 | memset(state->m_czram[2], 0, 0x200); |
| 2258 | memset(state->m_czram[3], 0, 0x200); |
| 2254 | 2259 | |
| 2255 | | VIDEO_START_CALL(common); |
| 2260 | VIDEO_START_CALL(common); |
| 2256 | 2261 | } |
| 2257 | 2262 | |
| 2258 | 2263 | SCREEN_UPDATE( namcos22s ) |
| 2259 | 2264 | { |
| 2260 | 2265 | UINT32 bgColor; |
| 2261 | | UpdateVideoMixer(); |
| 2266 | UpdateVideoMixer(screen->machine()); |
| 2262 | 2267 | bgColor = (mixer.rBackColor<<16)|(mixer.gBackColor<<8)|mixer.bBackColor; |
| 2263 | 2268 | bitmap_fill( bitmap, cliprect , bgColor); |
| 2264 | 2269 | UpdatePaletteS(screen->machine()); |
| r11160 | r11161 | |
| 2266 | 2271 | DrawPolygons( screen->machine(), bitmap ); |
| 2267 | 2272 | DrawSprites( screen->machine(), bitmap, cliprect ); |
| 2268 | 2273 | RenderScene(screen->machine(), bitmap ); |
| 2269 | | DrawTranslucentCharacters( bitmap, cliprect ); |
| 2274 | DrawTranslucentCharacters( screen->machine(), bitmap, cliprect ); |
| 2270 | 2275 | ApplyGamma( screen->machine(), bitmap ); |
| 2271 | 2276 | |
| 2272 | 2277 | #ifdef MAME_DEBUG |
| 2273 | | if( input_code_pressed(screen->machine(), KEYCODE_D) ) |
| 2274 | | { |
| 2275 | | FILE *f = fopen( "dump.txt", "wb" ); |
| 2276 | | if( f ) |
| 2277 | | { |
| 2278 | | address_space *space = screen->machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 2278 | if( input_code_pressed(screen->machine(), KEYCODE_D) ) |
| 2279 | { |
| 2280 | namcos22_state *state = screen->machine().driver_data<namcos22_state>(); |
| 2281 | FILE *f = fopen( "dump.txt", "wb" ); |
| 2282 | if( f ) |
| 2283 | { |
| 2284 | address_space *space = screen->machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 2279 | 2285 | |
| 2280 | | { |
| 2281 | | int i,bank; |
| 2282 | | for( bank=0; bank<4; bank++ ) |
| 2283 | | { |
| 2284 | | fprintf( f, "czram[%d] =", bank ); |
| 2285 | | for( i=0; i<256; i++ ) |
| 2286 | | { |
| 2287 | | fprintf( f, " %04x", namcos22_czram[bank][i] ); |
| 2288 | | } |
| 2289 | | fprintf( f, "\n" ); |
| 2290 | | } |
| 2291 | | } |
| 2286 | { |
| 2287 | int i,bank; |
| 2288 | for( bank=0; bank<4; bank++ ) |
| 2289 | { |
| 2290 | fprintf( f, "czram[%d] =", bank ); |
| 2291 | for( i=0; i<256; i++ ) |
| 2292 | { |
| 2293 | fprintf( f, " %04x", state->m_czram[bank][i] ); |
| 2294 | } |
| 2295 | fprintf( f, "\n" ); |
| 2296 | } |
| 2297 | } |
| 2292 | 2298 | |
| 2293 | | Dump(space, f,0x810000, 0x81000f, "cz attr" ); |
| 2294 | | Dump(space, f,0x820000, 0x8202ff, "unk_ac" ); |
| 2295 | | Dump(space, f,0x824000, 0x8243ff, "gamma"); |
| 2296 | | Dump(space, f,0x828000, 0x83ffff, "palette" ); |
| 2297 | | Dump(space, f,0x8a0000, 0x8a000f, "tilemap_attr"); |
| 2298 | | Dump(space, f,0x880000, 0x89ffff, "cgram/textram"); |
| 2299 | | Dump(space, f,0x900000, 0x90ffff, "vics_data"); |
| 2300 | | Dump(space, f,0x940000, 0x94007f, "vics_control"); |
| 2301 | | Dump(space, f,0x980000, 0x9affff, "sprite374" ); |
| 2302 | | Dump(space, f,0xc00000, 0xc1ffff, "polygonram"); |
| 2303 | | fclose( f ); |
| 2304 | | } |
| 2305 | | while( input_code_pressed(screen->machine(), KEYCODE_D) ){} |
| 2306 | | } |
| 2299 | Dump(space, f,0x810000, 0x81000f, "cz attr" ); |
| 2300 | Dump(space, f,0x820000, 0x8202ff, "unk_ac" ); |
| 2301 | Dump(space, f,0x824000, 0x8243ff, "gamma"); |
| 2302 | Dump(space, f,0x828000, 0x83ffff, "palette" ); |
| 2303 | Dump(space, f,0x8a0000, 0x8a000f, "tilemap_attr"); |
| 2304 | Dump(space, f,0x880000, 0x89ffff, "cgram/textram"); |
| 2305 | Dump(space, f,0x900000, 0x90ffff, "vics_data"); |
| 2306 | Dump(space, f,0x940000, 0x94007f, "vics_control"); |
| 2307 | Dump(space, f,0x980000, 0x9affff, "sprite374" ); |
| 2308 | Dump(space, f,0xc00000, 0xc1ffff, "polygonram"); |
| 2309 | fclose( f ); |
| 2310 | } |
| 2311 | while( input_code_pressed(screen->machine(), KEYCODE_D) ){} |
| 2312 | } |
| 2307 | 2313 | #endif |
| 2308 | 2314 | return 0; |
| 2309 | 2315 | } |
| 2310 | 2316 | |
| 2311 | 2317 | SCREEN_UPDATE( namcos22 ) |
| 2312 | 2318 | { |
| 2313 | | UpdateVideoMixer(); |
| 2319 | UpdateVideoMixer(screen->machine()); |
| 2314 | 2320 | bitmap_fill( bitmap, cliprect , get_black_pen(screen->machine())); |
| 2315 | 2321 | UpdatePalette(screen->machine()); |
| 2316 | 2322 | DrawCharacterLayer(screen->machine(), bitmap, cliprect ); |
| 2317 | 2323 | DrawPolygons( screen->machine(), bitmap ); |
| 2318 | 2324 | RenderScene(screen->machine(), bitmap); |
| 2319 | | DrawTranslucentCharacters( bitmap, cliprect ); |
| 2325 | DrawTranslucentCharacters( screen->machine(), bitmap, cliprect ); |
| 2320 | 2326 | ApplyGamma( screen->machine(), bitmap ); |
| 2321 | 2327 | |
| 2322 | 2328 | #ifdef MAME_DEBUG |
| 2323 | | if( input_code_pressed(screen->machine(), KEYCODE_D) ) |
| 2324 | | { |
| 2325 | | FILE *f = fopen( "dump.txt", "wb" ); |
| 2326 | | if( f ) |
| 2327 | | { |
| 2328 | | address_space *space = screen->machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 2329 | if( input_code_pressed(screen->machine(), KEYCODE_D) ) |
| 2330 | { |
| 2331 | FILE *f = fopen( "dump.txt", "wb" ); |
| 2332 | if( f ) |
| 2333 | { |
| 2334 | address_space *space = screen->machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 2329 | 2335 | |
| 2330 | | // Dump(space, f,0x90000000, 0x90000003, "led?" ); |
| 2331 | | // Dump(space, f,0x90010000, 0x90017fff, "cz_ram"); |
| 2332 | | // Dump(space, f,0x900a0000, 0x900a000f, "tilemap_attr"); |
| 2333 | | Dump(space, f,0x90020000, 0x90027fff, "gamma"); |
| 2334 | | // Dump(space, f,0x70000000, 0x7001ffff, "polygonram"); |
| 2335 | | fclose( f ); |
| 2336 | | } |
| 2337 | | while( input_code_pressed(screen->machine(), KEYCODE_D) ){} |
| 2338 | | } |
| 2336 | //Dump(space, f,0x90000000, 0x90000003, "led?" ); |
| 2337 | //Dump(space, f,0x90010000, 0x90017fff, "cz_ram"); |
| 2338 | //Dump(space, f,0x900a0000, 0x900a000f, "tilemap_attr"); |
| 2339 | Dump(space, f,0x90020000, 0x90027fff, "gamma"); |
| 2340 | //Dump(space, f,0x70000000, 0x7001ffff, "polygonram"); |
| 2341 | fclose( f ); |
| 2342 | } |
| 2343 | while( input_code_pressed(screen->machine(), KEYCODE_D) ){} |
| 2344 | } |
| 2339 | 2345 | #endif |
| 2340 | 2346 | return 0; |
| 2341 | 2347 | } |
| 2342 | 2348 | |
| 2343 | 2349 | WRITE16_HANDLER( namcos22_dspram16_bank_w ) |
| 2344 | 2350 | { |
| 2345 | | COMBINE_DATA( &namcos22_dspram_bank ); |
| 2351 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2352 | COMBINE_DATA( &state->m_dspram_bank ); |
| 2346 | 2353 | } |
| 2347 | 2354 | |
| 2348 | 2355 | READ16_HANDLER( namcos22_dspram16_r ) |
| 2349 | 2356 | { |
| 2350 | | UINT32 value = namcos22_polygonram[offset]; |
| 2351 | | switch( namcos22_dspram_bank ) |
| 2357 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2358 | UINT32 value = state->m_polygonram[offset]; |
| 2359 | switch( state->m_dspram_bank ) |
| 2352 | 2360 | { |
| 2353 | 2361 | case 0: |
| 2354 | 2362 | value &= 0xffff; |
| r11160 | r11161 | |
| 2359 | 2367 | break; |
| 2360 | 2368 | |
| 2361 | 2369 | case 2: |
| 2362 | | mUpperWordLatch = value>>16; |
| 2370 | state->m_mUpperWordLatch = value>>16; |
| 2363 | 2371 | value &= 0xffff; |
| 2364 | 2372 | break; |
| 2365 | 2373 | |
| r11160 | r11161 | |
| 2371 | 2379 | |
| 2372 | 2380 | WRITE16_HANDLER( namcos22_dspram16_w ) |
| 2373 | 2381 | { |
| 2374 | | UINT32 value = namcos22_polygonram[offset]; |
| 2382 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2383 | UINT32 value = state->m_polygonram[offset]; |
| 2375 | 2384 | UINT16 lo = value&0xffff; |
| 2376 | 2385 | UINT16 hi = value>>16; |
| 2377 | | switch( namcos22_dspram_bank ) |
| 2386 | switch( state->m_dspram_bank ) |
| 2378 | 2387 | { |
| 2379 | 2388 | case 0: |
| 2380 | 2389 | COMBINE_DATA( &lo ); |
| r11160 | r11161 | |
| 2386 | 2395 | |
| 2387 | 2396 | case 2: |
| 2388 | 2397 | COMBINE_DATA( &lo ); |
| 2389 | | hi = mUpperWordLatch; |
| 2398 | hi = state->m_mUpperWordLatch; |
| 2390 | 2399 | break; |
| 2391 | 2400 | |
| 2392 | 2401 | default: |
| 2393 | 2402 | break; |
| 2394 | 2403 | } |
| 2395 | | namcos22_polygonram[offset] = (hi<<16)|lo; |
| 2404 | state->m_polygonram[offset] = (hi<<16)|lo; |
| 2396 | 2405 | } /* namcos22_dspram16_w */ |
| 2397 | 2406 | |
| 2398 | 2407 | #ifdef MAME_DEBUG |
| 2399 | 2408 | static void |
| 2400 | 2409 | Dump( address_space *space, FILE *f, unsigned addr1, unsigned addr2, const char *name ) |
| 2401 | 2410 | { |
| 2402 | | unsigned addr; |
| 2403 | | fprintf( f, "%s:\n", name ); |
| 2404 | | for( addr=addr1; addr<=addr2; addr+=16 ) |
| 2405 | | { |
| 2406 | | UINT8 data[16]; |
| 2407 | | int bHasNonZero = 0; |
| 2408 | | int i; |
| 2409 | | for( i=0; i<16; i++ ) |
| 2410 | | { |
| 2411 | | data[i] = space->read_byte(addr+i ); |
| 2412 | | if( data[i] ) |
| 2413 | | { |
| 2414 | | bHasNonZero = 1; |
| 2415 | | } |
| 2416 | | } |
| 2417 | | if( bHasNonZero ) |
| 2418 | | { |
| 2419 | | fprintf( f,"%08x:", addr ); |
| 2420 | | for( i=0; i<16; i++ ) |
| 2421 | | { |
| 2422 | | if( (i&0x03)==0 ) |
| 2423 | | { |
| 2424 | | fprintf( f, " " ); |
| 2425 | | } |
| 2426 | | fprintf( f, "%02x", data[i] ); |
| 2427 | | } |
| 2428 | | fprintf( f, "\n" ); |
| 2429 | | } |
| 2430 | | } |
| 2431 | | fprintf( f, "\n" ); |
| 2411 | unsigned addr; |
| 2412 | fprintf( f, "%s:\n", name ); |
| 2413 | for( addr=addr1; addr<=addr2; addr+=16 ) |
| 2414 | { |
| 2415 | UINT8 data[16]; |
| 2416 | int bHasNonZero = 0; |
| 2417 | int i; |
| 2418 | for( i=0; i<16; i++ ) |
| 2419 | { |
| 2420 | data[i] = space->read_byte(addr+i ); |
| 2421 | if( data[i] ) |
| 2422 | { |
| 2423 | bHasNonZero = 1; |
| 2424 | } |
| 2425 | } |
| 2426 | if( bHasNonZero ) |
| 2427 | { |
| 2428 | fprintf( f,"%08x:", addr ); |
| 2429 | for( i=0; i<16; i++ ) |
| 2430 | { |
| 2431 | if( (i&0x03)==0 ) |
| 2432 | { |
| 2433 | fprintf( f, " " ); |
| 2434 | } |
| 2435 | fprintf( f, "%02x", data[i] ); |
| 2436 | } |
| 2437 | fprintf( f, "\n" ); |
| 2438 | } |
| 2439 | } |
| 2440 | fprintf( f, "\n" ); |
| 2432 | 2441 | } |
| 2433 | 2442 | #endif |
| 2434 | 2443 | |
| r11160 | r11161 | |
| 2467 | 2476 | */ |
| 2468 | 2477 | WRITE32_HANDLER(namcos22_port800000_w) |
| 2469 | 2478 | { |
| 2470 | | /* 00000011011111110000100011111111001001111110111110110001 */ |
| 2471 | | UINT16 word = data>>16; |
| 2472 | | logerror( "%x: C304/C399: 0x%04x\n", cpu_get_previouspc(&space->device()), word ); |
| 2473 | | if( word == 0x4038 ) |
| 2474 | | { |
| 2475 | | mbSpotlightEnable = 1; |
| 2476 | | } |
| 2477 | | else |
| 2478 | | { |
| 2479 | | mbSpotlightEnable = 0; |
| 2480 | | } |
| 2479 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2480 | /* 00000011011111110000100011111111001001111110111110110001 */ |
| 2481 | UINT16 word = data>>16; |
| 2482 | logerror( "%x: C304/C399: 0x%04x\n", cpu_get_previouspc(&space->device()), word ); |
| 2483 | if( word == 0x4038 ) |
| 2484 | { |
| 2485 | state->m_mbSpotlightEnable = 1; |
| 2486 | } |
| 2487 | else |
| 2488 | { |
| 2489 | state->m_mbSpotlightEnable = 0; |
| 2490 | } |
| 2481 | 2491 | } /* namcos22_port800000_w */ |
src/mame/video/galaxold.c
| r11160 | r11161 | |
| 7 | 7 | #include "emu.h" |
| 8 | 8 | #include "includes/galaxold.h" |
| 9 | 9 | |
| 10 | | static const rectangle _spritevisiblearea = |
| 10 | static const rectangle spritevisiblearea = |
| 11 | 11 | { |
| 12 | 12 | 2*8+1, 32*8-1, |
| 13 | 13 | 2*8, 30*8-1 |
| 14 | 14 | }; |
| 15 | | static const rectangle _spritevisibleareaflipx = |
| 15 | static const rectangle spritevisibleareaflipx = |
| 16 | 16 | { |
| 17 | 17 | 0*8, 30*8-2, |
| 18 | 18 | 2*8, 30*8-1 |
| 19 | 19 | }; |
| 20 | 20 | |
| 21 | | static const rectangle* spritevisiblearea; |
| 22 | | static const rectangle* spritevisibleareaflipx; |
| 23 | 21 | |
| 24 | | |
| 25 | 22 | #define STARS_COLOR_BASE (machine.region("proms")->bytes()) |
| 26 | 23 | #define BULLETS_COLOR_BASE (STARS_COLOR_BASE + 64) |
| 27 | 24 | #define BACKGROUND_COLOR_BASE (BULLETS_COLOR_BASE + 2) |
| 28 | 25 | |
| 29 | 26 | |
| 30 | | UINT8 *galaxold_videoram; |
| 31 | | UINT8 *galaxold_spriteram; |
| 32 | | UINT8 *galaxold_spriteram2; |
| 33 | | UINT8 *galaxold_attributesram; |
| 34 | | UINT8 *galaxold_bulletsram; |
| 35 | | UINT8 *rockclim_videoram; |
| 36 | | size_t galaxold_spriteram_size; |
| 37 | | size_t galaxold_spriteram2_size; |
| 38 | | size_t galaxold_bulletsram_size; |
| 39 | | |
| 40 | | |
| 41 | 27 | static TILE_GET_INFO( get_tile_info ); |
| 42 | 28 | static TILE_GET_INFO( rockclim_get_tile_info ); |
| 43 | | static tilemap_t *bg_tilemap; |
| 44 | | static tilemap_t *rockclim_tilemap; |
| 45 | | static int mooncrst_gfxextend; |
| 46 | | static int spriteram2_present; |
| 47 | | static UINT8 gfxbank[5]; |
| 48 | | static UINT8 flipscreen_x; |
| 49 | | static UINT8 flipscreen_y; |
| 50 | | static UINT8 color_mask; |
| 51 | | static tilemap_t *dambustr_tilemap2; |
| 52 | | static UINT8 *dambustr_videoram2; |
| 53 | | static void (*modify_charcode)(running_machine &machine, UINT16 *code,UINT8 x); /* function to call to do character banking */ |
| 54 | | static void mooncrst_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x); |
| 55 | | static void pisces_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x); |
| 56 | | static void mimonkey_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x); |
| 57 | | static void mariner_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x); |
| 58 | | static void dambustr_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x); |
| 29 | static void mooncrst_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x); |
| 30 | static void pisces_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x); |
| 31 | static void mimonkey_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x); |
| 32 | static void mariner_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x); |
| 33 | static void dambustr_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x); |
| 59 | 34 | |
| 60 | | static void (*modify_spritecode)(UINT8 *spriteram,int*,int*,int*,int); /* function to call to do sprite banking */ |
| 61 | | static void mshuttle_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs); |
| 62 | | static void mimonkey_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs); |
| 63 | | static void batman2_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs); |
| 64 | | static void dkongjrm_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs); |
| 65 | | static void ad2083_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs); |
| 66 | | static void dambustr_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs); |
| 35 | static void mshuttle_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); |
| 36 | static void mimonkey_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); |
| 37 | static void batman2_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); |
| 38 | static void dkongjrm_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); |
| 39 | static void ad2083_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); |
| 40 | static void dambustr_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); |
| 67 | 41 | |
| 68 | | static void (*modify_color)(UINT8 *color); /* function to call to do modify how the color codes map to the PROM */ |
| 69 | 42 | static void drivfrcg_modify_color(UINT8 *color); |
| 70 | 43 | |
| 71 | | static void (*modify_ypos)(UINT8*); /* function to call to do modify how vertical positioning bits are connected */ |
| 72 | | |
| 73 | 44 | static TIMER_CALLBACK( stars_blink_callback ); |
| 74 | 45 | static TIMER_CALLBACK( stars_scroll_callback ); |
| 75 | 46 | |
| 76 | | static void (*tilemap_set_scroll)( tilemap_t *, int col, int value ); |
| 77 | | |
| 78 | | /* star circuit */ |
| 79 | | #define STAR_COUNT 252 |
| 80 | | struct star |
| 81 | | { |
| 82 | | int x,y,color; |
| 83 | | }; |
| 84 | | static struct star stars[STAR_COUNT]; |
| 85 | | static int stars_colors_start; |
| 86 | | UINT8 galaxold_stars_on; |
| 87 | | static INT32 stars_scrollpos; |
| 88 | | static UINT8 stars_blink_state; |
| 89 | | static emu_timer *stars_blink_timer; |
| 90 | | static emu_timer *stars_scroll_timer; |
| 91 | | static UINT8 timer_adjusted; |
| 92 | 47 | void galaxold_init_stars(running_machine &machine, int colors_offset); |
| 93 | | static void (*draw_stars)(running_machine &machine, bitmap_t *, const rectangle *); /* function to call to draw the star layer */ |
| 94 | 48 | static void noop_draw_stars(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); |
| 95 | 49 | void galaxold_draw_stars(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); |
| 96 | 50 | static void scrambold_draw_stars(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); |
| 97 | 51 | static void rescue_draw_stars(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); |
| 98 | 52 | static void mariner_draw_stars(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); |
| 99 | | static void start_stars_blink_timer(double ra, double rb, double c); |
| 53 | static void start_stars_blink_timer(running_machine &machine, double ra, double rb, double c); |
| 100 | 54 | static void start_stars_scroll_timer(running_machine &machine); |
| 101 | 55 | |
| 102 | 56 | /* bullets circuit */ |
| 103 | | static UINT8 darkplnt_bullet_color; |
| 104 | | static void (*draw_bullets)(running_machine &,bitmap_t *,const rectangle *,int,int,int); /* function to call to draw a bullet */ |
| 105 | 57 | static void galaxold_draw_bullets(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y); |
| 106 | 58 | static void scrambold_draw_bullets(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y); |
| 107 | 59 | static void darkplnt_draw_bullets(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y); |
| 108 | 60 | static void dambustr_draw_bullets(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y); |
| 109 | 61 | |
| 110 | 62 | /* background circuit */ |
| 111 | | static UINT8 background_enable; |
| 112 | | static UINT8 background_red, background_green, background_blue; |
| 113 | | static void (*draw_background)(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); /* function to call to draw the background */ |
| 114 | 63 | static void galaxold_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); |
| 115 | 64 | static void scrambold_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); |
| 116 | 65 | static void ad2083_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); |
| r11160 | r11161 | |
| 120 | 69 | static void rescue_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); |
| 121 | 70 | static void dambustr_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); |
| 122 | 71 | |
| 123 | | static UINT16 rockclim_v; |
| 124 | | static UINT16 rockclim_h; |
| 125 | | static int dambustr_bg_split_line; |
| 126 | | static int dambustr_bg_color_1; |
| 127 | | static int dambustr_bg_color_2; |
| 128 | | static int dambustr_bg_priority; |
| 129 | | static int dambustr_char_bank; |
| 130 | | static bitmap_t *dambustr_tmpbitmap; |
| 131 | 72 | |
| 132 | 73 | |
| 133 | 74 | |
| r11160 | r11161 | |
| 496 | 437 | |
| 497 | 438 | static void state_save_register(running_machine &machine) |
| 498 | 439 | { |
| 499 | | state_save_register_global_array(machine, gfxbank); |
| 500 | | state_save_register_global(machine, flipscreen_x); |
| 501 | | state_save_register_global(machine, flipscreen_y); |
| 440 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 441 | state_save_register_global_array(machine, state->m_gfxbank); |
| 442 | state_save_register_global(machine, state->m_flipscreen_x); |
| 443 | state_save_register_global(machine, state->m_flipscreen_y); |
| 502 | 444 | |
| 503 | | state_save_register_global(machine, galaxold_stars_on); |
| 504 | | state_save_register_global(machine, stars_scrollpos); |
| 505 | | state_save_register_global(machine, stars_blink_state); |
| 445 | state_save_register_global(machine, state->m_stars_on); |
| 446 | state_save_register_global(machine, state->m_stars_scrollpos); |
| 447 | state_save_register_global(machine, state->m_stars_blink_state); |
| 506 | 448 | |
| 507 | | state_save_register_global(machine, darkplnt_bullet_color); |
| 449 | state_save_register_global(machine, state->m_darkplnt_bullet_color); |
| 508 | 450 | |
| 509 | | state_save_register_global(machine, background_enable); |
| 510 | | state_save_register_global(machine, background_red); |
| 511 | | state_save_register_global(machine, background_green); |
| 512 | | state_save_register_global(machine, background_blue); |
| 451 | state_save_register_global(machine, state->m_background_enable); |
| 452 | state_save_register_global(machine, state->m_background_red); |
| 453 | state_save_register_global(machine, state->m_background_green); |
| 454 | state_save_register_global(machine, state->m_background_blue); |
| 513 | 455 | } |
| 514 | 456 | |
| 515 | | static void video_start_common(running_machine &machine, tilemap_mapper_func get_memory_offset) |
| 457 | static void video_start_common(running_machine &machine) |
| 516 | 458 | { |
| 517 | | bg_tilemap = tilemap_create(machine, get_tile_info,get_memory_offset,8,8,32,32); |
| 459 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 460 | state->m_modify_charcode = 0; |
| 461 | state->m_modify_spritecode = 0; |
| 462 | state->m_modify_color = 0; |
| 463 | state->m_modify_ypos = 0; |
| 518 | 464 | |
| 519 | | tilemap_set_transparent_pen(bg_tilemap,0); |
| 465 | state->m_mooncrst_gfxextend = 0; |
| 520 | 466 | |
| 467 | state->m_draw_bullets = 0; |
| 521 | 468 | |
| 522 | | modify_charcode = 0; |
| 523 | | modify_spritecode = 0; |
| 524 | | modify_color = 0; |
| 525 | | modify_ypos = 0; |
| 469 | state->m_draw_background = galaxold_draw_background; |
| 470 | state->m_background_enable = 0; |
| 471 | state->m_background_blue = 0; |
| 472 | state->m_background_red = 0; |
| 473 | state->m_background_green = 0; |
| 526 | 474 | |
| 527 | | mooncrst_gfxextend = 0; |
| 475 | state->m_draw_stars = noop_draw_stars; |
| 528 | 476 | |
| 529 | | draw_bullets = 0; |
| 477 | state->m_flipscreen_x = 0; |
| 478 | state->m_flipscreen_y = 0; |
| 530 | 479 | |
| 531 | | draw_background = galaxold_draw_background; |
| 532 | | background_enable = 0; |
| 533 | | background_blue = 0; |
| 534 | | background_red = 0; |
| 535 | | background_green = 0; |
| 480 | state->m_spriteram2_present = 0; |
| 536 | 481 | |
| 537 | | draw_stars = noop_draw_stars; |
| 538 | | |
| 539 | | flipscreen_x = 0; |
| 540 | | flipscreen_y = 0; |
| 541 | | |
| 542 | | spriteram2_present = 0; |
| 543 | | |
| 544 | | spritevisiblearea = &_spritevisiblearea; |
| 545 | | spritevisibleareaflipx = &_spritevisibleareaflipx; |
| 546 | | |
| 547 | | color_mask = (machine.gfx[0]->color_granularity == 4) ? 7 : 3; |
| 548 | | |
| 549 | 482 | state_save_register(machine); |
| 550 | 483 | } |
| 551 | 484 | |
| 552 | 485 | VIDEO_START( galaxold_plain ) |
| 553 | 486 | { |
| 554 | | video_start_common(machine,tilemap_scan_rows); |
| 487 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 488 | video_start_common(machine); |
| 489 | state->m_bg_tilemap = tilemap_create(machine, get_tile_info,tilemap_scan_rows,8,8,32,32); |
| 490 | tilemap_set_transparent_pen(state->m_bg_tilemap,0); |
| 555 | 491 | |
| 556 | | tilemap_set_scroll_cols(bg_tilemap, 32); |
| 557 | | tilemap_set_scroll = tilemap_set_scrolly; |
| 492 | tilemap_set_scroll_cols(state->m_bg_tilemap, 32); |
| 493 | state->m_tilemap_set_scroll = tilemap_set_scrolly; |
| 494 | |
| 495 | state->m_color_mask = (machine.gfx[0]->color_granularity == 4) ? 7 : 3; |
| 558 | 496 | } |
| 559 | 497 | |
| 560 | 498 | VIDEO_START( galaxold ) |
| 561 | 499 | { |
| 500 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 562 | 501 | VIDEO_START_CALL(galaxold_plain); |
| 563 | 502 | |
| 564 | | draw_stars = galaxold_draw_stars; |
| 503 | state->m_draw_stars = galaxold_draw_stars; |
| 565 | 504 | |
| 566 | | draw_bullets = galaxold_draw_bullets; |
| 505 | state->m_draw_bullets = galaxold_draw_bullets; |
| 567 | 506 | } |
| 568 | 507 | |
| 569 | 508 | VIDEO_START( scrambold ) |
| 570 | 509 | { |
| 510 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 571 | 511 | VIDEO_START_CALL(galaxold_plain); |
| 572 | 512 | |
| 573 | 513 | /* FIXME: This most probably needs to be adjusted |
| 574 | 514 | * again when RAW video params are added to scramble |
| 575 | 515 | */ |
| 576 | | tilemap_set_scrolldx(bg_tilemap, 0, 0); |
| 516 | tilemap_set_scrolldx(state->m_bg_tilemap, 0, 0); |
| 577 | 517 | |
| 578 | | draw_stars = scrambold_draw_stars; |
| 518 | state->m_draw_stars = scrambold_draw_stars; |
| 579 | 519 | |
| 580 | | draw_bullets = scrambold_draw_bullets; |
| 520 | state->m_draw_bullets = scrambold_draw_bullets; |
| 581 | 521 | |
| 582 | | draw_background = scrambold_draw_background; |
| 522 | state->m_draw_background = scrambold_draw_background; |
| 583 | 523 | } |
| 584 | 524 | |
| 585 | 525 | VIDEO_START( darkplnt ) |
| 586 | 526 | { |
| 527 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 587 | 528 | VIDEO_START_CALL(galaxold_plain); |
| 588 | 529 | |
| 589 | | tilemap_set_scrolldx(bg_tilemap, 0, 0); |
| 590 | | draw_bullets = darkplnt_draw_bullets; |
| 530 | tilemap_set_scrolldx(state->m_bg_tilemap, 0, 0); |
| 531 | state->m_draw_bullets = darkplnt_draw_bullets; |
| 591 | 532 | } |
| 592 | 533 | |
| 593 | 534 | VIDEO_START( rescue ) |
| 594 | 535 | { |
| 536 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 595 | 537 | VIDEO_START_CALL(scrambold); |
| 596 | 538 | |
| 597 | | draw_stars = rescue_draw_stars; |
| 539 | state->m_draw_stars = rescue_draw_stars; |
| 598 | 540 | |
| 599 | | draw_background = rescue_draw_background; |
| 541 | state->m_draw_background = rescue_draw_background; |
| 600 | 542 | } |
| 601 | 543 | |
| 602 | 544 | VIDEO_START( minefld ) |
| 603 | 545 | { |
| 546 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 604 | 547 | VIDEO_START_CALL(scrambold); |
| 605 | 548 | |
| 606 | | draw_stars = rescue_draw_stars; |
| 549 | state->m_draw_stars = rescue_draw_stars; |
| 607 | 550 | |
| 608 | | draw_background = minefld_draw_background; |
| 551 | state->m_draw_background = minefld_draw_background; |
| 609 | 552 | } |
| 610 | 553 | |
| 611 | 554 | VIDEO_START( stratgyx ) |
| 612 | 555 | { |
| 556 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 613 | 557 | VIDEO_START_CALL(galaxold_plain); |
| 614 | 558 | |
| 615 | | draw_background = stratgyx_draw_background; |
| 559 | state->m_draw_background = stratgyx_draw_background; |
| 616 | 560 | } |
| 617 | 561 | |
| 618 | 562 | VIDEO_START( ckongs ) |
| 619 | 563 | { |
| 564 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 620 | 565 | VIDEO_START_CALL(scrambold); |
| 621 | 566 | |
| 622 | | modify_spritecode = mshuttle_modify_spritecode; |
| 567 | state->m_modify_spritecode = mshuttle_modify_spritecode; |
| 623 | 568 | } |
| 624 | 569 | |
| 625 | 570 | VIDEO_START( mariner ) |
| 626 | 571 | { |
| 572 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 627 | 573 | VIDEO_START_CALL(galaxold_plain); |
| 628 | 574 | |
| 629 | | draw_stars = mariner_draw_stars; |
| 575 | state->m_draw_stars = mariner_draw_stars; |
| 630 | 576 | |
| 631 | | draw_bullets = scrambold_draw_bullets; |
| 577 | state->m_draw_bullets = scrambold_draw_bullets; |
| 632 | 578 | |
| 633 | | draw_background = mariner_draw_background; |
| 579 | state->m_draw_background = mariner_draw_background; |
| 634 | 580 | |
| 635 | | modify_charcode = mariner_modify_charcode; |
| 581 | state->m_modify_charcode = mariner_modify_charcode; |
| 636 | 582 | } |
| 637 | 583 | |
| 638 | 584 | VIDEO_START( mimonkey ) |
| 639 | 585 | { |
| 586 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 640 | 587 | VIDEO_START_CALL(scrambold); |
| 641 | 588 | |
| 642 | | modify_charcode = mimonkey_modify_charcode; |
| 643 | | modify_spritecode = mimonkey_modify_spritecode; |
| 589 | state->m_modify_charcode = mimonkey_modify_charcode; |
| 590 | state->m_modify_spritecode = mimonkey_modify_spritecode; |
| 644 | 591 | } |
| 645 | 592 | |
| 646 | 593 | VIDEO_START( dkongjrm ) |
| 647 | 594 | { |
| 595 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 648 | 596 | VIDEO_START_CALL(galaxold_plain); |
| 649 | 597 | |
| 650 | | modify_charcode = pisces_modify_charcode; |
| 651 | | modify_spritecode = dkongjrm_modify_spritecode; |
| 598 | state->m_modify_charcode = pisces_modify_charcode; |
| 599 | state->m_modify_spritecode = dkongjrm_modify_spritecode; |
| 652 | 600 | |
| 653 | | spriteram2_present= 1; |
| 601 | state->m_spriteram2_present= 1; |
| 654 | 602 | } |
| 655 | 603 | |
| 656 | | VIDEO_START( newsin7 ) |
| 657 | | { |
| 658 | | VIDEO_START_CALL(scrambold); |
| 659 | | |
| 660 | | spritevisiblearea = &_spritevisibleareaflipx; |
| 661 | | spritevisibleareaflipx = &_spritevisiblearea; |
| 662 | | } |
| 663 | | |
| 664 | 604 | VIDEO_START( scorpion ) |
| 665 | 605 | { |
| 606 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 666 | 607 | VIDEO_START_CALL(scrambold); |
| 667 | 608 | |
| 668 | | modify_spritecode = batman2_modify_spritecode; |
| 609 | state->m_modify_spritecode = batman2_modify_spritecode; |
| 669 | 610 | } |
| 670 | 611 | |
| 671 | | static void pisces_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs) |
| 612 | static void pisces_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 672 | 613 | { |
| 673 | | *code |= (gfxbank[0] << 6); |
| 614 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 615 | *code |= (state->m_gfxbank[0] << 6); |
| 674 | 616 | } |
| 675 | 617 | |
| 676 | 618 | VIDEO_START( pisces ) |
| 677 | 619 | { |
| 620 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 678 | 621 | VIDEO_START_CALL(galaxold); |
| 679 | 622 | |
| 680 | | modify_charcode = pisces_modify_charcode; |
| 681 | | modify_spritecode = pisces_modify_spritecode; |
| 623 | state->m_modify_charcode = pisces_modify_charcode; |
| 624 | state->m_modify_spritecode = pisces_modify_spritecode; |
| 682 | 625 | } |
| 683 | 626 | |
| 684 | 627 | #ifdef UNUSED_FUNCTION |
| r11160 | r11161 | |
| 699 | 642 | |
| 700 | 643 | VIDEO_START( theend ) |
| 701 | 644 | { |
| 645 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 702 | 646 | VIDEO_START_CALL(galaxold); |
| 703 | 647 | |
| 704 | | draw_bullets = theend_draw_bullets; |
| 648 | state->m_draw_bullets = theend_draw_bullets; |
| 705 | 649 | } |
| 706 | 650 | #endif |
| 707 | 651 | |
| 708 | | static void mooncrst_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs) |
| 652 | static void mooncrst_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 709 | 653 | { |
| 710 | | if (gfxbank[2] && ((*code & 0x30) == 0x20)) |
| 654 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 655 | if (state->m_gfxbank[2] && ((*code & 0x30) == 0x20)) |
| 711 | 656 | { |
| 712 | | *code = (*code & 0x0f) | (gfxbank[0] << 4) | (gfxbank[1] << 5) | 0x40; |
| 657 | *code = (*code & 0x0f) | (state->m_gfxbank[0] << 4) | (state->m_gfxbank[1] << 5) | 0x40; |
| 713 | 658 | } |
| 714 | 659 | } |
| 715 | 660 | |
| 716 | 661 | VIDEO_START( mooncrst ) |
| 717 | 662 | { |
| 663 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 718 | 664 | VIDEO_START_CALL(galaxold); |
| 719 | 665 | |
| 720 | | modify_charcode = mooncrst_modify_charcode; |
| 721 | | modify_spritecode = mooncrst_modify_spritecode; |
| 666 | state->m_modify_charcode = mooncrst_modify_charcode; |
| 667 | state->m_modify_spritecode = mooncrst_modify_spritecode; |
| 722 | 668 | } |
| 723 | 669 | |
| 724 | | static void batman2_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x) |
| 670 | static void batman2_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) |
| 725 | 671 | { |
| 672 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 726 | 673 | if (*code & 0x80) |
| 727 | 674 | { |
| 728 | | *code |= (gfxbank[0] << 8); |
| 675 | *code |= (state->m_gfxbank[0] << 8); |
| 729 | 676 | } |
| 730 | 677 | } |
| 731 | 678 | |
| 732 | 679 | VIDEO_START( batman2 ) |
| 733 | 680 | { |
| 681 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 734 | 682 | VIDEO_START_CALL(galaxold); |
| 735 | 683 | |
| 736 | | modify_charcode = batman2_modify_charcode; |
| 737 | | modify_spritecode = batman2_modify_spritecode; |
| 738 | | |
| 684 | state->m_modify_charcode = batman2_modify_charcode; |
| 685 | state->m_modify_spritecode = batman2_modify_spritecode; |
| 739 | 686 | } |
| 740 | 687 | |
| 741 | 688 | |
| 742 | 689 | |
| 743 | 690 | static void rockclim_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 744 | 691 | { |
| 745 | | tilemap_draw(bitmap,cliprect,rockclim_tilemap, 0,0); |
| 692 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 693 | tilemap_draw(bitmap,cliprect,state->m_rockclim_tilemap, 0,0); |
| 746 | 694 | } |
| 747 | 695 | |
| 748 | | static void rockclim_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs) |
| 696 | static void rockclim_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 749 | 697 | { |
| 750 | | if (gfxbank[2]) *code|=0x40; |
| 698 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 699 | if (state->m_gfxbank[2]) *code|=0x40; |
| 751 | 700 | } |
| 752 | 701 | |
| 753 | 702 | VIDEO_START( rockclim ) |
| 754 | 703 | { |
| 704 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 755 | 705 | VIDEO_START_CALL(galaxold); |
| 756 | | rockclim_tilemap = tilemap_create(machine, rockclim_get_tile_info,tilemap_scan_rows,8,8,64,32); |
| 757 | | draw_background = rockclim_draw_background; |
| 758 | | modify_charcode = mooncrst_modify_charcode; |
| 759 | | modify_spritecode = rockclim_modify_spritecode; |
| 760 | | rockclim_v = rockclim_h = 0; |
| 761 | | state_save_register_global(machine, rockclim_v); |
| 762 | | state_save_register_global(machine, rockclim_h); |
| 706 | state->m_rockclim_tilemap = tilemap_create(machine, rockclim_get_tile_info,tilemap_scan_rows,8,8,64,32); |
| 707 | |
| 708 | state->m_draw_background = rockclim_draw_background; |
| 709 | state->m_modify_charcode = mooncrst_modify_charcode; |
| 710 | state->m_modify_spritecode = rockclim_modify_spritecode; |
| 711 | |
| 712 | state->m_rockclim_v = state->m_rockclim_h = 0; |
| 713 | state_save_register_global(machine, state->m_rockclim_v); |
| 714 | state_save_register_global(machine, state->m_rockclim_h); |
| 763 | 715 | } |
| 764 | 716 | |
| 765 | 717 | static TILE_GET_INFO( drivfrcg_get_tile_info ) |
| 766 | 718 | { |
| 767 | | int code = galaxold_videoram[tile_index]; |
| 719 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 720 | int code = state->m_videoram[tile_index]; |
| 768 | 721 | UINT8 x = tile_index & 0x1f; |
| 769 | | UINT8 color = galaxold_attributesram[(x << 1) | 1] & 7; |
| 770 | | UINT8 bank = galaxold_attributesram[(x << 1) | 1] & 0x30; |
| 722 | UINT8 color = state->m_attributesram[(x << 1) | 1] & 7; |
| 723 | UINT8 bank = state->m_attributesram[(x << 1) | 1] & 0x30; |
| 771 | 724 | |
| 772 | 725 | code |= (bank << 4); |
| 773 | | color |= ((galaxold_attributesram[(x << 1) | 1] & 0x40) >> 3); |
| 726 | color |= ((state->m_attributesram[(x << 1) | 1] & 0x40) >> 3); |
| 774 | 727 | |
| 775 | 728 | SET_TILE_INFO(0, code, color, 0); |
| 776 | 729 | } |
| 777 | 730 | |
| 778 | 731 | VIDEO_START( drivfrcg ) |
| 779 | 732 | { |
| 780 | | bg_tilemap = tilemap_create(machine, drivfrcg_get_tile_info,tilemap_scan_rows,8,8,32,32); |
| 733 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 734 | video_start_common(machine); |
| 735 | state->m_bg_tilemap = tilemap_create(machine, drivfrcg_get_tile_info,tilemap_scan_rows,8,8,32,32); |
| 781 | 736 | |
| 782 | | tilemap_set_transparent_pen(bg_tilemap,0); |
| 783 | | tilemap_set_scroll_cols(bg_tilemap, 32); |
| 784 | | tilemap_set_scroll = tilemap_set_scrolly; |
| 737 | tilemap_set_transparent_pen(state->m_bg_tilemap,0); |
| 738 | tilemap_set_scroll_cols(state->m_bg_tilemap, 32); |
| 739 | state->m_tilemap_set_scroll = tilemap_set_scrolly; |
| 785 | 740 | |
| 786 | | modify_charcode = 0; |
| 787 | | modify_spritecode = mshuttle_modify_spritecode; |
| 788 | | modify_color = drivfrcg_modify_color; |
| 789 | | modify_ypos = 0; |
| 741 | state->m_modify_spritecode = mshuttle_modify_spritecode; |
| 742 | state->m_modify_color = drivfrcg_modify_color; |
| 790 | 743 | |
| 791 | | mooncrst_gfxextend = 0; |
| 792 | | |
| 793 | | draw_bullets = 0; |
| 794 | | |
| 795 | | draw_background = galaxold_draw_background; |
| 796 | | background_enable = 0; |
| 797 | | background_blue = 0; |
| 798 | | background_red = 0; |
| 799 | | background_green = 0; |
| 800 | | |
| 801 | | draw_stars = noop_draw_stars; |
| 802 | | |
| 803 | | flipscreen_x = 0; |
| 804 | | flipscreen_y = 0; |
| 805 | | |
| 806 | | spriteram2_present = 0; |
| 807 | | |
| 808 | | spritevisiblearea = &_spritevisiblearea; |
| 809 | | spritevisibleareaflipx = &_spritevisibleareaflipx; |
| 810 | | |
| 811 | | color_mask = 0xff; |
| 812 | | |
| 813 | | state_save_register(machine); |
| 744 | state->m_color_mask = 0xff; |
| 814 | 745 | } |
| 815 | 746 | |
| 816 | 747 | VIDEO_START( ad2083 ) |
| 817 | 748 | { |
| 818 | | bg_tilemap = tilemap_create(machine, drivfrcg_get_tile_info,tilemap_scan_rows,8,8,32,32); |
| 749 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 750 | video_start_common(machine); |
| 751 | state->m_bg_tilemap = tilemap_create(machine, drivfrcg_get_tile_info,tilemap_scan_rows,8,8,32,32); |
| 819 | 752 | |
| 820 | | tilemap_set_transparent_pen(bg_tilemap,0); |
| 821 | | tilemap_set_scroll_cols(bg_tilemap, 32); |
| 822 | | tilemap_set_scroll = tilemap_set_scrolly; |
| 753 | tilemap_set_transparent_pen(state->m_bg_tilemap,0); |
| 754 | tilemap_set_scroll_cols(state->m_bg_tilemap, 32); |
| 755 | state->m_tilemap_set_scroll = tilemap_set_scrolly; |
| 823 | 756 | |
| 824 | | modify_charcode = 0; |
| 825 | | modify_spritecode = ad2083_modify_spritecode; |
| 826 | | modify_color = 0; |
| 827 | | modify_ypos = 0; |
| 757 | state->m_modify_spritecode = ad2083_modify_spritecode; |
| 828 | 758 | |
| 829 | | mooncrst_gfxextend = 0; |
| 759 | state->m_draw_bullets = scrambold_draw_bullets; |
| 830 | 760 | |
| 831 | | draw_bullets = scrambold_draw_bullets; |
| 761 | state->m_draw_background = ad2083_draw_background; |
| 832 | 762 | |
| 833 | | draw_background = ad2083_draw_background; |
| 834 | | background_enable = 0; |
| 835 | | background_blue = 0; |
| 836 | | background_red = 0; |
| 837 | | background_green = 0; |
| 838 | | |
| 839 | | draw_stars = noop_draw_stars; |
| 840 | | |
| 841 | | flipscreen_x = 0; |
| 842 | | flipscreen_y = 0; |
| 843 | | |
| 844 | | spriteram2_present = 0; |
| 845 | | |
| 846 | | spritevisiblearea = &_spritevisiblearea; |
| 847 | | spritevisibleareaflipx = &_spritevisibleareaflipx; |
| 848 | | |
| 849 | | color_mask = 7; |
| 850 | | |
| 851 | | state_save_register(machine); |
| 763 | state->m_color_mask = 7; |
| 852 | 764 | } |
| 853 | 765 | |
| 854 | | UINT8 *racknrol_tiles_bank; |
| 855 | 766 | |
| 856 | 767 | WRITE8_HANDLER( racknrol_tiles_bank_w ) |
| 857 | 768 | { |
| 858 | | racknrol_tiles_bank[offset] = data; |
| 859 | | tilemap_mark_all_tiles_dirty(bg_tilemap); |
| 769 | galaxold_state *state = space->machine().driver_data<galaxold_state>(); |
| 770 | state->m_racknrol_tiles_bank[offset] = data; |
| 771 | tilemap_mark_all_tiles_dirty(state->m_bg_tilemap); |
| 860 | 772 | } |
| 861 | 773 | |
| 862 | 774 | static TILE_GET_INFO( racknrol_get_tile_info ) |
| 863 | 775 | { |
| 864 | | int code = galaxold_videoram[tile_index]; |
| 776 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 777 | int code = state->m_videoram[tile_index]; |
| 865 | 778 | UINT8 x = tile_index & 0x1f; |
| 866 | | UINT8 color = galaxold_attributesram[(x << 1) | 1] & 7; |
| 867 | | UINT8 bank = racknrol_tiles_bank[x] & 7; |
| 779 | UINT8 color = state->m_attributesram[(x << 1) | 1] & 7; |
| 780 | UINT8 bank = state->m_racknrol_tiles_bank[x] & 7; |
| 868 | 781 | |
| 869 | 782 | code |= (bank << 8); |
| 870 | 783 | |
| r11160 | r11161 | |
| 873 | 786 | |
| 874 | 787 | VIDEO_START( racknrol ) |
| 875 | 788 | { |
| 876 | | bg_tilemap = tilemap_create(machine, racknrol_get_tile_info,tilemap_scan_rows,8,8,32,32); |
| 789 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 790 | video_start_common(machine); |
| 791 | state->m_bg_tilemap = tilemap_create(machine, racknrol_get_tile_info,tilemap_scan_rows,8,8,32,32); |
| 877 | 792 | |
| 878 | | tilemap_set_transparent_pen(bg_tilemap,0); |
| 879 | | tilemap_set_scroll_cols(bg_tilemap, 32); |
| 880 | | tilemap_set_scroll = tilemap_set_scrolly; |
| 793 | tilemap_set_transparent_pen(state->m_bg_tilemap,0); |
| 794 | tilemap_set_scroll_cols(state->m_bg_tilemap, 32); |
| 795 | state->m_tilemap_set_scroll = tilemap_set_scrolly; |
| 881 | 796 | |
| 882 | | modify_charcode = 0; |
| 883 | | modify_spritecode = 0; |
| 884 | | modify_color = 0; |
| 885 | | modify_ypos = 0; |
| 886 | | |
| 887 | | mooncrst_gfxextend = 0; |
| 888 | | |
| 889 | | draw_bullets = 0; |
| 890 | | |
| 891 | | draw_background = galaxold_draw_background; |
| 892 | | background_enable = 0; |
| 893 | | background_blue = 0; |
| 894 | | background_red = 0; |
| 895 | | background_green = 0; |
| 896 | | |
| 897 | | draw_stars = noop_draw_stars; |
| 898 | | |
| 899 | | flipscreen_x = 0; |
| 900 | | flipscreen_y = 0; |
| 901 | | |
| 902 | | spriteram2_present = 0; |
| 903 | | |
| 904 | | spritevisiblearea = &_spritevisiblearea; |
| 905 | | spritevisibleareaflipx = &_spritevisibleareaflipx; |
| 906 | | |
| 907 | | color_mask = 0xff; |
| 908 | | |
| 909 | | state_save_register(machine); |
| 797 | state->m_color_mask = 0xff; |
| 910 | 798 | } |
| 911 | 799 | |
| 912 | 800 | VIDEO_START( bongo ) |
| 913 | 801 | { |
| 802 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 914 | 803 | VIDEO_START_CALL(galaxold_plain); |
| 915 | 804 | |
| 916 | | modify_spritecode = batman2_modify_spritecode; |
| 805 | state->m_modify_spritecode = batman2_modify_spritecode; |
| 917 | 806 | } |
| 918 | 807 | |
| 919 | 808 | static TILE_GET_INFO( dambustr_get_tile_info2 ) |
| 920 | 809 | { |
| 810 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 921 | 811 | UINT8 x = tile_index & 0x1f; |
| 922 | 812 | |
| 923 | | UINT16 code = dambustr_videoram2[tile_index]; |
| 924 | | UINT8 color = galaxold_attributesram[(x << 1) | 1] & color_mask; |
| 813 | UINT16 code = state->m_dambustr_videoram2[tile_index]; |
| 814 | UINT8 color = state->m_attributesram[(x << 1) | 1] & state->m_color_mask; |
| 925 | 815 | |
| 926 | | if (modify_charcode) |
| 816 | if (state->m_modify_charcode) |
| 927 | 817 | { |
| 928 | | modify_charcode(machine, &code, x); |
| 818 | (*state->m_modify_charcode)(machine, &code, x); |
| 929 | 819 | } |
| 930 | 820 | |
| 931 | | if (modify_color) |
| 821 | if (state->m_modify_color) |
| 932 | 822 | { |
| 933 | | modify_color(&color); |
| 823 | (*state->m_modify_color)(&color); |
| 934 | 824 | } |
| 935 | 825 | |
| 936 | 826 | SET_TILE_INFO(0, code, color, 0); |
| r11160 | r11161 | |
| 938 | 828 | |
| 939 | 829 | VIDEO_START( dambustr ) |
| 940 | 830 | { |
| 831 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 941 | 832 | VIDEO_START_CALL(galaxold); |
| 942 | 833 | |
| 943 | | dambustr_bg_split_line = 0; |
| 944 | | dambustr_bg_color_1 = 0; |
| 945 | | dambustr_bg_color_2 = 0; |
| 946 | | dambustr_bg_priority = 0; |
| 947 | | dambustr_char_bank = 0; |
| 834 | state->m_dambustr_bg_split_line = 0; |
| 835 | state->m_dambustr_bg_color_1 = 0; |
| 836 | state->m_dambustr_bg_color_2 = 0; |
| 837 | state->m_dambustr_bg_priority = 0; |
| 838 | state->m_dambustr_char_bank = 0; |
| 948 | 839 | |
| 949 | | draw_background = dambustr_draw_background; |
| 840 | state->m_draw_background = dambustr_draw_background; |
| 950 | 841 | |
| 951 | | modify_charcode = dambustr_modify_charcode; |
| 952 | | modify_spritecode = dambustr_modify_spritecode; |
| 842 | state->m_modify_charcode = dambustr_modify_charcode; |
| 843 | state->m_modify_spritecode = dambustr_modify_spritecode; |
| 953 | 844 | |
| 954 | | draw_bullets = dambustr_draw_bullets; |
| 845 | state->m_draw_bullets = dambustr_draw_bullets; |
| 955 | 846 | |
| 956 | 847 | /* allocate the temporary bitmap for the background priority */ |
| 957 | | dambustr_tmpbitmap = machine.primary_screen->alloc_compatible_bitmap(); |
| 848 | state->m_dambustr_tmpbitmap = machine.primary_screen->alloc_compatible_bitmap(); |
| 958 | 849 | |
| 959 | 850 | /* make a copy of the tilemap to emulate background priority */ |
| 960 | | dambustr_videoram2 = auto_alloc_array(machine, UINT8, 0x0400); |
| 961 | | dambustr_tilemap2 = tilemap_create(machine, dambustr_get_tile_info2,tilemap_scan_rows,8,8,32,32); |
| 851 | state->m_dambustr_videoram2 = auto_alloc_array(machine, UINT8, 0x0400); |
| 852 | state->m_dambustr_tilemap2 = tilemap_create(machine, dambustr_get_tile_info2,tilemap_scan_rows,8,8,32,32); |
| 962 | 853 | |
| 963 | | tilemap_set_transparent_pen(dambustr_tilemap2,0); |
| 854 | tilemap_set_transparent_pen(state->m_dambustr_tilemap2,0); |
| 964 | 855 | } |
| 965 | 856 | |
| 966 | 857 | |
| 967 | 858 | WRITE8_HANDLER( galaxold_videoram_w ) |
| 968 | 859 | { |
| 969 | | galaxold_videoram[offset] = data; |
| 970 | | tilemap_mark_tile_dirty(bg_tilemap, offset); |
| 860 | galaxold_state *state = space->machine().driver_data<galaxold_state>(); |
| 861 | state->m_videoram[offset] = data; |
| 862 | tilemap_mark_tile_dirty(state->m_bg_tilemap, offset); |
| 971 | 863 | } |
| 972 | 864 | |
| 973 | 865 | READ8_HANDLER( galaxold_videoram_r ) |
| 974 | 866 | { |
| 975 | | return galaxold_videoram[offset]; |
| 867 | galaxold_state *state = space->machine().driver_data<galaxold_state>(); |
| 868 | return state->m_videoram[offset]; |
| 976 | 869 | } |
| 977 | 870 | |
| 978 | 871 | |
| 979 | 872 | WRITE8_HANDLER( galaxold_attributesram_w ) |
| 980 | 873 | { |
| 981 | | if (galaxold_attributesram[offset] != data) |
| 874 | galaxold_state *state = space->machine().driver_data<galaxold_state>(); |
| 875 | if (state->m_attributesram[offset] != data) |
| 982 | 876 | { |
| 983 | 877 | if (offset & 0x01) |
| 984 | 878 | { |
| r11160 | r11161 | |
| 986 | 880 | int i; |
| 987 | 881 | |
| 988 | 882 | for (i = offset >> 1; i < 0x0400; i += 32) |
| 989 | | tilemap_mark_tile_dirty(bg_tilemap, i); |
| 883 | tilemap_mark_tile_dirty(state->m_bg_tilemap, i); |
| 990 | 884 | } |
| 991 | 885 | else |
| 992 | 886 | { |
| 993 | | if (modify_ypos) |
| 887 | if (state->m_modify_ypos) |
| 994 | 888 | { |
| 995 | | modify_ypos(&data); |
| 889 | (*state->m_modify_ypos)(&data); |
| 996 | 890 | } |
| 997 | 891 | |
| 998 | | tilemap_set_scroll(bg_tilemap, offset >> 1, data); |
| 892 | (*state->m_tilemap_set_scroll)(state->m_bg_tilemap, offset >> 1, data); |
| 999 | 893 | } |
| 1000 | 894 | |
| 1001 | | galaxold_attributesram[offset] = data; |
| 895 | state->m_attributesram[offset] = data; |
| 1002 | 896 | } |
| 1003 | 897 | } |
| 1004 | 898 | |
| 1005 | 899 | |
| 1006 | 900 | WRITE8_HANDLER( galaxold_flip_screen_x_w ) |
| 1007 | 901 | { |
| 1008 | | if (flipscreen_x != (data & 0x01)) |
| 902 | galaxold_state *state = space->machine().driver_data<galaxold_state>(); |
| 903 | if (state->m_flipscreen_x != (data & 0x01)) |
| 1009 | 904 | { |
| 1010 | | flipscreen_x = data & 0x01; |
| 905 | state->m_flipscreen_x = data & 0x01; |
| 1011 | 906 | |
| 1012 | | tilemap_set_flip(bg_tilemap, (flipscreen_x ? TILEMAP_FLIPX : 0) | (flipscreen_y ? TILEMAP_FLIPY : 0)); |
| 907 | tilemap_set_flip(state->m_bg_tilemap, (state->m_flipscreen_x ? TILEMAP_FLIPX : 0) | (state->m_flipscreen_y ? TILEMAP_FLIPY : 0)); |
| 1013 | 908 | } |
| 1014 | 909 | } |
| 1015 | 910 | |
| 1016 | 911 | WRITE8_HANDLER( galaxold_flip_screen_y_w ) |
| 1017 | 912 | { |
| 1018 | | if (flipscreen_y != (data & 0x01)) |
| 913 | galaxold_state *state = space->machine().driver_data<galaxold_state>(); |
| 914 | if (state->m_flipscreen_y != (data & 0x01)) |
| 1019 | 915 | { |
| 1020 | | flipscreen_y = data & 0x01; |
| 916 | state->m_flipscreen_y = data & 0x01; |
| 1021 | 917 | |
| 1022 | | tilemap_set_flip(bg_tilemap, (flipscreen_x ? TILEMAP_FLIPX : 0) | (flipscreen_y ? TILEMAP_FLIPY : 0)); |
| 918 | tilemap_set_flip(state->m_bg_tilemap, (state->m_flipscreen_x ? TILEMAP_FLIPX : 0) | (state->m_flipscreen_y ? TILEMAP_FLIPY : 0)); |
| 1023 | 919 | } |
| 1024 | 920 | } |
| 1025 | 921 | |
| r11160 | r11161 | |
| 1046 | 942 | |
| 1047 | 943 | WRITE8_HANDLER( scrambold_background_enable_w ) |
| 1048 | 944 | { |
| 1049 | | background_enable = data & 0x01; |
| 945 | galaxold_state *state = space->machine().driver_data<galaxold_state>(); |
| 946 | state->m_background_enable = data & 0x01; |
| 1050 | 947 | } |
| 1051 | 948 | |
| 1052 | 949 | WRITE8_HANDLER( scrambold_background_red_w ) |
| 1053 | 950 | { |
| 1054 | | background_red = data & 0x01; |
| 951 | galaxold_state *state = space->machine().driver_data<galaxold_state>(); |
| 952 | state->m_background_red = data & 0x01; |
| 1055 | 953 | } |
| 1056 | 954 | |
| 1057 | 955 | WRITE8_HANDLER( scrambold_background_green_w ) |
| 1058 | 956 | { |
| 1059 | | background_green = data & 0x01; |
| 957 | galaxold_state *state = space->machine().driver_data<galaxold_state>(); |
| 958 | state->m_background_green = data & 0x01; |
| 1060 | 959 | } |
| 1061 | 960 | |
| 1062 | 961 | WRITE8_HANDLER( scrambold_background_blue_w ) |
| 1063 | 962 | { |
| 1064 | | background_blue = data & 0x01; |
| 963 | galaxold_state *state = space->machine().driver_data<galaxold_state>(); |
| 964 | state->m_background_blue = data & 0x01; |
| 1065 | 965 | } |
| 1066 | 966 | |
| 1067 | 967 | |
| 1068 | 968 | WRITE8_HANDLER( galaxold_stars_enable_w ) |
| 1069 | 969 | { |
| 1070 | | galaxold_stars_on = data & 0x01; |
| 970 | galaxold_state *state = space->machine().driver_data<galaxold_state>(); |
| 971 | state->m_stars_on = data & 0x01; |
| 1071 | 972 | |
| 1072 | | if (!galaxold_stars_on) |
| 973 | if (!state->m_stars_on) |
| 1073 | 974 | { |
| 1074 | | stars_scrollpos = 0; |
| 975 | state->m_stars_scrollpos = 0; |
| 1075 | 976 | } |
| 1076 | 977 | } |
| 1077 | 978 | |
| 1078 | 979 | |
| 1079 | 980 | WRITE8_HANDLER( darkplnt_bullet_color_w ) |
| 1080 | 981 | { |
| 1081 | | darkplnt_bullet_color = data & 0x01; |
| 982 | galaxold_state *state = space->machine().driver_data<galaxold_state>(); |
| 983 | state->m_darkplnt_bullet_color = data & 0x01; |
| 1082 | 984 | } |
| 1083 | 985 | |
| 1084 | 986 | |
| 1085 | 987 | |
| 1086 | 988 | WRITE8_HANDLER( galaxold_gfxbank_w ) |
| 1087 | 989 | { |
| 1088 | | if (gfxbank[offset] != data) |
| 990 | galaxold_state *state = space->machine().driver_data<galaxold_state>(); |
| 991 | if (state->m_gfxbank[offset] != data) |
| 1089 | 992 | { |
| 1090 | | gfxbank[offset] = data; |
| 993 | state->m_gfxbank[offset] = data; |
| 1091 | 994 | |
| 1092 | | tilemap_mark_all_tiles_dirty(bg_tilemap); |
| 995 | tilemap_mark_all_tiles_dirty(state->m_bg_tilemap); |
| 1093 | 996 | } |
| 1094 | 997 | } |
| 1095 | 998 | |
| 1096 | 999 | WRITE8_HANDLER( rockclim_videoram_w ) |
| 1097 | 1000 | { |
| 1098 | | rockclim_videoram[offset] = data; |
| 1099 | | tilemap_mark_tile_dirty(rockclim_tilemap, offset); |
| 1001 | galaxold_state *state = space->machine().driver_data<galaxold_state>(); |
| 1002 | state->m_rockclim_videoram[offset] = data; |
| 1003 | tilemap_mark_tile_dirty(state->m_rockclim_tilemap, offset); |
| 1100 | 1004 | } |
| 1101 | 1005 | |
| 1102 | 1006 | WRITE8_HANDLER( rockclim_scroll_w ) |
| 1103 | 1007 | { |
| 1008 | galaxold_state *state = space->machine().driver_data<galaxold_state>(); |
| 1104 | 1009 | switch(offset&3) |
| 1105 | 1010 | { |
| 1106 | | case 0: rockclim_h=(rockclim_h&0xff00)|data;tilemap_set_scrollx(rockclim_tilemap , 0, rockclim_h );break; |
| 1107 | | case 1: rockclim_h=(rockclim_h&0xff)|(data<<8);tilemap_set_scrollx(rockclim_tilemap , 0, rockclim_h );break; |
| 1108 | | case 2: rockclim_v=(rockclim_v&0xff00)|data;tilemap_set_scrolly(rockclim_tilemap , 0, rockclim_v );break; |
| 1109 | | case 3: rockclim_v=(rockclim_v&0xff)|(data<<8);tilemap_set_scrolly(rockclim_tilemap , 0, rockclim_v );break; |
| 1011 | case 0: state->m_rockclim_h=(state->m_rockclim_h&0xff00)|data;tilemap_set_scrollx(state->m_rockclim_tilemap , 0, state->m_rockclim_h );break; |
| 1012 | case 1: state->m_rockclim_h=(state->m_rockclim_h&0xff)|(data<<8);tilemap_set_scrollx(state->m_rockclim_tilemap , 0, state->m_rockclim_h );break; |
| 1013 | case 2: state->m_rockclim_v=(state->m_rockclim_v&0xff00)|data;tilemap_set_scrolly(state->m_rockclim_tilemap , 0, state->m_rockclim_v );break; |
| 1014 | case 3: state->m_rockclim_v=(state->m_rockclim_v&0xff)|(data<<8);tilemap_set_scrolly(state->m_rockclim_tilemap , 0, state->m_rockclim_v );break; |
| 1110 | 1015 | } |
| 1111 | 1016 | |
| 1112 | 1017 | } |
| r11160 | r11161 | |
| 1114 | 1019 | |
| 1115 | 1020 | READ8_HANDLER( rockclim_videoram_r ) |
| 1116 | 1021 | { |
| 1117 | | return rockclim_videoram[offset]; |
| 1022 | galaxold_state *state = space->machine().driver_data<galaxold_state>(); |
| 1023 | return state->m_rockclim_videoram[offset]; |
| 1118 | 1024 | } |
| 1119 | 1025 | |
| 1120 | 1026 | |
| 1121 | 1027 | WRITE8_HANDLER( dambustr_bg_split_line_w ) |
| 1122 | 1028 | { |
| 1123 | | dambustr_bg_split_line = data; |
| 1029 | galaxold_state *state = space->machine().driver_data<galaxold_state>(); |
| 1030 | state->m_dambustr_bg_split_line = data; |
| 1124 | 1031 | } |
| 1125 | 1032 | |
| 1126 | 1033 | |
| 1127 | 1034 | WRITE8_HANDLER( dambustr_bg_color_w ) |
| 1128 | 1035 | { |
| 1129 | | dambustr_bg_color_1 = (BIT(data,2)<<2) | (BIT(data,1)<<1) | BIT(data,0); |
| 1130 | | dambustr_bg_color_2 = (BIT(data,6)<<2) | (BIT(data,5)<<1) | BIT(data,4); |
| 1131 | | dambustr_bg_priority = BIT(data,3); |
| 1132 | | dambustr_char_bank = BIT(data,7); |
| 1133 | | tilemap_mark_all_tiles_dirty(bg_tilemap); |
| 1036 | galaxold_state *state = space->machine().driver_data<galaxold_state>(); |
| 1037 | state->m_dambustr_bg_color_1 = (BIT(data,2)<<2) | (BIT(data,1)<<1) | BIT(data,0); |
| 1038 | state->m_dambustr_bg_color_2 = (BIT(data,6)<<2) | (BIT(data,5)<<1) | BIT(data,4); |
| 1039 | state->m_dambustr_bg_priority = BIT(data,3); |
| 1040 | state->m_dambustr_char_bank = BIT(data,7); |
| 1041 | tilemap_mark_all_tiles_dirty(state->m_bg_tilemap); |
| 1134 | 1042 | } |
| 1135 | 1043 | |
| 1136 | 1044 | |
| 1137 | 1045 | |
| 1138 | 1046 | /* character banking functions */ |
| 1139 | 1047 | |
| 1140 | | static void mooncrst_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x) |
| 1048 | static void mooncrst_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) |
| 1141 | 1049 | { |
| 1142 | | if (gfxbank[2] && ((*code & 0xc0) == 0x80)) |
| 1050 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1051 | if (state->m_gfxbank[2] && ((*code & 0xc0) == 0x80)) |
| 1143 | 1052 | { |
| 1144 | | *code = (*code & 0x3f) | (gfxbank[0] << 6) | (gfxbank[1] << 7) | 0x0100; |
| 1053 | *code = (*code & 0x3f) | (state->m_gfxbank[0] << 6) | (state->m_gfxbank[1] << 7) | 0x0100; |
| 1145 | 1054 | } |
| 1146 | 1055 | } |
| 1147 | 1056 | |
| 1148 | | static void pisces_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x) |
| 1057 | static void pisces_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) |
| 1149 | 1058 | { |
| 1150 | | *code |= (gfxbank[0] << 8); |
| 1059 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1060 | *code |= (state->m_gfxbank[0] << 8); |
| 1151 | 1061 | } |
| 1152 | 1062 | |
| 1153 | | static void mimonkey_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x) |
| 1063 | static void mimonkey_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) |
| 1154 | 1064 | { |
| 1155 | | *code |= (gfxbank[0] << 8) | (gfxbank[2] << 9); |
| 1065 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1066 | *code |= (state->m_gfxbank[0] << 8) | (state->m_gfxbank[2] << 9); |
| 1156 | 1067 | } |
| 1157 | 1068 | |
| 1158 | | static void mariner_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x) |
| 1069 | static void mariner_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) |
| 1159 | 1070 | { |
| 1160 | 1071 | UINT8 *prom; |
| 1161 | 1072 | |
| r11160 | r11161 | |
| 1167 | 1078 | *code |= ((prom[x] & 0x01) << 8); |
| 1168 | 1079 | } |
| 1169 | 1080 | |
| 1170 | | static void dambustr_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x) |
| 1081 | static void dambustr_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) |
| 1171 | 1082 | { |
| 1172 | | if (dambustr_char_bank == 0) { // text mode |
| 1083 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1084 | if (state->m_dambustr_char_bank == 0) { // text mode |
| 1173 | 1085 | *code |= 0x0300; |
| 1174 | 1086 | } |
| 1175 | 1087 | else { // graphics mode |
| r11160 | r11161 | |
| 1184 | 1096 | |
| 1185 | 1097 | /* sprite banking functions */ |
| 1186 | 1098 | |
| 1187 | | static void mshuttle_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs) |
| 1099 | static void mshuttle_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 1188 | 1100 | { |
| 1189 | 1101 | *code |= ((spriteram[offs + 2] & 0x30) << 2); |
| 1190 | 1102 | } |
| 1191 | 1103 | |
| 1192 | 1104 | |
| 1193 | | static void mimonkey_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs) |
| 1105 | static void mimonkey_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 1194 | 1106 | { |
| 1195 | | *code |= (gfxbank[0] << 6) | (gfxbank[2] << 7); |
| 1107 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1108 | *code |= (state->m_gfxbank[0] << 6) | (state->m_gfxbank[2] << 7); |
| 1196 | 1109 | } |
| 1197 | 1110 | |
| 1198 | | static void batman2_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs) |
| 1111 | static void batman2_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 1199 | 1112 | { |
| 1200 | 1113 | /* only the upper 64 sprites are used */ |
| 1201 | 1114 | *code |= 0x40; |
| 1202 | 1115 | } |
| 1203 | 1116 | |
| 1204 | | static void dkongjrm_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs) |
| 1117 | static void dkongjrm_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 1205 | 1118 | { |
| 1206 | 1119 | /* No x flip */ |
| 1207 | 1120 | *code = (spriteram[offs + 1] & 0x7f) | 0x80; |
| 1208 | 1121 | *flipx = 0; |
| 1209 | 1122 | } |
| 1210 | 1123 | |
| 1211 | | static void ad2083_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs) |
| 1124 | static void ad2083_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 1212 | 1125 | { |
| 1213 | 1126 | /* No x flip */ |
| 1214 | 1127 | *code = (spriteram[offs + 1] & 0x7f) | ((spriteram[offs + 2] & 0x30) << 2); |
| 1215 | 1128 | *flipx = 0; |
| 1216 | 1129 | } |
| 1217 | 1130 | |
| 1218 | | static void dambustr_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs) |
| 1131 | static void dambustr_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 1219 | 1132 | { |
| 1220 | 1133 | *code += 0x40; |
| 1221 | 1134 | } |
| r11160 | r11161 | |
| 1257 | 1170 | |
| 1258 | 1171 | static void scrambold_draw_bullets(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y) |
| 1259 | 1172 | { |
| 1260 | | if (flipscreen_x) x++; |
| 1173 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1174 | if (state->m_flipscreen_x) x++; |
| 1261 | 1175 | |
| 1262 | 1176 | x = x - 6; |
| 1263 | 1177 | |
| r11160 | r11161 | |
| 1268 | 1182 | |
| 1269 | 1183 | static void darkplnt_draw_bullets(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y) |
| 1270 | 1184 | { |
| 1271 | | if (flipscreen_x) x++; |
| 1185 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1186 | if (state->m_flipscreen_x) x++; |
| 1272 | 1187 | |
| 1273 | 1188 | x = x - 6; |
| 1274 | 1189 | |
| 1275 | 1190 | if ((x >= cliprect->min_x) && (x <= cliprect->max_x) && (y >= cliprect->min_y) && (y <= cliprect->max_y)) |
| 1276 | | *BITMAP_ADDR16(bitmap, y, x) = 32 + darkplnt_bullet_color; |
| 1191 | *BITMAP_ADDR16(bitmap, y, x) = 32 + state->m_darkplnt_bullet_color; |
| 1277 | 1192 | } |
| 1278 | 1193 | |
| 1279 | 1194 | static void dambustr_draw_bullets(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y) |
| r11160 | r11161 | |
| 1314 | 1229 | |
| 1315 | 1230 | static void scrambold_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 1316 | 1231 | { |
| 1317 | | if (background_enable) |
| 1232 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1233 | if (state->m_background_enable) |
| 1318 | 1234 | bitmap_fill(bitmap,cliprect,BACKGROUND_COLOR_BASE); |
| 1319 | 1235 | else |
| 1320 | 1236 | bitmap_fill(bitmap,cliprect,0); |
| r11160 | r11161 | |
| 1322 | 1238 | |
| 1323 | 1239 | static void ad2083_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 1324 | 1240 | { |
| 1325 | | int color = (background_blue << 2) | (background_green << 1) | background_red; |
| 1241 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1242 | int color = (state->m_background_blue << 2) | (state->m_background_green << 1) | state->m_background_red; |
| 1326 | 1243 | |
| 1327 | 1244 | bitmap_fill(bitmap,cliprect,BACKGROUND_COLOR_BASE + color); |
| 1328 | 1245 | } |
| 1329 | 1246 | |
| 1330 | 1247 | static void stratgyx_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 1331 | 1248 | { |
| 1249 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1332 | 1250 | UINT8 x; |
| 1333 | 1251 | UINT8 *prom; |
| 1334 | 1252 | int base = BACKGROUND_COLOR_BASE; |
| r11160 | r11161 | |
| 1350 | 1268 | |
| 1351 | 1269 | color = 0; |
| 1352 | 1270 | |
| 1353 | | if ((~prom[x] & 0x02) && background_red) color |= 0x01; |
| 1354 | | if ((~prom[x] & 0x02) && background_green) color |= 0x02; |
| 1355 | | if ((~prom[x] & 0x01) && background_blue) color |= 0x04; |
| 1271 | if ((~prom[x] & 0x02) && state->m_background_red) color |= 0x01; |
| 1272 | if ((~prom[x] & 0x02) && state->m_background_green) color |= 0x02; |
| 1273 | if ((~prom[x] & 0x01) && state->m_background_blue) color |= 0x04; |
| 1356 | 1274 | |
| 1357 | | if (flipscreen_x) |
| 1275 | if (state->m_flipscreen_x) |
| 1358 | 1276 | sx = 8 * (31 - x); |
| 1359 | 1277 | else |
| 1360 | 1278 | sx = 8 * x; |
| r11160 | r11161 | |
| 1365 | 1283 | |
| 1366 | 1284 | static void minefld_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 1367 | 1285 | { |
| 1368 | | if (background_enable) |
| 1286 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1287 | if (state->m_background_enable) |
| 1369 | 1288 | { |
| 1370 | 1289 | int base = BACKGROUND_COLOR_BASE; |
| 1371 | 1290 | int x; |
| r11160 | r11161 | |
| 1385 | 1304 | |
| 1386 | 1305 | static void rescue_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 1387 | 1306 | { |
| 1388 | | if (background_enable) |
| 1307 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1308 | if (state->m_background_enable) |
| 1389 | 1309 | { |
| 1390 | 1310 | int base = BACKGROUND_COLOR_BASE; |
| 1391 | 1311 | int x; |
| r11160 | r11161 | |
| 1404 | 1324 | |
| 1405 | 1325 | static void mariner_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 1406 | 1326 | { |
| 1327 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1407 | 1328 | int base = BACKGROUND_COLOR_BASE; |
| 1408 | 1329 | UINT8 x; |
| 1409 | 1330 | UINT8 *prom; |
| r11160 | r11161 | |
| 1415 | 1336 | |
| 1416 | 1337 | prom = machine.region("user1")->base(); |
| 1417 | 1338 | |
| 1418 | | if (flipscreen_x) |
| 1339 | if (state->m_flipscreen_x) |
| 1419 | 1340 | { |
| 1420 | 1341 | for (x = 0; x < 32; x++) |
| 1421 | 1342 | { |
| r11160 | r11161 | |
| 1447 | 1368 | |
| 1448 | 1369 | static void dambustr_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 1449 | 1370 | { |
| 1371 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1450 | 1372 | int base = BACKGROUND_COLOR_BASE; |
| 1451 | | int col1 = base + dambustr_bg_color_1; |
| 1452 | | int col2 = base + dambustr_bg_color_2; |
| 1373 | int col1 = base + state->m_dambustr_bg_color_1; |
| 1374 | int col2 = base + state->m_dambustr_bg_color_2; |
| 1453 | 1375 | |
| 1454 | 1376 | if (flip_screen_x_get(machine)) |
| 1455 | 1377 | { |
| 1456 | | plot_box(bitmap, 0, 0, 256-dambustr_bg_split_line, 256, col2); |
| 1457 | | plot_box(bitmap, 256-dambustr_bg_split_line, 0, dambustr_bg_split_line, 256, col1); |
| 1378 | plot_box(bitmap, 0, 0, 256-state->m_dambustr_bg_split_line, 256, col2); |
| 1379 | plot_box(bitmap, 256-state->m_dambustr_bg_split_line, 0, state->m_dambustr_bg_split_line, 256, col1); |
| 1458 | 1380 | } |
| 1459 | 1381 | else |
| 1460 | 1382 | { |
| 1461 | | plot_box(bitmap, 0, 0, 256-dambustr_bg_split_line, 256, col1); |
| 1462 | | plot_box(bitmap, 256-dambustr_bg_split_line, 0, dambustr_bg_split_line, 256, col2); |
| 1383 | plot_box(bitmap, 0, 0, 256-state->m_dambustr_bg_split_line, 256, col1); |
| 1384 | plot_box(bitmap, 256-state->m_dambustr_bg_split_line, 0, state->m_dambustr_bg_split_line, 256, col2); |
| 1463 | 1385 | } |
| 1464 | 1386 | |
| 1465 | 1387 | } |
| 1466 | 1388 | |
| 1467 | 1389 | static void dambustr_draw_upper_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 1468 | 1390 | { |
| 1469 | | static rectangle clip = { 0, 0, 0, 0 }; |
| 1391 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1392 | rectangle clip; |
| 1470 | 1393 | |
| 1471 | 1394 | if (flip_screen_x_get(machine)) |
| 1472 | 1395 | { |
| 1473 | | clip.min_x = 254 - dambustr_bg_split_line; |
| 1474 | | clip.max_x = dambustr_bg_split_line; |
| 1396 | clip.min_x = 254 - state->m_dambustr_bg_split_line; |
| 1397 | clip.max_x = state->m_dambustr_bg_split_line; |
| 1475 | 1398 | clip.min_y = 0; |
| 1476 | 1399 | clip.max_y = 255; |
| 1477 | | copybitmap(bitmap, dambustr_tmpbitmap, 0, 0, 0, 0, &clip); |
| 1400 | copybitmap(bitmap, state->m_dambustr_tmpbitmap, 0, 0, 0, 0, &clip); |
| 1478 | 1401 | } |
| 1479 | 1402 | else |
| 1480 | 1403 | { |
| 1481 | 1404 | clip.min_x = 0; |
| 1482 | | clip.max_x = 254 - dambustr_bg_split_line; |
| 1405 | clip.max_x = 254 - state->m_dambustr_bg_split_line; |
| 1483 | 1406 | clip.min_y = 0; |
| 1484 | 1407 | clip.max_y = 255; |
| 1485 | | copybitmap(bitmap, dambustr_tmpbitmap, 0, 0, 0, 0, &clip); |
| 1408 | copybitmap(bitmap, state->m_dambustr_tmpbitmap, 0, 0, 0, 0, &clip); |
| 1486 | 1409 | } |
| 1487 | 1410 | } |
| 1488 | 1411 | |
| r11160 | r11161 | |
| 1492 | 1415 | |
| 1493 | 1416 | void galaxold_init_stars(running_machine &machine, int colors_offset) |
| 1494 | 1417 | { |
| 1418 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1419 | struct star *stars = state->m_stars; |
| 1495 | 1420 | int i; |
| 1496 | 1421 | int total_stars; |
| 1497 | 1422 | UINT32 generator; |
| 1498 | 1423 | int x,y; |
| 1499 | 1424 | |
| 1500 | 1425 | |
| 1501 | | galaxold_stars_on = 0; |
| 1502 | | stars_blink_state = 0; |
| 1503 | | stars_blink_timer = machine.scheduler().timer_alloc(FUNC(stars_blink_callback)); |
| 1504 | | stars_scroll_timer = machine.scheduler().timer_alloc(FUNC(stars_scroll_callback)); |
| 1505 | | timer_adjusted = 0; |
| 1506 | | stars_colors_start = colors_offset; |
| 1426 | state->m_stars_on = 0; |
| 1427 | state->m_stars_blink_state = 0; |
| 1428 | state->m_stars_blink_timer = machine.scheduler().timer_alloc(FUNC(stars_blink_callback)); |
| 1429 | state->m_stars_scroll_timer = machine.scheduler().timer_alloc(FUNC(stars_scroll_callback)); |
| 1430 | state->m_timer_adjusted = 0; |
| 1431 | state->m_stars_colors_start = colors_offset; |
| 1507 | 1432 | |
| 1508 | 1433 | for (i = 0;i < 64;i++) |
| 1509 | 1434 | { |
| r11160 | r11161 | |
| 1561 | 1486 | } |
| 1562 | 1487 | } |
| 1563 | 1488 | |
| 1564 | | static void plot_star(bitmap_t *bitmap, int x, int y, int color, const rectangle *cliprect) |
| 1489 | static void plot_star(galaxold_state *state, bitmap_t *bitmap, int x, int y, int color, const rectangle *cliprect) |
| 1565 | 1490 | { |
| 1566 | | if (flipscreen_x) |
| 1491 | if (state->m_flipscreen_x) |
| 1567 | 1492 | x = 255 - x; |
| 1568 | 1493 | |
| 1569 | | if (flipscreen_y) |
| 1494 | if (state->m_flipscreen_y) |
| 1570 | 1495 | y = 255 - y; |
| 1571 | 1496 | |
| 1572 | 1497 | if ((x >= cliprect->min_x) && (x <= cliprect->max_x) && (y >= cliprect->min_y) && (y <= cliprect->max_y)) |
| 1573 | | *BITMAP_ADDR16(bitmap, y, x) = stars_colors_start + color; |
| 1498 | *BITMAP_ADDR16(bitmap, y, x) = state->m_stars_colors_start + color; |
| 1574 | 1499 | } |
| 1575 | 1500 | |
| 1576 | 1501 | static void noop_draw_stars(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| r11160 | r11161 | |
| 1579 | 1504 | |
| 1580 | 1505 | void galaxold_draw_stars(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 1581 | 1506 | { |
| 1507 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1508 | struct star *stars = state->m_stars; |
| 1582 | 1509 | int offs; |
| 1583 | 1510 | |
| 1584 | 1511 | |
| 1585 | | if (!timer_adjusted) |
| 1512 | if (!state->m_timer_adjusted) |
| 1586 | 1513 | { |
| 1587 | 1514 | start_stars_scroll_timer(machine); |
| 1588 | | timer_adjusted = 1; |
| 1515 | state->m_timer_adjusted = 1; |
| 1589 | 1516 | } |
| 1590 | 1517 | |
| 1591 | 1518 | |
| r11160 | r11161 | |
| 1594 | 1521 | int x,y; |
| 1595 | 1522 | |
| 1596 | 1523 | |
| 1597 | | x = ((stars[offs].x + stars_scrollpos) & 0x01ff) >> 1; |
| 1598 | | y = ( stars[offs].y + ((stars_scrollpos + stars[offs].x) >> 9)) & 0xff; |
| 1524 | x = ((stars[offs].x + state->m_stars_scrollpos) & 0x01ff) >> 1; |
| 1525 | y = ( stars[offs].y + ((state->m_stars_scrollpos + stars[offs].x) >> 9)) & 0xff; |
| 1599 | 1526 | |
| 1600 | 1527 | if ((y & 0x01) ^ ((x >> 3) & 0x01)) |
| 1601 | 1528 | { |
| 1602 | | plot_star(bitmap, x, y, stars[offs].color, cliprect); |
| 1529 | plot_star(state, bitmap, x, y, stars[offs].color, cliprect); |
| 1603 | 1530 | } |
| 1604 | 1531 | } |
| 1605 | 1532 | } |
| 1606 | 1533 | |
| 1607 | 1534 | static void scrambold_draw_stars(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 1608 | 1535 | { |
| 1536 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1537 | struct star *stars = state->m_stars; |
| 1609 | 1538 | int offs; |
| 1610 | 1539 | |
| 1611 | 1540 | |
| 1612 | | if (!timer_adjusted) |
| 1541 | if (!state->m_timer_adjusted) |
| 1613 | 1542 | { |
| 1614 | | start_stars_blink_timer(100000, 10000, 0.00001); |
| 1615 | | timer_adjusted = 1; |
| 1543 | start_stars_blink_timer(machine, 100000, 10000, 0.00001); |
| 1544 | state->m_timer_adjusted = 1; |
| 1616 | 1545 | } |
| 1617 | 1546 | |
| 1618 | 1547 | |
| r11160 | r11161 | |
| 1627 | 1556 | if ((y & 0x01) ^ ((x >> 3) & 0x01)) |
| 1628 | 1557 | { |
| 1629 | 1558 | /* determine when to skip plotting */ |
| 1630 | | switch (stars_blink_state & 0x03) |
| 1559 | switch (state->m_stars_blink_state & 0x03) |
| 1631 | 1560 | { |
| 1632 | 1561 | case 0: |
| 1633 | 1562 | if (!(stars[offs].color & 0x01)) continue; |
| r11160 | r11161 | |
| 1643 | 1572 | break; |
| 1644 | 1573 | } |
| 1645 | 1574 | |
| 1646 | | plot_star(bitmap, x, y, stars[offs].color, cliprect); |
| 1575 | plot_star(state, bitmap, x, y, stars[offs].color, cliprect); |
| 1647 | 1576 | } |
| 1648 | 1577 | } |
| 1649 | 1578 | } |
| 1650 | 1579 | |
| 1651 | 1580 | static void rescue_draw_stars(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 1652 | 1581 | { |
| 1582 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1583 | struct star *stars = state->m_stars; |
| 1653 | 1584 | int offs; |
| 1654 | 1585 | |
| 1655 | 1586 | |
| 1656 | 1587 | /* same as Scramble, but only top (left) half of screen */ |
| 1657 | 1588 | |
| 1658 | | if (!timer_adjusted) |
| 1589 | if (!state->m_timer_adjusted) |
| 1659 | 1590 | { |
| 1660 | | start_stars_blink_timer(100000, 10000, 0.00001); |
| 1661 | | timer_adjusted = 1; |
| 1591 | start_stars_blink_timer(machine, 100000, 10000, 0.00001); |
| 1592 | state->m_timer_adjusted = 1; |
| 1662 | 1593 | } |
| 1663 | 1594 | |
| 1664 | 1595 | |
| r11160 | r11161 | |
| 1673 | 1604 | if ((x < 128) && ((y & 0x01) ^ ((x >> 3) & 0x01))) |
| 1674 | 1605 | { |
| 1675 | 1606 | /* determine when to skip plotting */ |
| 1676 | | switch (stars_blink_state & 0x03) |
| 1607 | switch (state->m_stars_blink_state & 0x03) |
| 1677 | 1608 | { |
| 1678 | 1609 | case 0: |
| 1679 | 1610 | if (!(stars[offs].color & 0x01)) continue; |
| r11160 | r11161 | |
| 1689 | 1620 | break; |
| 1690 | 1621 | } |
| 1691 | 1622 | |
| 1692 | | plot_star(bitmap, x, y, stars[offs].color, cliprect); |
| 1623 | plot_star(state, bitmap, x, y, stars[offs].color, cliprect); |
| 1693 | 1624 | } |
| 1694 | 1625 | } |
| 1695 | 1626 | } |
| 1696 | 1627 | |
| 1697 | 1628 | static void mariner_draw_stars(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 1698 | 1629 | { |
| 1630 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1631 | struct star *stars = state->m_stars; |
| 1699 | 1632 | int offs; |
| 1700 | 1633 | UINT8 *prom; |
| 1701 | 1634 | |
| 1702 | 1635 | |
| 1703 | | if (!timer_adjusted) |
| 1636 | if (!state->m_timer_adjusted) |
| 1704 | 1637 | { |
| 1705 | 1638 | start_stars_scroll_timer(machine); |
| 1706 | | timer_adjusted = 1; |
| 1639 | state->m_timer_adjusted = 1; |
| 1707 | 1640 | } |
| 1708 | 1641 | |
| 1709 | 1642 | |
| r11160 | r11161 | |
| 1716 | 1649 | int x,y; |
| 1717 | 1650 | |
| 1718 | 1651 | |
| 1719 | | x = ((stars[offs].x + -stars_scrollpos) & 0x01ff) >> 1; |
| 1720 | | y = ( stars[offs].y + ((-stars_scrollpos + stars[offs].x) >> 9)) & 0xff; |
| 1652 | x = ((stars[offs].x + -state->m_stars_scrollpos) & 0x01ff) >> 1; |
| 1653 | y = ( stars[offs].y + ((-state->m_stars_scrollpos + stars[offs].x) >> 9)) & 0xff; |
| 1721 | 1654 | |
| 1722 | 1655 | if ((y & 0x01) ^ ((x >> 3) & 0x01)) |
| 1723 | 1656 | { |
| 1724 | 1657 | if (prom[(x/8 + 1) & 0x1f] & 0x04) |
| 1725 | 1658 | { |
| 1726 | | plot_star(bitmap, x, y, stars[offs].color, cliprect); |
| 1659 | plot_star(state, bitmap, x, y, stars[offs].color, cliprect); |
| 1727 | 1660 | } |
| 1728 | 1661 | } |
| 1729 | 1662 | } |
| r11160 | r11161 | |
| 1731 | 1664 | |
| 1732 | 1665 | static TIMER_CALLBACK( stars_blink_callback ) |
| 1733 | 1666 | { |
| 1734 | | stars_blink_state++; |
| 1667 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1668 | state->m_stars_blink_state++; |
| 1735 | 1669 | } |
| 1736 | 1670 | |
| 1737 | | static void start_stars_blink_timer(double ra, double rb, double c) |
| 1671 | static void start_stars_blink_timer(running_machine &machine, double ra, double rb, double c) |
| 1738 | 1672 | { |
| 1673 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1739 | 1674 | /* calculate the period using the formula given in the 555 datasheet */ |
| 1740 | 1675 | |
| 1741 | 1676 | int period_in_ms = 693 * (ra + 2.0 * rb) * c; |
| 1742 | 1677 | |
| 1743 | | stars_blink_timer->adjust(attotime::from_msec(period_in_ms), 0, attotime::from_msec(period_in_ms)); |
| 1678 | state->m_stars_blink_timer->adjust(attotime::from_msec(period_in_ms), 0, attotime::from_msec(period_in_ms)); |
| 1744 | 1679 | } |
| 1745 | 1680 | |
| 1746 | 1681 | |
| 1747 | 1682 | static TIMER_CALLBACK( stars_scroll_callback ) |
| 1748 | 1683 | { |
| 1749 | | if (galaxold_stars_on) |
| 1684 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1685 | if (state->m_stars_on) |
| 1750 | 1686 | { |
| 1751 | | stars_scrollpos++; |
| 1687 | state->m_stars_scrollpos++; |
| 1752 | 1688 | } |
| 1753 | 1689 | } |
| 1754 | 1690 | |
| 1755 | 1691 | static void start_stars_scroll_timer(running_machine &machine) |
| 1756 | 1692 | { |
| 1757 | | stars_scroll_timer->adjust(machine.primary_screen->frame_period(), 0, machine.primary_screen->frame_period()); |
| 1693 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1694 | state->m_stars_scroll_timer->adjust(machine.primary_screen->frame_period(), 0, machine.primary_screen->frame_period()); |
| 1758 | 1695 | } |
| 1759 | 1696 | |
| 1760 | 1697 | |
| 1761 | 1698 | |
| 1762 | 1699 | static TILE_GET_INFO( get_tile_info ) |
| 1763 | 1700 | { |
| 1701 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1764 | 1702 | UINT8 x = tile_index & 0x1f; |
| 1765 | 1703 | |
| 1766 | | UINT16 code = galaxold_videoram[tile_index]; |
| 1767 | | UINT8 color = galaxold_attributesram[(x << 1) | 1] & color_mask; |
| 1704 | UINT16 code = state->m_videoram[tile_index]; |
| 1705 | UINT8 color = state->m_attributesram[(x << 1) | 1] & state->m_color_mask; |
| 1768 | 1706 | |
| 1769 | | if (modify_charcode) |
| 1707 | if (state->m_modify_charcode) |
| 1770 | 1708 | { |
| 1771 | | modify_charcode(machine, &code, x); |
| 1709 | (*state->m_modify_charcode)(machine, &code, x); |
| 1772 | 1710 | } |
| 1773 | 1711 | |
| 1774 | | if (modify_color) |
| 1712 | if (state->m_modify_color) |
| 1775 | 1713 | { |
| 1776 | | modify_color(&color); |
| 1714 | (*state->m_modify_color)(&color); |
| 1777 | 1715 | } |
| 1778 | 1716 | |
| 1779 | 1717 | SET_TILE_INFO(0, code, color, 0); |
| r11160 | r11161 | |
| 1781 | 1719 | |
| 1782 | 1720 | static TILE_GET_INFO( rockclim_get_tile_info ) |
| 1783 | 1721 | { |
| 1784 | | UINT16 code = rockclim_videoram[tile_index]; |
| 1722 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1723 | UINT16 code = state->m_rockclim_videoram[tile_index]; |
| 1785 | 1724 | SET_TILE_INFO(2, code, 0, 0); |
| 1786 | 1725 | } |
| 1787 | 1726 | |
| 1788 | 1727 | static void draw_bullets_common(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 1789 | 1728 | { |
| 1729 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1790 | 1730 | int offs; |
| 1791 | 1731 | |
| 1792 | 1732 | |
| 1793 | | for (offs = 0;offs < galaxold_bulletsram_size;offs += 4) |
| 1733 | for (offs = 0;offs < state->m_bulletsram_size;offs += 4) |
| 1794 | 1734 | { |
| 1795 | 1735 | UINT8 sx,sy; |
| 1796 | 1736 | |
| 1797 | | sy = 255 - galaxold_bulletsram[offs + 1]; |
| 1798 | | sx = 255 - galaxold_bulletsram[offs + 3]; |
| 1737 | sy = 255 - state->m_bulletsram[offs + 1]; |
| 1738 | sx = 255 - state->m_bulletsram[offs + 3]; |
| 1799 | 1739 | |
| 1800 | | if (flipscreen_y) sy = 255 - sy; |
| 1740 | if (state->m_flipscreen_y) sy = 255 - sy; |
| 1801 | 1741 | |
| 1802 | | draw_bullets(machine, bitmap, cliprect, offs, sx, sy); |
| 1742 | (*state->m_draw_bullets)(machine, bitmap, cliprect, offs, sx, sy); |
| 1803 | 1743 | } |
| 1804 | 1744 | } |
| 1805 | 1745 | |
| 1806 | 1746 | |
| 1807 | 1747 | static void draw_sprites(running_machine &machine, bitmap_t *bitmap, UINT8 *spriteram, size_t spriteram_size) |
| 1808 | 1748 | { |
| 1749 | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1809 | 1750 | int offs; |
| 1810 | 1751 | |
| 1811 | 1752 | |
| r11160 | r11161 | |
| 1820 | 1761 | flipx = spriteram[offs + 1] & 0x40; |
| 1821 | 1762 | flipy = spriteram[offs + 1] & 0x80; |
| 1822 | 1763 | code = spriteram[offs + 1] & 0x3f; |
| 1823 | | color = spriteram[offs + 2] & color_mask; |
| 1764 | color = spriteram[offs + 2] & state->m_color_mask; |
| 1824 | 1765 | |
| 1825 | | if (modify_spritecode) |
| 1766 | if (state->m_modify_spritecode) |
| 1826 | 1767 | { |
| 1827 | | modify_spritecode(spriteram, &code, &flipx, &flipy, offs); |
| 1768 | (*state->m_modify_spritecode)(machine, spriteram, &code, &flipx, &flipy, offs); |
| 1828 | 1769 | } |
| 1829 | 1770 | |
| 1830 | | if (modify_color) |
| 1771 | if (state->m_modify_color) |
| 1831 | 1772 | { |
| 1832 | | modify_color(&color); |
| 1773 | (*state->m_modify_color)(&color); |
| 1833 | 1774 | } |
| 1834 | 1775 | |
| 1835 | | if (modify_ypos) |
| 1776 | if (state->m_modify_ypos) |
| 1836 | 1777 | { |
| 1837 | | modify_ypos(&sy); |
| 1778 | (*state->m_modify_ypos)(&sy); |
| 1838 | 1779 | } |
| 1839 | 1780 | |
| 1840 | | if (flipscreen_x) |
| 1781 | if (state->m_flipscreen_x) |
| 1841 | 1782 | { |
| 1842 | 1783 | sx = 240 - sx; |
| 1843 | 1784 | flipx = !flipx; |
| 1844 | 1785 | } |
| 1845 | 1786 | |
| 1846 | | if (flipscreen_y) |
| 1787 | if (state->m_flipscreen_y) |
| 1847 | 1788 | { |
| 1848 | 1789 | flipy = !flipy; |
| 1849 | 1790 | } |
| r11160 | r11161 | |
| 1861 | 1802 | if (offs < 3*4) sy++; |
| 1862 | 1803 | |
| 1863 | 1804 | |
| 1864 | | drawgfx_transpen(bitmap,flipscreen_x ? spritevisibleareaflipx : spritevisiblearea,machine.gfx[1], |
| 1805 | drawgfx_transpen(bitmap, state->m_flipscreen_x ? &spritevisibleareaflipx : &spritevisiblearea, machine.gfx[1], |
| 1865 | 1806 | code,color, |
| 1866 | 1807 | flipx,flipy, |
| 1867 | 1808 | sx,sy,0); |
| r11160 | r11161 | |
| 1871 | 1812 | |
| 1872 | 1813 | SCREEN_UPDATE( galaxold ) |
| 1873 | 1814 | { |
| 1874 | | draw_background(screen->machine(), bitmap, cliprect); |
| 1815 | galaxold_state *state = screen->machine().driver_data<galaxold_state>(); |
| 1875 | 1816 | |
| 1817 | (*state->m_draw_background)(screen->machine(), bitmap, cliprect); |
| 1876 | 1818 | |
| 1877 | | if (galaxold_stars_on) |
| 1819 | if (state->m_stars_on) |
| 1878 | 1820 | { |
| 1879 | | draw_stars(screen->machine(), bitmap, cliprect); |
| 1821 | (*state->m_draw_stars)(screen->machine(), bitmap, cliprect); |
| 1880 | 1822 | } |
| 1881 | 1823 | |
| 1882 | 1824 | |
| 1883 | | tilemap_draw(bitmap, 0, bg_tilemap, 0, 0); |
| 1825 | tilemap_draw(bitmap, 0, state->m_bg_tilemap, 0, 0); |
| 1884 | 1826 | |
| 1885 | | |
| 1886 | | if (draw_bullets) |
| 1827 | if (state->m_draw_bullets) |
| 1887 | 1828 | { |
| 1888 | 1829 | draw_bullets_common(screen->machine(), bitmap, cliprect); |
| 1889 | 1830 | } |
| 1890 | 1831 | |
| 1891 | 1832 | |
| 1892 | | draw_sprites(screen->machine(), bitmap, galaxold_spriteram, galaxold_spriteram_size); |
| 1833 | draw_sprites(screen->machine(), bitmap, state->m_spriteram, state->m_spriteram_size); |
| 1893 | 1834 | |
| 1894 | | if (spriteram2_present) |
| 1835 | if (state->m_spriteram2_present) |
| 1895 | 1836 | { |
| 1896 | | draw_sprites(screen->machine(), bitmap, galaxold_spriteram2, galaxold_spriteram2_size); |
| 1837 | draw_sprites(screen->machine(), bitmap, state->m_spriteram2, state->m_spriteram2_size); |
| 1897 | 1838 | } |
| 1898 | 1839 | return 0; |
| 1899 | 1840 | } |
| r11160 | r11161 | |
| 1901 | 1842 | |
| 1902 | 1843 | SCREEN_UPDATE( dambustr ) |
| 1903 | 1844 | { |
| 1845 | galaxold_state *state = screen->machine().driver_data<galaxold_state>(); |
| 1904 | 1846 | int i, j; |
| 1905 | 1847 | UINT8 color; |
| 1906 | 1848 | |
| 1907 | | draw_background(screen->machine(), bitmap, cliprect); |
| 1849 | (*state->m_draw_background)(screen->machine(), bitmap, cliprect); |
| 1908 | 1850 | |
| 1909 | | if (galaxold_stars_on) |
| 1851 | if (state->m_stars_on) |
| 1910 | 1852 | { |
| 1911 | | draw_stars(screen->machine(), bitmap, cliprect); |
| 1853 | (*state->m_draw_stars)(screen->machine(), bitmap, cliprect); |
| 1912 | 1854 | } |
| 1913 | 1855 | |
| 1914 | 1856 | /* save the background for drawing it again later, if background has priority over characters */ |
| 1915 | | copybitmap(dambustr_tmpbitmap, bitmap, 0, 0, 0, 0, NULL); |
| 1857 | copybitmap(state->m_dambustr_tmpbitmap, bitmap, 0, 0, 0, 0, NULL); |
| 1916 | 1858 | |
| 1917 | | tilemap_draw(bitmap, 0, bg_tilemap, 0, 0); |
| 1859 | tilemap_draw(bitmap, 0, state->m_bg_tilemap, 0, 0); |
| 1918 | 1860 | |
| 1919 | | if (draw_bullets) |
| 1861 | if (state->m_draw_bullets) |
| 1920 | 1862 | { |
| 1921 | 1863 | draw_bullets_common(screen->machine(), bitmap, cliprect); |
| 1922 | 1864 | } |
| 1923 | 1865 | |
| 1924 | | draw_sprites(screen->machine(), bitmap, galaxold_spriteram, galaxold_spriteram_size); |
| 1866 | draw_sprites(screen->machine(), bitmap, state->m_spriteram, state->m_spriteram_size); |
| 1925 | 1867 | |
| 1926 | | if (dambustr_bg_priority) |
| 1868 | if (state->m_dambustr_bg_priority) |
| 1927 | 1869 | { |
| 1928 | 1870 | /* draw the upper part of the background, as it has priority */ |
| 1929 | 1871 | dambustr_draw_upper_background(screen->machine(), bitmap, cliprect); |
| 1930 | 1872 | |
| 1931 | 1873 | /* only rows with color code > 3 are stronger than the background */ |
| 1932 | | memset(dambustr_videoram2, 0x20, 0x0400); |
| 1874 | memset(state->m_dambustr_videoram2, 0x20, 0x0400); |
| 1933 | 1875 | for (i=0; i<32; i++) { |
| 1934 | | color = galaxold_attributesram[(i << 1) | 1] & color_mask; |
| 1876 | color = state->m_attributesram[(i << 1) | 1] & state->m_color_mask; |
| 1935 | 1877 | if (color > 3) { |
| 1936 | 1878 | for (j=0; j<32; j++) |
| 1937 | | dambustr_videoram2[32*j+i] = galaxold_videoram[32*j+i]; |
| 1879 | state->m_dambustr_videoram2[32*j+i] = state->m_videoram[32*j+i]; |
| 1938 | 1880 | }; |
| 1939 | 1881 | }; |
| 1940 | | tilemap_mark_all_tiles_dirty(dambustr_tilemap2); |
| 1941 | | tilemap_draw(bitmap, 0, dambustr_tilemap2, 0, 0); |
| 1882 | tilemap_mark_all_tiles_dirty(state->m_dambustr_tilemap2); |
| 1883 | tilemap_draw(bitmap, 0, state->m_dambustr_tilemap2, 0, 0); |
| 1942 | 1884 | }; |
| 1943 | 1885 | |
| 1944 | 1886 | return 0; |
src/mame/video/astrocde.c
| r11160 | r11161 | |
| 26 | 26 | |
| 27 | 27 | /************************************* |
| 28 | 28 | * |
| 29 | | * Global variables |
| 30 | | * |
| 31 | | *************************************/ |
| 32 | | |
| 33 | | /* video configuration */ |
| 34 | | UINT8 astrocade_video_config; |
| 35 | | UINT8 astrocade_sparkle[4]; |
| 36 | | |
| 37 | | /* palette/sparkle/star */ |
| 38 | | static UINT8 *sparklestar; |
| 39 | | |
| 40 | | /* Astrocade interrupts */ |
| 41 | | static UINT8 interrupt_enable; |
| 42 | | static UINT8 interrupt_vector; |
| 43 | | static UINT8 interrupt_scanline; |
| 44 | | static UINT8 vertical_feedback; |
| 45 | | static UINT8 horizontal_feedback; |
| 46 | | |
| 47 | | /* Astrocade video parameters */ |
| 48 | | static emu_timer *scanline_timer; |
| 49 | | static UINT8 colors[8]; |
| 50 | | static UINT8 colorsplit; |
| 51 | | static UINT8 bgdata; |
| 52 | | static UINT8 vblank; |
| 53 | | static UINT8 video_mode; |
| 54 | | |
| 55 | | /* Astrocade function generator */ |
| 56 | | static UINT8 funcgen_expand_color[2]; |
| 57 | | static UINT8 funcgen_control; |
| 58 | | static UINT8 funcgen_expand_count; |
| 59 | | static UINT8 funcgen_rotate_count; |
| 60 | | static UINT8 funcgen_rotate_data[4]; |
| 61 | | static UINT8 funcgen_shift_prev_data; |
| 62 | | static UINT8 funcgen_intercept; |
| 63 | | |
| 64 | | /* pattern board registers */ |
| 65 | | static UINT16 pattern_source; |
| 66 | | static UINT8 pattern_mode; |
| 67 | | static UINT16 pattern_dest; |
| 68 | | static UINT8 pattern_skip; |
| 69 | | static UINT8 pattern_width; |
| 70 | | static UINT8 pattern_height; |
| 71 | | |
| 72 | | /* 16-color board registers and video RAM */ |
| 73 | | static UINT16 *profpac_videoram; |
| 74 | | static UINT16 profpac_palette[16]; |
| 75 | | static UINT8 profpac_colormap[4]; |
| 76 | | static UINT8 profpac_intercept; |
| 77 | | static UINT8 profpac_vispage; |
| 78 | | static UINT8 profpac_readpage; |
| 79 | | static UINT8 profpac_readshift; |
| 80 | | static UINT8 profpac_writepage; |
| 81 | | static UINT8 profpac_writemode; |
| 82 | | static UINT16 profpac_writemask; |
| 83 | | static UINT8 profpac_vw; |
| 84 | | |
| 85 | | |
| 86 | | |
| 87 | | /************************************* |
| 88 | | * |
| 89 | 29 | * Function prototypes |
| 90 | 30 | * |
| 91 | 31 | *************************************/ |
| r11160 | r11161 | |
| 221 | 161 | |
| 222 | 162 | VIDEO_START( astrocde ) |
| 223 | 163 | { |
| 164 | astrocde_state *state = machine.driver_data<astrocde_state>(); |
| 224 | 165 | /* allocate a per-scanline timer */ |
| 225 | | scanline_timer = machine.scheduler().timer_alloc(FUNC(scanline_callback)); |
| 226 | | scanline_timer->adjust(machine.primary_screen->time_until_pos(1), 1); |
| 166 | state->m_scanline_timer = machine.scheduler().timer_alloc(FUNC(scanline_callback)); |
| 167 | state->m_scanline_timer->adjust(machine.primary_screen->time_until_pos(1), 1); |
| 227 | 168 | |
| 228 | 169 | /* register for save states */ |
| 229 | 170 | init_savestate(machine); |
| 230 | 171 | |
| 231 | 172 | /* initialize the sparkle and stars */ |
| 232 | | if (astrocade_video_config & AC_STARS) |
| 173 | if (state->m_video_config & AC_STARS) |
| 233 | 174 | init_sparklestar(machine); |
| 234 | 175 | } |
| 235 | 176 | |
| 236 | 177 | |
| 237 | 178 | VIDEO_START( profpac ) |
| 238 | 179 | { |
| 180 | astrocde_state *state = machine.driver_data<astrocde_state>(); |
| 239 | 181 | /* allocate a per-scanline timer */ |
| 240 | | scanline_timer = machine.scheduler().timer_alloc(FUNC(scanline_callback)); |
| 241 | | scanline_timer->adjust(machine.primary_screen->time_until_pos(1), 1); |
| 182 | state->m_scanline_timer = machine.scheduler().timer_alloc(FUNC(scanline_callback)); |
| 183 | state->m_scanline_timer->adjust(machine.primary_screen->time_until_pos(1), 1); |
| 242 | 184 | |
| 243 | 185 | /* allocate videoram */ |
| 244 | | profpac_videoram = auto_alloc_array(machine, UINT16, 0x4000 * 4); |
| 186 | state->m_profpac_videoram = auto_alloc_array(machine, UINT16, 0x4000 * 4); |
| 245 | 187 | |
| 246 | 188 | /* register for save states */ |
| 247 | 189 | init_savestate(machine); |
| 248 | 190 | |
| 249 | 191 | /* register our specific save state data */ |
| 250 | | state_save_register_global_pointer(machine, profpac_videoram, 0x4000 * 4); |
| 251 | | state_save_register_global_array(machine, profpac_palette); |
| 252 | | state_save_register_global_array(machine, profpac_colormap); |
| 253 | | state_save_register_global(machine, profpac_intercept); |
| 254 | | state_save_register_global(machine, profpac_vispage); |
| 255 | | state_save_register_global(machine, profpac_readpage); |
| 256 | | state_save_register_global(machine, profpac_readshift); |
| 257 | | state_save_register_global(machine, profpac_writepage); |
| 258 | | state_save_register_global(machine, profpac_writemode); |
| 259 | | state_save_register_global(machine, profpac_writemask); |
| 260 | | state_save_register_global(machine, profpac_vw); |
| 192 | state_save_register_global_pointer(machine, state->m_profpac_videoram, 0x4000 * 4); |
| 193 | state_save_register_global_array(machine, state->m_profpac_palette); |
| 194 | state_save_register_global_array(machine, state->m_profpac_colormap); |
| 195 | state_save_register_global(machine, state->m_profpac_intercept); |
| 196 | state_save_register_global(machine, state->m_profpac_vispage); |
| 197 | state_save_register_global(machine, state->m_profpac_readpage); |
| 198 | state_save_register_global(machine, state->m_profpac_readshift); |
| 199 | state_save_register_global(machine, state->m_profpac_writepage); |
| 200 | state_save_register_global(machine, state->m_profpac_writemode); |
| 201 | state_save_register_global(machine, state->m_profpac_writemask); |
| 202 | state_save_register_global(machine, state->m_profpac_vw); |
| 261 | 203 | } |
| 262 | 204 | |
| 263 | 205 | |
| 264 | 206 | static void init_savestate(running_machine &machine) |
| 265 | 207 | { |
| 266 | | state_save_register_global_array(machine, astrocade_sparkle); |
| 208 | astrocde_state *state = machine.driver_data<astrocde_state>(); |
| 209 | state_save_register_global_array(machine, state->m_sparkle); |
| 267 | 210 | |
| 268 | | state_save_register_global(machine, interrupt_enable); |
| 269 | | state_save_register_global(machine, interrupt_vector); |
| 270 | | state_save_register_global(machine, interrupt_scanline); |
| 271 | | state_save_register_global(machine, vertical_feedback); |
| 272 | | state_save_register_global(machine, horizontal_feedback); |
| 211 | state_save_register_global(machine, state->m_interrupt_enabl); |
| 212 | state_save_register_global(machine, state->m_interrupt_vector); |
| 213 | state_save_register_global(machine, state->m_interrupt_scanline); |
| 214 | state_save_register_global(machine, state->m_vertical_feedback); |
| 215 | state_save_register_global(machine, state->m_horizontal_feedback); |
| 273 | 216 | |
| 274 | | state_save_register_global_array(machine, colors); |
| 275 | | state_save_register_global(machine, colorsplit); |
| 276 | | state_save_register_global(machine, bgdata); |
| 277 | | state_save_register_global(machine, vblank); |
| 278 | | state_save_register_global(machine, video_mode); |
| 217 | state_save_register_global_array(machine, state->m_colors); |
| 218 | state_save_register_global(machine, state->m_colorsplit); |
| 219 | state_save_register_global(machine, state->m_bgdata); |
| 220 | state_save_register_global(machine, state->m_vblank); |
| 221 | state_save_register_global(machine, state->m_video_mode); |
| 279 | 222 | |
| 280 | | state_save_register_global_array(machine, funcgen_expand_color); |
| 281 | | state_save_register_global(machine, funcgen_control); |
| 282 | | state_save_register_global(machine, funcgen_expand_count); |
| 283 | | state_save_register_global(machine, funcgen_rotate_count); |
| 284 | | state_save_register_global_array(machine, funcgen_rotate_data); |
| 285 | | state_save_register_global(machine, funcgen_shift_prev_data); |
| 286 | | state_save_register_global(machine, funcgen_intercept); |
| 223 | state_save_register_global_array(machine, state->m_funcgen_expand_color); |
| 224 | state_save_register_global(machine, state->m_funcgen_control); |
| 225 | state_save_register_global(machine, state->m_funcgen_expand_count); |
| 226 | state_save_register_global(machine, state->m_funcgen_rotate_count); |
| 227 | state_save_register_global_array(machine, state->m_funcgen_rotate_data); |
| 228 | state_save_register_global(machine, state->m_funcgen_shift_prev_data); |
| 229 | state_save_register_global(machine, state->m_funcgen_intercept); |
| 287 | 230 | |
| 288 | | state_save_register_global(machine, pattern_source); |
| 289 | | state_save_register_global(machine, pattern_mode); |
| 290 | | state_save_register_global(machine, pattern_dest); |
| 291 | | state_save_register_global(machine, pattern_skip); |
| 292 | | state_save_register_global(machine, pattern_width); |
| 293 | | state_save_register_global(machine, pattern_height); |
| 231 | state_save_register_global(machine, state->m_pattern_source); |
| 232 | state_save_register_global(machine, state->m_pattern_mode); |
| 233 | state_save_register_global(machine, state->m_pattern_dest); |
| 234 | state_save_register_global(machine, state->m_pattern_skip); |
| 235 | state_save_register_global(machine, state->m_pattern_width); |
| 236 | state_save_register_global(machine, state->m_pattern_height); |
| 294 | 237 | } |
| 295 | 238 | |
| 296 | 239 | |
| r11160 | r11161 | |
| 306 | 249 | astrocde_state *state = screen->machine().driver_data<astrocde_state>(); |
| 307 | 250 | UINT8 *videoram = state->m_videoram; |
| 308 | 251 | UINT32 sparklebase = 0; |
| 309 | | const int colormask = (astrocade_video_config & AC_MONITOR_BW) ? 0 : 0x1f0; |
| 310 | | int xystep = 2 - video_mode; |
| 252 | const int colormask = (state->m_video_config & AC_MONITOR_BW) ? 0 : 0x1f0; |
| 253 | int xystep = 2 - state->m_video_mode; |
| 311 | 254 | int y; |
| 312 | 255 | |
| 313 | 256 | /* compute the starting point of sparkle for the current frame */ |
| 314 | 257 | int width = screen->width(); |
| 315 | 258 | int height = screen->height(); |
| 316 | 259 | |
| 317 | | if (astrocade_video_config & AC_STARS) |
| 260 | if (state->m_video_config & AC_STARS) |
| 318 | 261 | sparklebase = (screen->frame_number() * (UINT64)(width * height)) % RNG_PERIOD; |
| 319 | 262 | |
| 320 | 263 | /* iterate over scanlines */ |
| r11160 | r11161 | |
| 327 | 270 | int x; |
| 328 | 271 | |
| 329 | 272 | /* compute the star and sparkle offset at the start of this line */ |
| 330 | | if (astrocade_video_config & AC_STARS) |
| 273 | if (state->m_video_config & AC_STARS) |
| 331 | 274 | { |
| 332 | 275 | staroffs = ((effy < 0) ? (effy + 262) : effy) * width; |
| 333 | 276 | sparkleoffs = sparklebase + y * width; |
| r11160 | r11161 | |
| 339 | 282 | for (x = 0; x < 456/4; x += xystep) |
| 340 | 283 | { |
| 341 | 284 | int effx = x - HORZ_OFFSET/4; |
| 342 | | const UINT8 *colorbase = &colors[(effx < colorsplit) ? 4 : 0]; |
| 285 | const UINT8 *colorbase = &state->m_colors[(effx < state->m_colorsplit) ? 4 : 0]; |
| 343 | 286 | UINT8 data; |
| 344 | 287 | int xx; |
| 345 | 288 | |
| 346 | 289 | /* select either video data or background data */ |
| 347 | | data = (effx >= 0 && effx < 80 && effy >= 0 && effy < vblank) ? videoram[offset++] : bgdata; |
| 290 | data = (effx >= 0 && effx < 80 && effy >= 0 && effy < state->m_vblank) ? videoram[offset++] : state->m_bgdata; |
| 348 | 291 | |
| 349 | 292 | /* iterate over the 4 pixels */ |
| 350 | 293 | for (xx = 0; xx < 4; xx++) |
| r11160 | r11161 | |
| 355 | 298 | rgb_t color; |
| 356 | 299 | |
| 357 | 300 | /* handle stars/sparkle */ |
| 358 | | if (astrocade_video_config & AC_STARS) |
| 301 | if (state->m_video_config & AC_STARS) |
| 359 | 302 | { |
| 360 | 303 | /* if sparkle is enabled for this pixel index and either it is non-zero or a star */ |
| 361 | 304 | /* then adjust the intensity */ |
| 362 | | if (astrocade_sparkle[pixdata] == 0) |
| 305 | if (state->m_sparkle[pixdata] == 0) |
| 363 | 306 | { |
| 364 | | if (pixdata != 0 || (sparklestar[staroffs] & 0x10)) |
| 365 | | luma = sparklestar[sparkleoffs] & 0x0f; |
| 307 | if (pixdata != 0 || (state->m_sparklestar[staroffs] & 0x10)) |
| 308 | luma = state->m_sparklestar[sparkleoffs] & 0x0f; |
| 366 | 309 | else if (pixdata == 0) |
| 367 | 310 | colordata = luma = 0; |
| 368 | 311 | } |
| r11160 | r11161 | |
| 389 | 332 | |
| 390 | 333 | SCREEN_UPDATE( profpac ) |
| 391 | 334 | { |
| 335 | astrocde_state *state = screen->machine().driver_data<astrocde_state>(); |
| 392 | 336 | int y; |
| 393 | 337 | |
| 394 | 338 | /* iterate over scanlines */ |
| r11160 | r11161 | |
| 396 | 340 | { |
| 397 | 341 | int effy = mame_vpos_to_astrocade_vpos(y); |
| 398 | 342 | UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0); |
| 399 | | UINT16 offset = profpac_vispage * 0x4000 + effy * 80; |
| 343 | UINT16 offset = state->m_profpac_vispage * 0x4000 + effy * 80; |
| 400 | 344 | int x; |
| 401 | 345 | |
| 402 | 346 | /* star with black */ |
| r11160 | r11161 | |
| 407 | 351 | int effx = x - HORZ_OFFSET/4; |
| 408 | 352 | |
| 409 | 353 | /* select either video data or background data */ |
| 410 | | UINT16 data = (effx >= 0 && effx < 80 && effy >= 0 && effy < vblank) ? profpac_videoram[offset++] : 0; |
| 354 | UINT16 data = (effx >= 0 && effx < 80 && effy >= 0 && effy < state->m_vblank) ? state->m_profpac_videoram[offset++] : 0; |
| 411 | 355 | |
| 412 | 356 | /* iterate over the 4 pixels */ |
| 413 | | *dest++ = profpac_palette[(data >> 12) & 0x0f]; |
| 414 | | *dest++ = profpac_palette[(data >> 8) & 0x0f]; |
| 415 | | *dest++ = profpac_palette[(data >> 4) & 0x0f]; |
| 416 | | *dest++ = profpac_palette[(data >> 0) & 0x0f]; |
| 357 | *dest++ = state->m_profpac_palette[(data >> 12) & 0x0f]; |
| 358 | *dest++ = state->m_profpac_palette[(data >> 8) & 0x0f]; |
| 359 | *dest++ = state->m_profpac_palette[(data >> 4) & 0x0f]; |
| 360 | *dest++ = state->m_profpac_palette[(data >> 0) & 0x0f]; |
| 417 | 361 | } |
| 418 | 362 | } |
| 419 | 363 | |
| r11160 | r11161 | |
| 436 | 380 | |
| 437 | 381 | static void astrocade_trigger_lightpen(running_machine &machine, UINT8 vfeedback, UINT8 hfeedback) |
| 438 | 382 | { |
| 383 | astrocde_state *state = machine.driver_data<astrocde_state>(); |
| 439 | 384 | /* both bits 1 and 4 enable lightpen interrupts; bit 4 enables them even in horizontal */ |
| 440 | 385 | /* blanking regions; we treat them both the same here */ |
| 441 | | if ((interrupt_enable & 0x12) != 0) |
| 386 | if ((state->m_interrupt_enabl & 0x12) != 0) |
| 442 | 387 | { |
| 443 | 388 | /* bit 0 controls the interrupt mode: mode 0 means assert until acknowledged */ |
| 444 | | if ((interrupt_enable & 0x01) == 0) |
| 389 | if ((state->m_interrupt_enabl & 0x01) == 0) |
| 445 | 390 | { |
| 446 | | cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, interrupt_vector & 0xf0); |
| 391 | cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, state->m_interrupt_vector & 0xf0); |
| 447 | 392 | machine.scheduler().timer_set(machine.primary_screen->time_until_pos(vfeedback), FUNC(interrupt_off)); |
| 448 | 393 | } |
| 449 | 394 | |
| 450 | 395 | /* mode 1 means assert for 1 instruction */ |
| 451 | 396 | else |
| 452 | 397 | { |
| 453 | | cputag_set_input_line_and_vector(machine, "maincpu", 0, ASSERT_LINE, interrupt_vector & 0xf0); |
| 398 | cputag_set_input_line_and_vector(machine, "maincpu", 0, ASSERT_LINE, state->m_interrupt_vector & 0xf0); |
| 454 | 399 | machine.scheduler().timer_set(machine.device<cpu_device>("maincpu")->cycles_to_attotime(1), FUNC(interrupt_off)); |
| 455 | 400 | } |
| 456 | 401 | |
| 457 | 402 | /* latch the feedback registers */ |
| 458 | | vertical_feedback = vfeedback; |
| 459 | | horizontal_feedback = hfeedback; |
| 403 | state->m_vertical_feedback = vfeedback; |
| 404 | state->m_horizontal_feedback = hfeedback; |
| 460 | 405 | } |
| 461 | 406 | } |
| 462 | 407 | |
| r11160 | r11161 | |
| 470 | 415 | |
| 471 | 416 | static TIMER_CALLBACK( scanline_callback ) |
| 472 | 417 | { |
| 418 | astrocde_state *state = machine.driver_data<astrocde_state>(); |
| 473 | 419 | int scanline = param; |
| 474 | 420 | int astrocade_scanline = mame_vpos_to_astrocade_vpos(scanline); |
| 475 | 421 | |
| r11160 | r11161 | |
| 478 | 424 | machine.primary_screen->update_partial(scanline - 1); |
| 479 | 425 | |
| 480 | 426 | /* generate a scanline interrupt if it's time */ |
| 481 | | if (astrocade_scanline == interrupt_scanline && (interrupt_enable & 0x08) != 0) |
| 427 | if (astrocade_scanline == state->m_interrupt_scanline && (state->m_interrupt_enabl & 0x08) != 0) |
| 482 | 428 | { |
| 483 | 429 | /* bit 2 controls the interrupt mode: mode 0 means assert until acknowledged */ |
| 484 | | if ((interrupt_enable & 0x04) == 0) |
| 430 | if ((state->m_interrupt_enabl & 0x04) == 0) |
| 485 | 431 | { |
| 486 | | cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, interrupt_vector); |
| 432 | cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, state->m_interrupt_vector); |
| 487 | 433 | machine.scheduler().timer_set(machine.primary_screen->time_until_vblank_end(), FUNC(interrupt_off)); |
| 488 | 434 | } |
| 489 | 435 | |
| 490 | 436 | /* mode 1 means assert for 1 instruction */ |
| 491 | 437 | else |
| 492 | 438 | { |
| 493 | | cputag_set_input_line_and_vector(machine, "maincpu", 0, ASSERT_LINE, interrupt_vector); |
| 439 | cputag_set_input_line_and_vector(machine, "maincpu", 0, ASSERT_LINE, state->m_interrupt_vector); |
| 494 | 440 | machine.scheduler().timer_set(machine.device<cpu_device>("maincpu")->cycles_to_attotime(1), FUNC(interrupt_off)); |
| 495 | 441 | } |
| 496 | 442 | } |
| 497 | 443 | |
| 498 | 444 | /* on some games, the horizontal drive line is conected to the lightpen interrupt */ |
| 499 | | else if (astrocade_video_config & AC_LIGHTPEN_INTS) |
| 445 | else if (state->m_video_config & AC_LIGHTPEN_INTS) |
| 500 | 446 | astrocade_trigger_lightpen(machine, astrocade_scanline, 8); |
| 501 | 447 | |
| 502 | 448 | /* advance to the next scanline */ |
| 503 | 449 | scanline++; |
| 504 | 450 | if (scanline >= machine.primary_screen->height()) |
| 505 | 451 | scanline = 0; |
| 506 | | scanline_timer->adjust(machine.primary_screen->time_until_pos(scanline), scanline); |
| 452 | state->m_scanline_timer->adjust(machine.primary_screen->time_until_pos(scanline), scanline); |
| 507 | 453 | } |
| 508 | 454 | |
| 509 | 455 | |
| r11160 | r11161 | |
| 516 | 462 | |
| 517 | 463 | READ8_HANDLER( astrocade_data_chip_register_r ) |
| 518 | 464 | { |
| 465 | astrocde_state *state = space->machine().driver_data<astrocde_state>(); |
| 519 | 466 | UINT8 result = 0xff; |
| 520 | 467 | |
| 521 | 468 | /* these are the core registers */ |
| 522 | 469 | switch (offset & 0xff) |
| 523 | 470 | { |
| 524 | 471 | case 0x08: /* intercept feedback */ |
| 525 | | result = funcgen_intercept; |
| 526 | | funcgen_intercept = 0; |
| 472 | result = state->m_funcgen_intercept; |
| 473 | state->m_funcgen_intercept = 0; |
| 527 | 474 | break; |
| 528 | 475 | |
| 529 | 476 | case 0x0e: /* vertical feedback (from lightpen interrupt) */ |
| 530 | | result = vertical_feedback; |
| 477 | result = state->m_vertical_feedback; |
| 531 | 478 | break; |
| 532 | 479 | |
| 533 | 480 | case 0x0f: /* horizontal feedback (from lightpen interrupt) */ |
| 534 | | result = horizontal_feedback; |
| 481 | result = state->m_horizontal_feedback; |
| 535 | 482 | break; |
| 536 | 483 | |
| 537 | 484 | case 0x10: /* player 1 handle */ |
| r11160 | r11161 | |
| 589 | 536 | |
| 590 | 537 | WRITE8_HANDLER( astrocade_data_chip_register_w ) |
| 591 | 538 | { |
| 539 | astrocde_state *state = space->machine().driver_data<astrocde_state>(); |
| 592 | 540 | /* these are the core registers */ |
| 593 | 541 | switch (offset & 0xff) |
| 594 | 542 | { |
| r11160 | r11161 | |
| 600 | 548 | case 0x05: |
| 601 | 549 | case 0x06: |
| 602 | 550 | case 0x07: |
| 603 | | colors[offset & 7] = data; |
| 551 | state->m_colors[offset & 7] = data; |
| 604 | 552 | break; |
| 605 | 553 | |
| 606 | 554 | case 0x08: /* mode register */ |
| 607 | | video_mode = data & 1; |
| 555 | state->m_video_mode = data & 1; |
| 608 | 556 | break; |
| 609 | 557 | |
| 610 | 558 | case 0x09: /* color split pixel */ |
| 611 | | colorsplit = 2 * (data & 0x3f); |
| 612 | | bgdata = ((data & 0xc0) >> 6) * 0x55; |
| 559 | state->m_colorsplit = 2 * (data & 0x3f); |
| 560 | state->m_bgdata = ((data & 0xc0) >> 6) * 0x55; |
| 613 | 561 | break; |
| 614 | 562 | |
| 615 | 563 | case 0x0a: /* vertical blank register */ |
| 616 | | vblank = data; |
| 564 | state->m_vblank = data; |
| 617 | 565 | break; |
| 618 | 566 | |
| 619 | 567 | case 0x0b: /* color block transfer */ |
| 620 | | colors[(offset >> 8) & 7] = data; |
| 568 | state->m_colors[(offset >> 8) & 7] = data; |
| 621 | 569 | break; |
| 622 | 570 | |
| 623 | 571 | case 0x0c: /* function generator */ |
| 624 | | funcgen_control = data; |
| 625 | | funcgen_expand_count = 0; /* reset flip-flop for expand mode on write to this register */ |
| 626 | | funcgen_rotate_count = 0; /* reset counter for rotate mode on write to this register */ |
| 627 | | funcgen_shift_prev_data = 0; /* reset shift buffer on write to this register */ |
| 572 | state->m_funcgen_control = data; |
| 573 | state->m_funcgen_expand_count = 0; /* reset flip-flop for expand mode on write to this register */ |
| 574 | state->m_funcgen_rotate_count = 0; /* reset counter for rotate mode on write to this register */ |
| 575 | state->m_funcgen_shift_prev_data = 0; /* reset shift buffer on write to this register */ |
| 628 | 576 | break; |
| 629 | 577 | |
| 630 | 578 | case 0x0d: /* interrupt feedback */ |
| 631 | | interrupt_vector = data; |
| 579 | state->m_interrupt_vector = data; |
| 632 | 580 | break; |
| 633 | 581 | |
| 634 | 582 | case 0x0e: /* interrupt enable and mode */ |
| 635 | | interrupt_enable = data; |
| 583 | state->m_interrupt_enabl = data; |
| 636 | 584 | break; |
| 637 | 585 | |
| 638 | 586 | case 0x0f: /* interrupt line */ |
| 639 | | interrupt_scanline = data; |
| 587 | state->m_interrupt_scanline = data; |
| 640 | 588 | break; |
| 641 | 589 | |
| 642 | 590 | case 0x10: /* master oscillator register */ |
| r11160 | r11161 | |
| 648 | 596 | case 0x16: /* tone A volume and tone B volume register */ |
| 649 | 597 | case 0x17: /* noise volume register */ |
| 650 | 598 | case 0x18: /* sound block transfer */ |
| 651 | | if (astrocade_video_config & AC_SOUND_PRESENT) |
| 599 | if (state->m_video_config & AC_SOUND_PRESENT) |
| 652 | 600 | astrocade_sound_w(space->machine().device("astrocade1"), offset, data); |
| 653 | 601 | break; |
| 654 | 602 | |
| 655 | 603 | case 0x19: /* expand register */ |
| 656 | | funcgen_expand_color[0] = data & 0x03; |
| 657 | | funcgen_expand_color[1] = (data >> 2) & 0x03; |
| 604 | state->m_funcgen_expand_color[0] = data & 0x03; |
| 605 | state->m_funcgen_expand_color[1] = (data >> 2) & 0x03; |
| 658 | 606 | break; |
| 659 | 607 | } |
| 660 | 608 | } |
| r11160 | r11161 | |
| 669 | 617 | |
| 670 | 618 | WRITE8_HANDLER( astrocade_funcgen_w ) |
| 671 | 619 | { |
| 620 | astrocde_state *state = space->machine().driver_data<astrocde_state>(); |
| 672 | 621 | UINT8 prev_data; |
| 673 | 622 | |
| 674 | 623 | /* control register: |
| r11160 | r11161 | |
| 682 | 631 | */ |
| 683 | 632 | |
| 684 | 633 | /* expansion */ |
| 685 | | if (funcgen_control & 0x08) |
| 634 | if (state->m_funcgen_control & 0x08) |
| 686 | 635 | { |
| 687 | | funcgen_expand_count ^= 1; |
| 688 | | data >>= 4 * funcgen_expand_count; |
| 689 | | data = (funcgen_expand_color[(data >> 3) & 1] << 6) | |
| 690 | | (funcgen_expand_color[(data >> 2) & 1] << 4) | |
| 691 | | (funcgen_expand_color[(data >> 1) & 1] << 2) | |
| 692 | | (funcgen_expand_color[(data >> 0) & 1] << 0); |
| 636 | state->m_funcgen_expand_count ^= 1; |
| 637 | data >>= 4 * state->m_funcgen_expand_count; |
| 638 | data = (state->m_funcgen_expand_color[(data >> 3) & 1] << 6) | |
| 639 | (state->m_funcgen_expand_color[(data >> 2) & 1] << 4) | |
| 640 | (state->m_funcgen_expand_color[(data >> 1) & 1] << 2) | |
| 641 | (state->m_funcgen_expand_color[(data >> 0) & 1] << 0); |
| 693 | 642 | } |
| 694 | | prev_data = funcgen_shift_prev_data; |
| 695 | | funcgen_shift_prev_data = data; |
| 643 | prev_data = state->m_funcgen_shift_prev_data; |
| 644 | state->m_funcgen_shift_prev_data = data; |
| 696 | 645 | |
| 697 | 646 | /* rotate or shift */ |
| 698 | | if (funcgen_control & 0x04) |
| 647 | if (state->m_funcgen_control & 0x04) |
| 699 | 648 | { |
| 700 | 649 | /* rotate */ |
| 701 | 650 | |
| 702 | 651 | /* first 4 writes accumulate data for the rotate */ |
| 703 | | if ((funcgen_rotate_count & 4) == 0) |
| 652 | if ((state->m_funcgen_rotate_count & 4) == 0) |
| 704 | 653 | { |
| 705 | | funcgen_rotate_data[funcgen_rotate_count++ & 3] = data; |
| 654 | state->m_funcgen_rotate_data[state->m_funcgen_rotate_count++ & 3] = data; |
| 706 | 655 | return; |
| 707 | 656 | } |
| 708 | 657 | |
| 709 | 658 | /* second 4 writes actually write it */ |
| 710 | 659 | else |
| 711 | 660 | { |
| 712 | | UINT8 shift = 2 * (~funcgen_rotate_count++ & 3); |
| 713 | | data = (((funcgen_rotate_data[3] >> shift) & 3) << 6) | |
| 714 | | (((funcgen_rotate_data[2] >> shift) & 3) << 4) | |
| 715 | | (((funcgen_rotate_data[1] >> shift) & 3) << 2) | |
| 716 | | (((funcgen_rotate_data[0] >> shift) & 3) << 0); |
| 661 | UINT8 shift = 2 * (~state->m_funcgen_rotate_count++ & 3); |
| 662 | data = (((state->m_funcgen_rotate_data[3] >> shift) & 3) << 6) | |
| 663 | (((state->m_funcgen_rotate_data[2] >> shift) & 3) << 4) | |
| 664 | (((state->m_funcgen_rotate_data[1] >> shift) & 3) << 2) | |
| 665 | (((state->m_funcgen_rotate_data[0] >> shift) & 3) << 0); |
| 717 | 666 | } |
| 718 | 667 | } |
| 719 | 668 | else |
| 720 | 669 | { |
| 721 | 670 | /* shift */ |
| 722 | | UINT8 shift = 2 * (funcgen_control & 0x03); |
| 671 | UINT8 shift = 2 * (state->m_funcgen_control & 0x03); |
| 723 | 672 | data = (data >> shift) | (prev_data << (8 - shift)); |
| 724 | 673 | } |
| 725 | 674 | |
| 726 | 675 | /* flopping */ |
| 727 | | if (funcgen_control & 0x40) |
| 676 | if (state->m_funcgen_control & 0x40) |
| 728 | 677 | data = (data >> 6) | ((data >> 2) & 0x0c) | ((data << 2) & 0x30) | (data << 6); |
| 729 | 678 | |
| 730 | 679 | /* OR/XOR */ |
| 731 | | if (funcgen_control & 0x30) |
| 680 | if (state->m_funcgen_control & 0x30) |
| 732 | 681 | { |
| 733 | 682 | UINT8 olddata = space->read_byte(0x4000 + offset); |
| 734 | 683 | |
| 735 | 684 | /* compute any intercepts */ |
| 736 | | funcgen_intercept &= 0x0f; |
| 685 | state->m_funcgen_intercept &= 0x0f; |
| 737 | 686 | if ((olddata & 0xc0) && (data & 0xc0)) |
| 738 | | funcgen_intercept |= 0x11; |
| 687 | state->m_funcgen_intercept |= 0x11; |
| 739 | 688 | if ((olddata & 0x30) && (data & 0x30)) |
| 740 | | funcgen_intercept |= 0x22; |
| 689 | state->m_funcgen_intercept |= 0x22; |
| 741 | 690 | if ((olddata & 0x0c) && (data & 0x0c)) |
| 742 | | funcgen_intercept |= 0x44; |
| 691 | state->m_funcgen_intercept |= 0x44; |
| 743 | 692 | if ((olddata & 0x03) && (data & 0x03)) |
| 744 | | funcgen_intercept |= 0x88; |
| 693 | state->m_funcgen_intercept |= 0x88; |
| 745 | 694 | |
| 746 | 695 | /* apply the operation */ |
| 747 | | if (funcgen_control & 0x10) |
| 696 | if (state->m_funcgen_control & 0x10) |
| 748 | 697 | data |= olddata; |
| 749 | | else if (funcgen_control & 0x20) |
| 698 | else if (state->m_funcgen_control & 0x20) |
| 750 | 699 | data ^= olddata; |
| 751 | 700 | } |
| 752 | 701 | |
| r11160 | r11161 | |
| 762 | 711 | * |
| 763 | 712 | *************************************/ |
| 764 | 713 | |
| 765 | | INLINE void increment_source(UINT8 curwidth, UINT8 *u13ff) |
| 714 | INLINE void increment_source(astrocde_state *state, UINT8 curwidth, UINT8 *u13ff) |
| 766 | 715 | { |
| 767 | 716 | /* if the flip-flop at U13 is high and mode.d2 is 1 we can increment */ |
| 768 | 717 | /* however, if mode.d3 is set and we're on the last byte of a row, the increment is suppressed */ |
| 769 | | if (*u13ff && (pattern_mode & 0x04) != 0 && (curwidth != 0 || (pattern_mode & 0x08) == 0)) |
| 770 | | pattern_source++; |
| 718 | if (*u13ff && (state->m_pattern_mode & 0x04) != 0 && (curwidth != 0 || (state->m_pattern_mode & 0x08) == 0)) |
| 719 | state->m_pattern_source++; |
| 771 | 720 | |
| 772 | 721 | /* if mode.d1 is 1, toggle the flip-flop; otherwise leave it preset */ |
| 773 | | if ((pattern_mode & 0x02) != 0) |
| 722 | if ((state->m_pattern_mode & 0x02) != 0) |
| 774 | 723 | *u13ff ^= 1; |
| 775 | 724 | } |
| 776 | 725 | |
| 777 | 726 | |
| 778 | | INLINE void increment_dest(UINT8 curwidth) |
| 727 | INLINE void increment_dest(astrocde_state *state, UINT8 curwidth) |
| 779 | 728 | { |
| 780 | 729 | /* increment is suppressed for the last byte in a row */ |
| 781 | 730 | if (curwidth != 0) |
| 782 | 731 | { |
| 783 | 732 | /* if mode.d5 is 1, we increment */ |
| 784 | | if ((pattern_mode & 0x20) != 0) |
| 785 | | pattern_dest++; |
| 733 | if ((state->m_pattern_mode & 0x20) != 0) |
| 734 | state->m_pattern_dest++; |
| 786 | 735 | |
| 787 | 736 | /* otherwise, we decrement */ |
| 788 | 737 | else |
| 789 | | pattern_dest--; |
| 738 | state->m_pattern_dest--; |
| 790 | 739 | } |
| 791 | 740 | } |
| 792 | 741 | |
| 793 | 742 | |
| 794 | 743 | static void execute_blit(address_space *space) |
| 795 | 744 | { |
| 745 | astrocde_state *state = space->machine().driver_data<astrocde_state>(); |
| 796 | 746 | /* |
| 797 | | pattern_source = counter set U7/U16/U25/U34 |
| 798 | | pattern_dest = counter set U9/U18/U30/U39 |
| 799 | | pattern_mode = latch U21 |
| 800 | | pattern_skip = latch set U30/U39 |
| 801 | | pattern_width = latch set U32/U41 |
| 802 | | pattern_height = counter set U31/U40 |
| 747 | state->m_pattern_source = counter set U7/U16/U25/U34 |
| 748 | state->m_pattern_dest = counter set U9/U18/U30/U39 |
| 749 | state->m_pattern_mode = latch U21 |
| 750 | state->m_pattern_skip = latch set U30/U39 |
| 751 | state->m_pattern_width = latch set U32/U41 |
| 752 | state->m_pattern_height = counter set U31/U40 |
| 803 | 753 | |
| 804 | | pattern_mode bits: |
| 754 | state->m_pattern_mode bits: |
| 805 | 755 | d0 = direction (0 = read from src, write to dest, 1 = read from dest, write to src) |
| 806 | 756 | d1 = expand (0 = increment src each pixel, 1 = increment src every other pixel) |
| 807 | 757 | d2 = constant (0 = never increment src, 1 = normal src increment) |
| r11160 | r11161 | |
| 815 | 765 | int cycles = 0; |
| 816 | 766 | |
| 817 | 767 | /* logerror("Blit: src=%04X mode=%02X dest=%04X skip=%02X width=%02X height=%02X\n", |
| 818 | | pattern_source, pattern_mode, pattern_dest, pattern_skip, pattern_width, pattern_height);*/ |
| 768 | state->m_pattern_source, state->m_pattern_mode, state->m_pattern_dest, state->m_pattern_skip, state->m_pattern_width, state->m_pattern_height);*/ |
| 819 | 769 | |
| 820 | 770 | /* flip-flop at U13 is cleared at the beginning */ |
| 821 | 771 | u13ff = 0; |
| 822 | 772 | |
| 823 | 773 | /* it is also forced preset if mode.d1 == 0 */ |
| 824 | | if ((pattern_mode & 0x02) == 0) |
| 774 | if ((state->m_pattern_mode & 0x02) == 0) |
| 825 | 775 | u13ff = 1; |
| 826 | 776 | |
| 827 | 777 | /* loop over height */ |
| r11160 | r11161 | |
| 830 | 780 | UINT16 carry; |
| 831 | 781 | |
| 832 | 782 | /* loop over width */ |
| 833 | | curwidth = pattern_width; |
| 783 | curwidth = state->m_pattern_width; |
| 834 | 784 | do |
| 835 | 785 | { |
| 836 | 786 | UINT16 busaddr; |
| r11160 | r11161 | |
| 839 | 789 | /* ----- read phase ----- */ |
| 840 | 790 | |
| 841 | 791 | /* address is selected between source/dest based on mode.d0 */ |
| 842 | | busaddr = ((pattern_mode & 0x01) == 0) ? pattern_source : pattern_dest; |
| 792 | busaddr = ((state->m_pattern_mode & 0x01) == 0) ? state->m_pattern_source : state->m_pattern_dest; |
| 843 | 793 | |
| 844 | 794 | /* if mode.d3 is set, then the last byte fetched per row is forced to 0 */ |
| 845 | | if (curwidth == 0 && (pattern_mode & 0x08) != 0) |
| 795 | if (curwidth == 0 && (state->m_pattern_mode & 0x08) != 0) |
| 846 | 796 | busdata = 0; |
| 847 | 797 | else |
| 848 | 798 | busdata = space->read_byte(busaddr); |
| 849 | 799 | |
| 850 | 800 | /* increment the appropriate address */ |
| 851 | | if ((pattern_mode & 0x01) == 0) |
| 852 | | increment_source(curwidth, &u13ff); |
| 801 | if ((state->m_pattern_mode & 0x01) == 0) |
| 802 | increment_source(state, curwidth, &u13ff); |
| 853 | 803 | else |
| 854 | | increment_dest(curwidth); |
| 804 | increment_dest(state, curwidth); |
| 855 | 805 | |
| 856 | 806 | /* ----- write phase ----- */ |
| 857 | 807 | |
| 858 | 808 | /* address is selected between source/dest based on mode.d0 */ |
| 859 | | busaddr = ((pattern_mode & 0x01) != 0) ? pattern_source : pattern_dest; |
| 809 | busaddr = ((state->m_pattern_mode & 0x01) != 0) ? state->m_pattern_source : state->m_pattern_dest; |
| 860 | 810 | space->write_byte(busaddr, busdata); |
| 861 | 811 | |
| 862 | 812 | /* increment the appropriate address */ |
| 863 | | if ((pattern_mode & 0x01) == 0) |
| 864 | | increment_dest(curwidth); |
| 813 | if ((state->m_pattern_mode & 0x01) == 0) |
| 814 | increment_dest(state, curwidth); |
| 865 | 815 | else |
| 866 | | increment_source(curwidth, &u13ff); |
| 816 | increment_source(state, curwidth, &u13ff); |
| 867 | 817 | |
| 868 | 818 | /* count 4 cycles (two read, two write) */ |
| 869 | 819 | cycles += 4; |
| r11160 | r11161 | |
| 871 | 821 | } while (curwidth-- != 0); |
| 872 | 822 | |
| 873 | 823 | /* at the end of each row, the skip value is added to the dest value */ |
| 874 | | carry = ((pattern_dest & 0xff) + pattern_skip) & 0x100; |
| 875 | | pattern_dest = (pattern_dest & 0xff00) | ((pattern_dest + pattern_skip) & 0xff); |
| 824 | carry = ((state->m_pattern_dest & 0xff) + state->m_pattern_skip) & 0x100; |
| 825 | state->m_pattern_dest = (state->m_pattern_dest & 0xff00) | ((state->m_pattern_dest + state->m_pattern_skip) & 0xff); |
| 876 | 826 | |
| 877 | 827 | /* carry behavior into the top byte is controlled by mode.d4 */ |
| 878 | | if ((pattern_mode & 0x10) == 0) |
| 879 | | pattern_dest += carry; |
| 828 | if ((state->m_pattern_mode & 0x10) == 0) |
| 829 | state->m_pattern_dest += carry; |
| 880 | 830 | else |
| 881 | | pattern_dest -= carry ^ 0x100; |
| 831 | state->m_pattern_dest -= carry ^ 0x100; |
| 882 | 832 | |
| 883 | | } while (pattern_height-- != 0); |
| 833 | } while (state->m_pattern_height-- != 0); |
| 884 | 834 | |
| 885 | 835 | /* count cycles we ran the bus */ |
| 886 | 836 | device_adjust_icount(&space->device(), -cycles); |
| r11160 | r11161 | |
| 889 | 839 | |
| 890 | 840 | WRITE8_HANDLER( astrocade_pattern_board_w ) |
| 891 | 841 | { |
| 842 | astrocde_state *state = space->machine().driver_data<astrocde_state>(); |
| 892 | 843 | switch (offset) |
| 893 | 844 | { |
| 894 | 845 | case 0: /* source offset low 8 bits */ |
| 895 | | pattern_source = (pattern_source & 0xff00) | (data << 0); |
| 846 | state->m_pattern_source = (state->m_pattern_source & 0xff00) | (data << 0); |
| 896 | 847 | break; |
| 897 | 848 | |
| 898 | 849 | case 1: /* source offset upper 8 bits */ |
| 899 | | pattern_source = (pattern_source & 0x00ff) | (data << 8); |
| 850 | state->m_pattern_source = (state->m_pattern_source & 0x00ff) | (data << 8); |
| 900 | 851 | break; |
| 901 | 852 | |
| 902 | 853 | case 2: /* mode control; also clears low byte of dest */ |
| 903 | | pattern_mode = data & 0x3f; |
| 904 | | pattern_dest &= 0xff00; |
| 854 | state->m_pattern_mode = data & 0x3f; |
| 855 | state->m_pattern_dest &= 0xff00; |
| 905 | 856 | break; |
| 906 | 857 | |
| 907 | 858 | case 3: /* skip value */ |
| 908 | | pattern_skip = data; |
| 859 | state->m_pattern_skip = data; |
| 909 | 860 | break; |
| 910 | 861 | |
| 911 | 862 | case 4: /* dest offset upper 8 bits; also adds skip to low 8 bits */ |
| 912 | | pattern_dest = ((pattern_dest + pattern_skip) & 0xff) | (data << 8); |
| 863 | state->m_pattern_dest = ((state->m_pattern_dest + state->m_pattern_skip) & 0xff) | (data << 8); |
| 913 | 864 | break; |
| 914 | 865 | |
| 915 | 866 | case 5: /* width of blit */ |
| 916 | | pattern_width = data; |
| 867 | state->m_pattern_width = data; |
| 917 | 868 | break; |
| 918 | 869 | |
| 919 | 870 | case 6: /* height of blit and initiator */ |
| 920 | | pattern_height = data; |
| 871 | state->m_pattern_height = data; |
| 921 | 872 | execute_blit(space->device().memory().space(AS_PROGRAM)); |
| 922 | 873 | break; |
| 923 | 874 | } |
| r11160 | r11161 | |
| 962 | 913 | |
| 963 | 914 | static void init_sparklestar(running_machine &machine) |
| 964 | 915 | { |
| 916 | astrocde_state *state = machine.driver_data<astrocde_state>(); |
| 965 | 917 | UINT32 shiftreg; |
| 966 | 918 | int i; |
| 967 | 919 | |
| 968 | 920 | /* reset global sparkle state */ |
| 969 | | astrocade_sparkle[0] = astrocade_sparkle[1] = astrocade_sparkle[2] = astrocade_sparkle[3] = 0; |
| 921 | state->m_sparkle[0] = state->m_sparkle[1] = state->m_sparkle[2] = state->m_sparkle[3] = 0; |
| 970 | 922 | |
| 971 | 923 | /* allocate memory for the sparkle/star array */ |
| 972 | | sparklestar = auto_alloc_array(machine, UINT8, RNG_PERIOD); |
| 924 | state->m_sparklestar = auto_alloc_array(machine, UINT8, RNG_PERIOD); |
| 973 | 925 | |
| 974 | 926 | /* generate the data for the sparkle/star array */ |
| 975 | 927 | for (shiftreg = i = 0; i < RNG_PERIOD; i++) |
| r11160 | r11161 | |
| 982 | 934 | |
| 983 | 935 | /* extract the sparkle/star intensity here */ |
| 984 | 936 | /* this is controlled by the shift register at U17/U19/U18 */ |
| 985 | | sparklestar[i] = (((shiftreg >> 4) & 1) << 3) | |
| 937 | state->m_sparklestar[i] = (((shiftreg >> 4) & 1) << 3) | |
| 986 | 938 | (((shiftreg >> 12) & 1) << 2) | |
| 987 | 939 | (((shiftreg >> 16) & 1) << 1) | |
| 988 | 940 | (((shiftreg >> 8) & 1) << 0); |
| r11160 | r11161 | |
| 990 | 942 | /* determine the star enable here */ |
| 991 | 943 | /* this is controlled by the shift register at U17/U12/U11 */ |
| 992 | 944 | if ((shiftreg & 0xff) == 0xfe) |
| 993 | | sparklestar[i] |= 0x10; |
| 945 | state->m_sparklestar[i] |= 0x10; |
| 994 | 946 | } |
| 995 | 947 | } |
| 996 | 948 | |
| r11160 | r11161 | |
| 1004 | 956 | |
| 1005 | 957 | WRITE8_HANDLER( profpac_page_select_w ) |
| 1006 | 958 | { |
| 1007 | | profpac_readpage = data & 3; |
| 1008 | | profpac_writepage = (data >> 2) & 3; |
| 1009 | | profpac_vispage = (data >> 4) & 3; |
| 959 | astrocde_state *state = space->machine().driver_data<astrocde_state>(); |
| 960 | state->m_profpac_readpage = data & 3; |
| 961 | state->m_profpac_writepage = (data >> 2) & 3; |
| 962 | state->m_profpac_vispage = (data >> 4) & 3; |
| 1010 | 963 | } |
| 1011 | 964 | |
| 1012 | 965 | |
| 1013 | 966 | READ8_HANDLER( profpac_intercept_r ) |
| 1014 | 967 | { |
| 1015 | | return profpac_intercept; |
| 968 | astrocde_state *state = space->machine().driver_data<astrocde_state>(); |
| 969 | return state->m_profpac_intercept; |
| 1016 | 970 | } |
| 1017 | 971 | |
| 1018 | 972 | |
| 1019 | 973 | WRITE8_HANDLER( profpac_screenram_ctrl_w ) |
| 1020 | 974 | { |
| 975 | astrocde_state *state = space->machine().driver_data<astrocde_state>(); |
| 1021 | 976 | switch (offset) |
| 1022 | 977 | { |
| 1023 | 978 | case 0: /* port 0xC0 - red component */ |
| 1024 | | profpac_palette[data >> 4] = (profpac_palette[data >> 4] & ~0xf00) | ((data & 0x0f) << 8); |
| 979 | state->m_profpac_palette[data >> 4] = (state->m_profpac_palette[data >> 4] & ~0xf00) | ((data & 0x0f) << 8); |
| 1025 | 980 | break; |
| 1026 | 981 | |
| 1027 | 982 | case 1: /* port 0xC1 - green component */ |
| 1028 | | profpac_palette[data >> 4] = (profpac_palette[data >> 4] & ~0x0f0) | ((data & 0x0f) << 4); |
| 983 | state->m_profpac_palette[data >> 4] = (state->m_profpac_palette[data >> 4] & ~0x0f0) | ((data & 0x0f) << 4); |
| 1029 | 984 | break; |
| 1030 | 985 | |
| 1031 | 986 | case 2: /* port 0xC2 - blue component */ |
| 1032 | | profpac_palette[data >> 4] = (profpac_palette[data >> 4] & ~0x00f) | ((data & 0x0f) << 0); |
| 987 | state->m_profpac_palette[data >> 4] = (state->m_profpac_palette[data >> 4] & ~0x00f) | ((data & 0x0f) << 0); |
| 1033 | 988 | break; |
| 1034 | 989 | |
| 1035 | 990 | case 3: /* port 0xC3 - set 2bpp to 4bpp mapping and clear intercepts */ |
| 1036 | | profpac_colormap[(data >> 4) & 3] = data & 0x0f; |
| 1037 | | profpac_intercept = 0x00; |
| 991 | state->m_profpac_colormap[(data >> 4) & 3] = data & 0x0f; |
| 992 | state->m_profpac_intercept = 0x00; |
| 1038 | 993 | break; |
| 1039 | 994 | |
| 1040 | 995 | case 4: /* port 0xC4 - which half to read on a memory access */ |
| 1041 | | profpac_vw = data & 0x0f; /* refresh write enable lines TBD */ |
| 1042 | | profpac_readshift = 2 * ((data >> 4) & 1); |
| 996 | state->m_profpac_vw = data & 0x0f; /* refresh write enable lines TBD */ |
| 997 | state->m_profpac_readshift = 2 * ((data >> 4) & 1); |
| 1043 | 998 | break; |
| 1044 | 999 | |
| 1045 | 1000 | case 5: /* port 0xC5 - write enable and write mode */ |
| 1046 | | profpac_writemask = ((data & 0x0f) << 12) | ((data & 0x0f) << 8) | ((data & 0x0f) << 4) | ((data & 0x0f) << 0); |
| 1047 | | profpac_writemode = (data >> 4) & 0x03; |
| 1001 | state->m_profpac_writemask = ((data & 0x0f) << 12) | ((data & 0x0f) << 8) | ((data & 0x0f) << 4) | ((data & 0x0f) << 0); |
| 1002 | state->m_profpac_writemode = (data >> 4) & 0x03; |
| 1048 | 1003 | break; |
| 1049 | 1004 | } |
| 1050 | 1005 | } |
| r11160 | r11161 | |
| 1059 | 1014 | |
| 1060 | 1015 | READ8_HANDLER( profpac_videoram_r ) |
| 1061 | 1016 | { |
| 1062 | | UINT16 temp = profpac_videoram[profpac_readpage * 0x4000 + offset] >> profpac_readshift; |
| 1017 | astrocde_state *state = space->machine().driver_data<astrocde_state>(); |
| 1018 | UINT16 temp = state->m_profpac_videoram[state->m_profpac_readpage * 0x4000 + offset] >> state->m_profpac_readshift; |
| 1063 | 1019 | return ((temp >> 6) & 0xc0) | ((temp >> 4) & 0x30) | ((temp >> 2) & 0x0c) | ((temp >> 0) & 0x03); |
| 1064 | 1020 | } |
| 1065 | 1021 | |
| r11160 | r11161 | |
| 1067 | 1023 | /* All this information comes from decoding the PLA at U39 on the screen ram board */ |
| 1068 | 1024 | WRITE8_HANDLER( profpac_videoram_w ) |
| 1069 | 1025 | { |
| 1070 | | UINT16 oldbits = profpac_videoram[profpac_writepage * 0x4000 + offset]; |
| 1026 | astrocde_state *state = space->machine().driver_data<astrocde_state>(); |
| 1027 | UINT16 oldbits = state->m_profpac_videoram[state->m_profpac_writepage * 0x4000 + offset]; |
| 1071 | 1028 | UINT16 newbits, result = 0; |
| 1072 | 1029 | |
| 1073 | 1030 | /* apply the 2->4 bit expansion first */ |
| 1074 | | newbits = (profpac_colormap[(data >> 6) & 3] << 12) | |
| 1075 | | (profpac_colormap[(data >> 4) & 3] << 8) | |
| 1076 | | (profpac_colormap[(data >> 2) & 3] << 4) | |
| 1077 | | (profpac_colormap[(data >> 0) & 3] << 0); |
| 1031 | newbits = (state->m_profpac_colormap[(data >> 6) & 3] << 12) | |
| 1032 | (state->m_profpac_colormap[(data >> 4) & 3] << 8) | |
| 1033 | (state->m_profpac_colormap[(data >> 2) & 3] << 4) | |
| 1034 | (state->m_profpac_colormap[(data >> 0) & 3] << 0); |
| 1078 | 1035 | |
| 1079 | 1036 | /* there are 4 write modes: overwrite, xor, overlay, or underlay */ |
| 1080 | | switch (profpac_writemode) |
| 1037 | switch (state->m_profpac_writemode) |
| 1081 | 1038 | { |
| 1082 | 1039 | case 0: /* normal write */ |
| 1083 | 1040 | result = newbits; |
| r11160 | r11161 | |
| 1103 | 1060 | } |
| 1104 | 1061 | |
| 1105 | 1062 | /* apply the write mask and store */ |
| 1106 | | result = (result & profpac_writemask) | (oldbits & ~profpac_writemask); |
| 1107 | | profpac_videoram[profpac_writepage * 0x4000 + offset] = result; |
| 1063 | result = (result & state->m_profpac_writemask) | (oldbits & ~state->m_profpac_writemask); |
| 1064 | state->m_profpac_videoram[state->m_profpac_writepage * 0x4000 + offset] = result; |
| 1108 | 1065 | |
| 1109 | 1066 | /* Intercept (collision) stuff */ |
| 1110 | 1067 | |
| r11160 | r11161 | |
| 1117 | 1074 | ((oldbits & 0x00f0) == 0x0030 && (newbits & 0x00c0) == 0x0040) || |
| 1118 | 1075 | ((oldbits & 0x000f) == 0x0002 && (newbits & 0x0008) == 0x0008) || |
| 1119 | 1076 | ((oldbits & 0x000f) == 0x0003 && (newbits & 0x000c) == 0x0004)) |
| 1120 | | profpac_intercept |= 0x01; |
| 1077 | state->m_profpac_intercept |= 0x01; |
| 1121 | 1078 | |
| 1122 | 1079 | if (((newbits & 0xf000) != 0x0000 && (oldbits & 0xc000) == 0x4000) || |
| 1123 | 1080 | ((newbits & 0x0f00) != 0x0000 && (oldbits & 0x0c00) == 0x0400) || |
| 1124 | 1081 | ((newbits & 0x00f0) != 0x0000 && (oldbits & 0x00c0) == 0x0040) || |
| 1125 | 1082 | ((newbits & 0x000f) != 0x0000 && (oldbits & 0x000c) == 0x0004)) |
| 1126 | | profpac_intercept |= 0x02; |
| 1083 | state->m_profpac_intercept |= 0x02; |
| 1127 | 1084 | |
| 1128 | 1085 | if (((newbits & 0xf000) != 0x0000 && (oldbits & 0x8000) == 0x8000) || |
| 1129 | 1086 | ((newbits & 0x0f00) != 0x0000 && (oldbits & 0x0800) == 0x0800) || |
| 1130 | 1087 | ((newbits & 0x00f0) != 0x0000 && (oldbits & 0x0080) == 0x0080) || |
| 1131 | 1088 | ((newbits & 0x000f) != 0x0000 && (oldbits & 0x0008) == 0x0008)) |
| 1132 | | profpac_intercept |= 0x04; |
| 1089 | state->m_profpac_intercept |= 0x04; |
| 1133 | 1090 | } |
src/mame/video/taito_f3.c
| r11160 | r11161 | |
| 257 | 257 | { PBOBBLE4, 0, 1 }, |
| 258 | 258 | { POPNPOP, 1, 1 }, |
| 259 | 259 | { LANDMAKR, 1, 1 }, |
| 260 | { TMDRILL, 1, 0 }, |
| 260 | 261 | {0} |
| 261 | 262 | }; |
| 262 | 263 | |
| r11160 | r11161 | |
| 270 | 271 | int pri; |
| 271 | 272 | }; |
| 272 | 273 | |
| 273 | | static void get_sprite_info(running_machine &machine, const UINT32 *spriteram32_ptr); |
| 274 | static void get_sprite_info(running_machine &machine, const UINT16 *spriteram16_ptr); |
| 274 | 275 | |
| 275 | 276 | struct f3_playfield_line_inf |
| 276 | 277 | { |
| r11160 | r11161 | |
| 328 | 329 | static void print_debug_info(running_machine &machine, bitmap_t *bitmap) |
| 329 | 330 | { |
| 330 | 331 | taito_f3_state *state = machine.driver_data<taito_f3_state>(); |
| 331 | | UINT32 *f3_line_ram = state->m_f3_line_ram; |
| 332 | UINT16 *f3_line_ram = state->m_f3_line_ram; |
| 332 | 333 | int l[16]; |
| 333 | 334 | char buf[64*16]; |
| 334 | 335 | char *bufptr = buf; |
| 335 | 336 | |
| 336 | | bufptr += sprintf(bufptr,"%04X %04X %04X %04X\n",state->m_f3_control_0[0]>>22,(state->m_f3_control_0[0]&0xffff)>>6,state->m_f3_control_0[1]>>22,(state->m_f3_control_0[1]&0xffff)>>6); |
| 337 | | bufptr += sprintf(bufptr,"%04X %04X %04X %04X\n",state->m_f3_control_0[2]>>23,(state->m_f3_control_0[2]&0xffff)>>7,state->m_f3_control_0[3]>>23,(state->m_f3_control_0[3]&0xffff)>>7); |
| 338 | | bufptr += sprintf(bufptr,"%04X %04X %04X %04X\n",state->m_f3_control_1[0]>>16,state->m_f3_control_1[0]&0xffff,state->m_f3_control_1[1]>>16,state->m_f3_control_1[1]&0xffff); |
| 339 | | bufptr += sprintf(bufptr,"%04X %04X %04X %04X\n",state->m_f3_control_1[2]>>16,state->m_f3_control_1[2]&0xffff,state->m_f3_control_1[3]>>16,state->m_f3_control_1[3]&0xffff); |
| 337 | bufptr += sprintf(bufptr,"%04X %04X %04X %04X\n",state->m_f3_control_0[0]>>6,state->m_f3_control_0[1]>>6,state->m_f3_control_0[2]>>6,state->m_f3_control_0[3]>>6); |
| 338 | bufptr += sprintf(bufptr,"%04X %04X %04X %04X\n",state->m_f3_control_0[4]>>7,state->m_f3_control_0[5]>>7,state->m_f3_control_0[6]>>7,state->m_f3_control_0[7]>>7); |
| 339 | bufptr += sprintf(bufptr,"%04X %04X %04X %04X\n",state->m_f3_control_1[0],state->m_f3_control_1[1],state->m_f3_control_1[2],state->m_f3_control_1[3]); |
| 340 | bufptr += sprintf(bufptr,"%04X %04X %04X %04X\n",state->m_f3_control_1[4],state->m_f3_control_1[5],state->m_f3_control_1[6],state->m_f3_control_1[7]); |
| 340 | 341 | |
| 341 | | bufptr += sprintf(bufptr,"%04X %04X %04X %04X %04X %04X %04X %04X\n",state->m_spriteram32_buffered[0]>>16,state->m_spriteram32_buffered[0]&0xffff,state->m_spriteram32_buffered[1]>>16,state->m_spriteram32_buffered[1]&0xffff,state->m_spriteram32_buffered[2]>>16,state->m_spriteram32_buffered[2]&0xffff,state->m_spriteram32_buffered[3]>>16,state->m_spriteram32_buffered[3]&0xffff); |
| 342 | | bufptr += sprintf(bufptr,"%04X %04X %04X %04X %04X %04X %04X %04X\n",state->m_spriteram32_buffered[4]>>16,state->m_spriteram32_buffered[4]&0xffff,state->m_spriteram32_buffered[5]>>16,state->m_spriteram32_buffered[5]&0xffff,state->m_spriteram32_buffered[6]>>16,state->m_spriteram32_buffered[6]&0xffff,state->m_spriteram32_buffered[7]>>16,state->m_spriteram32_buffered[7]&0xffff); |
| 343 | | bufptr += sprintf(bufptr,"%04X %04X %04X %04X %04X %04X %04X %04X\n",state->m_spriteram32_buffered[8]>>16,state->m_spriteram32_buffered[8]&0xffff,state->m_spriteram32_buffered[9]>>16,state->m_spriteram32_buffered[9]&0xffff,state->m_spriteram32_buffered[10]>>16,state->m_spriteram32_buffered[10]&0xffff,state->m_spriteram32_buffered[11]>>16,state->m_spriteram32_buffered[11]&0xffff); |
| 342 | bufptr += sprintf(bufptr,"%04X %04X %04X %04X %04X %04X %04X %04X\n",state->m_spriteram16_buffered[0],state->m_spriteram16_buffered[1],state->m_spriteram16_buffered[2],state->m_spriteram16_buffered[3],state->m_spriteram16_buffered[4],state->m_spriteram16_buffered[5],state->m_spriteram16_buffered[6],state->m_spriteram16_buffered[7]); |
| 343 | bufptr += sprintf(bufptr,"%04X %04X %04X %04X %04X %04X %04X %04X\n",state->m_spriteram16_buffered[8],state->m_spriteram16_buffered[9],state->m_spriteram16_buffered[10],state->m_spriteram16_buffered[11],state->m_spriteram16_buffered[12],state->m_spriteram16_buffered[13],state->m_spriteram16_buffered[14],state->m_spriteram16_buffered[15]); |
| 344 | bufptr += sprintf(bufptr,"%04X %04X %04X %04X %04X %04X %04X %04X\n",state->m_spriteram16_buffered[16],state->m_spriteram16_buffered[17],state->m_spriteram16_buffered[18],state->m_spriteram16_buffered[19],state->m_spriteram16_buffered[20],state->m_spriteram16_buffered[21],state->m_spriteram16_buffered[22],state->m_spriteram16_buffered[23]); |
| 344 | 345 | |
| 345 | | l[0]=f3_line_ram[0x0040]&0xffff; |
| 346 | | l[1]=f3_line_ram[0x00c0]&0xffff; |
| 347 | | l[2]=f3_line_ram[0x0140]&0xffff; |
| 348 | | l[3]=f3_line_ram[0x01c0]&0xffff; |
| 346 | l[0]=f3_line_ram[0x0040*2]&0xffff; |
| 347 | l[1]=f3_line_ram[0x00c0*2]&0xffff; |
| 348 | l[2]=f3_line_ram[0x0140*2]&0xffff; |
| 349 | l[3]=f3_line_ram[0x01c0*2]&0xffff; |
| 349 | 350 | bufptr += sprintf(bufptr,"Ctr1: %04x %04x %04x %04x\n",l[0],l[1],l[2],l[3]); |
| 350 | 351 | |
| 351 | | l[0]=f3_line_ram[0x0240]&0xffff; |
| 352 | | l[1]=f3_line_ram[0x02c0]&0xffff; |
| 353 | | l[2]=f3_line_ram[0x0340]&0xffff; |
| 354 | | l[3]=f3_line_ram[0x03c0]&0xffff; |
| 352 | l[0]=f3_line_ram[0x0240*2]&0xffff; |
| 353 | l[1]=f3_line_ram[0x02c0*2]&0xffff; |
| 354 | l[2]=f3_line_ram[0x0340*2]&0xffff; |
| 355 | l[3]=f3_line_ram[0x03c0*2]&0xffff; |
| 355 | 356 | bufptr += sprintf(bufptr,"Ctr2: %04x %04x %04x %04x\n",l[0],l[1],l[2],l[3]); |
| 356 | 357 | |
| 357 | | l[0]=f3_line_ram[0x2c60]&0xffff; |
| 358 | | l[1]=f3_line_ram[0x2ce0]&0xffff; |
| 359 | | l[2]=f3_line_ram[0x2d60]&0xffff; |
| 360 | | l[3]=f3_line_ram[0x2de0]&0xffff; |
| 358 | l[0]=f3_line_ram[0x2c60*2]&0xffff; |
| 359 | l[1]=f3_line_ram[0x2ce0*2]&0xffff; |
| 360 | l[2]=f3_line_ram[0x2d60*2]&0xffff; |
| 361 | l[3]=f3_line_ram[0x2de0*2]&0xffff; |
| 361 | 362 | bufptr += sprintf(bufptr,"Pri : %04x %04x %04x %04x\n",l[0],l[1],l[2],l[3]); |
| 362 | 363 | |
| 363 | | l[0]=f3_line_ram[0x2060]&0xffff; |
| 364 | | l[1]=f3_line_ram[0x20e0]&0xffff; |
| 365 | | l[2]=f3_line_ram[0x2160]&0xffff; |
| 366 | | l[3]=f3_line_ram[0x21e0]&0xffff; |
| 364 | l[0]=f3_line_ram[0x2060*2]&0xffff; |
| 365 | l[1]=f3_line_ram[0x20e0*2]&0xffff; |
| 366 | l[2]=f3_line_ram[0x2160*2]&0xffff; |
| 367 | l[3]=f3_line_ram[0x21e0*2]&0xffff; |
| 367 | 368 | bufptr += sprintf(bufptr,"Zoom: %04x %04x %04x %04x\n",l[0],l[1],l[2],l[3]); |
| 368 | 369 | |
| 369 | | l[0]=f3_line_ram[0x2860]&0xffff; |
| 370 | | l[1]=f3_line_ram[0x28e0]&0xffff; |
| 371 | | l[2]=f3_line_ram[0x2960]&0xffff; |
| 372 | | l[3]=f3_line_ram[0x29e0]&0xffff; |
| 370 | l[0]=f3_line_ram[0x2860*2]&0xffff; |
| 371 | l[1]=f3_line_ram[0x28e0*2]&0xffff; |
| 372 | l[2]=f3_line_ram[0x2960*2]&0xffff; |
| 373 | l[3]=f3_line_ram[0x29e0*2]&0xffff; |
| 373 | 374 | bufptr += sprintf(bufptr,"Line: %04x %04x %04x %04x\n",l[0],l[1],l[2],l[3]); |
| 374 | 375 | |
| 375 | | l[0]=f3_line_ram[0x1c60]&0xffff; |
| 376 | | l[1]=f3_line_ram[0x1ce0]&0xffff; |
| 377 | | l[2]=f3_line_ram[0x1d60]&0xffff; |
| 378 | | l[3]=f3_line_ram[0x1de0]&0xffff; |
| 376 | l[0]=f3_line_ram[0x1c60*2]&0xffff; |
| 377 | l[1]=f3_line_ram[0x1ce0*2]&0xffff; |
| 378 | l[2]=f3_line_ram[0x1d60*2]&0xffff; |
| 379 | l[3]=f3_line_ram[0x1de0*2]&0xffff; |
| 379 | 380 | bufptr += sprintf(bufptr,"Sprt: %04x %04x %04x %04x\n",l[0],l[1],l[2],l[3]); |
| 380 | 381 | |
| 381 | | l[0]=f3_line_ram[0x1860]&0xffff; |
| 382 | | l[1]=f3_line_ram[0x18e0]&0xffff; |
| 383 | | l[2]=f3_line_ram[0x1960]&0xffff; |
| 384 | | l[3]=f3_line_ram[0x19e0]&0xffff; |
| 382 | l[0]=f3_line_ram[0x1860*2]&0xffff; |
| 383 | l[1]=f3_line_ram[0x18e0*2]&0xffff; |
| 384 | l[2]=f3_line_ram[0x1960*2]&0xffff; |
| 385 | l[3]=f3_line_ram[0x19e0*2]&0xffff; |
| 385 | 386 | bufptr += sprintf(bufptr,"Pivt: %04x %04x %04x %04x\n",l[0],l[1],l[2],l[3]); |
| 386 | 387 | |
| 387 | | l[0]=f3_line_ram[0x1060]&0xffff; |
| 388 | | l[1]=f3_line_ram[0x10e0]&0xffff; |
| 389 | | l[2]=f3_line_ram[0x1160]&0xffff; |
| 390 | | l[3]=f3_line_ram[0x11e0]&0xffff; |
| 388 | l[0]=f3_line_ram[0x1060*2]&0xffff; |
| 389 | l[1]=f3_line_ram[0x10e0*2]&0xffff; |
| 390 | l[2]=f3_line_ram[0x1160*2]&0xffff; |
| 391 | l[3]=f3_line_ram[0x11e0*2]&0xffff; |
| 391 | 392 | bufptr += sprintf(bufptr,"Colm: %04x %04x %04x %04x\n",l[0],l[1],l[2],l[3]); |
| 392 | 393 | |
| 393 | | l[0]=f3_line_ram[0x1460]&0xffff; |
| 394 | | l[1]=f3_line_ram[0x14e0]&0xffff; |
| 395 | | l[2]=f3_line_ram[0x1560]&0xffff; |
| 396 | | l[3]=f3_line_ram[0x15e0]&0xffff; |
| 394 | l[0]=f3_line_ram[0x1460*2]&0xffff; |
| 395 | l[1]=f3_line_ram[0x14e0*2]&0xffff; |
| 396 | l[2]=f3_line_ram[0x1560*2]&0xffff; |
| 397 | l[3]=f3_line_ram[0x15e0*2]&0xffff; |
| 397 | 398 | bufptr += sprintf(bufptr,"5000: %04x %04x %04x %04x\n",l[0],l[1],l[2],l[3]); |
| 398 | 399 | |
| 399 | 400 | ui_draw_text(&machine.render().ui_container(), buf, 60, 40); |
| r11160 | r11161 | |
| 401 | 402 | |
| 402 | 403 | /******************************************************************************/ |
| 403 | 404 | |
| 404 | | INLINE void get_tile_info(running_machine &machine, tile_data *tileinfo, int tile_index, UINT32 *gfx_base) |
| 405 | INLINE void get_tile_info(running_machine &machine, tile_data *tileinfo, int tile_index, UINT16 *gfx_base) |
| 405 | 406 | { |
| 406 | | UINT32 tile=gfx_base[tile_index]; |
| 407 | UINT32 tile=(gfx_base[tile_index*2+0]<<16)|(gfx_base[tile_index*2+1]&0xffff); |
| 407 | 408 | UINT8 abtype=(tile>>(16+9)) & 1; |
| 408 | 409 | // tiles can be configured to use 4, 5, or 6 bpp data. |
| 409 | 410 | // if tiles use more than 4bpp, the bottom bits of the color code must be masked out. |
| r11160 | r11161 | |
| 443 | 444 | get_tile_info(machine,tileinfo,tile_index,state->m_f3_pf_data_4); |
| 444 | 445 | } |
| 445 | 446 | |
| 447 | static TILE_GET_INFO( get_tile_info5 ) |
| 448 | { |
| 449 | taito_f3_state *state = machine.driver_data<taito_f3_state>(); |
| 450 | get_tile_info(machine,tileinfo,tile_index,state->m_f3_pf_data_5); |
| 451 | } |
| 452 | |
| 453 | static TILE_GET_INFO( get_tile_info6 ) |
| 454 | { |
| 455 | taito_f3_state *state = machine.driver_data<taito_f3_state>(); |
| 456 | get_tile_info(machine,tileinfo,tile_index,state->m_f3_pf_data_6); |
| 457 | } |
| 458 | |
| 459 | static TILE_GET_INFO( get_tile_info7 ) |
| 460 | { |
| 461 | taito_f3_state *state = machine.driver_data<taito_f3_state>(); |
| 462 | get_tile_info(machine,tileinfo,tile_index,state->m_f3_pf_data_7); |
| 463 | } |
| 464 | |
| 465 | static TILE_GET_INFO( get_tile_info8 ) |
| 466 | { |
| 467 | taito_f3_state *state = machine.driver_data<taito_f3_state>(); |
| 468 | get_tile_info(machine,tileinfo,tile_index,state->m_f3_pf_data_8); |
| 469 | } |
| 470 | |
| 471 | |
| 446 | 472 | static TILE_GET_INFO( get_tile_info_vram ) |
| 447 | 473 | { |
| 448 | 474 | taito_f3_state *state = machine.driver_data<taito_f3_state>(); |
| 449 | | UINT32 *videoram = state->m_videoram; |
| 450 | 475 | int vram_tile; |
| 451 | 476 | int flags=0; |
| 452 | 477 | |
| 453 | | if (tile_index&1) |
| 454 | | vram_tile = (videoram[tile_index>>1]&0xffff); |
| 455 | | else |
| 456 | | vram_tile = (videoram[tile_index>>1]>>16); |
| 478 | vram_tile = (state->m_videoram[tile_index]&0xffff); |
| 457 | 479 | |
| 458 | 480 | if (vram_tile&0x0100) flags|=TILE_FLIPX; |
| 459 | 481 | if (vram_tile&0x8000) flags|=TILE_FLIPY; |
| r11160 | r11161 | |
| 468 | 490 | static TILE_GET_INFO( get_tile_info_pixel ) |
| 469 | 491 | { |
| 470 | 492 | taito_f3_state *state = machine.driver_data<taito_f3_state>(); |
| 471 | | UINT32 *videoram = state->m_videoram; |
| 472 | 493 | int vram_tile,col_off; |
| 473 | 494 | int flags=0; |
| 474 | | int y_offs=(state->m_f3_control_1[2]&0x1ff); |
| 495 | int y_offs=(state->m_f3_control_1[5]&0x1ff); |
| 475 | 496 | if (state->m_flipscreen) y_offs+=0x100; |
| 476 | 497 | |
| 477 | 498 | /* Colour is shared with VRAM layer */ |
| r11160 | r11161 | |
| 480 | 501 | else |
| 481 | 502 | col_off=((tile_index%32)*0x40)+((tile_index&0xfe0)>>5); |
| 482 | 503 | |
| 483 | | if (col_off&1) |
| 484 | | vram_tile = (videoram[col_off>>1]&0xffff); |
| 485 | | else |
| 486 | | vram_tile = (videoram[col_off>>1]>>16); |
| 504 | vram_tile = (state->m_videoram[col_off]&0xffff); |
| 487 | 505 | |
| 488 | 506 | if (vram_tile&0x0100) flags|=TILE_FLIPX; |
| 489 | 507 | if (vram_tile&0x8000) flags|=TILE_FLIPY; |
| r11160 | r11161 | |
| 504 | 522 | { |
| 505 | 523 | if (machine.video().skip_this_frame() == 0) |
| 506 | 524 | { |
| 507 | | get_sprite_info(machine, state->m_spriteram32_buffered); |
| 525 | get_sprite_info(machine, state->m_spriteram16_buffered); |
| 508 | 526 | } |
| 509 | | memcpy(state->m_spriteram32_buffered,state->m_spriteram,state->m_spriteram_size); |
| 527 | memcpy(state->m_spriteram16_buffered,state->m_spriteram,0x10000); |
| 510 | 528 | } |
| 511 | 529 | else if (state->m_sprite_lag==1) |
| 512 | 530 | { |
| r11160 | r11161 | |
| 543 | 561 | state->m_tr_3b = 1; |
| 544 | 562 | |
| 545 | 563 | state->m_spritelist=0; |
| 546 | | state->m_spriteram32_buffered=0; |
| 564 | state->m_spriteram16_buffered=0; |
| 547 | 565 | state->m_pf_line_inf=0; |
| 548 | 566 | state->m_pri_alp_bitmap=0; |
| 549 | 567 | state->m_tile_opaque_sp=0; |
| r11160 | r11161 | |
| 559 | 577 | |
| 560 | 578 | state->m_f3_game_config=pCFG; |
| 561 | 579 | |
| 580 | state->m_f3_vram = auto_alloc_array(machine, UINT16, 0x2000/2); |
| 581 | state->m_f3_pf_data = auto_alloc_array(machine, UINT16, 0xc000/2); |
| 582 | state->m_videoram = auto_alloc_array(machine, UINT16, 0x2000/2); |
| 583 | state->m_f3_line_ram = auto_alloc_array(machine, UINT16, 0x10000/2); |
| 584 | state->m_f3_pivot_ram = auto_alloc_array(machine, UINT16, 0x10000/2); |
| 585 | state->m_spriteram = auto_alloc_array(machine, UINT16, 0x10000/2); |
| 586 | |
| 562 | 587 | if (state->m_f3_game_config->extend) { |
| 563 | 588 | state->m_pf1_tilemap = tilemap_create(machine, get_tile_info1,tilemap_scan_rows,16,16,64,32); |
| 564 | 589 | state->m_pf2_tilemap = tilemap_create(machine, get_tile_info2,tilemap_scan_rows,16,16,64,32); |
| 565 | 590 | state->m_pf3_tilemap = tilemap_create(machine, get_tile_info3,tilemap_scan_rows,16,16,64,32); |
| 566 | 591 | state->m_pf4_tilemap = tilemap_create(machine, get_tile_info4,tilemap_scan_rows,16,16,64,32); |
| 567 | 592 | |
| 568 | | state->m_f3_pf_data_1=state->m_f3_pf_data+0x0000; |
| 569 | | state->m_f3_pf_data_2=state->m_f3_pf_data+0x0800; |
| 570 | | state->m_f3_pf_data_3=state->m_f3_pf_data+0x1000; |
| 571 | | state->m_f3_pf_data_4=state->m_f3_pf_data+0x1800; |
| 593 | state->m_f3_pf_data_1=state->m_f3_pf_data+(0x0000/2); |
| 594 | state->m_f3_pf_data_2=state->m_f3_pf_data+(0x2000/2); |
| 595 | state->m_f3_pf_data_3=state->m_f3_pf_data+(0x4000/2); |
| 596 | state->m_f3_pf_data_4=state->m_f3_pf_data+(0x6000/2); |
| 572 | 597 | |
| 573 | 598 | state->m_width_mask=0x3ff; |
| 574 | | state->m_twidth_mask=0x3f; |
| 575 | | state->m_twidth_mask_bit=6; |
| 599 | state->m_twidth_mask=0x7f; |
| 600 | state->m_twidth_mask_bit=7; |
| 576 | 601 | |
| 602 | tilemap_set_transparent_pen(state->m_pf1_tilemap,0); |
| 603 | tilemap_set_transparent_pen(state->m_pf2_tilemap,0); |
| 604 | tilemap_set_transparent_pen(state->m_pf3_tilemap,0); |
| 605 | tilemap_set_transparent_pen(state->m_pf4_tilemap,0); |
| 606 | |
| 607 | |
| 577 | 608 | } else { |
| 578 | 609 | state->m_pf1_tilemap = tilemap_create(machine, get_tile_info1,tilemap_scan_rows,16,16,32,32); |
| 579 | 610 | state->m_pf2_tilemap = tilemap_create(machine, get_tile_info2,tilemap_scan_rows,16,16,32,32); |
| 580 | 611 | state->m_pf3_tilemap = tilemap_create(machine, get_tile_info3,tilemap_scan_rows,16,16,32,32); |
| 581 | 612 | state->m_pf4_tilemap = tilemap_create(machine, get_tile_info4,tilemap_scan_rows,16,16,32,32); |
| 613 | state->m_pf5_tilemap = tilemap_create(machine, get_tile_info5,tilemap_scan_rows,16,16,32,32); |
| 614 | state->m_pf6_tilemap = tilemap_create(machine, get_tile_info6,tilemap_scan_rows,16,16,32,32); |
| 615 | state->m_pf7_tilemap = tilemap_create(machine, get_tile_info7,tilemap_scan_rows,16,16,32,32); |
| 616 | state->m_pf8_tilemap = tilemap_create(machine, get_tile_info8,tilemap_scan_rows,16,16,32,32); |
| 582 | 617 | |
| 583 | | state->m_f3_pf_data_1=state->m_f3_pf_data+0x0000; |
| 584 | | state->m_f3_pf_data_2=state->m_f3_pf_data+0x0400; |
| 585 | | state->m_f3_pf_data_3=state->m_f3_pf_data+0x0800; |
| 586 | | state->m_f3_pf_data_4=state->m_f3_pf_data+0x0c00; |
| 618 | state->m_f3_pf_data_1=state->m_f3_pf_data+(0x0000/2); |
| 619 | state->m_f3_pf_data_2=state->m_f3_pf_data+(0x1000/2); |
| 620 | state->m_f3_pf_data_3=state->m_f3_pf_data+(0x2000/2); |
| 621 | state->m_f3_pf_data_4=state->m_f3_pf_data+(0x3000/2); |
| 622 | state->m_f3_pf_data_5=state->m_f3_pf_data+(0x4000/2); |
| 623 | state->m_f3_pf_data_6=state->m_f3_pf_data+(0x5000/2); |
| 624 | state->m_f3_pf_data_7=state->m_f3_pf_data+(0x6000/2); |
| 625 | state->m_f3_pf_data_8=state->m_f3_pf_data+(0x7000/2); |
| 587 | 626 | |
| 588 | 627 | state->m_width_mask=0x1ff; |
| 589 | | state->m_twidth_mask=0x1f; |
| 590 | | state->m_twidth_mask_bit=5; |
| 628 | state->m_twidth_mask=0x3f; |
| 629 | state->m_twidth_mask_bit=6; |
| 630 | |
| 631 | tilemap_set_transparent_pen(state->m_pf1_tilemap,0); |
| 632 | tilemap_set_transparent_pen(state->m_pf2_tilemap,0); |
| 633 | tilemap_set_transparent_pen(state->m_pf3_tilemap,0); |
| 634 | tilemap_set_transparent_pen(state->m_pf4_tilemap,0); |
| 635 | tilemap_set_transparent_pen(state->m_pf5_tilemap,0); |
| 636 | tilemap_set_transparent_pen(state->m_pf6_tilemap,0); |
| 637 | tilemap_set_transparent_pen(state->m_pf7_tilemap,0); |
| 638 | tilemap_set_transparent_pen(state->m_pf8_tilemap,0); |
| 591 | 639 | } |
| 592 | 640 | |
| 593 | | state->m_spriteram32_buffered = auto_alloc_array(machine, UINT32, 0x10000/4); |
| 641 | state->m_spriteram16_buffered = auto_alloc_array(machine, UINT16, 0x10000/2); |
| 594 | 642 | state->m_spritelist = auto_alloc_array(machine, struct tempsprite, 0x400); |
| 595 | 643 | state->m_sprite_end = state->m_spritelist; |
| 596 | 644 | state->m_vram_layer = tilemap_create(machine, get_tile_info_vram,tilemap_scan_rows,8,8,64,64); |
| r11160 | r11161 | |
| 601 | 649 | height = machine.primary_screen->height(); |
| 602 | 650 | state->m_pri_alp_bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED8 ); |
| 603 | 651 | state->m_tile_opaque_sp = auto_alloc_array(machine, UINT8, machine.gfx[2]->total_elements); |
| 604 | | for (i=0; i<4; i++) |
| 652 | for (i=0; i<8; i++) |
| 605 | 653 | state->m_tile_opaque_pf[i] = auto_alloc_array(machine, UINT8, machine.gfx[1]->total_elements); |
| 606 | 654 | |
| 607 | | tilemap_set_transparent_pen(state->m_pf1_tilemap,0); |
| 608 | | tilemap_set_transparent_pen(state->m_pf2_tilemap,0); |
| 609 | | tilemap_set_transparent_pen(state->m_pf3_tilemap,0); |
| 610 | | tilemap_set_transparent_pen(state->m_pf4_tilemap,0); |
| 655 | |
| 611 | 656 | tilemap_set_transparent_pen(state->m_vram_layer,0); |
| 612 | 657 | tilemap_set_transparent_pen(state->m_pixel_layer,0); |
| 613 | 658 | |
| r11160 | r11161 | |
| 617 | 662 | machine.gfx[2]->color_granularity=16; |
| 618 | 663 | |
| 619 | 664 | state->m_flipscreen = 0; |
| 620 | | memset(state->m_spriteram32_buffered,0,state->m_spriteram_size); |
| 621 | | memset(state->m_spriteram,0,state->m_spriteram_size); |
| 665 | memset(state->m_spriteram16_buffered,0,0x10000); |
| 666 | memset(state->m_spriteram,0,0x10000); |
| 622 | 667 | |
| 623 | 668 | state_save_register_global_array(machine, state->m_f3_control_0); |
| 624 | 669 | state_save_register_global_array(machine, state->m_f3_control_1); |
| r11160 | r11161 | |
| 690 | 735 | |
| 691 | 736 | /******************************************************************************/ |
| 692 | 737 | |
| 693 | | WRITE32_HANDLER( f3_pf_data_w ) |
| 738 | READ16_HANDLER( f3_pf_data_r ) |
| 694 | 739 | { |
| 695 | 740 | taito_f3_state *state = space->machine().driver_data<taito_f3_state>(); |
| 741 | return state->m_f3_pf_data[offset]; |
| 742 | } |
| 743 | |
| 744 | WRITE16_HANDLER( f3_pf_data_w ) |
| 745 | { |
| 746 | taito_f3_state *state = space->machine().driver_data<taito_f3_state>(); |
| 696 | 747 | COMBINE_DATA(&state->m_f3_pf_data[offset]); |
| 697 | 748 | |
| 698 | 749 | if (state->m_f3_game_config->extend) { |
| 699 | | if (offset<0x800) tilemap_mark_tile_dirty(state->m_pf1_tilemap,offset-0x0000); |
| 700 | | else if (offset<0x1000) tilemap_mark_tile_dirty(state->m_pf2_tilemap,offset-0x0800); |
| 701 | | else if (offset<0x1800) tilemap_mark_tile_dirty(state->m_pf3_tilemap,offset-0x1000); |
| 702 | | else if (offset<0x2000) tilemap_mark_tile_dirty(state->m_pf4_tilemap,offset-0x1800); |
| 750 | if (offset<0x1000) tilemap_mark_tile_dirty(state->m_pf1_tilemap,(offset & 0xfff) >> 1); |
| 751 | else if (offset<0x2000) tilemap_mark_tile_dirty(state->m_pf2_tilemap,(offset & 0xfff) >> 1); |
| 752 | else if (offset<0x3000) tilemap_mark_tile_dirty(state->m_pf3_tilemap,(offset & 0xfff) >> 1); |
| 753 | else if (offset<0x4000) tilemap_mark_tile_dirty(state->m_pf4_tilemap,(offset & 0xfff) >> 1); |
| 703 | 754 | } else { |
| 704 | | if (offset<0x400) tilemap_mark_tile_dirty(state->m_pf1_tilemap,offset-0x0000); |
| 705 | | else if (offset<0x800) tilemap_mark_tile_dirty(state->m_pf2_tilemap,offset-0x0400); |
| 706 | | else if (offset<0xc00) tilemap_mark_tile_dirty(state->m_pf3_tilemap,offset-0x0800); |
| 707 | | else if (offset<0x1000) tilemap_mark_tile_dirty(state->m_pf4_tilemap,offset-0xc00); |
| 755 | if (offset<0x0800) tilemap_mark_tile_dirty(state->m_pf1_tilemap,(offset & 0x7ff) >> 1); |
| 756 | else if (offset<0x1000) tilemap_mark_tile_dirty(state->m_pf2_tilemap,(offset & 0x7ff) >> 1); |
| 757 | else if (offset<0x1800) tilemap_mark_tile_dirty(state->m_pf3_tilemap,(offset & 0x7ff) >> 1); |
| 758 | else if (offset<0x2000) tilemap_mark_tile_dirty(state->m_pf4_tilemap,(offset & 0x7ff) >> 1); |
| 759 | else if (offset<0x2800) tilemap_mark_tile_dirty(state->m_pf5_tilemap,(offset & 0x7ff) >> 1); |
| 760 | else if (offset<0x3000) tilemap_mark_tile_dirty(state->m_pf6_tilemap,(offset & 0x7ff) >> 1); |
| 761 | else if (offset<0x3800) tilemap_mark_tile_dirty(state->m_pf7_tilemap,(offset & 0x7ff) >> 1); |
| 762 | else if (offset<0x4000) tilemap_mark_tile_dirty(state->m_pf8_tilemap,(offset & 0x7ff) >> 1); |
| 708 | 763 | } |
| 709 | 764 | } |
| 710 | 765 | |
| 711 | | WRITE32_HANDLER( f3_control_0_w ) |
| 766 | WRITE16_HANDLER( f3_control_0_w ) |
| 712 | 767 | { |
| 713 | 768 | taito_f3_state *state = space->machine().driver_data<taito_f3_state>(); |
| 714 | 769 | COMBINE_DATA(&state->m_f3_control_0[offset]); |
| 715 | 770 | } |
| 716 | 771 | |
| 717 | | WRITE32_HANDLER( f3_control_1_w ) |
| 772 | WRITE16_HANDLER( f3_control_1_w ) |
| 718 | 773 | { |
| 719 | 774 | taito_f3_state *state = space->machine().driver_data<taito_f3_state>(); |
| 720 | 775 | COMBINE_DATA(&state->m_f3_control_1[offset]); |
| 721 | 776 | } |
| 722 | 777 | |
| 723 | | WRITE32_HANDLER( f3_videoram_w ) |
| 778 | READ16_HANDLER( f3_spriteram_r ) |
| 724 | 779 | { |
| 725 | 780 | taito_f3_state *state = space->machine().driver_data<taito_f3_state>(); |
| 726 | | UINT32 *videoram = state->m_videoram; |
| 781 | return state->m_spriteram[offset]; |
| 782 | } |
| 783 | |
| 784 | WRITE16_HANDLER( f3_spriteram_w ) |
| 785 | { |
| 786 | taito_f3_state *state = space->machine().driver_data<taito_f3_state>(); |
| 787 | COMBINE_DATA(&state->m_spriteram[offset]); |
| 788 | } |
| 789 | |
| 790 | READ16_HANDLER( f3_videoram_r ) |
| 791 | { |
| 792 | taito_f3_state *state = space->machine().driver_data<taito_f3_state>(); |
| 793 | return state->m_videoram[offset]; |
| 794 | } |
| 795 | |
| 796 | WRITE16_HANDLER( f3_videoram_w ) |
| 797 | { |
| 798 | taito_f3_state *state = space->machine().driver_data<taito_f3_state>(); |
| 727 | 799 | int tile,col_off; |
| 728 | | COMBINE_DATA(&videoram[offset]); |
| 800 | COMBINE_DATA(&state->m_videoram[offset]); |
| 729 | 801 | |
| 730 | | tilemap_mark_tile_dirty(state->m_vram_layer,offset<<1); |
| 731 | | tilemap_mark_tile_dirty(state->m_vram_layer,(offset<<1)+1); |
| 802 | tilemap_mark_tile_dirty(state->m_vram_layer,offset); |
| 803 | //tilemap_mark_tile_dirty(state->m_vram_layer,offset+1); |
| 732 | 804 | |
| 733 | | if (offset>0x3ff) offset-=0x400; |
| 805 | if (offset>0x7ff) offset-=0x800; |
| 734 | 806 | |
| 735 | | tile=offset<<1; |
| 807 | tile=offset; |
| 736 | 808 | col_off=((tile&0x3f)*32)+((tile&0xfc0)>>6); |
| 737 | 809 | |
| 738 | 810 | tilemap_mark_tile_dirty(state->m_pixel_layer,col_off); |
| 739 | | tilemap_mark_tile_dirty(state->m_pixel_layer,col_off+32); |
| 811 | //tilemap_mark_tile_dirty(state->m_pixel_layer,col_off+32); |
| 740 | 812 | } |
| 741 | 813 | |
| 742 | | WRITE32_HANDLER( f3_vram_w ) |
| 814 | |
| 815 | READ16_HANDLER( f3_vram_r ) |
| 743 | 816 | { |
| 744 | 817 | taito_f3_state *state = space->machine().driver_data<taito_f3_state>(); |
| 818 | |
| 819 | return state->m_f3_vram[offset]; |
| 820 | } |
| 821 | |
| 822 | WRITE16_HANDLER( f3_vram_w ) |
| 823 | { |
| 824 | taito_f3_state *state = space->machine().driver_data<taito_f3_state>(); |
| 745 | 825 | COMBINE_DATA(&state->m_f3_vram[offset]); |
| 746 | | gfx_element_mark_dirty(space->machine().gfx[0], offset/8); |
| 826 | gfx_element_mark_dirty(space->machine().gfx[0], offset/16); |
| 747 | 827 | } |
| 748 | 828 | |
| 749 | | WRITE32_HANDLER( f3_pivot_w ) |
| 829 | READ16_HANDLER( f3_pivot_r ) |
| 750 | 830 | { |
| 751 | 831 | taito_f3_state *state = space->machine().driver_data<taito_f3_state>(); |
| 832 | return state->m_f3_pivot_ram[offset]; |
| 833 | } |
| 834 | |
| 835 | WRITE16_HANDLER( f3_pivot_w ) |
| 836 | { |
| 837 | taito_f3_state *state = space->machine().driver_data<taito_f3_state>(); |
| 752 | 838 | COMBINE_DATA(&state->m_f3_pivot_ram[offset]); |
| 753 | | gfx_element_mark_dirty(space->machine().gfx[3], offset/8); |
| 839 | gfx_element_mark_dirty(space->machine().gfx[3], offset/16); |
| 754 | 840 | } |
| 755 | 841 | |
| 756 | | WRITE32_HANDLER( f3_lineram_w ) |
| 842 | READ16_HANDLER( f3_lineram_r ) |
| 757 | 843 | { |
| 758 | 844 | taito_f3_state *state = space->machine().driver_data<taito_f3_state>(); |
| 845 | return state->m_f3_line_ram[offset]; |
| 846 | } |
| 847 | |
| 848 | WRITE16_HANDLER( f3_lineram_w ) |
| 849 | { |
| 850 | taito_f3_state *state = space->machine().driver_data<taito_f3_state>(); |
| 759 | 851 | /* DariusGX has an interesting bug at the start of Round D - the clearing of lineram |
| 760 | 852 | (0xa000->0x0xa7ff) overflows into priority RAM (0xb000) and creates garbage priority |
| 761 | 853 | values. I'm not sure what the real machine would do with these values, and this |
| r11160 | r11161 | |
| 765 | 857 | if (state->m_f3_game==DARIUSG) { |
| 766 | 858 | if (state->m_f3_skip_this_frame) |
| 767 | 859 | return; |
| 768 | | if (offset==0xb000/4 && data==0x003f0000) { |
| 860 | if (offset==0xb000/2 && data==0x003f) { |
| 769 | 861 | state->m_f3_skip_this_frame=1; |
| 770 | 862 | return; |
| 771 | 863 | } |
| r11160 | r11161 | |
| 1476 | 1568 | struct f3_playfield_line_inf *line_t, |
| 1477 | 1569 | int line, |
| 1478 | 1570 | UINT32 x_index_fx,UINT32 y_index, |
| 1479 | | UINT32 *f3_pf_data_n) |
| 1571 | UINT16 *f3_pf_data_n) |
| 1480 | 1572 | { |
| 1481 | 1573 | taito_f3_state *state = machine.driver_data<taito_f3_state>(); |
| 1482 | | UINT32 *pf_base; |
| 1574 | UINT16 *pf_base; |
| 1483 | 1575 | int i,trans_all,tile_index,tile_num; |
| 1484 | 1576 | int alpha_type,alpha_mode; |
| 1485 | 1577 | int opaque_all; |
| r11160 | r11161 | |
| 1507 | 1599 | alpha_type=0; |
| 1508 | 1600 | for(i=0;i<tile_num;i++) |
| 1509 | 1601 | { |
| 1510 | | UINT32 tile=pf_base[(tile_index)&state->m_twidth_mask]; |
| 1602 | UINT32 tile=(pf_base[(tile_index*2+0)&state->m_twidth_mask]<<16)|(pf_base[(tile_index*2+1)&state->m_twidth_mask]); |
| 1511 | 1603 | UINT8 extra_planes = (tile>>(16+10)) & 3; |
| 1512 | 1604 | if(tile&0xffff) |
| 1513 | 1605 | { |
| r11160 | r11161 | |
| 1692 | 1784 | while(y!=y_end) |
| 1693 | 1785 | { |
| 1694 | 1786 | /* The zoom, column and row values can latch according to control ram */ |
| 1695 | | if (y&1) |
| 1696 | 1787 | { |
| 1697 | | if (state->m_f3_line_ram[0x080+(y>>1)]&1) |
| 1698 | | clip0_low=(state->m_f3_line_ram[clip_base_low/4]>> 0)&0xffff; |
| 1699 | | if (state->m_f3_line_ram[0x000+(y>>1)]&4) |
| 1700 | | clip0_high=(state->m_f3_line_ram[clip_base_high/4]>> 0)&0xffff; |
| 1701 | | if (state->m_f3_line_ram[0x080+(y>>1)]&2) |
| 1702 | | clip1_low=(state->m_f3_line_ram[(clip_base_low+0x200)/4]>> 0)&0xffff; |
| 1788 | if (state->m_f3_line_ram[0x100+(y)]&1) |
| 1789 | clip0_low=(state->m_f3_line_ram[clip_base_low/2]>> 0)&0xffff; |
| 1790 | if (state->m_f3_line_ram[0x000+(y)]&4) |
| 1791 | clip0_high=(state->m_f3_line_ram[clip_base_high/2]>> 0)&0xffff; |
| 1792 | if (state->m_f3_line_ram[0x100+(y)]&2) |
| 1793 | clip1_low=(state->m_f3_line_ram[(clip_base_low+0x200)/2]>> 0)&0xffff; |
| 1703 | 1794 | |
| 1704 | | if (state->m_f3_line_ram[(0x0600/4)+(y>>1)]&0x8) |
| 1705 | | spri=state->m_f3_line_ram[spri_base/4]&0xffff; |
| 1706 | | if (state->m_f3_line_ram[(0x0600/4)+(y>>1)]&0x4) |
| 1707 | | sprite_clip=state->m_f3_line_ram[(spri_base-0x200)/4]&0xffff; |
| 1708 | | if (state->m_f3_line_ram[(0x0400/4)+(y>>1)]&0x1) |
| 1709 | | sprite_alpha=state->m_f3_line_ram[(spri_base-0x1600)/4]&0xffff; |
| 1710 | | if (state->m_f3_line_ram[(0x0400/4)+(y>>1)]&0x2) |
| 1711 | | alpha_level=state->m_f3_line_ram[(spri_base-0x1400)/4]&0xffff; |
| 1795 | if (state->m_f3_line_ram[(0x0600/2)+(y)]&0x8) |
| 1796 | spri=state->m_f3_line_ram[spri_base/2]&0xffff; |
| 1797 | if (state->m_f3_line_ram[(0x0600/2)+(y)]&0x4) |
| 1798 | sprite_clip=state->m_f3_line_ram[(spri_base-0x200)/2]&0xffff; |
| 1799 | if (state->m_f3_line_ram[(0x0400/2)+(y)]&0x1) |
| 1800 | sprite_alpha=state->m_f3_line_ram[(spri_base-0x1600)/2]&0xffff; |
| 1801 | if (state->m_f3_line_ram[(0x0400/2)+(y)]&0x2) |
| 1802 | alpha_level=state->m_f3_line_ram[(spri_base-0x1400)/2]&0xffff; |
| 1712 | 1803 | } |
| 1713 | | else |
| 1714 | | { |
| 1715 | | if (state->m_f3_line_ram[0x080+(y>>1)]&0x10000) |
| 1716 | | clip0_low=(state->m_f3_line_ram[clip_base_low/4]>>16)&0xffff; |
| 1717 | | if (state->m_f3_line_ram[0x000+(y>>1)]&0x40000) |
| 1718 | | clip0_high=(state->m_f3_line_ram[clip_base_high/4]>>16)&0xffff; |
| 1719 | | if (state->m_f3_line_ram[0x080+(y>>1)]&0x20000) |
| 1720 | | clip1_low=(state->m_f3_line_ram[(clip_base_low+0x200)/4]>>16)&0xffff; |
| 1721 | 1804 | |
| 1722 | | if (state->m_f3_line_ram[(0x0600/4)+(y>>1)]&0x80000) |
| 1723 | | spri=state->m_f3_line_ram[spri_base/4]>>16; |
| 1724 | | if (state->m_f3_line_ram[(0x0600/4)+(y>>1)]&0x40000) |
| 1725 | | sprite_clip=state->m_f3_line_ram[(spri_base-0x200)/4]>>16; |
| 1726 | | if (state->m_f3_line_ram[(0x0400/4)+(y>>1)]&0x10000) |
| 1727 | | sprite_alpha=state->m_f3_line_ram[(spri_base-0x1600)/4]>>16; |
| 1728 | | if (state->m_f3_line_ram[(0x0400/4)+(y>>1)]&0x20000) |
| 1729 | | alpha_level=state->m_f3_line_ram[(spri_base-0x1400)/4]>>16; |
| 1730 | | } |
| 1731 | 1805 | |
| 1732 | 1806 | line_t->alpha_level[y]=alpha_level; |
| 1733 | 1807 | line_t->spri[y]=spri; |
| r11160 | r11161 | |
| 1768 | 1842 | } |
| 1769 | 1843 | |
| 1770 | 1844 | /* sx and sy are 16.16 fixed point numbers */ |
| 1771 | | static void get_line_ram_info(running_machine &machine, tilemap_t *tmap, int sx, int sy, int pos, UINT32 *f3_pf_data_n) |
| 1845 | static void get_line_ram_info(running_machine &machine, tilemap_t *tmap, int sx, int sy, int pos, UINT16 *f3_pf_data_n) |
| 1772 | 1846 | { |
| 1773 | 1847 | taito_f3_state *state = machine.driver_data<taito_f3_state>(); |
| 1774 | 1848 | struct f3_playfield_line_inf *line_t=&state->m_pf_line_inf[pos]; |
| r11160 | r11161 | |
| 1782 | 1856 | int colscroll=0,x_offset=0,line_zoom=0; |
| 1783 | 1857 | UINT32 _y_zoom[256]; |
| 1784 | 1858 | UINT16 pri=0; |
| 1785 | | int bit_select0=0x10000<<pos; |
| 1786 | | int bit_select1=1<<pos; |
| 1859 | int bit_select=1<<pos; |
| 1787 | 1860 | |
| 1788 | 1861 | int _colscroll[256]; |
| 1789 | 1862 | UINT32 _x_offset[256]; |
| r11160 | r11161 | |
| 1820 | 1893 | } |
| 1821 | 1894 | |
| 1822 | 1895 | y=y_start; |
| 1896 | |
| 1823 | 1897 | while(y!=y_end) |
| 1824 | 1898 | { |
| 1825 | 1899 | /* The zoom, column and row values can latch according to control ram */ |
| 1826 | | if (y&1) |
| 1827 | 1900 | { |
| 1828 | | if (state->m_f3_line_ram[0x300+(y>>1)]&bit_select1) |
| 1829 | | x_offset=(state->m_f3_line_ram[line_base/4]&0xffff)<<10; |
| 1830 | | if (state->m_f3_line_ram[0x380+(y>>1)]&bit_select1) |
| 1831 | | pri=state->m_f3_line_ram[pri_base/4]&0xffff; |
| 1901 | if (state->m_f3_line_ram[0x600+(y)]&bit_select) |
| 1902 | x_offset=(state->m_f3_line_ram[line_base/2]&0xffff)<<10; |
| 1903 | if (state->m_f3_line_ram[0x700+(y)]&bit_select) |
| 1904 | pri=state->m_f3_line_ram[pri_base/2]&0xffff; |
| 1832 | 1905 | |
| 1833 | 1906 | // Zoom for playfields 1 & 3 is interleaved, as is the latch select |
| 1834 | 1907 | switch (pos) |
| 1835 | 1908 | { |
| 1836 | 1909 | case 0: |
| 1837 | | if (state->m_f3_line_ram[0x200+(y>>1)]&bit_select1) |
| 1838 | | line_zoom=state->m_f3_line_ram[(zoom_base+0x000)/4]&0xffff; |
| 1910 | if (state->m_f3_line_ram[0x400+(y)]&bit_select) |
| 1911 | line_zoom=state->m_f3_line_ram[(zoom_base+0x000)/2]&0xffff; |
| 1839 | 1912 | break; |
| 1840 | 1913 | case 1: |
| 1841 | | if (state->m_f3_line_ram[0x200+(y>>1)]&0x2) |
| 1842 | | line_zoom=((state->m_f3_line_ram[(zoom_base+0x200)/4]&0xffff)&0xff00) | (line_zoom&0x00ff); |
| 1843 | | if (state->m_f3_line_ram[0x200+(y>>1)]&0x8) |
| 1844 | | line_zoom=((state->m_f3_line_ram[(zoom_base+0x600)/4]&0xffff)&0x00ff) | (line_zoom&0xff00); |
| 1914 | if (state->m_f3_line_ram[0x400+(y)]&0x2) |
| 1915 | line_zoom=((state->m_f3_line_ram[(zoom_base+0x200)/2]&0xffff)&0xff00) | (line_zoom&0x00ff); |
| 1916 | if (state->m_f3_line_ram[0x400+(y)]&0x8) |
| 1917 | line_zoom=((state->m_f3_line_ram[(zoom_base+0x600)/2]&0xffff)&0x00ff) | (line_zoom&0xff00); |
| 1845 | 1918 | break; |
| 1846 | 1919 | case 2: |
| 1847 | | if (state->m_f3_line_ram[0x200+(y>>1)]&bit_select1) |
| 1848 | | line_zoom=state->m_f3_line_ram[(zoom_base+0x400)/4]&0xffff; |
| 1920 | if (state->m_f3_line_ram[0x400+(y)]&bit_select) |
| 1921 | line_zoom=state->m_f3_line_ram[(zoom_base+0x400)/2]&0xffff; |
| 1849 | 1922 | break; |
| 1850 | 1923 | case 3: |
| 1851 | | if (state->m_f3_line_ram[0x200+(y>>1)]&0x8) |
| 1852 | | line_zoom=((state->m_f3_line_ram[(zoom_base+0x600)/4]&0xffff)&0xff00) | (line_zoom&0x00ff); |
| 1853 | | if (state->m_f3_line_ram[0x200+(y>>1)]&0x2) |
| 1854 | | line_zoom=((state->m_f3_line_ram[(zoom_base+0x200)/4]&0xffff)&0x00ff) | (line_zoom&0xff00); |
| 1924 | if (state->m_f3_line_ram[0x400+(y)]&0x8) |
| 1925 | line_zoom=((state->m_f3_line_ram[(zoom_base+0x600)/2]&0xffff)&0xff00) | (line_zoom&0x00ff); |
| 1926 | if (state->m_f3_line_ram[0x400+(y)]&0x2) |
| 1927 | line_zoom=((state->m_f3_line_ram[(zoom_base+0x200)/2]&0xffff)&0x00ff) | (line_zoom&0xff00); |
| 1855 | 1928 | break; |
| 1856 | 1929 | default: |
| 1857 | 1930 | break; |
| 1858 | 1931 | } |
| 1859 | 1932 | |
| 1860 | 1933 | // Column scroll only affects playfields 2 & 3 |
| 1861 | | if (pos>=2 && state->m_f3_line_ram[0x000+(y>>1)]&bit_select1) |
| 1862 | | colscroll=(state->m_f3_line_ram[col_base/4]>> 0)&0x3ff; |
| 1934 | if (pos>=2 && state->m_f3_line_ram[0x000+(y)]&bit_select) |
| 1935 | colscroll=(state->m_f3_line_ram[col_base/2]>> 0)&0x3ff; |
| 1863 | 1936 | } |
| 1864 | | else |
| 1865 | | { |
| 1866 | | if (state->m_f3_line_ram[0x300+(y>>1)]&bit_select0) |
| 1867 | | x_offset=(state->m_f3_line_ram[line_base/4]&0xffff0000)>>6; |
| 1868 | 1937 | |
| 1869 | | if (state->m_f3_line_ram[0x380+(y>>1)]&bit_select0) |
| 1870 | | pri=(state->m_f3_line_ram[pri_base/4]>>16)&0xffff; |
| 1871 | | |
| 1872 | | // Zoom for playfields 1 & 3 is interleaved, as is the latch select |
| 1873 | | switch (pos) |
| 1874 | | { |
| 1875 | | case 0: |
| 1876 | | if (state->m_f3_line_ram[0x200+(y>>1)]&bit_select0) |
| 1877 | | line_zoom=state->m_f3_line_ram[(zoom_base+0x000)/4]>>16; |
| 1878 | | break; |
| 1879 | | case 1: |
| 1880 | | if (state->m_f3_line_ram[0x200+(y>>1)]&0x20000) |
| 1881 | | line_zoom=((state->m_f3_line_ram[(zoom_base+0x200)/4]>>16)&0xff00) | (line_zoom&0x00ff); |
| 1882 | | if (state->m_f3_line_ram[0x200+(y>>1)]&0x80000) |
| 1883 | | line_zoom=((state->m_f3_line_ram[(zoom_base+0x600)/4]>>16)&0x00ff) | (line_zoom&0xff00); |
| 1884 | | break; |
| 1885 | | case 2: |
| 1886 | | if (state->m_f3_line_ram[0x200+(y>>1)]&bit_select0) |
| 1887 | | line_zoom=state->m_f3_line_ram[(zoom_base+0x400)/4]>>16; |
| 1888 | | break; |
| 1889 | | case 3: |
| 1890 | | if (state->m_f3_line_ram[0x200+(y>>1)]&0x80000) |
| 1891 | | line_zoom=((state->m_f3_line_ram[(zoom_base+0x600)/4]>>16)&0xff00) | (line_zoom&0x00ff); |
| 1892 | | if (state->m_f3_line_ram[0x200+(y>>1)]&0x20000) |
| 1893 | | line_zoom=((state->m_f3_line_ram[(zoom_base+0x200)/4]>>16)&0x00ff) | (line_zoom&0xff00); |
| 1894 | | break; |
| 1895 | | default: |
| 1896 | | break; |
| 1897 | | } |
| 1898 | | |
| 1899 | | // Column scroll only affects playfields 2 & 3 |
| 1900 | | if (pos>=2 && state->m_f3_line_ram[0x000+(y>>1)]&bit_select0) |
| 1901 | | colscroll=(state->m_f3_line_ram[col_base/4]>>16)&0x3ff; |
| 1902 | | } |
| 1903 | | |
| 1904 | 1938 | if (!pri || (!state->m_flipscreen && y<24) || (state->m_flipscreen && y>231) || |
| 1905 | 1939 | (pri&0xc000)==0xc000 || !(pri&0x2000)/**/) |
| 1906 | 1940 | line_enable=0; |
| r11160 | r11161 | |
| 1914 | 1948 | _colscroll[y]=colscroll; |
| 1915 | 1949 | _x_offset[y]=(x_offset&0xffff0000) - (x_offset&0x0000ffff); |
| 1916 | 1950 | _y_zoom[y] = (line_zoom&0xff) << 9; |
| 1917 | | |
| 1918 | | /* The football games use values in the range 0x200-0x3ff where the crowd should be drawn - !? |
| 1919 | | |
| 1920 | | Until this is understood we disable those lines (which would usually wrap and show the grass |
| 1921 | | area. |
| 1922 | | */ |
| 1923 | | if (colscroll&0x200) |
| 1924 | | pri|=0x0800; |
| 1925 | | |
| 1951 | |
| 1926 | 1952 | /* Evaluate clipping */ |
| 1927 | 1953 | if (pri&0x0800) |
| 1928 | 1954 | line_enable=0; |
| r11160 | r11161 | |
| 1949 | 1975 | y +=y_inc; |
| 1950 | 1976 | } |
| 1951 | 1977 | |
| 1952 | | /* set pixmap pointer */ |
| 1953 | | srcbitmap = tilemap_get_pixmap(tmap); |
| 1954 | | flagsbitmap = tilemap_get_flagsmap(tmap); |
| 1955 | 1978 | |
| 1979 | tilemap_t* tm = tmap; |
| 1980 | |
| 1956 | 1981 | y=y_start; |
| 1957 | 1982 | while(y!=y_end) |
| 1958 | 1983 | { |
| 1959 | 1984 | UINT32 x_index_fx; |
| 1960 | 1985 | UINT32 y_index; |
| 1961 | 1986 | |
| 1987 | /* The football games use values in the range 0x200-0x3ff where the crowd should be drawn - !? |
| 1988 | |
| 1989 | This appears to cause it to reference outside of the normal tilemap RAM area into the unused |
| 1990 | area on the 32x32 tilemap configuration.. but exactly how isn't understood |
| 1991 | |
| 1992 | Until this is understood we're creating additional tilemaps for the otherwise unused area of |
| 1993 | RAM and forcing it to look up there. |
| 1994 | |
| 1995 | the crowd area still seems to 'lag' behind the pitch area however.. but these are the values |
| 1996 | in ram?? |
| 1997 | */ |
| 1998 | int cs = _colscroll[y]; |
| 1999 | |
| 2000 | if (cs&0x200) |
| 2001 | { |
| 2002 | if (state->m_pf5_tilemap && state->m_pf6_tilemap) |
| 2003 | { |
| 2004 | if (tmap == state->m_pf3_tilemap) tmap = state->m_pf5_tilemap; // pitch -> crowd |
| 2005 | if (tmap == state->m_pf4_tilemap) tmap = state->m_pf6_tilemap; // corruption on goals -> blank (hthero94) |
| 2006 | } |
| 2007 | } |
| 2008 | else |
| 2009 | { |
| 2010 | tmap = tm; |
| 2011 | } |
| 2012 | |
| 2013 | /* set pixmap pointer */ |
| 2014 | srcbitmap = tilemap_get_pixmap(tmap); |
| 2015 | flagsbitmap = tilemap_get_flagsmap(tmap); |
| 2016 | |
| 1962 | 2017 | if(line_t->alpha_mode[y]!=0) |
| 1963 | 2018 | { |
| 1964 | 2019 | UINT16 *src_s; |
| r11160 | r11161 | |
| 2004 | 2059 | |
| 2005 | 2060 | UINT16 pri=0; |
| 2006 | 2061 | |
| 2007 | | const int vram_width_mask=0x1ff; |
| 2062 | const int vram_width_mask=0x3ff; |
| 2008 | 2063 | |
| 2009 | 2064 | if (state->m_flipscreen) |
| 2010 | 2065 | { |
| r11160 | r11161 | |
| 2028 | 2083 | while(y!=y_end) |
| 2029 | 2084 | { |
| 2030 | 2085 | /* The zoom, column and row values can latch according to control ram */ |
| 2031 | | if (y&1) |
| 2032 | 2086 | { |
| 2033 | | if (state->m_f3_line_ram[(0x0600/4)+(y>>1)]&0x2) |
| 2034 | | pri=(state->m_f3_line_ram[pri_base/4]&0xffff); |
| 2087 | if (state->m_f3_line_ram[(0x0600/2)+(y)]&0x2) |
| 2088 | pri=(state->m_f3_line_ram[pri_base/2]&0xffff); |
| 2035 | 2089 | } |
| 2036 | | else |
| 2037 | | { |
| 2038 | | if (state->m_f3_line_ram[(0x0600/4)+(y>>1)]&0x20000) |
| 2039 | | pri=(state->m_f3_line_ram[pri_base/4]&0xffff0000)>>16; |
| 2040 | | } |
| 2041 | 2090 | |
| 2091 | |
| 2042 | 2092 | if (!pri || (!state->m_flipscreen && y<24) || (state->m_flipscreen && y>231) || |
| 2043 | 2093 | (pri&0xc000)==0xc000 || !(pri&0x2000)/**/) |
| 2044 | 2094 | line_enable=0; |
| r11160 | r11161 | |
| 2548 | 2598 | |
| 2549 | 2599 | INLINE void f3_drawgfx( |
| 2550 | 2600 | bitmap_t *dest_bmp,const rectangle *clip,const gfx_element *gfx, |
| 2551 | | UINT32 code, |
| 2552 | | UINT32 color, |
| 2601 | int code, |
| 2602 | int color, |
| 2553 | 2603 | int flipx,int flipy, |
| 2554 | 2604 | int sx,int sy, |
| 2555 | 2605 | UINT8 pri_dst) |
| r11160 | r11161 | |
| 2712 | 2762 | |
| 2713 | 2763 | INLINE void f3_drawgfxzoom( |
| 2714 | 2764 | bitmap_t *dest_bmp,const rectangle *clip,const gfx_element *gfx, |
| 2715 | | UINT32 code, |
| 2716 | | UINT32 color, |
| 2765 | int code, |
| 2766 | int color, |
| 2717 | 2767 | int flipx,int flipy, |
| 2718 | 2768 | int sx,int sy, |
| 2719 | 2769 | int scalex, int scaley, |
| r11160 | r11161 | |
| 2846 | 2896 | /*zoom##p = p##_addition << 12;*/ \ |
| 2847 | 2897 | } |
| 2848 | 2898 | |
| 2849 | | static void get_sprite_info(running_machine &machine, const UINT32 *spriteram32_ptr) |
| 2899 | static void get_sprite_info(running_machine &machine, const UINT16 *spriteram16_ptr) |
| 2850 | 2900 | { |
| 2851 | 2901 | taito_f3_state *state = machine.driver_data<taito_f3_state>(); |
| 2852 | 2902 | const rectangle &visarea = machine.primary_screen->visible_area(); |
| r11160 | r11161 | |
| 2872 | 2922 | //old_x=0; |
| 2873 | 2923 | y=x=0; |
| 2874 | 2924 | |
| 2875 | | sprite_top=0x1000; |
| 2876 | | for (offs = 0; offs < sprite_top && (total_sprites < 0x400); offs += 4) |
| 2925 | sprite_top=0x2000; |
| 2926 | for (offs = 0; offs < sprite_top && (total_sprites < 0x400); offs += 8) |
| 2877 | 2927 | { |
| 2878 | 2928 | const int current_offs=offs; /* Offs can change during loop, current_offs cannot */ |
| 2879 | 2929 | |
| 2880 | 2930 | /* Check if the sprite list jump command bit is set */ |
| 2881 | | if ((spriteram32_ptr[current_offs+3]>>16) & 0x8000) { |
| 2882 | | UINT32 jump = (spriteram32_ptr[current_offs+3]>>16)&0x3ff; |
| 2931 | if ((spriteram16_ptr[current_offs+6+0]) & 0x8000) { |
| 2932 | UINT32 jump = (spriteram16_ptr[current_offs+6+0])&0x3ff; |
| 2883 | 2933 | |
| 2884 | | UINT32 new_offs=((offs&0x2000)|((jump<<4)/4)); |
| 2934 | UINT32 new_offs=((offs&0x4000)|((jump<<4)/2)); |
| 2885 | 2935 | if (new_offs==offs) |
| 2886 | 2936 | break; |
| 2887 | | offs=new_offs - 4; |
| 2937 | offs=new_offs - 8; |
| 2888 | 2938 | } |
| 2889 | 2939 | |
| 2890 | 2940 | /* Check if special command bit is set */ |
| 2891 | | if (spriteram32_ptr[current_offs+1] & 0x8000) { |
| 2892 | | UINT32 cntrl=(spriteram32_ptr[current_offs+2])&0xffff; |
| 2941 | if (spriteram16_ptr[current_offs+2+1] & 0x8000) { |
| 2942 | UINT32 cntrl=(spriteram16_ptr[current_offs+4+1])&0xffff; |
| 2893 | 2943 | state->m_flipscreen=cntrl&0x2000; |
| 2894 | 2944 | |
| 2895 | 2945 | /* cntrl&0x1000 = disabled? (From F2 driver, doesn't seem used anywhere) |
| r11160 | r11161 | |
| 2902 | 2952 | |
| 2903 | 2953 | /* Sprite bank select */ |
| 2904 | 2954 | if (cntrl&1) { |
| 2905 | | offs=offs|0x2000; |
| 2906 | | sprite_top=sprite_top|0x2000; |
| 2955 | offs=offs|0x4000; |
| 2956 | sprite_top=sprite_top|0x4000; |
| 2907 | 2957 | } |
| 2908 | 2958 | } |
| 2909 | 2959 | |
| 2910 | 2960 | /* Set global sprite scroll */ |
| 2911 | | if (((spriteram32_ptr[current_offs+1]>>16) & 0xf000) == 0xa000) { |
| 2912 | | global_x = (spriteram32_ptr[current_offs+1]>>16) & 0xfff; |
| 2961 | if (((spriteram16_ptr[current_offs+2+0]) & 0xf000) == 0xa000) { |
| 2962 | global_x = (spriteram16_ptr[current_offs+2+0]) & 0xfff; |
| 2913 | 2963 | if (global_x >= 0x800) global_x -= 0x1000; |
| 2914 | | global_y = spriteram32_ptr[current_offs+1] & 0xfff; |
| 2964 | global_y = spriteram16_ptr[current_offs+2+1] & 0xfff; |
| 2915 | 2965 | if (global_y >= 0x800) global_y -= 0x1000; |
| 2916 | 2966 | } |
| 2917 | 2967 | |
| 2918 | 2968 | /* And sub-global sprite scroll */ |
| 2919 | | if (((spriteram32_ptr[current_offs+1]>>16) & 0xf000) == 0x5000) { |
| 2920 | | subglobal_x = (spriteram32_ptr[current_offs+1]>>16) & 0xfff; |
| 2969 | if (((spriteram16_ptr[current_offs+2+0]) & 0xf000) == 0x5000) { |
| 2970 | subglobal_x = (spriteram16_ptr[current_offs+2+0]) & 0xfff; |
| 2921 | 2971 | if (subglobal_x >= 0x800) subglobal_x -= 0x1000; |
| 2922 | | subglobal_y = spriteram32_ptr[current_offs+1] & 0xfff; |
| 2972 | subglobal_y = spriteram16_ptr[current_offs+2+1] & 0xfff; |
| 2923 | 2973 | if (subglobal_y >= 0x800) subglobal_y -= 0x1000; |
| 2924 | 2974 | } |
| 2925 | 2975 | |
| 2926 | | if (((spriteram32_ptr[current_offs+1]>>16) & 0xf000) == 0xb000) { |
| 2927 | | subglobal_x = (spriteram32_ptr[current_offs+1]>>16) & 0xfff; |
| 2976 | if (((spriteram16_ptr[current_offs+2+0]) & 0xf000) == 0xb000) { |
| 2977 | subglobal_x = (spriteram16_ptr[current_offs+2+0]) & 0xfff; |
| 2928 | 2978 | if (subglobal_x >= 0x800) subglobal_x -= 0x1000; |
| 2929 | | subglobal_y = spriteram32_ptr[current_offs+1] & 0xfff; |
| 2979 | subglobal_y = spriteram16_ptr[current_offs+2+1] & 0xfff; |
| 2930 | 2980 | if (subglobal_y >= 0x800) subglobal_y -= 0x1000; |
| 2931 | 2981 | global_y=subglobal_y; |
| 2932 | 2982 | global_x=subglobal_x; |
| 2933 | 2983 | } |
| 2934 | 2984 | |
| 2935 | 2985 | /* A real sprite to process! */ |
| 2936 | | sprite = (spriteram32_ptr[current_offs]>>16) | ((spriteram32_ptr[current_offs+2]&1)<<16); |
| 2937 | | spritecont = spriteram32_ptr[current_offs+2]>>24; |
| 2986 | sprite = (spriteram16_ptr[current_offs+0+0]) | ((spriteram16_ptr[current_offs+4+1]&1)<<16); |
| 2987 | spritecont = spriteram16_ptr[current_offs+4+0]>>8; |
| 2938 | 2988 | |
| 2939 | 2989 | /* These games either don't set the XY control bits properly (68020 bug?), or |
| 2940 | 2990 | have some different mode from the others */ |
| r11160 | r11161 | |
| 2947 | 2997 | if (multi) { |
| 2948 | 2998 | /* Bit 0x4 is 'use previous colour' for this block part */ |
| 2949 | 2999 | if (spritecont&0x4) color=last_color; |
| 2950 | | else color=(spriteram32_ptr[current_offs+2]>>16)&0xff; |
| 3000 | else color=(spriteram16_ptr[current_offs+4+0])&0xff; |
| 2951 | 3001 | |
| 2952 | 3002 | #ifdef DARIUSG_KLUDGE |
| 2953 | 3003 | if (state->m_f3_game==DARIUSG || state->m_f3_game==GEKIRIDO || state->m_f3_game==CLEOPATR || state->m_f3_game==RECALH) { |
| r11160 | r11161 | |
| 2956 | 3006 | if (spritecont & 0x4) { |
| 2957 | 3007 | x = block_x; |
| 2958 | 3008 | } else { |
| 2959 | | this_x = spriteram32_ptr[current_offs+1]>>16; |
| 3009 | this_x = spriteram16_ptr[current_offs+2+0]; |
| 2960 | 3010 | if (this_x&0x800) this_x= 0 - (0x800 - (this_x&0x7ff)); else this_x&=0x7ff; |
| 2961 | 3011 | |
| 2962 | | if ((spriteram32_ptr[current_offs+1]>>16)&0x8000) { |
| 3012 | if ((spriteram16_ptr[current_offs+2+0])&0x8000) { |
| 2963 | 3013 | this_x+=0; |
| 2964 | | } else if ((spriteram32_ptr[current_offs+1]>>16)&0x4000) { |
| 3014 | } else if ((spriteram16_ptr[current_offs+2+0])&0x4000) { |
| 2965 | 3015 | /* Ignore subglobal (but apply global) */ |
| 2966 | 3016 | this_x+=global_x; |
| 2967 | 3017 | } else { /* Apply both scroll offsets */ |
| r11160 | r11161 | |
| 2983 | 3033 | if (spritecont & 0x4) { |
| 2984 | 3034 | y = block_y; |
| 2985 | 3035 | } else { |
| 2986 | | this_y = spriteram32_ptr[current_offs+1]&0xffff; |
| 3036 | this_y = spriteram16_ptr[current_offs+2+1]&0xffff; |
| 2987 | 3037 | if (this_y&0x800) this_y= 0 - (0x800 - (this_y&0x7ff)); else this_y&=0x7ff; |
| 2988 | 3038 | |
| 2989 | | if ((spriteram32_ptr[current_offs+1]>>16)&0x8000) { |
| 3039 | if ((spriteram16_ptr[current_offs+2+0])&0x8000) { |
| 2990 | 3040 | this_y+=0; |
| 2991 | | } else if ((spriteram32_ptr[current_offs+1]>>16)&0x4000) { |
| 3041 | } else if ((spriteram16_ptr[current_offs+2+0])&0x4000) { |
| 2992 | 3042 | /* Ignore subglobal (but apply global) */ |
| 2993 | 3043 | this_y+=global_y; |
| 2994 | 3044 | } else { /* Apply both scroll offsets */ |
| r11160 | r11161 | |
| 3032 | 3082 | } |
| 3033 | 3083 | /* Else this sprite is the possible start of a block */ |
| 3034 | 3084 | else { |
| 3035 | | color = (spriteram32_ptr[current_offs+2]>>16)&0xff; |
| 3085 | color = (spriteram16_ptr[current_offs+4+0])&0xff; |
| 3036 | 3086 | last_color=color; |
| 3037 | 3087 | |
| 3038 | 3088 | /* Sprite positioning */ |
| 3039 | | this_y = spriteram32_ptr[current_offs+1]&0xffff; |
| 3040 | | this_x = spriteram32_ptr[current_offs+1]>>16; |
| 3089 | this_y = spriteram16_ptr[current_offs+2+1]&0xffff; |
| 3090 | this_x = spriteram16_ptr[current_offs+2+0]&0xffff; |
| 3041 | 3091 | if (this_y&0x800) this_y= 0 - (0x800 - (this_y&0x7ff)); else this_y&=0x7ff; |
| 3042 | 3092 | if (this_x&0x800) this_x= 0 - (0x800 - (this_x&0x7ff)); else this_x&=0x7ff; |
| 3043 | 3093 | |
| 3044 | 3094 | /* Ignore both scroll offsets for this block */ |
| 3045 | | if ((spriteram32_ptr[current_offs+1]>>16)&0x8000) { |
| 3095 | if ((spriteram16_ptr[current_offs+2+0])&0x8000) { |
| 3046 | 3096 | this_x+=0; |
| 3047 | 3097 | this_y+=0; |
| 3048 | | } else if ((spriteram32_ptr[current_offs+1]>>16)&0x4000) { |
| 3098 | } else if ((spriteram16_ptr[current_offs+2+0])&0x4000) { |
| 3049 | 3099 | /* Ignore subglobal (but apply global) */ |
| 3050 | 3100 | this_x+=global_x; |
| 3051 | 3101 | this_y+=global_y; |
| r11160 | r11161 | |
| 3057 | 3107 | block_y = y = this_y; |
| 3058 | 3108 | block_x = x = this_x; |
| 3059 | 3109 | |
| 3060 | | block_zoom_x=spriteram32_ptr[current_offs]; |
| 3110 | block_zoom_x=spriteram16_ptr[current_offs+0+1]; |
| 3061 | 3111 | block_zoom_y=(block_zoom_x>>8)&0xff; |
| 3062 | 3112 | block_zoom_x&=0xff; |
| 3063 | 3113 | |
| r11160 | r11161 | |
| 3165 | 3215 | tilemap_set_flip_all(screen->machine(),state->m_flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); |
| 3166 | 3216 | |
| 3167 | 3217 | /* Setup scroll */ |
| 3168 | | sy_fix[0]=((state->m_f3_control_0[2]&0xffff0000)>> 7) + (1<<16); |
| 3169 | | sy_fix[1]=((state->m_f3_control_0[2]&0x0000ffff)<< 9) + (1<<16); |
| 3170 | | sy_fix[2]=((state->m_f3_control_0[3]&0xffff0000)>> 7) + (1<<16); |
| 3171 | | sy_fix[3]=((state->m_f3_control_0[3]&0x0000ffff)<< 9) + (1<<16); |
| 3172 | | sx_fix[0]=((state->m_f3_control_0[0]&0xffc00000)>> 6) - (6<<16); |
| 3173 | | sx_fix[1]=((state->m_f3_control_0[0]&0x0000ffc0)<<10) - (10<<16); |
| 3174 | | sx_fix[2]=((state->m_f3_control_0[1]&0xffc00000)>> 6) - (14<<16); |
| 3175 | | sx_fix[3]=((state->m_f3_control_0[1]&0x0000ffc0)<<10) - (18<<16); |
| 3176 | | sx_fix[4]=-(state->m_f3_control_1[2]>>16)+41; |
| 3177 | | sy_fix[4]=-(state->m_f3_control_1[2]&0x1ff); |
| 3218 | sy_fix[0]=((state->m_f3_control_0[4]&0xffff)<< 9) + (1<<16); |
| 3219 | sy_fix[1]=((state->m_f3_control_0[5]&0xffff)<< 9) + (1<<16); |
| 3220 | sy_fix[2]=((state->m_f3_control_0[6]&0xffff)<< 9) + (1<<16); |
| 3221 | sy_fix[3]=((state->m_f3_control_0[7]&0xffff)<< 9) + (1<<16); |
| 3222 | sx_fix[0]=((state->m_f3_control_0[0]&0xffc0)<<10) - (6<<16); |
| 3223 | sx_fix[1]=((state->m_f3_control_0[1]&0xffc0)<<10) - (10<<16); |
| 3224 | sx_fix[2]=((state->m_f3_control_0[2]&0xffc0)<<10) - (14<<16); |
| 3225 | sx_fix[3]=((state->m_f3_control_0[3]&0xffc0)<<10) - (18<<16); |
| 3226 | sx_fix[4]=-(state->m_f3_control_1[4])+41; |
| 3227 | sy_fix[4]=-(state->m_f3_control_1[5]&0x1ff); |
| 3178 | 3228 | |
| 3179 | | sx_fix[0]-=((state->m_f3_control_0[0]&0x003f0000)>> 6)+0x0400-0x10000; |
| 3180 | | sx_fix[1]-=((state->m_f3_control_0[0]&0x0000003f)<<10)+0x0400-0x10000; |
| 3181 | | sx_fix[2]-=((state->m_f3_control_0[1]&0x003f0000)>> 6)+0x0400-0x10000; |
| 3182 | | sx_fix[3]-=((state->m_f3_control_0[1]&0x0000003f)<<10)+0x0400-0x10000; |
| 3229 | sx_fix[0]-=((state->m_f3_control_0[0]&0x003f)<<10)+0x0400-0x10000; |
| 3230 | sx_fix[1]-=((state->m_f3_control_0[1]&0x003f)<<10)+0x0400-0x10000; |
| 3231 | sx_fix[2]-=((state->m_f3_control_0[2]&0x003f)<<10)+0x0400-0x10000; |
| 3232 | sx_fix[3]-=((state->m_f3_control_0[3]&0x003f)<<10)+0x0400-0x10000; |
| 3183 | 3233 | |
| 3184 | 3234 | if (state->m_flipscreen) |
| 3185 | 3235 | { |
src/mame/video/cave.c
| r11160 | r11161 | |
| 225 | 225 | |
| 226 | 226 | ***************************************************************************/ |
| 227 | 227 | |
| 228 | | INLINE void get_tile_info( running_machine &machine, tile_data *tileinfo, int tile_index, int GFX, UINT16 *VRAM, int TDIM ) |
| 228 | INLINE void get_tile_info( running_machine &machine, tile_data *tileinfo, int tile_index, int GFX ) |
| 229 | 229 | { |
| 230 | cave_state *state = machine.driver_data<cave_state>(); |
| 231 | UINT16 *VRAM = state->m_vram[GFX]; |
| 232 | int TDIM = state->m_tiledim[GFX]; |
| 230 | 233 | UINT32 code, color, pri, tile; |
| 231 | 234 | |
| 232 | 235 | if (TDIM) |
| r11160 | r11161 | |
| 263 | 266 | if (state->m_sailormn_tilebank != bank) |
| 264 | 267 | { |
| 265 | 268 | state->m_sailormn_tilebank = bank; |
| 266 | | tilemap_mark_all_tiles_dirty(state->m_tilemap_2); |
| 269 | tilemap_mark_all_tiles_dirty(state->m_tilemap[2]); |
| 267 | 270 | } |
| 268 | 271 | } |
| 269 | 272 | |
| r11160 | r11161 | |
| 272 | 275 | cave_state *state = machine.driver_data<cave_state>(); |
| 273 | 276 | UINT32 code, color, pri; |
| 274 | 277 | |
| 275 | | if (state->m_tiledim_2) |
| 278 | if (state->m_tiledim[2]) |
| 276 | 279 | { |
| 277 | 280 | UINT32 tile; |
| 278 | 281 | tile = (tile_index % (512 / 8)) / 2 + ((tile_index / (512 / 8)) / 2) * (512 / 16); |
| 279 | | code = (state->m_vram_2[tile * 2 + 0x0000 / 2] << 16) + state->m_vram_2[tile * 2 + 0x0002 / 2]; |
| 282 | code = (state->m_vram[2][tile * 2 + 0x0000 / 2] << 16) + state->m_vram[2][tile * 2 + 0x0002 / 2]; |
| 280 | 283 | |
| 281 | 284 | color = (code & 0x3f000000) >> (32 - 8); |
| 282 | 285 | pri = (code & 0xc0000000) >> (32 - 2); |
| r11160 | r11161 | |
| 287 | 290 | } |
| 288 | 291 | else |
| 289 | 292 | { |
| 290 | | code = (state->m_vram_2[tile_index * 2 + 0x4000 / 2] << 16) + state->m_vram_2[tile_index * 2 + 0x4002 / 2]; |
| 293 | code = (state->m_vram[2][tile_index * 2 + 0x4000 / 2] << 16) + state->m_vram[2][tile_index * 2 + 0x4002 / 2]; |
| 291 | 294 | |
| 292 | 295 | color = (code & 0x3f000000) >> (32 - 8); |
| 293 | 296 | pri = (code & 0xc0000000) >> (32 - 2); |
| r11160 | r11161 | |
| 301 | 304 | } |
| 302 | 305 | |
| 303 | 306 | |
| 304 | | INLINE void vram_w( UINT16 *VRAM, tilemap_t *TILEMAP, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 data, ATTR_UNUSED UINT16 mem_mask ) |
| 307 | INLINE void vram_w( address_space *space, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 data, ATTR_UNUSED UINT16 mem_mask, int GFX ) |
| 305 | 308 | { |
| 309 | cave_state *state = space->machine().driver_data<cave_state>(); |
| 310 | UINT16 *VRAM = state->m_vram[GFX]; |
| 311 | tilemap_t *TILEMAP = state->m_tilemap[GFX]; |
| 312 | |
| 306 | 313 | if ((VRAM[offset] & mem_mask) == (data & mem_mask)) |
| 307 | | return; |
| 314 | return; |
| 308 | 315 | |
| 309 | 316 | COMBINE_DATA(&VRAM[offset]); |
| 310 | 317 | offset /= 2; |
| r11160 | r11161 | |
| 325 | 332 | and 408000-407fff both go to the 8x8 tilemap ram. Use this function |
| 326 | 333 | in this cases. Note that the get_tile_info function looks in the |
| 327 | 334 | 4000-7fff range for tiles, so we have to write the data there. */ |
| 328 | | INLINE void vram_8x8_w( UINT16 *VRAM, tilemap_t *TILEMAP, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 data, ATTR_UNUSED UINT16 mem_mask ) |
| 335 | INLINE void vram_8x8_w( address_space *space, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 data, ATTR_UNUSED UINT16 mem_mask, int GFX ) |
| 329 | 336 | { |
| 337 | cave_state *state = space->machine().driver_data<cave_state>(); |
| 338 | UINT16 *VRAM = state->m_vram[GFX]; |
| 339 | tilemap_t *TILEMAP = state->m_tilemap[GFX]; |
| 340 | |
| 330 | 341 | offset %= 0x4000 / 2; |
| 331 | 342 | if ((VRAM[offset] & mem_mask) == (data & mem_mask)) |
| 332 | 343 | return; |
| r11160 | r11161 | |
| 337 | 348 | } |
| 338 | 349 | |
| 339 | 350 | |
| 340 | | static TILE_GET_INFO( get_tile_info_0 ) { cave_state *state = machine.driver_data<cave_state>(); get_tile_info(machine, tileinfo, tile_index, 0, state->m_vram_0, state->m_tiledim_0); } |
| 341 | | static TILE_GET_INFO( get_tile_info_1 ) { cave_state *state = machine.driver_data<cave_state>(); get_tile_info(machine, tileinfo, tile_index, 1, state->m_vram_1, state->m_tiledim_1); } |
| 342 | | static TILE_GET_INFO( get_tile_info_2 ) { cave_state *state = machine.driver_data<cave_state>(); get_tile_info(machine, tileinfo, tile_index, 2, state->m_vram_2, state->m_tiledim_2); } |
| 343 | | static TILE_GET_INFO( get_tile_info_3 ) { cave_state *state = machine.driver_data<cave_state>(); get_tile_info(machine, tileinfo, tile_index, 3, state->m_vram_3, state->m_tiledim_3); } |
| 351 | static TILE_GET_INFO( get_tile_info_0 ) { get_tile_info(machine, tileinfo, tile_index, 0); } |
| 352 | static TILE_GET_INFO( get_tile_info_1 ) { get_tile_info(machine, tileinfo, tile_index, 1); } |
| 353 | static TILE_GET_INFO( get_tile_info_2 ) { get_tile_info(machine, tileinfo, tile_index, 2); } |
| 354 | static TILE_GET_INFO( get_tile_info_3 ) { get_tile_info(machine, tileinfo, tile_index, 3); } |
| 344 | 355 | |
| 345 | | WRITE16_HANDLER( cave_vram_0_w ) |
| 346 | | { |
| 347 | | cave_state *state = space->machine().driver_data<cave_state>(); |
| 348 | | vram_w(state->m_vram_0, state->m_tilemap_0, offset, data, mem_mask); |
| 349 | | } |
| 356 | WRITE16_HANDLER( cave_vram_0_w ) { vram_w(space, offset, data, mem_mask, 0); } |
| 357 | WRITE16_HANDLER( cave_vram_1_w ) { vram_w(space, offset, data, mem_mask, 1); } |
| 358 | WRITE16_HANDLER( cave_vram_2_w ) { vram_w(space, offset, data, mem_mask, 2); } |
| 359 | WRITE16_HANDLER( cave_vram_3_w ) { vram_w(space, offset, data, mem_mask, 3); } |
| 350 | 360 | |
| 351 | | WRITE16_HANDLER( cave_vram_0_8x8_w ) |
| 352 | | { |
| 353 | | cave_state *state = space->machine().driver_data<cave_state>(); |
| 354 | | vram_8x8_w(state->m_vram_0, state->m_tilemap_0, offset, data, mem_mask); |
| 355 | | } |
| 361 | WRITE16_HANDLER( cave_vram_0_8x8_w ) { vram_8x8_w(space, offset, data, mem_mask, 0); } |
| 362 | WRITE16_HANDLER( cave_vram_1_8x8_w ) { vram_8x8_w(space, offset, data, mem_mask, 1); } |
| 363 | WRITE16_HANDLER( cave_vram_2_8x8_w ) { vram_8x8_w(space, offset, data, mem_mask, 2); } |
| 364 | WRITE16_HANDLER( cave_vram_3_8x8_w ) { vram_8x8_w(space, offset, data, mem_mask, 3); } |
| 356 | 365 | |
| 357 | | WRITE16_HANDLER( cave_vram_1_w ) |
| 358 | | { |
| 359 | | cave_state *state = space->machine().driver_data<cave_state>(); |
| 360 | | vram_w(state->m_vram_1, state->m_tilemap_1, offset, data, mem_mask); |
| 361 | | } |
| 362 | 366 | |
| 363 | | WRITE16_HANDLER( cave_vram_1_8x8_w ) |
| 364 | | { |
| 365 | | cave_state *state = space->machine().driver_data<cave_state>(); |
| 366 | | vram_8x8_w(state->m_vram_1, state->m_tilemap_1, offset, data, mem_mask); |
| 367 | | } |
| 368 | | |
| 369 | | WRITE16_HANDLER( cave_vram_2_w ) |
| 370 | | { |
| 371 | | cave_state *state = space->machine().driver_data<cave_state>(); |
| 372 | | vram_w(state->m_vram_2, state->m_tilemap_2, offset, data, mem_mask); |
| 373 | | } |
| 374 | | |
| 375 | | WRITE16_HANDLER( cave_vram_2_8x8_w ) |
| 376 | | { |
| 377 | | cave_state *state = space->machine().driver_data<cave_state>(); |
| 378 | | vram_8x8_w(state->m_vram_2, state->m_tilemap_2, offset, data, mem_mask); |
| 379 | | } |
| 380 | | |
| 381 | | WRITE16_HANDLER( cave_vram_3_w ) |
| 382 | | { |
| 383 | | cave_state *state = space->machine().driver_data<cave_state>(); |
| 384 | | vram_w(state->m_vram_3, state->m_tilemap_3, offset, data, mem_mask); |
| 385 | | } |
| 386 | | |
| 387 | | WRITE16_HANDLER( cave_vram_3_8x8_w ) |
| 388 | | { |
| 389 | | cave_state *state = space->machine().driver_data<cave_state>(); |
| 390 | | vram_8x8_w(state->m_vram_3, state->m_tilemap_3, offset, data, mem_mask); |
| 391 | | } |
| 392 | | |
| 393 | | |
| 394 | 367 | /*************************************************************************** |
| 395 | 368 | |
| 396 | 369 | Video Init Routines |
| r11160 | r11161 | |
| 406 | 379 | |
| 407 | 380 | assert(state->m_palette_map != NULL); |
| 408 | 381 | |
| 409 | | state->m_tilemap_0 = 0; |
| 410 | | state->m_tilemap_1 = 0; |
| 411 | | state->m_tilemap_2 = 0; |
| 412 | | state->m_tilemap_3 = 0; |
| 382 | state->m_tilemap[0] = 0; |
| 383 | state->m_tilemap[1] = 0; |
| 384 | state->m_tilemap[2] = 0; |
| 385 | state->m_tilemap[3] = 0; |
| 413 | 386 | |
| 414 | | state->m_tiledim_0 = 0; |
| 415 | | state->m_tiledim_1 = 0; |
| 416 | | state->m_tiledim_2 = 0; |
| 417 | | state->m_tiledim_3 = 0; |
| 387 | state->m_tiledim[0] = 0; |
| 388 | state->m_tiledim[1] = 0; |
| 389 | state->m_tiledim[2] = 0; |
| 390 | state->m_tiledim[3] = 0; |
| 418 | 391 | |
| 419 | | state->m_old_tiledim_0 = 0; |
| 420 | | state->m_old_tiledim_1 = 0; |
| 421 | | state->m_old_tiledim_2 = 0; |
| 422 | | state->m_old_tiledim_3 = 0; |
| 392 | state->m_old_tiledim[0] = 0; |
| 393 | state->m_old_tiledim[1] = 0; |
| 394 | state->m_old_tiledim[2] = 0; |
| 395 | state->m_old_tiledim[3] = 0; |
| 423 | 396 | |
| 424 | 397 | assert((num >= 1) && (num <= 4)); |
| 425 | 398 | |
| 426 | 399 | switch (num) |
| 427 | 400 | { |
| 428 | 401 | case 4: |
| 429 | | state->m_tilemap_3 = tilemap_create(machine, get_tile_info_3, tilemap_scan_rows, 8, 8, 512 / 8, 512 / 8); |
| 430 | | tilemap_set_transparent_pen(state->m_tilemap_3, 0); |
| 431 | | tilemap_set_scroll_rows(state->m_tilemap_3, 1); |
| 432 | | tilemap_set_scroll_cols(state->m_tilemap_3, 1); |
| 433 | | state->save_item(NAME(state->m_tiledim_3)); |
| 434 | | state->save_item(NAME(state->m_old_tiledim_3)); |
| 402 | state->m_tilemap[3] = tilemap_create(machine, get_tile_info_3, tilemap_scan_rows, 8, 8, 512 / 8, 512 / 8); |
| 403 | tilemap_set_transparent_pen(state->m_tilemap[3], 0); |
| 404 | tilemap_set_scroll_rows(state->m_tilemap[3], 1); |
| 405 | tilemap_set_scroll_cols(state->m_tilemap[3], 1); |
| 406 | state->save_item(NAME(state->m_tiledim[3])); |
| 407 | state->save_item(NAME(state->m_old_tiledim[3])); |
| 435 | 408 | |
| 436 | 409 | case 3: |
| 437 | | state->m_tilemap_2 = tilemap_create(machine, get_tile_info_2, tilemap_scan_rows, 8, 8, 512 / 8, 512 / 8); |
| 438 | | tilemap_set_transparent_pen(state->m_tilemap_2, 0); |
| 439 | | tilemap_set_scroll_rows(state->m_tilemap_2, 1); |
| 440 | | tilemap_set_scroll_cols(state->m_tilemap_2, 1); |
| 441 | | state->save_item(NAME(state->m_tiledim_2)); |
| 442 | | state->save_item(NAME(state->m_old_tiledim_2)); |
| 410 | state->m_tilemap[2] = tilemap_create(machine, get_tile_info_2, tilemap_scan_rows, 8, 8, 512 / 8, 512 / 8); |
| 411 | tilemap_set_transparent_pen(state->m_tilemap[2], 0); |
| 412 | tilemap_set_scroll_rows(state->m_tilemap[2], 1); |
| 413 | tilemap_set_scroll_cols(state->m_tilemap[2], 1); |
| 414 | state->save_item(NAME(state->m_tiledim[2])); |
| 415 | state->save_item(NAME(state->m_old_tiledim[2])); |
| 443 | 416 | |
| 444 | 417 | case 2: |
| 445 | | state->m_tilemap_1 = tilemap_create(machine, get_tile_info_1, tilemap_scan_rows, 8, 8, 512 / 8, 512 / 8); |
| 446 | | tilemap_set_transparent_pen(state->m_tilemap_1, 0); |
| 447 | | tilemap_set_scroll_rows(state->m_tilemap_1, 1); |
| 448 | | tilemap_set_scroll_cols(state->m_tilemap_1, 1); |
| 449 | | state->save_item(NAME(state->m_tiledim_1)); |
| 450 | | state->save_item(NAME(state->m_old_tiledim_1)); |
| 418 | state->m_tilemap[1] = tilemap_create(machine, get_tile_info_1, tilemap_scan_rows, 8, 8, 512 / 8, 512 / 8); |
| 419 | tilemap_set_transparent_pen(state->m_tilemap[1], 0); |
| 420 | tilemap_set_scroll_rows(state->m_tilemap[1], 1); |
| 421 | tilemap_set_scroll_cols(state->m_tilemap[1], 1); |
| 422 | state->save_item(NAME(state->m_tiledim[1])); |
| 423 | state->save_item(NAME(state->m_old_tiledim[1])); |
| 451 | 424 | |
| 452 | 425 | case 1: |
| 453 | | state->m_tilemap_0 = tilemap_create(machine, get_tile_info_0, tilemap_scan_rows, 8, 8, 512 / 8, 512 / 8); |
| 454 | | tilemap_set_transparent_pen(state->m_tilemap_0, 0); |
| 455 | | tilemap_set_scroll_rows(state->m_tilemap_0, 1); |
| 456 | | tilemap_set_scroll_cols(state->m_tilemap_0, 1); |
| 457 | | state->save_item(NAME(state->m_tiledim_0)); |
| 458 | | state->save_item(NAME(state->m_old_tiledim_0)); |
| 426 | state->m_tilemap[0] = tilemap_create(machine, get_tile_info_0, tilemap_scan_rows, 8, 8, 512 / 8, 512 / 8); |
| 427 | tilemap_set_transparent_pen(state->m_tilemap[0], 0); |
| 428 | tilemap_set_scroll_rows(state->m_tilemap[0], 1); |
| 429 | tilemap_set_scroll_cols(state->m_tilemap[0], 1); |
| 430 | state->save_item(NAME(state->m_tiledim[0])); |
| 431 | state->save_item(NAME(state->m_old_tiledim[0])); |
| 459 | 432 | |
| 460 | 433 | break; |
| 461 | 434 | } |
| r11160 | r11161 | |
| 500 | 473 | cave_vh_start(machine, 2); |
| 501 | 474 | |
| 502 | 475 | /* Layer 2 (8x8) needs to be handled differently */ |
| 503 | | state->m_tilemap_2 = tilemap_create(machine, sailormn_get_tile_info_2, tilemap_scan_rows, 8, 8, 512 / 8, 512 / 8 ); |
| 476 | state->m_tilemap[2] = tilemap_create(machine, sailormn_get_tile_info_2, tilemap_scan_rows, 8, 8, 512 / 8, 512 / 8 ); |
| 504 | 477 | |
| 505 | | tilemap_set_transparent_pen(state->m_tilemap_2, 0); |
| 506 | | tilemap_set_scroll_rows(state->m_tilemap_2, 1); |
| 507 | | tilemap_set_scroll_cols(state->m_tilemap_2, 1); |
| 478 | tilemap_set_transparent_pen(state->m_tilemap[2], 0); |
| 479 | tilemap_set_scroll_rows(state->m_tilemap[2], 1); |
| 480 | tilemap_set_scroll_cols(state->m_tilemap[2], 1); |
| 508 | 481 | } |
| 509 | 482 | |
| 510 | 483 | /*************************************************************************** |
| r11160 | r11161 | |
| 1447 | 1420 | |
| 1448 | 1421 | INLINE void cave_tilemap_draw( |
| 1449 | 1422 | running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, |
| 1450 | | tilemap_t *TILEMAP, UINT16 *VRAM, UINT16 *VCTRL, |
| 1451 | | UINT32 flags, UINT32 priority, UINT32 priority2 ) |
| 1423 | UINT32 flags, UINT32 priority, UINT32 priority2, int GFX ) |
| 1452 | 1424 | { |
| 1453 | 1425 | cave_state *state = machine.driver_data<cave_state>(); |
| 1426 | tilemap_t *TILEMAP = state->m_tilemap[GFX]; |
| 1427 | UINT16 *VRAM = state->m_vram[GFX]; |
| 1428 | UINT16 *VCTRL = state->m_vctrl[GFX]; |
| 1454 | 1429 | int sx, sy, flipx, flipy, offs_x, offs_y, offs_row; |
| 1455 | 1430 | |
| 1456 | 1431 | /* Bail out if ... */ |
| r11160 | r11161 | |
| 1472 | 1447 | /* An additional 8 pixel offset for layers with 8x8 tiles. Plus |
| 1473 | 1448 | Layer 0 is displaced by 1 pixel wrt Layer 1, so is Layer 2 wrt |
| 1474 | 1449 | Layer 1 */ |
| 1475 | | if (TILEMAP == state->m_tilemap_0) offs_x -= (state->m_tiledim_0 ? 1 : (1 + 8)); |
| 1476 | | else if (TILEMAP == state->m_tilemap_1) offs_x -= (state->m_tiledim_1 ? 2 : (2 + 8)); |
| 1477 | | else if (TILEMAP == state->m_tilemap_2) offs_x -= (state->m_tiledim_2 ? 3 : (3 + 8)); |
| 1478 | | else if (TILEMAP == state->m_tilemap_3) offs_x -= (state->m_tiledim_3 ? 4 : (4 + 8)); |
| 1450 | if (TILEMAP == state->m_tilemap[0]) offs_x -= (state->m_tiledim[0] ? 1 : (1 + 8)); |
| 1451 | else if (TILEMAP == state->m_tilemap[1]) offs_x -= (state->m_tiledim[1] ? 2 : (2 + 8)); |
| 1452 | else if (TILEMAP == state->m_tilemap[2]) offs_x -= (state->m_tiledim[2] ? 3 : (3 + 8)); |
| 1453 | else if (TILEMAP == state->m_tilemap[3]) offs_x -= (state->m_tiledim[3] ? 4 : (4 + 8)); |
| 1479 | 1454 | |
| 1480 | 1455 | sx = VCTRL[0] - state->m_videoregs[0] + (flipx ? (offs_x + 2) : -offs_x); |
| 1481 | 1456 | sy = VCTRL[1] - state->m_videoregs[1] + (flipy ? (offs_y + 2) : -offs_y); |
| r11160 | r11161 | |
| 1565 | 1540 | } |
| 1566 | 1541 | } |
| 1567 | 1542 | |
| 1568 | | static void cave_tilemap_0_draw( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT32 flags, UINT32 priority, UINT32 priority2 ) |
| 1569 | | { |
| 1570 | | cave_state *state = machine.driver_data<cave_state>(); |
| 1571 | | cave_tilemap_draw(machine, bitmap, cliprect, state->m_tilemap_0, state->m_vram_0, state->m_vctrl_0, flags, priority, priority2); |
| 1572 | | } |
| 1573 | 1543 | |
| 1574 | | static void cave_tilemap_1_draw( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT32 flags, UINT32 priority, UINT32 priority2 ) |
| 1575 | | { |
| 1576 | | cave_state *state = machine.driver_data<cave_state>(); |
| 1577 | | cave_tilemap_draw(machine, bitmap, cliprect, state->m_tilemap_1, state->m_vram_1, state->m_vctrl_1, flags, priority, priority2); |
| 1578 | | } |
| 1579 | | |
| 1580 | | static void cave_tilemap_2_draw( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT32 flags, UINT32 priority, UINT32 priority2 ) |
| 1581 | | { |
| 1582 | | cave_state *state = machine.driver_data<cave_state>(); |
| 1583 | | cave_tilemap_draw(machine, bitmap, cliprect, state->m_tilemap_2, state->m_vram_2, state->m_vctrl_2, flags, priority, priority2); |
| 1584 | | } |
| 1585 | | |
| 1586 | | static void cave_tilemap_3_draw( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT32 flags, UINT32 priority, UINT32 priority2 ) |
| 1587 | | { |
| 1588 | | cave_state *state = machine.driver_data<cave_state>(); |
| 1589 | | cave_tilemap_draw(machine, bitmap, cliprect, state->m_tilemap_3, state->m_vram_3, state->m_vctrl_3, flags, priority, priority2); |
| 1590 | | } |
| 1591 | | |
| 1592 | | |
| 1593 | 1544 | SCREEN_UPDATE( cave ) |
| 1594 | 1545 | { |
| 1595 | 1546 | cave_state *state = screen->machine().driver_data<cave_state>(); |
| 1596 | | int pri, pri2; |
| 1547 | int pri, pri2, GFX; |
| 1597 | 1548 | int layers_ctrl = -1; |
| 1598 | 1549 | |
| 1599 | 1550 | set_pens(screen->machine()); |
| r11160 | r11161 | |
| 1602 | 1553 | state->m_blit.line_offset = bitmap->rowpixels * bitmap->bpp / 8; |
| 1603 | 1554 | |
| 1604 | 1555 | /* Choose the tilemap to display (8x8 tiles or 16x16 tiles) */ |
| 1605 | | if (state->m_tilemap_0) |
| 1556 | for (GFX = 0; GFX < 4; GFX++) |
| 1606 | 1557 | { |
| 1607 | | state->m_tiledim_0 = state->m_vctrl_0[1] & 0x2000; |
| 1608 | | if (state->m_tiledim_0 != state->m_old_tiledim_0) |
| 1609 | | tilemap_mark_all_tiles_dirty(state->m_tilemap_0); |
| 1610 | | state->m_old_tiledim_0 = state->m_tiledim_0; |
| 1558 | if (state->m_tilemap[GFX]) |
| 1559 | { |
| 1560 | state->m_tiledim[GFX] = state->m_vctrl[0][1] & 0x2000; |
| 1561 | if (state->m_tiledim[GFX] != state->m_old_tiledim[GFX]) |
| 1562 | tilemap_mark_all_tiles_dirty(state->m_tilemap[GFX]); |
| 1563 | state->m_old_tiledim[GFX] = state->m_tiledim[GFX]; |
| 1564 | } |
| 1611 | 1565 | } |
| 1612 | 1566 | |
| 1613 | | if (state->m_tilemap_1) |
| 1614 | | { |
| 1615 | | state->m_tiledim_1 = state->m_vctrl_1[1] & 0x2000; |
| 1616 | | if (state->m_tiledim_1 != state->m_old_tiledim_1) |
| 1617 | | tilemap_mark_all_tiles_dirty(state->m_tilemap_1); |
| 1618 | | state->m_old_tiledim_1 = state->m_tiledim_1; |
| 1619 | | } |
| 1620 | | |
| 1621 | | if (state->m_tilemap_2) |
| 1622 | | { |
| 1623 | | state->m_tiledim_2 = state->m_vctrl_2[1] & 0x2000; |
| 1624 | | if (state->m_tiledim_2 != state->m_old_tiledim_2) |
| 1625 | | tilemap_mark_all_tiles_dirty(state->m_tilemap_2); |
| 1626 | | state->m_old_tiledim_2 = state->m_tiledim_2; |
| 1627 | | } |
| 1628 | | |
| 1629 | | if (state->m_tilemap_3) |
| 1630 | | { |
| 1631 | | state->m_tiledim_3 = state->m_vctrl_3[1] & 0x2000; |
| 1632 | | if (state->m_tiledim_3 != state->m_old_tiledim_3) |
| 1633 | | tilemap_mark_all_tiles_dirty(state->m_tilemap_3); |
| 1634 | | state->m_old_tiledim_3 = state->m_tiledim_3; |
| 1635 | | } |
| 1636 | | |
| 1637 | | |
| 1638 | 1567 | #ifdef MAME_DEBUG |
| 1639 | 1568 | { |
| 1640 | 1569 | if ( input_code_pressed(screen->machine(), KEYCODE_Z) || input_code_pressed(screen->machine(), KEYCODE_X) || input_code_pressed(screen->machine(), KEYCODE_C) || |
| r11160 | r11161 | |
| 1662 | 1591 | state->m_videoregs[4], state->m_videoregs[5], state->m_videoregs[6], state->m_videoregs[7] ); |
| 1663 | 1592 | #endif |
| 1664 | 1593 | /* Show the scroll / flags registers of the selected layer */ |
| 1665 | | if ((state->m_tilemap_0) && (msk & 0x000f)) popmessage("x:%04X y:%04X f:%04X", state->m_vctrl_0[0],state->m_vctrl_0[1],state->m_vctrl_0[2]); |
| 1666 | | if ((state->m_tilemap_1) && (msk & 0x00f0)) popmessage("x:%04X y:%04X f:%04X", state->m_vctrl_1[0],state->m_vctrl_1[1],state->m_vctrl_1[2]); |
| 1667 | | if ((state->m_tilemap_2) && (msk & 0x0f00)) popmessage("x:%04X y:%04X f:%04X", state->m_vctrl_2[0],state->m_vctrl_2[1],state->m_vctrl_2[2]); |
| 1668 | | if ((state->m_tilemap_3) && (msk & 0xf000)) popmessage("x:%04X y:%04X f:%04X", state->m_vctrl_3[0],state->m_vctrl_3[1],state->m_vctrl_3[2]); |
| 1594 | if ((state->m_tilemap[0]) && (msk & 0x000f)) popmessage("x:%04X y:%04X f:%04X", state->m_vctrl[0][0],state->m_vctrl[0][1],state->m_vctrl[0][2]); |
| 1595 | if ((state->m_tilemap[1]) && (msk & 0x00f0)) popmessage("x:%04X y:%04X f:%04X", state->m_vctrl[1][0],state->m_vctrl[1][1],state->m_vctrl[1][2]); |
| 1596 | if ((state->m_tilemap[2]) && (msk & 0x0f00)) popmessage("x:%04X y:%04X f:%04X", state->m_vctrl[2][0],state->m_vctrl[2][1],state->m_vctrl[2][2]); |
| 1597 | if ((state->m_tilemap[3]) && (msk & 0xf000)) popmessage("x:%04X y:%04X f:%04X", state->m_vctrl[3][0],state->m_vctrl[3][1],state->m_vctrl[3][2]); |
| 1669 | 1598 | } |
| 1670 | 1599 | |
| 1671 | 1600 | /* Show the row / "column" scroll enable flags, when they change state */ |
| 1672 | 1601 | state->m_rasflag = 0; |
| 1673 | | if (state->m_tilemap_0) |
| 1602 | for (GFX = 0; GFX < 4; GFX++) |
| 1674 | 1603 | { |
| 1675 | | state->m_rasflag |= (state->m_vctrl_0[0] & 0x4000) ? 0x0001 : 0; |
| 1676 | | state->m_rasflag |= (state->m_vctrl_0[1] & 0x4000) ? 0x0002 : 0; |
| 1604 | if (state->m_tilemap[GFX]) |
| 1605 | { |
| 1606 | state->m_rasflag |= (state->m_vctrl[GFX][0] & 0x4000) ? 0x0001 << (4*GFX) : 0; |
| 1607 | state->m_rasflag |= (state->m_vctrl[GFX][1] & 0x4000) ? 0x0002 << (4*GFX) : 0; |
| 1608 | } |
| 1677 | 1609 | } |
| 1678 | | if (state->m_tilemap_1) |
| 1679 | | { |
| 1680 | | state->m_rasflag |= (state->m_vctrl_1[0] & 0x4000) ? 0x0010 : 0; |
| 1681 | | state->m_rasflag |= (state->m_vctrl_1[1] & 0x4000) ? 0x0020 : 0; |
| 1682 | | } |
| 1683 | | if (state->m_tilemap_2) |
| 1684 | | { |
| 1685 | | state->m_rasflag |= (state->m_vctrl_2[0] & 0x4000) ? 0x0100 : 0; |
| 1686 | | state->m_rasflag |= (state->m_vctrl_2[1] & 0x4000) ? 0x0200 : 0; |
| 1687 | | } |
| 1688 | | if (state->m_tilemap_3) |
| 1689 | | { |
| 1690 | | state->m_rasflag |= (state->m_vctrl_3[0] & 0x4000) ? 0x1000 : 0; |
| 1691 | | state->m_rasflag |= (state->m_vctrl_3[1] & 0x4000) ? 0x2000 : 0; |
| 1692 | | } |
| 1610 | |
| 1693 | 1611 | if (state->m_rasflag != state->m_old_rasflag) |
| 1694 | 1612 | { |
| 1695 | 1613 | popmessage("Line Effect: 0:%c%c 1:%c%c 2:%c%c 3:%c%c", |
| r11160 | r11161 | |
| 1720 | 1638 | */ |
| 1721 | 1639 | for (pri = 0; pri <= 3; pri++) // tile / sprite priority |
| 1722 | 1640 | { |
| 1723 | | if (layers_ctrl & (1 << (pri + 16))) (*state->m_sprite_draw)(screen->machine(), pri); |
| 1641 | if (layers_ctrl & (1 << (pri + 16))) (*state->m_sprite_draw)(screen->machine(), pri); |
| 1724 | 1642 | |
| 1725 | 1643 | for (pri2 = 0; pri2 <= 3; pri2++) // priority of the whole layer |
| 1726 | 1644 | { |
| 1727 | | if (layers_ctrl & (1 << (pri + 0))) cave_tilemap_0_draw(screen->machine(), bitmap, cliprect, pri, 0, pri2); |
| 1728 | | if (layers_ctrl & (1 << (pri + 4))) cave_tilemap_1_draw(screen->machine(), bitmap, cliprect, pri, 0, pri2); |
| 1729 | | if (layers_ctrl & (1 << (pri + 8))) cave_tilemap_2_draw(screen->machine(), bitmap, cliprect, pri, 0, pri2); |
| 1730 | | if (layers_ctrl & (1 << (pri + 12))) cave_tilemap_3_draw(screen->machine(), bitmap, cliprect, pri, 0, pri2); |
| 1645 | if (layers_ctrl & (1 << (pri + 0))) cave_tilemap_draw(screen->machine(), bitmap, cliprect, pri, 0, pri2, 0); |
| 1646 | if (layers_ctrl & (1 << (pri + 4))) cave_tilemap_draw(screen->machine(), bitmap, cliprect, pri, 0, pri2, 1); |
| 1647 | if (layers_ctrl & (1 << (pri + 8))) cave_tilemap_draw(screen->machine(), bitmap, cliprect, pri, 0, pri2, 2); |
| 1648 | if (layers_ctrl & (1 << (pri + 12))) cave_tilemap_draw(screen->machine(), bitmap, cliprect, pri, 0, pri2, 3); |
| 1731 | 1649 | } |
| 1732 | 1650 | } |
| 1733 | 1651 | return 0; |
src/mame/drivers/kaneko16.c
| r11160 | r11161 | |
| 93 | 93 | #include "sound/2151intf.h" |
| 94 | 94 | #include "sound/okim6295.h" |
| 95 | 95 | |
| 96 | | static UINT16* kaneko16_mainram; |
| 97 | 96 | |
| 98 | 97 | /*************************************************************************** |
| 99 | 98 | |
| r11160 | r11161 | |
| 105 | 104 | |
| 106 | 105 | MACHINE_RESET( kaneko16 ) |
| 107 | 106 | { |
| 108 | | kaneko16_sprite_type = 0; |
| 107 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 108 | state->m_sprite_type = 0; |
| 109 | 109 | |
| 110 | | kaneko16_sprite_xoffs = 0; |
| 111 | | kaneko16_sprite_yoffs = 0; |
| 110 | state->m_sprite_xoffs = 0; |
| 111 | state->m_sprite_yoffs = 0; |
| 112 | 112 | |
| 113 | | kaneko16_sprite_fliptype = 0; |
| 113 | state->m_sprite_fliptype = 0; |
| 114 | 114 | |
| 115 | 115 | /* |
| 116 | 116 | Sx = Sprites with priority x, x = tiles with priority x, |
| r11160 | r11161 | |
| 121 | 121 | 0 1 2 S2 3 |
| 122 | 122 | 0 1 2 3 S3 |
| 123 | 123 | */ |
| 124 | | kaneko16_priority.sprite[0] = 1; // above tile[0], below the others |
| 125 | | kaneko16_priority.sprite[1] = 2; // above tile[0-1], below the others |
| 126 | | kaneko16_priority.sprite[2] = 3; // above tile[0-2], below the others |
| 127 | | kaneko16_priority.sprite[3] = 8; // above all |
| 124 | state->m_priority.sprite[0] = 1; // above tile[0], below the others |
| 125 | state->m_priority.sprite[1] = 2; // above tile[0-1], below the others |
| 126 | state->m_priority.sprite[2] = 3; // above tile[0-2], below the others |
| 127 | state->m_priority.sprite[3] = 8; // above all |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | static MACHINE_RESET( berlwall ) |
| 131 | 131 | { |
| 132 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 132 | 133 | MACHINE_RESET_CALL(kaneko16); |
| 133 | 134 | |
| 134 | | kaneko16_sprite_type = 2; // like type 0, but using 16 instead of 8 bytes |
| 135 | state->m_sprite_type = 2; // like type 0, but using 16 instead of 8 bytes |
| 135 | 136 | } |
| 136 | 137 | |
| 137 | 138 | static MACHINE_RESET( blazeon ) |
| 138 | 139 | { |
| 140 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 139 | 141 | MACHINE_RESET_CALL(kaneko16); |
| 140 | 142 | |
| 141 | | kaneko16_sprite_xoffs = 0x10000 - 0x680; |
| 142 | | kaneko16_sprite_yoffs = 0x000; |
| 143 | state->m_sprite_xoffs = 0x10000 - 0x680; |
| 144 | state->m_sprite_yoffs = 0x000; |
| 143 | 145 | |
| 144 | 146 | /* |
| 145 | 147 | Sx = Sprites with priority x, x = tiles with priority x, |
| r11160 | r11161 | |
| 150 | 152 | 0 1 2 3 S2 |
| 151 | 153 | 0 1 2 3 S3 |
| 152 | 154 | */ |
| 153 | | kaneko16_priority.sprite[0] = 1; // above tile[0], below the others |
| 154 | | kaneko16_priority.sprite[1] = 2; // above tile[0-1], below the others |
| 155 | | kaneko16_priority.sprite[2] = 8; // above all |
| 156 | | kaneko16_priority.sprite[3] = 8; // "" |
| 155 | state->m_priority.sprite[0] = 1; // above tile[0], below the others |
| 156 | state->m_priority.sprite[1] = 2; // above tile[0-1], below the others |
| 157 | state->m_priority.sprite[2] = 8; // above all |
| 158 | state->m_priority.sprite[3] = 8; // "" |
| 157 | 159 | } |
| 158 | 160 | |
| 159 | 161 | static MACHINE_RESET( bloodwar ) |
| 160 | 162 | { |
| 161 | | kaneko16_priority.sprite[0] = 2; // ever used ? |
| 162 | | kaneko16_priority.sprite[1] = 3; // character selection / vs. portraits |
| 163 | | kaneko16_priority.sprite[2] = 5; // winning portrait |
| 164 | | kaneko16_priority.sprite[3] = 7; |
| 163 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 164 | state->m_priority.sprite[0] = 2; // ever used ? |
| 165 | state->m_priority.sprite[1] = 3; // character selection / vs. portraits |
| 166 | state->m_priority.sprite[2] = 5; // winning portrait |
| 167 | state->m_priority.sprite[3] = 7; |
| 165 | 168 | |
| 166 | | kaneko16_sprite_type = 1; |
| 169 | state->m_sprite_type = 1; |
| 167 | 170 | |
| 168 | | kaneko16_priority.VIEW2_2_pri = 1; |
| 171 | state->m_priority.VIEW2_2_pri = 1; |
| 169 | 172 | |
| 170 | | toybox_mcu_run = bloodwar_mcu_run; |
| 171 | | toybox_mcu_init(); |
| 173 | state->m_toybox_mcu_run = bloodwar_mcu_run; |
| 174 | toybox_mcu_init(machine); |
| 172 | 175 | } |
| 173 | 176 | |
| 174 | 177 | static MACHINE_RESET( bonkadv ) |
| 175 | 178 | { |
| 176 | | kaneko16_priority.sprite[0] = 2; // ever used ? |
| 177 | | kaneko16_priority.sprite[1] = 3; // volcano lava on level 2 |
| 178 | | kaneko16_priority.sprite[2] = 5; // in-game player |
| 179 | | kaneko16_priority.sprite[3] = 7; // demostration text |
| 179 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 180 | state->m_priority.sprite[0] = 2; // ever used ? |
| 181 | state->m_priority.sprite[1] = 3; // volcano lava on level 2 |
| 182 | state->m_priority.sprite[2] = 5; // in-game player |
| 183 | state->m_priority.sprite[3] = 7; // demostration text |
| 180 | 184 | |
| 181 | | kaneko16_sprite_type = 1; |
| 185 | state->m_sprite_type = 1; |
| 182 | 186 | |
| 183 | | kaneko16_priority.VIEW2_2_pri = 1; |
| 187 | state->m_priority.VIEW2_2_pri = 1; |
| 184 | 188 | |
| 185 | | toybox_mcu_run = bonkadv_mcu_run; |
| 186 | | toybox_mcu_init(); |
| 189 | state->m_toybox_mcu_run = bonkadv_mcu_run; |
| 190 | toybox_mcu_init(machine); |
| 187 | 191 | } |
| 188 | 192 | |
| 189 | 193 | static MACHINE_RESET( bakubrkr ) |
| 190 | 194 | { |
| 195 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 191 | 196 | MACHINE_RESET_CALL(kaneko16); |
| 192 | 197 | |
| 193 | | kaneko16_priority.sprite[0] = 8; // above all |
| 194 | | kaneko16_priority.sprite[1] = 8; // above all |
| 195 | | kaneko16_priority.sprite[2] = 8; // above all |
| 196 | | kaneko16_priority.sprite[3] = 8; // above all |
| 198 | state->m_priority.sprite[0] = 8; // above all |
| 199 | state->m_priority.sprite[1] = 8; // above all |
| 200 | state->m_priority.sprite[2] = 8; // above all |
| 201 | state->m_priority.sprite[3] = 8; // above all |
| 197 | 202 | |
| 198 | | kaneko16_priority.VIEW2_2_pri = 1; |
| 203 | state->m_priority.VIEW2_2_pri = 1; |
| 199 | 204 | } |
| 200 | 205 | |
| 201 | 206 | static MACHINE_RESET( gtmr ) |
| 202 | 207 | { |
| 208 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 203 | 209 | MACHINE_RESET_CALL(kaneko16); |
| 204 | 210 | |
| 205 | | kaneko16_sprite_type = 1; |
| 211 | state->m_sprite_type = 1; |
| 206 | 212 | |
| 207 | | kaneko16_priority.VIEW2_2_pri = 1; |
| 213 | state->m_priority.VIEW2_2_pri = 1; |
| 208 | 214 | |
| 209 | | toybox_mcu_run = gtmr_mcu_run; |
| 210 | | toybox_mcu_init(); |
| 215 | state->m_toybox_mcu_run = gtmr_mcu_run; |
| 216 | toybox_mcu_init(machine); |
| 211 | 217 | } |
| 212 | 218 | |
| 213 | 219 | static MACHINE_RESET( mgcrystl ) |
| 214 | 220 | { |
| 221 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 215 | 222 | MACHINE_RESET_CALL(kaneko16); |
| 216 | 223 | /* |
| 217 | 224 | Sx = Sprites with priority x, x = tiles with priority x, |
| r11160 | r11161 | |
| 229 | 236 | tiles of the 2nd VIEW2 chip always behind sprites? |
| 230 | 237 | |
| 231 | 238 | */ |
| 232 | | kaneko16_priority.sprite[0] = 2; // below all |
| 233 | | kaneko16_priority.sprite[1] = 3; // above tile[0], below the others |
| 234 | | kaneko16_priority.sprite[2] = 5; // above all |
| 235 | | kaneko16_priority.sprite[3] = 7; // "" |
| 239 | state->m_priority.sprite[0] = 2; // below all |
| 240 | state->m_priority.sprite[1] = 3; // above tile[0], below the others |
| 241 | state->m_priority.sprite[2] = 5; // above all |
| 242 | state->m_priority.sprite[3] = 7; // "" |
| 236 | 243 | |
| 237 | | kaneko16_priority.VIEW2_2_pri = 0; |
| 244 | state->m_priority.VIEW2_2_pri = 0; |
| 238 | 245 | } |
| 239 | 246 | |
| 240 | 247 | |
| 241 | 248 | |
| 242 | 249 | static MACHINE_RESET( shogwarr ) |
| 243 | 250 | { |
| 251 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 244 | 252 | MACHINE_RESET_CALL(kaneko16); |
| 245 | 253 | |
| 246 | | kaneko16_sprite_xoffs = 0xa00; |
| 254 | state->m_sprite_xoffs = 0xa00; |
| 247 | 255 | |
| 248 | | kaneko16_sprite_yoffs = -0x40; |
| 256 | state->m_sprite_yoffs = -0x40; |
| 249 | 257 | |
| 250 | | kaneko16_sprite_type = 0; |
| 251 | | kaneko16_sprite_fliptype = 1; |
| 258 | state->m_sprite_type = 0; |
| 259 | state->m_sprite_fliptype = 1; |
| 252 | 260 | |
| 253 | | kaneko16_priority.sprite[0] = 1; // below all |
| 254 | | kaneko16_priority.sprite[1] = 3; // above tile[0], below the others |
| 255 | | kaneko16_priority.sprite[2] = 5; // above all |
| 256 | | kaneko16_priority.sprite[3] = 7; // "" |
| 257 | | kaneko16_priority.VIEW2_2_pri = 0; |
| 261 | state->m_priority.sprite[0] = 1; // below all |
| 262 | state->m_priority.sprite[1] = 3; // above tile[0], below the others |
| 263 | state->m_priority.sprite[2] = 5; // above all |
| 264 | state->m_priority.sprite[3] = 7; // "" |
| 265 | state->m_priority.VIEW2_2_pri = 0; |
| 258 | 266 | |
| 259 | | calc3_mcu_init(); |
| 267 | calc3_mcu_init(machine); |
| 260 | 268 | } |
| 261 | 269 | |
| 262 | 270 | |
| r11160 | r11161 | |
| 366 | 374 | AM_RANGE(0x30e000, 0x30ffff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) // Sprites |
| 367 | 375 | AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_BASE_GENERIC(paletteram) // Palette |
| 368 | 376 | // AM_RANGE(0x480000, 0x480001) AM_RAM // ? |
| 369 | | AM_RANGE(0x500000, 0x500001) AM_READWRITE(kaneko16_bg15_reg_r, kaneko16_bg15_reg_w) AM_BASE(&kaneko16_bg15_reg) // High Color Background |
| 370 | | AM_RANGE(0x580000, 0x580001) AM_READWRITE(kaneko16_bg15_select_r, kaneko16_bg15_select_w) AM_BASE(&kaneko16_bg15_select) |
| 371 | | AM_RANGE(0x600000, 0x60003f) AM_RAM_WRITE(kaneko16_sprites_regs_w) AM_BASE(&kaneko16_sprites_regs) // Sprites Regs |
| 377 | AM_RANGE(0x500000, 0x500001) AM_READWRITE(kaneko16_bg15_reg_r, kaneko16_bg15_reg_w) AM_BASE_MEMBER(kaneko16_state, m_bg15_reg) // High Color Background |
| 378 | AM_RANGE(0x580000, 0x580001) AM_READWRITE(kaneko16_bg15_select_r, kaneko16_bg15_select_w) AM_BASE_MEMBER(kaneko16_state, m_bg15_select) |
| 379 | AM_RANGE(0x600000, 0x60003f) AM_RAM_WRITE(kaneko16_sprites_regs_w) AM_BASE_MEMBER(kaneko16_state, m_sprites_regs) // Sprites Regs |
| 372 | 380 | AM_RANGE(0x680000, 0x680001) AM_READ_PORT("P1") |
| 373 | 381 | AM_RANGE(0x680002, 0x680003) AM_READ_PORT("P2") |
| 374 | 382 | AM_RANGE(0x680004, 0x680005) AM_READ_PORT("SYSTEM") |
| r11160 | r11161 | |
| 379 | 387 | AM_RANGE(0x800200, 0x80021f) AM_DEVREADWRITE("ay2", kaneko16_YM2149_r, kaneko16_YM2149_w) |
| 380 | 388 | AM_RANGE(0x8003fe, 0x8003ff) AM_NOP // for OKI when accessed as .l |
| 381 | 389 | AM_RANGE(0x800400, 0x800401) AM_DEVREADWRITE8_MODERN("oki", okim6295_device, read, write, 0x00ff) |
| 382 | | AM_RANGE(0xc00000, 0xc00fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE(&kaneko16_vram_1) // Layers |
| 383 | | AM_RANGE(0xc01000, 0xc01fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE(&kaneko16_vram_0) // |
| 384 | | AM_RANGE(0xc02000, 0xc02fff) AM_RAM AM_BASE(&kaneko16_vscroll_1) // |
| 385 | | AM_RANGE(0xc03000, 0xc03fff) AM_RAM AM_BASE(&kaneko16_vscroll_0) // |
| 386 | | AM_RANGE(0xd00000, 0xd0001f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE(&kaneko16_layers_0_regs) // Layers Regs |
| 390 | AM_RANGE(0xc00000, 0xc00fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE_MEMBER(kaneko16_state, m_vram[1]) // Layers |
| 391 | AM_RANGE(0xc01000, 0xc01fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE_MEMBER(kaneko16_state, m_vram[0]) // |
| 392 | AM_RANGE(0xc02000, 0xc02fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[1]) // |
| 393 | AM_RANGE(0xc03000, 0xc03fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[0]) // |
| 394 | AM_RANGE(0xd00000, 0xd0001f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE_MEMBER(kaneko16_state, m_layers_0_regs) // Layers Regs |
| 387 | 395 | ADDRESS_MAP_END |
| 388 | 396 | |
| 389 | 397 | |
| r11160 | r11161 | |
| 412 | 420 | AM_RANGE(0x40001e, 0x40001f) AM_DEVWRITE("oki", bakubrkr_oki_bank_sw) // OKI bank Switch |
| 413 | 421 | AM_RANGE(0x400200, 0x40021f) AM_DEVREADWRITE("ay2", kaneko16_YM2149_r,kaneko16_YM2149_w) // Sound |
| 414 | 422 | AM_RANGE(0x400400, 0x400401) AM_DEVREADWRITE8_MODERN("oki", okim6295_device, read, write, 0x00ff) // |
| 415 | | AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE(&kaneko16_vram_1) // Layers 0 |
| 416 | | AM_RANGE(0x501000, 0x501fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE(&kaneko16_vram_0) // |
| 417 | | AM_RANGE(0x502000, 0x502fff) AM_RAM AM_BASE(&kaneko16_vscroll_1) // |
| 418 | | AM_RANGE(0x503000, 0x503fff) AM_RAM AM_BASE(&kaneko16_vscroll_0) // |
| 419 | | AM_RANGE(0x580000, 0x580fff) AM_RAM_WRITE(kaneko16_vram_3_w) AM_BASE(&kaneko16_vram_3) // Layers 1 |
| 420 | | AM_RANGE(0x581000, 0x581fff) AM_RAM_WRITE(kaneko16_vram_2_w) AM_BASE(&kaneko16_vram_2) // |
| 421 | | AM_RANGE(0x582000, 0x582fff) AM_RAM AM_BASE(&kaneko16_vscroll_3) // |
| 422 | | AM_RANGE(0x583000, 0x583fff) AM_RAM AM_BASE(&kaneko16_vscroll_2) // |
| 423 | AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE_MEMBER(kaneko16_state, m_vram[1]) // Layers 0 |
| 424 | AM_RANGE(0x501000, 0x501fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE_MEMBER(kaneko16_state, m_vram[0]) // |
| 425 | AM_RANGE(0x502000, 0x502fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[1]) // |
| 426 | AM_RANGE(0x503000, 0x503fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[0]) // |
| 427 | AM_RANGE(0x580000, 0x580fff) AM_RAM_WRITE(kaneko16_vram_3_w) AM_BASE_MEMBER(kaneko16_state, m_vram[3]) // Layers 1 |
| 428 | AM_RANGE(0x581000, 0x581fff) AM_RAM_WRITE(kaneko16_vram_2_w) AM_BASE_MEMBER(kaneko16_state, m_vram[2]) // |
| 429 | AM_RANGE(0x582000, 0x582fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[3]) // |
| 430 | AM_RANGE(0x583000, 0x583fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[2]) // |
| 423 | 431 | AM_RANGE(0x600000, 0x601fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) // Sprites |
| 424 | 432 | AM_RANGE(0x700000, 0x700fff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_BASE_GENERIC(paletteram) // Palette |
| 425 | | AM_RANGE(0x800000, 0x80001f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE(&kaneko16_layers_0_regs) // Layers 0 Regs |
| 426 | | AM_RANGE(0x900000, 0x90001f) AM_RAM_WRITE(kaneko16_sprites_regs_w) AM_BASE(&kaneko16_sprites_regs ) // Sprites Regs |
| 433 | AM_RANGE(0x800000, 0x80001f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE_MEMBER(kaneko16_state, m_layers_0_regs) // Layers 0 Regs |
| 434 | AM_RANGE(0x900000, 0x90001f) AM_RAM_WRITE(kaneko16_sprites_regs_w) AM_BASE_MEMBER(kaneko16_state, m_sprites_regs ) // Sprites Regs |
| 427 | 435 | AM_RANGE(0xa80000, 0xa80001) AM_READ(watchdog_reset16_r) // Watchdog |
| 428 | | AM_RANGE(0xb00000, 0xb0001f) AM_RAM_WRITE(kaneko16_layers_1_regs_w) AM_BASE(&kaneko16_layers_1_regs) // Layers 1 Regs |
| 436 | AM_RANGE(0xb00000, 0xb0001f) AM_RAM_WRITE(kaneko16_layers_1_regs_w) AM_BASE_MEMBER(kaneko16_state, m_layers_1_regs) // Layers 1 Regs |
| 429 | 437 | AM_RANGE(0xd00000, 0xd00001) AM_WRITE(kaneko16_eeprom_w) // EEPROM |
| 430 | 438 | AM_RANGE(0xe00000, 0xe00001) AM_READ_PORT("P1") |
| 431 | 439 | AM_RANGE(0xe00002, 0xe00003) AM_READ_PORT("P2") |
| r11160 | r11161 | |
| 442 | 450 | AM_RANGE(0x000000, 0x07ffff) AM_ROM // ROM |
| 443 | 451 | AM_RANGE(0x300000, 0x30ffff) AM_RAM // Work RAM |
| 444 | 452 | AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_BASE_GENERIC(paletteram) // Palette |
| 445 | | AM_RANGE(0x600000, 0x600fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE(&kaneko16_vram_1) // Layers 0 |
| 446 | | AM_RANGE(0x601000, 0x601fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE(&kaneko16_vram_0) // |
| 447 | | AM_RANGE(0x602000, 0x602fff) AM_RAM AM_BASE(&kaneko16_vscroll_1) // |
| 448 | | AM_RANGE(0x603000, 0x603fff) AM_RAM AM_BASE(&kaneko16_vscroll_0) // |
| 453 | AM_RANGE(0x600000, 0x600fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE_MEMBER(kaneko16_state, m_vram[1]) // Layers 0 |
| 454 | AM_RANGE(0x601000, 0x601fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE_MEMBER(kaneko16_state, m_vram[0]) // |
| 455 | AM_RANGE(0x602000, 0x602fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[1]) // |
| 456 | AM_RANGE(0x603000, 0x603fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[0]) // |
| 449 | 457 | AM_RANGE(0x700000, 0x700fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) // Sprites |
| 450 | | AM_RANGE(0x800000, 0x80001f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE(&kaneko16_layers_0_regs) // Layers 0 Regs |
| 451 | | AM_RANGE(0x900000, 0x90001f) AM_RAM_WRITE(kaneko16_sprites_regs_w) AM_BASE(&kaneko16_sprites_regs) // Sprites Regs #1 |
| 458 | AM_RANGE(0x800000, 0x80001f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE_MEMBER(kaneko16_state, m_layers_0_regs) // Layers 0 Regs |
| 459 | AM_RANGE(0x900000, 0x90001f) AM_RAM_WRITE(kaneko16_sprites_regs_w) AM_BASE_MEMBER(kaneko16_state, m_sprites_regs) // Sprites Regs #1 |
| 452 | 460 | AM_RANGE(0x980000, 0x98001f) AM_RAM // Sprites Regs #2 |
| 453 | 461 | AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("DSW2_P1") |
| 454 | 462 | AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("DSW1_P2") |
| r11160 | r11161 | |
| 500 | 508 | static ADDRESS_MAP_START( bloodwar, AS_PROGRAM, 16 ) |
| 501 | 509 | AM_RANGE(0x000000, 0x0fffff) AM_ROM // ROM |
| 502 | 510 | AM_RANGE(0x100000, 0x10ffff) AM_RAM // Work RAM |
| 503 | | AM_RANGE(0x200000, 0x20ffff) AM_RAM AM_BASE(&kaneko16_mcu_ram) // Shared With MCU |
| 511 | AM_RANGE(0x200000, 0x20ffff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_mcu_ram) // Shared With MCU |
| 504 | 512 | AM_RANGE(0x2a0000, 0x2a0001) AM_WRITE(toybox_mcu_com0_w) // To MCU ? |
| 505 | 513 | AM_RANGE(0x2b0000, 0x2b0001) AM_WRITE(toybox_mcu_com1_w) |
| 506 | 514 | AM_RANGE(0x2c0000, 0x2c0001) AM_WRITE(toybox_mcu_com2_w) |
| 507 | 515 | AM_RANGE(0x2d0000, 0x2d0001) AM_WRITE(toybox_mcu_com3_w) |
| 508 | 516 | AM_RANGE(0x300000, 0x30ffff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_BASE_GENERIC(paletteram) // Palette |
| 509 | 517 | AM_RANGE(0x400000, 0x401fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) // Sprites |
| 510 | | AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE(&kaneko16_vram_1) // Layers 0 |
| 511 | | AM_RANGE(0x501000, 0x501fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE(&kaneko16_vram_0) // |
| 512 | | AM_RANGE(0x502000, 0x502fff) AM_RAM AM_BASE(&kaneko16_vscroll_1) // |
| 513 | | AM_RANGE(0x503000, 0x503fff) AM_RAM AM_BASE(&kaneko16_vscroll_0) // |
| 514 | | AM_RANGE(0x580000, 0x580fff) AM_RAM_WRITE(kaneko16_vram_3_w) AM_BASE(&kaneko16_vram_3) // Layers 1 |
| 515 | | AM_RANGE(0x581000, 0x581fff) AM_RAM_WRITE(kaneko16_vram_2_w) AM_BASE(&kaneko16_vram_2) // |
| 516 | | AM_RANGE(0x582000, 0x582fff) AM_RAM AM_BASE(&kaneko16_vscroll_3) // |
| 517 | | AM_RANGE(0x583000, 0x583fff) AM_RAM AM_BASE(&kaneko16_vscroll_2) // |
| 518 | | AM_RANGE(0x600000, 0x60001f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE(&kaneko16_layers_0_regs) // Layers 0 Regs |
| 519 | | AM_RANGE(0x680000, 0x68001f) AM_RAM_WRITE(kaneko16_layers_1_regs_w) AM_BASE(&kaneko16_layers_1_regs) // Layers 1 Regs |
| 520 | | AM_RANGE(0x700000, 0x70001f) AM_RAM_WRITE(kaneko16_sprites_regs_w) AM_BASE(&kaneko16_sprites_regs) // Sprites Regs |
| 518 | AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE_MEMBER(kaneko16_state, m_vram[1]) // Layers 0 |
| 519 | AM_RANGE(0x501000, 0x501fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE_MEMBER(kaneko16_state, m_vram[0]) // |
| 520 | AM_RANGE(0x502000, 0x502fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[1]) // |
| 521 | AM_RANGE(0x503000, 0x503fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[0]) // |
| 522 | AM_RANGE(0x580000, 0x580fff) AM_RAM_WRITE(kaneko16_vram_3_w) AM_BASE_MEMBER(kaneko16_state, m_vram[3]) // Layers 1 |
| 523 | AM_RANGE(0x581000, 0x581fff) AM_RAM_WRITE(kaneko16_vram_2_w) AM_BASE_MEMBER(kaneko16_state, m_vram[2]) // |
| 524 | AM_RANGE(0x582000, 0x582fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[3]) // |
| 525 | AM_RANGE(0x583000, 0x583fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[2]) // |
| 526 | AM_RANGE(0x600000, 0x60001f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE_MEMBER(kaneko16_state, m_layers_0_regs) // Layers 0 Regs |
| 527 | AM_RANGE(0x680000, 0x68001f) AM_RAM_WRITE(kaneko16_layers_1_regs_w) AM_BASE_MEMBER(kaneko16_state, m_layers_1_regs) // Layers 1 Regs |
| 528 | AM_RANGE(0x700000, 0x70001f) AM_RAM_WRITE(kaneko16_sprites_regs_w) AM_BASE_MEMBER(kaneko16_state, m_sprites_regs) // Sprites Regs |
| 521 | 529 | AM_RANGE(0x800000, 0x800001) AM_DEVREADWRITE8_MODERN("oki1", okim6295_device, read, write, 0x00ff) |
| 522 | 530 | AM_RANGE(0x880000, 0x880001) AM_DEVREADWRITE8_MODERN("oki2", okim6295_device, read, write, 0x00ff) |
| 523 | 531 | AM_RANGE(0x900000, 0x900039) AM_READWRITE(bloodwar_calc_r, bloodwar_calc_w) |
| r11160 | r11161 | |
| 562 | 570 | static ADDRESS_MAP_START( bonkadv, AS_PROGRAM, 16 ) |
| 563 | 571 | AM_RANGE(0x000000, 0x0fffff) AM_ROM // ROM |
| 564 | 572 | AM_RANGE(0x100000, 0x10ffff) AM_RAM // Work RAM |
| 565 | | AM_RANGE(0x200000, 0x20ffff) AM_RAM AM_BASE(&kaneko16_mcu_ram) // Shared With MCU |
| 573 | AM_RANGE(0x200000, 0x20ffff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_mcu_ram) // Shared With MCU |
| 566 | 574 | AM_RANGE(0x2a0000, 0x2a0001) AM_WRITE(toybox_mcu_com0_w) // To MCU ? |
| 567 | 575 | AM_RANGE(0x2b0000, 0x2b0001) AM_WRITE(toybox_mcu_com1_w) |
| 568 | 576 | AM_RANGE(0x2c0000, 0x2c0001) AM_WRITE(toybox_mcu_com2_w) |
| 569 | 577 | AM_RANGE(0x2d0000, 0x2d0001) AM_WRITE(toybox_mcu_com3_w) |
| 570 | 578 | AM_RANGE(0x300000, 0x30ffff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_BASE_GENERIC(paletteram) // Palette |
| 571 | 579 | AM_RANGE(0x400000, 0x401fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) // Sprites |
| 572 | | AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE(&kaneko16_vram_1) // Layers 0 |
| 573 | | AM_RANGE(0x501000, 0x501fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE(&kaneko16_vram_0) // |
| 574 | | AM_RANGE(0x502000, 0x502fff) AM_RAM AM_BASE(&kaneko16_vscroll_1) // |
| 575 | | AM_RANGE(0x503000, 0x503fff) AM_RAM AM_BASE(&kaneko16_vscroll_0) // |
| 576 | | AM_RANGE(0x580000, 0x580fff) AM_RAM_WRITE(kaneko16_vram_3_w) AM_BASE(&kaneko16_vram_3) // Layers 1 |
| 577 | | AM_RANGE(0x581000, 0x581fff) AM_RAM_WRITE(kaneko16_vram_2_w) AM_BASE(&kaneko16_vram_2) // |
| 578 | | AM_RANGE(0x582000, 0x582fff) AM_RAM AM_BASE(&kaneko16_vscroll_3) // |
| 579 | | AM_RANGE(0x583000, 0x583fff) AM_RAM AM_BASE(&kaneko16_vscroll_2) // |
| 580 | | AM_RANGE(0x600000, 0x60001f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE(&kaneko16_layers_0_regs) // Layers 0 Regs |
| 581 | | AM_RANGE(0x680000, 0x68001f) AM_RAM_WRITE(kaneko16_layers_1_regs_w) AM_BASE(&kaneko16_layers_1_regs) // Layers 1 Regs |
| 582 | | AM_RANGE(0x700000, 0x70001f) AM_RAM_WRITE(kaneko16_sprites_regs_w) AM_BASE(&kaneko16_sprites_regs) // Sprites Regs |
| 580 | AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE_MEMBER(kaneko16_state, m_vram[1]) // Layers 0 |
| 581 | AM_RANGE(0x501000, 0x501fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE_MEMBER(kaneko16_state, m_vram[0]) // |
| 582 | AM_RANGE(0x502000, 0x502fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[1]) // |
| 583 | AM_RANGE(0x503000, 0x503fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[0]) // |
| 584 | AM_RANGE(0x580000, 0x580fff) AM_RAM_WRITE(kaneko16_vram_3_w) AM_BASE_MEMBER(kaneko16_state, m_vram[3]) // Layers 1 |
| 585 | AM_RANGE(0x581000, 0x581fff) AM_RAM_WRITE(kaneko16_vram_2_w) AM_BASE_MEMBER(kaneko16_state, m_vram[2]) // |
| 586 | AM_RANGE(0x582000, 0x582fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[3]) // |
| 587 | AM_RANGE(0x583000, 0x583fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[2]) // |
| 588 | AM_RANGE(0x600000, 0x60001f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE_MEMBER(kaneko16_state, m_layers_0_regs) // Layers 0 Regs |
| 589 | AM_RANGE(0x680000, 0x68001f) AM_RAM_WRITE(kaneko16_layers_1_regs_w) AM_BASE_MEMBER(kaneko16_state, m_layers_1_regs) // Layers 1 Regs |
| 590 | AM_RANGE(0x700000, 0x70001f) AM_RAM_WRITE(kaneko16_sprites_regs_w) AM_BASE_MEMBER(kaneko16_state, m_sprites_regs) // Sprites Regs |
| 583 | 591 | AM_RANGE(0x800000, 0x800001) AM_DEVREADWRITE8_MODERN("oki1", okim6295_device, read, write, 0x00ff) |
| 584 | 592 | AM_RANGE(0x880000, 0x880001) AM_DEVREADWRITE8_MODERN("oki2", okim6295_device, read, write, 0x00ff) |
| 585 | 593 | AM_RANGE(0x900000, 0x900015) AM_READWRITE(galpanib_calc_r,galpanib_calc_w) |
| r11160 | r11161 | |
| 640 | 648 | AM_RANGE(0x0ffffe, 0x0fffff) AM_READ(gtmr_wheel_r) // Wheel Value |
| 641 | 649 | |
| 642 | 650 | AM_RANGE(0x100000, 0x10ffff) AM_RAM // Work RAM |
| 643 | | AM_RANGE(0x200000, 0x20ffff) AM_RAM AM_BASE(&kaneko16_mcu_ram) // Shared With MCU |
| 651 | AM_RANGE(0x200000, 0x20ffff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_mcu_ram) // Shared With MCU |
| 644 | 652 | |
| 645 | 653 | AM_RANGE(0x2a0000, 0x2a0001) AM_WRITE(toybox_mcu_com0_w) // To MCU ? |
| 646 | 654 | AM_RANGE(0x2b0000, 0x2b0001) AM_WRITE(toybox_mcu_com1_w) |
| r11160 | r11161 | |
| 651 | 659 | AM_RANGE(0x310000, 0x327fff) AM_RAM // |
| 652 | 660 | AM_RANGE(0x400000, 0x401fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) // Sprites |
| 653 | 661 | |
| 654 | | AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE(&kaneko16_vram_1) // Layers 0 |
| 655 | | AM_RANGE(0x501000, 0x501fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE(&kaneko16_vram_0) // |
| 656 | | AM_RANGE(0x502000, 0x502fff) AM_RAM AM_BASE(&kaneko16_vscroll_1) // |
| 657 | | AM_RANGE(0x503000, 0x503fff) AM_RAM AM_BASE(&kaneko16_vscroll_0) // |
| 662 | AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE_MEMBER(kaneko16_state, m_vram[1]) // Layers 0 |
| 663 | AM_RANGE(0x501000, 0x501fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE_MEMBER(kaneko16_state, m_vram[0]) // |
| 664 | AM_RANGE(0x502000, 0x502fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[1]) // |
| 665 | AM_RANGE(0x503000, 0x503fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[0]) // |
| 658 | 666 | |
| 659 | | AM_RANGE(0x580000, 0x580fff) AM_RAM_WRITE(kaneko16_vram_3_w) AM_BASE(&kaneko16_vram_3) // Layers 1 |
| 660 | | AM_RANGE(0x581000, 0x581fff) AM_RAM_WRITE(kaneko16_vram_2_w) AM_BASE(&kaneko16_vram_2) // |
| 661 | | AM_RANGE(0x582000, 0x582fff) AM_RAM AM_BASE(&kaneko16_vscroll_3) // |
| 662 | | AM_RANGE(0x583000, 0x583fff) AM_RAM AM_BASE(&kaneko16_vscroll_2) // |
| 667 | AM_RANGE(0x580000, 0x580fff) AM_RAM_WRITE(kaneko16_vram_3_w) AM_BASE_MEMBER(kaneko16_state, m_vram[3]) // Layers 1 |
| 668 | AM_RANGE(0x581000, 0x581fff) AM_RAM_WRITE(kaneko16_vram_2_w) AM_BASE_MEMBER(kaneko16_state, m_vram[2]) // |
| 669 | AM_RANGE(0x582000, 0x582fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[3]) // |
| 670 | AM_RANGE(0x583000, 0x583fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[2]) // |
| 663 | 671 | |
| 664 | | AM_RANGE(0x600000, 0x60000f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE(&kaneko16_layers_0_regs) // Layers 0 Regs |
| 665 | | AM_RANGE(0x680000, 0x68000f) AM_RAM_WRITE(kaneko16_layers_1_regs_w) AM_BASE(&kaneko16_layers_1_regs) // Layers 1 Regs |
| 672 | AM_RANGE(0x600000, 0x60000f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE_MEMBER(kaneko16_state, m_layers_0_regs) // Layers 0 Regs |
| 673 | AM_RANGE(0x680000, 0x68000f) AM_RAM_WRITE(kaneko16_layers_1_regs_w) AM_BASE_MEMBER(kaneko16_state, m_layers_1_regs) // Layers 1 Regs |
| 666 | 674 | |
| 667 | | AM_RANGE(0x700000, 0x70001f) AM_READWRITE(kaneko16_sprites_regs_r, kaneko16_sprites_regs_w) AM_BASE(&kaneko16_sprites_regs) // Sprites Regs |
| 675 | AM_RANGE(0x700000, 0x70001f) AM_READWRITE(kaneko16_sprites_regs_r, kaneko16_sprites_regs_w) AM_BASE_MEMBER(kaneko16_state, m_sprites_regs) // Sprites Regs |
| 668 | 676 | |
| 669 | 677 | AM_RANGE(0x800000, 0x800001) AM_DEVREADWRITE8_MODERN("oki1", okim6295_device, read, write, 0x00ff) // Samples |
| 670 | 678 | AM_RANGE(0x880000, 0x880001) AM_DEVREADWRITE8_MODERN("oki2", okim6295_device, read, write, 0x00ff) |
| r11160 | r11161 | |
| 716 | 724 | AM_RANGE(0x0ffffe, 0x0fffff) AM_READ(gtmr2_wheel_r) // Wheel Value |
| 717 | 725 | |
| 718 | 726 | AM_RANGE(0x100000, 0x10ffff) AM_RAM // Work RAM |
| 719 | | AM_RANGE(0x200000, 0x20ffff) AM_RAM AM_BASE(&kaneko16_mcu_ram) // Shared With MCU |
| 727 | AM_RANGE(0x200000, 0x20ffff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_mcu_ram) // Shared With MCU |
| 720 | 728 | |
| 721 | 729 | AM_RANGE(0x2a0000, 0x2a0001) AM_WRITE(toybox_mcu_com0_w) // To MCU ? |
| 722 | 730 | AM_RANGE(0x2b0000, 0x2b0001) AM_WRITE(toybox_mcu_com1_w) |
| r11160 | r11161 | |
| 727 | 735 | AM_RANGE(0x310000, 0x327fff) AM_RAM // |
| 728 | 736 | AM_RANGE(0x400000, 0x401fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) // Sprites |
| 729 | 737 | |
| 730 | | AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE(&kaneko16_vram_1) // Layers 0 |
| 731 | | AM_RANGE(0x501000, 0x501fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE(&kaneko16_vram_0) // |
| 732 | | AM_RANGE(0x502000, 0x502fff) AM_RAM AM_BASE(&kaneko16_vscroll_1) // |
| 733 | | AM_RANGE(0x503000, 0x503fff) AM_RAM AM_BASE(&kaneko16_vscroll_0) // |
| 738 | AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE_MEMBER(kaneko16_state, m_vram[1]) // Layers 0 |
| 739 | AM_RANGE(0x501000, 0x501fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE_MEMBER(kaneko16_state, m_vram[0]) // |
| 740 | AM_RANGE(0x502000, 0x502fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[1]) // |
| 741 | AM_RANGE(0x503000, 0x503fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[0]) // |
| 734 | 742 | |
| 735 | | AM_RANGE(0x580000, 0x580fff) AM_RAM_WRITE(kaneko16_vram_3_w) AM_BASE(&kaneko16_vram_3) // Layers 1 |
| 736 | | AM_RANGE(0x581000, 0x581fff) AM_RAM_WRITE(kaneko16_vram_2_w) AM_BASE(&kaneko16_vram_2) // |
| 737 | | AM_RANGE(0x582000, 0x582fff) AM_RAM AM_BASE(&kaneko16_vscroll_3) // |
| 738 | | AM_RANGE(0x583000, 0x583fff) AM_RAM AM_BASE(&kaneko16_vscroll_2) // |
| 739 | | AM_RANGE(0x600000, 0x60000f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE(&kaneko16_layers_0_regs) // Layers 0 Regs |
| 743 | AM_RANGE(0x580000, 0x580fff) AM_RAM_WRITE(kaneko16_vram_3_w) AM_BASE_MEMBER(kaneko16_state, m_vram[3]) // Layers 1 |
| 744 | AM_RANGE(0x581000, 0x581fff) AM_RAM_WRITE(kaneko16_vram_2_w) AM_BASE_MEMBER(kaneko16_state, m_vram[2]) // |
| 745 | AM_RANGE(0x582000, 0x582fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[3]) // |
| 746 | AM_RANGE(0x583000, 0x583fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[2]) // |
| 747 | AM_RANGE(0x600000, 0x60000f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE_MEMBER(kaneko16_state, m_layers_0_regs) // Layers 0 Regs |
| 740 | 748 | |
| 741 | | AM_RANGE(0x680000, 0x68000f) AM_RAM_WRITE(kaneko16_layers_1_regs_w) AM_BASE(&kaneko16_layers_1_regs) // Layers 1 Regs |
| 742 | | AM_RANGE(0x700000, 0x70001f) AM_READWRITE(kaneko16_sprites_regs_r, kaneko16_sprites_regs_w) AM_BASE(&kaneko16_sprites_regs) // Sprites Regs |
| 749 | AM_RANGE(0x680000, 0x68000f) AM_RAM_WRITE(kaneko16_layers_1_regs_w) AM_BASE_MEMBER(kaneko16_state, m_layers_1_regs) // Layers 1 Regs |
| 750 | AM_RANGE(0x700000, 0x70001f) AM_READWRITE(kaneko16_sprites_regs_r, kaneko16_sprites_regs_w) AM_BASE_MEMBER(kaneko16_state, m_sprites_regs) // Sprites Regs |
| 743 | 751 | AM_RANGE(0x800000, 0x800001) AM_DEVREADWRITE8_MODERN("oki1", okim6295_device, read, write, 0x00ff) // Samples |
| 744 | 752 | AM_RANGE(0x880000, 0x880001) AM_DEVREADWRITE8_MODERN("oki2", okim6295_device, read, write, 0x00ff) |
| 745 | 753 | |
| r11160 | r11161 | |
| 771 | 779 | AM_RANGE(0x400200, 0x40021f) AM_DEVREADWRITE("ay2", kaneko16_YM2149_r, kaneko16_YM2149_w) |
| 772 | 780 | AM_RANGE(0x400400, 0x400401) AM_DEVREADWRITE8_MODERN("oki", okim6295_device, read, write, 0x00ff) |
| 773 | 781 | AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_BASE_GENERIC(paletteram) // Palette |
| 774 | | AM_RANGE(0x600000, 0x600fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE(&kaneko16_vram_1) // Layers 0 |
| 775 | | AM_RANGE(0x601000, 0x601fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE(&kaneko16_vram_0) // |
| 776 | | AM_RANGE(0x602000, 0x602fff) AM_RAM AM_BASE(&kaneko16_vscroll_1) // |
| 777 | | AM_RANGE(0x603000, 0x603fff) AM_RAM AM_BASE(&kaneko16_vscroll_0) // |
| 778 | | AM_RANGE(0x680000, 0x680fff) AM_RAM_WRITE(kaneko16_vram_3_w) AM_BASE(&kaneko16_vram_3) // Layers 1 |
| 779 | | AM_RANGE(0x681000, 0x681fff) AM_RAM_WRITE(kaneko16_vram_2_w) AM_BASE(&kaneko16_vram_2) // |
| 780 | | AM_RANGE(0x682000, 0x682fff) AM_RAM AM_BASE(&kaneko16_vscroll_3) // |
| 781 | | AM_RANGE(0x683000, 0x683fff) AM_RAM AM_BASE(&kaneko16_vscroll_2) // |
| 782 | AM_RANGE(0x600000, 0x600fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE_MEMBER(kaneko16_state, m_vram[1]) // Layers 0 |
| 783 | AM_RANGE(0x601000, 0x601fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE_MEMBER(kaneko16_state, m_vram[0]) // |
| 784 | AM_RANGE(0x602000, 0x602fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[1]) // |
| 785 | AM_RANGE(0x603000, 0x603fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[0]) // |
| 786 | AM_RANGE(0x680000, 0x680fff) AM_RAM_WRITE(kaneko16_vram_3_w) AM_BASE_MEMBER(kaneko16_state, m_vram[3]) // Layers 1 |
| 787 | AM_RANGE(0x681000, 0x681fff) AM_RAM_WRITE(kaneko16_vram_2_w) AM_BASE_MEMBER(kaneko16_state, m_vram[2]) // |
| 788 | AM_RANGE(0x682000, 0x682fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[3]) // |
| 789 | AM_RANGE(0x683000, 0x683fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[2]) // |
| 782 | 790 | AM_RANGE(0x700000, 0x701fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) // Sprites |
| 783 | | AM_RANGE(0x800000, 0x80001f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE(&kaneko16_layers_0_regs) // Layers 0 Regs |
| 784 | | AM_RANGE(0x900000, 0x90001f) AM_RAM_WRITE(kaneko16_sprites_regs_w) AM_BASE(&kaneko16_sprites_regs) // Sprites Regs |
| 785 | | AM_RANGE(0xb00000, 0xb0001f) AM_RAM_WRITE(kaneko16_layers_1_regs_w) AM_BASE(&kaneko16_layers_1_regs) // Layers 1 Regs |
| 791 | AM_RANGE(0x800000, 0x80001f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE_MEMBER(kaneko16_state, m_layers_0_regs) // Layers 0 Regs |
| 792 | AM_RANGE(0x900000, 0x90001f) AM_RAM_WRITE(kaneko16_sprites_regs_w) AM_BASE_MEMBER(kaneko16_state, m_sprites_regs) // Sprites Regs |
| 793 | AM_RANGE(0xb00000, 0xb0001f) AM_RAM_WRITE(kaneko16_layers_1_regs_w) AM_BASE_MEMBER(kaneko16_state, m_layers_1_regs) // Layers 1 Regs |
| 786 | 794 | AM_RANGE(0xa00000, 0xa00001) AM_READ(watchdog_reset16_r) // Watchdog |
| 787 | 795 | AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("DSW_P1") |
| 788 | 796 | AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("P2") |
| r11160 | r11161 | |
| 831 | 839 | |
| 832 | 840 | static ADDRESS_MAP_START( shogwarr, AS_PROGRAM, 16 ) |
| 833 | 841 | AM_RANGE(0x000000, 0x03ffff) AM_ROM // ROM |
| 834 | | AM_RANGE(0x100000, 0x10ffff) AM_RAM AM_BASE(&kaneko16_mainram) // Work RAM |
| 835 | | AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(calc3_mcu_ram_w) AM_BASE(&kaneko16_mcu_ram) // Shared With MCU |
| 842 | AM_RANGE(0x100000, 0x10ffff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_mainram) // Work RAM |
| 843 | AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(calc3_mcu_ram_w) AM_BASE_MEMBER(kaneko16_state, m_mcu_ram) // Shared With MCU |
| 836 | 844 | AM_RANGE(0x280000, 0x280001) AM_WRITE(calc3_mcu_com0_w) |
| 837 | 845 | AM_RANGE(0x290000, 0x290001) AM_WRITE(calc3_mcu_com1_w) |
| 838 | 846 | AM_RANGE(0x2b0000, 0x2b0001) AM_WRITE(calc3_mcu_com2_w) |
| r11160 | r11161 | |
| 842 | 850 | AM_RANGE(0x400000, 0x400001) AM_DEVREADWRITE8_MODERN("oki1", okim6295_device, read, write, 0x00ff) // Samples |
| 843 | 851 | AM_RANGE(0x480000, 0x480001) AM_DEVREADWRITE8_MODERN("oki2", okim6295_device, read, write, 0x00ff) |
| 844 | 852 | AM_RANGE(0x580000, 0x581fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) // Sprites |
| 845 | | AM_RANGE(0x600000, 0x600fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE(&kaneko16_vram_1) // Layers 0 |
| 846 | | AM_RANGE(0x601000, 0x601fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE(&kaneko16_vram_0) |
| 847 | | AM_RANGE(0x602000, 0x602fff) AM_RAM AM_BASE(&kaneko16_vscroll_1) |
| 848 | | AM_RANGE(0x603000, 0x603fff) AM_RAM AM_BASE(&kaneko16_vscroll_0) |
| 849 | | AM_RANGE(0x800000, 0x80000f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE(&kaneko16_layers_0_regs) // Layers 0 Regs |
| 850 | | AM_RANGE(0x900000, 0x90001f) AM_RAM_WRITE(kaneko16_sprites_regs_w) AM_BASE(&kaneko16_sprites_regs) // Sprites Regs |
| 853 | AM_RANGE(0x600000, 0x600fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE_MEMBER(kaneko16_state, m_vram[1]) // Layers 0 |
| 854 | AM_RANGE(0x601000, 0x601fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE_MEMBER(kaneko16_state, m_vram[0]) |
| 855 | AM_RANGE(0x602000, 0x602fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[1]) |
| 856 | AM_RANGE(0x603000, 0x603fff) AM_RAM AM_BASE_MEMBER(kaneko16_state, m_vscroll[0]) |
| 857 | AM_RANGE(0x800000, 0x80000f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE_MEMBER(kaneko16_state, m_layers_0_regs) // Layers 0 Regs |
| 858 | AM_RANGE(0x900000, 0x90001f) AM_RAM_WRITE(kaneko16_sprites_regs_w) AM_BASE_MEMBER(kaneko16_state, m_sprites_regs) // Sprites Regs |
| 851 | 859 | AM_RANGE(0xa00000, 0xa0007f) AM_READWRITE(bloodwar_calc_r, bloodwar_calc_w) |
| 852 | 860 | AM_RANGE(0xa80000, 0xa80001) AM_READWRITE(watchdog_reset16_r, watchdog_reset16_w) // Watchdog |
| 853 | 861 | AM_RANGE(0xb80000, 0xb80001) AM_READ_PORT("P1") |
| r11160 | r11161 | |
| 1799 | 1807 | 6-7] rte |
| 1800 | 1808 | */ |
| 1801 | 1809 | |
| 1802 | | static MACHINE_CONFIG_START( berlwall, driver_device ) |
| 1810 | static MACHINE_CONFIG_START( berlwall, kaneko16_state ) |
| 1803 | 1811 | |
| 1804 | 1812 | /* basic machine hardware */ |
| 1805 | 1813 | MCFG_CPU_ADD("maincpu", M68000, 12000000) /* MC68000P12 */ |
| r11160 | r11161 | |
| 1845 | 1853 | Bakuretsu Breaker |
| 1846 | 1854 | ***************************************************************************/ |
| 1847 | 1855 | |
| 1848 | | static MACHINE_CONFIG_START( bakubrkr, driver_device ) |
| 1856 | static MACHINE_CONFIG_START( bakubrkr, kaneko16_state ) |
| 1849 | 1857 | |
| 1850 | 1858 | /* basic machine hardware */ |
| 1851 | 1859 | MCFG_CPU_ADD("maincpu", M68000, XTAL_12MHz) /* verified on pcb */ |
| r11160 | r11161 | |
| 1900 | 1908 | 6-7] busy loop |
| 1901 | 1909 | */ |
| 1902 | 1910 | |
| 1903 | | static MACHINE_CONFIG_START( blazeon, driver_device ) |
| 1911 | static MACHINE_CONFIG_START( blazeon, kaneko16_state ) |
| 1904 | 1912 | |
| 1905 | 1913 | /* basic machine hardware */ |
| 1906 | 1914 | MCFG_CPU_ADD("maincpu", M68000,12000000) /* TMP68HC000-12 */ |
| r11160 | r11161 | |
| 1953 | 1961 | VIDEO_UPDATE_AFTER_VBLANK fixes the mangled/wrong colored sprites |
| 1954 | 1962 | */ |
| 1955 | 1963 | |
| 1956 | | static MACHINE_CONFIG_START( gtmr, driver_device ) |
| 1964 | static MACHINE_CONFIG_START( gtmr, kaneko16_state ) |
| 1957 | 1965 | |
| 1958 | 1966 | /* basic machine hardware */ |
| 1959 | 1967 | MCFG_CPU_ADD("gtmr", M68000, XTAL_16MHz) /* verified on pcb */ |
| r11160 | r11161 | |
| 2041 | 2049 | Magical Crystal |
| 2042 | 2050 | ***************************************************************************/ |
| 2043 | 2051 | |
| 2044 | | static MACHINE_CONFIG_START( mgcrystl, driver_device ) |
| 2052 | static MACHINE_CONFIG_START( mgcrystl, kaneko16_state ) |
| 2045 | 2053 | |
| 2046 | 2054 | /* basic machine hardware */ |
| 2047 | 2055 | MCFG_CPU_ADD("maincpu", M68000, XTAL_12MHz) /* verified on pcb */ |
| r11160 | r11161 | |
| 2103 | 2111 | #define SHOGWARR_INTERRUPTS_NUM 3 |
| 2104 | 2112 | static INTERRUPT_GEN( shogwarr_interrupt ) |
| 2105 | 2113 | { |
| 2114 | //kaneko16_state *state = device->machine().driver_data<kaneko16_state>(); |
| 2106 | 2115 | switch ( cpu_getiloops(device) ) |
| 2107 | 2116 | { |
| 2108 | 2117 | case 2: device_set_input_line(device, 2, HOLD_LINE); break; |
| r11160 | r11161 | |
| 2113 | 2122 | |
| 2114 | 2123 | calc3_mcu_run(device->machine()); |
| 2115 | 2124 | break; |
| 2116 | | /*case 0: |
| 2117 | | { |
| 2118 | | // hack, clear this ram address to get into test mode (interrupt would clear it) |
| 2119 | | if (kaneko16_mainram[0x2dfe/2]==0xff00) |
| 2120 | | { |
| 2121 | | kaneko16_mainram[0x2dfe/2]=0x0000; |
| 2122 | | } |
| 2123 | | |
| 2124 | | }*/ |
| 2125 | #if 0 |
| 2126 | case 0: |
| 2127 | { |
| 2128 | // hack, clear this ram address to get into test mode (interrupt would clear it) |
| 2129 | if (state->mainram[0x2dfe/2]==0xff00) |
| 2130 | { |
| 2131 | state->mainram[0x2dfe/2]=0x0000; |
| 2132 | } |
| 2133 | } |
| 2134 | #endif |
| 2125 | 2135 | } |
| 2126 | 2136 | } |
| 2127 | 2137 | |
| r11160 | r11161 | |
| 2159 | 2169 | AM_RANGE(0x00000, 0x3ffff) AM_ROMBANK("bank11") |
| 2160 | 2170 | ADDRESS_MAP_END |
| 2161 | 2171 | |
| 2162 | | static MACHINE_CONFIG_START( shogwarr, driver_device ) |
| 2172 | static MACHINE_CONFIG_START( shogwarr, kaneko16_state ) |
| 2163 | 2173 | |
| 2164 | 2174 | /* basic machine hardware */ |
| 2165 | 2175 | MCFG_CPU_ADD("maincpu", M68000, XTAL_12MHz) |
| r11160 | r11161 | |
| 3843 | 3853 | |
| 3844 | 3854 | static DRIVER_INIT( bloodwar ) |
| 3845 | 3855 | { |
| 3846 | | machine.device<nvram_device>("nvram")->set_base(kaneko16_nvram_save, sizeof(kaneko16_nvram_save)); |
| 3856 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 3857 | machine.device<nvram_device>("nvram")->set_base(state->m_nvram_save, sizeof(state->m_nvram_save)); |
| 3847 | 3858 | DRIVER_INIT_CALL(samplebank); |
| 3848 | 3859 | DRIVER_INIT_CALL(decrypt_toybox_rom); |
| 3849 | 3860 | } |
| 3850 | 3861 | |
| 3851 | 3862 | static DRIVER_INIT( gtmr2 ) |
| 3852 | 3863 | { |
| 3853 | | machine.device<nvram_device>("nvram")->set_base(kaneko16_nvram_save, sizeof(kaneko16_nvram_save)); |
| 3864 | kaneko16_state *state = machine.driver_data<kaneko16_state>(); |
| 3865 | machine.device<nvram_device>("nvram")->set_base(state->m_nvram_save, sizeof(state->m_nvram_save)); |
| 3854 | 3866 | DRIVER_INIT_CALL(samplebank); |
| 3855 | 3867 | DRIVER_INIT_CALL(decrypt_toybox_rom_alt); |
| 3856 | 3868 | } |
src/mame/drivers/majorpkr.c
| r0 | r11161 | |
| 1 | /********************************************************************************** |
| 2 | |
| 3 | Major Poker / Major Joker |
| 4 | 1994 PAL System. |
| 5 | |
| 6 | Driver by Roberto Fresca. |
| 7 | |
| 8 | |
| 9 | Special thanks to Tomasz Slanina & Rob Ragon for their invaluable help. |
| 10 | |
| 11 | *********************************************************************************** |
| 12 | |
| 13 | Hardware Notes: |
| 14 | -------------- |
| 15 | |
| 16 | 1x Z80 @ 6 MHz. (main CPU) |
| 17 | |
| 18 | 1x M6295 @ 1.5 MHz. (4 channel mixing ADPCM voice synthesis). Pin7 high. |
| 19 | |
| 20 | 1x 6845 (CRT Controller) @ 750 kHz. |
| 21 | Hs 15625 Hz |
| 22 | Vs 52.786 Hz |
| 23 | |
| 24 | 2x MB8464 (Video?)8kx8 |
| 25 | 1x MB8416 (NVRAM) 2Kx8 |
| 26 | 1x MB8464 (?) 8kx8 |
| 27 | |
| 28 | 2x 27C040 (Roms P1 & P2) (GFX ROMs). |
| 29 | 2x 27C010 (Roms 3 & 4) (GFX ROMs). |
| 30 | 1x 27C020 (Rom 5) (sound) |
| 31 | 1x 27C512 (Rom 6) (program) |
| 32 | |
| 33 | 1x Xtal @ 12 MHz. |
| 34 | |
| 35 | 4x 8 DIP switches banks. |
| 36 | 2x switches (SW1, SW2). |
| 37 | |
| 38 | 1x 2x10-pin edge connector. |
| 39 | 1x 2x22-pin edge connector. |
| 40 | |
| 41 | |
| 42 | *********************************************************************************** |
| 43 | |
| 44 | PORTS: |
| 45 | ------ |
| 46 | |
| 47 | 00 W ---> ROM bank. |
| 48 | 01 W ---> RAM bank. |
| 49 | 02 W ---> RAM bank. |
| 50 | |
| 51 | 10 R ---> Regular inputs (holds) multiplexed with credits out. |
| 52 | 10 W ---> Writes a kind of watchdog (bit4) and mech counters pulses (bits 0-1-2-3). |
| 53 | 11 R ---> Read input port (remaining controls). |
| 54 | 11 W ---> Writes mux selector. |
| 55 | 12 R ---> Read coin/credits port. |
| 56 | 12 W ---> Video registers: Normal or Up Down screen (bit6 off/on). Also writes 0xFC & 0x11 at CRTC offsets 0x0C & 0x0D (0's if normal). |
| 57 | 13 R ---> Multiplexed port for DIP switches banks. |
| 58 | 13 W ---> Lamps out (array a) |
| 59 | 14 R ---> Freeze. Switch in bit0 that pause the game when active. Just once active, the code loops till the bit resets. |
| 60 | 14 W ---> Lamps out (array b). |
| 61 | |
| 62 | 50 RW ---> OKI6295 (R/W) |
| 63 | |
| 64 | 60 W ---> PSG SN76489/96 initialization routines. (Maybe a leftover for different hardware) |
| 65 | The offset is initialized with the following sequence: 0x9f, 0xbf, 0xdf, 0xff. |
| 66 | |
| 67 | |
| 68 | Pulses - Port 10h. |
| 69 | ------------------ |
| 70 | - bits - |
| 71 | 7654 3210 |
| 72 | ---- ---x Credits Out mech counter. |
| 73 | ---- --x- Credits 3 mech counter. |
| 74 | ---- -x-- Credits 1 mech counter. |
| 75 | ---- x--- Credits 2 mech counter. |
| 76 | ---x ---- Watchdog? (constant writes). (*) |
| 77 | xxx- ---- Unknown. |
| 78 | |
| 79 | (*) Tied to a ULN Opto Triac (pin3 solder side edge connector - Lock Out (100V)) |
| 80 | |
| 81 | |
| 82 | Lamps - Array A - Port 13h. |
| 83 | --------------------------- |
| 84 | - bits - |
| 85 | 7654 3210 |
| 86 | ---- ---x Hold 1 lamp. |
| 87 | ---- --x- Hold 2 lamp. |
| 88 | ---- -x-- Hold 3 lamp. |
| 89 | ---- x--- Hold 4 lamp. |
| 90 | ---x ---- Hold 5 lamp. |
| 91 | --x- ---- Big lamp. |
| 92 | -x-- ---- Small lamp. |
| 93 | x--- ---- Unknown. |
| 94 | |
| 95 | |
| 96 | Lamps - Array B - Port 14h. |
| 97 | --------------------------- |
| 98 | - bits - |
| 99 | 7654 3210 |
| 100 | ---- ---x Bet lamp. |
| 101 | ---- --x- Draw lamp. |
| 102 | ---- -x-- Cancel lamp. |
| 103 | ---- x--- Take lamp. |
| 104 | ---x ---- Double-Up lamp. |
| 105 | --x- ---- Fever lamp. |
| 106 | xx-- ---- Unknown. |
| 107 | |
| 108 | *********************************************************************************** |
| 109 | |
| 110 | Instructions... |
| 111 | (translated from a Japanese flyer) |
| 112 | |
| 113 | Bonus stage: |
| 114 | - 10 fever awarded by three of a kind of 1, 3, or 7. |
| 115 | - 15 fever awarded by four of a kind. |
| 116 | |
| 117 | Slot stage: |
| 118 | - 10 bonus stage awarded by three consecutive 1, 3, or 7. |
| 119 | - 5 bonus stage awarded by four consecutive numbers other than 1, 3, or 7. |
| 120 | |
| 121 | If bonus is awarded while you are in bonus stage, odds will be x4. |
| 122 | Bonus stage & slot stage: You can get triple & fourth fever points, and you |
| 123 | can challenge 3 or 4 times of double-up game by this point. |
| 124 | |
| 125 | .... |
| 126 | |
| 127 | Service Mode: |
| 128 | |
| 129 | F2 to enter the Book/Settings Mode. |
| 130 | HOLD1 to move UP. |
| 131 | HOLD2 to move DOWN. |
| 132 | HOLD3 to move LEFT. |
| 133 | HOLD4 to move RIGHT. |
| 134 | HOLD5 to move next screen / exit. |
| 135 | |
| 136 | You can shortcut the DIP settings pressing "0" in Book Mode. |
| 137 | HOLD5 to exit. |
| 138 | |
| 139 | *********************************************************************************** |
| 140 | |
| 141 | Major Poker: Things that you should know!!! (from "engrish" manual) |
| 142 | ------------------------------------------------------------------- |
| 143 | |
| 144 | The game not stabilise until 10,000 games have been played. As a result, the |
| 145 | actual payout % may exceed the set payout % during this period. After the 10,000 |
| 146 | games the machine will follow the set payout %. |
| 147 | |
| 148 | Original game for your location. |
| 149 | |
| 150 | Analyzer screen #1: Provides you with data regarding games played so far such as |
| 151 | numbers of games, number of fevers, etc... |
| 152 | |
| 153 | Analyzer screen #2: Allows you to adjust various aspects of the game to suit your |
| 154 | location. For example you can increase the number of Fever (this does not affect |
| 155 | the payout %). Also you can make the dealing speed quicker or slower. |
| 156 | |
| 157 | Even if you do not adjust the game it is ready to be played. |
| 158 | |
| 159 | |
| 160 | DIP Switches.... |
| 161 | |
| 162 | .-------------------------------+-----+-----+-----+-----+-----+-----+-----+-----. |
| 163 | | DIP Switches #1 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | |
| 164 | +-------------------------------+-----+-----+-----+-----+-----+-----+-----+-----+ |
| 165 | +-------------------------------+-----+-----+-----+-----+-----+-----+-----+-----+ |
| 166 | | OFF Fixed | OFF | | |
| 167 | +-------------------------------+-----+-----+-----------------------------------+ |
| 168 | | Screen Direction Normal | | OFF | | |
| 169 | | Up Down | | ON | | |
| 170 | +-------------------------------+-----+-----+-----+-----------------------------+ |
| 171 | | Hopper No | | OFF | | |
| 172 | | Yes | | ON | | |
| 173 | +-------------------------------+-----------+-----+-----+-----------------------+ |
| 174 | | Hopper SW Active High | | OFF | | |
| 175 | | Low | | ON | | |
| 176 | +-------------------------------+-----------------+-----+-----+-----------------+ |
| 177 | | Coin Payout Payout SW | | OFF | | |
| 178 | | Automatic | | ON | | |
| 179 | +-------------------------------+-----------------------+-----+-----+-----------+ |
| 180 | | Hold Cancel No | | OFF | | |
| 181 | | Yes | | ON | | |
| 182 | +-------------------------------+-----------------------------+-----+-----+-----+ |
| 183 | | Auto Hold No | | OFF | | |
| 184 | | Yes | | ON | | |
| 185 | +-------------------------------+-----------------------------------+-----+-----+ |
| 186 | | Fever Mode Yes | | OFF | |
| 187 | | No | | ON | |
| 188 | '-------------------------------+-----------------------------------------+-----' |
| 189 | |
| 190 | .-------------------------------+-----+-----+-----+-----+-----+-----+-----+-----. |
| 191 | | DIP Switches #2 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | |
| 192 | +-------------------------------+-----+-----+-----+-----+-----+-----+-----+-----+ |
| 193 | +-------------------------------+-----+-----+-----+-----+-----+-----+-----+-----+ |
| 194 | | Payout % 95% | OFF | OFF | OFF | | |
| 195 | | 90% | ON | OFF | OFF | | |
| 196 | | 85% | OFF | ON | OFF | | |
| 197 | | 80% | ON | ON | OFF | | |
| 198 | | 75% | OFF | OFF | ON | | |
| 199 | | 70% | ON | OFF | ON | | |
| 200 | | 65% | OFF | ON | ON | | |
| 201 | | 60% | ON | ON | ON | | |
| 202 | +-------------------------------+-----+-----+-----+-----+-----+-----------------+ |
| 203 | | Min Bet size 1 | | OFF | OFF | | |
| 204 | | for Fever 3 | | ON | OFF | | |
| 205 | | 5 | | OFF | ON | | |
| 206 | | 10 | | ON | ON | | |
| 207 | +-------------------------------+-----------------+-----+-----+-----+-----+-----+ |
| 208 | | Double-Up Weak | | OFF | OFF | | |
| 209 | | Game Difficulty ... | | ON | OFF | | |
| 210 | | ... | | OFF | ON | | |
| 211 | | Strong | | ON | ON | | |
| 212 | +-------------------------------+-----------------------------+-----+-----+-----+ |
| 213 | | OFF Fixed | | OFF | |
| 214 | '-------------------------------+-----------------------------------------+-----' |
| 215 | |
| 216 | .-------------------------------+-----+-----+-----+-----+-----+-----+-----+-----. |
| 217 | | DIP Switches #3 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | |
| 218 | +-------------------------------+-----+-----+-----+-----+-----+-----+-----+-----+ |
| 219 | +-------------------------------+-----+-----+-----+-----+-----+-----+-----+-----+ |
| 220 | | Key In 1 Coin - 50 Credits | OFF | OFF | OFF | | |
| 221 | | 1 Coin - 5 Credits | ON | OFF | OFF | | |
| 222 | | 1 Coin - 10 Credits | OFF | ON | OFF | | |
| 223 | | 1 Coin - 20 Credits | ON | ON | OFF | | |
| 224 | | 1 Coin - 25 Credits | OFF | OFF | ON | | |
| 225 | | 1 Coin - 40 Credits | ON | OFF | ON | | |
| 226 | | 1 Coin - 60 Credits | OFF | ON | ON | | |
| 227 | | 1 Coin - 100 Credits | ON | ON | ON | | |
| 228 | +-------------------------------+-----+-----+-----+-----+-----+-----+-----------+ |
| 229 | | Coin-A 1 Coin - 5 Credits | | OFF | OFF | OFF | | |
| 230 | | 1 Coin - 1 Credit | | ON | OFF | OFF | | |
| 231 | | 1 Coin - 2 Credits | | OFF | ON | OFF | | |
| 232 | | 1 Coin - 10 Credits | | ON | ON | OFF | | |
| 233 | | 1 Coin - 20 Credits | | OFF | OFF | ON | | |
| 234 | | 1 Coin - 25 Credits | | ON | OFF | ON | | |
| 235 | | 1 Coin - 40 Credits | | OFF | ON | ON | | |
| 236 | | 1 Coin - 50 Credits | | ON | ON | ON | | |
| 237 | +-------------------------------+-----------------+-----+-----+-----+-----+-----+ |
| 238 | | Credit Limit 5000 | | OFF | OFF | |
| 239 | | 10000 | | ON | OFF | |
| 240 | | 20000 | | OFF | ON | |
| 241 | | 30000 | | ON | ON | |
| 242 | '-------------------------------+-----------------------------------+-----+-----' |
| 243 | |
| 244 | .-------------------------------+-----+-----+-----+-----+-----+-----+-----+-----. |
| 245 | | DIP Switches #4 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | |
| 246 | +-------------------------------+-----+-----+-----+-----+-----+-----+-----+-----+ |
| 247 | +-------------------------------+-----+-----+-----+-----+-----+-----+-----+-----+ |
| 248 | | Coin-B 1 Coin - 50 Credits | OFF | OFF | OFF | OFF | | |
| 249 | | 1 Coin - 1 Credit | ON | OFF | OFF | OFF | | |
| 250 | | 1 Coin - 2 Credits | OFF | ON | OFF | OFF | | |
| 251 | | 1 Coin - 4 Credits | ON | ON | OFF | OFF | | |
| 252 | | 1 Coin - 5 Credits | OFF | OFF | ON | OFF | | |
| 253 | | 1 Coin - 10 Credits | ON | OFF | ON | OFF | | |
| 254 | | 1 Coin - 20 Credits | OFF | ON | ON | OFF | | |
| 255 | | 1 Coin - 25 Credits | ON | ON | ON | OFF | | |
| 256 | | 1 Coin - 100 Credits | OFF | OFF | OFF | ON | | |
| 257 | | 2 Coins - 1 Credit | ON | OFF | OFF | ON | | |
| 258 | | 2 Coins - 5 Credits | OFF | ON | OFF | ON | | |
| 259 | | 4 Coins - 1 Credit | ON | ON | OFF | ON | | |
| 260 | | 5 Coins - 1 Credit | OFF | OFF | ON | ON | | |
| 261 | | 5 Coins - 2 Credits | ON | OFF | ON | ON | | |
| 262 | | 10 Coins - 1 Credit | OFF | ON | ON | ON | | |
| 263 | | 20 Coins - 1 Credit | ON | ON | ON | ON | | |
| 264 | +-------------------------------+-----+-----+-----+-----+-----+-----+-----------+ |
| 265 | | Max Bet 20 | | OFF | OFF | | |
| 266 | | 10 | | ON | OFF | | |
| 267 | | 30 | | OFF | ON | | |
| 268 | | 50 | | ON | ON | | |
| 269 | +-------------------------------+-----------------------+-----+-----+-----+-----+ |
| 270 | | Credit-In Limit No Limit | | OFF | OFF | |
| 271 | | 1000 | | ON | OFF | |
| 272 | | 2000 | | OFF | ON | |
| 273 | | 5000 | | ON | ON | |
| 274 | '-------------------------------+-----------------------------------+-----+-----' |
| 275 | |
| 276 | |
| 277 | *********************************************************************************** |
| 278 | |
| 279 | Power Supply edge connector Layout... |
| 280 | |
| 281 | .-----------------------+-+--+---------------------------. |
| 282 | | Components side |L|PN| Solder side | |
| 283 | +-----------------------+-+--+---------------------------+ |
| 284 | | GND |A|01| GND | |
| 285 | | GND |B|02| GND | |
| 286 | | +5V |C|03| +5V | |
| 287 | | +5V |D|04| +5V | |
| 288 | | Lamp BET |E|05| Lamp HOLD 1 | |
| 289 | | +12V |F|06| +12V | |
| 290 | | Lamp DEAL |H|07| Lamp HOLD 2 | |
| 291 | | Lamp CANCEL |J|08| Lamp HOLD 3 | |
| 292 | | Lamp TAKE SCORE |K|09| Lamp HOLD 4 | |
| 293 | | Lamp DOUBLE UP |L|10| Lamp HOLD 5 | |
| 294 | '-----------------------+-+--+---------------------------' |
| 295 | |
| 296 | Edge connector Layout... |
| 297 | |
| 298 | .-----------------------+-+--+---------------------------. |
| 299 | | Components side |L|PN| Solder side | |
| 300 | +-----------------------+-+--+---------------------------+ |
| 301 | | Out Counter |A|01| AC 100V In | |
| 302 | | Key In Counter |B|02| AC Out to Hopper | |
| 303 | | Coin In Counter A |C|03| Lock Out (100V) | |
| 304 | | Sound GND |D|04| Sound Out | |
| 305 | | HOLD 5 / SMALL |E|05| Payout | |
| 306 | | Key In |F|06| HOLD 2 | |
| 307 | | HOLD 3 |H|07| Coin B In | |
| 308 | | HOLD 4 |J|08| HOLD 1 / BIG | |
| 309 | | |K|09| RED (TV) | |
| 310 | | |L|10| GREEN (TV) | |
| 311 | | TAKE SCORE |M|11| Sync (TV) | |
| 312 | | DOUBLE UP |N|12| BLUE (TV) | |
| 313 | | Coin A In |P|13| DEAL | |
| 314 | | CANCEL |R|14| Analyzer (Books/Settings) | |
| 315 | | * SW2 (Clear Meters) |S|15| BET | |
| 316 | | Coin In Counter |T|16| Out of Fever Lamp | |
| 317 | | ** GND |U|17| GND ** | |
| 318 | | ** GND |V|18| GND ** | |
| 319 | | |W|19| GND | |
| 320 | | |X|20| | |
| 321 | | Hopper Limited SW |Y|21| Hopper Payout | |
| 322 | | |Z|22| | |
| 323 | '-----------------------+-+--+---------------------------' |
| 324 | |
| 325 | * Soft SW2 Extension. Traced (undocumented). |
| 326 | ** Edge connector pins U, V, 17 and 18 (GND), are tied |
| 327 | to Power Supply edge connector pins A, B, 01 and 02. |
| 328 | |
| 329 | *********************************************************************************** |
| 330 | |
| 331 | Book / Settings Mode: |
| 332 | --------------------- |
| 333 | |
| 334 | First Screen (Books & Meters): |
| 335 | |
| 336 | 5C 0 F5C 0 |
| 337 | RF 0 FRF 0 |
| 338 | SF 0 FSF 0 |
| 339 | 4C 0 F4C 0 |
| 340 | FH 0 FFH 0 |
| 341 | FL 0 FFL 0 |
| 342 | ST 0 FST 0 |
| 343 | 3C 0 F3C 0 |
| 344 | 2P 0 F2P 0 |
| 345 | |
| 346 | MAIN GAMES 0 |
| 347 | FEVER GAMES 0 |
| 348 | FEVER OUT 0 |
| 349 | S-FEVER GAMES 0 |
| 350 | S-FEVER OUT 0 |
| 351 | TOTAL BET 0 |
| 352 | TOTAL SCORE 0 |
| 353 | SCORE%BET 0% |
| 354 | W-UP IN 0 |
| 355 | W-UP OUT 0 |
| 356 | W-UP OUT%IN 0% |
| 357 | CREDIT IN 0 |
| 358 | CREDIT OUT 0 |
| 359 | CREDIT OUT%IN 0% |
| 360 | DOWN COUNT 0 |
| 361 | TOTAL-CREDIT IN 0 |
| 362 | TOTAL-CREDIT OUT 0 |
| 363 | TOTAL-CREDIT IN/OUT 0 |
| 364 | |
| 365 | DATA RESET: In this first screen, press the SW2 to clear all data, |
| 366 | except for the Total Credits meters. |
| 367 | |
| 368 | |
| 369 | Second Screen (Settings): |
| 370 | |
| 371 | MIN NTL MAX |
| 372 | FEVER --------------------*-------------------- |
| 373 | 5 CARD --------------------*-------------------- |
| 374 | ROYAL --------------------*-------------------- |
| 375 | STR-FLUSH --------------------*-------------------- |
| 376 | 4 CARD --------------------*-------------------- |
| 377 | FULL HOUSE --------------------*-------------------- |
| 378 | FLUSH --------------------*-------------------- |
| 379 | STRAIGHT --------------------*-------------------- |
| 380 | 3 CARD --------------------*-------------------- |
| 381 | 2 PAIR --------------------*-------------------- |
| 382 | NORMAL JKR --------------------*-------------------- |
| 383 | FEVER JKR --------------------*-------------------- |
| 384 | DEAL SPEED --------------------*-------------------- |
| 385 | difficult appear easy appear |
| 386 | |
| 387 | HOLD 1 (Up) |
| 388 | HOLD 2 (Down) |
| 389 | HOLD 3 (Left) |
| 390 | HOLD 4 (Right) |
| 391 | HOLD 5 (Next) |
| 392 | |
| 393 | |
| 394 | Third Screen (Settings): |
| 395 | |
| 396 | Memory Switches... |
| 397 | |
| 398 | DEALER OFF ON <--- Girl Dealer. |
| 399 | FVR-ANIMATION OFF ON <--- Fever Screen animation. |
| 400 | DUP-NUDE OFF ON <--- Double-Up Nude. |
| 401 | SLOW-ACTION OFF ON <--- Speed of Cards. |
| 402 | KEY-LOCK OFF ON <--- Lock settings leaving only Books. Other revisions may have "JQKA-1PAIR" (Jacks or Better). |
| 403 | FVR-SLOT OFF ON <--- Fever's number slot. |
| 404 | AMUSEMENT-MODE OFF ON <--- Self explanatory.... |
| 405 | |
| 406 | 1ST BET 1 5 10 20 30 <--- First Bet. |
| 407 | CNT BET 1 5 10 20 30 <--- Second Bet. |
| 408 | |
| 409 | BACK-RGB R 0 1 2 3 4 5 6 7 <--- Background R component (0 = light, 7 = strong) |
| 410 | BACK-RGB G 0 1 2 3 4 5 6 7 <--- Background G component (0 = light, 7 = strong) |
| 411 | BACK-RGB B 0 1 2 3 4 5 6 7 <--- Background B component (0 = light, 7 = strong) |
| 412 | |
| 413 | BACK-PATTERN 0 1 2 3 4 5 6 <--- Background Pattern (0 = None, 1-6 available when dealer is off) |
| 414 | |
| 415 | HOLD 1 (Up) |
| 416 | HOLD 2 (Down) |
| 417 | HOLD 3 (Off) |
| 418 | HOLD 4 (On) |
| 419 | HOLD 5 (Exit) |
| 420 | |
| 421 | |
| 422 | Fourth Screen (DIP switches test): |
| 423 | |
| 424 | DIP Switch test... |
| 425 | |
| 426 | DIPSW-1 00000000 00000000 |
| 427 | DIPSW-2 00000000 00000000 |
| 428 | DIPSW-3 00000000 00000000 |
| 429 | DIPSW-4 00000000 00000000 |
| 430 | |
| 431 | HOLD 5 (Exit) |
| 432 | |
| 433 | Created of DIP Switch (Green) <--- ????? |
| 434 | Test Mode of DIP Switch (White) <--- Show on the fly each DIP switch state. |
| 435 | |
| 436 | *********************************************************************************** |
| 437 | |
| 438 | To Do: |
| 439 | |
| 440 | - Find the input that unlocks the "KEY-LOCK" mode in the settings. |
| 441 | - Proper flip mode. |
| 442 | - Resistors Network. |
| 443 | |
| 444 | **********************************************************************************/ |
| 445 | |
| 446 | #define MASTER_CLOCK XTAL_12MHz |
| 447 | #define CPU_CLOCK (MASTER_CLOCK / 2) /* 6 MHz, measured */ |
| 448 | #define OKI_CLOCK (MASTER_CLOCK / 8) /* 1.5 MHz, measured */ |
| 449 | #define CRTC_CLOCK (MASTER_CLOCK / 16) /* 750 kHz, measured */ |
| 450 | |
| 451 | #include "emu.h" |
| 452 | #include "cpu/z80/z80.h" |
| 453 | #include "video/mc6845.h" |
| 454 | #include "sound/okim6295.h" |
| 455 | #include "machine/nvram.h" |
| 456 | #include "majorpkr.lh" |
| 457 | |
| 458 | |
| 459 | class majorpkr_state : public driver_device |
| 460 | { |
| 461 | public: |
| 462 | majorpkr_state(running_machine &machine, const driver_device_config_base &config) : driver_device(machine, config), oki(*this, "oki") { } |
| 463 | |
| 464 | int m_mux_data; |
| 465 | int m_palette_bank; |
| 466 | int m_vram_bank; |
| 467 | int m_flip_state; |
| 468 | |
| 469 | tilemap_t *m_bg_tilemap, *m_fg_tilemap; |
| 470 | |
| 471 | UINT8 *m_videoram; |
| 472 | |
| 473 | required_device<okim6295_device> oki; |
| 474 | |
| 475 | }; |
| 476 | |
| 477 | |
| 478 | /************************* |
| 479 | * Video Hardware * |
| 480 | *************************/ |
| 481 | |
| 482 | static TILE_GET_INFO( bg_get_tile_info ) |
| 483 | { |
| 484 | majorpkr_state *state = machine.driver_data<majorpkr_state>(); |
| 485 | |
| 486 | int code = state->m_videoram[0x800 + 2 * tile_index] + (state->m_videoram[0x800 + 2 * tile_index + 1] << 8); |
| 487 | |
| 488 | SET_TILE_INFO( |
| 489 | 0, |
| 490 | (code & 0x1fff), |
| 491 | code >> 13, |
| 492 | 0); |
| 493 | } |
| 494 | |
| 495 | static TILE_GET_INFO( fg_get_tile_info ) |
| 496 | { |
| 497 | majorpkr_state *state = machine.driver_data<majorpkr_state>(); |
| 498 | |
| 499 | int code = state->m_videoram[2 * tile_index] + (state->m_videoram[2 * tile_index + 1] << 8); |
| 500 | |
| 501 | SET_TILE_INFO( |
| 502 | 1, |
| 503 | (code & 0x07ff), |
| 504 | code >> 13, |
| 505 | (code & (1 << 12)) ? (TILE_FLIPX|TILE_FLIPY) : 0); |
| 506 | } |
| 507 | |
| 508 | |
| 509 | static VIDEO_START(majorpkr) |
| 510 | { |
| 511 | majorpkr_state *state = machine.driver_data<majorpkr_state>(); |
| 512 | |
| 513 | state->m_bg_tilemap = tilemap_create(machine, bg_get_tile_info, tilemap_scan_rows, 16, 8, 36, 28); |
| 514 | state->m_fg_tilemap = tilemap_create(machine, fg_get_tile_info, tilemap_scan_rows, 16, 8, 36, 28); |
| 515 | tilemap_set_transparent_pen(state->m_fg_tilemap, 0); |
| 516 | |
| 517 | state->machine().generic.paletteram.u8 = auto_alloc_array(machine, UINT8, 4 * 0x800); |
| 518 | |
| 519 | state->m_videoram = auto_alloc_array(machine, UINT8, 4 * 0x800); /* 2 banks in use, but the game clears 4 after boot ... */ |
| 520 | } |
| 521 | |
| 522 | |
| 523 | static SCREEN_UPDATE(majorpkr) |
| 524 | { |
| 525 | majorpkr_state *state = screen->machine().driver_data<majorpkr_state>(); |
| 526 | |
| 527 | bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine())); |
| 528 | |
| 529 | rectangle custom_clip; |
| 530 | |
| 531 | /* The following custom_clip is to exclude the last char column (unused) |
| 532 | form the render. We need more proof about how the video is working. |
| 533 | */ |
| 534 | custom_clip.min_x=cliprect->min_x; |
| 535 | // custom_clip.max_x=cliprect->max_x-16; |
| 536 | custom_clip.max_x=cliprect->max_x; |
| 537 | custom_clip.min_y=cliprect->min_y; |
| 538 | custom_clip.max_y=cliprect->max_y; |
| 539 | |
| 540 | tilemap_draw(bitmap, &custom_clip, state->m_bg_tilemap, 0, 0); |
| 541 | tilemap_draw(bitmap, &custom_clip, state->m_fg_tilemap, 0, 0); |
| 542 | |
| 543 | if (state->m_flip_state == 1) |
| 544 | { |
| 545 | tilemap_set_flip(state->m_bg_tilemap, TILEMAP_FLIPX | TILEMAP_FLIPY); |
| 546 | tilemap_set_flip(state->m_fg_tilemap, TILEMAP_FLIPX | TILEMAP_FLIPY); |
| 547 | } |
| 548 | |
| 549 | return 0; |
| 550 | } |
| 551 | |
| 552 | |
| 553 | /****************************** |
| 554 | * R/W Handlers * |
| 555 | ******************************/ |
| 556 | |
| 557 | static WRITE8_HANDLER(rom_bank_w) |
| 558 | { |
| 559 | memory_set_bank(space->machine(), "rom_bank", data & 0x3); |
| 560 | } |
| 561 | |
| 562 | |
| 563 | static WRITE8_HANDLER(palette_bank_w) |
| 564 | { |
| 565 | majorpkr_state *state = space->machine().driver_data<majorpkr_state>(); |
| 566 | |
| 567 | state->m_palette_bank=data; |
| 568 | } |
| 569 | |
| 570 | |
| 571 | static READ8_HANDLER(paletteram_r) |
| 572 | { |
| 573 | majorpkr_state *state = space->machine().driver_data<majorpkr_state>(); |
| 574 | return state->machine().generic.paletteram.u8[state->m_palette_bank * 0x800 + offset]; |
| 575 | } |
| 576 | |
| 577 | static WRITE8_HANDLER(paletteram_w) |
| 578 | { |
| 579 | majorpkr_state *state = space->machine().driver_data<majorpkr_state>(); |
| 580 | state->machine().generic.paletteram.u8[state->m_palette_bank * 0x800 + offset] = data; |
| 581 | |
| 582 | offset >>= 1; |
| 583 | int color = state->machine().generic.paletteram.u8[state->m_palette_bank * 0x800 + offset * 2] + state->machine().generic.paletteram.u8[state->m_palette_bank * 0x800 + offset * 2 + 1] * 256; |
| 584 | palette_set_color(space->machine(), offset + state->m_palette_bank * 256 * 4, MAKE_RGB(pal5bit(color >> 5), pal5bit(color >> 10), pal5bit(color))); |
| 585 | } |
| 586 | |
| 587 | |
| 588 | static WRITE8_HANDLER(vram_bank_w) |
| 589 | { |
| 590 | majorpkr_state *state = space->machine().driver_data<majorpkr_state>(); |
| 591 | state->m_vram_bank = data; |
| 592 | } |
| 593 | |
| 594 | static READ8_HANDLER(vram_r) |
| 595 | { |
| 596 | majorpkr_state *state = space->machine().driver_data<majorpkr_state>(); |
| 597 | return state->m_videoram[state->m_vram_bank * 0x800 + offset]; |
| 598 | } |
| 599 | |
| 600 | static WRITE8_HANDLER(vram_w) |
| 601 | { |
| 602 | majorpkr_state *state = space->machine().driver_data<majorpkr_state>(); |
| 603 | state->m_videoram[state->m_vram_bank * 0x800 + offset] = data; |
| 604 | |
| 605 | if (state->m_vram_bank == 0) |
| 606 | { |
| 607 | tilemap_mark_tile_dirty(state->m_fg_tilemap, offset >> 1); |
| 608 | } |
| 609 | else |
| 610 | { |
| 611 | if (state->m_vram_bank == 1) |
| 612 | { |
| 613 | tilemap_mark_tile_dirty(state->m_bg_tilemap, offset >> 1); |
| 614 | } |
| 615 | else |
| 616 | { |
| 617 | //logerror("accessing vram bank %d (offset = %x , data = %x )\n", state->m_vram_bank, offset,data); |
| 618 | } |
| 619 | } |
| 620 | } |
| 621 | |
| 622 | static WRITE8_HANDLER(vidreg_w) |
| 623 | { |
| 624 | majorpkr_state *state = space->machine().driver_data<majorpkr_state>(); |
| 625 | |
| 626 | /* If bit6 is active, the screen is drawn upside down. |
| 627 | (also 0xfc and 0x11 are written to the CRTC registers 0xc0 and 0xd0) |
| 628 | So, the CRTC display start address = 0xfc11 |
| 629 | */ |
| 630 | if (data & 0x40) |
| 631 | { |
| 632 | /* upside down screen */ |
| 633 | state->m_flip_state = 1; |
| 634 | } |
| 635 | |
| 636 | /* If bit6 is not active, the screen is drawn normally. |
| 637 | (also 0x00 is written to the CRTC registers 0xc0 and 0xd0) |
| 638 | So, the CRTC display start address = 0x0000 |
| 639 | */ |
| 640 | else |
| 641 | { |
| 642 | /* normal screen */ |
| 643 | state->m_flip_state = 0; |
| 644 | } |
| 645 | } |
| 646 | |
| 647 | |
| 648 | /***** Multiplexed Ports *****/ |
| 649 | |
| 650 | static READ8_HANDLER( mux_port_r ) |
| 651 | { |
| 652 | majorpkr_state *state = space->machine().driver_data<majorpkr_state>(); |
| 653 | |
| 654 | switch( (state->m_mux_data & 0xf0) ) /* 00-10-20-30-0F-1F-2F-3F */ |
| 655 | { |
| 656 | case 0x00: return input_port_read(space->machine(), "DSW1"); /* confirmed */ |
| 657 | case 0x10: return input_port_read(space->machine(), "DSW2"); /* confirmed */ |
| 658 | case 0x20: return input_port_read(space->machine(), "DSW3"); /* confirmed */ |
| 659 | case 0x30: return input_port_read(space->machine(), "DSW4"); /* confirmed */ |
| 660 | } |
| 661 | |
| 662 | return 0xff; |
| 663 | } |
| 664 | |
| 665 | static READ8_HANDLER( mux_port2_r ) |
| 666 | { |
| 667 | majorpkr_state *state = space->machine().driver_data<majorpkr_state>(); |
| 668 | |
| 669 | if ((state->m_mux_data & 0x0f) == 4) |
| 670 | { |
| 671 | return input_port_read(space->machine(), "IN0-1"); |
| 672 | } |
| 673 | else |
| 674 | { |
| 675 | return input_port_read(space->machine(), "IN0-0"); |
| 676 | } |
| 677 | } |
| 678 | |
| 679 | static WRITE8_HANDLER( mux_sel_w ) |
| 680 | { |
| 681 | majorpkr_state *state = space->machine().driver_data<majorpkr_state>(); |
| 682 | |
| 683 | state->m_mux_data = data; /* 00-10-20-30-0F-1F-2F-3F */ |
| 684 | } |
| 685 | |
| 686 | |
| 687 | /************************* |
| 688 | * Lamps and Pulses * |
| 689 | *************************/ |
| 690 | |
| 691 | static WRITE8_HANDLER( lamps_a_w ) |
| 692 | { |
| 693 | /* Lamps - Array A. |
| 694 | |
| 695 | - bits - |
| 696 | 7654 3210 |
| 697 | ---- ---x Hold 1 lamp. |
| 698 | ---- --x- Hold 2 lamp. |
| 699 | ---- -x-- Hold 3 lamp. |
| 700 | ---- x--- Hold 4 lamp. |
| 701 | ---x ---- Hold 5 lamp. |
| 702 | --x- ---- Big lamp. |
| 703 | -x-- ---- Small lamp. |
| 704 | x--- ---- Unknown. |
| 705 | */ |
| 706 | output_set_lamp_value(0, (data) & 1); /* Lamp 0: Hold 1 */ |
| 707 | output_set_lamp_value(1, (data >> 1) & 1); /* Lamp 1: Hold 2 */ |
| 708 | output_set_lamp_value(2, (data >> 2) & 1); /* Lamp 2: Hold 3 */ |
| 709 | output_set_lamp_value(3, (data >> 3) & 1); /* Lamp 3: Hold 4 */ |
| 710 | output_set_lamp_value(4, (data >> 4) & 1); /* Lamp 4: Hold 5 */ |
| 711 | output_set_lamp_value(5, (data >> 5) & 1); /* Lamp 5: Big or Small (need identification) */ |
| 712 | output_set_lamp_value(6, (data >> 6) & 1); /* Lamp 6: Big or Small (need identification) */ |
| 713 | |
| 714 | if (data & 0x80) |
| 715 | logerror("Lamps A: Write to 13h: %02x\n", data); |
| 716 | } |
| 717 | |
| 718 | static WRITE8_HANDLER( lamps_b_w ) |
| 719 | { |
| 720 | /* Lamps - Array B. |
| 721 | |
| 722 | - bits - |
| 723 | 7654 3210 |
| 724 | ---- ---x Bet lamp. |
| 725 | ---- --x- Draw lamp. |
| 726 | ---- -x-- Cancel lamp. |
| 727 | ---- x--- Take lamp. |
| 728 | ---x ---- Double-Up lamp. |
| 729 | --x- ---- Fever lamp. |
| 730 | xx-- ---- Unknown. |
| 731 | */ |
| 732 | output_set_lamp_value(7, (data) & 1); /* Lamp 7: Bet */ |
| 733 | output_set_lamp_value(8, (data >> 1) & 1); /* Lamp 8: Draw */ |
| 734 | output_set_lamp_value(9, (data >> 2) & 1); /* Lamp 9: Cancel */ |
| 735 | output_set_lamp_value(10, (data >> 3) & 1); /* Lamp 10: Take */ |
| 736 | output_set_lamp_value(11, (data >> 4) & 1); /* Lamp 11: D-UP */ |
| 737 | output_set_lamp_value(12, (data >> 5) & 1); /* Lamp 12: Fever */ |
| 738 | |
| 739 | if (data & 0xc0) |
| 740 | logerror("Lamps B: Write to 14h: %02x\n", data); |
| 741 | } |
| 742 | |
| 743 | static WRITE8_HANDLER( pulses_w ) |
| 744 | { |
| 745 | /* Pulses... |
| 746 | |
| 747 | - bits - |
| 748 | 7654 3210 |
| 749 | ---- ---x Credits Out mech counter. |
| 750 | ---- --x- Credits 3 mech counter. |
| 751 | ---- -x-- Credits 1 mech counter. |
| 752 | ---- x--- Credits 2 mech counter. |
| 753 | ---x ---- Watchdog? (constant writes). |
| 754 | xxx- ---- Unknown. |
| 755 | */ |
| 756 | coin_counter_w(space->machine(), 3, data & 0x01); /* Credits Out (all) */ |
| 757 | coin_counter_w(space->machine(), 2, data & 0x02); /* Credits 3 */ |
| 758 | coin_counter_w(space->machine(), 0, data & 0x04); /* Credits 1 */ |
| 759 | coin_counter_w(space->machine(), 1, data & 0x08); /* Credits 2 */ |
| 760 | |
| 761 | if (data & 0xe0) |
| 762 | logerror("Pulse: Write to 10h: %02x\n", data); |
| 763 | } |
| 764 | |
| 765 | |
| 766 | /************************* |
| 767 | * Memory map information * |
| 768 | *************************/ |
| 769 | |
| 770 | static ADDRESS_MAP_START( map, AS_PROGRAM, 8 ) |
| 771 | AM_RANGE(0x0000, 0xdfff) AM_ROM |
| 772 | AM_RANGE(0xe000, 0xe7ff) AM_ROM AM_ROMBANK("rom_bank") |
| 773 | AM_RANGE(0xe800, 0xefff) AM_RAM AM_SHARE("nvram") |
| 774 | AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(paletteram_r, paletteram_w) /* 4*4 palettes - 4 banks? */ |
| 775 | AM_RANGE(0xf800, 0xffff) AM_READWRITE(vram_r, vram_w) /* two tilemaps - 2 banks? */ |
| 776 | ADDRESS_MAP_END |
| 777 | |
| 778 | /* |
| 779 | 00 W ---> ROM bank. |
| 780 | 01 W ---> RAM bank. |
| 781 | 02 W ---> RAM bank. |
| 782 | |
| 783 | 10 R ---> Regular inputs (holds) multiplexed with credits out. |
| 784 | 10 W ---> Writes a kind of watchdog (bit4) and mech counters pulses (bits 0-1-2-3). |
| 785 | 11 R ---> Read input port (remaining controls). |
| 786 | 11 W ---> Writes mux selector. |
| 787 | 12 R ---> Read coin/credits port. |
| 788 | 12 W ---> Video registers: Normal or Up Down screen (bit6 off/on). Also writes 0xFC & 0x11 at CRTC offsets 0x0C & 0x0D (0's if normal). |
| 789 | 13 R ---> Multiplexed port for DIP switches banks. |
| 790 | 13 W ---> Lamps out (array a) |
| 791 | 14 R ---> Freeze. Switch in bit0 that pause the game when active. Just once active, the code loops till the bit resets. |
| 792 | 14 W ---> Lamps out (array b). |
| 793 | |
| 794 | 50 RW ---> OKI6295 (RW) |
| 795 | |
| 796 | 60 W ---> PSG SN76489/96 initialization routines. |
| 797 | (Maybe a leftover for different hardware). |
| 798 | */ |
| 799 | static ADDRESS_MAP_START( portmap, AS_IO, 8 ) |
| 800 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 801 | AM_RANGE(0x00, 0x00) AM_WRITE(rom_bank_w) |
| 802 | AM_RANGE(0x01, 0x01) AM_WRITE(palette_bank_w) |
| 803 | AM_RANGE(0x02, 0x02) AM_WRITE(vram_bank_w) |
| 804 | |
| 805 | AM_RANGE(0x10, 0x10) AM_READ(mux_port2_r) /* muxed set of controls */ |
| 806 | AM_RANGE(0x10, 0x10) AM_WRITE(pulses_w) /* kind of watchdog on bit4... mech counters on bits 0-1-2-3 */ |
| 807 | AM_RANGE(0x11, 0x11) AM_READ_PORT("IN1") |
| 808 | AM_RANGE(0x11, 0x11) AM_WRITE(mux_sel_w) /* multiplexer selector */ |
| 809 | AM_RANGE(0x12, 0x12) AM_READ_PORT("IN2") |
| 810 | AM_RANGE(0x12, 0x12) AM_WRITE(vidreg_w) /* video registers: normal or up down screen */ |
| 811 | AM_RANGE(0x13, 0x13) AM_READ(mux_port_r) /* all 4 DIP switches banks multiplexed */ |
| 812 | AM_RANGE(0x13, 0x13) AM_WRITE(lamps_a_w) /* lamps a out */ |
| 813 | AM_RANGE(0x14, 0x14) AM_READ_PORT("TEST") /* "freeze" switch */ |
| 814 | AM_RANGE(0x14, 0x14) AM_WRITE(lamps_b_w) /* lamps b out */ |
| 815 | |
| 816 | // AM_RANGE(0x30, 0x30) AM_DEVWRITE("crtc", mc6845_address_w) |
| 817 | // AM_RANGE(0x31, 0x31) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w) |
| 818 | |
| 819 | AM_RANGE(0x50, 0x50) AM_DEVREADWRITE_MODERN("oki", okim6295_device, read, write) |
| 820 | AM_RANGE(0x60, 0x60) AM_WRITENOP /* leftover from a PSG SN76489/96? */ |
| 821 | ADDRESS_MAP_END |
| 822 | |
| 823 | |
| 824 | /************************* |
| 825 | * Input ports * |
| 826 | *************************/ |
| 827 | |
| 828 | static INPUT_PORTS_START( majorpkr ) |
| 829 | PORT_START("IN0-0") |
| 830 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_POKER_HOLD1 ) |
| 831 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_POKER_HOLD2 ) /* muxed with Key Out */ |
| 832 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_POKER_HOLD3 ) |
| 833 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_POKER_HOLD4 ) |
| 834 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_POKER_HOLD5 ) |
| 835 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_POKER_CANCEL ) |
| 836 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_GAMBLE_HIGH ) PORT_NAME("Big") |
| 837 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_GAMBLE_LOW ) PORT_NAME("Small / DIP Test (In Book Mode)") |
| 838 | |
| 839 | PORT_START("IN0-1") |
| 840 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_GAMBLE_KEYOUT ) /* muxed with HOLD 2 */ |
| 841 | PORT_BIT( 0xfd, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 842 | |
| 843 | PORT_START("IN1") |
| 844 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_POKER_BET ) |
| 845 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_GAMBLE_DEAL ) |
| 846 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_GAMBLE_D_UP ) |
| 847 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_GAMBLE_TAKE ) |
| 848 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Book/Settings Mode") |
| 849 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_GAMBLE_PAYOUT ) |
| 850 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("UNK 1-PAD") |
| 851 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("UNK 2-PAD") |
| 852 | |
| 853 | PORT_START("IN2") |
| 854 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) |
| 855 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) |
| 856 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_GAMBLE_KEYIN) |
| 857 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("SW2 (Clear Short-Term Meters)") |
| 858 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("UNK 4-PAD") |
| 859 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_CODE(KEYCODE_E) PORT_NAME("Manual Payout") |
| 860 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("UNK 5-PAD") |
| 861 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("UNK 6-PAD") |
| 862 | |
| 863 | PORT_START("DSW1") /* multiplexed x4 & inverted */ |
| 864 | PORT_DIPNAME( 0x01, 0x00, "OFF Fixed" ) PORT_DIPLOCATION("DSW1:1") |
| 865 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 866 | PORT_DIPSETTING( 0x01, DEF_STR( On ) ) |
| 867 | PORT_DIPNAME( 0x02, 0x00, "Screen Direction" ) PORT_DIPLOCATION("DSW1:2") /* Activates bit6 at port 0x10 & change CRTC registers */ |
| 868 | PORT_DIPSETTING( 0x00, DEF_STR( Normal ) ) |
| 869 | PORT_DIPSETTING( 0x02, "Up Down" ) |
| 870 | PORT_DIPNAME( 0x04, 0x00, "Payout" ) PORT_DIPLOCATION("DSW1:3") /* Hopper: No / Yes (in the manual) */ |
| 871 | PORT_DIPSETTING( 0x00, "Automatic" ) |
| 872 | PORT_DIPSETTING( 0x04, "Manual" ) |
| 873 | PORT_DIPNAME( 0x08, 0x00, "Hopper SW Active" ) PORT_DIPLOCATION("DSW1:4") |
| 874 | PORT_DIPSETTING( 0x00, DEF_STR( High ) ) |
| 875 | PORT_DIPSETTING( 0x08, DEF_STR( Low ) ) |
| 876 | PORT_DIPNAME( 0x10, 0x00, "Auto Max Bet" ) PORT_DIPLOCATION("DSW1:5") /* Coin Payout: Payout SW / Automatic (in the manual) */ |
| 877 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 878 | PORT_DIPSETTING( 0x10, DEF_STR( On ) ) |
| 879 | PORT_DIPNAME( 0x20, 0x20, "Hold Cancel" ) PORT_DIPLOCATION("DSW1:6") /* Inverse from the manual */ |
| 880 | PORT_DIPSETTING( 0x20, DEF_STR( No ) ) |
| 881 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| 882 | PORT_DIPNAME( 0x40, 0x40, "Auto Hold" ) PORT_DIPLOCATION("DSW1:7") |
| 883 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 884 | PORT_DIPSETTING( 0x40, DEF_STR( On ) ) |
| 885 | PORT_DIPNAME( 0x80, 0x00, "Fever Mode" ) PORT_DIPLOCATION("DSW1:8") |
| 886 | PORT_DIPSETTING( 0x80, DEF_STR( No ) ) |
| 887 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| 888 | |
| 889 | PORT_START("DSW2") /* multiplexed x4 & inverted */ |
| 890 | PORT_DIPNAME( 0x07, 0x00, "Payout %" ) PORT_DIPLOCATION("DSW2:1,2,3") |
| 891 | PORT_DIPSETTING( 0x07, "60%" ) |
| 892 | PORT_DIPSETTING( 0x06, "65%" ) |
| 893 | PORT_DIPSETTING( 0x05, "70%" ) |
| 894 | PORT_DIPSETTING( 0x04, "75%" ) |
| 895 | PORT_DIPSETTING( 0x03, "80%" ) |
| 896 | PORT_DIPSETTING( 0x02, "85%" ) |
| 897 | PORT_DIPSETTING( 0x01, "90%" ) |
| 898 | PORT_DIPSETTING( 0x00, "95%" ) |
| 899 | PORT_DIPNAME( 0x18, 0x00, "Min Bet Size for Fever" ) PORT_DIPLOCATION("DSW2:4,5") |
| 900 | PORT_DIPSETTING( 0x00, "1" ) |
| 901 | PORT_DIPSETTING( 0x08, "3" ) |
| 902 | PORT_DIPSETTING( 0x10, "5" ) |
| 903 | PORT_DIPSETTING( 0x18, "10" ) |
| 904 | PORT_DIPNAME( 0x60, 0x00, "D-UP Game Difficulty" ) PORT_DIPLOCATION("DSW2:6,7") |
| 905 | PORT_DIPSETTING( 0x00, "0 (Weak)" ) |
| 906 | PORT_DIPSETTING( 0x20, "1" ) |
| 907 | PORT_DIPSETTING( 0x40, "2" ) |
| 908 | PORT_DIPSETTING( 0x60, "3 (Strong)" ) |
| 909 | PORT_DIPNAME( 0x80, 0x00, "OFF Fixed" ) PORT_DIPLOCATION("DSW2:8") |
| 910 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 911 | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) |
| 912 | |
| 913 | PORT_START("DSW3") /* multiplexed x4 & inverted */ |
| 914 | PORT_DIPNAME( 0x07, 0x00, "Key In" ) PORT_DIPLOCATION("DSW3:1,2,3") |
| 915 | PORT_DIPSETTING( 0x01, "5 Credits / Pulse" ) |
| 916 | PORT_DIPSETTING( 0x02, "10 Credits / Pulse" ) |
| 917 | PORT_DIPSETTING( 0x03, "20 Credits / Pulse" ) |
| 918 | PORT_DIPSETTING( 0x04, "25 Credits / Pulse" ) |
| 919 | PORT_DIPSETTING( 0x05, "40 Credits / Pulse" ) |
| 920 | PORT_DIPSETTING( 0x00, "50 Credits / Pulse" ) |
| 921 | PORT_DIPSETTING( 0x06, "60 Credits / Pulse" ) |
| 922 | PORT_DIPSETTING( 0x07, "100 Credits / Pulse" ) |
| 923 | PORT_DIPNAME( 0x38, 0x00, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("DSW3:4,5,6") |
| 924 | PORT_DIPSETTING( 0x08, DEF_STR( 1C_1C ) ) |
| 925 | PORT_DIPSETTING( 0x10, DEF_STR( 1C_2C ) ) |
| 926 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_5C ) ) |
| 927 | PORT_DIPSETTING( 0x18, "1 Coin/10 Credits" ) |
| 928 | PORT_DIPSETTING( 0x20, "1 Coin/20 Credits" ) |
| 929 | PORT_DIPSETTING( 0x28, "1 Coin/25 Credits" ) |
| 930 | PORT_DIPSETTING( 0x30, "1 Coin/40 Credits" ) |
| 931 | PORT_DIPSETTING( 0x38, "1 Coin/50 Credits" ) |
| 932 | PORT_DIPNAME( 0xc0, 0x00, "Credit Limit" ) PORT_DIPLOCATION("DSW3:7,8") |
| 933 | PORT_DIPSETTING( 0x00, "5000" ) |
| 934 | PORT_DIPSETTING( 0x40, "10000" ) |
| 935 | PORT_DIPSETTING( 0x80, "20000" ) |
| 936 | PORT_DIPSETTING( 0xc0, "30000" ) |
| 937 | |
| 938 | PORT_START("DSW4") /* multiplexed x4 & inverted */ |
| 939 | PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("DSW4:1,2,3,4") |
| 940 | PORT_DIPSETTING( 0x0f, "20 Coins/1 Credit" ) |
| 941 | PORT_DIPSETTING( 0x0e, "10 Coins/1 Credit" ) |
| 942 | PORT_DIPSETTING( 0x0c, DEF_STR( 5C_1C ) ) |
| 943 | PORT_DIPSETTING( 0x0b, DEF_STR( 4C_1C ) ) |
| 944 | PORT_DIPSETTING( 0x0d, "5 Coins/2 Credits" ) |
| 945 | PORT_DIPSETTING( 0x09, DEF_STR( 2C_1C ) ) |
| 946 | PORT_DIPSETTING( 0x01, DEF_STR( 1C_1C ) ) |
| 947 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) ) |
| 948 | PORT_DIPSETTING( 0x0a, DEF_STR( 2C_5C ) ) |
| 949 | PORT_DIPSETTING( 0x03, DEF_STR( 1C_4C ) ) |
| 950 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_5C ) ) |
| 951 | PORT_DIPSETTING( 0x05, "1 Coin/10 Credits" ) |
| 952 | PORT_DIPSETTING( 0x06, "1 Coin/20 Credits" ) |
| 953 | PORT_DIPSETTING( 0x07, "1 Coin/25 Credits" ) |
| 954 | PORT_DIPSETTING( 0x00, "1 Coin/50 Credits" ) |
| 955 | PORT_DIPSETTING( 0x08, "1 Coin/100 Credits" ) |
| 956 | PORT_DIPNAME( 0x30, 0x00, "Max Bet" ) PORT_DIPLOCATION("DSW4:5,6") |
| 957 | PORT_DIPSETTING( 0x10, "10" ) |
| 958 | PORT_DIPSETTING( 0x00, "20" ) |
| 959 | PORT_DIPSETTING( 0x20, "30" ) |
| 960 | PORT_DIPSETTING( 0x30, "50" ) |
| 961 | PORT_DIPNAME( 0xc0, 0x00, "Credit-In Limit" ) PORT_DIPLOCATION("DSW4:7,8") |
| 962 | PORT_DIPSETTING( 0x00, "No Limit" ) |
| 963 | PORT_DIPSETTING( 0x40, "1000" ) |
| 964 | PORT_DIPSETTING( 0x80, "2000" ) |
| 965 | PORT_DIPSETTING( 0xc0, "5000" ) |
| 966 | |
| 967 | PORT_START("TEST") |
| 968 | PORT_DIPNAME( 0x01, 0x00, "Freeze" ) /* Freeze the execution */ |
| 969 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 970 | PORT_DIPSETTING( 0x01, DEF_STR( On ) ) |
| 971 | PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 972 | INPUT_PORTS_END |
| 973 | |
| 974 | |
| 975 | /************************* |
| 976 | * Graphics Layouts * |
| 977 | *************************/ |
| 978 | |
| 979 | static const gfx_layout tilelayout = |
| 980 | { |
| 981 | 16, 8, |
| 982 | RGN_FRAC(1,2), |
| 983 | 8, |
| 984 | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 985 | { |
| 986 | 0*8, 0*8+RGN_FRAC(1,2), 1*8, 1*8+RGN_FRAC(1,2), 2*8, 2*8+RGN_FRAC(1,2), 3*8, 3*8+RGN_FRAC(1,2), |
| 987 | 4*8, 4*8+RGN_FRAC(1,2), 5*8, 5*8+RGN_FRAC(1,2), 6*8, 6*8+RGN_FRAC(1,2), 7*8, 7*8+RGN_FRAC(1,2) |
| 988 | }, |
| 989 | { 0*8*8, 1*8*8, 2*8*8, 3*8*8, 4*8*8, 5*8*8, 6*8*8, 7*8*8 }, |
| 990 | 8*8*8 |
| 991 | }; |
| 992 | |
| 993 | |
| 994 | /****************************** |
| 995 | * Graphics Decode Information * |
| 996 | ******************************/ |
| 997 | |
| 998 | static GFXDECODE_START( majorpkr ) |
| 999 | GFXDECODE_ENTRY( "gfx1", 0, tilelayout, 8*256, 8 ) |
| 1000 | GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 0, 8 ) |
| 1001 | GFXDECODE_END |
| 1002 | |
| 1003 | |
| 1004 | /*********************** |
| 1005 | * CRTC Interface * |
| 1006 | ***********************/ |
| 1007 | |
| 1008 | static const mc6845_interface mc6845_intf = |
| 1009 | { |
| 1010 | "screen", /* screen we are acting on */ |
| 1011 | 16, /* number of pixels per video memory address */ |
| 1012 | NULL, /* before pixel update callback */ |
| 1013 | NULL, /* row update callback */ |
| 1014 | NULL, /* after pixel update callback */ |
| 1015 | DEVCB_NULL, /* callback for display state changes */ |
| 1016 | DEVCB_NULL, /* callback for cursor state changes */ |
| 1017 | DEVCB_NULL, /* HSYNC callback */ |
| 1018 | DEVCB_NULL, /* VSYNC callback */ |
| 1019 | NULL /* update address callback */ |
| 1020 | }; |
| 1021 | |
| 1022 | |
| 1023 | /************************* |
| 1024 | * Machine Drivers * |
| 1025 | *************************/ |
| 1026 | |
| 1027 | static MACHINE_CONFIG_START( majorpkr, majorpkr_state ) |
| 1028 | /* basic machine hardware */ |
| 1029 | MCFG_CPU_ADD("maincpu", Z80, CPU_CLOCK) /* 6 MHz */ |
| 1030 | MCFG_CPU_PROGRAM_MAP(map) |
| 1031 | MCFG_CPU_IO_MAP(portmap) |
| 1032 | MCFG_CPU_VBLANK_INT("screen", irq0_line_hold) |
| 1033 | |
| 1034 | MCFG_NVRAM_ADD_0FILL("nvram") |
| 1035 | |
| 1036 | /* video hardware */ |
| 1037 | MCFG_SCREEN_ADD("screen", RASTER) |
| 1038 | MCFG_SCREEN_REFRESH_RATE(52.786) |
| 1039 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 1040 | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 1041 | MCFG_SCREEN_SIZE((47+1)*16, (36+1)*8) /* through CRTC registers: 768 x 296 */ |
| 1042 | // MCFG_SCREEN_VISIBLE_AREA(0, (36*16)-1, 0, (28*8)-1) /* through CRTC registers: 560(+16) x 224 */ |
| 1043 | MCFG_SCREEN_VISIBLE_AREA(0, (35*16)-1, 0, (28*8)-1) |
| 1044 | |
| 1045 | MCFG_GFXDECODE(majorpkr) |
| 1046 | MCFG_PALETTE_LENGTH(0x100 * 16) |
| 1047 | |
| 1048 | MCFG_VIDEO_START(majorpkr) |
| 1049 | MCFG_SCREEN_UPDATE(majorpkr) |
| 1050 | |
| 1051 | MCFG_MC6845_ADD("crtc", MC6845, CRTC_CLOCK, mc6845_intf) /* verified */ |
| 1052 | |
| 1053 | /* sound hardware */ |
| 1054 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 1055 | MCFG_OKIM6295_ADD("oki", OKI_CLOCK, OKIM6295_PIN7_HIGH) /* clock frequency & pin 7 verified */ |
| 1056 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 1057 | MACHINE_CONFIG_END |
| 1058 | |
| 1059 | |
| 1060 | /************************* |
| 1061 | * Rom Load * |
| 1062 | *************************/ |
| 1063 | |
| 1064 | ROM_START( majorpkr ) |
| 1065 | ROM_REGION( 0x20000, "maincpu", 0 ) |
| 1066 | ROM_LOAD( "6_27c512_823b.bin", 0x00000, 0x0e000, CRC(a3d5475e) SHA1(cb41508b55da8b8c658a2f2ccc6ebda09db29040) ) |
| 1067 | ROM_CONTINUE(0x10000,0x2000) |
| 1068 | |
| 1069 | ROM_REGION( 0x100000, "gfx1", 0 ) |
| 1070 | ROM_LOAD( "p1_27c040_7d3b.bin", 0x00000, 0x80000, CRC(67299eff) SHA1(34d3d8baf08dea495b699dd63272b445e2acb42d) ) |
| 1071 | ROM_LOAD( "p2_27c040_6039.bin", 0x80000, 0x80000, CRC(2d68b177) SHA1(01c934e0383991f2208b915cc5015463a8b6a8fd) ) |
| 1072 | |
| 1073 | ROM_REGION( 0x40000, "gfx2", 0 ) |
| 1074 | ROM_LOAD( "3_27c010_af18.bin", 0x00000, 0x20000, CRC(54452bb8) SHA1(9d13c17b85dd0185ba64fc6f90425e0c75363960) ) |
| 1075 | ROM_LOAD( "4_27c010_92d6.bin", 0x20000, 0x20000, CRC(2e1e0972) SHA1(729dba2ef6ae8a7299c7ceb38835bebb0c42d28e) ) |
| 1076 | |
| 1077 | ROM_REGION( 0x40000, "oki", 0 ) |
| 1078 | ROM_LOAD( "5_27c020_8630.bin", 0x00000, 0x40000, CRC(4843858e) SHA1(27629829cf7753d7801a6eb42bb77ca2a467bebd) ) |
| 1079 | ROM_END |
| 1080 | |
| 1081 | |
| 1082 | /************************* |
| 1083 | * Driver Init * |
| 1084 | *************************/ |
| 1085 | |
| 1086 | static DRIVER_INIT( majorpkr ) |
| 1087 | { |
| 1088 | UINT8 * ROM = (UINT8 *)machine.region("maincpu")->base(); |
| 1089 | memory_configure_bank(machine, "rom_bank", 0, 4, &ROM[0x10000], 0x800); |
| 1090 | } |
| 1091 | |
| 1092 | |
| 1093 | /************************* |
| 1094 | * Game Drivers * |
| 1095 | *************************/ |
| 1096 | |
| 1097 | /* YEAR NAME PARENT MACHINE INPUT INIT ROT COMPANY FULLNAME FLAGS LAYOUT */ |
| 1098 | GAMEL( 1994, majorpkr, 0, majorpkr, majorpkr, majorpkr, ROT0, "PAL System", "Major Poker (v2.0)", 0, layout_majorpkr ) |
src/mame/drivers/namcos21.c
| r11160 | r11161 | |
| 303 | 303 | |
| 304 | 304 | #define PTRAM_SIZE 0x20000 |
| 305 | 305 | |
| 306 | | static UINT16 *winrun_dspbios; |
| 307 | | static UINT16 *winrun_dspcomram; |
| 308 | | #define WINRUN_MAX_POLY_PARAM (1+256*3) |
| 309 | | static UINT16 winrun_poly_buf[WINRUN_MAX_POLY_PARAM]; |
| 310 | | static int winrun_poly_index; |
| 311 | | static UINT32 winrun_pointrom_addr; |
| 312 | | static UINT16 *winrun_polydata; |
| 313 | | static int winrun_dsp_alive; |
| 314 | | static UINT16 *winrun_gpucomram; |
| 315 | | static UINT16 winrun_dspcomram_control[8]; |
| 316 | | static UINT16 namcos21_video_enable; |
| 317 | | |
| 318 | | static UINT8 *pointram; |
| 319 | | static int pointram_idx; |
| 320 | | |
| 321 | | static UINT16 *namcos21_dspram16; |
| 322 | | //UINT16 *namcos21_spritepos; |
| 323 | | |
| 324 | | /* private data */ |
| 325 | | static UINT16 *mpDataROM; |
| 326 | | static UINT16 *mpSharedRAM1; |
| 327 | | static UINT8 *mpDualPortRAM; |
| 328 | | static UINT16 pointram_control; |
| 329 | | |
| 330 | | |
| 331 | 306 | #define ENABLE_LOGGING 0 |
| 332 | 307 | |
| 333 | 308 | |
| 334 | | #define DSP_BUF_MAX (4096*12) |
| 335 | | struct dsp_state |
| 336 | | { |
| 337 | | unsigned masterSourceAddr; |
| 338 | | UINT16 slaveInputBuffer[DSP_BUF_MAX]; |
| 339 | | unsigned slaveBytesAvailable; |
| 340 | | unsigned slaveBytesAdvertised; |
| 341 | | unsigned slaveInputStart; |
| 342 | | UINT16 slaveOutputBuffer[DSP_BUF_MAX]; |
| 343 | | unsigned slaveOutputSize; |
| 344 | | UINT16 masterDirectDrawBuffer[256]; |
| 345 | | unsigned masterDirectDrawSize; |
| 346 | | int masterFinished; |
| 347 | | int slaveActive; |
| 348 | | }; |
| 349 | | static dsp_state *mpDspState; |
| 350 | | |
| 351 | 309 | static INT32 |
| 352 | 310 | ReadPointROMData( running_machine &machine, unsigned offset ) |
| 353 | 311 | { |
| r11160 | r11161 | |
| 358 | 316 | |
| 359 | 317 | static READ16_HANDLER(namcos21_video_enable_r) |
| 360 | 318 | { |
| 361 | | return namcos21_video_enable; |
| 319 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 320 | return state->m_video_enable; |
| 362 | 321 | } |
| 363 | 322 | |
| 364 | 323 | static WRITE16_HANDLER(namcos21_video_enable_w) |
| 365 | 324 | { |
| 366 | | COMBINE_DATA( &namcos21_video_enable ); /* 0x40 = enable */ |
| 367 | | if( namcos21_video_enable!=0 && namcos21_video_enable!=0x40 ) |
| 325 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 326 | COMBINE_DATA( &state->m_video_enable ); /* 0x40 = enable */ |
| 327 | if( state->m_video_enable!=0 && state->m_video_enable!=0x40 ) |
| 368 | 328 | { |
| 369 | | logerror( "unexpected namcos21_video_enable_w=0x%x\n", namcos21_video_enable ); |
| 329 | logerror( "unexpected namcos21_video_enable_w=0x%x\n", state->m_video_enable ); |
| 370 | 330 | } |
| 371 | 331 | } |
| 372 | 332 | |
| r11160 | r11161 | |
| 418 | 378 | } |
| 419 | 379 | |
| 420 | 380 | static void |
| 421 | | TransmitWordToSlave( UINT16 data ) |
| 381 | TransmitWordToSlave( namcos21_state *state, UINT16 data ) |
| 422 | 382 | { |
| 423 | | unsigned offs = mpDspState->slaveInputStart+mpDspState->slaveBytesAvailable++; |
| 424 | | mpDspState->slaveInputBuffer[offs%DSP_BUF_MAX] = data; |
| 425 | | if (ENABLE_LOGGING) logerror( "+%04x(#%04x)\n", data, mpDspState->slaveBytesAvailable ); |
| 426 | | mpDspState->slaveActive = 1; |
| 427 | | if( mpDspState->slaveBytesAvailable >= DSP_BUF_MAX ) |
| 383 | unsigned offs = state->m_mpDspState->slaveInputStart+state->m_mpDspState->slaveBytesAvailable++; |
| 384 | state->m_mpDspState->slaveInputBuffer[offs%DSP_BUF_MAX] = data; |
| 385 | if (ENABLE_LOGGING) logerror( "+%04x(#%04x)\n", data, state->m_mpDspState->slaveBytesAvailable ); |
| 386 | state->m_mpDspState->slaveActive = 1; |
| 387 | if( state->m_mpDspState->slaveBytesAvailable >= DSP_BUF_MAX ) |
| 428 | 388 | { |
| 429 | 389 | logerror( "IDC overflow\n" ); |
| 430 | 390 | exit(1); |
| r11160 | r11161 | |
| 434 | 394 | static void |
| 435 | 395 | TransferDspData( running_machine &machine ) |
| 436 | 396 | { |
| 437 | | UINT16 addr = mpDspState->masterSourceAddr; |
| 397 | namcos21_state *state = machine.driver_data<namcos21_state>(); |
| 398 | UINT16 addr = state->m_mpDspState->masterSourceAddr; |
| 438 | 399 | int mode = addr&0x8000; |
| 439 | 400 | addr&=0x7fff; |
| 440 | 401 | if( addr ) |
| r11160 | r11161 | |
| 443 | 404 | { |
| 444 | 405 | int i; |
| 445 | 406 | UINT16 old = addr; |
| 446 | | UINT16 code = namcos21_dspram16[addr++]; |
| 407 | UINT16 code = state->m_dspram16[addr++]; |
| 447 | 408 | if( code == 0xffff ) |
| 448 | 409 | { |
| 449 | 410 | if( mode ) |
| 450 | 411 | { |
| 451 | | addr = namcos21_dspram16[addr]; |
| 452 | | mpDspState->masterSourceAddr = addr; |
| 412 | addr = state->m_dspram16[addr]; |
| 413 | state->m_mpDspState->masterSourceAddr = addr; |
| 453 | 414 | if (ENABLE_LOGGING) logerror( "LOOP:0x%04x\n", addr ); |
| 454 | 415 | addr&=0x7fff; |
| 455 | 416 | if( old==addr ) |
| r11160 | r11161 | |
| 459 | 420 | } |
| 460 | 421 | else |
| 461 | 422 | { |
| 462 | | mpDspState->masterSourceAddr = 0; |
| 423 | state->m_mpDspState->masterSourceAddr = 0; |
| 463 | 424 | return; |
| 464 | 425 | } |
| 465 | 426 | } |
| 466 | 427 | else if( mode==0 ) |
| 467 | 428 | { /* direct data transfer */ |
| 468 | 429 | if (ENABLE_LOGGING) logerror( "DATA TFR(0x%x)\n", code ); |
| 469 | | TransmitWordToSlave( code ); |
| 430 | TransmitWordToSlave( state, code ); |
| 470 | 431 | for( i=0; i<code; i++ ) |
| 471 | 432 | { |
| 472 | | UINT16 data = namcos21_dspram16[addr++]; |
| 473 | | TransmitWordToSlave( data ); |
| 433 | UINT16 data = state->m_dspram16[addr++]; |
| 434 | TransmitWordToSlave( state, data ); |
| 474 | 435 | } |
| 475 | 436 | } |
| 476 | 437 | else if( code==0x18 || code==0x1a ) |
| 477 | 438 | { |
| 478 | 439 | if (ENABLE_LOGGING) logerror( "HEADER TFR(0x%x)\n", code ); |
| 479 | | TransmitWordToSlave( code+1 ); |
| 440 | TransmitWordToSlave( state, code+1 ); |
| 480 | 441 | for( i=0; i<code; i++ ) |
| 481 | 442 | { |
| 482 | | UINT16 data = namcos21_dspram16[addr++]; |
| 483 | | TransmitWordToSlave( data ); |
| 443 | UINT16 data = state->m_dspram16[addr++]; |
| 444 | TransmitWordToSlave( state, data ); |
| 484 | 445 | } |
| 485 | 446 | } |
| 486 | 447 | else |
| r11160 | r11161 | |
| 488 | 449 | INT32 masterAddr = ReadPointROMData(machine, code); |
| 489 | 450 | if (ENABLE_LOGGING) logerror( "OBJ TFR(0x%x)\n", code ); |
| 490 | 451 | { |
| 491 | | UINT16 len = namcos21_dspram16[addr++]; |
| 452 | UINT16 len = state->m_dspram16[addr++]; |
| 492 | 453 | for(;;) |
| 493 | 454 | { |
| 494 | 455 | int subAddr = ReadPointROMData(machine, masterAddr++); |
| r11160 | r11161 | |
| 501 | 462 | int primWords = (UINT16)ReadPointROMData(machine, subAddr++); |
| 502 | 463 | if( primWords>2 ) |
| 503 | 464 | { |
| 504 | | TransmitWordToSlave( 0 ); /* pad1 */ |
| 505 | | TransmitWordToSlave( len+1 ); |
| 465 | TransmitWordToSlave( state, 0 ); /* pad1 */ |
| 466 | TransmitWordToSlave( state, len+1 ); |
| 506 | 467 | for( i=0; i<len; i++ ) |
| 507 | 468 | { /* transform */ |
| 508 | | TransmitWordToSlave( namcos21_dspram16[addr+i] ); |
| 469 | TransmitWordToSlave( state, state->m_dspram16[addr+i] ); |
| 509 | 470 | } |
| 510 | | TransmitWordToSlave( 0 ); /* pad2 */ |
| 511 | | TransmitWordToSlave( primWords+1 ); |
| 471 | TransmitWordToSlave( state, 0 ); /* pad2 */ |
| 472 | TransmitWordToSlave( state, primWords+1 ); |
| 512 | 473 | for( i=0; i<primWords; i++ ) |
| 513 | 474 | { |
| 514 | | TransmitWordToSlave( (UINT16)ReadPointROMData(machine, subAddr+i) ); |
| 475 | TransmitWordToSlave( state, (UINT16)ReadPointROMData(machine, subAddr+i) ); |
| 515 | 476 | } |
| 516 | 477 | } |
| 517 | 478 | else |
| r11160 | r11161 | |
| 527 | 488 | } |
| 528 | 489 | } /* TransferDspData */ |
| 529 | 490 | |
| 530 | | static int mbNeedsKickstart; |
| 531 | 491 | |
| 532 | | static UINT16 *master_dsp_code; |
| 533 | 492 | |
| 534 | 493 | void |
| 535 | 494 | namcos21_kickstart( running_machine &machine, int internal ) |
| 536 | 495 | { |
| 496 | namcos21_state *state = machine.driver_data<namcos21_state>(); |
| 537 | 497 | /* patch dsp watchdog */ |
| 538 | 498 | switch( namcos2_gametype ) |
| 539 | 499 | { |
| 540 | 500 | case NAMCOS21_AIRCOMBAT: |
| 541 | | master_dsp_code[0x008e] = 0x808f; |
| 501 | state->m_master_dsp_code[0x008e] = 0x808f; |
| 542 | 502 | break; |
| 543 | 503 | case NAMCOS21_SOLVALOU: |
| 544 | | master_dsp_code[0x008b] = 0x808c; |
| 504 | state->m_master_dsp_code[0x008b] = 0x808c; |
| 545 | 505 | break; |
| 546 | 506 | default: |
| 547 | 507 | break; |
| 548 | 508 | } |
| 549 | 509 | if( internal ) |
| 550 | 510 | { |
| 551 | | if( mbNeedsKickstart==0 ) return; |
| 552 | | mbNeedsKickstart--; |
| 553 | | if( mbNeedsKickstart ) return; |
| 511 | if( state->m_mbNeedsKickstart==0 ) return; |
| 512 | state->m_mbNeedsKickstart--; |
| 513 | if( state->m_mbNeedsKickstart ) return; |
| 554 | 514 | } |
| 555 | 515 | |
| 556 | | namcos21_ClearPolyFrameBuffer(); |
| 557 | | mpDspState->masterSourceAddr = 0; |
| 558 | | mpDspState->slaveOutputSize = 0; |
| 559 | | mpDspState->masterFinished = 0; |
| 560 | | mpDspState->slaveActive = 0; |
| 516 | namcos21_ClearPolyFrameBuffer(machine); |
| 517 | state->m_mpDspState->masterSourceAddr = 0; |
| 518 | state->m_mpDspState->slaveOutputSize = 0; |
| 519 | state->m_mpDspState->masterFinished = 0; |
| 520 | state->m_mpDspState->slaveActive = 0; |
| 561 | 521 | cputag_set_input_line(machine, "dspmaster", 0, HOLD_LINE); |
| 562 | 522 | cputag_set_input_line(machine, "dspslave", INPUT_LINE_RESET, PULSE_LINE); |
| 563 | 523 | } |
| r11160 | r11161 | |
| 565 | 525 | static UINT16 |
| 566 | 526 | ReadWordFromSlaveInput( address_space *space ) |
| 567 | 527 | { |
| 528 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 568 | 529 | UINT16 data = 0; |
| 569 | | if( mpDspState->slaveBytesAvailable>0 ) |
| 530 | if( state->m_mpDspState->slaveBytesAvailable>0 ) |
| 570 | 531 | { |
| 571 | | data = mpDspState->slaveInputBuffer[mpDspState->slaveInputStart++]; |
| 572 | | mpDspState->slaveInputStart %= DSP_BUF_MAX; |
| 573 | | mpDspState->slaveBytesAvailable--; |
| 574 | | if( mpDspState->slaveBytesAdvertised>0 ) |
| 532 | data = state->m_mpDspState->slaveInputBuffer[state->m_mpDspState->slaveInputStart++]; |
| 533 | state->m_mpDspState->slaveInputStart %= DSP_BUF_MAX; |
| 534 | state->m_mpDspState->slaveBytesAvailable--; |
| 535 | if( state->m_mpDspState->slaveBytesAdvertised>0 ) |
| 575 | 536 | { |
| 576 | | mpDspState->slaveBytesAdvertised--; |
| 537 | state->m_mpDspState->slaveBytesAdvertised--; |
| 577 | 538 | } |
| 578 | | if (ENABLE_LOGGING) logerror( "%s:-%04x(0x%04x)\n", space->machine().describe_context(), data, mpDspState->slaveBytesAvailable ); |
| 539 | if (ENABLE_LOGGING) logerror( "%s:-%04x(0x%04x)\n", space->machine().describe_context(), data, state->m_mpDspState->slaveBytesAvailable ); |
| 579 | 540 | } |
| 580 | 541 | return data; |
| 581 | 542 | } /* ReadWordFromSlaveInput */ |
| r11160 | r11161 | |
| 583 | 544 | static size_t |
| 584 | 545 | GetInputBytesAdvertisedForSlave( running_machine &machine ) |
| 585 | 546 | { |
| 586 | | if( mpDspState->slaveBytesAdvertised < mpDspState->slaveBytesAvailable ) |
| 547 | namcos21_state *state = machine.driver_data<namcos21_state>(); |
| 548 | if( state->m_mpDspState->slaveBytesAdvertised < state->m_mpDspState->slaveBytesAvailable ) |
| 587 | 549 | { |
| 588 | | mpDspState->slaveBytesAdvertised++; |
| 550 | state->m_mpDspState->slaveBytesAdvertised++; |
| 589 | 551 | } |
| 590 | | else if( mpDspState->slaveActive && mpDspState->masterFinished && mpDspState->masterSourceAddr ) |
| 552 | else if( state->m_mpDspState->slaveActive && state->m_mpDspState->masterFinished && state->m_mpDspState->masterSourceAddr ) |
| 591 | 553 | { |
| 592 | 554 | namcos21_kickstart(machine, 0); |
| 593 | 555 | } |
| 594 | | return mpDspState->slaveBytesAdvertised; |
| 556 | return state->m_mpDspState->slaveBytesAdvertised; |
| 595 | 557 | } /* GetInputBytesAdvertisedForSlave */ |
| 596 | 558 | |
| 597 | 559 | static READ16_HANDLER( dspram16_r ) |
| 598 | 560 | { |
| 599 | | return namcos21_dspram16[offset]; |
| 561 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 562 | return state->m_dspram16[offset]; |
| 600 | 563 | } /* dspram16_r */ |
| 601 | 564 | |
| 602 | 565 | static WRITE16_HANDLER( dspram16_w ) |
| 603 | 566 | { |
| 604 | | COMBINE_DATA( &namcos21_dspram16[offset] ); |
| 567 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 568 | COMBINE_DATA( &state->m_dspram16[offset] ); |
| 605 | 569 | |
| 606 | 570 | if( namcos2_gametype != NAMCOS21_WINRUN91 ) |
| 607 | 571 | { |
| 608 | | if( mpDspState->masterSourceAddr && |
| 609 | | offset == 1+(mpDspState->masterSourceAddr&0x7fff) ) |
| 572 | if( state->m_mpDspState->masterSourceAddr && |
| 573 | offset == 1+(state->m_mpDspState->masterSourceAddr&0x7fff) ) |
| 610 | 574 | { |
| 611 | 575 | if (ENABLE_LOGGING) logerror( "IDC-CONTINUE\n" ); |
| 612 | 576 | TransferDspData(space->machine()); |
| r11160 | r11161 | |
| 625 | 589 | static int |
| 626 | 590 | InitDSP( running_machine &machine ) |
| 627 | 591 | { |
| 592 | namcos21_state *state = machine.driver_data<namcos21_state>(); |
| 628 | 593 | UINT16 *pMem = (UINT16 *)machine.region("dspmaster")->base(); |
| 629 | 594 | /** |
| 630 | 595 | * DSP BIOS tests "CPU ID" on startup |
| r11160 | r11161 | |
| 634 | 599 | pMem[0x8000] = 0xFF80; |
| 635 | 600 | pMem[0x8001] = 0x0000; |
| 636 | 601 | |
| 637 | | mpDspState = auto_alloc_clear(machine, dsp_state); |
| 602 | state->m_mpDspState = auto_alloc_clear(machine, dsp_state); |
| 638 | 603 | |
| 639 | 604 | return 0; |
| 640 | 605 | } |
| 641 | 606 | |
| 642 | 607 | /***********************************************************/ |
| 643 | 608 | |
| 644 | | static UINT32 pointrom_idx; |
| 645 | 609 | |
| 646 | | static UINT8 mPointRomMSB; |
| 647 | | static int mbPointRomDataAvailable; |
| 648 | 610 | |
| 649 | 611 | static READ16_HANDLER( dsp_port0_r ) |
| 650 | 612 | { |
| 651 | | INT32 data = ReadPointROMData(space->machine(), pointrom_idx++); |
| 652 | | mPointRomMSB = (UINT8)(data>>16); |
| 653 | | mbPointRomDataAvailable = 1; |
| 613 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 614 | INT32 data = ReadPointROMData(space->machine(), state->m_pointrom_idx++); |
| 615 | state->m_mPointRomMSB = (UINT8)(data>>16); |
| 616 | state->m_mbPointRomDataAvailable = 1; |
| 654 | 617 | return (UINT16)data; |
| 655 | 618 | } /* dsp_port0_r */ |
| 656 | 619 | |
| r11160 | r11161 | |
| 661 | 624 | |
| 662 | 625 | static READ16_HANDLER( dsp_port1_r ) |
| 663 | 626 | { |
| 664 | | if( mbPointRomDataAvailable ) |
| 627 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 628 | if( state->m_mbPointRomDataAvailable ) |
| 665 | 629 | { |
| 666 | | mbPointRomDataAvailable = 0; |
| 667 | | return mPointRomMSB; |
| 630 | state->m_mbPointRomDataAvailable = 0; |
| 631 | return state->m_mPointRomMSB; |
| 668 | 632 | } |
| 669 | 633 | return 0x8000; /* IDC ack? */ |
| 670 | 634 | } /* dsp_port1_r */ |
| r11160 | r11161 | |
| 681 | 645 | |
| 682 | 646 | static WRITE16_HANDLER( dsp_port2_w ) |
| 683 | 647 | { |
| 648 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 684 | 649 | if (ENABLE_LOGGING) logerror( "IDC ADDR INIT(0x%04x)\n", data ); |
| 685 | | mpDspState->masterSourceAddr = data; |
| 650 | state->m_mpDspState->masterSourceAddr = data; |
| 686 | 651 | TransferDspData(space->machine()); |
| 687 | 652 | } /* dsp_port2_w */ |
| 688 | 653 | |
| r11160 | r11161 | |
| 692 | 657 | } /* dsp_port3_idc_rcv_enable_r */ |
| 693 | 658 | |
| 694 | 659 | static WRITE16_HANDLER( dsp_port3_w ) |
| 695 | | { /* same address space as pointram? */ |
| 696 | | pointrom_idx<<=16; |
| 697 | | pointrom_idx|=data; |
| 660 | { |
| 661 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); /* same address space as state->m_pointram? */ |
| 662 | state->m_pointrom_idx<<=16; |
| 663 | state->m_pointrom_idx|=data; |
| 698 | 664 | } /* dsp_port3_w */ |
| 699 | 665 | |
| 700 | 666 | static WRITE16_HANDLER( dsp_port4_w ) |
| r11160 | r11161 | |
| 706 | 672 | return 1; |
| 707 | 673 | } /* dsp_port8_r */ |
| 708 | 674 | |
| 709 | | static int namcos21_irq_enable; |
| 710 | 675 | |
| 711 | 676 | static WRITE16_HANDLER( dsp_port8_w ) |
| 712 | | { /* IRQ-enable? */ |
| 677 | { |
| 678 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); /* IRQ-enable? */ |
| 713 | 679 | if (ENABLE_LOGGING) logerror( "port8_w(%d)\n", data ); |
| 714 | 680 | if( data ) |
| 715 | 681 | { |
| 716 | | mpDspState->masterFinished = 1; |
| 682 | state->m_mpDspState->masterFinished = 1; |
| 717 | 683 | } |
| 718 | | namcos21_irq_enable = data; |
| 684 | state->m_irq_enable = data; |
| 719 | 685 | } /* dsp_port8_w */ |
| 720 | 686 | |
| 721 | 687 | static READ16_HANDLER( dsp_port9_r ) |
| r11160 | r11161 | |
| 744 | 710 | } /* dsp_portb_r */ |
| 745 | 711 | |
| 746 | 712 | static WRITE16_HANDLER(dsp_portb_w) |
| 747 | | { /* render-device trigger */ |
| 713 | { |
| 714 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); /* render-device trigger */ |
| 748 | 715 | if( data==0 ) |
| 749 | 716 | { /* only 0->1 transition triggers */ |
| 750 | 717 | return; |
| 751 | 718 | } |
| 752 | | if( mpDspState->masterDirectDrawSize == 13 ) |
| 719 | if( state->m_mpDspState->masterDirectDrawSize == 13 ) |
| 753 | 720 | { |
| 754 | 721 | int i; |
| 755 | 722 | int sx[4], sy[4], zcode[4]; |
| 756 | | int color = mpDspState->masterDirectDrawBuffer[0]; |
| 723 | int color = state->m_mpDspState->masterDirectDrawBuffer[0]; |
| 757 | 724 | for( i=0; i<4; i++ ) |
| 758 | 725 | { |
| 759 | | sx[i] = NAMCOS21_POLY_FRAME_WIDTH/2 + (INT16)mpDspState->masterDirectDrawBuffer[i*3+1]; |
| 760 | | sy[i] = NAMCOS21_POLY_FRAME_HEIGHT/2 + (INT16)mpDspState->masterDirectDrawBuffer[i*3+2]; |
| 761 | | zcode[i] = mpDspState->masterDirectDrawBuffer[i*3+3]; |
| 726 | sx[i] = NAMCOS21_POLY_FRAME_WIDTH/2 + (INT16)state->m_mpDspState->masterDirectDrawBuffer[i*3+1]; |
| 727 | sy[i] = NAMCOS21_POLY_FRAME_HEIGHT/2 + (INT16)state->m_mpDspState->masterDirectDrawBuffer[i*3+2]; |
| 728 | zcode[i] = state->m_mpDspState->masterDirectDrawBuffer[i*3+3]; |
| 762 | 729 | } |
| 763 | 730 | if( color&0x8000 ) |
| 764 | 731 | { |
| 765 | | namcos21_DrawQuad( sx, sy, zcode, color ); |
| 732 | namcos21_DrawQuad( space->machine(), sx, sy, zcode, color ); |
| 766 | 733 | } |
| 767 | 734 | else |
| 768 | 735 | { |
| 769 | 736 | logerror( "indirection used w/ direct draw?\n" ); |
| 770 | 737 | } |
| 771 | 738 | } |
| 772 | | else if( mpDspState->masterDirectDrawSize ) |
| 739 | else if( state->m_mpDspState->masterDirectDrawSize ) |
| 773 | 740 | { |
| 774 | | logerror( "unexpected masterDirectDrawSize=%d!\n",mpDspState->masterDirectDrawSize ); |
| 741 | logerror( "unexpected masterDirectDrawSize=%d!\n",state->m_mpDspState->masterDirectDrawSize ); |
| 775 | 742 | } |
| 776 | | mpDspState->masterDirectDrawSize = 0; |
| 743 | state->m_mpDspState->masterDirectDrawSize = 0; |
| 777 | 744 | } /* dsp_portb_w */ |
| 778 | 745 | |
| 779 | 746 | static WRITE16_HANDLER(dsp_portc_w) |
| 780 | | { /* enqueue data for direct-drawn poly */ |
| 781 | | if( mpDspState->masterDirectDrawSize < DSP_BUF_MAX ) |
| 747 | { |
| 748 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); /* enqueue data for direct-drawn poly */ |
| 749 | if( state->m_mpDspState->masterDirectDrawSize < DSP_BUF_MAX ) |
| 782 | 750 | { |
| 783 | | mpDspState->masterDirectDrawBuffer[mpDspState->masterDirectDrawSize++] = data; |
| 751 | state->m_mpDspState->masterDirectDrawBuffer[state->m_mpDspState->masterDirectDrawSize++] = data; |
| 784 | 752 | } |
| 785 | 753 | else |
| 786 | 754 | { |
| r11160 | r11161 | |
| 800 | 768 | |
| 801 | 769 | static ADDRESS_MAP_START( master_dsp_program, AS_PROGRAM, 16 ) |
| 802 | 770 | AM_RANGE(0x0000, 0x0fff) AM_ROM /* BIOS */ |
| 803 | | AM_RANGE(0x8000, 0xbfff) AM_RAM AM_BASE(&master_dsp_code) |
| 771 | AM_RANGE(0x8000, 0xbfff) AM_RAM AM_BASE_MEMBER(namcos21_state, m_master_dsp_code) |
| 804 | 772 | ADDRESS_MAP_END |
| 805 | 773 | |
| 806 | 774 | static ADDRESS_MAP_START( master_dsp_data, AS_DATA, 16 ) |
| r11160 | r11161 | |
| 828 | 796 | /************************************************************************************/ |
| 829 | 797 | |
| 830 | 798 | static void |
| 831 | | RenderSlaveOutput( UINT16 data ) |
| 799 | RenderSlaveOutput( running_machine &machine, UINT16 data ) |
| 832 | 800 | { |
| 833 | | if( mpDspState->slaveOutputSize >= 4096 ) |
| 801 | namcos21_state *state = machine.driver_data<namcos21_state>(); |
| 802 | if( state->m_mpDspState->slaveOutputSize >= 4096 ) |
| 834 | 803 | { |
| 835 | | logerror( "FATAL ERROR: SLAVE OVERFLOW (0x%x)\n",mpDspState->slaveOutputBuffer[0] ); |
| 804 | logerror( "FATAL ERROR: SLAVE OVERFLOW (0x%x)\n",state->m_mpDspState->slaveOutputBuffer[0] ); |
| 836 | 805 | exit(1); |
| 837 | 806 | return; |
| 838 | 807 | } |
| 839 | 808 | |
| 840 | 809 | /* append word to slave output buffer */ |
| 841 | | mpDspState->slaveOutputBuffer[mpDspState->slaveOutputSize++] = data; |
| 810 | state->m_mpDspState->slaveOutputBuffer[state->m_mpDspState->slaveOutputSize++] = data; |
| 842 | 811 | |
| 843 | 812 | { |
| 844 | | UINT16 *pSource = mpDspState->slaveOutputBuffer; |
| 813 | UINT16 *pSource = state->m_mpDspState->slaveOutputBuffer; |
| 845 | 814 | UINT16 count = *pSource++; |
| 846 | | if( count && mpDspState->slaveOutputSize > count ) |
| 815 | if( count && state->m_mpDspState->slaveOutputSize > count ) |
| 847 | 816 | { |
| 848 | 817 | UINT16 color = *pSource++; |
| 849 | 818 | int sx[4], sy[4],zcode[4]; |
| r11160 | r11161 | |
| 857 | 826 | sy[j] = NAMCOS21_POLY_FRAME_HEIGHT/2 + (INT16)pSource[3*j+1]; |
| 858 | 827 | zcode[j] = pSource[3*j+2]; |
| 859 | 828 | } |
| 860 | | namcos21_DrawQuad( sx, sy, zcode, color&0x7fff ); |
| 829 | namcos21_DrawQuad( machine, sx, sy, zcode, color&0x7fff ); |
| 861 | 830 | } |
| 862 | 831 | else |
| 863 | 832 | { |
| 864 | 833 | int quad_idx = color*6; |
| 865 | 834 | for(;;) |
| 866 | 835 | { |
| 867 | | UINT8 code = pointram[quad_idx++]; |
| 868 | | color = pointram[quad_idx++]|(code<<8); |
| 836 | UINT8 code = state->m_pointram[quad_idx++]; |
| 837 | color = state->m_pointram[quad_idx++]|(code<<8); |
| 869 | 838 | for( j=0; j<4; j++ ) |
| 870 | 839 | { |
| 871 | | UINT8 vi = pointram[quad_idx++]; |
| 840 | UINT8 vi = state->m_pointram[quad_idx++]; |
| 872 | 841 | sx[j] = NAMCOS21_POLY_FRAME_WIDTH/2 + (INT16)pSource[vi*3+0]; |
| 873 | 842 | sy[j] = NAMCOS21_POLY_FRAME_HEIGHT/2 + (INT16)pSource[vi*3+1]; |
| 874 | 843 | zcode[j] = pSource[vi*3+2]; |
| 875 | 844 | } |
| 876 | | namcos21_DrawQuad( sx, sy, zcode, color&0x7fff ); |
| 845 | namcos21_DrawQuad( machine, sx, sy, zcode, color&0x7fff ); |
| 877 | 846 | if( code&0x80 ) |
| 878 | 847 | { /* end-of-quadlist marker */ |
| 879 | 848 | break; |
| 880 | 849 | } |
| 881 | 850 | } |
| 882 | 851 | } |
| 883 | | mpDspState->slaveOutputSize = 0; |
| 852 | state->m_mpDspState->slaveOutputSize = 0; |
| 884 | 853 | } |
| 885 | 854 | else if( count==0 ) |
| 886 | 855 | { |
| r11160 | r11161 | |
| 897 | 866 | |
| 898 | 867 | static WRITE16_HANDLER(slave_port0_w) |
| 899 | 868 | { |
| 900 | | RenderSlaveOutput( data ); |
| 869 | RenderSlaveOutput( space->machine(), data ); |
| 901 | 870 | } |
| 902 | 871 | |
| 903 | 872 | static READ16_HANDLER(slave_port2_r) |
| r11160 | r11161 | |
| 967 | 936 | */ |
| 968 | 937 | static WRITE16_HANDLER( pointram_control_w ) |
| 969 | 938 | { |
| 970 | | // UINT16 prev = pointram_control; |
| 971 | | COMBINE_DATA( &pointram_control ); |
| 939 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 940 | // UINT16 prev = state->m_pointram_control; |
| 941 | COMBINE_DATA( &state->m_pointram_control ); |
| 972 | 942 | |
| 973 | | /* pointram_control&0x20 : bank for depthcue data */ |
| 974 | | /* |
| 975 | | logerror( "dsp_control_w:'%s':%x[%x]:=%04x ", |
| 976 | | space->device().tag, |
| 977 | | cpu_get_pc(&space->device()), |
| 978 | | offset, |
| 979 | | pointram_control ); |
| 943 | /* state->m_pointram_control&0x20 : bank for depthcue data */ |
| 944 | #if 0 |
| 945 | logerror( "dsp_control_w:'%s':%x[%x]:=%04x ", |
| 946 | space->cpu->tag, |
| 947 | cpu_get_pc(space->cpu), |
| 948 | offset, |
| 949 | state->m_pointram_control ); |
| 980 | 950 | |
| 981 | | UINT16 delta = (prev^pointram_control)&pointram_control; |
| 982 | | if( delta&0x10 ) |
| 983 | | { |
| 984 | | logerror( " [reset]" ); |
| 985 | | } |
| 986 | | if( delta&2 ) |
| 987 | | { |
| 988 | | logerror( " send(A)%x", pointram_control&1 ); |
| 989 | | } |
| 990 | | if( delta&4 ) |
| 991 | | { |
| 992 | | logerror( " send(B)%x", pointram_control&1 ); |
| 993 | | } |
| 994 | | if( delta&8 ) |
| 995 | | { |
| 996 | | logerror( " send(C)%x", pointram_control&1 ); |
| 997 | | } |
| 998 | | logerror( "\n" ); |
| 999 | | */ |
| 1000 | | pointram_idx = 0; /* HACK */ |
| 951 | UINT16 delta = (prev^state->m_pointram_control)&state->m_pointram_control; |
| 952 | if( delta&0x10 ) |
| 953 | { |
| 954 | logerror( " [reset]" ); |
| 955 | } |
| 956 | if( delta&2 ) |
| 957 | { |
| 958 | logerror( " send(A)%x", state->m_pointram_control&1 ); |
| 959 | } |
| 960 | if( delta&4 ) |
| 961 | { |
| 962 | logerror( " send(B)%x", state->m_pointram_control&1 ); |
| 963 | } |
| 964 | if( delta&8 ) |
| 965 | { |
| 966 | logerror( " send(C)%x", state->m_pointram_control&1 ); |
| 967 | } |
| 968 | logerror( "\n" ); |
| 969 | #endif |
| 970 | state->m_pointram_idx = 0; /* HACK */ |
| 1001 | 971 | } /* pointram_control_w */ |
| 1002 | 972 | |
| 1003 | 973 | static READ16_HANDLER( pointram_data_r ) |
| 1004 | 974 | { |
| 1005 | | return pointram[pointram_idx]; |
| 975 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 976 | return state->m_pointram[state->m_pointram_idx]; |
| 1006 | 977 | } /* pointram_data_r */ |
| 1007 | 978 | |
| 1008 | 979 | static WRITE16_HANDLER( pointram_data_w ) |
| 1009 | 980 | { |
| 981 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1010 | 982 | if( ACCESSING_BITS_0_7 ) |
| 1011 | 983 | { |
| 1012 | | // if( (pointram_idx%6)==0 ) logerror("\n" ); |
| 984 | // if( (state->m_pointram_idx%6)==0 ) logerror("\n" ); |
| 1013 | 985 | // logerror( " %02x", data ); |
| 1014 | | pointram[pointram_idx++] = data; |
| 1015 | | pointram_idx &= (PTRAM_SIZE-1); |
| 986 | state->m_pointram[state->m_pointram_idx++] = data; |
| 987 | state->m_pointram_idx &= (PTRAM_SIZE-1); |
| 1016 | 988 | } |
| 1017 | 989 | } /* pointram_data_w */ |
| 1018 | 990 | |
| 1019 | | static UINT8 namcos21_depthcue[2][0x400]; /* 0x800 nybbles */ |
| 1020 | 991 | |
| 1021 | 992 | static READ16_HANDLER( namcos21_depthcue_r ) |
| 1022 | 993 | { |
| 1023 | | int bank = (pointram_control&0x20)?1:0; |
| 1024 | | return namcos21_depthcue[bank][offset]; |
| 994 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 995 | int bank = (state->m_pointram_control&0x20)?1:0; |
| 996 | return state->m_depthcue[bank][offset]; |
| 1025 | 997 | } |
| 1026 | 998 | static WRITE16_HANDLER( namcos21_depthcue_w ) |
| 1027 | 999 | { |
| 1000 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1028 | 1001 | if( ACCESSING_BITS_0_7 ) |
| 1029 | 1002 | { |
| 1030 | | int bank = (pointram_control&0x20)?1:0; |
| 1031 | | namcos21_depthcue[bank][offset] = data; |
| 1003 | int bank = (state->m_pointram_control&0x20)?1:0; |
| 1004 | state->m_depthcue[bank][offset] = data; |
| 1032 | 1005 | // if( (offset&0xf)==0 ) logerror( "\n depthcue: " ); |
| 1033 | 1006 | // logerror( " %02x", data ); |
| 1034 | 1007 | } |
| r11160 | r11161 | |
| 1038 | 1011 | |
| 1039 | 1012 | static READ16_HANDLER( namcos2_68k_dualportram_word_r ) |
| 1040 | 1013 | { |
| 1041 | | return mpDualPortRAM[offset]; |
| 1014 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1015 | return state->m_mpDualPortRAM[offset]; |
| 1042 | 1016 | } |
| 1043 | 1017 | |
| 1044 | 1018 | static WRITE16_HANDLER( namcos2_68k_dualportram_word_w ) |
| 1045 | 1019 | { |
| 1020 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1046 | 1021 | if( ACCESSING_BITS_0_7 ) |
| 1047 | 1022 | { |
| 1048 | | mpDualPortRAM[offset] = data&0xff; |
| 1023 | state->m_mpDualPortRAM[offset] = data&0xff; |
| 1049 | 1024 | } |
| 1050 | 1025 | } |
| 1051 | 1026 | |
| 1052 | 1027 | static READ8_HANDLER( namcos2_dualportram_byte_r ) |
| 1053 | 1028 | { |
| 1054 | | return mpDualPortRAM[offset]; |
| 1029 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1030 | return state->m_mpDualPortRAM[offset]; |
| 1055 | 1031 | } |
| 1056 | 1032 | |
| 1057 | 1033 | static WRITE8_HANDLER( namcos2_dualportram_byte_w ) |
| 1058 | 1034 | { |
| 1059 | | mpDualPortRAM[offset] = data; |
| 1035 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1036 | state->m_mpDualPortRAM[offset] = data; |
| 1060 | 1037 | } |
| 1061 | 1038 | |
| 1062 | 1039 | /* shared RAM memory handlers */ |
| 1063 | 1040 | |
| 1064 | 1041 | static READ16_HANDLER( shareram1_r ) |
| 1065 | 1042 | { |
| 1066 | | return mpSharedRAM1[offset]; |
| 1043 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1044 | return state->m_mpSharedRAM1[offset]; |
| 1067 | 1045 | } |
| 1068 | 1046 | |
| 1069 | 1047 | static WRITE16_HANDLER( shareram1_w ) |
| 1070 | 1048 | { |
| 1071 | | COMBINE_DATA( &mpSharedRAM1[offset] ); |
| 1049 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1050 | COMBINE_DATA( &state->m_mpSharedRAM1[offset] ); |
| 1072 | 1051 | } |
| 1073 | 1052 | |
| 1074 | 1053 | /* some games have read-only areas where more ROMs are mapped */ |
| 1075 | 1054 | |
| 1076 | 1055 | static READ16_HANDLER( datarom_r ) |
| 1077 | 1056 | { |
| 1078 | | return mpDataROM[offset]; |
| 1057 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1058 | return state->m_mpDataROM[offset]; |
| 1079 | 1059 | } |
| 1080 | 1060 | |
| 1081 | 1061 | static READ16_HANDLER( data2_r ) |
| 1082 | 1062 | { |
| 1083 | | return mpDataROM[0x100000/2+offset]; |
| 1063 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1064 | return state->m_mpDataROM[0x100000/2+offset]; |
| 1084 | 1065 | } |
| 1085 | 1066 | |
| 1086 | 1067 | /* palette memory handlers */ |
| r11160 | r11161 | |
| 1108 | 1089 | /*************************************************************/ |
| 1109 | 1090 | |
| 1110 | 1091 | #define NAMCO21_68K_COMMON \ |
| 1111 | | AM_RANGE(0x200000, 0x20ffff) AM_READWRITE(dspram16_r,dspram16_w) AM_BASE(&namcos21_dspram16) \ |
| 1092 | AM_RANGE(0x200000, 0x20ffff) AM_READWRITE(dspram16_r,dspram16_w) AM_BASE_MEMBER(namcos21_state, m_dspram16) \ |
| 1112 | 1093 | AM_RANGE(0x280000, 0x280001) AM_WRITENOP /* written once on startup */ \ |
| 1113 | 1094 | AM_RANGE(0x400000, 0x400001) AM_WRITE(pointram_control_w) \ |
| 1114 | 1095 | AM_RANGE(0x440000, 0x440001) AM_READWRITE(pointram_data_r,pointram_data_w) \ |
| r11160 | r11161 | |
| 1119 | 1100 | AM_RANGE(0x740000, 0x75ffff) AM_READWRITE(paletteram16_r,paletteram16_w) AM_BASE_GENERIC(paletteram) \ |
| 1120 | 1101 | AM_RANGE(0x760000, 0x760001) AM_READWRITE(namcos21_video_enable_r,namcos21_video_enable_w) \ |
| 1121 | 1102 | AM_RANGE(0x800000, 0x8fffff) AM_READ(datarom_r) \ |
| 1122 | | AM_RANGE(0x900000, 0x90ffff) AM_READWRITE(shareram1_r,shareram1_w) AM_BASE(&mpSharedRAM1) \ |
| 1103 | AM_RANGE(0x900000, 0x90ffff) AM_READWRITE(shareram1_r,shareram1_w) AM_BASE_MEMBER(namcos21_state, m_mpSharedRAM1) \ |
| 1123 | 1104 | AM_RANGE(0xa00000, 0xa00fff) AM_READWRITE(namcos2_68k_dualportram_word_r,namcos2_68k_dualportram_word_w) \ |
| 1124 | 1105 | AM_RANGE(0xb00000, 0xb03fff) AM_READWRITE(NAMCO_C139_SCI_buffer_r,NAMCO_C139_SCI_buffer_w) \ |
| 1125 | 1106 | AM_RANGE(0xb80000, 0xb8000f) AM_READWRITE(NAMCO_C139_SCI_register_r,NAMCO_C139_SCI_register_w) \ |
| r11160 | r11161 | |
| 1147 | 1128 | *************************************************************/ |
| 1148 | 1129 | static READ16_HANDLER( winrun_dspcomram_r ) |
| 1149 | 1130 | { |
| 1150 | | int bank = 1-(winrun_dspcomram_control[0x4/2]&1); |
| 1151 | | UINT16 *mem = &winrun_dspcomram[0x1000*bank]; |
| 1131 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1132 | int bank = 1-(state->m_winrun_dspcomram_control[0x4/2]&1); |
| 1133 | UINT16 *mem = &state->m_winrun_dspcomram[0x1000*bank]; |
| 1152 | 1134 | return mem[offset]; |
| 1153 | 1135 | } |
| 1154 | 1136 | static WRITE16_HANDLER( winrun_dspcomram_w ) |
| 1155 | 1137 | { |
| 1156 | | int bank = 1-(winrun_dspcomram_control[0x4/2]&1); |
| 1157 | | UINT16 *mem = &winrun_dspcomram[0x1000*bank]; |
| 1138 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1139 | int bank = 1-(state->m_winrun_dspcomram_control[0x4/2]&1); |
| 1140 | UINT16 *mem = &state->m_winrun_dspcomram[0x1000*bank]; |
| 1158 | 1141 | COMBINE_DATA( &mem[offset] ); |
| 1159 | 1142 | } |
| 1160 | 1143 | |
| r11160 | r11161 | |
| 1184 | 1167 | } /* winrun_cuskey_w */ |
| 1185 | 1168 | |
| 1186 | 1169 | static void |
| 1187 | | winrun_flushpoly( void ) |
| 1170 | winrun_flushpoly( running_machine &machine ) |
| 1188 | 1171 | { |
| 1189 | | if( winrun_poly_index>0 ) |
| 1172 | namcos21_state *state = machine.driver_data<namcos21_state>(); |
| 1173 | if( state->m_winrun_poly_index>0 ) |
| 1190 | 1174 | { |
| 1191 | | const UINT16 *pSource = winrun_poly_buf; |
| 1175 | const UINT16 *pSource = state->m_winrun_poly_buf; |
| 1192 | 1176 | UINT16 color; |
| 1193 | 1177 | int sx[4], sy[4], zcode[4]; |
| 1194 | 1178 | int j; |
| r11160 | r11161 | |
| 1201 | 1185 | sy[j] = NAMCOS21_POLY_FRAME_HEIGHT/2 + (INT16)*pSource++; |
| 1202 | 1186 | zcode[j] = *pSource++; |
| 1203 | 1187 | } |
| 1204 | | namcos21_DrawQuad( sx, sy, zcode, color&0x7fff ); |
| 1188 | namcos21_DrawQuad( machine, sx, sy, zcode, color&0x7fff ); |
| 1205 | 1189 | } |
| 1206 | 1190 | else |
| 1207 | 1191 | { |
| 1208 | 1192 | int quad_idx = color*6; |
| 1209 | 1193 | for(;;) |
| 1210 | 1194 | { |
| 1211 | | UINT8 code = pointram[quad_idx++]; |
| 1212 | | color = pointram[quad_idx++]; |
| 1195 | UINT8 code = state->m_pointram[quad_idx++]; |
| 1196 | color = state->m_pointram[quad_idx++]; |
| 1213 | 1197 | for( j=0; j<4; j++ ) |
| 1214 | 1198 | { |
| 1215 | | UINT8 vi = pointram[quad_idx++]; |
| 1199 | UINT8 vi = state->m_pointram[quad_idx++]; |
| 1216 | 1200 | sx[j] = NAMCOS21_POLY_FRAME_WIDTH/2 + (INT16)pSource[vi*3+0]; |
| 1217 | 1201 | sy[j] = NAMCOS21_POLY_FRAME_HEIGHT/2 + (INT16)pSource[vi*3+1]; |
| 1218 | 1202 | zcode[j] = pSource[vi*3+2]; |
| 1219 | 1203 | } |
| 1220 | | namcos21_DrawQuad( sx, sy, zcode, color&0x7fff ); |
| 1204 | namcos21_DrawQuad( machine, sx, sy, zcode, color&0x7fff ); |
| 1221 | 1205 | if( code&0x80 ) |
| 1222 | 1206 | { /* end-of-quadlist marker */ |
| 1223 | 1207 | break; |
| 1224 | 1208 | } |
| 1225 | 1209 | } |
| 1226 | 1210 | } |
| 1227 | | winrun_poly_index = 0; |
| 1211 | state->m_winrun_poly_index = 0; |
| 1228 | 1212 | } |
| 1229 | 1213 | } /* winrun_flushpoly */ |
| 1230 | 1214 | |
| 1231 | 1215 | static READ16_HANDLER( winrun_poly_reset_r ) |
| 1232 | 1216 | { |
| 1233 | | winrun_flushpoly(); |
| 1217 | winrun_flushpoly(space->machine()); |
| 1234 | 1218 | return 0; |
| 1235 | 1219 | } |
| 1236 | 1220 | |
| 1237 | 1221 | static WRITE16_HANDLER( winrun_dsp_render_w ) |
| 1238 | 1222 | { |
| 1239 | | if( winrun_poly_index<WINRUN_MAX_POLY_PARAM ) |
| 1223 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1224 | if( state->m_winrun_poly_index<WINRUN_MAX_POLY_PARAM ) |
| 1240 | 1225 | { |
| 1241 | | winrun_poly_buf[winrun_poly_index++] = data; |
| 1226 | state->m_winrun_poly_buf[state->m_winrun_poly_index++] = data; |
| 1242 | 1227 | } |
| 1243 | 1228 | else |
| 1244 | 1229 | { |
| r11160 | r11161 | |
| 1248 | 1233 | |
| 1249 | 1234 | static WRITE16_HANDLER( winrun_dsp_pointrom_addr_w ) |
| 1250 | 1235 | { |
| 1236 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1251 | 1237 | if( offset==0 ) |
| 1252 | 1238 | { /* port 8 */ |
| 1253 | | winrun_pointrom_addr = data; |
| 1239 | state->m_winrun_pointrom_addr = data; |
| 1254 | 1240 | } |
| 1255 | 1241 | else |
| 1256 | 1242 | { /* port 9 */ |
| 1257 | | winrun_pointrom_addr |= (data<<16); |
| 1243 | state->m_winrun_pointrom_addr |= (data<<16); |
| 1258 | 1244 | } |
| 1259 | 1245 | } |
| 1260 | 1246 | |
| 1261 | 1247 | static READ16_HANDLER( winrun_dsp_pointrom_data_r ) |
| 1262 | 1248 | { |
| 1249 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1263 | 1250 | UINT16 *ptrom = (UINT16 *)space->machine().region("user2")->base(); |
| 1264 | | return ptrom[winrun_pointrom_addr++]; |
| 1251 | return ptrom[state->m_winrun_pointrom_addr++]; |
| 1265 | 1252 | } /* winrun_dsp_pointrom_data_r */ |
| 1266 | 1253 | |
| 1267 | 1254 | static WRITE16_HANDLER( winrun_dsp_complete_w ) |
| 1268 | 1255 | { |
| 1269 | 1256 | if( data ) |
| 1270 | 1257 | { |
| 1271 | | winrun_flushpoly(); |
| 1258 | winrun_flushpoly(space->machine()); |
| 1272 | 1259 | cputag_set_input_line(space->machine(), "dsp", INPUT_LINE_RESET, PULSE_LINE); |
| 1273 | | namcos21_ClearPolyFrameBuffer(); |
| 1260 | namcos21_ClearPolyFrameBuffer(space->machine()); |
| 1274 | 1261 | } |
| 1275 | 1262 | } |
| 1276 | 1263 | |
| 1277 | 1264 | static READ16_HANDLER( winrun_table_r ) |
| 1278 | 1265 | { |
| 1279 | | return winrun_polydata[offset]; |
| 1266 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1267 | return state->m_winrun_polydata[offset]; |
| 1280 | 1268 | } |
| 1281 | 1269 | |
| 1282 | 1270 | static ADDRESS_MAP_START( winrun_dsp_program, AS_PROGRAM, 16 ) |
| r11160 | r11161 | |
| 1308 | 1296 | |
| 1309 | 1297 | static READ16_HANDLER( winrun_gpucomram_r ) |
| 1310 | 1298 | { |
| 1311 | | return winrun_gpucomram[offset]; |
| 1299 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1300 | return state->m_winrun_gpucomram[offset]; |
| 1312 | 1301 | } |
| 1313 | 1302 | static WRITE16_HANDLER( winrun_gpucomram_w ) |
| 1314 | 1303 | { |
| 1315 | | COMBINE_DATA( &winrun_gpucomram[offset] ); |
| 1304 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1305 | COMBINE_DATA( &state->m_winrun_gpucomram[offset] ); |
| 1316 | 1306 | } |
| 1317 | 1307 | |
| 1318 | 1308 | static WRITE16_HANDLER( winrun_dspbios_w ) |
| 1319 | 1309 | { |
| 1320 | | COMBINE_DATA( &winrun_dspbios[offset] ); |
| 1310 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1311 | COMBINE_DATA( &state->m_winrun_dspbios[offset] ); |
| 1321 | 1312 | if( offset==0xfff ) |
| 1322 | 1313 | { |
| 1323 | 1314 | UINT16 *mem = (UINT16 *)space->machine().region("dsp")->base(); |
| 1324 | | memcpy( mem, winrun_dspbios, 0x2000 ); |
| 1325 | | winrun_dsp_alive = 1; |
| 1315 | memcpy( mem, state->m_winrun_dspbios, 0x2000 ); |
| 1316 | state->m_winrun_dsp_alive = 1; |
| 1326 | 1317 | } |
| 1327 | 1318 | } /* winrun_dspbios_w */ |
| 1328 | 1319 | |
| r11160 | r11161 | |
| 1333 | 1324 | |
| 1334 | 1325 | static READ16_HANDLER( winrun_68k_dspcomram_r ) |
| 1335 | 1326 | { |
| 1336 | | int bank = winrun_dspcomram_control[0x4/2]&1; |
| 1337 | | UINT16 *mem = &winrun_dspcomram[0x1000*bank]; |
| 1327 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1328 | int bank = state->m_winrun_dspcomram_control[0x4/2]&1; |
| 1329 | UINT16 *mem = &state->m_winrun_dspcomram[0x1000*bank]; |
| 1338 | 1330 | return mem[offset]; |
| 1339 | 1331 | } |
| 1340 | 1332 | |
| 1341 | 1333 | static WRITE16_HANDLER( winrun_68k_dspcomram_w ) |
| 1342 | 1334 | { |
| 1343 | | int bank = winrun_dspcomram_control[0x4/2]&1; |
| 1344 | | UINT16 *mem = &winrun_dspcomram[0x1000*bank]; |
| 1335 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1336 | int bank = state->m_winrun_dspcomram_control[0x4/2]&1; |
| 1337 | UINT16 *mem = &state->m_winrun_dspcomram[0x1000*bank]; |
| 1345 | 1338 | COMBINE_DATA( &mem[offset] ); |
| 1346 | 1339 | } |
| 1347 | 1340 | |
| 1348 | 1341 | static READ16_HANDLER( winrun_dspcomram_control_r ) |
| 1349 | 1342 | { |
| 1350 | | return winrun_dspcomram_control[offset]; |
| 1343 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1344 | return state->m_winrun_dspcomram_control[offset]; |
| 1351 | 1345 | } |
| 1352 | 1346 | |
| 1353 | 1347 | static WRITE16_HANDLER( winrun_dspcomram_control_w ) |
| 1354 | 1348 | { |
| 1355 | | COMBINE_DATA( &winrun_dspcomram_control[offset] ); |
| 1349 | namcos21_state *state = space->machine().driver_data<namcos21_state>(); |
| 1350 | COMBINE_DATA( &state->m_winrun_dspcomram_control[offset] ); |
| 1356 | 1351 | } |
| 1357 | 1352 | |
| 1358 | 1353 | static ADDRESS_MAP_START( am_master_winrun, AS_PROGRAM, 16 ) |
| r11160 | r11161 | |
| 1360 | 1355 | AM_RANGE(0x100000, 0x10ffff) AM_RAM /* work RAM */ |
| 1361 | 1356 | AM_RANGE(0x180000, 0x183fff) AM_READWRITE(NAMCOS2_68K_eeprom_R,NAMCOS2_68K_eeprom_W)// AM_BASE(&namcos2_eeprom) AM_SIZE(&namcos2_eeprom_size) |
| 1362 | 1357 | AM_RANGE(0x1c0000, 0x1fffff) AM_READWRITE(namcos2_68k_master_C148_r,namcos2_68k_master_C148_w) |
| 1363 | | AM_RANGE(0x250000, 0x25ffff) AM_RAM AM_BASE( &winrun_polydata ) |
| 1358 | AM_RANGE(0x250000, 0x25ffff) AM_RAM AM_BASE_MEMBER(namcos21_state, m_winrun_polydata ) |
| 1364 | 1359 | AM_RANGE(0x260000, 0x26ffff) AM_RAM /* unused? */ |
| 1365 | | AM_RANGE(0x280000, 0x281fff) AM_WRITE(winrun_dspbios_w) AM_BASE(&winrun_dspbios) |
| 1360 | AM_RANGE(0x280000, 0x281fff) AM_WRITE(winrun_dspbios_w) AM_BASE_MEMBER(namcos21_state, m_winrun_dspbios) |
| 1366 | 1361 | AM_RANGE(0x380000, 0x38000f) AM_READWRITE(winrun_dspcomram_control_r,winrun_dspcomram_control_w) |
| 1367 | 1362 | AM_RANGE(0x3c0000, 0x3c1fff) AM_READWRITE(winrun_68k_dspcomram_r,winrun_68k_dspcomram_w) |
| 1368 | 1363 | AM_RANGE(0x400000, 0x400001) AM_WRITE(pointram_control_w) |
| 1369 | 1364 | AM_RANGE(0x440000, 0x440001) AM_READWRITE(pointram_data_r,pointram_data_w) |
| 1370 | 1365 | AM_RANGE(0x600000, 0x60ffff) AM_READWRITE(winrun_gpucomram_r,winrun_gpucomram_w) |
| 1371 | 1366 | AM_RANGE(0x800000, 0x87ffff) AM_READ(datarom_r) |
| 1372 | | AM_RANGE(0x900000, 0x90ffff) AM_READWRITE(shareram1_r,shareram1_w) AM_BASE(&mpSharedRAM1) |
| 1367 | AM_RANGE(0x900000, 0x90ffff) AM_READWRITE(shareram1_r,shareram1_w) AM_BASE_MEMBER(namcos21_state, m_mpSharedRAM1) |
| 1373 | 1368 | AM_RANGE(0xa00000, 0xa00fff) AM_READWRITE(namcos2_68k_dualportram_word_r,namcos2_68k_dualportram_word_w) |
| 1374 | 1369 | AM_RANGE(0xb00000, 0xb03fff) AM_READWRITE(NAMCO_C139_SCI_buffer_r,NAMCO_C139_SCI_buffer_w) |
| 1375 | 1370 | AM_RANGE(0xb80000, 0xb8000f) AM_READWRITE(NAMCO_C139_SCI_register_r,NAMCO_C139_SCI_register_w) |
| r11160 | r11161 | |
| 1392 | 1387 | AM_RANGE(0x100000, 0x100001) AM_READWRITE(winrun_gpu_color_r,winrun_gpu_color_w) /* ? */ |
| 1393 | 1388 | AM_RANGE(0x180000, 0x19ffff) AM_RAM /* work RAM */ |
| 1394 | 1389 | AM_RANGE(0x1c0000, 0x1fffff) AM_READWRITE(namcos2_68k_gpu_C148_r,namcos2_68k_gpu_C148_w) |
| 1395 | | AM_RANGE(0x200000, 0x20ffff) AM_RAM AM_BASE( &winrun_gpucomram ) |
| 1390 | AM_RANGE(0x200000, 0x20ffff) AM_RAM AM_BASE_MEMBER(namcos21_state, m_winrun_gpucomram ) |
| 1396 | 1391 | AM_RANGE(0x400000, 0x41ffff) AM_READWRITE(paletteram16_r,paletteram16_w) AM_BASE_GENERIC( paletteram ) |
| 1397 | 1392 | AM_RANGE(0x600000, 0x6fffff) AM_READ(gpu_data_r) |
| 1398 | 1393 | AM_RANGE(0xc00000, 0xcfffff) AM_READWRITE(winrun_gpu_videoram_r,winrun_gpu_videoram_w) |
| r11160 | r11161 | |
| 1410 | 1405 | AM_RANGE(0x3000, 0x3003) AM_WRITENOP /* ? */ |
| 1411 | 1406 | AM_RANGE(0x4000, 0x4001) AM_DEVREADWRITE("ymsnd", ym2151_r,ym2151_w) |
| 1412 | 1407 | AM_RANGE(0x5000, 0x6fff) AM_DEVREADWRITE("c140", c140_r,c140_w) |
| 1413 | | AM_RANGE(0x7000, 0x77ff) AM_READWRITE(namcos2_dualportram_byte_r,namcos2_dualportram_byte_w) AM_BASE(&mpDualPortRAM) |
| 1408 | AM_RANGE(0x7000, 0x77ff) AM_READWRITE(namcos2_dualportram_byte_r,namcos2_dualportram_byte_w) AM_BASE_MEMBER(namcos21_state, m_mpDualPortRAM) |
| 1414 | 1409 | AM_RANGE(0x7800, 0x7fff) AM_READWRITE(namcos2_dualportram_byte_r,namcos2_dualportram_byte_w) /* mirror */ |
| 1415 | 1410 | AM_RANGE(0x8000, 0x9fff) AM_RAM |
| 1416 | 1411 | AM_RANGE(0xa000, 0xbfff) AM_WRITENOP /* amplifier enable on 1st write */ |
| r11160 | r11161 | |
| 1441 | 1436 | AM_RANGE(0x3001, 0x3001) AM_READ_PORT("DIAL1") |
| 1442 | 1437 | AM_RANGE(0x3002, 0x3002) AM_READ_PORT("DIAL2") |
| 1443 | 1438 | AM_RANGE(0x3003, 0x3003) AM_READ_PORT("DIAL3") |
| 1444 | | AM_RANGE(0x5000, 0x57ff) AM_READWRITE(namcos2_dualportram_byte_r,namcos2_dualportram_byte_w) AM_BASE(&mpDualPortRAM) |
| 1439 | AM_RANGE(0x5000, 0x57ff) AM_READWRITE(namcos2_dualportram_byte_r,namcos2_dualportram_byte_w) AM_BASE_MEMBER(namcos21_state, m_mpDualPortRAM) |
| 1445 | 1440 | AM_RANGE(0x6000, 0x6fff) AM_READNOP /* watchdog */ |
| 1446 | 1441 | AM_RANGE(0x8000, 0xffff) AM_ROM |
| 1447 | 1442 | ADDRESS_MAP_END |
| r11160 | r11161 | |
| 1458 | 1453 | AM_RANGE(0x740000, 0x75ffff) AM_READWRITE(paletteram16_r,paletteram16_w) AM_BASE_GENERIC(paletteram) \ |
| 1459 | 1454 | AM_RANGE(0x760000, 0x760001) AM_READWRITE(namcos21_video_enable_r,namcos21_video_enable_w) \ |
| 1460 | 1455 | AM_RANGE(0x800000, 0x8fffff) AM_READ(datarom_r) \ |
| 1461 | | AM_RANGE(0x900000, 0x90ffff) AM_READWRITE(shareram1_r,shareram1_w) AM_BASE(&mpSharedRAM1) \ |
| 1456 | AM_RANGE(0x900000, 0x90ffff) AM_READWRITE(shareram1_r,shareram1_w) AM_BASE_MEMBER(namcos21_state, m_mpSharedRAM1) \ |
| 1462 | 1457 | AM_RANGE(0xa00000, 0xa00fff) AM_READWRITE(namcos2_68k_dualportram_word_r,namcos2_68k_dualportram_word_w) \ |
| 1463 | 1458 | AM_RANGE(0xb00000, 0xb03fff) AM_READWRITE(NAMCO_C139_SCI_buffer_r,NAMCO_C139_SCI_buffer_w) \ |
| 1464 | 1459 | AM_RANGE(0xb80000, 0xb8000f) AM_READWRITE(NAMCO_C139_SCI_register_r,NAMCO_C139_SCI_register_w) \ |
| r11160 | r11161 | |
| 1469 | 1464 | AM_RANGE(0x100000, 0x10ffff) AM_RAM /* private work RAM */ |
| 1470 | 1465 | AM_RANGE(0x180000, 0x183fff) AM_READWRITE(NAMCOS2_68K_eeprom_R,NAMCOS2_68K_eeprom_W)// AM_BASE(&namcos2_eeprom) AM_SIZE(&namcos2_eeprom_size) |
| 1471 | 1466 | AM_RANGE(0x1c0000, 0x1fffff) AM_READWRITE(namcos2_68k_master_C148_r,namcos2_68k_master_C148_w) |
| 1472 | | AM_RANGE(0x250000, 0x25ffff) AM_RAM AM_BASE( &winrun_polydata ) |
| 1473 | | AM_RANGE(0x280000, 0x281fff) AM_WRITE(winrun_dspbios_w) AM_BASE(&winrun_dspbios) |
| 1467 | AM_RANGE(0x250000, 0x25ffff) AM_RAM AM_BASE_MEMBER(namcos21_state, m_winrun_polydata ) |
| 1468 | AM_RANGE(0x280000, 0x281fff) AM_WRITE(winrun_dspbios_w) AM_BASE_MEMBER(namcos21_state, m_winrun_dspbios) |
| 1474 | 1469 | AM_RANGE(0x380000, 0x38000f) AM_READWRITE(winrun_dspcomram_control_r,winrun_dspcomram_control_w) |
| 1475 | 1470 | AM_RANGE(0x3c0000, 0x3c1fff) AM_READWRITE(winrun_68k_dspcomram_r,winrun_68k_dspcomram_w) |
| 1476 | 1471 | AM_RANGE(0x400000, 0x400001) AM_WRITE(pointram_control_w) |
| r11160 | r11161 | |
| 1769 | 1764 | ROM_LOAD("ac1-voi2.12d",0x100000,0x80000,CRC(1fcb51ba) SHA1(80fc815e5fad76d20c3795ab1d89b57d9abc3efd) ) |
| 1770 | 1765 | ROM_LOAD("ac1-voi3.12e",0x180000,0x80000,CRC(cd202e06) SHA1(72a18f5ba402caefef14b8d1304f337eaaa3eb1d) ) |
| 1771 | 1766 | |
| 1772 | | // ROM_REGION( 0x0600, "plds", 0 ) |
| 1773 | | // ROM_LOAD( "gal16v8a-3pdsp5.17d", 0x0000, 0x0117, CRC(799c1f26) SHA1(d28ed1b9fa78180c5a0b01a7198a2870137c7349) ) |
| 1774 | | // ROM_LOAD( "plhs18p8-3pobj3.17n", 0x0200, 0x0149, CRC(9625f469) SHA1(29158a3d37485fb0714d0a60bcd07abd26a3f56e) ) |
| 1775 | | // ROM_LOAD( "plhs18p8-3pobj4.17n", 0x0400, 0x0149, CRC(1b7c90c1) SHA1(ae65aab7a191cdf1af488e144af22b9d8669c903) ) |
| 1767 | ROM_REGION( 0x0600, "plds", 0 ) |
| 1768 | ROM_LOAD( "gal16v8a-3pdsp5.17d", 0x0000, 0x0117, CRC(799c1f26) SHA1(d28ed1b9fa78180c5a0b01a7198a2870137c7349) ) |
| 1769 | ROM_LOAD( "plhs18p8-3pobj3.17n", 0x0200, 0x0149, CRC(9625f469) SHA1(29158a3d37485fb0714d0a60bcd07abd26a3f56e) ) |
| 1770 | ROM_LOAD( "plhs18p8-3pobj4.17n", 0x0400, 0x0149, CRC(1b7c90c1) SHA1(ae65aab7a191cdf1af488e144af22b9d8669c903) ) |
| 1776 | 1771 | ROM_END |
| 1777 | 1772 | |
| 1778 | 1773 | ROM_START( aircombj ) |
| r11160 | r11161 | |
| 2203 | 2198 | |
| 2204 | 2199 | static void namcos21_init( running_machine &machine, int game_type ) |
| 2205 | 2200 | { |
| 2201 | namcos21_state *state = machine.driver_data<namcos21_state>(); |
| 2206 | 2202 | namcos2_gametype = game_type; |
| 2207 | | pointram = auto_alloc_array(machine, UINT8, PTRAM_SIZE); |
| 2208 | | mpDataROM = (UINT16 *)machine.region( "user1" )->base(); |
| 2203 | state->m_pointram = auto_alloc_array(machine, UINT8, PTRAM_SIZE); |
| 2204 | state->m_mpDataROM = (UINT16 *)machine.region( "user1" )->base(); |
| 2209 | 2205 | InitDSP(machine); |
| 2210 | | mbNeedsKickstart = 20; |
| 2206 | state->m_mbNeedsKickstart = 20; |
| 2211 | 2207 | if( game_type==NAMCOS21_CYBERSLED ) |
| 2212 | 2208 | { |
| 2213 | | mbNeedsKickstart = 200; |
| 2209 | state->m_mbNeedsKickstart = 200; |
| 2214 | 2210 | } |
| 2215 | 2211 | } /* namcos21_init */ |
| 2216 | 2212 | |
| 2217 | 2213 | static DRIVER_INIT( winrun ) |
| 2218 | 2214 | { |
| 2215 | namcos21_state *state = machine.driver_data<namcos21_state>(); |
| 2219 | 2216 | UINT16 *pMem = (UINT16 *)machine.region("dsp")->base(); |
| 2220 | 2217 | int pc = 0; |
| 2221 | 2218 | pMem[pc++] = 0xff80; /* b */ |
| 2222 | 2219 | pMem[pc++] = 0; |
| 2223 | 2220 | |
| 2224 | | winrun_dspcomram = auto_alloc_array(machine, UINT16, 0x1000*2); |
| 2221 | state->m_winrun_dspcomram = auto_alloc_array(machine, UINT16, 0x1000*2); |
| 2225 | 2222 | |
| 2226 | 2223 | namcos2_gametype = NAMCOS21_WINRUN91; |
| 2227 | | mpDataROM = (UINT16 *)machine.region( "user1" )->base(); |
| 2228 | | pointram = auto_alloc_array(machine, UINT8, PTRAM_SIZE); |
| 2229 | | pointram_idx = 0; |
| 2230 | | mbNeedsKickstart = 0; |
| 2224 | state->m_mpDataROM = (UINT16 *)machine.region( "user1" )->base(); |
| 2225 | state->m_pointram = auto_alloc_array(machine, UINT8, PTRAM_SIZE); |
| 2226 | state->m_pointram_idx = 0; |
| 2227 | state->m_mbNeedsKickstart = 0; |
| 2231 | 2228 | } |
| 2232 | 2229 | |
| 2233 | 2230 | static DRIVER_INIT( aircombt ) |
| r11160 | r11161 | |
| 2259 | 2256 | |
| 2260 | 2257 | static DRIVER_INIT( driveyes ) |
| 2261 | 2258 | { |
| 2259 | namcos21_state *state = machine.driver_data<namcos21_state>(); |
| 2262 | 2260 | UINT16 *pMem = (UINT16 *)machine.region("dsp")->base(); |
| 2263 | 2261 | int pc = 0; |
| 2264 | 2262 | pMem[pc++] = 0xff80; /* b */ |
| 2265 | 2263 | pMem[pc++] = 0; |
| 2266 | | winrun_dspcomram = auto_alloc_array(machine, UINT16, 0x1000*2); |
| 2264 | state->m_winrun_dspcomram = auto_alloc_array(machine, UINT16, 0x1000*2); |
| 2267 | 2265 | namcos2_gametype = NAMCOS21_DRIVERS_EYES; |
| 2268 | | mpDataROM = (UINT16 *)machine.region( "user1" )->base(); |
| 2269 | | pointram = auto_alloc_array(machine, UINT8, PTRAM_SIZE); |
| 2270 | | pointram_idx = 0; |
| 2271 | | mbNeedsKickstart = 0; |
| 2266 | state->m_mpDataROM = (UINT16 *)machine.region( "user1" )->base(); |
| 2267 | state->m_pointram = auto_alloc_array(machine, UINT8, PTRAM_SIZE); |
| 2268 | state->m_pointram_idx = 0; |
| 2269 | state->m_mbNeedsKickstart = 0; |
| 2272 | 2270 | } |
| 2273 | 2271 | |
| 2274 | 2272 | /*************************************************************/ |
src/mame/drivers/namcos23.c
| r11160 | r11161 | |
| 989 | 989 | #define S23_HSYNC (16666150) |
| 990 | 990 | #define S23_MODECLOCK (130205) |
| 991 | 991 | |
| 992 | | static tilemap_t *bgtilemap; |
| 993 | | static UINT32 *namcos23_textram, *namcos23_shared_ram, *gmen_sh2_shared; |
| 994 | | static UINT32 *namcos23_charram; |
| 995 | | static UINT8 namcos23_jvssense; |
| 996 | | static INT32 has_jvsio; |
| 992 | enum { MODEL, FLUSH }; |
| 997 | 993 | |
| 998 | | static bool ctl_vbl_active; |
| 999 | | static UINT8 ctl_led; |
| 1000 | | static UINT16 ctl_inp_buffer[2]; |
| 994 | struct namcos23_render_entry { |
| 995 | int type; |
| 1001 | 996 | |
| 1002 | | static UINT16 c417_ram[0x10000], c417_adr = 0; |
| 1003 | | static UINT32 c417_pointrom_adr = 0; |
| 997 | union { |
| 998 | struct { |
| 999 | UINT16 model; |
| 1000 | INT16 m[9]; |
| 1001 | INT32 v[3]; |
| 1002 | float scaling; |
| 1003 | } model; |
| 1004 | }; |
| 1005 | }; |
| 1004 | 1006 | |
| 1005 | | static UINT16 c412_sdram_a[0x100000]; // Framebuffers, probably |
| 1006 | | static UINT16 c412_sdram_b[0x100000]; |
| 1007 | | static UINT16 c412_sram[0x20000]; // Ram-based tiles for rendering |
| 1008 | | static UINT16 c412_pczram[0x200]; // Ram-based tilemap for rendering, or something else |
| 1009 | | static UINT32 c412_adr = 0; |
| 1007 | struct namcos23_render_data { |
| 1008 | running_machine *machine; |
| 1009 | const pen_t *pens; |
| 1010 | UINT32 (*texture_lookup)(running_machine &machine, const pen_t *pens, float x, float y); |
| 1011 | }; |
| 1010 | 1012 | |
| 1011 | | static UINT16 c421_dram_a[0x40000]; |
| 1012 | | static UINT16 c421_dram_b[0x40000]; |
| 1013 | | static UINT16 c421_sram[0x8000]; |
| 1014 | | static UINT32 c421_adr = 0; |
| 1013 | struct namcos23_poly_entry { |
| 1014 | namcos23_render_data rd; |
| 1015 | float zkey; |
| 1016 | int front; |
| 1017 | int vertex_count; |
| 1018 | poly_vertex pv[16]; |
| 1019 | }; |
| 1015 | 1020 | |
| 1016 | | static INT16 s23_c422_regs[0x10]; |
| 1017 | | static int s23_subcpu_running; |
| 1021 | enum { RENDER_MAX_ENTRIES = 1000, POLY_MAX_ENTRIES = 10000 }; |
| 1018 | 1022 | |
| 1019 | | static emu_timer *c361_timer; |
| 1020 | 1023 | |
| 1021 | | static UINT32 p3d_address, p3d_size; |
| 1024 | typedef struct |
| 1025 | { |
| 1026 | UINT16 ram[0x10000]; |
| 1027 | UINT16 adr; |
| 1028 | UINT32 pointrom_adr; |
| 1029 | } c417_t; |
| 1022 | 1030 | |
| 1023 | | static const UINT32 *ptrom; |
| 1024 | | static const UINT16 *tmlrom; |
| 1025 | | static const UINT8 *tmhrom, *texrom; |
| 1026 | | static UINT32 tileid_mask, tile_mask, ptrom_limit; |
| 1031 | typedef struct |
| 1032 | { |
| 1033 | UINT16 sdram_a[0x100000]; // Framebuffers, probably |
| 1034 | UINT16 sdram_b[0x100000]; |
| 1035 | UINT16 sram[0x20000]; // Ram-based tiles for rendering |
| 1036 | UINT16 pczram[0x200]; // Ram-based tilemap for rendering, or something else |
| 1037 | UINT32 adr; |
| 1038 | } c412_t; |
| 1027 | 1039 | |
| 1040 | typedef struct |
| 1041 | { |
| 1042 | UINT16 dram_a[0x40000]; |
| 1043 | UINT16 dram_b[0x40000]; |
| 1044 | UINT16 sram[0x8000]; |
| 1045 | UINT32 adr; |
| 1046 | } c421_t; |
| 1047 | |
| 1048 | typedef struct |
| 1049 | { |
| 1050 | INT16 regs[0x10]; |
| 1051 | } c422_t; |
| 1052 | |
| 1053 | typedef struct |
| 1054 | { |
| 1055 | emu_timer *timer; |
| 1056 | int scanline; |
| 1057 | } c361_t; |
| 1058 | |
| 1059 | typedef struct |
| 1060 | { |
| 1061 | poly_manager *polymgr; |
| 1062 | int cur; |
| 1063 | int poly_count; |
| 1064 | int count[2]; |
| 1065 | namcos23_render_entry entries[2][RENDER_MAX_ENTRIES]; |
| 1066 | namcos23_poly_entry polys[POLY_MAX_ENTRIES]; |
| 1067 | namcos23_poly_entry *poly_order[POLY_MAX_ENTRIES]; |
| 1068 | } render_t; |
| 1069 | |
| 1070 | class namcos23_state : public driver_device |
| 1071 | { |
| 1072 | public: |
| 1073 | namcos23_state(running_machine &machine, const driver_device_config_base &config) |
| 1074 | : driver_device(machine, config) { } |
| 1075 | |
| 1076 | c361_t m_c361; |
| 1077 | c417_t m_c417; |
| 1078 | c412_t m_c412; |
| 1079 | c421_t m_c421; |
| 1080 | c422_t m_c422; |
| 1081 | render_t m_render; |
| 1082 | |
| 1083 | tilemap_t *m_bgtilemap; |
| 1084 | UINT32 *m_textram; |
| 1085 | UINT32 *m_shared_ram; |
| 1086 | UINT32 *m_gmen_sh2_shared; |
| 1087 | UINT32 *m_charram; |
| 1088 | UINT8 m_jvssense; |
| 1089 | INT32 m_has_jvsio; |
| 1090 | bool m_ctl_vbl_active; |
| 1091 | UINT8 m_ctl_led; |
| 1092 | UINT16 m_ctl_inp_buffer[2]; |
| 1093 | int m_s23_subcpu_running; |
| 1094 | UINT32 m_p3d_address; |
| 1095 | UINT32 m_p3d_size; |
| 1096 | const UINT32 *m_ptrom; |
| 1097 | const UINT16 *m_tmlrom; |
| 1098 | const UINT8 *m_tmhrom; |
| 1099 | const UINT8 *m_texrom; |
| 1100 | UINT32 m_tileid_mask; |
| 1101 | UINT32 m_tile_mask; |
| 1102 | UINT32 m_ptrom_limit; |
| 1103 | |
| 1028 | 1104 | // It may only be 128 |
| 1029 | 1105 | // At 0x1e bytes per slot, rounded up to 0x20, that's 0x1000 to 0x2000 bytes. |
| 1030 | 1106 | // That fits pretty much anywhere, including inside a IC |
| r11160 | r11161 | |
| 1033 | 1109 | // Matrices are stored in signed 2.14 fixed point |
| 1034 | 1110 | // Vectors are stored in signed 10.14 fixed point |
| 1035 | 1111 | |
| 1036 | | static INT16 matrices[256][9]; |
| 1037 | | static INT32 vectors[256][3]; |
| 1038 | | static INT32 light_vector[3]; |
| 1039 | | static UINT16 scaling; |
| 1112 | INT16 m_matrices[256][9]; |
| 1113 | INT32 m_vectors[256][3]; |
| 1114 | INT32 m_light_vector[3]; |
| 1115 | UINT16 m_scaling; |
| 1116 | INT32 m_spv[3]; |
| 1117 | INT16 m_spm[3]; |
| 1040 | 1118 | |
| 1119 | int m_s23_porta; |
| 1120 | int m_s23_rtcstate; |
| 1121 | int m_s23_lastpB; |
| 1122 | int m_s23_setstate; |
| 1123 | int m_s23_setnum; |
| 1124 | int m_s23_settings[8]; |
| 1125 | UINT8 m_maintoio[128]; |
| 1126 | UINT8 m_mi_rd; |
| 1127 | UINT8 m_mi_wr; |
| 1128 | UINT8 m_iotomain[128]; |
| 1129 | UINT8 m_im_rd; |
| 1130 | UINT8 m_im_wr; |
| 1131 | UINT8 m_s23_tssio_port_4; |
| 1132 | }; |
| 1041 | 1133 | |
| 1134 | |
| 1135 | |
| 1042 | 1136 | static UINT16 nthword( const UINT32 *pSource, int offs ) |
| 1043 | 1137 | { |
| 1044 | 1138 | pSource += offs/2; |
| r11160 | r11161 | |
| 1047 | 1141 | |
| 1048 | 1142 | static TILE_GET_INFO( TextTilemapGetInfo ) |
| 1049 | 1143 | { |
| 1050 | | UINT16 data = nthword( namcos23_textram,tile_index ); |
| 1144 | namcos23_state *state = machine.driver_data<namcos23_state>(); |
| 1145 | UINT16 data = nthword( state->m_textram,tile_index ); |
| 1051 | 1146 | /** |
| 1052 | 1147 | * x---.----.----.---- blend |
| 1053 | 1148 | * xxxx.----.----.---- palette select |
| r11160 | r11161 | |
| 1059 | 1154 | |
| 1060 | 1155 | static WRITE32_HANDLER( namcos23_textram_w ) |
| 1061 | 1156 | { |
| 1062 | | COMBINE_DATA( &namcos23_textram[offset] ); |
| 1063 | | tilemap_mark_tile_dirty(bgtilemap, offset*2); |
| 1064 | | tilemap_mark_tile_dirty(bgtilemap, (offset*2)+1); |
| 1157 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1158 | COMBINE_DATA( &state->m_textram[offset] ); |
| 1159 | tilemap_mark_tile_dirty(state->m_bgtilemap, offset*2); |
| 1160 | tilemap_mark_tile_dirty(state->m_bgtilemap, (offset*2)+1); |
| 1065 | 1161 | } |
| 1066 | 1162 | |
| 1067 | 1163 | static WRITE32_HANDLER( s23_txtchar_w ) |
| 1068 | 1164 | { |
| 1069 | | COMBINE_DATA(&namcos23_charram[offset]); |
| 1165 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1166 | COMBINE_DATA(&state->m_charram[offset]); |
| 1070 | 1167 | gfx_element_mark_dirty(space->machine().gfx[0], offset/32); |
| 1071 | 1168 | } |
| 1072 | 1169 | |
| r11160 | r11161 | |
| 1101 | 1198 | |
| 1102 | 1199 | static READ16_HANDLER(s23_c417_r) |
| 1103 | 1200 | { |
| 1201 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1202 | c417_t &c417 = state->m_c417; |
| 1203 | |
| 1104 | 1204 | switch(offset) { |
| 1105 | 1205 | /* According to timecrs2c, +0 is the status word with bits being: |
| 1106 | 1206 | 15: test mode flag (huh?) |
| r11160 | r11161 | |
| 1117 | 1217 | 0: xcpreq |
| 1118 | 1218 | */ |
| 1119 | 1219 | case 0: return 0x8e | (space->machine().primary_screen->vblank() ? 0x0000 : 0x8000); |
| 1120 | | case 1: return c417_adr; |
| 1220 | case 1: return c417.adr; |
| 1121 | 1221 | case 4: |
| 1122 | | // logerror("c417_r %04x = %04x (%08x, %08x)\n", c417_adr, c417_ram[c417_adr], cpu_get_pc(&space->device()), (unsigned int)cpu_get_reg(&space->device(), MIPS3_R31)); |
| 1123 | | return c417_ram[c417_adr]; |
| 1222 | // logerror("c417_r %04x = %04x (%08x, %08x)\n", c417.adr, c417.ram[c417.adr], cpu_get_pc(&space->device()), (unsigned int)cpu_get_reg(&space->device(), MIPS3_R31)); |
| 1223 | return c417.ram[c417.adr]; |
| 1124 | 1224 | case 5: |
| 1125 | | if(c417_pointrom_adr >= ptrom_limit) |
| 1225 | if(c417.pointrom_adr >= state->m_ptrom_limit) |
| 1126 | 1226 | return 0xffff; |
| 1127 | | return ptrom[c417_pointrom_adr] >> 16; |
| 1227 | return state->m_ptrom[c417.pointrom_adr] >> 16; |
| 1128 | 1228 | case 6: |
| 1129 | | if(c417_pointrom_adr >= ptrom_limit) |
| 1229 | if(c417.pointrom_adr >= state->m_ptrom_limit) |
| 1130 | 1230 | return 0xffff; |
| 1131 | | return ptrom[c417_pointrom_adr]; |
| 1231 | return state->m_ptrom[c417.pointrom_adr]; |
| 1132 | 1232 | |
| 1133 | 1233 | } |
| 1134 | 1234 | |
| r11160 | r11161 | |
| 1138 | 1238 | |
| 1139 | 1239 | static WRITE16_HANDLER(s23_c417_w) |
| 1140 | 1240 | { |
| 1141 | | switch(offset) { |
| 1142 | | case 0: |
| 1241 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1242 | c417_t &c417 = state->m_c417; |
| 1243 | |
| 1244 | switch(offset) { |
| 1245 | case 0: |
| 1143 | 1246 | logerror("p3d PIO %04x\n", data); |
| 1144 | 1247 | break; |
| 1145 | | case 1: |
| 1146 | | COMBINE_DATA(&c417_adr); |
| 1147 | | break; |
| 1248 | case 1: |
| 1249 | COMBINE_DATA(&c417.adr); |
| 1250 | break; |
| 1148 | 1251 | case 2: |
| 1149 | | c417_pointrom_adr = (c417_pointrom_adr << 16) | data; |
| 1252 | c417.pointrom_adr = (c417.pointrom_adr << 16) | data; |
| 1150 | 1253 | break; |
| 1151 | 1254 | case 3: |
| 1152 | | c417_pointrom_adr = 0; |
| 1255 | c417.pointrom_adr = 0; |
| 1153 | 1256 | break; |
| 1154 | | case 4: |
| 1155 | | // logerror("c417_w %04x = %04x (%08x, %08x)\n", c417_adr, data, cpu_get_pc(&space->device()), (unsigned int)cpu_get_reg(&space->device(), MIPS3_R31)); |
| 1156 | | COMBINE_DATA(c417_ram + c417_adr); |
| 1157 | | break; |
| 1158 | | case 7: |
| 1159 | | logerror("c417_w: ack IRQ 2 (%x)\n", data); |
| 1160 | | cputag_set_input_line(space->machine(), "maincpu", MIPS3_IRQ2, CLEAR_LINE); |
| 1161 | | break; |
| 1162 | | default: |
| 1163 | | logerror("c417_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, cpu_get_pc(&space->device()), (unsigned int)cpu_get_reg(&space->device(), MIPS3_R31)); |
| 1164 | | break; |
| 1165 | | } |
| 1257 | case 4: |
| 1258 | // logerror("c417_w %04x = %04x (%08x, %08x)\n", c417.adr, data, cpu_get_pc(&space->device()), (unsigned int)cpu_get_reg(&space->device(), MIPS3_R31)); |
| 1259 | COMBINE_DATA(c417.ram + c417.adr); |
| 1260 | break; |
| 1261 | case 7: |
| 1262 | logerror("c417_w: ack IRQ 2 (%x)\n", data); |
| 1263 | cputag_set_input_line(space->machine(), "maincpu", MIPS3_IRQ2, CLEAR_LINE); |
| 1264 | break; |
| 1265 | default: |
| 1266 | logerror("c417_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, cpu_get_pc(&space->device()), (unsigned int)cpu_get_reg(&space->device(), MIPS3_R31)); |
| 1267 | break; |
| 1268 | } |
| 1166 | 1269 | } |
| 1167 | 1270 | |
| 1168 | 1271 | static READ16_HANDLER(s23_c412_ram_r) |
| 1169 | 1272 | { |
| 1273 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1274 | c412_t &c412 = state->m_c412; |
| 1275 | |
| 1170 | 1276 | // logerror("c412_ram_r %06x (%08x, %08x)\n", offset, cpu_get_pc(&space->device()), (unsigned int)cpu_get_reg(&space->device(), MIPS3_R31)); |
| 1171 | 1277 | if(offset < 0x100000) |
| 1172 | | return c412_sdram_a[offset & 0xfffff]; |
| 1278 | return c412.sdram_a[offset & 0xfffff]; |
| 1173 | 1279 | else if(offset < 0x200000) |
| 1174 | | return c412_sdram_b[offset & 0xfffff]; |
| 1280 | return c412.sdram_b[offset & 0xfffff]; |
| 1175 | 1281 | else if(offset < 0x220000) |
| 1176 | | return c412_sram [offset & 0x1ffff]; |
| 1282 | return c412.sram [offset & 0x1ffff]; |
| 1177 | 1283 | else if(offset < 0x220200) |
| 1178 | | return c412_pczram [offset & 0x001ff]; |
| 1284 | return c412.pczram [offset & 0x001ff]; |
| 1179 | 1285 | |
| 1180 | 1286 | return 0xffff; |
| 1181 | 1287 | } |
| 1182 | 1288 | |
| 1183 | 1289 | static WRITE16_HANDLER(s23_c412_ram_w) |
| 1184 | 1290 | { |
| 1291 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1292 | c412_t &c412 = state->m_c412; |
| 1293 | |
| 1185 | 1294 | // logerror("c412_ram_w %06x = %04x (%08x, %08x)\n", offset, data, cpu_get_pc(&space->device()), (unsigned int)cpu_get_reg(&space->device(), MIPS3_R31)); |
| 1186 | 1295 | if(offset < 0x100000) |
| 1187 | | COMBINE_DATA(c412_sdram_a + (offset & 0xfffff)); |
| 1296 | COMBINE_DATA(c412.sdram_a + (offset & 0xfffff)); |
| 1188 | 1297 | else if(offset < 0x200000) |
| 1189 | | COMBINE_DATA(c412_sdram_b + (offset & 0xfffff)); |
| 1298 | COMBINE_DATA(c412.sdram_b + (offset & 0xfffff)); |
| 1190 | 1299 | else if(offset < 0x220000) |
| 1191 | | COMBINE_DATA(c412_sram + (offset & 0x1ffff)); |
| 1300 | COMBINE_DATA(c412.sram + (offset & 0x1ffff)); |
| 1192 | 1301 | else if(offset < 0x220200) |
| 1193 | | COMBINE_DATA(c412_pczram + (offset & 0x001ff)); |
| 1302 | COMBINE_DATA(c412.pczram + (offset & 0x001ff)); |
| 1194 | 1303 | } |
| 1195 | 1304 | |
| 1196 | 1305 | static READ16_HANDLER(s23_c412_r) |
| 1197 | 1306 | { |
| 1307 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1308 | c412_t &c412 = state->m_c412; |
| 1309 | |
| 1198 | 1310 | switch(offset) { |
| 1199 | 1311 | case 3: |
| 1200 | 1312 | // 0001 = busy, 0002 = game uploads things |
| 1201 | 1313 | return 0x0002; |
| 1202 | | case 8: return c412_adr; |
| 1203 | | case 9: return c412_adr >> 16; |
| 1204 | | case 10: return s23_c412_ram_r(space, c412_adr, mem_mask); |
| 1314 | case 8: return c412.adr; |
| 1315 | case 9: return c412.adr >> 16; |
| 1316 | case 10: return s23_c412_ram_r(space, c412.adr, mem_mask); |
| 1205 | 1317 | } |
| 1206 | 1318 | |
| 1207 | 1319 | logerror("c412_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, cpu_get_pc(&space->device()), (unsigned int)cpu_get_reg(&space->device(), MIPS3_R31)); |
| r11160 | r11161 | |
| 1210 | 1322 | |
| 1211 | 1323 | static WRITE16_HANDLER(s23_c412_w) |
| 1212 | 1324 | { |
| 1213 | | switch(offset) { |
| 1214 | | case 8: c412_adr = (data & mem_mask) | (c412_adr & (0xffffffff ^ mem_mask)); break; |
| 1215 | | case 9: c412_adr = ((data & mem_mask) << 16) | (c412_adr & (0xffffffff ^ (mem_mask << 16))); break; |
| 1216 | | case 10: s23_c412_ram_w(space, c412_adr, data, mem_mask); c412_adr += 2; break; |
| 1217 | | default: |
| 1218 | | logerror("c412_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, cpu_get_pc(&space->device()), (unsigned int)cpu_get_reg(&space->device(), MIPS3_R31)); |
| 1219 | | break; |
| 1220 | | } |
| 1325 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1326 | c412_t &c412 = state->m_c412; |
| 1327 | |
| 1328 | switch(offset) { |
| 1329 | case 8: c412.adr = (data & mem_mask) | (c412.adr & (0xffffffff ^ mem_mask)); break; |
| 1330 | case 9: c412.adr = ((data & mem_mask) << 16) | (c412.adr & (0xffffffff ^ (mem_mask << 16))); break; |
| 1331 | case 10: s23_c412_ram_w(space, c412.adr, data, mem_mask); c412.adr += 2; break; |
| 1332 | default: |
| 1333 | logerror("c412_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, cpu_get_pc(&space->device()), (unsigned int)cpu_get_reg(&space->device(), MIPS3_R31)); |
| 1334 | break; |
| 1335 | } |
| 1221 | 1336 | } |
| 1222 | 1337 | |
| 1223 | 1338 | static READ16_HANDLER(s23_c421_ram_r) |
| 1224 | 1339 | { |
| 1340 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1341 | c421_t &c421 = state->m_c421; |
| 1342 | |
| 1225 | 1343 | // logerror("c421_ram_r %06x (%08x, %08x)\n", offset, cpu_get_pc(&space->device()), (unsigned int)cpu_get_reg(&space->device(), MIPS3_R31)); |
| 1226 | 1344 | if(offset < 0x40000) |
| 1227 | | return c421_dram_a[offset & 0x3ffff]; |
| 1345 | return c421.dram_a[offset & 0x3ffff]; |
| 1228 | 1346 | else if(offset < 0x80000) |
| 1229 | | return c421_dram_b[offset & 0x3ffff]; |
| 1347 | return c421.dram_b[offset & 0x3ffff]; |
| 1230 | 1348 | else if(offset < 0x88000) |
| 1231 | | return c421_sram [offset & 0x07fff]; |
| 1349 | return c421.sram [offset & 0x07fff]; |
| 1232 | 1350 | |
| 1233 | 1351 | return 0xffff; |
| 1234 | 1352 | } |
| 1235 | 1353 | |
| 1236 | 1354 | static WRITE16_HANDLER(s23_c421_ram_w) |
| 1237 | 1355 | { |
| 1356 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1357 | c421_t &c421 = state->m_c421; |
| 1358 | |
| 1238 | 1359 | // logerror("c421_ram_w %06x = %04x (%08x, %08x)\n", offset, data, cpu_get_pc(&space->device()), (unsigned int)cpu_get_reg(&space->device(), MIPS3_R31)); |
| 1239 | 1360 | if(offset < 0x40000) |
| 1240 | | COMBINE_DATA(c421_dram_a + (offset & 0x3ffff)); |
| 1361 | COMBINE_DATA(c421.dram_a + (offset & 0x3ffff)); |
| 1241 | 1362 | else if(offset < 0x80000) |
| 1242 | | COMBINE_DATA(c421_dram_b + (offset & 0x3ffff)); |
| 1363 | COMBINE_DATA(c421.dram_b + (offset & 0x3ffff)); |
| 1243 | 1364 | else if(offset < 0x88000) |
| 1244 | | COMBINE_DATA(c421_sram + (offset & 0x07fff)); |
| 1365 | COMBINE_DATA(c421.sram + (offset & 0x07fff)); |
| 1245 | 1366 | } |
| 1246 | 1367 | |
| 1247 | 1368 | static READ16_HANDLER(s23_c421_r) |
| 1248 | 1369 | { |
| 1370 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1371 | c421_t &c421 = state->m_c421; |
| 1372 | |
| 1249 | 1373 | switch(offset) { |
| 1250 | | case 0: return s23_c421_ram_r(space, c421_adr & 0xfffff, mem_mask); |
| 1251 | | case 2: return c421_adr >> 16; |
| 1252 | | case 3: return c421_adr; |
| 1374 | case 0: return s23_c421_ram_r(space, c421.adr & 0xfffff, mem_mask); |
| 1375 | case 2: return c421.adr >> 16; |
| 1376 | case 3: return c421.adr; |
| 1253 | 1377 | } |
| 1254 | 1378 | |
| 1255 | 1379 | logerror("c421_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, cpu_get_pc(&space->device()), (unsigned int)cpu_get_reg(&space->device(), MIPS3_R31)); |
| r11160 | r11161 | |
| 1258 | 1382 | |
| 1259 | 1383 | static WRITE16_HANDLER(s23_c421_w) |
| 1260 | 1384 | { |
| 1261 | | switch(offset) { |
| 1262 | | case 0: s23_c421_ram_w(space, c421_adr & 0xfffff, data, mem_mask); c421_adr += 2; break; |
| 1263 | | case 2: c421_adr = ((data & mem_mask) << 16) | (c421_adr & (0xffffffff ^ (mem_mask << 16))); break; |
| 1264 | | case 3: c421_adr = (data & mem_mask) | (c421_adr & (0xffffffff ^ mem_mask)); break; |
| 1265 | | default: |
| 1266 | | logerror("c421_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, cpu_get_pc(&space->device()), (unsigned int)cpu_get_reg(&space->device(), MIPS3_R31)); |
| 1267 | | break; |
| 1268 | | } |
| 1385 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1386 | c421_t &c421 = state->m_c421; |
| 1387 | |
| 1388 | switch(offset) { |
| 1389 | case 0: s23_c421_ram_w(space, c421.adr & 0xfffff, data, mem_mask); c421.adr += 2; break; |
| 1390 | case 2: c421.adr = ((data & mem_mask) << 16) | (c421.adr & (0xffffffff ^ (mem_mask << 16))); break; |
| 1391 | case 3: c421.adr = (data & mem_mask) | (c421.adr & (0xffffffff ^ mem_mask)); break; |
| 1392 | default: |
| 1393 | logerror("c421_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, cpu_get_pc(&space->device()), (unsigned int)cpu_get_reg(&space->device(), MIPS3_R31)); |
| 1394 | break; |
| 1395 | } |
| 1269 | 1396 | } |
| 1270 | 1397 | |
| 1271 | 1398 | static WRITE16_HANDLER(s23_ctl_w) |
| 1272 | 1399 | { |
| 1400 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1273 | 1401 | switch(offset) { |
| 1274 | 1402 | case 0: { |
| 1275 | | if(ctl_led != (data & 0xff)) { |
| 1276 | | ctl_led = data; |
| 1403 | if(state->m_ctl_led != (data & 0xff)) { |
| 1404 | state->m_ctl_led = data; |
| 1277 | 1405 | /* logerror("LEDS %c%c%c%c%c%c%c%c\n", |
| 1278 | | ctl_led & 0x80 ? '.' : '#', |
| 1279 | | ctl_led & 0x40 ? '.' : '#', |
| 1280 | | ctl_led & 0x20 ? '.' : '#', |
| 1281 | | ctl_led & 0x10 ? '.' : '#', |
| 1282 | | ctl_led & 0x08 ? '.' : '#', |
| 1283 | | ctl_led & 0x04 ? '.' : '#', |
| 1284 | | ctl_led & 0x02 ? '.' : '#', |
| 1285 | | ctl_led & 0x01 ? '.' : '#');*/ |
| 1406 | state->m_ctl_led & 0x80 ? '.' : '#', |
| 1407 | state->m_ctl_led & 0x40 ? '.' : '#', |
| 1408 | state->m_ctl_led & 0x20 ? '.' : '#', |
| 1409 | state->m_ctl_led & 0x10 ? '.' : '#', |
| 1410 | state->m_ctl_led & 0x08 ? '.' : '#', |
| 1411 | state->m_ctl_led & 0x04 ? '.' : '#', |
| 1412 | state->m_ctl_led & 0x02 ? '.' : '#', |
| 1413 | state->m_ctl_led & 0x01 ? '.' : '#');*/ |
| 1286 | 1414 | } |
| 1287 | 1415 | break; |
| 1288 | 1416 | } |
| 1289 | 1417 | |
| 1290 | 1418 | case 2: case 3: |
| 1291 | 1419 | // These may be coming from another CPU, in particular the I/O one |
| 1292 | | ctl_inp_buffer[offset-2] = input_port_read(space->machine(), offset == 2 ? "P1" : "P2"); |
| 1420 | state->m_ctl_inp_buffer[offset-2] = input_port_read(space->machine(), offset == 2 ? "P1" : "P2"); |
| 1293 | 1421 | break; |
| 1294 | 1422 | case 5: |
| 1295 | | if(ctl_vbl_active) { |
| 1296 | | ctl_vbl_active = false; |
| 1423 | if(state->m_ctl_vbl_active) { |
| 1424 | state->m_ctl_vbl_active = false; |
| 1297 | 1425 | device_set_input_line(&space->device(), MIPS3_IRQ0, CLEAR_LINE); |
| 1298 | 1426 | } |
| 1299 | 1427 | break; |
| r11160 | r11161 | |
| 1310 | 1438 | |
| 1311 | 1439 | static READ16_HANDLER(s23_ctl_r) |
| 1312 | 1440 | { |
| 1441 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1313 | 1442 | switch(offset) { |
| 1314 | 1443 | // 0100 set freezes gorgon (polygon fifo flag) |
| 1315 | 1444 | case 1: return 0x0000 | input_port_read(space->machine(), "DSW"); |
| 1316 | 1445 | case 2: case 3: { |
| 1317 | | UINT16 res = ctl_inp_buffer[offset-2] & 0x800 ? 0xffff : 0x0000; |
| 1318 | | ctl_inp_buffer[offset-2] = (ctl_inp_buffer[offset-2] << 1) | 1; |
| 1446 | UINT16 res = state->m_ctl_inp_buffer[offset-2] & 0x800 ? 0xffff : 0x0000; |
| 1447 | state->m_ctl_inp_buffer[offset-2] = (state->m_ctl_inp_buffer[offset-2] << 1) | 1; |
| 1319 | 1448 | return res; |
| 1320 | 1449 | } |
| 1321 | 1450 | } |
| r11160 | r11161 | |
| 1324 | 1453 | } |
| 1325 | 1454 | |
| 1326 | 1455 | // raster timer. TC2 indicates it's probably one-shot since it resets it each VBL... |
| 1327 | | static int c361_scanline; |
| 1328 | 1456 | static TIMER_CALLBACK( c361_timer_cb ) |
| 1329 | 1457 | { |
| 1330 | | if (c361_scanline != 511) |
| 1458 | namcos23_state *state = machine.driver_data<namcos23_state>(); |
| 1459 | c361_t &c361 = state->m_c361; |
| 1460 | |
| 1461 | if (c361.scanline != 511) |
| 1331 | 1462 | { |
| 1332 | 1463 | cputag_set_input_line(machine, "maincpu", MIPS3_IRQ1, ASSERT_LINE); |
| 1333 | | c361_timer->adjust(attotime::never); |
| 1464 | c361.timer->adjust(attotime::never); |
| 1334 | 1465 | } |
| 1335 | 1466 | } |
| 1336 | 1467 | |
| 1337 | 1468 | static WRITE16_HANDLER(s23_c361_w) |
| 1338 | 1469 | { |
| 1470 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1471 | c361_t &c361 = state->m_c361; |
| 1472 | |
| 1339 | 1473 | switch(offset) { |
| 1340 | 1474 | case 0: |
| 1341 | | tilemap_set_scrollx(bgtilemap, 0, data&0xfff); |
| 1475 | tilemap_set_scrollx(state->m_bgtilemap, 0, data&0xfff); |
| 1342 | 1476 | break; |
| 1343 | 1477 | |
| 1344 | 1478 | case 1: |
| 1345 | | tilemap_set_scrolly(bgtilemap, 0, data&0xfff); |
| 1479 | tilemap_set_scrolly(state->m_bgtilemap, 0, data&0xfff); |
| 1346 | 1480 | break; |
| 1347 | 1481 | |
| 1348 | 1482 | case 4: // interrupt control |
| 1349 | | c361_scanline = data; |
| 1483 | c361.scanline = data; |
| 1350 | 1484 | if (data == 0x1ff) |
| 1351 | 1485 | { |
| 1352 | 1486 | cputag_set_input_line(space->machine(), "maincpu", MIPS3_IRQ1, CLEAR_LINE); |
| 1353 | | c361_timer->adjust(attotime::never); |
| 1487 | c361.timer->adjust(attotime::never); |
| 1354 | 1488 | } |
| 1355 | 1489 | else |
| 1356 | 1490 | { |
| 1357 | | c361_timer->adjust(space->machine().primary_screen->time_until_pos(c361_scanline)); |
| 1491 | c361.timer->adjust(space->machine().primary_screen->time_until_pos(c361.scanline)); |
| 1358 | 1492 | } |
| 1359 | 1493 | break; |
| 1360 | 1494 | |
| r11160 | r11161 | |
| 1375 | 1509 | |
| 1376 | 1510 | static READ16_HANDLER(s23_c422_r) |
| 1377 | 1511 | { |
| 1378 | | return s23_c422_regs[offset];; |
| 1512 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1513 | c422_t &c422 = state->m_c422; |
| 1514 | return c422.regs[offset]; |
| 1379 | 1515 | } |
| 1380 | 1516 | |
| 1381 | 1517 | static WRITE16_HANDLER(s23_c422_w) |
| 1382 | 1518 | { |
| 1519 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1520 | c422_t &c422 = state->m_c422; |
| 1383 | 1521 | switch (offset) |
| 1384 | 1522 | { |
| 1385 | 1523 | case 1: |
| r11160 | r11161 | |
| 1401 | 1539 | |
| 1402 | 1540 | } |
| 1403 | 1541 | |
| 1404 | | COMBINE_DATA(&s23_c422_regs[offset]); |
| 1542 | COMBINE_DATA(&c422.regs[offset]); |
| 1405 | 1543 | } |
| 1406 | 1544 | |
| 1407 | 1545 | // as with System 22, we need to halt the MCU while checking shared RAM |
| 1408 | 1546 | static WRITE32_HANDLER( s23_mcuen_w ) |
| 1409 | 1547 | { |
| 1548 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1410 | 1549 | logerror("mcuen_w: mask %08x, data %08x\n", mem_mask, data); |
| 1411 | 1550 | if (mem_mask == 0x0000ffff) |
| 1412 | 1551 | { |
| r11160 | r11161 | |
| 1415 | 1554 | logerror("S23: booting H8/3002\n"); |
| 1416 | 1555 | |
| 1417 | 1556 | // Panic Park: writing 1 when it's already running means reboot? |
| 1418 | | if (s23_subcpu_running) |
| 1557 | if (state->m_s23_subcpu_running) |
| 1419 | 1558 | { |
| 1420 | 1559 | cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_RESET, ASSERT_LINE); |
| 1421 | 1560 | } |
| 1422 | 1561 | |
| 1423 | 1562 | cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_RESET, CLEAR_LINE); |
| 1424 | | s23_subcpu_running = 1; |
| 1563 | state->m_s23_subcpu_running = 1; |
| 1425 | 1564 | } |
| 1426 | 1565 | else |
| 1427 | 1566 | { |
| 1428 | 1567 | logerror("S23: stopping H8/3002\n"); |
| 1429 | 1568 | cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_RESET, ASSERT_LINE); |
| 1430 | | s23_subcpu_running = 0; |
| 1569 | state->m_s23_subcpu_running = 0; |
| 1431 | 1570 | } |
| 1432 | 1571 | } |
| 1433 | 1572 | } |
| r11160 | r11161 | |
| 1440 | 1579 | |
| 1441 | 1580 | static READ32_HANDLER( gorgon_sharedram_r ) |
| 1442 | 1581 | { |
| 1443 | | return namcos23_shared_ram[offset]; |
| 1582 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1583 | return state->m_shared_ram[offset]; |
| 1444 | 1584 | } |
| 1445 | 1585 | |
| 1446 | 1586 | static WRITE32_HANDLER( gorgon_sharedram_w ) |
| 1447 | 1587 | { |
| 1448 | | COMBINE_DATA(&namcos23_shared_ram[offset]); |
| 1588 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1589 | COMBINE_DATA(&state->m_shared_ram[offset]); |
| 1449 | 1590 | |
| 1450 | 1591 | // hack for final furlong |
| 1451 | 1592 | if ((offset == 0x6000/4) && (data == 0) && (mem_mask == 0xff000000)) |
| r11160 | r11161 | |
| 1464 | 1605 | |
| 1465 | 1606 | // 3D hardware, to throw at least in part in video/namcos23.c |
| 1466 | 1607 | |
| 1467 | | enum { MODEL, FLUSH }; |
| 1468 | | |
| 1469 | | struct namcos23_render_entry { |
| 1470 | | int type; |
| 1471 | | |
| 1472 | | union { |
| 1473 | | struct { |
| 1474 | | UINT16 model; |
| 1475 | | INT16 m[9]; |
| 1476 | | INT32 v[3]; |
| 1477 | | float scaling; |
| 1478 | | } model; |
| 1479 | | }; |
| 1480 | | }; |
| 1481 | | |
| 1482 | | struct namcos23_render_data { |
| 1483 | | const pen_t *pens; |
| 1484 | | UINT32 (*texture_lookup)(const pen_t *pens, float x, float y); |
| 1485 | | }; |
| 1486 | | |
| 1487 | | struct namcos23_poly_entry { |
| 1488 | | namcos23_render_data rd; |
| 1489 | | float zkey; |
| 1490 | | int front; |
| 1491 | | int vertex_count; |
| 1492 | | poly_vertex pv[16]; |
| 1493 | | }; |
| 1494 | | |
| 1495 | | enum { RENDER_MAX_ENTRIES = 1000, POLY_MAX_ENTRIES = 10000 }; |
| 1496 | | static namcos23_render_entry render_entries[2][RENDER_MAX_ENTRIES]; |
| 1497 | | static namcos23_poly_entry render_polys[POLY_MAX_ENTRIES]; |
| 1498 | | static int render_poly_order[POLY_MAX_ENTRIES]; |
| 1499 | | static int render_count[2], render_cur, render_poly_count; |
| 1500 | | static poly_manager *polymgr; |
| 1501 | | |
| 1502 | 1608 | INLINE INT32 u32_to_s24(UINT32 v) |
| 1503 | 1609 | { |
| 1504 | 1610 | return v & 0x800000 ? v | 0xff000000 : v & 0xffffff; |
| r11160 | r11161 | |
| 1519 | 1625 | return UINT8(l); |
| 1520 | 1626 | } |
| 1521 | 1627 | |
| 1522 | | static UINT32 texture_lookup_nocache_point(const pen_t *pens, float x, float y) |
| 1628 | static UINT32 texture_lookup_nocache_point(running_machine &machine, const pen_t *pens, float x, float y) |
| 1523 | 1629 | { |
| 1630 | namcos23_state *state = machine.driver_data<namcos23_state>(); |
| 1524 | 1631 | UINT32 xx = UINT32(x); |
| 1525 | 1632 | UINT32 yy = UINT32(y); |
| 1526 | | UINT32 tileid = ((xx >> 4) & 0xff) | ((yy << 4) & tileid_mask); |
| 1527 | | UINT8 attr = tmhrom[tileid >> 1]; |
| 1633 | UINT32 tileid = ((xx >> 4) & 0xff) | ((yy << 4) & state->m_tileid_mask); |
| 1634 | UINT8 attr = state->m_tmhrom[tileid >> 1]; |
| 1528 | 1635 | if(tileid & 1) |
| 1529 | 1636 | attr &= 15; |
| 1530 | 1637 | else |
| 1531 | 1638 | attr >>= 4; |
| 1532 | | UINT32 tile = (tmlrom[tileid] | (attr << 16)) & tile_mask; |
| 1639 | UINT32 tile = (state->m_tmlrom[tileid] | (attr << 16)) & state->m_tile_mask; |
| 1533 | 1640 | |
| 1534 | 1641 | // Probably swapx/swapy to add on bits 2-3 of attr |
| 1535 | 1642 | // Bits used by motoxgo at least |
| 1536 | | UINT8 color = texrom[(tile << 8) | ((yy << 4) & 0xf0) | (xx & 0x0f)]; |
| 1643 | UINT8 color = state->m_texrom[(tile << 8) | ((yy << 4) & 0xf0) | (xx & 0x0f)]; |
| 1537 | 1644 | return pens[color]; |
| 1538 | 1645 | } |
| 1539 | 1646 | |
| r11160 | r11161 | |
| 1554 | 1661 | |
| 1555 | 1662 | for(int x = extent->startx; x < extent->stopx; x++) { |
| 1556 | 1663 | float z = w ? 1/w : 0; |
| 1557 | | UINT32 pcol = rd->texture_lookup(rd->pens, u*z, v*z); |
| 1664 | UINT32 pcol = rd->texture_lookup(*rd->machine, rd->pens, u*z, v*z); |
| 1558 | 1665 | float ll = l*z; |
| 1559 | 1666 | *img = (light(pcol >> 16, ll) << 16) | (light(pcol >> 8, ll) << 8) | light(pcol, ll); |
| 1560 | 1667 | |
| r11160 | r11161 | |
| 1566 | 1673 | } |
| 1567 | 1674 | } |
| 1568 | 1675 | |
| 1569 | | static INT32 *p3d_getv(UINT16 id) |
| 1676 | static INT32 *p3d_getv(namcos23_state *state, UINT16 id) |
| 1570 | 1677 | { |
| 1571 | | static INT32 sp[3]; |
| 1572 | 1678 | if(id == 0x8000) |
| 1573 | | return light_vector; |
| 1679 | return state->m_light_vector; |
| 1574 | 1680 | if(id >= 0x100) { |
| 1575 | | memset(sp, 0, sizeof(sp)); |
| 1576 | | return sp; |
| 1681 | memset(state->m_spv, 0, sizeof(state->m_spv)); |
| 1682 | return state->m_spv; |
| 1577 | 1683 | } |
| 1578 | | return vectors[id]; |
| 1684 | return state->m_vectors[id]; |
| 1579 | 1685 | } |
| 1580 | 1686 | |
| 1581 | | static INT16 *p3d_getm(UINT16 id) |
| 1687 | static INT16 *p3d_getm(namcos23_state *state, UINT16 id) |
| 1582 | 1688 | { |
| 1583 | | static INT16 sp[3]; |
| 1584 | 1689 | if(id >= 0x100) { |
| 1585 | | memset(sp, 0, sizeof(sp)); |
| 1586 | | return sp; |
| 1690 | memset(state->m_spm, 0, sizeof(state->m_spm)); |
| 1691 | return state->m_spm; |
| 1587 | 1692 | } |
| 1588 | | return matrices[id]; |
| 1693 | return state->m_matrices[id]; |
| 1589 | 1694 | } |
| 1590 | 1695 | |
| 1591 | | static void p3d_matrix_set(const UINT16 *p, int size) |
| 1696 | static void p3d_matrix_set(namcos23_state *state, const UINT16 *p, int size) |
| 1592 | 1697 | { |
| 1593 | 1698 | if(size != 10) { |
| 1594 | 1699 | logerror("WARNING: p3d_matrix_set with size %d\n", size); |
| 1595 | 1700 | return; |
| 1596 | 1701 | } |
| 1597 | | INT16 *t = p3d_getm(*p++); |
| 1702 | INT16 *t = p3d_getm(state, *p++); |
| 1598 | 1703 | for(int i=0; i<9; i++) |
| 1599 | 1704 | t[i] = *p++; |
| 1600 | 1705 | } |
| 1601 | 1706 | |
| 1602 | | static void p3d_vector_set(const UINT16 *p, int size) |
| 1707 | static void p3d_vector_set(namcos23_state *state, const UINT16 *p, int size) |
| 1603 | 1708 | { |
| 1604 | 1709 | if(size != 7) { |
| 1605 | 1710 | logerror("WARNING: p3d_vector_set with size %d\n", size); |
| 1606 | 1711 | return; |
| 1607 | 1712 | } |
| 1608 | | INT32 *t = p3d_getv(*p++); |
| 1713 | INT32 *t = p3d_getv(state, *p++); |
| 1609 | 1714 | for(int i=0; i<3; i++) { |
| 1610 | 1715 | t[i] = u32_to_s24((p[0] << 16) | p[1]); |
| 1611 | 1716 | p += 2; |
| 1612 | 1717 | } |
| 1613 | 1718 | } |
| 1614 | 1719 | |
| 1615 | | static void p3d_scaling_set(const UINT16 *p, int size) |
| 1720 | static void p3d_scaling_set(namcos23_state *state, const UINT16 *p, int size) |
| 1616 | 1721 | { |
| 1617 | 1722 | if(size != 1) { |
| 1618 | 1723 | logerror("WARNING: p3d_scaling_set with size %d\n", size); |
| 1619 | 1724 | return; |
| 1620 | 1725 | } |
| 1621 | | scaling = *p; |
| 1726 | state->m_scaling = *p; |
| 1622 | 1727 | } |
| 1623 | 1728 | |
| 1624 | | static void p3d_vector_matrix_mul(const UINT16 *p, int size) |
| 1729 | static void p3d_vector_matrix_mul(namcos23_state *state, const UINT16 *p, int size) |
| 1625 | 1730 | { |
| 1626 | 1731 | if(size != 4) { |
| 1627 | 1732 | logerror("WARNING: p3d_vector_matrix_mul with size %d\n", size); |
| r11160 | r11161 | |
| 1630 | 1735 | if(p[2] != 0xffff) |
| 1631 | 1736 | logerror("WARNING: p3d_vector_matrix_mul with +2=%04x\n", p[2]); |
| 1632 | 1737 | |
| 1633 | | INT32 *t = p3d_getv(p[0]); |
| 1634 | | const INT16 *m = p3d_getm(p[1]); |
| 1635 | | const INT32 *v = p3d_getv(p[3]); |
| 1738 | INT32 *t = p3d_getv(state, p[0]); |
| 1739 | const INT16 *m = p3d_getm(state, p[1]); |
| 1740 | const INT32 *v = p3d_getv(state, p[3]); |
| 1636 | 1741 | |
| 1637 | 1742 | t[0] = INT32((m[0]*INT64(v[0]) + m[3]*INT64(v[1]) + m[6]*INT64(v[2])) >> 14); |
| 1638 | 1743 | t[1] = INT32((m[1]*INT64(v[0]) + m[4]*INT64(v[1]) + m[7]*INT64(v[2])) >> 14); |
| 1639 | 1744 | t[2] = INT32((m[2]*INT64(v[0]) + m[5]*INT64(v[1]) + m[8]*INT64(v[2])) >> 14); |
| 1640 | 1745 | } |
| 1641 | 1746 | |
| 1642 | | static void p3d_matrix_vector_mul(const UINT16 *p, int size) |
| 1747 | static void p3d_matrix_vector_mul(namcos23_state *state, const UINT16 *p, int size) |
| 1643 | 1748 | { |
| 1644 | 1749 | if(size != 4) { |
| 1645 | 1750 | logerror("WARNING: p3d_matrix_vector_mul with size %d\n", size); |
| r11160 | r11161 | |
| 1648 | 1753 | if(p[2] != 0xffff) |
| 1649 | 1754 | logerror("WARNING: p3d_matrix_vector_mul with +2=%04x\n", p[2]); |
| 1650 | 1755 | |
| 1651 | | INT32 *t = p3d_getv(p[0]); |
| 1652 | | const INT16 *m = p3d_getm(p[1]); |
| 1653 | | const INT32 *v = p3d_getv(p[3]); |
| 1756 | INT32 *t = p3d_getv(state, p[0]); |
| 1757 | const INT16 *m = p3d_getm(state, p[1]); |
| 1758 | const INT32 *v = p3d_getv(state, p[3]); |
| 1654 | 1759 | |
| 1655 | 1760 | t[0] = INT32((m[0]*INT64(v[0]) + m[1]*INT64(v[1]) + m[2]*INT64(v[2])) >> 14); |
| 1656 | 1761 | t[1] = INT32((m[3]*INT64(v[0]) + m[4]*INT64(v[1]) + m[7]*INT64(v[2])) >> 14); |
| r11160 | r11161 | |
| 1658 | 1763 | } |
| 1659 | 1764 | |
| 1660 | 1765 | |
| 1661 | | static void p3d_matrix_matrix_mul(const UINT16 *p, int size) |
| 1766 | static void p3d_matrix_matrix_mul(namcos23_state *state, const UINT16 *p, int size) |
| 1662 | 1767 | { |
| 1663 | 1768 | if(size != 4) { |
| 1664 | 1769 | logerror("WARNING: p3d_matrix_matrix_mul with size %d\n", size); |
| r11160 | r11161 | |
| 1667 | 1772 | if(p[2] != 0xffff) |
| 1668 | 1773 | logerror("WARNING: p3d_matrix_matrix_mul with +2=%04x\n", p[2]); |
| 1669 | 1774 | |
| 1670 | | INT16 *t = p3d_getm(p[0]); |
| 1671 | | const INT16 *m1 = p3d_getm(p[1]); |
| 1672 | | const INT16 *m2 = p3d_getm(p[3]); |
| 1775 | INT16 *t = p3d_getm(state, p[0]); |
| 1776 | const INT16 *m1 = p3d_getm(state, p[1]); |
| 1777 | const INT16 *m2 = p3d_getm(state, p[3]); |
| 1673 | 1778 | |
| 1674 | 1779 | t[0] = INT16((m1[0]*m2[0] + m1[1]*m2[3] + m1[2]*m2[6]) >> 14); |
| 1675 | 1780 | t[1] = INT16((m1[0]*m2[1] + m1[1]*m2[4] + m1[2]*m2[7]) >> 14); |
| r11160 | r11161 | |
| 1682 | 1787 | t[8] = INT16((m1[6]*m2[2] + m1[7]*m2[5] + m1[8]*m2[8]) >> 14); |
| 1683 | 1788 | } |
| 1684 | 1789 | |
| 1685 | | static void p3d_render(const UINT16 *p, int size, bool use_scaling) |
| 1790 | static void p3d_render(namcos23_state *state, const UINT16 *p, int size, bool use_scaling) |
| 1686 | 1791 | { |
| 1792 | render_t &render = state->m_render; |
| 1793 | |
| 1687 | 1794 | if(size != 3) { |
| 1688 | 1795 | logerror("WARNING: p3d_render with size %d\n", size); |
| 1689 | 1796 | return; |
| r11160 | r11161 | |
| 1695 | 1802 | if(p[0] == 0xd96) |
| 1696 | 1803 | return; |
| 1697 | 1804 | |
| 1698 | | if(render_count[render_cur] >= RENDER_MAX_ENTRIES) { |
| 1805 | if(render.count[render.cur] >= RENDER_MAX_ENTRIES) { |
| 1699 | 1806 | logerror("WARNING: render buffer full\n"); |
| 1700 | 1807 | return; |
| 1701 | 1808 | } |
| 1702 | 1809 | |
| 1703 | 1810 | // Vector and matrix may be inverted |
| 1704 | | const INT16 *m = p3d_getm(p[1]); |
| 1705 | | const INT32 *v = p3d_getv(p[2]); |
| 1811 | const INT16 *m = p3d_getm(state, p[1]); |
| 1812 | const INT32 *v = p3d_getv(state, p[2]); |
| 1706 | 1813 | |
| 1707 | | namcos23_render_entry *re = render_entries[render_cur] + render_count[render_cur]; |
| 1814 | namcos23_render_entry *re = render.entries[render.cur] + render.count[render.cur]; |
| 1708 | 1815 | re->type = MODEL; |
| 1709 | 1816 | re->model.model = p[0]; |
| 1710 | | re->model.scaling = use_scaling ? scaling / 16384.0 : 1.0; |
| 1817 | re->model.scaling = use_scaling ? state->m_scaling / 16384.0 : 1.0; |
| 1711 | 1818 | memcpy(re->model.m, m, sizeof(re->model.m)); |
| 1712 | 1819 | memcpy(re->model.v, v, sizeof(re->model.v)); |
| 1713 | 1820 | if(0) |
| r11160 | r11161 | |
| 1718 | 1825 | re->model.m[6]/16384.0, re->model.m[7]/16384.0, re->model.m[8]/16384.0, |
| 1719 | 1826 | re->model.v[0]/16384.0, re->model.v[1]/16384.0, re->model.v[2]/16384.0); |
| 1720 | 1827 | |
| 1721 | | render_count[render_cur]++; |
| 1828 | render.count[render.cur]++; |
| 1722 | 1829 | } |
| 1723 | 1830 | |
| 1724 | 1831 | |
| 1725 | | static void p3d_flush(const UINT16 *p, int size) |
| 1832 | static void p3d_flush(namcos23_state *state, const UINT16 *p, int size) |
| 1726 | 1833 | { |
| 1834 | render_t &render = state->m_render; |
| 1835 | |
| 1727 | 1836 | if(size != 0) { |
| 1728 | 1837 | logerror("WARNING: p3d_flush with size %d\n", size); |
| 1729 | 1838 | return; |
| 1730 | 1839 | } |
| 1731 | 1840 | |
| 1732 | | namcos23_render_entry *re = render_entries[render_cur] + render_count[render_cur]; |
| 1841 | namcos23_render_entry *re = render.entries[render.cur] + render.count[render.cur]; |
| 1733 | 1842 | re->type = FLUSH; |
| 1734 | | render_count[render_cur]++; |
| 1843 | render.count[render.cur]++; |
| 1735 | 1844 | } |
| 1736 | 1845 | |
| 1737 | 1846 | static void p3d_dma(address_space *space, UINT32 adr, UINT32 size) |
| 1738 | 1847 | { |
| 1848 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1849 | UINT16 buffer[256]; |
| 1739 | 1850 | adr &= 0x1fffffff; |
| 1740 | | UINT16 buffer[256]; |
| 1741 | 1851 | int pos = 0; |
| 1742 | 1852 | while(pos < size) { |
| 1743 | 1853 | UINT16 h = space->read_word(adr+pos); |
| r11160 | r11161 | |
| 1765 | 1875 | } |
| 1766 | 1876 | |
| 1767 | 1877 | switch(h1) { |
| 1768 | | case 0x0040: p3d_matrix_set(buffer, psize); break; |
| 1769 | | case 0x0050: p3d_vector_set(buffer, psize); break; |
| 1770 | | case 0x0000: p3d_matrix_matrix_mul(buffer, psize); break; |
| 1771 | | case 0x0810: p3d_matrix_vector_mul(buffer, psize); break; |
| 1772 | | case 0x1010: p3d_vector_matrix_mul(buffer, psize); break; |
| 1773 | | case 0x4400: p3d_scaling_set(buffer, psize); break; |
| 1774 | | case 0x8000: p3d_render(buffer, psize, false); break; |
| 1775 | | case 0x8080: p3d_render(buffer, psize, true); break; |
| 1776 | | case 0xc000: p3d_flush(buffer, psize); break; |
| 1878 | case 0x0040: p3d_matrix_set(state, buffer, psize); break; |
| 1879 | case 0x0050: p3d_vector_set(state, buffer, psize); break; |
| 1880 | case 0x0000: p3d_matrix_matrix_mul(state, buffer, psize); break; |
| 1881 | case 0x0810: p3d_matrix_vector_mul(state, buffer, psize); break; |
| 1882 | case 0x1010: p3d_vector_matrix_mul(state, buffer, psize); break; |
| 1883 | case 0x4400: p3d_scaling_set(state, buffer, psize); break; |
| 1884 | case 0x8000: p3d_render(state, buffer, psize, false); break; |
| 1885 | case 0x8080: p3d_render(state, buffer, psize, true); break; |
| 1886 | case 0xc000: p3d_flush(state, buffer, psize); break; |
| 1777 | 1887 | default: { |
| 1778 | 1888 | if(0) { |
| 1779 | 1889 | logerror("p3d - [%04x] %04x", h1, h); |
| r11160 | r11161 | |
| 1799 | 1909 | |
| 1800 | 1910 | static WRITE32_HANDLER( p3d_w) |
| 1801 | 1911 | { |
| 1912 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 1802 | 1913 | switch(offset) { |
| 1803 | | case 0x7: COMBINE_DATA(&p3d_address); return; |
| 1804 | | case 0x8: COMBINE_DATA(&p3d_size); return; |
| 1914 | case 0x7: COMBINE_DATA(&state->m_p3d_address); return; |
| 1915 | case 0x8: COMBINE_DATA(&state->m_p3d_size); return; |
| 1805 | 1916 | case 0x9: |
| 1806 | 1917 | if(data & 1) |
| 1807 | | p3d_dma(space, p3d_address, p3d_size); |
| 1918 | p3d_dma(space, state->m_p3d_address, state->m_p3d_size); |
| 1808 | 1919 | return; |
| 1809 | 1920 | case 0x17: |
| 1810 | 1921 | cputag_set_input_line(space->machine(), "maincpu", MIPS3_IRQ1, CLEAR_LINE); |
| 1811 | | c361_timer->adjust(attotime::never); |
| 1922 | state->m_c361.timer->adjust(attotime::never); |
| 1812 | 1923 | return; |
| 1813 | 1924 | } |
| 1814 | 1925 | logerror("p3d_w %02x, %08x @ %08x (%08x, %08x)\n", offset, data, mem_mask, cpu_get_pc(&space->device()), (unsigned int)cpu_get_reg(&space->device(), MIPS3_R31)); |
| r11160 | r11161 | |
| 1843 | 1954 | |
| 1844 | 1955 | static void render_one_model(running_machine &machine, const namcos23_render_entry *re) |
| 1845 | 1956 | { |
| 1846 | | UINT32 adr = ptrom[re->model.model]; |
| 1847 | | if(adr >= ptrom_limit) { |
| 1957 | namcos23_state *state = machine.driver_data<namcos23_state>(); |
| 1958 | render_t &render = state->m_render; |
| 1959 | UINT32 adr = state->m_ptrom[re->model.model]; |
| 1960 | if(adr >= state->m_ptrom_limit) { |
| 1848 | 1961 | logerror("WARNING: model %04x base address %08x out-of-bounds - pointram?\n", re->model.model, adr); |
| 1849 | 1962 | return; |
| 1850 | 1963 | } |
| 1851 | 1964 | |
| 1852 | | while(adr < ptrom_limit) { |
| 1965 | while(adr < state->m_ptrom_limit) { |
| 1853 | 1966 | poly_vertex pv[15]; |
| 1854 | 1967 | |
| 1855 | | UINT32 type = ptrom[adr++]; |
| 1856 | | UINT32 h = ptrom[adr++]; |
| 1968 | UINT32 type = state->m_ptrom[adr++]; |
| 1969 | UINT32 h = state->m_ptrom[adr++]; |
| 1857 | 1970 | |
| 1858 | 1971 | |
| 1859 | 1972 | float tbase = (type >> 24) << 12; |
| r11160 | r11161 | |
| 1872 | 1985 | extptr = adr; |
| 1873 | 1986 | adr += ne; |
| 1874 | 1987 | } else |
| 1875 | | light = ptrom[adr++]; |
| 1988 | light = state->m_ptrom[adr++]; |
| 1876 | 1989 | |
| 1877 | 1990 | float minz = FLT_MAX; |
| 1878 | 1991 | float maxz = FLT_MIN; |
| 1879 | 1992 | |
| 1880 | 1993 | for(int i=0; i<ne; i++) { |
| 1881 | | UINT32 v1 = ptrom[adr++]; |
| 1882 | | UINT32 v2 = ptrom[adr++]; |
| 1883 | | UINT32 v3 = ptrom[adr++]; |
| 1994 | UINT32 v1 = state->m_ptrom[adr++]; |
| 1995 | UINT32 v2 = state->m_ptrom[adr++]; |
| 1996 | UINT32 v3 = state->m_ptrom[adr++]; |
| 1884 | 1997 | |
| 1885 | 1998 | render_apply_transform(u32_to_s24(v1), u32_to_s24(v2), u32_to_s24(v3), re, pv[i]); |
| 1886 | 1999 | pv[i].p[1] = (((v1 >> 20) & 0xf00) | ((v2 >> 24 & 0xff))) + 0.5; |
| r11160 | r11161 | |
| 1899 | 2012 | pv[i].p[3] = 1.0; |
| 1900 | 2013 | break; |
| 1901 | 2014 | case 3: { |
| 1902 | | UINT32 norm = ptrom[extptr++]; |
| 2015 | UINT32 norm = state->m_ptrom[extptr++]; |
| 1903 | 2016 | INT32 nx = u32_to_s10(norm >> 20); |
| 1904 | 2017 | INT32 ny = u32_to_s10(norm >> 10); |
| 1905 | 2018 | INT32 nz = u32_to_s10(norm); |
| 1906 | 2019 | INT32 nrx, nry, nrz; |
| 1907 | 2020 | render_apply_matrot(nx, ny, nz, re, nrx, nry, nrz); |
| 1908 | 2021 | |
| 1909 | | float lsi = float(nrx*light_vector[0] + nry*light_vector[1] + nrz*light_vector[2])/4194304.0; |
| 2022 | float lsi = float(nrx*state->m_light_vector[0] + nry*state->m_light_vector[1] + nrz*state->m_light_vector[2])/4194304.0; |
| 1910 | 2023 | if(lsi < 0) |
| 1911 | 2024 | lsi = 0; |
| 1912 | 2025 | |
| r11160 | r11161 | |
| 1917 | 2030 | } |
| 1918 | 2031 | } |
| 1919 | 2032 | |
| 1920 | | namcos23_poly_entry *p = render_polys + render_poly_count; |
| 2033 | namcos23_poly_entry *p = render.polys + render.poly_count; |
| 1921 | 2034 | |
| 1922 | 2035 | p->vertex_count = poly_zclip_if_less(ne, pv, p->pv, 4, 0.001f); |
| 1923 | 2036 | |
| r11160 | r11161 | |
| 1931 | 2044 | } |
| 1932 | 2045 | p->zkey = 0.5*(minz+maxz); |
| 1933 | 2046 | p->front = !(h & 0x00000001); |
| 2047 | p->rd.machine = &machine; |
| 1934 | 2048 | p->rd.texture_lookup = texture_lookup_nocache_point; |
| 1935 | 2049 | p->rd.pens = machine.pens + (color << 8); |
| 1936 | | render_poly_count++; |
| 2050 | render.poly_count++; |
| 1937 | 2051 | } |
| 1938 | 2052 | |
| 1939 | 2053 | if(type & 0x000010000) |
| r11160 | r11161 | |
| 1943 | 2057 | |
| 1944 | 2058 | static int render_poly_compare(const void *i1, const void *i2) |
| 1945 | 2059 | { |
| 1946 | | const namcos23_poly_entry *p1 = render_polys + *(const int *)i1; |
| 1947 | | const namcos23_poly_entry *p2 = render_polys + *(const int *)i2; |
| 2060 | const namcos23_poly_entry *p1 = *(const namcos23_poly_entry **)i1; |
| 2061 | const namcos23_poly_entry *p2 = *(const namcos23_poly_entry **)i2; |
| 1948 | 2062 | |
| 1949 | 2063 | if(p1->front != p2->front) |
| 1950 | 2064 | return p1->front ? 1 : -1; |
| r11160 | r11161 | |
| 1954 | 2068 | |
| 1955 | 2069 | static void render_flush(running_machine &machine, bitmap_t *bitmap) |
| 1956 | 2070 | { |
| 1957 | | if(!render_poly_count) |
| 2071 | namcos23_state *state = machine.driver_data<namcos23_state>(); |
| 2072 | render_t &render = state->m_render; |
| 2073 | |
| 2074 | if(!render.poly_count) |
| 1958 | 2075 | return; |
| 1959 | 2076 | |
| 1960 | | for(int i=0; i<render_poly_count; i++) |
| 1961 | | render_poly_order[i] = i; |
| 2077 | for(int i=0; i<render.poly_count; i++) |
| 2078 | render.poly_order[i] = &render.polys[i]; |
| 1962 | 2079 | |
| 1963 | | qsort(render_poly_order, render_poly_count, sizeof(int), render_poly_compare); |
| 2080 | qsort(render.poly_order, render.poly_count, sizeof(namcos23_poly_entry *), render_poly_compare); |
| 1964 | 2081 | |
| 1965 | 2082 | const static rectangle scissor = { 0, 639, 0, 479 }; |
| 1966 | 2083 | |
| 1967 | | for(int i=0; i<render_poly_count; i++) { |
| 1968 | | const namcos23_poly_entry *p = render_polys + render_poly_order[i]; |
| 1969 | | namcos23_render_data *rd = (namcos23_render_data *)poly_get_extra_data(polymgr); |
| 2084 | for(int i=0; i<render.poly_count; i++) { |
| 2085 | const namcos23_poly_entry *p = render.poly_order[i]; |
| 2086 | namcos23_render_data *rd = (namcos23_render_data *)poly_get_extra_data(render.polymgr); |
| 1970 | 2087 | *rd = p->rd; |
| 1971 | | poly_render_triangle_fan(polymgr, bitmap, &scissor, render_scanline, 4, p->vertex_count, p->pv); |
| 2088 | poly_render_triangle_fan(render.polymgr, bitmap, &scissor, render_scanline, 4, p->vertex_count, p->pv); |
| 1972 | 2089 | } |
| 1973 | | render_poly_count = 0; |
| 2090 | render.poly_count = 0; |
| 1974 | 2091 | } |
| 1975 | 2092 | |
| 1976 | 2093 | static void render_run(running_machine &machine, bitmap_t *bitmap) |
| 1977 | 2094 | { |
| 1978 | | render_poly_count = 0; |
| 1979 | | const namcos23_render_entry *re = render_entries[!render_cur]; |
| 1980 | | for(int i=0; i<render_count[!render_cur]; i++) { |
| 2095 | namcos23_state *state = machine.driver_data<namcos23_state>(); |
| 2096 | render_t &render = state->m_render; |
| 2097 | const namcos23_render_entry *re = render.entries[!render.cur]; |
| 2098 | |
| 2099 | render.poly_count = 0; |
| 2100 | for(int i=0; i<render.count[!render.cur]; i++) { |
| 1981 | 2101 | switch(re->type) { |
| 1982 | 2102 | case MODEL: |
| 1983 | 2103 | render_one_model(machine, re); |
| r11160 | r11161 | |
| 1990 | 2110 | } |
| 1991 | 2111 | render_flush(machine, bitmap); |
| 1992 | 2112 | |
| 1993 | | poly_wait(polymgr, "render_run"); |
| 2113 | poly_wait(render.polymgr, "render_run"); |
| 1994 | 2114 | } |
| 1995 | 2115 | |
| 1996 | 2116 | |
| 1997 | 2117 | static VIDEO_START( ss23 ) |
| 1998 | 2118 | { |
| 1999 | | gfx_element_set_source(machine.gfx[0], (UINT8 *)namcos23_charram); |
| 2000 | | bgtilemap = tilemap_create(machine, TextTilemapGetInfo, tilemap_scan_rows, 16, 16, 64, 64); |
| 2001 | | tilemap_set_transparent_pen(bgtilemap, 0xf); |
| 2119 | namcos23_state *state = machine.driver_data<namcos23_state>(); |
| 2120 | gfx_element_set_source(machine.gfx[0], (UINT8 *)state->m_charram); |
| 2121 | state->m_bgtilemap = tilemap_create(machine, TextTilemapGetInfo, tilemap_scan_rows, 16, 16, 64, 64); |
| 2122 | tilemap_set_transparent_pen(state->m_bgtilemap, 0xf); |
| 2002 | 2123 | |
| 2003 | 2124 | // Gorgon's tilemap offset is 0, S23/SS23's is 860 |
| 2004 | 2125 | if ((!strcmp(machine.system().name, "rapidrvr")) || |
| 2005 | 2126 | (!strcmp(machine.system().name, "rapidrvr2")) || |
| 2006 | 2127 | (!strcmp(machine.system().name, "finlflng"))) |
| 2007 | 2128 | { |
| 2008 | | tilemap_set_scrolldx(bgtilemap, 0, 0); |
| 2129 | tilemap_set_scrolldx(state->m_bgtilemap, 0, 0); |
| 2009 | 2130 | } |
| 2010 | 2131 | else |
| 2011 | 2132 | { |
| 2012 | | tilemap_set_scrolldx(bgtilemap, 860, 860); |
| 2133 | tilemap_set_scrolldx(state->m_bgtilemap, 860, 860); |
| 2013 | 2134 | } |
| 2014 | | polymgr = poly_alloc(machine, 10000, sizeof(namcos23_render_data), POLYFLAG_NO_WORK_QUEUE); |
| 2135 | state->m_render.polymgr = poly_alloc(machine, 10000, sizeof(namcos23_render_data), POLYFLAG_NO_WORK_QUEUE); |
| 2015 | 2136 | } |
| 2016 | 2137 | |
| 2017 | 2138 | static SCREEN_UPDATE( ss23 ) |
| 2018 | 2139 | { |
| 2140 | namcos23_state *state = screen->machine().driver_data<namcos23_state>(); |
| 2019 | 2141 | bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine())); |
| 2020 | 2142 | |
| 2021 | 2143 | render_run( screen->machine(), bitmap ); |
| r11160 | r11161 | |
| 2023 | 2145 | gfx_element *gfx = screen->machine().gfx[0]; |
| 2024 | 2146 | memset(gfx->dirty, 1, gfx->total_elements); |
| 2025 | 2147 | |
| 2026 | | tilemap_draw( bitmap, cliprect, bgtilemap, 0/*flags*/, 0/*priority*/ ); /* opaque */ |
| 2148 | tilemap_draw( bitmap, cliprect, state->m_bgtilemap, 0/*flags*/, 0/*priority*/ ); /* opaque */ |
| 2027 | 2149 | return 0; |
| 2028 | 2150 | } |
| 2029 | 2151 | |
| 2030 | 2152 | static INTERRUPT_GEN(s23_interrupt) |
| 2031 | 2153 | { |
| 2032 | | if(!ctl_vbl_active) { |
| 2033 | | ctl_vbl_active = true; |
| 2154 | namcos23_state *state = device->machine().driver_data<namcos23_state>(); |
| 2155 | render_t &render = state->m_render; |
| 2156 | |
| 2157 | if(!state->m_ctl_vbl_active) { |
| 2158 | state->m_ctl_vbl_active = true; |
| 2034 | 2159 | device_set_input_line(device, MIPS3_IRQ0, ASSERT_LINE); |
| 2035 | 2160 | } |
| 2036 | 2161 | |
| 2037 | | render_cur = !render_cur; |
| 2038 | | render_count[render_cur] = 0; |
| 2162 | render.cur = !render.cur; |
| 2163 | render.count[render.cur] = 0; |
| 2039 | 2164 | } |
| 2040 | 2165 | |
| 2041 | 2166 | static MACHINE_START( s23 ) |
| 2042 | 2167 | { |
| 2043 | | c361_timer = machine.scheduler().timer_alloc(FUNC(c361_timer_cb)); |
| 2044 | | c361_timer->adjust(attotime::never); |
| 2168 | namcos23_state *state = machine.driver_data<namcos23_state>(); |
| 2169 | c361_t &c361 = state->m_c361; |
| 2170 | c361.timer = machine.scheduler().timer_alloc(FUNC(c361_timer_cb)); |
| 2171 | c361.timer->adjust(attotime::never); |
| 2045 | 2172 | } |
| 2046 | 2173 | |
| 2047 | 2174 | static ADDRESS_MAP_START( gorgon_map, AS_PROGRAM, 32 ) |
| r11160 | r11161 | |
| 2049 | 2176 | AM_RANGE(0x00000000, 0x003fffff) AM_RAM |
| 2050 | 2177 | AM_RANGE(0x01000000, 0x010000ff) AM_READWRITE( p3d_r, p3d_w ) |
| 2051 | 2178 | AM_RANGE(0x02000000, 0x0200000f) AM_READWRITE16( s23_c417_r, s23_c417_w, 0xffffffff ) |
| 2052 | | AM_RANGE(0x04400000, 0x0440ffff) AM_READWRITE( gorgon_sharedram_r, gorgon_sharedram_w ) AM_BASE(&namcos23_shared_ram) |
| 2179 | AM_RANGE(0x04400000, 0x0440ffff) AM_READWRITE( gorgon_sharedram_r, gorgon_sharedram_w ) AM_BASE_MEMBER(namcos23_state, m_shared_ram) |
| 2053 | 2180 | |
| 2054 | 2181 | AM_RANGE(0x04c3ff08, 0x04c3ff0b) AM_WRITE( s23_mcuen_w ) |
| 2055 | 2182 | AM_RANGE(0x04c3ff0c, 0x04c3ff0f) AM_RAM |
| r11160 | r11161 | |
| 2058 | 2185 | |
| 2059 | 2186 | AM_RANGE(0x06108000, 0x061087ff) AM_RAM // GAMMA (C404-3S) |
| 2060 | 2187 | AM_RANGE(0x06110000, 0x0613ffff) AM_RAM_WRITE( namcos23_paletteram_w ) AM_BASE_GENERIC(paletteram) |
| 2061 | | AM_RANGE(0x06400000, 0x06403fff) AM_RAM_WRITE( s23_txtchar_w ) AM_BASE(&namcos23_charram) // text layer characters |
| 2188 | AM_RANGE(0x06400000, 0x06403fff) AM_RAM_WRITE( s23_txtchar_w ) AM_BASE_MEMBER(namcos23_state, m_charram) // text layer characters |
| 2062 | 2189 | AM_RANGE(0x06404000, 0x0641dfff) AM_RAM |
| 2063 | | AM_RANGE(0x0641e000, 0x0641ffff) AM_RAM_WRITE( namcos23_textram_w ) AM_BASE(&namcos23_textram) |
| 2190 | AM_RANGE(0x0641e000, 0x0641ffff) AM_RAM_WRITE( namcos23_textram_w ) AM_BASE_MEMBER(namcos23_state, m_textram) |
| 2064 | 2191 | |
| 2065 | 2192 | AM_RANGE(0x08000000, 0x087fffff) AM_ROM AM_REGION("data", 0) // data ROMs |
| 2066 | 2193 | |
| r11160 | r11161 | |
| 2080 | 2207 | AM_RANGE(0x00000000, 0x00ffffff) AM_RAM |
| 2081 | 2208 | AM_RANGE(0x01000000, 0x010000ff) AM_READWRITE( p3d_r, p3d_w ) |
| 2082 | 2209 | AM_RANGE(0x02000000, 0x0200000f) AM_READWRITE16( s23_c417_r, s23_c417_w, 0xffffffff ) |
| 2083 | | AM_RANGE(0x04400000, 0x0440ffff) AM_RAM AM_BASE(&namcos23_shared_ram) |
| 2210 | AM_RANGE(0x04400000, 0x0440ffff) AM_RAM AM_BASE_MEMBER(namcos23_state, m_shared_ram) |
| 2084 | 2211 | AM_RANGE(0x04c3ff08, 0x04c3ff0b) AM_WRITE( s23_mcuen_w ) |
| 2085 | 2212 | AM_RANGE(0x04c3ff0c, 0x04c3ff0f) AM_RAM |
| 2086 | 2213 | AM_RANGE(0x06000000, 0x0600ffff) AM_RAM AM_SHARE("nvram") // Backup |
| 2087 | 2214 | AM_RANGE(0x06200000, 0x06203fff) AM_RAM // C422 |
| 2088 | 2215 | AM_RANGE(0x06400000, 0x0640000f) AM_READWRITE16( s23_c422_r, s23_c422_w, 0xffffffff ) // C422 registers |
| 2089 | | AM_RANGE(0x06800000, 0x06807fff) AM_RAM_WRITE( s23_txtchar_w ) AM_BASE(&namcos23_charram) // text layer characters (shown as CGRAM in POST) |
| 2216 | AM_RANGE(0x06800000, 0x06807fff) AM_RAM_WRITE( s23_txtchar_w ) AM_BASE_MEMBER(namcos23_state, m_charram) // text layer characters (shown as CGRAM in POST) |
| 2090 | 2217 | AM_RANGE(0x06804000, 0x0681dfff) AM_RAM |
| 2091 | | AM_RANGE(0x0681e000, 0x0681ffff) AM_RAM_WRITE( namcos23_textram_w ) AM_BASE(&namcos23_textram) |
| 2218 | AM_RANGE(0x0681e000, 0x0681ffff) AM_RAM_WRITE( namcos23_textram_w ) AM_BASE_MEMBER(namcos23_state, m_textram) |
| 2092 | 2219 | AM_RANGE(0x06820000, 0x0682000f) AM_READWRITE16( s23_c361_r, s23_c361_w, 0xffffffff ) // C361 |
| 2093 | 2220 | AM_RANGE(0x06a08000, 0x06a087ff) AM_RAM // Blending control & GAMMA (C404) |
| 2094 | 2221 | AM_RANGE(0x06a10000, 0x06a3ffff) AM_RAM_WRITE( namcos23_paletteram_w ) AM_BASE_GENERIC(paletteram) |
| r11160 | r11161 | |
| 2111 | 2238 | |
| 2112 | 2239 | static READ32_HANDLER( sh2_shared_r ) |
| 2113 | 2240 | { |
| 2114 | | return gmen_sh2_shared[offset]; |
| 2241 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 2242 | return state->m_gmen_sh2_shared[offset]; |
| 2115 | 2243 | } |
| 2116 | 2244 | |
| 2117 | 2245 | static WRITE32_HANDLER( sh2_shared_w ) |
| 2118 | 2246 | { |
| 2119 | | COMBINE_DATA(&gmen_sh2_shared[offset]); |
| 2247 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 2248 | COMBINE_DATA(&state->m_gmen_sh2_shared[offset]); |
| 2120 | 2249 | } |
| 2121 | 2250 | |
| 2122 | 2251 | static ADDRESS_MAP_START( gmen_mips_map, AS_PROGRAM, 32 ) |
| r11160 | r11161 | |
| 2127 | 2256 | |
| 2128 | 2257 | |
| 2129 | 2258 | static ADDRESS_MAP_START( gmen_sh2_map, AS_PROGRAM, 32 ) |
| 2130 | | AM_RANGE( 0x00000000, 0x00007fff ) AM_RAM AM_BASE(&gmen_sh2_shared) |
| 2259 | AM_RANGE( 0x00000000, 0x00007fff ) AM_RAM AM_BASE_MEMBER(namcos23_state, m_gmen_sh2_shared) |
| 2131 | 2260 | AM_RANGE( 0x04000000, 0x043fffff ) AM_RAM // SH-2 main work RAM |
| 2132 | 2261 | ADDRESS_MAP_END |
| 2133 | 2262 | |
| r11160 | r11161 | |
| 2139 | 2268 | |
| 2140 | 2269 | static WRITE16_HANDLER( sharedram_sub_w ) |
| 2141 | 2270 | { |
| 2142 | | UINT16 *shared16 = (UINT16 *)namcos23_shared_ram; |
| 2271 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 2272 | UINT16 *shared16 = (UINT16 *)state->m_shared_ram; |
| 2143 | 2273 | |
| 2144 | 2274 | // fake that an I/O board is connected for games w/o a dump or that aren't properly communicating with it yet |
| 2145 | | if (!has_jvsio) |
| 2275 | if (!state->m_has_jvsio) |
| 2146 | 2276 | { |
| 2147 | 2277 | if ((offset == 0x4052/2) && (data == 0x78)) |
| 2148 | 2278 | { |
| r11160 | r11161 | |
| 2155 | 2285 | |
| 2156 | 2286 | static READ16_HANDLER( sharedram_sub_r ) |
| 2157 | 2287 | { |
| 2158 | | UINT16 *shared16 = (UINT16 *)namcos23_shared_ram; |
| 2288 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 2289 | UINT16 *shared16 = (UINT16 *)state->m_shared_ram; |
| 2159 | 2290 | |
| 2160 | 2291 | return shared16[BYTE_XOR_BE(offset)]; |
| 2161 | 2292 | } |
| r11160 | r11161 | |
| 2192 | 2323 | // in System 12, bit 0 of H8/3002 port A is connected to it's chip enable |
| 2193 | 2324 | // the actual I/O takes place through the H8/3002's serial port B. |
| 2194 | 2325 | |
| 2195 | | static int s23_porta = 0, s23_rtcstate = 0; |
| 2196 | 2326 | |
| 2197 | 2327 | static READ8_HANDLER( s23_mcu_pa_r ) |
| 2198 | 2328 | { |
| 2199 | | return s23_porta; |
| 2329 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 2330 | return state->m_s23_porta; |
| 2200 | 2331 | } |
| 2201 | 2332 | |
| 2202 | 2333 | static WRITE8_HANDLER( s23_mcu_pa_w ) |
| 2203 | 2334 | { |
| 2335 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 2204 | 2336 | // bit 0 = chip enable for the RTC |
| 2205 | 2337 | // reset the state on the rising edge of the bit |
| 2206 | | if ((!(s23_porta & 1)) && (data & 1)) |
| 2338 | if ((!(state->m_s23_porta & 1)) && (data & 1)) |
| 2207 | 2339 | { |
| 2208 | | s23_rtcstate = 0; |
| 2340 | state->m_s23_rtcstate = 0; |
| 2209 | 2341 | } |
| 2210 | 2342 | |
| 2211 | | s23_porta = data; |
| 2343 | state->m_s23_porta = data; |
| 2212 | 2344 | } |
| 2213 | 2345 | |
| 2214 | 2346 | INLINE UINT8 make_bcd(UINT8 data) |
| r11160 | r11161 | |
| 2218 | 2350 | |
| 2219 | 2351 | static READ8_HANDLER( s23_mcu_rtc_r ) |
| 2220 | 2352 | { |
| 2353 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 2221 | 2354 | UINT8 ret = 0; |
| 2222 | 2355 | system_time systime; |
| 2223 | 2356 | static const int weekday[7] = { 7, 1, 2, 3, 4, 5, 6 }; |
| 2224 | 2357 | |
| 2225 | 2358 | space->machine().current_datetime(systime); |
| 2226 | 2359 | |
| 2227 | | switch (s23_rtcstate) |
| 2360 | switch (state->m_s23_rtcstate) |
| 2228 | 2361 | { |
| 2229 | 2362 | case 0: |
| 2230 | 2363 | ret = make_bcd(systime.local_time.second); // seconds (BCD, 0-59) in bits 0-6, bit 7 = battery low |
| r11160 | r11161 | |
| 2252 | 2385 | break; |
| 2253 | 2386 | } |
| 2254 | 2387 | |
| 2255 | | s23_rtcstate++; |
| 2388 | state->m_s23_rtcstate++; |
| 2256 | 2389 | |
| 2257 | 2390 | return ret; |
| 2258 | 2391 | } |
| 2259 | 2392 | |
| 2260 | | static int s23_lastpB, s23_setstate, s23_setnum, s23_settings[8]; |
| 2261 | 2393 | |
| 2262 | 2394 | static READ8_HANDLER( s23_mcu_portB_r ) |
| 2263 | 2395 | { |
| 2264 | | s23_lastpB ^= 0x80; |
| 2265 | | return s23_lastpB; |
| 2396 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 2397 | state->m_s23_lastpB ^= 0x80; |
| 2398 | return state->m_s23_lastpB; |
| 2266 | 2399 | } |
| 2267 | 2400 | |
| 2268 | 2401 | static WRITE8_HANDLER( s23_mcu_portB_w ) |
| 2269 | 2402 | { |
| 2403 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 2270 | 2404 | // bit 7 = chip enable for the video settings controller |
| 2271 | 2405 | if (data & 0x80) |
| 2272 | 2406 | { |
| 2273 | | s23_setstate = 0; |
| 2407 | state->m_s23_setstate = 0; |
| 2274 | 2408 | } |
| 2275 | 2409 | |
| 2276 | | s23_lastpB = data; |
| 2410 | state->m_s23_lastpB = data; |
| 2277 | 2411 | } |
| 2278 | 2412 | |
| 2279 | 2413 | static WRITE8_HANDLER( s23_mcu_settings_w ) |
| 2280 | 2414 | { |
| 2281 | | if (s23_setstate) |
| 2415 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 2416 | if (state->m_s23_setstate) |
| 2282 | 2417 | { |
| 2283 | 2418 | // data |
| 2284 | | s23_settings[s23_setnum] = data; |
| 2419 | state->m_s23_settings[state->m_s23_setnum] = data; |
| 2285 | 2420 | |
| 2286 | | if (s23_setnum == 7) |
| 2421 | if (state->m_s23_setnum == 7) |
| 2287 | 2422 | { |
| 2288 | 2423 | logerror("S23 video settings: Contrast: %02x R: %02x G: %02x B: %02x\n", |
| 2289 | | BITSWAP8(s23_settings[0], 0, 1, 2, 3, 4, 5, 6, 7), |
| 2290 | | BITSWAP8(s23_settings[1], 0, 1, 2, 3, 4, 5, 6, 7), |
| 2291 | | BITSWAP8(s23_settings[2], 0, 1, 2, 3, 4, 5, 6, 7), |
| 2292 | | BITSWAP8(s23_settings[3], 0, 1, 2, 3, 4, 5, 6, 7)); |
| 2424 | BITSWAP8(state->m_s23_settings[0], 0, 1, 2, 3, 4, 5, 6, 7), |
| 2425 | BITSWAP8(state->m_s23_settings[1], 0, 1, 2, 3, 4, 5, 6, 7), |
| 2426 | BITSWAP8(state->m_s23_settings[2], 0, 1, 2, 3, 4, 5, 6, 7), |
| 2427 | BITSWAP8(state->m_s23_settings[3], 0, 1, 2, 3, 4, 5, 6, 7)); |
| 2293 | 2428 | } |
| 2294 | 2429 | } |
| 2295 | 2430 | else |
| 2296 | 2431 | { // setting number |
| 2297 | | s23_setnum = (data >> 4)-1; |
| 2432 | state->m_s23_setnum = (data >> 4)-1; |
| 2298 | 2433 | } |
| 2299 | 2434 | |
| 2300 | | s23_setstate ^= 1; |
| 2435 | state->m_s23_setstate ^= 1; |
| 2301 | 2436 | } |
| 2302 | 2437 | |
| 2303 | | static UINT8 maintoio[128], mi_rd, mi_wr; |
| 2304 | | static UINT8 iotomain[128], im_rd, im_wr; |
| 2305 | 2438 | |
| 2306 | 2439 | static READ8_HANDLER( s23_mcu_iob_r ) |
| 2307 | 2440 | { |
| 2308 | | UINT8 ret = iotomain[im_rd]; |
| 2441 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 2442 | UINT8 ret = state->m_iotomain[state->m_im_rd]; |
| 2309 | 2443 | |
| 2310 | | im_rd++; |
| 2311 | | im_rd &= 0x7f; |
| 2444 | state->m_im_rd++; |
| 2445 | state->m_im_rd &= 0x7f; |
| 2312 | 2446 | |
| 2313 | | if (im_rd == im_wr) |
| 2447 | if (state->m_im_rd == state->m_im_wr) |
| 2314 | 2448 | { |
| 2315 | 2449 | cputag_set_input_line(space->machine(), "audiocpu", H8_SCI_0_RX, CLEAR_LINE); |
| 2316 | 2450 | } |
| r11160 | r11161 | |
| 2325 | 2459 | |
| 2326 | 2460 | static WRITE8_HANDLER( s23_mcu_iob_w ) |
| 2327 | 2461 | { |
| 2328 | | maintoio[mi_wr++] = data; |
| 2329 | | mi_wr &= 0x7f; |
| 2462 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 2463 | state->m_maintoio[state->m_mi_wr++] = data; |
| 2464 | state->m_mi_wr &= 0x7f; |
| 2330 | 2465 | |
| 2331 | 2466 | cputag_set_input_line(space->machine(), "ioboard", H8_SCI_0_RX, ASSERT_LINE); |
| 2332 | 2467 | } |
| r11160 | r11161 | |
| 2503 | 2638 | |
| 2504 | 2639 | static READ8_HANDLER(s23_mcu_p6_r) |
| 2505 | 2640 | { |
| 2641 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 2506 | 2642 | // bit 1 = JVS cable present sense (1 = I/O board plugged in) |
| 2507 | | return (namcos23_jvssense << 1) | 0xfd; |
| 2643 | return (state->m_jvssense << 1) | 0xfd; |
| 2508 | 2644 | } |
| 2509 | 2645 | |
| 2510 | 2646 | static WRITE8_HANDLER(s23_mcu_p6_w) |
| r11160 | r11161 | |
| 2544 | 2680 | |
| 2545 | 2681 | static READ8_HANDLER( s23_iob_mcu_r ) |
| 2546 | 2682 | { |
| 2547 | | UINT8 ret = maintoio[mi_rd]; |
| 2683 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 2684 | UINT8 ret = state->m_maintoio[state->m_mi_rd]; |
| 2548 | 2685 | |
| 2549 | | mi_rd++; |
| 2550 | | mi_rd &= 0x7f; |
| 2686 | state->m_mi_rd++; |
| 2687 | state->m_mi_rd &= 0x7f; |
| 2551 | 2688 | |
| 2552 | | if (mi_rd == mi_wr) |
| 2689 | if (state->m_mi_rd == state->m_mi_wr) |
| 2553 | 2690 | { |
| 2554 | 2691 | cputag_set_input_line(space->machine(), "ioboard", H8_SCI_0_RX, CLEAR_LINE); |
| 2555 | 2692 | } |
| r11160 | r11161 | |
| 2559 | 2696 | |
| 2560 | 2697 | static WRITE8_HANDLER( s23_iob_mcu_w ) |
| 2561 | 2698 | { |
| 2562 | | iotomain[im_wr++] = data; |
| 2563 | | im_wr &= 0x7f; |
| 2699 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 2700 | state->m_iotomain[state->m_im_wr++] = data; |
| 2701 | state->m_im_wr &= 0x7f; |
| 2564 | 2702 | |
| 2565 | 2703 | cputag_set_input_line(space->machine(), "audiocpu", H8_SCI_0_RX, ASSERT_LINE); |
| 2566 | 2704 | } |
| 2567 | 2705 | |
| 2568 | | static UINT8 s23_tssio_port_4 = 0; |
| 2569 | 2706 | |
| 2570 | 2707 | static READ8_HANDLER( s23_iob_p4_r ) |
| 2571 | 2708 | { |
| 2572 | | return s23_tssio_port_4; |
| 2709 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 2710 | return state->m_s23_tssio_port_4; |
| 2573 | 2711 | } |
| 2574 | 2712 | |
| 2575 | 2713 | static WRITE8_HANDLER( s23_iob_p4_w ) |
| 2576 | 2714 | { |
| 2577 | | s23_tssio_port_4 = data; |
| 2715 | namcos23_state *state = space->machine().driver_data<namcos23_state>(); |
| 2716 | state->m_s23_tssio_port_4 = data; |
| 2578 | 2717 | |
| 2579 | | namcos23_jvssense = (data & 0x04) ? 0 : 1; |
| 2718 | state->m_jvssense = (data & 0x04) ? 0 : 1; |
| 2580 | 2719 | } |
| 2581 | 2720 | |
| 2582 | 2721 | static READ8_HANDLER(iob_r) |
| r11160 | r11161 | |
| 2627 | 2766 | |
| 2628 | 2767 | static DRIVER_INIT(ss23) |
| 2629 | 2768 | { |
| 2630 | | ptrom = (const UINT32 *)machine.region("pointrom")->base(); |
| 2631 | | tmlrom = (const UINT16 *)machine.region("textilemapl")->base(); |
| 2632 | | tmhrom = machine.region("textilemaph")->base(); |
| 2633 | | texrom = machine.region("textile")->base(); |
| 2769 | namcos23_state *state = machine.driver_data<namcos23_state>(); |
| 2770 | render_t &render = state->m_render; |
| 2771 | state->m_ptrom = (const UINT32 *)machine.region("pointrom")->base(); |
| 2772 | state->m_tmlrom = (const UINT16 *)machine.region("textilemapl")->base(); |
| 2773 | state->m_tmhrom = machine.region("textilemaph")->base(); |
| 2774 | state->m_texrom = machine.region("textile")->base(); |
| 2634 | 2775 | |
| 2635 | | tileid_mask = (machine.region("textilemapl")->bytes()/2 - 1) & ~0xff; // Used for y masking |
| 2636 | | tile_mask = machine.region("textile")->bytes()/256 - 1; |
| 2637 | | ptrom_limit = machine.region("pointrom")->bytes()/4; |
| 2776 | state->m_tileid_mask = (machine.region("textilemapl")->bytes()/2 - 1) & ~0xff; // Used for y masking |
| 2777 | state->m_tile_mask = machine.region("textile")->bytes()/256 - 1; |
| 2778 | state->m_ptrom_limit = machine.region("pointrom")->bytes()/4; |
| 2638 | 2779 | |
| 2639 | | mi_rd = mi_wr = im_rd = im_wr = 0; |
| 2640 | | namcos23_jvssense = 1; |
| 2641 | | ctl_vbl_active = false; |
| 2642 | | s23_lastpB = 0x50; |
| 2643 | | s23_setstate = 0; |
| 2644 | | s23_setnum = 0; |
| 2645 | | memset(s23_settings, 0, sizeof(s23_settings)); |
| 2646 | | s23_tssio_port_4 = 0; |
| 2647 | | s23_porta = 0, s23_rtcstate = 0; |
| 2648 | | s23_subcpu_running = 1; |
| 2649 | | render_count[0] = render_count[1] = 0; |
| 2650 | | render_cur = 0; |
| 2780 | state->m_mi_rd = state->m_mi_wr = state->m_im_rd = state->m_im_wr = 0; |
| 2781 | state->m_jvssense = 1; |
| 2782 | state->m_ctl_vbl_active = false; |
| 2783 | state->m_s23_lastpB = 0x50; |
| 2784 | state->m_s23_setstate = 0; |
| 2785 | state->m_s23_setnum = 0; |
| 2786 | memset(state->m_s23_settings, 0, sizeof(state->m_s23_settings)); |
| 2787 | state->m_s23_tssio_port_4 = 0; |
| 2788 | state->m_s23_porta = 0, state->m_s23_rtcstate = 0; |
| 2789 | state->m_s23_subcpu_running = 1; |
| 2790 | render.count[0] = render.count[1] = 0; |
| 2791 | render.cur = 0; |
| 2651 | 2792 | |
| 2652 | 2793 | if ((!strcmp(machine.system().name, "motoxgo")) || |
| 2653 | 2794 | (!strcmp(machine.system().name, "panicprk")) || |
| r11160 | r11161 | |
| 2665 | 2806 | (!strcmp(machine.system().name, "timecrs2b")) || |
| 2666 | 2807 | (!strcmp(machine.system().name, "timecrs2"))) |
| 2667 | 2808 | { |
| 2668 | | has_jvsio = 1; |
| 2809 | state->m_has_jvsio = 1; |
| 2669 | 2810 | } |
| 2670 | 2811 | else |
| 2671 | 2812 | { |
| 2672 | | has_jvsio = 0; |
| 2813 | state->m_has_jvsio = 0; |
| 2673 | 2814 | } |
| 2674 | 2815 | } |
| 2675 | 2816 | |
| r11160 | r11161 | |
| 2697 | 2838 | 8192 /* data cache size - VERIFIED */ |
| 2698 | 2839 | }; |
| 2699 | 2840 | |
| 2700 | | static MACHINE_CONFIG_START( gorgon, driver_device ) |
| 2841 | static MACHINE_CONFIG_START( gorgon, namcos23_state ) |
| 2701 | 2842 | |
| 2702 | 2843 | /* basic machine hardware */ |
| 2703 | 2844 | MCFG_CPU_ADD("maincpu", R4650BE, S23_BUSCLOCK*4) |
| r11160 | r11161 | |
| 2744 | 2885 | MCFG_SOUND_ROUTE(3, "lspeaker", 1.00) |
| 2745 | 2886 | MACHINE_CONFIG_END |
| 2746 | 2887 | |
| 2747 | | static MACHINE_CONFIG_START( s23, driver_device ) |
| 2888 | static MACHINE_CONFIG_START( s23, namcos23_state ) |
| 2748 | 2889 | /* basic machine hardware */ |
| 2749 | 2890 | MCFG_CPU_ADD("maincpu", R4650BE, S23_BUSCLOCK*4) |
| 2750 | 2891 | MCFG_CPU_CONFIG(r4650_config) |
| r11160 | r11161 | |
| 2790 | 2931 | MCFG_SOUND_ROUTE(3, "lspeaker", 1.00) |
| 2791 | 2932 | MACHINE_CONFIG_END |
| 2792 | 2933 | |
| 2793 | | static MACHINE_CONFIG_START( ss23, driver_device ) |
| 2934 | static MACHINE_CONFIG_START( ss23, namcos23_state ) |
| 2794 | 2935 | /* basic machine hardware */ |
| 2795 | 2936 | MCFG_CPU_ADD("maincpu", R4650BE, S23_BUSCLOCK*5) |
| 2796 | 2937 | MCFG_CPU_CONFIG(r4650_config) |
src/mame/drivers/subsino2.c
| r11160 | r11161 | |
| 14 | 14 | Year Game CPU Sound Custom Other |
| 15 | 15 | ------------------------------------------------------------------------------------------------------------- |
| 16 | 16 | 1996 Magic Train HD647180* U6295 SS9601, SS9602 HM86171 RAMDAC, Battery |
| 17 | 1996 Water-Nymph HD647180* U6295 SS9601, SS9602 HM86171 RAMDAC, Battery |
| 17 | 18 | 1998 Express Card AM188-EM M6295 SS9601, SS9802, SS9803 HM86171 RAMDAC, Battery |
| 18 | 19 | 1998 Ying Hua Lian AM188-EM M6295 + YM3812? SS9601, SS9602 HM86171 RAMDAC, Battery |
| 19 | 20 | 1999 Bishou Jan H8/3044 SS9904? SS9601, SS9802, SS9803 HM86171 RAMDAC, Battery |
| r11160 | r11161 | |
| 40 | 41 | #include "sound/3812intf.h" |
| 41 | 42 | #include "sound/okim6295.h" |
| 42 | 43 | #include "machine/nvram.h" |
| 44 | #include "machine/subsino.h" |
| 43 | 45 | #include "machine/ticket.h" |
| 44 | 46 | |
| 45 | 47 | |
| r11160 | r11161 | |
| 312 | 314 | |
| 313 | 315 | More registers, at boot (never changed AFAICT): |
| 314 | 316 | |
| 315 | | mtrain saklove xtrain, expcard |
| 316 | | xplan |
| 317 | mtrain, saklove xtrain, expcard |
| 318 | wtrnymph xplan |
| 317 | 319 | |
| 318 | 320 | C0 = 0A C0 = 0A |
| 319 | 321 | E0 = 18 E0 = 18 |
| r11160 | r11161 | |
| 328 | 330 | 9107 = 00 207 = 00 207 = 00 207 = 00 |
| 329 | 331 | 9108 = 33 208 = 33 208 = 33 208 = 33 |
| 330 | 332 | 9109 = 16 209 = 0E 209 = 0E 209 = 0E |
| 331 | | 910A = F6 20A = FD 20A = FD 20A = FD |
| 333 | 910A = F6 20A = FD 20A = FD 20A = FD *F5 in wtrnymph |
| 332 | 334 | 910B = 22 20B = 22 20B = 22 20B = 22 |
| 333 | 335 | 910C = FE 20C = FE 20C = FE 20C = FE |
| 334 | 336 | 910D = FB 20D = FB 20D = FB 20D = FB |
| r11160 | r11161 | |
| 1999 | 2001 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) // serial in? |
| 2000 | 2002 | INPUT_PORTS_END |
| 2001 | 2003 | |
| 2004 | /*************************************************************************** |
| 2005 | Water-Nymph |
| 2006 | ***************************************************************************/ |
| 2002 | 2007 | |
| 2008 | static INPUT_PORTS_START( wtrnymph ) |
| 2009 | PORT_START("DSW1") |
| 2010 | PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2,3") |
| 2011 | PORT_DIPSETTING( 0x01, DEF_STR( 1C_1C ) ) |
| 2012 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) ) |
| 2013 | PORT_DIPSETTING( 0x03, DEF_STR( 1C_5C ) ) |
| 2014 | PORT_DIPSETTING( 0x00, "1 Coin / 10 Credits" ) |
| 2015 | PORT_DIPSETTING( 0x04, "1 Coin / 20 Credits" ) |
| 2016 | PORT_DIPSETTING( 0x05, "1 Coin / 25 Credits" ) |
| 2017 | PORT_DIPSETTING( 0x06, "1 Coin / 50 Credits" ) |
| 2018 | PORT_DIPSETTING( 0x07, "1 Coin / 100 Credits" ) |
| 2019 | PORT_DIPNAME( 0x38, 0x00, "Key Coinage" ) PORT_DIPLOCATION("SW1:4,5,6") |
| 2020 | PORT_DIPSETTING( 0x08, "1 Key / 1 Credits" ) |
| 2021 | PORT_DIPSETTING( 0x10, "1 Key / 2 Credits" ) |
| 2022 | PORT_DIPSETTING( 0x18, "1 Key / 5 Credits" ) |
| 2023 | PORT_DIPSETTING( 0x00, "1 Key / 10 Credits" ) |
| 2024 | PORT_DIPSETTING( 0x20, "1 Key / 20 Credits" ) |
| 2025 | PORT_DIPSETTING( 0x28, "1 Key / 25 Credits" ) |
| 2026 | PORT_DIPSETTING( 0x30, "1 Key / 50 Credits" ) |
| 2027 | PORT_DIPSETTING( 0x38, "1 Key / 100 Credits" ) |
| 2028 | PORT_DIPNAME( 0x40, 0x40, "Pay Out" ) PORT_DIPLOCATION("SW1:7") |
| 2029 | PORT_DIPSETTING( 0x40, "Coin" ) |
| 2030 | PORT_DIPSETTING( 0x00, "Key" ) |
| 2031 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8") |
| 2032 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 2033 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2034 | |
| 2035 | PORT_START("DSW2") |
| 2036 | PORT_DIPNAME( 0x03, 0x00, "Minimum Bet" ) PORT_DIPLOCATION("SW2:1,2") |
| 2037 | PORT_DIPSETTING( 0x01, "1" ) |
| 2038 | PORT_DIPSETTING( 0x00, "8" ) |
| 2039 | PORT_DIPSETTING( 0x02, "16" ) |
| 2040 | PORT_DIPSETTING( 0x03, "20" ) |
| 2041 | PORT_DIPNAME( 0x0c, 0x0c, "Max Bet" ) PORT_DIPLOCATION("SW2:3,4") |
| 2042 | PORT_DIPSETTING( 0x08, "10" ) |
| 2043 | PORT_DIPSETTING( 0x04, "20" ) |
| 2044 | PORT_DIPSETTING( 0x00, "40" ) |
| 2045 | PORT_DIPSETTING( 0x0c, "60" ) |
| 2046 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:5") |
| 2047 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 2048 | PORT_DIPSETTING( 0x10, DEF_STR( On ) ) |
| 2049 | PORT_DIPNAME( 0x60, 0x60, "Game Limit" ) PORT_DIPLOCATION("SW2:6,7") |
| 2050 | PORT_DIPSETTING( 0x20, "10k" ) |
| 2051 | PORT_DIPSETTING( 0x00, "20k" ) |
| 2052 | PORT_DIPSETTING( 0x40, "30k" ) |
| 2053 | PORT_DIPSETTING( 0x60, "40k" ) |
| 2054 | PORT_DIPNAME( 0x80, 0x80, "Double Up" ) PORT_DIPLOCATION("SW2:8") |
| 2055 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 2056 | PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) |
| 2057 | |
| 2058 | PORT_START("DSW3") |
| 2059 | PORT_DIPNAME( 0x07, 0x07, "Win Rate" ) PORT_DIPLOCATION("SW3:1,2,3") |
| 2060 | PORT_DIPSETTING( 0x07, "55%" ) |
| 2061 | PORT_DIPSETTING( 0x06, "60%" ) |
| 2062 | PORT_DIPSETTING( 0x05, "65%" ) |
| 2063 | PORT_DIPSETTING( 0x04, "70%" ) |
| 2064 | PORT_DIPSETTING( 0x03, "75%" ) |
| 2065 | PORT_DIPSETTING( 0x00, "80%" ) |
| 2066 | PORT_DIPSETTING( 0x02, "85%" ) |
| 2067 | PORT_DIPSETTING( 0x01, "90%" ) |
| 2068 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:4") |
| 2069 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 2070 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2071 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:5") |
| 2072 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 2073 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2074 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:6") |
| 2075 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 2076 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2077 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:7") |
| 2078 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 2079 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2080 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:8") |
| 2081 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 2082 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2083 | |
| 2084 | PORT_START("DSW4") |
| 2085 | PORT_DIPNAME( 0x07, 0x07, "Double-Up Rate" ) PORT_DIPLOCATION("SW4:1,2,3") |
| 2086 | PORT_DIPSETTING( 0x00, "82%" ) |
| 2087 | PORT_DIPSETTING( 0x01, "84%" ) |
| 2088 | PORT_DIPSETTING( 0x02, "88%" ) |
| 2089 | PORT_DIPSETTING( 0x03, "90%" ) |
| 2090 | PORT_DIPSETTING( 0x04, "92%" ) |
| 2091 | PORT_DIPSETTING( 0x05, "94%" ) |
| 2092 | PORT_DIPSETTING( 0x06, "96%" ) |
| 2093 | PORT_DIPSETTING( 0x07, "98%" ) |
| 2094 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW4:4") |
| 2095 | PORT_DIPSETTING( 0x00, "5k" ) |
| 2096 | PORT_DIPSETTING( 0x08, "10k" ) |
| 2097 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW4:6") |
| 2098 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 2099 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2100 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW4:6") |
| 2101 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 2102 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2103 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW4:7") |
| 2104 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 2105 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2106 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW4:8") |
| 2107 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 2108 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2109 | |
| 2110 | PORT_START("IN A") |
| 2111 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2112 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2113 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2114 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START ) PORT_CODE(KEYCODE_N) PORT_NAME("Start All") |
| 2115 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_NAME("Bet / Stop All") |
| 2116 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Z) PORT_NAME("Info / Double?") // down |
| 2117 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2118 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2119 | |
| 2120 | PORT_START("IN B") |
| 2121 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN ) PORT_IMPULSE(5) // key in |
| 2122 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) // coin in |
| 2123 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2124 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2125 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) // stats |
| 2126 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) // service mode |
| 2127 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) // payout (hopper error) |
| 2128 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) // key out |
| 2129 | |
| 2130 | PORT_START("IN C") |
| 2131 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SLOT_STOP3 ) PORT_NAME("Stop 3 / Right") |
| 2132 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2133 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2134 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SLOT_STOP2 ) PORT_NAME("Stop 2 / Left / Play Gambling 1") // C \__ play gambling game |
| 2135 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Play Gambling 2") PORT_CODE(KEYCODE_D) // D / |
| 2136 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2137 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SLOT_STOP1 ) PORT_NAME("Stop 1 / Take / Rotate") |
| 2138 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Play Tetris") PORT_CODE(KEYCODE_T) // T |__ play Tetris game |
| 2139 | |
| 2140 | PORT_START("IN D") // not shown in test mode |
| 2141 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2142 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2143 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2144 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2145 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F1) |
| 2146 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2147 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2148 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) // serial in? |
| 2149 | INPUT_PORTS_END |
| 2150 | |
| 2151 | |
| 2003 | 2152 | /*************************************************************************** |
| 2004 | 2153 | Machine Drivers |
| 2005 | 2154 | ***************************************************************************/ |
| r11160 | r11161 | |
| 2348 | 2497 | ROM_REGION( 0x80000, "oki", 0 ) |
| 2349 | 2498 | ROM_LOAD( "rom_5.u27", 0x00000, 0x40000, CRC(51cae476) SHA1(d1da4e5c3d53d18d8b69dfb57796d0ae311d99bf) ) |
| 2350 | 2499 | ROM_RELOAD( 0x40000, 0x40000 ) |
| 2500 | |
| 2501 | ROM_REGION( 0x117, "plds", 0 ) |
| 2502 | ROM_LOAD( "gal16v8d.u6", 0x000, 0x117, NO_DUMP ) |
| 2503 | ROM_LOAD( "gal16v8d.u18", 0x000, 0x117, NO_DUMP ) |
| 2504 | ROM_LOAD( "gal16v8d.u19", 0x000, 0x117, NO_DUMP ) |
| 2505 | ROM_LOAD( "gal16v8d.u26", 0x000, 0x117, NO_DUMP ) |
| 2506 | ROM_LOAD( "gal16v8d.u31", 0x000, 0x117, NO_DUMP ) |
| 2351 | 2507 | ROM_END |
| 2352 | 2508 | |
| 2353 | 2509 | /*************************************************************************** |
| 2354 | 2510 | |
| 2355 | | Decryption of mtrain (lifted from subsino.c) |
| 2511 | Decryption of mtrain (same as crsbingo) |
| 2356 | 2512 | |
| 2357 | 2513 | Notes: |
| 2358 | 2514 | |
| r11160 | r11161 | |
| 2367 | 2523 | |
| 2368 | 2524 | ***************************************************************************/ |
| 2369 | 2525 | |
| 2370 | | static void crsbingo_bitswaps(UINT8* decrypt, int i) |
| 2371 | | { |
| 2372 | | if ((i&7) == 0) decrypt[i] = BITSWAP8(decrypt[i],7,2,5,4,3,6,1,0); |
| 2373 | | if ((i&7) == 1) decrypt[i] = BITSWAP8(decrypt[i],7,2,1,0,3,6,5,4); |
| 2374 | | if ((i&7) == 2) decrypt[i] = BITSWAP8(decrypt[i],3,2,5,0,7,6,1,4); |
| 2375 | | if ((i&7) == 3) decrypt[i] = BITSWAP8(decrypt[i],7,2,5,0,3,6,1,4); |
| 2376 | | if ((i&7) == 4) decrypt[i] = BITSWAP8(decrypt[i],7,6,5,0,3,2,1,4); |
| 2377 | | if ((i&7) == 5) decrypt[i] = BITSWAP8(decrypt[i],7,2,1,4,3,6,5,0); |
| 2378 | | if ((i&7) == 6) decrypt[i] = BITSWAP8(decrypt[i],7,2,1,0,3,6,5,4); |
| 2379 | | if ((i&7) == 7) decrypt[i] = BITSWAP8(decrypt[i],3,2,1,0,7,6,5,4); |
| 2380 | | } |
| 2381 | | |
| 2382 | | static const unsigned char crsbingo_xors[8] = { 0xbb, 0xcc, 0xcc, 0xdd, 0xaa, 0x11, 0x44, 0xee }; |
| 2383 | | |
| 2384 | | static void subsino_decrypt(running_machine& machine, void (*bitswaps)(UINT8* decrypt, int i), const UINT8* xors, int size) |
| 2385 | | { |
| 2386 | | int i; |
| 2387 | | UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x10000); |
| 2388 | | UINT8* region = machine.region("maincpu")->base(); |
| 2389 | | |
| 2390 | | for (i=0;i<0x10000;i++) |
| 2391 | | { |
| 2392 | | if (i<size) |
| 2393 | | { |
| 2394 | | decrypt[i] = region[i]^xors[i&7]; |
| 2395 | | bitswaps(decrypt, i); |
| 2396 | | } |
| 2397 | | else |
| 2398 | | { |
| 2399 | | decrypt[i] = region[i]; |
| 2400 | | } |
| 2401 | | } |
| 2402 | | // dump_decrypted(machine, decrypt); |
| 2403 | | memcpy(region, decrypt, 0x10000); |
| 2404 | | } |
| 2405 | | |
| 2406 | 2526 | DRIVER_INIT( mtrain ) |
| 2407 | 2527 | { |
| 2408 | 2528 | subsino_decrypt(machine, crsbingo_bitswaps, crsbingo_xors, 0x8000); |
| r11160 | r11161 | |
| 2588 | 2708 | rom[0xe190f-0xc0000] = 0xeb; |
| 2589 | 2709 | } |
| 2590 | 2710 | |
| 2591 | | GAME( 1996, mtrain, 0, mtrain, mtrain, mtrain, ROT0, "Subsino", "Magic Train (Ver. 1.31)", 0 ) |
| 2592 | | GAME( 1998, expcard, 0, expcard, expcard, expcard, ROT0, "American Alpha", "Express Card / Top Card (Ver. 1.5)", 0 ) |
| 2593 | | GAME( 1998, saklove, 0, saklove, saklove, saklove, ROT0, "Subsino", "Ying Hua Lian 2.0 (China, Ver. 1.02)", 0 ) |
| 2594 | | GAME( 1999, xtrain, 0, xtrain, xtrain, xtrain, ROT0, "Subsino", "X-Train (Ver. 1.3)", 0 ) |
| 2595 | | GAME( 1999, bishjan, 0, bishjan, bishjan, bishjan, ROT0, "Subsino", "Bishou Jan (Japan, Ver. 2.03)", GAME_NO_SOUND ) |
| 2596 | | GAME( 2006, xplan, 0, xplan, xplan, xplan, ROT0, "Subsino", "X-Plan (Ver. 1.01)", 0 ) |
| 2711 | /*************************************************************************** |
| 2712 | |
| 2713 | Water-Nymph (Ver. 1.4) |
| 2714 | (c) 1996 Subsino |
| 2715 | |
| 2716 | Same PCB as Magic Train |
| 2717 | |
| 2718 | ***************************************************************************/ |
| 2719 | |
| 2720 | ROM_START( wtrnymph ) |
| 2721 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 2722 | // code starts at 0x8100! |
| 2723 | ROM_LOAD( "ocean-n tetris_1 v1.4.u17", 0x0000, 0x8100, CRC(c7499123) SHA1(39a9ea6d927ee839cfb127747e5e3df3535af098) ) |
| 2724 | ROM_CONTINUE( 0x0000, 0x7f00 ) |
| 2725 | ROM_RELOAD( 0xa000, 0x6000 ) |
| 2726 | |
| 2727 | ROM_REGION( 0x100000, "tilemap", 0 ) |
| 2728 | ROM_LOAD32_BYTE( "ocean-n tetris_2 v1.21.u2", 0x00000, 0x40000, CRC(813aac90) SHA1(4555adf8dc363359b10f1d5cfae2dcebed411679) ) |
| 2729 | ROM_LOAD32_BYTE( "ocean-n tetris_3 v1.21.u3", 0x00001, 0x40000, CRC(83c39379) SHA1(e7f9315d19370c18b664b759e433052a88f8c146) ) |
| 2730 | ROM_LOAD32_BYTE( "ocean-n tetris_4 v1.21.u4", 0x00002, 0x40000, CRC(6fc64b42) SHA1(80110d7dae28cca5e39c8a7c2ceebf589116ae23) ) |
| 2731 | ROM_LOAD32_BYTE( "ocean-n tetris_5 v1.21.u5", 0x00003, 0x40000, CRC(8c7515ee) SHA1(a67b21c1e8ca8a098fe558c73561bca13962893e) ) |
| 2732 | |
| 2733 | ROM_REGION( 0x80000, "oki", 0 ) |
| 2734 | ROM_LOAD( "ocean-n tetris_6 v1.21.u27", 0x00000, 0x40000, CRC(1c8a886d) SHA1(faa983801b368a6d04ef80e359c6fb67b240c60d) ) |
| 2735 | ROM_RELOAD( 0x40000, 0x40000 ) |
| 2736 | |
| 2737 | ROM_REGION( 0x117, "plds", 0 ) |
| 2738 | ROM_LOAD( "gal16v8d.u6", 0x000, 0x117, NO_DUMP ) |
| 2739 | ROM_LOAD( "gal16v8d.u18", 0x000, 0x117, NO_DUMP ) |
| 2740 | ROM_LOAD( "gal16v8d.u19", 0x000, 0x117, NO_DUMP ) |
| 2741 | ROM_LOAD( "gal16v8d.u26", 0x000, 0x117, NO_DUMP ) |
| 2742 | ROM_LOAD( "gal16v8d.u31", 0x000, 0x117, NO_DUMP ) |
| 2743 | ROM_END |
| 2744 | |
| 2745 | DRIVER_INIT( wtrnymph ) |
| 2746 | { |
| 2747 | subsino_decrypt(machine, victor5_bitswaps, victor5_xors, 0x8000); |
| 2748 | |
| 2749 | // patch serial protection test (it always enters test mode on boot otherwise) |
| 2750 | UINT8 *rom = machine.region("maincpu")->base(); |
| 2751 | rom[0x0d79] = 0x18; |
| 2752 | rom[0xc1cf] = 0x18; |
| 2753 | rom[0xc2a9] = 0x18; |
| 2754 | rom[0xc2d7] = 0x18; |
| 2755 | } |
| 2756 | |
| 2757 | GAME( 1996, mtrain, 0, mtrain, mtrain, mtrain, ROT0, "Subsino", "Magic Train (Ver. 1.31)", 0 ) |
| 2758 | GAME( 1996, wtrnymph, 0, mtrain, wtrnymph, wtrnymph, ROT0, "Subsino", "Water-Nymph (Ver. 1.4)", 0 ) |
| 2759 | GAME( 1998, expcard, 0, expcard, expcard, expcard, ROT0, "American Alpha", "Express Card / Top Card (Ver. 1.5)", 0 ) |
| 2760 | GAME( 1998, saklove, 0, saklove, saklove, saklove, ROT0, "Subsino", "Ying Hua Lian 2.0 (China, Ver. 1.02)", 0 ) |
| 2761 | GAME( 1999, xtrain, 0, xtrain, xtrain, xtrain, ROT0, "Subsino", "X-Train (Ver. 1.3)", 0 ) |
| 2762 | GAME( 1999, bishjan, 0, bishjan, bishjan, bishjan, ROT0, "Subsino", "Bishou Jan (Japan, Ver. 2.03)", GAME_NO_SOUND ) |
| 2763 | GAME( 2006, xplan, 0, xplan, xplan, xplan, ROT0, "Subsino", "X-Plan (Ver. 1.01)", 0 ) |
src/mame/drivers/m72.c
| r11160 | r11161 | |
| 106 | 106 | static MACHINE_START( m72 ) |
| 107 | 107 | { |
| 108 | 108 | m72_state *state = machine.driver_data<m72_state>(); |
| 109 | state->m_audio = machine.device("m72"); |
| 109 | 110 | state->m_scanline_timer = machine.scheduler().timer_alloc(FUNC(m72_scanline_interrupt)); |
| 110 | 111 | |
| 111 | 112 | state->save_item(NAME(state->m_mcu_sample_addr)); |
| r11160 | r11161 | |
| 453 | 454 | |
| 454 | 455 | static INTERRUPT_GEN(fake_nmi) |
| 455 | 456 | { |
| 456 | | address_space *space = device->memory().space(AS_PROGRAM); |
| 457 | | int sample = m72_sample_r(space,0); |
| 457 | m72_state *state = device->machine().driver_data<m72_state>(); |
| 458 | int sample = m72_sample_r(state->m_audio,0); |
| 458 | 459 | if (sample) |
| 459 | | m72_sample_w(device->machine().device("dac"),0,sample); |
| 460 | m72_sample_w(state->m_audio,0,sample); |
| 460 | 461 | } |
| 461 | 462 | |
| 462 | 463 | |
| 463 | 464 | static WRITE16_HANDLER( bchopper_sample_trigger_w ) |
| 464 | 465 | { |
| 466 | m72_state *state = space->machine().driver_data<m72_state>(); |
| 465 | 467 | static const int a[6] = { 0x0000, 0x0010, 0x2510, 0x6510, 0x8510, 0x9310 }; |
| 466 | | if (ACCESSING_BITS_0_7 && (data & 0xff) < 6) m72_set_sample_start(a[data & 0xff]); |
| 468 | if (ACCESSING_BITS_0_7 && (data & 0xff) < 6) m72_set_sample_start(state->m_audio, a[data & 0xff]); |
| 467 | 469 | } |
| 468 | 470 | |
| 469 | 471 | static WRITE16_HANDLER( nspirit_sample_trigger_w ) |
| 470 | 472 | { |
| 473 | m72_state *state = space->machine().driver_data<m72_state>(); |
| 471 | 474 | static const int a[9] = { 0x0000, 0x0020, 0x2020, 0, 0x5720, 0, 0x7b60, 0x9b60, 0xc360 }; |
| 472 | | if (ACCESSING_BITS_0_7 && (data & 0xff) < 9) m72_set_sample_start(a[data & 0xff]); |
| 475 | if (ACCESSING_BITS_0_7 && (data & 0xff) < 9) m72_set_sample_start(state->m_audio, a[data & 0xff]); |
| 473 | 476 | } |
| 474 | 477 | |
| 475 | 478 | static WRITE16_HANDLER( imgfight_sample_trigger_w ) |
| 476 | 479 | { |
| 480 | m72_state *state = space->machine().driver_data<m72_state>(); |
| 477 | 481 | static const int a[7] = { 0x0000, 0x0020, 0x44e0, 0x98a0, 0xc820, 0xf7a0, 0x108c0 }; |
| 478 | | if (ACCESSING_BITS_0_7 && (data & 0xff) < 7) m72_set_sample_start(a[data & 0xff]); |
| 482 | if (ACCESSING_BITS_0_7 && (data & 0xff) < 7) m72_set_sample_start(state->m_audio, a[data & 0xff]); |
| 479 | 483 | } |
| 480 | 484 | |
| 481 | 485 | static WRITE16_HANDLER( loht_sample_trigger_w ) |
| 482 | 486 | { |
| 487 | m72_state *state = space->machine().driver_data<m72_state>(); |
| 483 | 488 | static const int a[7] = { 0x0000, 0x0020, 0, 0x2c40, 0x4320, 0x7120, 0xb200 }; |
| 484 | | if (ACCESSING_BITS_0_7 && (data & 0xff) < 7) m72_set_sample_start(a[data & 0xff]); |
| 489 | if (ACCESSING_BITS_0_7 && (data & 0xff) < 7) m72_set_sample_start(state->m_audio, a[data & 0xff]); |
| 485 | 490 | } |
| 486 | 491 | |
| 487 | 492 | static WRITE16_HANDLER( xmultiplm72_sample_trigger_w ) |
| 488 | 493 | { |
| 494 | m72_state *state = space->machine().driver_data<m72_state>(); |
| 489 | 495 | static const int a[3] = { 0x0000, 0x0020, 0x1a40 }; |
| 490 | | if (ACCESSING_BITS_0_7 && (data & 0xff) < 3) m72_set_sample_start(a[data & 0xff]); |
| 496 | if (ACCESSING_BITS_0_7 && (data & 0xff) < 3) m72_set_sample_start(state->m_audio, a[data & 0xff]); |
| 491 | 497 | } |
| 492 | 498 | |
| 493 | 499 | static WRITE16_HANDLER( dbreedm72_sample_trigger_w ) |
| 494 | 500 | { |
| 501 | m72_state *state = space->machine().driver_data<m72_state>(); |
| 495 | 502 | static const int a[9] = { 0x00000, 0x00020, 0x02c40, 0x08160, 0x0c8c0, 0x0ffe0, 0x13000, 0x15820, 0x15f40 }; |
| 496 | | if (ACCESSING_BITS_0_7 && (data & 0xff) < 9) m72_set_sample_start(a[data & 0xff]); |
| 503 | if (ACCESSING_BITS_0_7 && (data & 0xff) < 9) m72_set_sample_start(state->m_audio, a[data & 0xff]); |
| 497 | 504 | } |
| 498 | 505 | |
| 499 | 506 | static WRITE16_HANDLER( airduel_sample_trigger_w ) |
| 500 | 507 | { |
| 508 | m72_state *state = space->machine().driver_data<m72_state>(); |
| 501 | 509 | static const int a[16] = { |
| 502 | 510 | 0x00000, 0x00020, 0x03ec0, 0x05640, 0x06dc0, 0x083a0, 0x0c000, 0x0eb60, |
| 503 | 511 | 0x112e0, 0x13dc0, 0x16520, 0x16d60, 0x18ae0, 0x1a5a0, 0x1bf00, 0x1c340 }; |
| 504 | | if (ACCESSING_BITS_0_7 && (data & 0xff) < 16) m72_set_sample_start(a[data & 0xff]); |
| 512 | if (ACCESSING_BITS_0_7 && (data & 0xff) < 16) m72_set_sample_start(state->m_audio, a[data & 0xff]); |
| 505 | 513 | } |
| 506 | 514 | |
| 507 | 515 | static WRITE16_HANDLER( dkgenm72_sample_trigger_w ) |
| 508 | 516 | { |
| 517 | m72_state *state = space->machine().driver_data<m72_state>(); |
| 509 | 518 | static const int a[28] = { |
| 510 | 519 | 0x00000, 0x00020, 0x01800, 0x02da0, 0x03be0, 0x05ae0, 0x06100, 0x06de0, |
| 511 | 520 | 0x07260, 0x07a60, 0x08720, 0x0a5c0, 0x0c3c0, 0x0c7a0, 0x0e140, 0x0fb00, |
| 512 | 521 | 0x10fa0, 0x10fc0, 0x10fe0, 0x11f40, 0x12b20, 0x130a0, 0x13c60, 0x14740, |
| 513 | 522 | 0x153c0, 0x197e0, 0x1af40, 0x1c080 }; |
| 514 | 523 | |
| 515 | | if (ACCESSING_BITS_0_7 && (data & 0xff) < 28) m72_set_sample_start(a[data & 0xff]); |
| 524 | if (ACCESSING_BITS_0_7 && (data & 0xff) < 28) m72_set_sample_start(state->m_audio, a[data & 0xff]); |
| 516 | 525 | } |
| 517 | 526 | |
| 518 | 527 | static WRITE16_HANDLER( gallop_sample_trigger_w ) |
| 519 | 528 | { |
| 529 | m72_state *state = space->machine().driver_data<m72_state>(); |
| 520 | 530 | static const int a[31] = { |
| 521 | 531 | 0x00000, 0x00020, 0x00040, 0x01360, 0x02580, 0x04f20, 0x06240, 0x076e0, |
| 522 | 532 | 0x08660, 0x092a0, 0x09ba0, 0x0a560, 0x0cee0, 0x0de20, 0x0e620, 0x0f1c0, |
| 523 | 533 | 0x10200, 0x10220, 0x10240, 0x11380, 0x12760, 0x12780, 0x127a0, 0x13c40, |
| 524 | 534 | 0x140a0, 0x16760, 0x17e40, 0x18ee0, 0x19f60, 0x1bbc0, 0x1cee0 }; |
| 525 | 535 | |
| 526 | | if (ACCESSING_BITS_0_7 && (data & 0xff) < 31) m72_set_sample_start(a[data & 0xff]); |
| 536 | if (ACCESSING_BITS_0_7 && (data & 0xff) < 31) m72_set_sample_start(state->m_audio, a[data & 0xff]); |
| 527 | 537 | } |
| 528 | 538 | |
| 529 | 539 | |
| r11160 | r11161 | |
| 998 | 1008 | AM_RANGE(0x00, 0x01) AM_READ_PORT("IN0") |
| 999 | 1009 | AM_RANGE(0x02, 0x03) AM_READ_PORT("IN1") |
| 1000 | 1010 | AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW") |
| 1001 | | AM_RANGE(0x00, 0x01) AM_WRITE(m72_sound_command_w) |
| 1011 | AM_RANGE(0x00, 0x01) AM_DEVWRITE("m72", m72_sound_command_w) |
| 1002 | 1012 | AM_RANGE(0x02, 0x03) AM_WRITE(m72_port02_w) /* coin counters, reset sound cpu, other stuff? */ |
| 1003 | 1013 | AM_RANGE(0x04, 0x05) AM_WRITE(m72_dmaon_w) |
| 1004 | 1014 | AM_RANGE(0x06, 0x07) AM_WRITE(m72_irq_line_w) |
| r11160 | r11161 | |
| 1014 | 1024 | AM_RANGE(0x00, 0x01) AM_READ_PORT("IN0") |
| 1015 | 1025 | AM_RANGE(0x02, 0x03) AM_READ_PORT("IN1") |
| 1016 | 1026 | AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW") |
| 1017 | | AM_RANGE(0x00, 0x01) AM_WRITE(m72_sound_command_w) |
| 1027 | AM_RANGE(0x00, 0x01) AM_DEVWRITE("m72", m72_sound_command_w) |
| 1018 | 1028 | AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w) |
| 1019 | 1029 | AM_RANGE(0x40, 0x43) AM_WRITENOP /* Interrupt controller, only written to at bootup */ |
| 1020 | 1030 | AM_RANGE(0x80, 0x81) AM_WRITE(m72_scrolly1_w) |
| r11160 | r11161 | |
| 1027 | 1037 | AM_RANGE(0x02, 0x03) AM_READ_PORT("IN1") |
| 1028 | 1038 | AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW") |
| 1029 | 1039 | AM_RANGE(0x08, 0x0f) AM_READ(poundfor_trackball_r) |
| 1030 | | AM_RANGE(0x00, 0x01) AM_WRITE(m72_sound_command_w) |
| 1040 | AM_RANGE(0x00, 0x01) AM_DEVWRITE("m72", m72_sound_command_w) |
| 1031 | 1041 | AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w) |
| 1032 | 1042 | AM_RANGE(0x40, 0x43) AM_WRITENOP /* Interrupt controller, only written to at bootup */ |
| 1033 | 1043 | AM_RANGE(0x80, 0x81) AM_WRITE(m72_scrolly1_w) |
| r11160 | r11161 | |
| 1040 | 1050 | AM_RANGE(0x00, 0x01) AM_READ_PORT("IN0") |
| 1041 | 1051 | AM_RANGE(0x02, 0x03) AM_READ_PORT("IN1") |
| 1042 | 1052 | AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW") |
| 1043 | | AM_RANGE(0x00, 0x01) AM_WRITE(m72_sound_command_w) |
| 1053 | AM_RANGE(0x00, 0x01) AM_DEVWRITE("m72", m72_sound_command_w) |
| 1044 | 1054 | AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w) |
| 1045 | 1055 | AM_RANGE(0x40, 0x43) AM_WRITENOP /* Interrupt controller, only written to at bootup */ |
| 1046 | 1056 | AM_RANGE(0x80, 0x81) AM_WRITE(m72_scrolly1_w) |
| r11160 | r11161 | |
| 1054 | 1064 | AM_RANGE(0x00, 0x01) AM_READ_PORT("IN0") |
| 1055 | 1065 | AM_RANGE(0x02, 0x03) AM_READ_PORT("IN1") |
| 1056 | 1066 | AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW") |
| 1057 | | AM_RANGE(0x00, 0x01) AM_WRITE(m72_sound_command_w) |
| 1067 | AM_RANGE(0x00, 0x01) AM_DEVWRITE("m72", m72_sound_command_w) |
| 1058 | 1068 | AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w) /* coin counters, reset sound cpu, other stuff? */ |
| 1059 | 1069 | AM_RANGE(0x04, 0x05) AM_WRITE(m72_dmaon_w) |
| 1060 | 1070 | AM_RANGE(0x06, 0x07) AM_WRITE(m72_irq_line_w) |
| r11160 | r11161 | |
| 1069 | 1079 | AM_RANGE(0x00, 0x01) AM_READ_PORT("IN0") |
| 1070 | 1080 | AM_RANGE(0x02, 0x03) AM_READ_PORT("IN1") |
| 1071 | 1081 | AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW") |
| 1072 | | AM_RANGE(0x00, 0x01) AM_WRITE(m72_sound_command_w) |
| 1082 | AM_RANGE(0x00, 0x01) AM_DEVWRITE("m72", m72_sound_command_w) |
| 1073 | 1083 | AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w) |
| 1074 | 1084 | AM_RANGE(0x80, 0x81) AM_WRITE(m72_scrolly1_w) |
| 1075 | 1085 | AM_RANGE(0x82, 0x83) AM_WRITE(m72_scrollx1_w) |
| r11160 | r11161 | |
| 1092 | 1102 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 1093 | 1103 | AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("ymsnd", ym2151_r, ym2151_w) |
| 1094 | 1104 | AM_RANGE(0x02, 0x02) AM_READ(soundlatch_r) |
| 1095 | | AM_RANGE(0x06, 0x06) AM_WRITE(m72_sound_irq_ack_w) |
| 1096 | | AM_RANGE(0x84, 0x84) AM_READ(m72_sample_r) |
| 1105 | AM_RANGE(0x06, 0x06) AM_DEVWRITE("m72", m72_sound_irq_ack_w) |
| 1106 | AM_RANGE(0x84, 0x84) AM_DEVREAD("m72", m72_sample_r) |
| 1097 | 1107 | ADDRESS_MAP_END |
| 1098 | 1108 | |
| 1099 | 1109 | static ADDRESS_MAP_START( sound_portmap, AS_IO, 8 ) |
| 1100 | 1110 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 1101 | 1111 | AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("ymsnd", ym2151_r, ym2151_w) |
| 1102 | 1112 | AM_RANGE(0x02, 0x02) AM_READ(soundlatch_r) |
| 1103 | | AM_RANGE(0x06, 0x06) AM_WRITE(m72_sound_irq_ack_w) |
| 1104 | | AM_RANGE(0x82, 0x82) AM_DEVWRITE("dac", m72_sample_w) |
| 1105 | | AM_RANGE(0x84, 0x84) AM_READ(m72_sample_r) |
| 1113 | AM_RANGE(0x06, 0x06) AM_DEVWRITE("m72", m72_sound_irq_ack_w) |
| 1114 | AM_RANGE(0x82, 0x82) AM_DEVWRITE("m72", m72_sample_w) |
| 1115 | AM_RANGE(0x84, 0x84) AM_DEVREAD("m72", m72_sample_r) |
| 1106 | 1116 | ADDRESS_MAP_END |
| 1107 | 1117 | |
| 1108 | 1118 | static ADDRESS_MAP_START( rtype2_sound_portmap, AS_IO, 8 ) |
| 1109 | 1119 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 1110 | 1120 | AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("ymsnd", ym2151_r, ym2151_w) |
| 1111 | 1121 | AM_RANGE(0x80, 0x80) AM_READ(soundlatch_r) |
| 1112 | | AM_RANGE(0x80, 0x81) AM_WRITE(rtype2_sample_addr_w) |
| 1113 | | AM_RANGE(0x82, 0x82) AM_DEVWRITE("dac", m72_sample_w) |
| 1114 | | AM_RANGE(0x83, 0x83) AM_WRITE(m72_sound_irq_ack_w) |
| 1115 | | AM_RANGE(0x84, 0x84) AM_READ(m72_sample_r) |
| 1122 | AM_RANGE(0x80, 0x81) AM_DEVWRITE("m72", rtype2_sample_addr_w) |
| 1123 | AM_RANGE(0x82, 0x82) AM_DEVWRITE("m72", m72_sample_w) |
| 1124 | AM_RANGE(0x83, 0x83) AM_DEVWRITE("m72", m72_sound_irq_ack_w) |
| 1125 | AM_RANGE(0x84, 0x84) AM_DEVREAD("m72", m72_sample_r) |
| 1116 | 1126 | // AM_RANGE(0x87, 0x87) AM_WRITENOP /* ??? */ |
| 1117 | 1127 | ADDRESS_MAP_END |
| 1118 | 1128 | |
| 1119 | 1129 | static ADDRESS_MAP_START( poundfor_sound_portmap, AS_IO, 8 ) |
| 1120 | 1130 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 1121 | | AM_RANGE(0x10, 0x13) AM_WRITE(poundfor_sample_addr_w) |
| 1131 | AM_RANGE(0x10, 0x13) AM_DEVWRITE("m72", poundfor_sample_addr_w) |
| 1122 | 1132 | AM_RANGE(0x40, 0x41) AM_DEVREADWRITE("ymsnd", ym2151_r, ym2151_w) |
| 1123 | 1133 | AM_RANGE(0x42, 0x42) AM_READ(soundlatch_r) |
| 1124 | | AM_RANGE(0x42, 0x42) AM_WRITE(m72_sound_irq_ack_w) |
| 1134 | AM_RANGE(0x42, 0x42) AM_DEVWRITE("m72", m72_sound_irq_ack_w) |
| 1125 | 1135 | ADDRESS_MAP_END |
| 1126 | 1136 | |
| 1127 | 1137 | static ADDRESS_MAP_START( mcu_io_map, AS_IO, 8 ) |
| r11160 | r11161 | |
| 1859 | 1869 | MCFG_MACHINE_START(m72) |
| 1860 | 1870 | MCFG_MACHINE_RESET(m72) |
| 1861 | 1871 | |
| 1862 | | MCFG_SOUND_START(m72) |
| 1863 | | MCFG_SOUND_RESET(m72) |
| 1864 | | |
| 1865 | 1872 | /* video hardware */ |
| 1866 | 1873 | MCFG_GFXDECODE(m72) |
| 1867 | 1874 | MCFG_PALETTE_LENGTH(512) |
| r11160 | r11161 | |
| 1876 | 1883 | /* sound hardware */ |
| 1877 | 1884 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 1878 | 1885 | |
| 1886 | MCFG_SOUND_ADD("m72", M72, 0); |
| 1887 | |
| 1879 | 1888 | MCFG_SOUND_ADD("ymsnd", YM2151, SOUND_CLOCK) |
| 1880 | 1889 | MCFG_SOUND_CONFIG(ym2151_config) |
| 1881 | 1890 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) |
| r11160 | r11161 | |
| 1916 | 1925 | MCFG_MACHINE_START(m72) |
| 1917 | 1926 | MCFG_MACHINE_RESET(m72) |
| 1918 | 1927 | |
| 1919 | | MCFG_SOUND_START(m72) |
| 1920 | | MCFG_SOUND_RESET(m72) |
| 1921 | | |
| 1922 | 1928 | /* video hardware */ |
| 1923 | 1929 | MCFG_GFXDECODE(m72) |
| 1924 | 1930 | MCFG_PALETTE_LENGTH(512) |
| r11160 | r11161 | |
| 1933 | 1939 | /* sound hardware */ |
| 1934 | 1940 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 1935 | 1941 | |
| 1942 | MCFG_SOUND_ADD("m72", M72, 0); |
| 1943 | |
| 1936 | 1944 | MCFG_SOUND_ADD("ymsnd", YM2151, SOUND_CLOCK) |
| 1937 | 1945 | MCFG_SOUND_CONFIG(ym2151_config) |
| 1938 | 1946 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) |
| r11160 | r11161 | |
| 1955 | 1963 | MCFG_MACHINE_START(m72) |
| 1956 | 1964 | MCFG_MACHINE_RESET(xmultipl) |
| 1957 | 1965 | |
| 1958 | | MCFG_SOUND_START(m72) |
| 1959 | | MCFG_SOUND_RESET(m72) |
| 1960 | | |
| 1961 | 1966 | /* video hardware */ |
| 1962 | 1967 | MCFG_GFXDECODE(m72) |
| 1963 | 1968 | MCFG_PALETTE_LENGTH(512) |
| r11160 | r11161 | |
| 1972 | 1977 | /* sound hardware */ |
| 1973 | 1978 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 1974 | 1979 | |
| 1980 | MCFG_SOUND_ADD("m72", M72, 0); |
| 1981 | |
| 1975 | 1982 | MCFG_SOUND_ADD("ymsnd", YM2151, SOUND_CLOCK) |
| 1976 | 1983 | MCFG_SOUND_CONFIG(ym2151_config) |
| 1977 | 1984 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) |
| r11160 | r11161 | |
| 1998 | 2005 | MCFG_MACHINE_START(m72) |
| 1999 | 2006 | MCFG_MACHINE_RESET(xmultipl) |
| 2000 | 2007 | |
| 2001 | | MCFG_SOUND_START(m72) |
| 2002 | | MCFG_SOUND_RESET(m72) |
| 2003 | | |
| 2004 | 2008 | /* video hardware */ |
| 2005 | 2009 | MCFG_GFXDECODE(m72) |
| 2006 | 2010 | MCFG_PALETTE_LENGTH(512) |
| r11160 | r11161 | |
| 2015 | 2019 | /* sound hardware */ |
| 2016 | 2020 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 2017 | 2021 | |
| 2022 | MCFG_SOUND_ADD("m72", M72, 0); |
| 2023 | |
| 2018 | 2024 | MCFG_SOUND_ADD("ymsnd", YM2151, SOUND_CLOCK) |
| 2019 | 2025 | MCFG_SOUND_CONFIG(ym2151_config) |
| 2020 | 2026 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) |
| r11160 | r11161 | |
| 2041 | 2047 | MCFG_MACHINE_START(m72) |
| 2042 | 2048 | MCFG_MACHINE_RESET(xmultipl) |
| 2043 | 2049 | |
| 2044 | | MCFG_SOUND_START(m72) |
| 2045 | | MCFG_SOUND_RESET(m72) |
| 2046 | | |
| 2047 | 2050 | /* video hardware */ |
| 2048 | 2051 | MCFG_GFXDECODE(rtype2) |
| 2049 | 2052 | MCFG_PALETTE_LENGTH(512) |
| r11160 | r11161 | |
| 2058 | 2061 | /* sound hardware */ |
| 2059 | 2062 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 2060 | 2063 | |
| 2064 | MCFG_SOUND_ADD("m72", M72, 0); |
| 2065 | |
| 2061 | 2066 | MCFG_SOUND_ADD("ymsnd", YM2151, SOUND_CLOCK) |
| 2062 | 2067 | MCFG_SOUND_CONFIG(ym2151_config) |
| 2063 | 2068 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) |
| r11160 | r11161 | |
| 2084 | 2089 | MCFG_MACHINE_START(m72) |
| 2085 | 2090 | MCFG_MACHINE_RESET(xmultipl) |
| 2086 | 2091 | |
| 2087 | | MCFG_SOUND_START(m72) |
| 2088 | | MCFG_SOUND_RESET(m72) |
| 2089 | | |
| 2090 | 2092 | /* video hardware */ |
| 2091 | 2093 | MCFG_GFXDECODE(m72) |
| 2092 | 2094 | MCFG_PALETTE_LENGTH(512) |
| r11160 | r11161 | |
| 2101 | 2103 | /* sound hardware */ |
| 2102 | 2104 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 2103 | 2105 | |
| 2106 | MCFG_SOUND_ADD("m72", M72, 0); |
| 2107 | |
| 2104 | 2108 | MCFG_SOUND_ADD("ymsnd", YM2151, SOUND_CLOCK) |
| 2105 | 2109 | MCFG_SOUND_CONFIG(ym2151_config) |
| 2106 | 2110 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) |
| r11160 | r11161 | |
| 2127 | 2131 | MCFG_MACHINE_START(m72) |
| 2128 | 2132 | MCFG_MACHINE_RESET(m72) |
| 2129 | 2133 | |
| 2130 | | MCFG_SOUND_START(m72) |
| 2131 | | MCFG_SOUND_RESET(m72) |
| 2132 | | |
| 2133 | 2134 | /* video hardware */ |
| 2134 | 2135 | MCFG_GFXDECODE(rtype2) |
| 2135 | 2136 | MCFG_PALETTE_LENGTH(512) |
| r11160 | r11161 | |
| 2144 | 2145 | /* sound hardware */ |
| 2145 | 2146 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 2146 | 2147 | |
| 2148 | MCFG_SOUND_ADD("m72", M72, 0); |
| 2149 | |
| 2147 | 2150 | MCFG_SOUND_ADD("ymsnd", YM2151, SOUND_CLOCK) |
| 2148 | 2151 | MCFG_SOUND_CONFIG(ym2151_config) |
| 2149 | 2152 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) |
| r11160 | r11161 | |
| 2170 | 2173 | MCFG_MACHINE_START(m72) |
| 2171 | 2174 | MCFG_MACHINE_RESET(m72) |
| 2172 | 2175 | |
| 2173 | | MCFG_SOUND_START(m72) |
| 2174 | | MCFG_SOUND_RESET(m72) |
| 2175 | | |
| 2176 | 2176 | /* video hardware */ |
| 2177 | 2177 | MCFG_GFXDECODE(majtitle) |
| 2178 | 2178 | MCFG_PALETTE_LENGTH(512) |
| r11160 | r11161 | |
| 2187 | 2187 | /* sound hardware */ |
| 2188 | 2188 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 2189 | 2189 | |
| 2190 | MCFG_SOUND_ADD("m72", M72, 0); |
| 2191 | |
| 2190 | 2192 | MCFG_SOUND_ADD("ymsnd", YM2151, SOUND_CLOCK) |
| 2191 | 2193 | MCFG_SOUND_CONFIG(ym2151_config) |
| 2192 | 2194 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) |
| r11160 | r11161 | |
| 2213 | 2215 | MCFG_MACHINE_START(m72) |
| 2214 | 2216 | MCFG_MACHINE_RESET(xmultipl) |
| 2215 | 2217 | |
| 2216 | | MCFG_SOUND_START(m72) |
| 2217 | | MCFG_SOUND_RESET(m72) |
| 2218 | | |
| 2219 | 2218 | /* video hardware */ |
| 2220 | 2219 | MCFG_GFXDECODE(rtype2) |
| 2221 | 2220 | MCFG_PALETTE_LENGTH(512) |
| r11160 | r11161 | |
| 2230 | 2229 | /* sound hardware */ |
| 2231 | 2230 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 2232 | 2231 | |
| 2232 | MCFG_SOUND_ADD("m72", M72, 0); |
| 2233 | |
| 2233 | 2234 | MCFG_SOUND_ADD("ymsnd", YM2151, SOUND_CLOCK) |
| 2234 | 2235 | MCFG_SOUND_CONFIG(ym2151_config) |
| 2235 | 2236 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) |
| r11160 | r11161 | |
| 2256 | 2257 | MCFG_MACHINE_START(m72) |
| 2257 | 2258 | MCFG_MACHINE_RESET(xmultipl) |
| 2258 | 2259 | |
| 2259 | | MCFG_SOUND_START(m72) |
| 2260 | | MCFG_SOUND_RESET(m72) |
| 2261 | | |
| 2262 | 2260 | /* video hardware */ |
| 2263 | 2261 | MCFG_GFXDECODE(rtype2) |
| 2264 | 2262 | MCFG_PALETTE_LENGTH(512) |
| r11160 | r11161 | |
| 2273 | 2271 | /* sound hardware */ |
| 2274 | 2272 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 2275 | 2273 | |
| 2274 | MCFG_SOUND_ADD("m72", M72, 0); |
| 2275 | |
| 2276 | 2276 | MCFG_SOUND_ADD("ymsnd", YM2151, SOUND_CLOCK) |
| 2277 | 2277 | MCFG_SOUND_CONFIG(ym2151_config) |
| 2278 | 2278 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) |
| r11160 | r11161 | |
| 2299 | 2299 | MCFG_MACHINE_START(m72) |
| 2300 | 2300 | MCFG_MACHINE_RESET(xmultipl) |
| 2301 | 2301 | |
| 2302 | | MCFG_SOUND_START(m72) |
| 2303 | | MCFG_SOUND_RESET(m72) |
| 2304 | | |
| 2305 | 2302 | /* video hardware */ |
| 2306 | 2303 | MCFG_GFXDECODE(m72) |
| 2307 | 2304 | MCFG_PALETTE_LENGTH(512) |
| r11160 | r11161 | |
| 2316 | 2313 | /* sound hardware */ |
| 2317 | 2314 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 2318 | 2315 | |
| 2316 | MCFG_SOUND_ADD("m72", M72, 0); |
| 2317 | |
| 2319 | 2318 | MCFG_SOUND_ADD("ymsnd", YM2151, SOUND_CLOCK) |
| 2320 | 2319 | MCFG_SOUND_CONFIG(ym2151_config) |
| 2321 | 2320 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) |
| r11160 | r11161 | |
| 2342 | 2341 | MCFG_MACHINE_START(m72) |
| 2343 | 2342 | MCFG_MACHINE_RESET(m72) |
| 2344 | 2343 | |
| 2345 | | MCFG_SOUND_START(m72) |
| 2346 | | MCFG_SOUND_RESET(m72) |
| 2347 | | |
| 2348 | 2344 | /* video hardware */ |
| 2349 | 2345 | MCFG_GFXDECODE(rtype2) |
| 2350 | 2346 | MCFG_PALETTE_LENGTH(512) |
| r11160 | r11161 | |
| 2359 | 2355 | /* sound hardware */ |
| 2360 | 2356 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 2361 | 2357 | |
| 2358 | MCFG_SOUND_ADD("m72", M72, 0); |
| 2359 | |
| 2362 | 2360 | MCFG_SOUND_ADD("ymsnd", YM2151, SOUND_CLOCK) |
| 2363 | 2361 | MCFG_SOUND_CONFIG(ym2151_config) |
| 2364 | 2362 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) |
| r11160 | r11161 | |
| 2385 | 2383 | MCFG_MACHINE_START(kengo) |
| 2386 | 2384 | MCFG_MACHINE_RESET(kengo) |
| 2387 | 2385 | |
| 2388 | | MCFG_SOUND_START(m72) |
| 2389 | | MCFG_SOUND_RESET(m72) |
| 2390 | | |
| 2391 | 2386 | /* video hardware */ |
| 2392 | 2387 | MCFG_GFXDECODE(rtype2) |
| 2393 | 2388 | MCFG_PALETTE_LENGTH(512) |
| r11160 | r11161 | |
| 2402 | 2397 | /* sound hardware */ |
| 2403 | 2398 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 2404 | 2399 | |
| 2400 | MCFG_SOUND_ADD("m72", M72, 0); |
| 2401 | |
| 2405 | 2402 | MCFG_SOUND_ADD("ymsnd", YM2151, SOUND_CLOCK) |
| 2406 | 2403 | MCFG_SOUND_CONFIG(ym2151_config) |
| 2407 | 2404 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) |
src/mame/drivers/sigmab98.c
| r11160 | r11161 | |
| 105 | 105 | |
| 106 | 106 | UINT8 *m_spriteram; |
| 107 | 107 | size_t m_spriteram_size; |
| 108 | UINT8 m_reg; |
| 109 | UINT8 m_rombank; |
| 110 | UINT8 m_reg2; |
| 111 | UINT8 m_rambank; |
| 112 | UINT8 m_c0; |
| 113 | UINT8 m_c4; |
| 114 | UINT8 m_c6; |
| 115 | UINT8 m_c8; |
| 116 | UINT8 m_vblank; |
| 117 | UINT8 m_out[3]; |
| 118 | UINT8 *m_nvram; |
| 108 | 119 | }; |
| 109 | 120 | |
| 110 | 121 | |
| r11160 | r11161 | |
| 266 | 277 | |
| 267 | 278 | ***************************************************************************/ |
| 268 | 279 | |
| 269 | | static UINT8 reg, rombank; |
| 270 | | static UINT8 reg2, rambank; |
| 271 | 280 | |
| 272 | 281 | /*************************************************************************** |
| 273 | 282 | GeGeGe no Kitarou Youkai Slot |
| r11160 | r11161 | |
| 276 | 285 | // rombank |
| 277 | 286 | static WRITE8_HANDLER( regs_w ) |
| 278 | 287 | { |
| 288 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 279 | 289 | if (offset == 0) |
| 280 | 290 | { |
| 281 | | reg = data; |
| 291 | state->m_reg = data; |
| 282 | 292 | return; |
| 283 | 293 | } |
| 284 | 294 | |
| 285 | | switch ( reg ) |
| 295 | switch ( state->m_reg ) |
| 286 | 296 | { |
| 287 | 297 | case 0x1f: |
| 288 | | rombank = data; |
| 298 | state->m_rombank = data; |
| 289 | 299 | if (data >= 0x18) |
| 290 | 300 | logerror("%s: unknown rom bank = %02x\n", space->machine().describe_context(), data); |
| 291 | 301 | else |
| r11160 | r11161 | |
| 293 | 303 | break; |
| 294 | 304 | |
| 295 | 305 | default: |
| 296 | | logerror("%s: unknown reg written: %02x = %02x\n", space->machine().describe_context(), reg, data); |
| 306 | logerror("%s: unknown reg written: %02x = %02x\n", space->machine().describe_context(), state->m_reg, data); |
| 297 | 307 | } |
| 298 | 308 | } |
| 299 | 309 | static READ8_HANDLER( regs_r ) |
| 300 | 310 | { |
| 311 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 301 | 312 | if (offset == 0) |
| 302 | | return reg; |
| 313 | return state->m_reg; |
| 303 | 314 | |
| 304 | | switch ( reg ) |
| 315 | switch ( state->m_reg ) |
| 305 | 316 | { |
| 306 | 317 | case 0x1f: |
| 307 | | return rombank; |
| 318 | return state->m_rombank; |
| 308 | 319 | |
| 309 | 320 | default: |
| 310 | | logerror("%s: unknown reg read: %02x\n", space->machine().describe_context(), reg); |
| 321 | logerror("%s: unknown reg read: %02x\n", space->machine().describe_context(), state->m_reg); |
| 311 | 322 | return 0x00; |
| 312 | 323 | } |
| 313 | 324 | } |
| r11160 | r11161 | |
| 315 | 326 | // rambank |
| 316 | 327 | static WRITE8_HANDLER( regs2_w ) |
| 317 | 328 | { |
| 329 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 318 | 330 | if (offset == 0) |
| 319 | 331 | { |
| 320 | | reg2 = data; |
| 332 | state->m_reg2 = data; |
| 321 | 333 | return; |
| 322 | 334 | } |
| 323 | 335 | |
| 324 | | switch ( reg2 ) |
| 336 | switch ( state->m_reg2 ) |
| 325 | 337 | { |
| 326 | 338 | case 0xb5: |
| 327 | | rambank = data; |
| 339 | state->m_rambank = data; |
| 328 | 340 | switch (data) |
| 329 | 341 | { |
| 330 | 342 | case 0x32: |
| r11160 | r11161 | |
| 339 | 351 | break; |
| 340 | 352 | |
| 341 | 353 | default: |
| 342 | | logerror("%s: unknown reg2 written: %02x = %02x\n", space->machine().describe_context(), reg2, data); |
| 354 | logerror("%s: unknown reg2 written: %02x = %02x\n", space->machine().describe_context(), state->m_reg2, data); |
| 343 | 355 | } |
| 344 | 356 | } |
| 345 | 357 | static READ8_HANDLER( regs2_r ) |
| 346 | 358 | { |
| 359 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 347 | 360 | if (offset == 0) |
| 348 | | return reg2; |
| 361 | return state->m_reg2; |
| 349 | 362 | |
| 350 | | switch ( reg2 ) |
| 363 | switch ( state->m_reg2 ) |
| 351 | 364 | { |
| 352 | 365 | case 0xb5: |
| 353 | | return rambank; |
| 366 | return state->m_rambank; |
| 354 | 367 | |
| 355 | 368 | default: |
| 356 | | logerror("%s: unknown reg2 read: %02x\n", space->machine().describe_context(), reg2); |
| 369 | logerror("%s: unknown reg2 read: %02x\n", space->machine().describe_context(), state->m_reg2); |
| 357 | 370 | return 0x00; |
| 358 | 371 | } |
| 359 | 372 | } |
| r11160 | r11161 | |
| 361 | 374 | |
| 362 | 375 | // Outputs |
| 363 | 376 | |
| 364 | | static UINT8 c0,c4,c6,c8; |
| 365 | | static void show_outputs() |
| 377 | static void show_outputs(sigmab98_state *state) |
| 366 | 378 | { |
| 367 | 379 | #ifdef MAME_DEBUG |
| 368 | | // popmessage("0: %02X 4: %02X 6: %02X 8: %02X",c0,c4,c6,c8); |
| 380 | // popmessage("0: %02X 4: %02X 6: %02X 8: %02X",state->m_c0,state->m_c4,state->m_c6,state->m_c8); |
| 369 | 381 | #endif |
| 370 | 382 | } |
| 371 | 383 | |
| 372 | 384 | // Port c0 |
| 373 | 385 | static WRITE8_DEVICE_HANDLER( eeprom_w ) |
| 374 | 386 | { |
| 387 | sigmab98_state *state = device->machine().driver_data<sigmab98_state>(); |
| 375 | 388 | // latch the bit |
| 376 | 389 | eeprom_write_bit(device, data & 0x40); |
| 377 | 390 | |
| 378 | 391 | // reset line asserted: reset. |
| 379 | | // if ((c0 ^ data) & 0x20) |
| 392 | // if ((state->m_c0 ^ data) & 0x20) |
| 380 | 393 | eeprom_set_cs_line(device, (data & 0x20) ? CLEAR_LINE : ASSERT_LINE); |
| 381 | 394 | |
| 382 | 395 | // clock line asserted: write latch or select next bit to read |
| 383 | 396 | eeprom_set_clock_line(device, (data & 0x10) ? ASSERT_LINE : CLEAR_LINE); |
| 384 | 397 | |
| 385 | | c0 = data; |
| 386 | | show_outputs(); |
| 398 | state->m_c0 = data; |
| 399 | show_outputs(state); |
| 387 | 400 | } |
| 388 | 401 | |
| 389 | 402 | // Port c4 |
| 390 | 403 | // 10 led? |
| 391 | 404 | static WRITE8_HANDLER( c4_w ) |
| 392 | 405 | { |
| 406 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 393 | 407 | set_led_status(space->machine(), 0, (data & 0x10)); |
| 394 | 408 | |
| 395 | | c4 = data; |
| 396 | | show_outputs(); |
| 409 | state->m_c4 = data; |
| 410 | show_outputs(state); |
| 397 | 411 | } |
| 398 | 412 | |
| 399 | 413 | // Port c6 |
| r11160 | r11161 | |
| 404 | 418 | // 20 blinks after coin up |
| 405 | 419 | static WRITE8_HANDLER( c6_w ) |
| 406 | 420 | { |
| 421 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 407 | 422 | coin_lockout_w(space->machine(), 0, (~data) & 0x02); |
| 408 | 423 | |
| 409 | 424 | coin_counter_w(space->machine(), 0, data & 0x04); |
| r11160 | r11161 | |
| 412 | 427 | set_led_status(space->machine(), 2, data & 0x10); |
| 413 | 428 | set_led_status(space->machine(), 3, data & 0x20); // |
| 414 | 429 | |
| 415 | | c6 = data; |
| 416 | | show_outputs(); |
| 430 | state->m_c6 = data; |
| 431 | show_outputs(state); |
| 417 | 432 | } |
| 418 | 433 | |
| 419 | 434 | // Port c8 |
| r11160 | r11161 | |
| 421 | 436 | // 02 hopper motor on (active low)? |
| 422 | 437 | static WRITE8_HANDLER( c8_w ) |
| 423 | 438 | { |
| 439 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 424 | 440 | ticket_dispenser_w(space->machine().device("hopper"), 0, (!(data & 0x02) && (data & 0x01)) ? 0x00 : 0x80); |
| 425 | 441 | |
| 426 | | c8 = data; |
| 427 | | show_outputs(); |
| 442 | state->m_c8 = data; |
| 443 | show_outputs(state); |
| 428 | 444 | } |
| 429 | 445 | |
| 430 | 446 | static ADDRESS_MAP_START( gegege_mem_map, AS_PROGRAM, 8 ) |
| r11160 | r11161 | |
| 477 | 493 | // rombank |
| 478 | 494 | static WRITE8_HANDLER( animalc_rombank_w ) |
| 479 | 495 | { |
| 496 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 480 | 497 | if (offset == 0) |
| 481 | 498 | { |
| 482 | | reg = data; |
| 499 | state->m_reg = data; |
| 483 | 500 | return; |
| 484 | 501 | } |
| 485 | 502 | |
| 486 | 503 | UINT8 *rom = space->machine().region("maincpu")->base(); |
| 487 | | switch ( reg ) |
| 504 | switch ( state->m_reg ) |
| 488 | 505 | { |
| 489 | 506 | case 0x0f: |
| 490 | | rombank = data; |
| 507 | state->m_rombank = data; |
| 491 | 508 | switch (data) |
| 492 | 509 | { |
| 493 | 510 | case 0x10: memory_set_bankptr(space->machine(), "rombank", rom + 0x400 + 0x4000); break; |
| 494 | 511 | case 0x14: memory_set_bankptr(space->machine(), "rombank", rom + 0x400 + 0x8000); break; |
| 495 | 512 | case 0x18: memory_set_bankptr(space->machine(), "rombank", rom + 0x400 + 0xc000); break; |
| 496 | 513 | default: |
| 497 | | logerror("%s: unknown rom bank = %02x, reg = %02x\n", space->machine().describe_context(), data, reg); |
| 514 | logerror("%s: unknown rom bank = %02x, reg = %02x\n", space->machine().describe_context(), data, state->m_reg); |
| 498 | 515 | } |
| 499 | 516 | break; |
| 500 | 517 | |
| 501 | 518 | default: |
| 502 | | logerror("%s: unknown reg written: %02x = %02x\n", space->machine().describe_context(), reg, data); |
| 519 | logerror("%s: unknown reg written: %02x = %02x\n", space->machine().describe_context(), state->m_reg, data); |
| 503 | 520 | } |
| 504 | 521 | } |
| 505 | 522 | static READ8_HANDLER( animalc_rombank_r ) |
| 506 | 523 | { |
| 524 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 507 | 525 | if (offset == 0) |
| 508 | | return reg; |
| 526 | return state->m_reg; |
| 509 | 527 | |
| 510 | | switch ( reg ) |
| 528 | switch ( state->m_reg ) |
| 511 | 529 | { |
| 512 | 530 | case 0x0f: |
| 513 | | return rombank; |
| 531 | return state->m_rombank; |
| 514 | 532 | |
| 515 | 533 | default: |
| 516 | | logerror("%s: unknown reg read: %02x\n", space->machine().describe_context(), reg); |
| 534 | logerror("%s: unknown reg read: %02x\n", space->machine().describe_context(), state->m_reg); |
| 517 | 535 | return 0x00; |
| 518 | 536 | } |
| 519 | 537 | } |
| r11160 | r11161 | |
| 521 | 539 | // rambank |
| 522 | 540 | static WRITE8_HANDLER( animalc_rambank_w ) |
| 523 | 541 | { |
| 542 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 524 | 543 | if (offset == 0) |
| 525 | 544 | { |
| 526 | | reg2 = data; |
| 545 | state->m_reg2 = data; |
| 527 | 546 | return; |
| 528 | 547 | } |
| 529 | 548 | |
| 530 | 549 | int bank = 0; |
| 531 | | switch ( reg2 ) |
| 550 | switch ( state->m_reg2 ) |
| 532 | 551 | { |
| 533 | 552 | case 0x1f: |
| 534 | | rambank = data; |
| 553 | state->m_rambank = data; |
| 535 | 554 | switch (data) |
| 536 | 555 | { |
| 537 | 556 | case 0x58: bank = 0; break; |
| r11160 | r11161 | |
| 540 | 559 | case 0x64: bank = 3; break; |
| 541 | 560 | case 0x65: bank = 4; break; |
| 542 | 561 | default: |
| 543 | | logerror("%s: unknown ram bank = %02x, reg2 = %02x\n", space->machine().describe_context(), data, reg2); |
| 562 | logerror("%s: unknown ram bank = %02x, reg2 = %02x\n", space->machine().describe_context(), data, state->m_reg2); |
| 544 | 563 | return; |
| 545 | 564 | } |
| 546 | 565 | memory_set_bank(space->machine(), "rambank", bank); |
| r11160 | r11161 | |
| 549 | 568 | break; |
| 550 | 569 | |
| 551 | 570 | default: |
| 552 | | logerror("%s: unknown reg2 written: %02x = %02x\n", space->machine().describe_context(), reg2, data); |
| 571 | logerror("%s: unknown reg2 written: %02x = %02x\n", space->machine().describe_context(), state->m_reg2, data); |
| 553 | 572 | } |
| 554 | 573 | } |
| 555 | 574 | static READ8_HANDLER( animalc_rambank_r ) |
| 556 | 575 | { |
| 576 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 557 | 577 | if (offset == 0) |
| 558 | | return reg2; |
| 578 | return state->m_reg2; |
| 559 | 579 | |
| 560 | | switch ( reg2 ) |
| 580 | switch ( state->m_reg2 ) |
| 561 | 581 | { |
| 562 | 582 | case 0x1f: |
| 563 | | return rambank; |
| 583 | return state->m_rambank; |
| 564 | 584 | |
| 565 | 585 | default: |
| 566 | | logerror("%s: unknown reg2 read: %02x\n", space->machine().describe_context(), reg2); |
| 586 | logerror("%s: unknown reg2 read: %02x\n", space->machine().describe_context(), state->m_reg2); |
| 567 | 587 | return 0x00; |
| 568 | 588 | } |
| 569 | 589 | } |
| r11160 | r11161 | |
| 595 | 615 | return 0x01; |
| 596 | 616 | } |
| 597 | 617 | |
| 598 | | static UINT8 vblank; |
| 599 | | |
| 600 | 618 | static READ8_HANDLER( vblank_r ) |
| 601 | 619 | { |
| 620 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 602 | 621 | // mask 0x04 must be set before writing sprite list |
| 603 | 622 | // mask 0x10 must be set or irq/00 hangs? |
| 604 | | return vblank | 0x14; |
| 623 | return state->m_vblank | 0x14; |
| 605 | 624 | } |
| 606 | 625 | |
| 607 | 626 | static WRITE8_HANDLER( vblank_w ) |
| 608 | 627 | { |
| 609 | | vblank = (vblank & ~0x03) | (data & 0x03); |
| 628 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 629 | state->m_vblank = (state->m_vblank & ~0x03) | (data & 0x03); |
| 610 | 630 | } |
| 611 | 631 | |
| 612 | 632 | static SCREEN_EOF( sammymdl ) |
| 613 | 633 | { |
| 614 | | vblank &= ~0x01; |
| 634 | sigmab98_state *state = machine.driver_data<sigmab98_state>(); |
| 635 | state->m_vblank &= ~0x01; |
| 615 | 636 | } |
| 616 | 637 | |
| 617 | | static UINT8 out[3]; |
| 618 | | static void show_3_outputs() |
| 638 | static void show_3_outputs(sigmab98_state *state) |
| 619 | 639 | { |
| 620 | 640 | #ifdef MAME_DEBUG |
| 621 | | // popmessage("COIN: %02X LED: %02X HOP: %02X", out[0], out[1], out[2]); |
| 641 | // popmessage("COIN: %02X LED: %02X HOP: %02X", state->m_out[0], state->m_out[1], state->m_out[2]); |
| 622 | 642 | #endif |
| 623 | 643 | } |
| 624 | 644 | // Port 31 |
| 625 | 645 | static WRITE8_HANDLER( sammymdl_coin_w ) |
| 626 | 646 | { |
| 647 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 627 | 648 | coin_counter_w(space->machine(), 0, data & 0x01 ); // coin1 in |
| 628 | 649 | coin_counter_w(space->machine(), 1, data & 0x02 ); // coin2 in |
| 629 | 650 | coin_counter_w(space->machine(), 2, data & 0x04 ); // medal in |
| r11160 | r11161 | |
| 632 | 653 | // coin_lockout_w(space->machine(), 0, (~data) & 0x10 ); // coin1 lockout |
| 633 | 654 | // coin_lockout_w(space->machine(), 2, (~data) & 0x20 ); // medal lockout? |
| 634 | 655 | |
| 635 | | out[0] = data; |
| 636 | | show_3_outputs(); |
| 656 | state->m_out[0] = data; |
| 657 | show_3_outputs(state); |
| 637 | 658 | } |
| 638 | 659 | |
| 639 | 660 | // Port 32 |
| 640 | 661 | static WRITE8_HANDLER( sammymdl_leds_w ) |
| 641 | 662 | { |
| 663 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 642 | 664 | set_led_status(space->machine(), 0, data & 0x01); // button |
| 643 | 665 | |
| 644 | | out[1] = data; |
| 645 | | show_3_outputs(); |
| 666 | state->m_out[1] = data; |
| 667 | show_3_outputs(state); |
| 646 | 668 | } |
| 647 | 669 | |
| 648 | 670 | // Port b0 |
| r11160 | r11161 | |
| 650 | 672 | // 01 hopper motor on (active low)? |
| 651 | 673 | static WRITE8_HANDLER( sammymdl_hopper_w ) |
| 652 | 674 | { |
| 675 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 653 | 676 | ticket_dispenser_w(space->machine().device("hopper"), 0, (!(data & 0x01) && (data & 0x02)) ? 0x00 : 0x80); |
| 654 | 677 | |
| 655 | | out[2] = data; |
| 656 | | show_3_outputs(); |
| 678 | state->m_out[2] = data; |
| 679 | show_3_outputs(state); |
| 657 | 680 | } |
| 658 | 681 | |
| 659 | 682 | static READ8_HANDLER( sammymdl_coin_hopper_r ) |
| r11160 | r11161 | |
| 666 | 689 | return ret; |
| 667 | 690 | } |
| 668 | 691 | |
| 669 | | static UINT8 *nvram; |
| 670 | 692 | static ADDRESS_MAP_START( animalc_map, AS_PROGRAM, 8 ) |
| 671 | 693 | AM_RANGE( 0x0000, 0x3fff ) AM_ROM |
| 672 | 694 | AM_RANGE( 0x4000, 0x7fff ) AM_ROMBANK( "rombank" ) |
| 673 | | AM_RANGE( 0x8000, 0x8fff ) AM_RAMBANK( "rambank" ) AM_SHARE( "nvram" ) AM_BASE( &nvram ) |
| 695 | AM_RANGE( 0x8000, 0x8fff ) AM_RAMBANK( "rambank" ) AM_SHARE( "nvram" ) AM_BASE_MEMBER( sigmab98_state, m_nvram ) |
| 674 | 696 | |
| 675 | 697 | AM_RANGE( 0x9000, 0x9fff ) AM_RAM |
| 676 | 698 | AM_RANGE( 0xa000, 0xafff ) AM_RAM |
| r11160 | r11161 | |
| 710 | 732 | // rombank |
| 711 | 733 | static WRITE8_HANDLER( haekaka_rombank_w ) |
| 712 | 734 | { |
| 735 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 713 | 736 | if (offset == 0) |
| 714 | 737 | { |
| 715 | | reg = data; |
| 738 | state->m_reg = data; |
| 716 | 739 | return; |
| 717 | 740 | } |
| 718 | 741 | |
| 719 | | switch ( reg ) |
| 742 | switch ( state->m_reg ) |
| 720 | 743 | { |
| 721 | 744 | case 0x2b: |
| 722 | | rombank = data; |
| 745 | state->m_rombank = data; |
| 723 | 746 | switch (data) |
| 724 | 747 | { |
| 725 | 748 | case 0x10: // ROM |
| r11160 | r11161 | |
| 744 | 767 | break; |
| 745 | 768 | |
| 746 | 769 | default: |
| 747 | | logerror("%s: unknown rom bank = %02x, reg = %02x\n", space->machine().describe_context(), data, reg); |
| 770 | logerror("%s: unknown rom bank = %02x, reg = %02x\n", space->machine().describe_context(), data, state->m_reg); |
| 748 | 771 | } |
| 749 | 772 | break; |
| 750 | 773 | |
| 751 | 774 | default: |
| 752 | | logerror("%s: unknown reg written: %02x = %02x\n", space->machine().describe_context(), reg, data); |
| 775 | logerror("%s: unknown reg written: %02x = %02x\n", space->machine().describe_context(), state->m_reg, data); |
| 753 | 776 | } |
| 754 | 777 | } |
| 755 | 778 | static READ8_HANDLER( haekaka_rombank_r ) |
| 756 | 779 | { |
| 780 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 757 | 781 | if (offset == 0) |
| 758 | | return reg; |
| 782 | return state->m_reg; |
| 759 | 783 | |
| 760 | | switch ( reg ) |
| 784 | switch ( state->m_reg ) |
| 761 | 785 | { |
| 762 | 786 | case 0x2b: |
| 763 | | return rombank; |
| 787 | return state->m_rombank; |
| 764 | 788 | |
| 765 | 789 | default: |
| 766 | | logerror("%s: unknown reg read: %02x\n", space->machine().describe_context(), reg); |
| 790 | logerror("%s: unknown reg read: %02x\n", space->machine().describe_context(), state->m_reg); |
| 767 | 791 | return 0x00; |
| 768 | 792 | } |
| 769 | 793 | } |
| r11160 | r11161 | |
| 771 | 795 | // rambank |
| 772 | 796 | static WRITE8_HANDLER( haekaka_rambank_w ) |
| 773 | 797 | { |
| 798 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 774 | 799 | if (offset == 0) |
| 775 | 800 | { |
| 776 | | reg2 = data; |
| 801 | state->m_reg2 = data; |
| 777 | 802 | return; |
| 778 | 803 | } |
| 779 | 804 | |
| 780 | | switch ( reg2 ) |
| 805 | switch ( state->m_reg2 ) |
| 781 | 806 | { |
| 782 | 807 | case 0x33: |
| 783 | | rambank = data; |
| 808 | state->m_rambank = data; |
| 784 | 809 | switch (data) |
| 785 | 810 | { |
| 786 | 811 | case 0x53: |
| 787 | 812 | break; |
| 788 | 813 | |
| 789 | 814 | default: |
| 790 | | logerror("%s: unknown ram bank = %02x, reg2 = %02x\n", space->machine().describe_context(), data, reg2); |
| 815 | logerror("%s: unknown ram bank = %02x, reg2 = %02x\n", space->machine().describe_context(), data, state->m_reg2); |
| 791 | 816 | } |
| 792 | 817 | break; |
| 793 | 818 | |
| 794 | 819 | default: |
| 795 | | logerror("%s: unknown reg2 written: %02x = %02x\n", space->machine().describe_context(), reg2, data); |
| 820 | logerror("%s: unknown reg2 written: %02x = %02x\n", space->machine().describe_context(), state->m_reg2, data); |
| 796 | 821 | } |
| 797 | 822 | } |
| 798 | 823 | static READ8_HANDLER( haekaka_rambank_r ) |
| 799 | 824 | { |
| 825 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 800 | 826 | if (offset == 0) |
| 801 | | return reg2; |
| 827 | return state->m_reg2; |
| 802 | 828 | |
| 803 | | switch ( reg2 ) |
| 829 | switch ( state->m_reg2 ) |
| 804 | 830 | { |
| 805 | 831 | case 0x33: |
| 806 | | return rambank; |
| 832 | return state->m_rambank; |
| 807 | 833 | |
| 808 | 834 | default: |
| 809 | | logerror("%s: unknown reg2 read: %02x\n", space->machine().describe_context(), reg2); |
| 835 | logerror("%s: unknown reg2 read: %02x\n", space->machine().describe_context(), state->m_reg2); |
| 810 | 836 | return 0x00; |
| 811 | 837 | } |
| 812 | 838 | } |
| r11160 | r11161 | |
| 819 | 845 | static READ8_HANDLER( haekaka_b000_r ) |
| 820 | 846 | { |
| 821 | 847 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 822 | | switch (rombank) |
| 848 | switch (state->m_rombank) |
| 823 | 849 | { |
| 824 | 850 | case 0x10: // ROM |
| 825 | 851 | case 0x11: |
| r11160 | r11161 | |
| 837 | 863 | case 0x1d: |
| 838 | 864 | case 0x1e: |
| 839 | 865 | case 0x1f: |
| 840 | | return space->machine().region("maincpu")->base()[offset + 0xb400 + 0x1000 * (rombank-0x10)]; |
| 866 | return space->machine().region("maincpu")->base()[offset + 0xb400 + 0x1000 * (state->m_rombank-0x10)]; |
| 841 | 867 | |
| 842 | 868 | case 0x65: // SPRITERAM |
| 843 | 869 | if (offset < 0x1000) |
| r11160 | r11161 | |
| 851 | 877 | break; |
| 852 | 878 | } |
| 853 | 879 | |
| 854 | | logerror("%s: unknown read from %02x with rombank = %02x\n", space->machine().describe_context(), offset+0xb000, rombank); |
| 880 | logerror("%s: unknown read from %02x with rombank = %02x\n", space->machine().describe_context(), offset+0xb000, state->m_rombank); |
| 855 | 881 | return 0x00; |
| 856 | 882 | } |
| 857 | 883 | |
| 858 | 884 | static WRITE8_HANDLER( haekaka_b000_w ) |
| 859 | 885 | { |
| 860 | 886 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 861 | | switch (rombank) |
| 887 | switch (state->m_rombank) |
| 862 | 888 | { |
| 863 | 889 | case 0x65: // SPRITERAM |
| 864 | 890 | if (offset < 0x1000) |
| r11160 | r11161 | |
| 883 | 909 | break; |
| 884 | 910 | } |
| 885 | 911 | |
| 886 | | logerror("%s: unknown write to %02x = %02x with rombank = %02x\n", space->machine().describe_context(), offset+0xb000, data, rombank); |
| 912 | logerror("%s: unknown write to %02x = %02x with rombank = %02x\n", space->machine().describe_context(), offset+0xb000, data, state->m_rombank); |
| 887 | 913 | } |
| 888 | 914 | |
| 889 | 915 | static WRITE8_HANDLER( haekaka_leds_w ) |
| 890 | 916 | { |
| 917 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 891 | 918 | // All used |
| 892 | 919 | set_led_status(space->machine(), 0, data & 0x01); |
| 893 | 920 | set_led_status(space->machine(), 1, data & 0x02); |
| r11160 | r11161 | |
| 898 | 925 | set_led_status(space->machine(), 6, data & 0x40); |
| 899 | 926 | set_led_status(space->machine(), 7, data & 0x80); |
| 900 | 927 | |
| 901 | | out[1] = data; |
| 902 | | show_3_outputs(); |
| 928 | state->m_out[1] = data; |
| 929 | show_3_outputs(state); |
| 903 | 930 | } |
| 904 | 931 | |
| 905 | 932 | static WRITE8_HANDLER( haekaka_coin_w ) |
| 906 | 933 | { |
| 934 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 907 | 935 | coin_counter_w(space->machine(), 0, data & 0x01 ); // medal out |
| 908 | 936 | // data & 0x02 ? |
| 909 | 937 | // data & 0x04 ? |
| 910 | 938 | // data & 0x10 ? |
| 911 | 939 | |
| 912 | | out[0] = data; |
| 913 | | show_3_outputs(); |
| 940 | state->m_out[0] = data; |
| 941 | show_3_outputs(state); |
| 914 | 942 | } |
| 915 | 943 | |
| 916 | 944 | static ADDRESS_MAP_START( haekaka_map, AS_PROGRAM, 8 ) |
| 917 | 945 | AM_RANGE( 0x0000, 0x7fff ) AM_ROM |
| 918 | 946 | AM_RANGE( 0xb000, 0xcfff ) AM_READWRITE( haekaka_b000_r, haekaka_b000_w ) |
| 919 | | AM_RANGE( 0xd000, 0xefff ) AM_RAM AM_SHARE( "nvram" ) AM_BASE( &nvram ) |
| 947 | AM_RANGE( 0xd000, 0xefff ) AM_RAM AM_SHARE( "nvram" ) AM_BASE_MEMBER( sigmab98_state, m_nvram ) |
| 920 | 948 | AM_RANGE( 0xfe00, 0xffff ) AM_RAM // High speed internal RAM |
| 921 | 949 | ADDRESS_MAP_END |
| 922 | 950 | |
| r11160 | r11161 | |
| 947 | 975 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 948 | 976 | if (offset == 0) |
| 949 | 977 | { |
| 950 | | reg = data; |
| 978 | state->m_reg = data; |
| 951 | 979 | return; |
| 952 | 980 | } |
| 953 | 981 | |
| 954 | 982 | UINT8 *rom = space->machine().region("maincpu")->base(); |
| 955 | | switch ( reg ) |
| 983 | switch ( state->m_reg ) |
| 956 | 984 | { |
| 957 | 985 | case 0x0d: |
| 958 | | rombank = data; |
| 986 | state->m_rombank = data; |
| 959 | 987 | switch (data) |
| 960 | 988 | { |
| 961 | 989 | case 0x11: // 3800 IS ROM |
| r11160 | r11161 | |
| 966 | 994 | break; |
| 967 | 995 | |
| 968 | 996 | default: |
| 969 | | logerror("%s: unknown rom bank = %02x, reg = %02x\n", space->machine().describe_context(), data, reg); |
| 997 | logerror("%s: unknown rom bank = %02x, reg = %02x\n", space->machine().describe_context(), data, state->m_reg); |
| 970 | 998 | } |
| 971 | 999 | break; |
| 972 | 1000 | |
| 973 | 1001 | case 0x4d: |
| 974 | | rombank = data; |
| 1002 | state->m_rombank = data; |
| 975 | 1003 | switch (data) |
| 976 | 1004 | { |
| 977 | 1005 | case 0x14: // 3800 IS ROM |
| r11160 | r11161 | |
| 982 | 1010 | break; |
| 983 | 1011 | |
| 984 | 1012 | default: |
| 985 | | logerror("%s: unknown rom bank = %02x, reg = %02x\n", space->machine().describe_context(), data, reg); |
| 1013 | logerror("%s: unknown rom bank = %02x, reg = %02x\n", space->machine().describe_context(), data, state->m_reg); |
| 986 | 1014 | } |
| 987 | 1015 | break; |
| 988 | 1016 | |
| 989 | 1017 | case 0x8d: |
| 990 | | rombank = data; |
| 1018 | state->m_rombank = data; |
| 991 | 1019 | switch (data) |
| 992 | 1020 | { |
| 993 | 1021 | case 0x0f: // 3800 IS ROM |
| r11160 | r11161 | |
| 1021 | 1049 | break; |
| 1022 | 1050 | |
| 1023 | 1051 | default: |
| 1024 | | logerror("%s: unknown rom bank = %02x, reg = %02x\n", space->machine().describe_context(), data, reg); |
| 1052 | logerror("%s: unknown rom bank = %02x, reg = %02x\n", space->machine().describe_context(), data, state->m_reg); |
| 1025 | 1053 | } |
| 1026 | 1054 | break; |
| 1027 | 1055 | |
| 1028 | 1056 | case 0xcd: |
| 1029 | | rombank = data; |
| 1057 | state->m_rombank = data; |
| 1030 | 1058 | switch (data) |
| 1031 | 1059 | { |
| 1032 | 1060 | case 0x14: // 3800 IS ROM |
| r11160 | r11161 | |
| 1037 | 1065 | break; |
| 1038 | 1066 | |
| 1039 | 1067 | default: |
| 1040 | | logerror("%s: unknown rom bank = %02x, reg = %02x\n", space->machine().describe_context(), data, reg); |
| 1068 | logerror("%s: unknown rom bank = %02x, reg = %02x\n", space->machine().describe_context(), data, state->m_reg); |
| 1041 | 1069 | } |
| 1042 | 1070 | break; |
| 1043 | 1071 | |
| 1044 | 1072 | default: |
| 1045 | | logerror("%s: unknown reg written: %02x = %02x\n", space->machine().describe_context(), reg, data); |
| 1073 | logerror("%s: unknown reg written: %02x = %02x\n", space->machine().describe_context(), state->m_reg, data); |
| 1046 | 1074 | } |
| 1047 | 1075 | } |
| 1048 | 1076 | static READ8_HANDLER( itazuram_rombank_r ) |
| 1049 | 1077 | { |
| 1078 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 1050 | 1079 | if (offset == 0) |
| 1051 | | return reg; |
| 1080 | return state->m_reg; |
| 1052 | 1081 | |
| 1053 | | switch ( reg ) |
| 1082 | switch ( state->m_reg ) |
| 1054 | 1083 | { |
| 1055 | 1084 | // FIXME different registers |
| 1056 | 1085 | case 0x0d: |
| 1057 | 1086 | case 0x4d: |
| 1058 | 1087 | case 0x8d: |
| 1059 | 1088 | case 0xcd: |
| 1060 | | return rombank; |
| 1089 | return state->m_rombank; |
| 1061 | 1090 | |
| 1062 | 1091 | default: |
| 1063 | | logerror("%s: unknown reg read: %02x\n", space->machine().describe_context(), reg); |
| 1092 | logerror("%s: unknown reg read: %02x\n", space->machine().describe_context(), state->m_reg); |
| 1064 | 1093 | return 0x00; |
| 1065 | 1094 | } |
| 1066 | 1095 | } |
| r11160 | r11161 | |
| 1068 | 1097 | // rambank |
| 1069 | 1098 | static WRITE8_HANDLER( itazuram_rambank_w ) |
| 1070 | 1099 | { |
| 1100 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 1071 | 1101 | if (offset == 0) |
| 1072 | 1102 | { |
| 1073 | | reg2 = data; |
| 1103 | state->m_reg2 = data; |
| 1074 | 1104 | return; |
| 1075 | 1105 | } |
| 1076 | 1106 | |
| 1077 | | switch ( reg2 ) |
| 1107 | switch ( state->m_reg2 ) |
| 1078 | 1108 | { |
| 1079 | 1109 | case 0x76: |
| 1080 | | rambank = data; |
| 1110 | state->m_rambank = data; |
| 1081 | 1111 | switch (data) |
| 1082 | 1112 | { |
| 1083 | | case 0x52: memory_set_bankptr(space->machine(), "palbank", nvram); break; |
| 1113 | case 0x52: memory_set_bankptr(space->machine(), "palbank", state->m_nvram); break; |
| 1084 | 1114 | case 0x64: memory_set_bankptr(space->machine(), "palbank", space->machine().generic.paletteram.u8); break; |
| 1085 | 1115 | default: |
| 1086 | | logerror("%s: unknown ram bank = %02x, reg2 = %02x\n", space->machine().describe_context(), data, reg2); |
| 1116 | logerror("%s: unknown ram bank = %02x, reg2 = %02x\n", space->machine().describe_context(), data, state->m_reg2); |
| 1087 | 1117 | return; |
| 1088 | 1118 | } |
| 1089 | 1119 | break; |
| 1090 | 1120 | |
| 1091 | 1121 | default: |
| 1092 | | logerror("%s: unknown reg2 written: %02x = %02x\n", space->machine().describe_context(), reg2, data); |
| 1122 | logerror("%s: unknown reg2 written: %02x = %02x\n", space->machine().describe_context(), state->m_reg2, data); |
| 1093 | 1123 | } |
| 1094 | 1124 | } |
| 1095 | 1125 | |
| 1096 | 1126 | static READ8_HANDLER( itazuram_rambank_r ) |
| 1097 | 1127 | { |
| 1128 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 1098 | 1129 | if (offset == 0) |
| 1099 | | return reg2; |
| 1130 | return state->m_reg2; |
| 1100 | 1131 | |
| 1101 | | switch ( reg2 ) |
| 1132 | switch ( state->m_reg2 ) |
| 1102 | 1133 | { |
| 1103 | 1134 | case 0x76: |
| 1104 | | return rambank; |
| 1135 | return state->m_rambank; |
| 1105 | 1136 | |
| 1106 | 1137 | default: |
| 1107 | | logerror("%s: unknown reg2 read: %02x\n", space->machine().describe_context(), reg2); |
| 1138 | logerror("%s: unknown reg2 read: %02x\n", space->machine().describe_context(), state->m_reg2); |
| 1108 | 1139 | return 0x00; |
| 1109 | 1140 | } |
| 1110 | 1141 | } |
| 1111 | 1142 | |
| 1112 | 1143 | static WRITE8_HANDLER( itazuram_nvram_palette_w ) |
| 1113 | 1144 | { |
| 1114 | | if (rambank == 0x64) |
| 1145 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 1146 | if (state->m_rambank == 0x64) |
| 1115 | 1147 | { |
| 1116 | 1148 | paletteram_xRRRRRGGGGGBBBBB_be_w(space, offset, data); |
| 1117 | 1149 | // space->machine().generic.paletteram.u8[offset] = data; |
| 1118 | 1150 | } |
| 1119 | | else if (rambank == 0x52) |
| 1151 | else if (state->m_rambank == 0x52) |
| 1120 | 1152 | { |
| 1121 | | nvram[offset] = data; |
| 1153 | state->m_nvram[offset] = data; |
| 1122 | 1154 | } |
| 1123 | 1155 | else |
| 1124 | 1156 | { |
| 1125 | | logerror("%s: itazuram_nvram_palette_w offset = %03x with unknown bank = %02x\n", space->machine().describe_context(), offset, rambank); |
| 1157 | logerror("%s: itazuram_nvram_palette_w offset = %03x with unknown bank = %02x\n", space->machine().describe_context(), offset, state->m_rambank); |
| 1126 | 1158 | } |
| 1127 | 1159 | } |
| 1128 | 1160 | |
| 1129 | 1161 | static WRITE8_HANDLER( itazuram_palette_w ) |
| 1130 | 1162 | { |
| 1131 | | if (rombank == 0x6c) |
| 1163 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 1164 | if (state->m_rombank == 0x6c) |
| 1132 | 1165 | { |
| 1133 | 1166 | if (offset < 0x200) |
| 1134 | 1167 | paletteram_xRRRRRGGGGGBBBBB_be_w(space, offset, data); |
| r11160 | r11161 | |
| 1136 | 1169 | } |
| 1137 | 1170 | else |
| 1138 | 1171 | { |
| 1139 | | logerror("%s: itazuram_palette_w offset = %03x with unknown bank = %02x\n", space->machine().describe_context(), offset, rombank); |
| 1172 | logerror("%s: itazuram_palette_w offset = %03x with unknown bank = %02x\n", space->machine().describe_context(), offset, state->m_rombank); |
| 1140 | 1173 | } |
| 1141 | 1174 | } |
| 1142 | 1175 | static READ8_HANDLER( itazuram_palette_r ) |
| r11160 | r11161 | |
| 1154 | 1187 | |
| 1155 | 1188 | AM_RANGE( 0x6811, 0x6811 ) AM_WRITENOP // IRQ Enable? Screen disable? |
| 1156 | 1189 | AM_RANGE( 0x6813, 0x6813 ) AM_WRITENOP // IRQ Ack? |
| 1157 | | AM_RANGE( 0xdc00, 0xfdff ) AM_READ_BANK( "palbank" ) AM_WRITE( itazuram_nvram_palette_w ) AM_SHARE( "nvram" ) AM_BASE( &nvram ) // nvram | paletteram |
| 1190 | AM_RANGE( 0xdc00, 0xfdff ) AM_READ_BANK( "palbank" ) AM_WRITE( itazuram_nvram_palette_w ) AM_SHARE( "nvram" ) AM_BASE_MEMBER( sigmab98_state, m_nvram ) // nvram | paletteram |
| 1158 | 1191 | |
| 1159 | 1192 | AM_RANGE( 0xfe00, 0xffff ) AM_RAM // High speed internal RAM |
| 1160 | 1193 | ADDRESS_MAP_END |
| r11160 | r11161 | |
| 1192 | 1225 | // rombank |
| 1193 | 1226 | static WRITE8_HANDLER( tdoboon_rombank_w ) |
| 1194 | 1227 | { |
| 1228 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 1195 | 1229 | if (offset == 0) |
| 1196 | 1230 | { |
| 1197 | | reg = data; |
| 1231 | state->m_reg = data; |
| 1198 | 1232 | return; |
| 1199 | 1233 | } |
| 1200 | 1234 | |
| 1201 | | switch ( reg ) |
| 1235 | switch ( state->m_reg ) |
| 1202 | 1236 | { |
| 1203 | 1237 | case 0x2f: |
| 1204 | | rombank = data; |
| 1238 | state->m_rombank = data; |
| 1205 | 1239 | switch (data) |
| 1206 | 1240 | { |
| 1207 | 1241 | case 0x10: // ROM |
| r11160 | r11161 | |
| 1227 | 1261 | break; |
| 1228 | 1262 | |
| 1229 | 1263 | default: |
| 1230 | | logerror("%s: unknown rom bank = %02x, reg = %02x\n", space->machine().describe_context(), data, reg); |
| 1264 | logerror("%s: unknown rom bank = %02x, reg = %02x\n", space->machine().describe_context(), data, state->m_reg); |
| 1231 | 1265 | } |
| 1232 | 1266 | break; |
| 1233 | 1267 | |
| 1234 | 1268 | default: |
| 1235 | | logerror("%s: unknown reg written: %02x = %02x\n", space->machine().describe_context(), reg, data); |
| 1269 | logerror("%s: unknown reg written: %02x = %02x\n", space->machine().describe_context(), state->m_reg, data); |
| 1236 | 1270 | } |
| 1237 | 1271 | } |
| 1238 | 1272 | static READ8_HANDLER( tdoboon_rombank_r ) |
| 1239 | 1273 | { |
| 1274 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 1240 | 1275 | if (offset == 0) |
| 1241 | | return reg; |
| 1276 | return state->m_reg; |
| 1242 | 1277 | |
| 1243 | | switch ( reg ) |
| 1278 | switch ( state->m_reg ) |
| 1244 | 1279 | { |
| 1245 | 1280 | case 0x2f: |
| 1246 | | return rombank; |
| 1281 | return state->m_rombank; |
| 1247 | 1282 | |
| 1248 | 1283 | default: |
| 1249 | | logerror("%s: unknown reg read: %02x\n", space->machine().describe_context(), reg); |
| 1284 | logerror("%s: unknown reg read: %02x\n", space->machine().describe_context(), state->m_reg); |
| 1250 | 1285 | return 0x00; |
| 1251 | 1286 | } |
| 1252 | 1287 | } |
| r11160 | r11161 | |
| 1254 | 1289 | // rambank |
| 1255 | 1290 | static WRITE8_HANDLER( tdoboon_rambank_w ) |
| 1256 | 1291 | { |
| 1292 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 1257 | 1293 | if (offset == 0) |
| 1258 | 1294 | { |
| 1259 | | reg2 = data; |
| 1295 | state->m_reg2 = data; |
| 1260 | 1296 | return; |
| 1261 | 1297 | } |
| 1262 | 1298 | |
| 1263 | | switch ( reg2 ) |
| 1299 | switch ( state->m_reg2 ) |
| 1264 | 1300 | { |
| 1265 | 1301 | case 0x33: |
| 1266 | | rambank = data; |
| 1302 | state->m_rambank = data; |
| 1267 | 1303 | switch (data) |
| 1268 | 1304 | { |
| 1269 | 1305 | case 0x53: |
| 1270 | 1306 | break; |
| 1271 | 1307 | |
| 1272 | 1308 | default: |
| 1273 | | logerror("%s: unknown ram bank = %02x, reg2 = %02x\n", space->machine().describe_context(), data, reg2); |
| 1309 | logerror("%s: unknown ram bank = %02x, reg2 = %02x\n", space->machine().describe_context(), data, state->m_reg2); |
| 1274 | 1310 | } |
| 1275 | 1311 | break; |
| 1276 | 1312 | |
| 1277 | 1313 | default: |
| 1278 | | logerror("%s: unknown reg2 written: %02x = %02x\n", space->machine().describe_context(), reg2, data); |
| 1314 | logerror("%s: unknown reg2 written: %02x = %02x\n", space->machine().describe_context(), state->m_reg2, data); |
| 1279 | 1315 | } |
| 1280 | 1316 | } |
| 1281 | 1317 | static READ8_HANDLER( tdoboon_rambank_r ) |
| 1282 | 1318 | { |
| 1319 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 1283 | 1320 | if (offset == 0) |
| 1284 | | return reg2; |
| 1321 | return state->m_reg2; |
| 1285 | 1322 | |
| 1286 | | switch ( reg2 ) |
| 1323 | switch ( state->m_reg2 ) |
| 1287 | 1324 | { |
| 1288 | 1325 | case 0x33: |
| 1289 | | return rambank; |
| 1326 | return state->m_rambank; |
| 1290 | 1327 | |
| 1291 | 1328 | default: |
| 1292 | | logerror("%s: unknown reg2 read: %02x\n", space->machine().describe_context(), reg2); |
| 1329 | logerror("%s: unknown reg2 read: %02x\n", space->machine().describe_context(), state->m_reg2); |
| 1293 | 1330 | return 0x00; |
| 1294 | 1331 | } |
| 1295 | 1332 | } |
| r11160 | r11161 | |
| 1297 | 1334 | static READ8_HANDLER( tdoboon_c000_r ) |
| 1298 | 1335 | { |
| 1299 | 1336 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 1300 | | switch (rombank) |
| 1337 | switch (state->m_rombank) |
| 1301 | 1338 | { |
| 1302 | 1339 | case 0x10: // ROM |
| 1303 | 1340 | case 0x11: |
| r11160 | r11161 | |
| 1315 | 1352 | case 0x1d: |
| 1316 | 1353 | case 0x1e: |
| 1317 | 1354 | case 0x1f: |
| 1318 | | return space->machine().region("maincpu")->base()[offset + 0xc400 + 0x1000 * (rombank-0x10)]; |
| 1355 | return space->machine().region("maincpu")->base()[offset + 0xc400 + 0x1000 * (state->m_rombank-0x10)]; |
| 1319 | 1356 | |
| 1320 | 1357 | case 0x64: // SPRITERAM |
| 1321 | 1358 | if (offset < 0x1000) |
| r11160 | r11161 | |
| 1333 | 1370 | break; |
| 1334 | 1371 | } |
| 1335 | 1372 | |
| 1336 | | logerror("%s: unknown read from %02x with rombank = %02x\n", space->machine().describe_context(), offset+0xc000, rombank); |
| 1373 | logerror("%s: unknown read from %02x with rombank = %02x\n", space->machine().describe_context(), offset+0xc000, state->m_rombank); |
| 1337 | 1374 | return 0x00; |
| 1338 | 1375 | } |
| 1339 | 1376 | |
| 1340 | 1377 | static WRITE8_HANDLER( tdoboon_c000_w ) |
| 1341 | 1378 | { |
| 1342 | 1379 | sigmab98_state *state = space->machine().driver_data<sigmab98_state>(); |
| 1343 | | switch (rombank) |
| 1380 | switch (state->m_rombank) |
| 1344 | 1381 | { |
| 1345 | 1382 | case 0x64: // SPRITERAM |
| 1346 | 1383 | if (offset < 0x1000) |
| r11160 | r11161 | |
| 1365 | 1402 | break; |
| 1366 | 1403 | } |
| 1367 | 1404 | |
| 1368 | | logerror("%s: unknown write to %02x = %02x with rombank = %02x\n", space->machine().describe_context(), offset+0xc000, data, rombank); |
| 1405 | logerror("%s: unknown write to %02x = %02x with rombank = %02x\n", space->machine().describe_context(), offset+0xc000, data, state->m_rombank); |
| 1369 | 1406 | } |
| 1370 | 1407 | |
| 1371 | 1408 | static ADDRESS_MAP_START( tdoboon_map, AS_PROGRAM, 8 ) |
| 1372 | 1409 | AM_RANGE( 0x0000, 0xbfff ) AM_ROM |
| 1373 | 1410 | AM_RANGE( 0xc000, 0xcfff ) AM_READWRITE( tdoboon_c000_r, tdoboon_c000_w ) |
| 1374 | | AM_RANGE( 0xd000, 0xefff ) AM_RAM AM_SHARE( "nvram" ) AM_BASE( &nvram ) |
| 1411 | AM_RANGE( 0xd000, 0xefff ) AM_RAM AM_SHARE( "nvram" ) AM_BASE_MEMBER( sigmab98_state, m_nvram ) |
| 1375 | 1412 | AM_RANGE( 0xfe00, 0xffff ) AM_RAM // High speed internal RAM |
| 1376 | 1413 | ADDRESS_MAP_END |
| 1377 | 1414 | |
| r11160 | r11161 | |
| 1919 | 1956 | sigmab98_state *state = machine.driver_data<sigmab98_state>(); |
| 1920 | 1957 | // RAM banks |
| 1921 | 1958 | UINT8 *bankedram = auto_alloc_array(machine, UINT8, 0x1000 * 5); |
| 1922 | | memory_configure_bank(machine, "rambank", 0, 1, nvram, 0x1000); |
| 1959 | memory_configure_bank(machine, "rambank", 0, 1, state->m_nvram, 0x1000); |
| 1923 | 1960 | memory_configure_bank(machine, "rambank", 1, 4, bankedram, 0x1000); |
| 1924 | 1961 | memory_set_bank(machine, "rambank", 0); |
| 1925 | 1962 | |
| r11160 | r11161 | |
| 1959 | 1996 | UINT8 *rom = machine.region("maincpu")->base(); |
| 1960 | 1997 | memory_set_bankptr(machine, "rombank0", rom + 0x3400); |
| 1961 | 1998 | memory_set_bankptr(machine, "rombank1", rom + 0x4400); |
| 1962 | | rombank = 0x0f; |
| 1999 | state->m_rombank = 0x0f; |
| 1963 | 2000 | |
| 1964 | 2001 | // RAM banks |
| 1965 | 2002 | machine.generic.paletteram.u8 = auto_alloc_array(machine, UINT8, 0x3000); |
| 1966 | 2003 | memset(machine.generic.paletteram.u8, 0, 0x3000); |
| 1967 | 2004 | memory_set_bankptr(machine, "palbank", machine.generic.paletteram.u8); |
| 1968 | | rambank = 0x64; |
| 2005 | state->m_rambank = 0x64; |
| 1969 | 2006 | |
| 1970 | 2007 | state->m_spriteram = auto_alloc_array(machine, UINT8, 0x1000 * 5); |
| 1971 | 2008 | memset(state->m_spriteram, 0, 0x1000 * 5); |
| r11160 | r11161 | |
| 2079 | 2116 | memset(state->m_spriteram, 0, 0x1000); |
| 2080 | 2117 | state->m_spriteram_size = 0x1000; |
| 2081 | 2118 | |
| 2082 | | rombank = 0x65; |
| 2083 | | rambank = 0x53; |
| 2119 | state->m_rombank = 0x65; |
| 2120 | state->m_rambank = 0x53; |
| 2084 | 2121 | } |
| 2085 | 2122 | |
| 2086 | 2123 | |
src/mame/drivers/namcos22.c
| r11160 | r11161 | |
| 1147 | 1147 | |
| 1148 | 1148 | #define SS22_MASTER_CLOCK (49152000) /* info from Guru */ |
| 1149 | 1149 | |
| 1150 | | enum namcos22_gametype namcos22_gametype; /* TBR: used for game-specific hacks */ |
| 1151 | | |
| 1152 | | static int mbSuperSystem22; /* used to dispatch Sys22/SuperSys22 differences */ |
| 1153 | | static int mbEnableDspIrqs; |
| 1154 | | static UINT32 *namcos22_shareram; |
| 1155 | | static UINT32 *namcos22_system_controller; |
| 1156 | | static UINT32 *namcos22_nvmem; |
| 1157 | | static size_t namcos22_nvmem_size; |
| 1158 | | static UINT16 mMasterBIOZ; |
| 1159 | | static UINT32 *mpPointRAM; |
| 1160 | | static UINT32 old_coin_state, credits1, credits2; |
| 1161 | | static UINT16 *mpSlaveExternalRAM; |
| 1162 | | |
| 1163 | | static UINT32 mPointAddr; |
| 1164 | | static UINT32 mPointData; |
| 1165 | | static UINT16 *mpMasterExternalRAM; |
| 1166 | | |
| 1167 | | static UINT16 mSerialDataSlaveToMasterNext; |
| 1168 | | static UINT16 mSerialDataSlaveToMasterCurrent; |
| 1169 | | |
| 1170 | | #define MAX_RENDER_CMD_SEQ 0x1c |
| 1171 | | static int mRenderBufSize; |
| 1172 | | static UINT16 mRenderBufData[MAX_RENDER_CMD_SEQ]; |
| 1173 | | |
| 1174 | | static UINT32 mSys22PortBits; |
| 1175 | | |
| 1176 | | static int mFrameCount; |
| 1177 | | |
| 1178 | | static UINT8 stick_input, prev_stick_state; |
| 1179 | | |
| 1180 | 1150 | /** |
| 1181 | 1151 | * helper function used to read a byte from a chunk of 32 bit memory |
| 1182 | 1152 | */ |
| r11160 | r11161 | |
| 1211 | 1181 | static UINT16 |
| 1212 | 1182 | AnalogAsDigital( running_machine &machine ) |
| 1213 | 1183 | { |
| 1184 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 1214 | 1185 | UINT16 stick = input_port_read_safe(machine, "INPUTS", 0); |
| 1215 | 1186 | UINT16 gas = input_port_read_safe(machine, "GAS", 0); |
| 1216 | 1187 | UINT16 steer = input_port_read_safe(machine, "STEER", 0); |
| 1217 | 1188 | UINT16 result = 0xffff; |
| 1218 | 1189 | |
| 1219 | | switch( namcos22_gametype ) |
| 1190 | switch( state->m_gametype ) |
| 1220 | 1191 | { |
| 1221 | 1192 | case NAMCOS22_RAVE_RACER: |
| 1222 | 1193 | case NAMCOS22_RIDGE_RACER: |
| r11160 | r11161 | |
| 1262 | 1233 | static void |
| 1263 | 1234 | HandleCoinage(running_machine &machine, int slots) |
| 1264 | 1235 | { |
| 1265 | | UINT16 *share16 = (UINT16 *)namcos22_shareram; |
| 1236 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 1237 | UINT16 *share16 = (UINT16 *)state->m_shareram; |
| 1266 | 1238 | UINT32 coin_state; |
| 1267 | 1239 | |
| 1268 | 1240 | coin_state = input_port_read(machine, "INPUTS") & 0x1200; |
| 1269 | 1241 | |
| 1270 | | if (!(coin_state & 0x1000) && (old_coin_state & 0x1000)) |
| 1242 | if (!(coin_state & 0x1000) && (state->m_old_coin_state & 0x1000)) |
| 1271 | 1243 | { |
| 1272 | | credits1++; |
| 1244 | state->m_credits1++; |
| 1273 | 1245 | } |
| 1274 | 1246 | |
| 1275 | | if (!(coin_state & 0x0200) && (old_coin_state & 0x0200)) |
| 1247 | if (!(coin_state & 0x0200) && (state->m_old_coin_state & 0x0200)) |
| 1276 | 1248 | { |
| 1277 | | credits2++; |
| 1249 | state->m_credits2++; |
| 1278 | 1250 | } |
| 1279 | 1251 | |
| 1280 | | old_coin_state = coin_state; |
| 1252 | state->m_old_coin_state = coin_state; |
| 1281 | 1253 | |
| 1282 | | share16[BYTE_XOR_LE(0x38/2)] = credits1; |
| 1254 | share16[BYTE_XOR_LE(0x38/2)] = state->m_credits1; |
| 1283 | 1255 | |
| 1284 | 1256 | if (slots == 2) |
| 1285 | 1257 | { |
| 1286 | | share16[BYTE_XOR_LE(0x3e/2)] = credits2; |
| 1258 | share16[BYTE_XOR_LE(0x3e/2)] = state->m_credits2; |
| 1287 | 1259 | } |
| 1288 | 1260 | } /* HandleCoinage */ |
| 1289 | 1261 | |
| r11160 | r11161 | |
| 1291 | 1263 | static void |
| 1292 | 1264 | HandleDrivingIO( running_machine &machine ) |
| 1293 | 1265 | { |
| 1294 | | if( nthbyte(namcos22_system_controller, 0x18) != 0 ) |
| 1266 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 1267 | if( nthbyte(state->m_system_controller, 0x18) != 0 ) |
| 1295 | 1268 | { |
| 1296 | 1269 | UINT16 flags = input_port_read(machine, "INPUTS"); |
| 1297 | 1270 | UINT16 gas, brake, steer; |
| r11160 | r11161 | |
| 1299 | 1272 | |
| 1300 | 1273 | HandleCoinage(machine, 2); |
| 1301 | 1274 | |
| 1302 | | switch (namcos22_gametype) |
| 1275 | switch (state->m_gametype) |
| 1303 | 1276 | { |
| 1304 | 1277 | case NAMCOS22_RIDGE_RACER: |
| 1305 | 1278 | case NAMCOS22_RIDGE_RACER2: |
| r11160 | r11161 | |
| 1337 | 1310 | break; |
| 1338 | 1311 | } |
| 1339 | 1312 | |
| 1340 | | namcos22_shareram[0x000/4] = 0x10<<16; /* SUB CPU ready */ |
| 1341 | | namcos22_shareram[0x030/4] = (flags<<16)|steer; |
| 1342 | | namcos22_shareram[0x034/4] = (gas<<16)|brake; |
| 1313 | state->m_shareram[0x000/4] = 0x10<<16; /* SUB CPU ready */ |
| 1314 | state->m_shareram[0x030/4] = (flags<<16)|steer; |
| 1315 | state->m_shareram[0x034/4] = (gas<<16)|brake; |
| 1343 | 1316 | } |
| 1344 | 1317 | } /* HandleDrivingIO */ |
| 1345 | 1318 | |
| r11160 | r11161 | |
| 1347 | 1320 | static void |
| 1348 | 1321 | HandleCyberCommandoIO( running_machine &machine ) |
| 1349 | 1322 | { |
| 1350 | | if( nthbyte(namcos22_system_controller, 0x18) != 0 ) |
| 1323 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 1324 | if( nthbyte(state->m_system_controller, 0x18) != 0 ) |
| 1351 | 1325 | { |
| 1352 | 1326 | UINT16 flags = input_port_read(machine, "INPUTS"); |
| 1353 | 1327 | |
| r11160 | r11161 | |
| 1356 | 1330 | UINT16 volume2 = input_port_read(machine, "STICKX1") * 0x10; |
| 1357 | 1331 | UINT16 volume3 = input_port_read(machine, "STICKX2") * 0x10; |
| 1358 | 1332 | |
| 1359 | | namcos22_shareram[0x030/4] = (flags<<16) | volume0; |
| 1360 | | namcos22_shareram[0x034/4] = (volume1<<16) | volume2; |
| 1361 | | namcos22_shareram[0x038/4] = volume3<<16; |
| 1333 | state->m_shareram[0x030/4] = (flags<<16) | volume0; |
| 1334 | state->m_shareram[0x034/4] = (volume1<<16) | volume2; |
| 1335 | state->m_shareram[0x038/4] = volume3<<16; |
| 1362 | 1336 | |
| 1363 | 1337 | HandleCoinage(machine, 1); |
| 1364 | 1338 | } |
| r11160 | r11161 | |
| 1367 | 1341 | /*********************************************************************************************/ |
| 1368 | 1342 | |
| 1369 | 1343 | static void |
| 1370 | | InitDSP( running_machine &machine, int bSuperSystem22 ) |
| 1344 | InitDSP( running_machine &machine ) |
| 1371 | 1345 | { |
| 1372 | | mbSuperSystem22 = bSuperSystem22; |
| 1373 | 1346 | cputag_set_input_line(machine, "master",INPUT_LINE_RESET,ASSERT_LINE); /* master DSP */ |
| 1374 | 1347 | cputag_set_input_line(machine, "slave",INPUT_LINE_RESET,ASSERT_LINE); /* slave DSP */ |
| 1375 | 1348 | cputag_set_input_line(machine, "mcu",INPUT_LINE_RESET,ASSERT_LINE); /* MCU */ |
| r11160 | r11161 | |
| 1377 | 1350 | |
| 1378 | 1351 | static READ16_HANDLER( pdp_status_r ) |
| 1379 | 1352 | { |
| 1380 | | return mMasterBIOZ; |
| 1353 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1354 | return state->m_mMasterBIOZ; |
| 1381 | 1355 | } /* pdp_status_r */ |
| 1382 | 1356 | |
| 1383 | 1357 | static void |
| 1384 | | WriteToPointRAM( offs_t offs, UINT32 data ) |
| 1358 | WriteToPointRAM( namcos22_state *state, offs_t offs, UINT32 data ) |
| 1385 | 1359 | { |
| 1386 | 1360 | offs &= 0xffffff; /* 24 bit addressing */ |
| 1387 | | if( mbSuperSystem22 ) |
| 1361 | if( state->m_mbSuperSystem22 ) |
| 1388 | 1362 | { |
| 1389 | 1363 | if( offs>=0xf80000 && offs<=0xf9ffff ) |
| 1390 | 1364 | { |
| 1391 | | mpPointRAM[offs-0xf80000] = data; |
| 1365 | state->m_mpPointRAM[offs-0xf80000] = data; |
| 1392 | 1366 | } |
| 1393 | 1367 | } |
| 1394 | 1368 | else |
| 1395 | 1369 | { |
| 1396 | 1370 | if( offs>=0xf00000 && offs<=0xf1ffff ) |
| 1397 | 1371 | { |
| 1398 | | mpPointRAM[offs-0xf00000] = data; |
| 1372 | state->m_mpPointRAM[offs-0xf00000] = data; |
| 1399 | 1373 | } |
| 1400 | 1374 | } |
| 1401 | 1375 | } /* WriteToPointRAM */ |
| 1402 | 1376 | |
| 1403 | 1377 | static UINT32 |
| 1404 | | ReadFromPointRAM( offs_t offs ) |
| 1378 | ReadFromPointRAM( running_machine &machine, offs_t offs ) |
| 1405 | 1379 | { |
| 1380 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 1406 | 1381 | offs &= 0xffffff; /* 24 bit addressing */ |
| 1407 | | if( mbSuperSystem22 ) |
| 1382 | if( state->m_mbSuperSystem22 ) |
| 1408 | 1383 | { |
| 1409 | 1384 | if( offs>=0xf80000 && offs<=0xf9ffff ) |
| 1410 | 1385 | { |
| 1411 | | return mpPointRAM[offs-0xf80000]; |
| 1386 | return state->m_mpPointRAM[offs-0xf80000]; |
| 1412 | 1387 | } |
| 1413 | 1388 | } |
| 1414 | 1389 | else |
| 1415 | 1390 | { |
| 1416 | 1391 | if( offs>=0xf00000 && offs<=0xf1ffff ) |
| 1417 | 1392 | { |
| 1418 | | return mpPointRAM[offs-0xf00000]; |
| 1393 | return state->m_mpPointRAM[offs-0xf00000]; |
| 1419 | 1394 | } |
| 1420 | 1395 | } |
| 1421 | | return namcos22_point_rom_r(offs); |
| 1396 | return namcos22_point_rom_r(machine, offs); |
| 1422 | 1397 | } /* ReadFromPointRAM */ |
| 1423 | 1398 | |
| 1424 | 1399 | static UINT32 |
| 1425 | | ReadFromCommRAM( offs_t offs ) |
| 1400 | ReadFromCommRAM( namcos22_state *state, offs_t offs ) |
| 1426 | 1401 | { |
| 1427 | | return namcos22_polygonram[offs&0x7fff]; |
| 1402 | return state->m_polygonram[offs&0x7fff]; |
| 1428 | 1403 | } /* ReadFromCommRAM */ |
| 1429 | 1404 | |
| 1430 | 1405 | static void |
| 1431 | | WriteToCommRAM( offs_t offs, UINT32 data ) |
| 1406 | WriteToCommRAM( namcos22_state *state, offs_t offs, UINT32 data ) |
| 1432 | 1407 | { |
| 1433 | | namcos22_polygonram[offs&0x7fff] = data; |
| 1408 | state->m_polygonram[offs&0x7fff] = data; |
| 1434 | 1409 | } /* WriteToCommRAM */ |
| 1435 | 1410 | |
| 1436 | 1411 | static READ16_HANDLER( pdp_begin_r ) |
| 1437 | 1412 | { |
| 1413 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1438 | 1414 | /* this feature appears to be only used on Super System22 hardware */ |
| 1439 | | if( mbSuperSystem22 ) |
| 1415 | if( state->m_mbSuperSystem22 ) |
| 1440 | 1416 | { |
| 1441 | | UINT16 offs = namcos22_polygonram[0x20000/4-1]; |
| 1442 | | mMasterBIOZ = 1; |
| 1417 | UINT16 offs = state->m_polygonram[0x20000/4-1]; |
| 1418 | state->m_mMasterBIOZ = 1; |
| 1443 | 1419 | for(;;) |
| 1444 | 1420 | { |
| 1445 | 1421 | UINT16 start = offs; |
| 1446 | | UINT16 cmd = ReadFromCommRAM(offs++); |
| 1422 | UINT16 cmd = ReadFromCommRAM(state, offs++); |
| 1447 | 1423 | UINT32 srcAddr; |
| 1448 | 1424 | UINT32 dstAddr; |
| 1449 | 1425 | UINT32 numWords; |
| r11160 | r11161 | |
| 1455 | 1431 | break; |
| 1456 | 1432 | |
| 1457 | 1433 | case 0xfff5: /* write to point ram */ |
| 1458 | | dstAddr = ReadFromCommRAM(offs++); /* 32 bit PointRAM address */ |
| 1459 | | data = ReadFromCommRAM(offs++); /* 24 bit data */ |
| 1460 | | WriteToPointRAM( dstAddr, data ); |
| 1434 | dstAddr = ReadFromCommRAM(state, offs++); /* 32 bit PointRAM address */ |
| 1435 | data = ReadFromCommRAM(state, offs++); /* 24 bit data */ |
| 1436 | WriteToPointRAM( state, dstAddr, data ); |
| 1461 | 1437 | break; |
| 1462 | 1438 | |
| 1463 | 1439 | case 0xfff6: /* read word from point ram */ |
| 1464 | | srcAddr = ReadFromCommRAM(offs++); /* 32 bit PointRAM address */ |
| 1465 | | dstAddr = ReadFromCommRAM(offs++); /* CommRAM address; receives 24 bit PointRAM data */ |
| 1466 | | data = ReadFromPointRAM( srcAddr ); |
| 1467 | | WriteToCommRAM( dstAddr, data ); |
| 1440 | srcAddr = ReadFromCommRAM(state, offs++); /* 32 bit PointRAM address */ |
| 1441 | dstAddr = ReadFromCommRAM(state, offs++); /* CommRAM address; receives 24 bit PointRAM data */ |
| 1442 | data = ReadFromPointRAM( space->machine(), srcAddr ); |
| 1443 | WriteToCommRAM( state, dstAddr, data ); |
| 1468 | 1444 | break; |
| 1469 | 1445 | |
| 1470 | 1446 | case 0xfff7: /* block move (CommRAM to CommRAM) */ |
| 1471 | | srcAddr = ReadFromCommRAM(offs++); |
| 1472 | | dstAddr = ReadFromCommRAM(offs++); |
| 1473 | | numWords = ReadFromCommRAM(offs++); |
| 1447 | srcAddr = ReadFromCommRAM(state, offs++); |
| 1448 | dstAddr = ReadFromCommRAM(state, offs++); |
| 1449 | numWords = ReadFromCommRAM(state, offs++); |
| 1474 | 1450 | while( numWords-- ) |
| 1475 | 1451 | { |
| 1476 | | data = ReadFromCommRAM(srcAddr++); |
| 1477 | | WriteToCommRAM( dstAddr++, data ); |
| 1452 | data = ReadFromCommRAM(state, srcAddr++); |
| 1453 | WriteToCommRAM( state, dstAddr++, data ); |
| 1478 | 1454 | } |
| 1479 | 1455 | break; |
| 1480 | 1456 | |
| 1481 | 1457 | case 0xfffa: /* read block from point ram */ |
| 1482 | | srcAddr = ReadFromCommRAM(offs++); /* 32 bit PointRAM address */ |
| 1483 | | dstAddr = ReadFromCommRAM(offs++); /* CommRAM address; receives data */ |
| 1484 | | numWords = ReadFromCommRAM(offs++); /* block size */ |
| 1458 | srcAddr = ReadFromCommRAM(state, offs++); /* 32 bit PointRAM address */ |
| 1459 | dstAddr = ReadFromCommRAM(state, offs++); /* CommRAM address; receives data */ |
| 1460 | numWords = ReadFromCommRAM(state, offs++); /* block size */ |
| 1485 | 1461 | while( numWords-- ) |
| 1486 | 1462 | { |
| 1487 | | data = ReadFromPointRAM( srcAddr++ ); |
| 1488 | | WriteToCommRAM( dstAddr++, data ); |
| 1463 | data = ReadFromPointRAM( space->machine(), srcAddr++ ); |
| 1464 | WriteToCommRAM( state, dstAddr++, data ); |
| 1489 | 1465 | } |
| 1490 | 1466 | break; |
| 1491 | 1467 | |
| 1492 | 1468 | case 0xfffb: /* write block to point ram */ |
| 1493 | | dstAddr = ReadFromCommRAM(offs++); /* 32 bit PointRAM address */ |
| 1494 | | numWords = ReadFromCommRAM(offs++); /* block size */ |
| 1469 | dstAddr = ReadFromCommRAM(state, offs++); /* 32 bit PointRAM address */ |
| 1470 | numWords = ReadFromCommRAM(state, offs++); /* block size */ |
| 1495 | 1471 | while( numWords-- ) |
| 1496 | 1472 | { |
| 1497 | | data = ReadFromCommRAM( offs++ ); /* 24 bit source data */ |
| 1498 | | WriteToPointRAM( dstAddr++, data ); |
| 1473 | data = ReadFromCommRAM( state, offs++ ); /* 24 bit source data */ |
| 1474 | WriteToPointRAM( state, dstAddr++, data ); |
| 1499 | 1475 | } |
| 1500 | 1476 | break; |
| 1501 | 1477 | |
| 1502 | 1478 | case 0xfffc: /* point ram to point ram */ |
| 1503 | | srcAddr = ReadFromCommRAM(offs++); |
| 1504 | | dstAddr = ReadFromCommRAM(offs++); |
| 1505 | | numWords = ReadFromCommRAM(offs++); |
| 1479 | srcAddr = ReadFromCommRAM(state, offs++); |
| 1480 | dstAddr = ReadFromCommRAM(state, offs++); |
| 1481 | numWords = ReadFromCommRAM(state, offs++); |
| 1506 | 1482 | while( numWords-- ) |
| 1507 | 1483 | { |
| 1508 | | data = ReadFromPointRAM( srcAddr++ ); |
| 1509 | | WriteToPointRAM( dstAddr++, data ); |
| 1484 | data = ReadFromPointRAM( space->machine(), srcAddr++ ); |
| 1485 | WriteToPointRAM( state, dstAddr++, data ); |
| 1510 | 1486 | } |
| 1511 | 1487 | break; |
| 1512 | 1488 | |
| 1513 | 1489 | case 0xfffd: /* unknown */ |
| 1514 | | numWords = ReadFromCommRAM(offs++); |
| 1490 | numWords = ReadFromCommRAM(state, offs++); |
| 1515 | 1491 | while( numWords-- ) |
| 1516 | 1492 | { |
| 1517 | | data = ReadFromCommRAM(offs++); |
| 1493 | data = ReadFromCommRAM(state, offs++); |
| 1518 | 1494 | //namcos22_WriteDataToRenderDevice( data ); |
| 1519 | 1495 | } |
| 1520 | 1496 | break; |
| 1521 | 1497 | |
| 1522 | 1498 | case 0xfffe: /* unknown */ |
| 1523 | | data = ReadFromCommRAM(offs++); /* ??? */ |
| 1499 | data = ReadFromCommRAM(state, offs++); /* ??? */ |
| 1524 | 1500 | break; |
| 1525 | 1501 | |
| 1526 | 1502 | case 0xffff: /* "goto" command */ |
| 1527 | | offs = ReadFromCommRAM(offs); |
| 1503 | offs = ReadFromCommRAM(state, offs); |
| 1528 | 1504 | if( offs == start ) |
| 1529 | 1505 | { /* most commands end with a "goto self" */ |
| 1530 | 1506 | return 0; |
| r11160 | r11161 | |
| 1536 | 1512 | return 0; |
| 1537 | 1513 | } |
| 1538 | 1514 | } /* for(;;) */ |
| 1539 | | } /* mbSuperSystem22 */ |
| 1515 | } /* state->m_mbSuperSystem22 */ |
| 1540 | 1516 | return 0; |
| 1541 | 1517 | } /* pdp_begin_r */ |
| 1542 | 1518 | |
| 1543 | 1519 | static READ16_HANDLER( slave_external_ram_r ) |
| 1544 | 1520 | { |
| 1545 | | return mpSlaveExternalRAM[offset]; |
| 1521 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1522 | return state->m_mpSlaveExternalRAM[offset]; |
| 1546 | 1523 | } |
| 1547 | 1524 | |
| 1548 | 1525 | static WRITE16_HANDLER( slave_external_ram_w ) |
| 1549 | 1526 | { |
| 1550 | | COMBINE_DATA( &mpSlaveExternalRAM[offset] ); |
| 1527 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1528 | COMBINE_DATA( &state->m_mpSlaveExternalRAM[offset] ); |
| 1551 | 1529 | } |
| 1552 | 1530 | |
| 1553 | 1531 | static void HaltSlaveDSP( running_machine &machine ) |
| r11160 | r11161 | |
| 1577 | 1555 | |
| 1578 | 1556 | static WRITE16_HANDLER( point_ram_idx_w ) |
| 1579 | 1557 | { |
| 1580 | | mPointAddr<<=16; |
| 1581 | | mPointAddr |= data; |
| 1558 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1559 | state->m_mPointAddr<<=16; |
| 1560 | state->m_mPointAddr |= data; |
| 1582 | 1561 | } |
| 1583 | 1562 | |
| 1584 | 1563 | static WRITE16_HANDLER( point_ram_loword_iw ) |
| 1585 | 1564 | { |
| 1586 | | mPointData |= data; |
| 1587 | | WriteToPointRAM( mPointAddr++, mPointData ); |
| 1565 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1566 | state->m_mPointData |= data; |
| 1567 | WriteToPointRAM( state, state->m_mPointAddr++, state->m_mPointData ); |
| 1588 | 1568 | } |
| 1589 | 1569 | |
| 1590 | 1570 | static WRITE16_HANDLER( point_ram_hiword_w ) |
| 1591 | 1571 | { |
| 1592 | | mPointData = (data<<16); |
| 1572 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1573 | state->m_mPointData = (data<<16); |
| 1593 | 1574 | } |
| 1594 | 1575 | |
| 1595 | 1576 | static READ16_HANDLER( point_ram_loword_r ) |
| 1596 | 1577 | { |
| 1597 | | return ReadFromPointRAM(mPointAddr)&0xffff; |
| 1578 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1579 | return ReadFromPointRAM(space->machine(), state->m_mPointAddr)&0xffff; |
| 1598 | 1580 | } |
| 1599 | 1581 | |
| 1600 | 1582 | static READ16_HANDLER( point_ram_hiword_ir ) |
| 1601 | 1583 | { |
| 1602 | | return ReadFromPointRAM(mPointAddr++)>>16; |
| 1584 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1585 | return ReadFromPointRAM(space->machine(), state->m_mPointAddr++)>>16; |
| 1603 | 1586 | } |
| 1604 | 1587 | |
| 1605 | 1588 | static WRITE16_HANDLER( dsp_unk2_w ) |
| r11160 | r11161 | |
| 1613 | 1596 | */ |
| 1614 | 1597 | } |
| 1615 | 1598 | |
| 1616 | | static enum |
| 1599 | enum |
| 1617 | 1600 | { |
| 1618 | 1601 | eDSP_UPLOAD_READY, |
| 1619 | 1602 | eDSP_UPLOAD_DEST, |
| 1620 | 1603 | eDSP_UPLOAD_DATA |
| 1621 | | } mDspUploadState; |
| 1604 | }; |
| 1622 | 1605 | |
| 1623 | 1606 | static READ16_HANDLER( dsp_unk_port3_r ) |
| 1624 | 1607 | { |
| 1625 | | mMasterBIOZ = 0; |
| 1626 | | mDspUploadState = eDSP_UPLOAD_READY; |
| 1608 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1609 | state->m_mMasterBIOZ = 0; |
| 1610 | state->m_mDspUploadState = eDSP_UPLOAD_READY; |
| 1627 | 1611 | return 0; |
| 1628 | 1612 | } |
| 1629 | 1613 | |
| 1630 | 1614 | static WRITE16_HANDLER( upload_code_to_slave_dsp_w ) |
| 1631 | 1615 | { |
| 1632 | | static int mUploadDestIdx; |
| 1616 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1633 | 1617 | |
| 1634 | | switch( mDspUploadState ) |
| 1618 | switch( state->m_mDspUploadState ) |
| 1635 | 1619 | { |
| 1636 | 1620 | case eDSP_UPLOAD_READY: |
| 1637 | 1621 | logerror( "UPLOAD_READY; cmd = 0x%x\n", data ); |
| r11160 | r11161 | |
| 1641 | 1625 | } |
| 1642 | 1626 | else if( data==1 ) |
| 1643 | 1627 | { |
| 1644 | | mDspUploadState = eDSP_UPLOAD_DEST; |
| 1628 | state->m_mDspUploadState = eDSP_UPLOAD_DEST; |
| 1645 | 1629 | } |
| 1646 | 1630 | else if( data==2 ) |
| 1647 | 1631 | { |
| r11160 | r11161 | |
| 1666 | 1650 | break; |
| 1667 | 1651 | |
| 1668 | 1652 | case eDSP_UPLOAD_DEST: |
| 1669 | | mUploadDestIdx = data-0x8000; |
| 1670 | | mDspUploadState = eDSP_UPLOAD_DATA; |
| 1653 | state->m_mUploadDestIdx = data-0x8000; |
| 1654 | state->m_mDspUploadState = eDSP_UPLOAD_DATA; |
| 1671 | 1655 | break; |
| 1672 | 1656 | |
| 1673 | 1657 | case eDSP_UPLOAD_DATA: |
| 1674 | | mpSlaveExternalRAM[mUploadDestIdx++] = data; |
| 1658 | state->m_mpSlaveExternalRAM[state->m_mUploadDestIdx++] = data; |
| 1675 | 1659 | break; |
| 1676 | 1660 | |
| 1677 | 1661 | default: |
| r11160 | r11161 | |
| 1702 | 1686 | |
| 1703 | 1687 | static READ16_HANDLER( master_external_ram_r ) |
| 1704 | 1688 | { |
| 1705 | | return mpMasterExternalRAM[offset]; |
| 1689 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1690 | return state->m_mpMasterExternalRAM[offset]; |
| 1706 | 1691 | } |
| 1707 | 1692 | |
| 1708 | 1693 | static WRITE16_HANDLER( master_external_ram_w ) |
| 1709 | 1694 | { |
| 1710 | | COMBINE_DATA( &mpMasterExternalRAM[offset] ); |
| 1695 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1696 | COMBINE_DATA( &state->m_mpMasterExternalRAM[offset] ); |
| 1711 | 1697 | } |
| 1712 | 1698 | |
| 1713 | 1699 | #ifdef USE_NAMCOS22_SPEED_HACK |
| r11160 | r11161 | |
| 1718 | 1704 | |
| 1719 | 1705 | static WRITE16_HANDLER( slave_serial_io_w ) |
| 1720 | 1706 | { |
| 1721 | | mSerialDataSlaveToMasterNext = data; |
| 1707 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1708 | state->m_mSerialDataSlaveToMasterNext = data; |
| 1722 | 1709 | logerror( "slave_serial_io_w(%04x)\n", data ); |
| 1723 | 1710 | } |
| 1724 | 1711 | |
| 1725 | 1712 | static READ16_HANDLER( master_serial_io_r ) |
| 1726 | 1713 | { |
| 1714 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1727 | 1715 | logerror( "master_serial_io_r() == %04x\n", |
| 1728 | | mSerialDataSlaveToMasterCurrent ); |
| 1729 | | return mSerialDataSlaveToMasterCurrent; |
| 1716 | state->m_mSerialDataSlaveToMasterCurrent ); |
| 1717 | return state->m_mSerialDataSlaveToMasterCurrent; |
| 1730 | 1718 | } |
| 1731 | 1719 | |
| 1732 | 1720 | static INTERRUPT_GEN( dsp_serial_pulse1 ) |
| 1733 | 1721 | { |
| 1734 | | if( mbEnableDspIrqs ) |
| 1722 | namcos22_state *state = device->machine().driver_data<namcos22_state>(); |
| 1723 | if( state->m_mbEnableDspIrqs ) |
| 1735 | 1724 | { |
| 1736 | | mSerialDataSlaveToMasterCurrent = mSerialDataSlaveToMasterNext; |
| 1725 | state->m_mSerialDataSlaveToMasterCurrent = state->m_mSerialDataSlaveToMasterNext; |
| 1737 | 1726 | |
| 1738 | 1727 | if( cpu_getiloops(device) == 0 ) |
| 1739 | 1728 | { |
| r11160 | r11161 | |
| 1793 | 1782 | */ |
| 1794 | 1783 | static WRITE16_HANDLER( dsp_unk8_w ) |
| 1795 | 1784 | { |
| 1796 | | mRenderBufSize = 0; |
| 1785 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1786 | state->m_mRenderBufSize = 0; |
| 1797 | 1787 | } |
| 1798 | 1788 | |
| 1799 | 1789 | static WRITE16_HANDLER( master_render_device_w ) |
| 1800 | 1790 | { |
| 1801 | | if( mRenderBufSize<MAX_RENDER_CMD_SEQ ) |
| 1791 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 1792 | if( state->m_mRenderBufSize<MAX_RENDER_CMD_SEQ ) |
| 1802 | 1793 | { |
| 1803 | | mRenderBufData[mRenderBufSize++] = data; |
| 1804 | | if( mRenderBufSize == MAX_RENDER_CMD_SEQ ) |
| 1794 | state->m_mRenderBufData[state->m_mRenderBufSize++] = data; |
| 1795 | if( state->m_mRenderBufSize == MAX_RENDER_CMD_SEQ ) |
| 1805 | 1796 | { |
| 1806 | | namcos22_draw_direct_poly( space->machine(), mRenderBufData ); |
| 1797 | namcos22_draw_direct_poly( space->machine(), state->m_mRenderBufData ); |
| 1807 | 1798 | } |
| 1808 | 1799 | } |
| 1809 | 1800 | } |
| 1810 | 1801 | |
| 1811 | 1802 | static ADDRESS_MAP_START( master_dsp_program, AS_PROGRAM, 16 ) |
| 1812 | 1803 | AM_RANGE(0x0000, 0x0fff) AM_ROM /* internal ROM (4k words) */ |
| 1813 | | AM_RANGE(0x4000, 0x7fff) AM_ROM AM_BASE(&mpMasterExternalRAM) |
| 1804 | AM_RANGE(0x4000, 0x7fff) AM_ROM AM_BASE_MEMBER(namcos22_state, m_mpMasterExternalRAM) |
| 1814 | 1805 | ADDRESS_MAP_END |
| 1815 | 1806 | |
| 1816 | 1807 | static ADDRESS_MAP_START( master_dsp_data, AS_DATA, 16 ) |
| r11160 | r11161 | |
| 1859 | 1850 | |
| 1860 | 1851 | static READ16_HANDLER( dsp_slave_port5_r ) |
| 1861 | 1852 | { |
| 1862 | | /* int numWords = SlaveBufSize(); |
| 1863 | | int mode = 2; |
| 1864 | | return (numWords<<4) | mode; |
| 1865 | | */ |
| 1853 | #if 0 |
| 1854 | int numWords = SlaveBufSize(); |
| 1855 | int mode = 2; |
| 1856 | return (numWords<<4) | mode; |
| 1857 | #endif |
| 1866 | 1858 | return 0; |
| 1867 | 1859 | } |
| 1868 | 1860 | |
| r11160 | r11161 | |
| 1903 | 1895 | |
| 1904 | 1896 | static ADDRESS_MAP_START( slave_dsp_program, AS_PROGRAM, 16 ) |
| 1905 | 1897 | AM_RANGE(0x0000, 0x0fff) AM_ROM /* internal ROM */ |
| 1906 | | AM_RANGE(0x8000, 0x9fff) AM_ROM AM_BASE(&mpSlaveExternalRAM) |
| 1898 | AM_RANGE(0x8000, 0x9fff) AM_ROM AM_BASE_MEMBER(namcos22_state, m_mpSlaveExternalRAM) |
| 1907 | 1899 | ADDRESS_MAP_END |
| 1908 | 1900 | |
| 1909 | 1901 | static ADDRESS_MAP_START( slave_dsp_data, AS_DATA, 16 ) |
| r11160 | r11161 | |
| 1935 | 1927 | |
| 1936 | 1928 | static NVRAM_HANDLER( namcos22 ) |
| 1937 | 1929 | { |
| 1930 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 1938 | 1931 | int i; |
| 1939 | 1932 | UINT8 data[4]; |
| 1940 | 1933 | if( read_or_write ) |
| 1941 | 1934 | { |
| 1942 | | for( i=0; i<namcos22_nvmem_size/4; i++ ) |
| 1935 | for( i=0; i<state->m_nvmem_size/4; i++ ) |
| 1943 | 1936 | { |
| 1944 | | UINT32 dword = namcos22_nvmem[i]; |
| 1937 | UINT32 dword = state->m_nvmem[i]; |
| 1945 | 1938 | data[0] = dword>>24; |
| 1946 | 1939 | data[1] = (dword&0x00ff0000)>>16; |
| 1947 | 1940 | data[2] = (dword&0x0000ff00)>>8; |
| r11160 | r11161 | |
| 1953 | 1946 | { |
| 1954 | 1947 | if( file ) |
| 1955 | 1948 | { |
| 1956 | | for( i=0; i<namcos22_nvmem_size/4; i++ ) |
| 1949 | for( i=0; i<state->m_nvmem_size/4; i++ ) |
| 1957 | 1950 | { |
| 1958 | 1951 | file->read( data, 4 ); |
| 1959 | | namcos22_nvmem[i] = (data[0]<<24)|(data[1]<<16)|(data[2]<<8)|data[3]; |
| 1952 | state->m_nvmem[i] = (data[0]<<24)|(data[1]<<16)|(data[2]<<8)|data[3]; |
| 1960 | 1953 | } |
| 1961 | 1954 | } |
| 1962 | 1955 | else |
| 1963 | 1956 | { |
| 1964 | | memset( namcos22_nvmem, 0x00, namcos22_nvmem_size ); |
| 1965 | | if (machine.region("nvram")->bytes() == namcos22_nvmem_size) |
| 1957 | memset( state->m_nvmem, 0x00, state->m_nvmem_size ); |
| 1958 | if (machine.region("nvram")->bytes() == state->m_nvmem_size) |
| 1966 | 1959 | { |
| 1967 | 1960 | UINT8* nvram = machine.region("nvram")->base(); |
| 1968 | 1961 | |
| 1969 | | for( i=0; i<namcos22_nvmem_size/4; i++ ) |
| 1962 | for( i=0; i<state->m_nvmem_size/4; i++ ) |
| 1970 | 1963 | { |
| 1971 | | namcos22_nvmem[i] = (nvram[0+i*4]<<24)|(nvram[1+i*4]<<16)|(nvram[2+i*4]<<8)|nvram[3+i*4]; |
| 1964 | state->m_nvmem[i] = (nvram[0+i*4]<<24)|(nvram[1+i*4]<<16)|(nvram[2+i*4]<<8)|nvram[3+i*4]; |
| 1972 | 1965 | } |
| 1973 | 1966 | } |
| 1974 | 1967 | } |
| r11160 | r11161 | |
| 2006 | 1999 | { 0,1,2,3,4,5,6,7 }, |
| 2007 | 2000 | { |
| 2008 | 2001 | 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8,8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 |
| 2009 | | }, |
| 2002 | }, |
| 2010 | 2003 | { |
| 2011 | 2004 | 0*16*8,1*16*8,2*16*8,3*16*8,4*16*8,5*16*8,6*16*8,7*16*8, |
| 2012 | 2005 | 8*16*8,9*16*8,10*16*8,11*16*8,12*16*8,13*16*8,14*16*8,15*16*8 |
| 2013 | | }, |
| 2006 | }, |
| 2014 | 2007 | 16*16*8 |
| 2015 | 2008 | }; |
| 2016 | 2009 | |
| r11160 | r11161 | |
| 2085 | 2078 | |
| 2086 | 2079 | static READ32_HANDLER( namcos22_system_controller_r ) |
| 2087 | 2080 | { |
| 2088 | | return namcos22_system_controller[offset]; |
| 2081 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2082 | return state->m_system_controller[offset]; |
| 2089 | 2083 | } |
| 2090 | 2084 | |
| 2091 | 2085 | static int |
| 2092 | | GetDspControlRegister( void ) |
| 2086 | GetDspControlRegister( namcos22_state *state ) |
| 2093 | 2087 | { |
| 2094 | 2088 | int mode; |
| 2095 | | if( mbSuperSystem22 ) |
| 2089 | if( state->m_mbSuperSystem22 ) |
| 2096 | 2090 | { |
| 2097 | | mode = nthbyte(namcos22_system_controller,0x1c); |
| 2091 | mode = nthbyte(state->m_system_controller,0x1c); |
| 2098 | 2092 | } |
| 2099 | 2093 | else |
| 2100 | 2094 | { |
| 2101 | | mode = nthbyte(namcos22_system_controller,0x1a); |
| 2095 | mode = nthbyte(state->m_system_controller,0x1a); |
| 2102 | 2096 | } |
| 2103 | 2097 | return mode; |
| 2104 | 2098 | } /* GetDspControlRegister */ |
| r11160 | r11161 | |
| 2142 | 2136 | |
| 2143 | 2137 | static WRITE32_HANDLER( namcos22_system_controller_w ) |
| 2144 | 2138 | { |
| 2145 | | int oldReg = GetDspControlRegister(); |
| 2139 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2140 | int oldReg = GetDspControlRegister(state); |
| 2146 | 2141 | int newReg; |
| 2147 | 2142 | |
| 2148 | 2143 | if( 0 ) |
| r11160 | r11161 | |
| 2168 | 2163 | } |
| 2169 | 2164 | } |
| 2170 | 2165 | |
| 2171 | | if( mbSuperSystem22 ) |
| 2166 | if( state->m_mbSuperSystem22 ) |
| 2172 | 2167 | { |
| 2173 | 2168 | if (offset == 0x14/4 && mem_mask == 0x0000ff00) |
| 2174 | 2169 | { /* SUBCPU enable for Super System 22 */ |
| r11160 | r11161 | |
| 2193 | 2188 | } |
| 2194 | 2189 | } |
| 2195 | 2190 | |
| 2196 | | COMBINE_DATA( &namcos22_system_controller[offset] ); |
| 2191 | COMBINE_DATA( &state->m_system_controller[offset] ); |
| 2197 | 2192 | |
| 2198 | | newReg = GetDspControlRegister(); |
| 2193 | newReg = GetDspControlRegister(state); |
| 2199 | 2194 | if( newReg != oldReg ) |
| 2200 | 2195 | { |
| 2201 | 2196 | if( newReg == 0 ) |
| 2202 | 2197 | { /* disable DSPs */ |
| 2203 | 2198 | cputag_set_input_line(space->machine(), "master", INPUT_LINE_RESET, ASSERT_LINE); /* master DSP */ |
| 2204 | 2199 | cputag_set_input_line(space->machine(), "slave", INPUT_LINE_RESET, ASSERT_LINE); /* slave DSP */ |
| 2205 | | mbEnableDspIrqs = 0; |
| 2200 | state->m_mbEnableDspIrqs = 0; |
| 2206 | 2201 | } |
| 2207 | 2202 | else if( newReg == 1 ) |
| 2208 | 2203 | { /*enable dsp and rendering subsystem */ |
| 2209 | 2204 | cputag_set_input_line(space->machine(), "master", INPUT_LINE_RESET, CLEAR_LINE); |
| 2210 | | namcos22_enable_slave_simulation(); |
| 2211 | | mbEnableDspIrqs = 1; |
| 2205 | namcos22_enable_slave_simulation(space->machine()); |
| 2206 | state->m_mbEnableDspIrqs = 1; |
| 2212 | 2207 | } |
| 2213 | 2208 | else if( newReg == 0xff ) |
| 2214 | 2209 | { /* used to upload game-specific code to master/slave dsps */ |
| 2215 | 2210 | cputag_set_input_line(space->machine(), "master", INPUT_LINE_RESET, CLEAR_LINE); |
| 2216 | | mbEnableDspIrqs = 0; |
| 2211 | state->m_mbEnableDspIrqs = 0; |
| 2217 | 2212 | } |
| 2218 | 2213 | } |
| 2219 | 2214 | } /* namcos22_system_controller_w */ |
| r11160 | r11161 | |
| 2232 | 2227 | */ |
| 2233 | 2228 | static INTERRUPT_GEN( namcos22s_interrupt ) |
| 2234 | 2229 | { |
| 2230 | namcos22_state *state = device->machine().driver_data<namcos22_state>(); |
| 2235 | 2231 | if( cpu_getiloops(device) == 0 ) |
| 2236 | 2232 | { |
| 2237 | | int vblank_level = nthbyte(namcos22_system_controller,0x00)&0x7; /* $700004: ack */ |
| 2233 | int vblank_level = nthbyte(state->m_system_controller,0x00)&0x7; /* $700004: ack */ |
| 2238 | 2234 | device_set_input_line(device, vblank_level, HOLD_LINE); |
| 2239 | | mFrameCount++; |
| 2235 | state->m_mFrameCount++; |
| 2240 | 2236 | } |
| 2241 | 2237 | else |
| 2242 | 2238 | { |
| 2243 | | //int scanline_level = nthbyte(namcos22_system_controller,0x01)&0x7; /* $700005: ack */ |
| 2244 | | //int sci_level = nthbyte(namcos22_system_controller,0x02)&0x7; /* $700006: ack */ |
| 2245 | | //int unk_irq = nthbyte(namcos22_system_controller,0x03)&0x7; /* $700007: ack */ |
| 2239 | //int scanline_level = nthbyte(state->m_system_controller,0x01)&0x7; /* $700005: ack */ |
| 2240 | //int sci_level = nthbyte(state->m_system_controller,0x02)&0x7; /* $700006: ack */ |
| 2241 | //int unk_irq = nthbyte(state->m_system_controller,0x03)&0x7; /* $700007: ack */ |
| 2246 | 2242 | //device_set_input_line(device, sci_level, HOLD_LINE); |
| 2247 | 2243 | } |
| 2248 | 2244 | } |
| 2249 | 2245 | |
| 2250 | 2246 | static READ32_HANDLER( namcos22_keycus_r ) |
| 2251 | 2247 | { |
| 2248 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2252 | 2249 | // printf("Hit keycus mask %x PC=%x\n", mem_mask, cpu_get_pc(&space->device())); |
| 2253 | 2250 | |
| 2254 | | switch( namcos22_gametype ) |
| 2251 | switch( state->m_gametype ) |
| 2255 | 2252 | { |
| 2256 | 2253 | case NAMCOS22_RIDGE_RACER: |
| 2257 | 2254 | case NAMCOS22_RIDGE_RACER2: |
| r11160 | r11161 | |
| 2305 | 2302 | */ |
| 2306 | 2303 | static READ32_HANDLER( namcos22_portbit_r ) |
| 2307 | 2304 | { |
| 2308 | | UINT32 data = mSys22PortBits; |
| 2309 | | mSys22PortBits>>=1; |
| 2305 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2306 | UINT32 data = state->m_mSys22PortBits; |
| 2307 | state->m_mSys22PortBits>>=1; |
| 2310 | 2308 | return data&0x10001; |
| 2311 | 2309 | } |
| 2312 | 2310 | static WRITE32_HANDLER( namcos22_portbit_w ) |
| 2313 | 2311 | { |
| 2312 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2314 | 2313 | unsigned dat50000008 = AnalogAsDigital(space->machine()); |
| 2315 | 2314 | unsigned dat5000000a = 0xffff; |
| 2316 | | mSys22PortBits = (dat50000008<<16)|dat5000000a; |
| 2315 | state->m_mSys22PortBits = (dat50000008<<16)|dat5000000a; |
| 2317 | 2316 | } |
| 2318 | 2317 | |
| 2319 | 2318 | static READ32_HANDLER( namcos22_dipswitch_r ) |
| r11160 | r11161 | |
| 2323 | 2322 | |
| 2324 | 2323 | static READ32_HANDLER( namcos22_mcuram_r ) |
| 2325 | 2324 | { |
| 2326 | | return namcos22_shareram[offset]; |
| 2325 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2326 | return state->m_shareram[offset]; |
| 2327 | 2327 | } |
| 2328 | 2328 | |
| 2329 | 2329 | static WRITE32_HANDLER( namcos22_mcuram_w ) |
| 2330 | 2330 | { |
| 2331 | | COMBINE_DATA(&namcos22_shareram[offset]); |
| 2331 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2332 | COMBINE_DATA(&state->m_shareram[offset]); |
| 2332 | 2333 | } |
| 2333 | 2334 | |
| 2334 | 2335 | /** |
| r11160 | r11161 | |
| 2404 | 2405 | } |
| 2405 | 2406 | } /* namcos22_gun_r */ |
| 2406 | 2407 | |
| 2407 | | static UINT32 mAlpineSurferProtData; |
| 2408 | 2408 | |
| 2409 | 2409 | static READ32_HANDLER( alpinesa_prot_r ) |
| 2410 | 2410 | { |
| 2411 | | return mAlpineSurferProtData; |
| 2411 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2412 | return state->m_mAlpineSurferProtData; |
| 2412 | 2413 | } /* alpinesa_prot_r */ |
| 2413 | 2414 | |
| 2414 | 2415 | static WRITE32_HANDLER( alpinesa_prot_w ) |
| 2415 | 2416 | { |
| 2417 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2416 | 2418 | #if 1 |
| 2417 | 2419 | switch( data ) |
| 2418 | 2420 | { |
| 2419 | 2421 | case 0: |
| 2420 | | mAlpineSurferProtData = 0; |
| 2422 | state->m_mAlpineSurferProtData = 0; |
| 2421 | 2423 | break; |
| 2422 | 2424 | case 1: |
| 2423 | | mAlpineSurferProtData = 1; |
| 2425 | state->m_mAlpineSurferProtData = 1; |
| 2424 | 2426 | break; |
| 2425 | 2427 | case 3: |
| 2426 | | mAlpineSurferProtData = 2; |
| 2428 | state->m_mAlpineSurferProtData = 2; |
| 2427 | 2429 | break; |
| 2428 | 2430 | default: |
| 2429 | 2431 | break; |
| r11160 | r11161 | |
| 2431 | 2433 | #else |
| 2432 | 2434 | int i; |
| 2433 | 2435 | unsigned sptr = downcast<cpu_device *>(&space->device())->sp(); |
| 2434 | | mAlpineSurferProtData = 0; |
| 2436 | state->m_mAlpineSurferProtData = 0; |
| 2435 | 2437 | for(i=0;i<4;i++) |
| 2436 | 2438 | { |
| 2437 | | mAlpineSurferProtData<<=8; |
| 2438 | | mAlpineSurferProtData |= space->read_byte(sptr+4+i ); |
| 2439 | state->m_mAlpineSurferProtData<<=8; |
| 2440 | state->m_mAlpineSurferProtData |= space->read_byte(sptr+4+i ); |
| 2439 | 2441 | } |
| 2440 | 2442 | #endif |
| 2441 | 2443 | } /* alpinesa_prot_w */ |
| r11160 | r11161 | |
| 2451 | 2453 | AM_RANGE(0x430000, 0x43000f) AM_READ(namcos22_gun_r) AM_WRITENOP /* LEDs? */ |
| 2452 | 2454 | AM_RANGE(0x440000, 0x440003) AM_READ(namcos22_dipswitch_r) |
| 2453 | 2455 | AM_RANGE(0x450008, 0x45000b) AM_READ(namcos22_portbit_r) AM_WRITE(namcos22_portbit_w) |
| 2454 | | AM_RANGE(0x460000, 0x463fff) AM_RAM AM_BASE(&namcos22_nvmem) AM_SIZE(&namcos22_nvmem_size) |
| 2455 | | AM_RANGE(0x700000, 0x70001f) AM_READ(namcos22_system_controller_r) AM_WRITE(namcos22_system_controller_w) AM_BASE(&namcos22_system_controller) |
| 2456 | AM_RANGE(0x460000, 0x463fff) AM_RAM AM_BASE_SIZE_MEMBER(namcos22_state, m_nvmem, m_nvmem_size) |
| 2457 | AM_RANGE(0x700000, 0x70001f) AM_READ(namcos22_system_controller_r) AM_WRITE(namcos22_system_controller_w) AM_BASE_MEMBER(namcos22_state, m_system_controller) |
| 2456 | 2458 | AM_RANGE(0x800000, 0x800003) AM_WRITE(namcos22_port800000_w) /* (C304 C399) 40380000 during SPOT test */ |
| 2457 | | AM_RANGE(0x810000, 0x81000f) AM_RAM AM_BASE(&namcos22_czattr) |
| 2459 | AM_RANGE(0x810000, 0x81000f) AM_RAM AM_BASE_MEMBER(namcos22_state, m_czattr) |
| 2458 | 2460 | AM_RANGE(0x810200, 0x8103ff) AM_READ(namcos22_czram_r) AM_WRITE(namcos22_czram_w) |
| 2459 | 2461 | AM_RANGE(0x820000, 0x8202ff) AM_RAM /* unknown (air combat) */ |
| 2460 | | AM_RANGE(0x824000, 0x8243ff) AM_READ(namcos22_gamma_r) AM_WRITE(namcos22_gamma_w) AM_BASE(&namcos22_gamma) |
| 2462 | AM_RANGE(0x824000, 0x8243ff) AM_READ(namcos22_gamma_r) AM_WRITE(namcos22_gamma_w) AM_BASE_MEMBER(namcos22_state, m_gamma) |
| 2461 | 2463 | AM_RANGE(0x828000, 0x83ffff) AM_READ(namcos22_paletteram_r) AM_WRITE(namcos22_paletteram_w) AM_BASE_GENERIC(paletteram) |
| 2462 | 2464 | AM_RANGE(0x860000, 0x860007) AM_READ(spotram_r) AM_WRITE(spotram_w) |
| 2463 | | AM_RANGE(0x880000, 0x89dfff) AM_RAM_WRITE(namcos22_cgram_w) AM_BASE(&namcos22_cgram) |
| 2464 | | AM_RANGE(0x89e000, 0x89ffff) AM_READ(namcos22_textram_r) AM_WRITE(namcos22_textram_w) AM_BASE(&namcos22_textram) |
| 2465 | | AM_RANGE(0x8a0000, 0x8a000f) AM_RAM AM_BASE(&namcos22_tilemapattr) |
| 2466 | | AM_RANGE(0x900000, 0x90ffff) AM_RAM AM_BASE(&namcos22_vics_data) |
| 2467 | | AM_RANGE(0x940000, 0x94007f) AM_RAM AM_BASE(&namcos22_vics_control) |
| 2465 | AM_RANGE(0x880000, 0x89dfff) AM_RAM_WRITE(namcos22_cgram_w) AM_BASE_MEMBER(namcos22_state, m_cgram) |
| 2466 | AM_RANGE(0x89e000, 0x89ffff) AM_READ(namcos22_textram_r) AM_WRITE(namcos22_textram_w) AM_BASE_MEMBER(namcos22_state, m_textram) |
| 2467 | AM_RANGE(0x8a0000, 0x8a000f) AM_RAM AM_BASE_MEMBER(namcos22_state, m_tilemapattr) |
| 2468 | AM_RANGE(0x900000, 0x90ffff) AM_RAM AM_BASE_MEMBER(namcos22_state, m_vics_data) |
| 2469 | AM_RANGE(0x940000, 0x94007f) AM_RAM AM_BASE_MEMBER(namcos22_state, m_vics_control) |
| 2468 | 2470 | AM_RANGE(0x980000, 0x9affff) AM_RAM AM_BASE_MEMBER(namcos22_state, m_spriteram) /* C374 */ |
| 2469 | | AM_RANGE(0xa04000, 0xa0bfff) AM_READ(namcos22_mcuram_r) AM_WRITE(namcos22_mcuram_w) AM_BASE(&namcos22_shareram) /* COM RAM */ |
| 2470 | | AM_RANGE(0xc00000, 0xc1ffff) AM_READ(namcos22_dspram_r) AM_WRITE(namcos22_dspram_w) AM_BASE(&namcos22_polygonram) |
| 2471 | AM_RANGE(0xa04000, 0xa0bfff) AM_READ(namcos22_mcuram_r) AM_WRITE(namcos22_mcuram_w) AM_BASE_MEMBER(namcos22_state, m_shareram) /* COM RAM */ |
| 2472 | AM_RANGE(0xc00000, 0xc1ffff) AM_READ(namcos22_dspram_r) AM_WRITE(namcos22_dspram_w) AM_BASE_MEMBER(namcos22_state, m_polygonram) |
| 2471 | 2473 | AM_RANGE(0xe00000, 0xe3ffff) AM_RAM /* workram */ |
| 2472 | 2474 | ADDRESS_MAP_END |
| 2473 | 2475 | |
| 2474 | 2476 | static READ16_HANDLER( s22mcu_shared_r ) |
| 2475 | 2477 | { |
| 2476 | | UINT16 *share16 = (UINT16 *)namcos22_shareram; |
| 2478 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2479 | UINT16 *share16 = (UINT16 *)state->m_shareram; |
| 2477 | 2480 | |
| 2478 | 2481 | return share16[BYTE_XOR_BE(offset)]; |
| 2479 | 2482 | } |
| 2480 | 2483 | |
| 2481 | 2484 | static WRITE16_HANDLER( s22mcu_shared_w ) |
| 2482 | 2485 | { |
| 2483 | | UINT16 *share16 = (UINT16 *)namcos22_shareram; |
| 2486 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2487 | UINT16 *share16 = (UINT16 *)state->m_shareram; |
| 2484 | 2488 | |
| 2485 | 2489 | COMBINE_DATA(&share16[BYTE_XOR_BE(offset)]); |
| 2486 | 2490 | } |
| 2487 | 2491 | |
| 2488 | | static MACHINE_RESET(namcoss22) |
| 2489 | | { |
| 2490 | | InitDSP(machine, 1/*super*/); |
| 2491 | | } |
| 2492 | | |
| 2493 | 2492 | /* |
| 2494 | 2493 | MCU memory map |
| 2495 | 2494 | -------------- |
| r11160 | r11161 | |
| 2539 | 2538 | AM_RANGE(0x308000, 0x308003) AM_NOP // volume control IC? |
| 2540 | 2539 | ADDRESS_MAP_END |
| 2541 | 2540 | |
| 2542 | | static int p4; |
| 2543 | 2541 | |
| 2544 | 2542 | static READ8_HANDLER( mcu_port5_r ) |
| 2545 | 2543 | { |
| 2544 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2546 | 2545 | // hack for motor status |
| 2547 | | if ((namcos22_gametype == NAMCOS22_ALPINE_RACER) || (namcos22_gametype == NAMCOS22_ALPINE_RACER_2) || (namcos22_gametype == NAMCOS22_ALPINE_SURFER)) |
| 2546 | if ((state->m_gametype == NAMCOS22_ALPINE_RACER) || (state->m_gametype == NAMCOS22_ALPINE_RACER_2) || (state->m_gametype == NAMCOS22_ALPINE_SURFER)) |
| 2548 | 2547 | { |
| 2549 | | if (p4 & 8) |
| 2548 | if (state->m_p4 & 8) |
| 2550 | 2549 | { |
| 2551 | | if (mFrameCount & 1) |
| 2550 | if (state->m_mFrameCount & 1) |
| 2552 | 2551 | { |
| 2553 | 2552 | return input_port_read_safe(space->machine(), "MCUP5A", 0xff) | 0x80; |
| 2554 | 2553 | } |
| r11160 | r11161 | |
| 2559 | 2558 | } |
| 2560 | 2559 | else |
| 2561 | 2560 | { |
| 2562 | | if (mFrameCount & 1) |
| 2561 | if (state->m_mFrameCount & 1) |
| 2563 | 2562 | { |
| 2564 | 2563 | return 0xfe; |
| 2565 | 2564 | } |
| r11160 | r11161 | |
| 2571 | 2570 | } |
| 2572 | 2571 | else |
| 2573 | 2572 | { |
| 2574 | | if (p4 & 8) |
| 2573 | if (state->m_p4 & 8) |
| 2575 | 2574 | { |
| 2576 | 2575 | return input_port_read_safe(space->machine(), "MCUP5A", 0xff); |
| 2577 | 2576 | } |
| r11160 | r11161 | |
| 2584 | 2583 | |
| 2585 | 2584 | static WRITE8_HANDLER( mcu_port4_w ) |
| 2586 | 2585 | { |
| 2587 | | p4 = data; |
| 2586 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2587 | state->m_p4 = data; |
| 2588 | 2588 | } |
| 2589 | 2589 | |
| 2590 | 2590 | static READ8_HANDLER( mcu_port4_r ) |
| 2591 | 2591 | { |
| 2592 | | return p4; |
| 2592 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2593 | return state->m_p4; |
| 2593 | 2594 | } |
| 2594 | 2595 | |
| 2595 | 2596 | static WRITE8_HANDLER( mcu_port5_w ) |
| r11160 | r11161 | |
| 2618 | 2619 | // H+L = horizontal, 1 H+L = vertical |
| 2619 | 2620 | static READ8_HANDLER( propcycle_mcu_adc_r ) |
| 2620 | 2621 | { |
| 2621 | | static UINT16 ddx, ddy; |
| 2622 | UINT16 ddx, ddy; |
| 2622 | 2623 | |
| 2623 | 2624 | ddx = input_port_read(space->machine(), "STICKX")^0xff; |
| 2624 | 2625 | if (ddx > 0) ddx -= 1; |
| r11160 | r11161 | |
| 2795 | 2796 | return ddy & 0xff; |
| 2796 | 2797 | |
| 2797 | 2798 | case 5: |
| 2798 | | return (ddy>>8); |
| 2799 | return (ddy>>8); |
| 2799 | 2800 | |
| 2800 | 2801 | default: |
| 2801 | 2802 | return 0; |
| r11160 | r11161 | |
| 2845 | 2846 | |
| 2846 | 2847 | static READ8_HANDLER( mcu_port4_s22_r ) |
| 2847 | 2848 | { |
| 2848 | | return p4 | 0x10; // for C74, 0x10 selects sound MCU role, 0x00 selects control-reading role |
| 2849 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 2850 | return state->m_p4 | 0x10; // for C74, 0x10 selects sound MCU role, 0x00 selects control-reading role |
| 2849 | 2851 | } |
| 2850 | 2852 | |
| 2851 | 2853 | static ADDRESS_MAP_START( mcu_s22_io, AS_IO, 8 ) |
| r11160 | r11161 | |
| 2868 | 2870 | } |
| 2869 | 2871 | } |
| 2870 | 2872 | |
| 2873 | static MACHINE_RESET(namcos22) |
| 2874 | { |
| 2875 | InitDSP(machine); |
| 2876 | } |
| 2877 | |
| 2871 | 2878 | static MACHINE_CONFIG_START( namcos22s, namcos22_state ) |
| 2872 | 2879 | MCFG_CPU_ADD("maincpu", M68EC020,SS22_MASTER_CLOCK/2) |
| 2873 | 2880 | MCFG_CPU_PROGRAM_MAP(namcos22s_am) |
| r11160 | r11161 | |
| 2903 | 2910 | MCFG_PALETTE_LENGTH(NAMCOS22_PALETTE_SIZE) |
| 2904 | 2911 | MCFG_GFXDECODE(super) |
| 2905 | 2912 | MCFG_VIDEO_START(namcos22s) |
| 2906 | | MCFG_MACHINE_RESET(namcoss22) |
| 2913 | MCFG_MACHINE_RESET(namcos22) |
| 2907 | 2914 | |
| 2908 | 2915 | /* sound hardware */ |
| 2909 | 2916 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| r11160 | r11161 | |
| 3037 | 3044 | * 4000001e |
| 3038 | 3045 | * 4000001f |
| 3039 | 3046 | */ |
| 3040 | | AM_RANGE(0x40000000, 0x4000001f) AM_READ(namcos22_system_controller_r) AM_WRITE(namcos22_system_controller_w) AM_BASE(&namcos22_system_controller) |
| 3047 | AM_RANGE(0x40000000, 0x4000001f) AM_READ(namcos22_system_controller_r) AM_WRITE(namcos22_system_controller_w) AM_BASE_MEMBER(namcos22_state, m_system_controller) |
| 3041 | 3048 | |
| 3042 | 3049 | /** |
| 3043 | 3050 | * Unknown Device (optional for diagnostics?) |
| r11160 | r11161 | |
| 3060 | 3067 | * Mounted position: CPU 9E |
| 3061 | 3068 | * Known chip type: HN58C65P-25 (8k x 8bit EEPROM) |
| 3062 | 3069 | */ |
| 3063 | | AM_RANGE(0x58000000, 0x58001fff) AM_RAM AM_BASE(&namcos22_nvmem) AM_SIZE(&namcos22_nvmem_size) |
| 3070 | AM_RANGE(0x58000000, 0x58001fff) AM_RAM AM_BASE_MEMBER(namcos22_state, m_nvmem) AM_SIZE_MEMBER(namcos22_state, m_nvmem_size) |
| 3064 | 3071 | |
| 3065 | 3072 | /** |
| 3066 | 3073 | * C74 (Mitsubishi M37702 MCU) Shared RAM (0x60004000 - 0x6000bfff) |
| r11160 | r11161 | |
| 3102 | 3109 | * +0x0300 - 0x03ff? Song Title (put messages here from Sound CPU) |
| 3103 | 3110 | */ |
| 3104 | 3111 | AM_RANGE(0x60000000, 0x60003fff) AM_WRITENOP |
| 3105 | | AM_RANGE(0x60004000, 0x6000bfff) AM_READ(namcos22_mcuram_r) AM_WRITE(namcos22_mcuram_w) AM_BASE(&namcos22_shareram) |
| 3112 | AM_RANGE(0x60004000, 0x6000bfff) AM_READ(namcos22_mcuram_r) AM_WRITE(namcos22_mcuram_w) AM_BASE_MEMBER(namcos22_state, m_shareram) |
| 3106 | 3113 | |
| 3107 | 3114 | /** |
| 3108 | 3115 | * C71 (TI TMS320C25 DSP) Shared RAM (0x70000000 - 0x70020000) |
| r11160 | r11161 | |
| 3112 | 3119 | * Known chip type: TC55328P-25, N341256P-15 |
| 3113 | 3120 | * Notes: connected bits = 0x00ffffff (24bit) |
| 3114 | 3121 | */ |
| 3115 | | AM_RANGE(0x70000000, 0x7001ffff) AM_READ(namcos22_dspram_r) AM_WRITE(namcos22_dspram_w) AM_BASE(&namcos22_polygonram) |
| 3122 | AM_RANGE(0x70000000, 0x7001ffff) AM_READ(namcos22_dspram_r) AM_WRITE(namcos22_dspram_w) AM_BASE_MEMBER(namcos22_state, m_polygonram) |
| 3116 | 3123 | |
| 3117 | 3124 | /** |
| 3118 | 3125 | * LED on PCB(?) |
| r11160 | r11161 | |
| 3124 | 3131 | * Mounted position: VIDEO 8P |
| 3125 | 3132 | * Known chip type: TC55328P-25 |
| 3126 | 3133 | */ |
| 3127 | | AM_RANGE(0x90010000, 0x90017fff) AM_RAM /* AM_BASE(&namcos22_czram) */ |
| 3134 | AM_RANGE(0x90010000, 0x90017fff) AM_RAM /* AM_BASE_MEMBER(namcos22_state, m_czram) */ |
| 3128 | 3135 | |
| 3129 | 3136 | /** |
| 3130 | 3137 | * C305 (Display Controller) |
| r11160 | r11161 | |
| 3144 | 3151 | * |
| 3145 | 3152 | * Notes: Boot time check: 0x90020100 - 0x9002027f |
| 3146 | 3153 | */ |
| 3147 | | AM_RANGE(0x90020000, 0x90027fff) /*AM_RAM*/ AM_READ(namcos22_gamma_r) AM_WRITE(namcos22_gamma_w) AM_BASE(&namcos22_gamma) |
| 3154 | AM_RANGE(0x90020000, 0x90027fff) /*AM_RAM*/ AM_READ(namcos22_gamma_r) AM_WRITE(namcos22_gamma_w) AM_BASE_MEMBER(namcos22_state, m_gamma) |
| 3148 | 3155 | |
| 3149 | 3156 | /** |
| 3150 | 3157 | * 0x90028000 - 0x9002ffff Palette (R) |
| r11160 | r11161 | |
| 3165 | 3172 | /** |
| 3166 | 3173 | * Tilemap PCG Memory |
| 3167 | 3174 | */ |
| 3168 | | AM_RANGE(0x90080000, 0x9009dfff) AM_RAM_WRITE(namcos22_cgram_w) AM_BASE(&namcos22_cgram) |
| 3175 | AM_RANGE(0x90080000, 0x9009dfff) AM_RAM_WRITE(namcos22_cgram_w) AM_BASE_MEMBER(namcos22_state, m_cgram) |
| 3169 | 3176 | |
| 3170 | 3177 | /** |
| 3171 | 3178 | * Tilemap Memory (64 x 64) |
| r11160 | r11161 | |
| 3173 | 3180 | * Known chip type: HM511664 (64k x 16bit SRAM) |
| 3174 | 3181 | * Note: Self test: 90084000 - 9009ffff |
| 3175 | 3182 | */ |
| 3176 | | AM_RANGE(0x9009e000, 0x9009ffff) AM_RAM_WRITE(namcos22_textram_w) AM_BASE(&namcos22_textram) |
| 3183 | AM_RANGE(0x9009e000, 0x9009ffff) AM_RAM_WRITE(namcos22_textram_w) AM_BASE_MEMBER(namcos22_state, m_textram) |
| 3177 | 3184 | |
| 3178 | 3185 | /** |
| 3179 | 3186 | * Tilemap Register |
| r11160 | r11161 | |
| 3181 | 3188 | * +0x0000 Position X |
| 3182 | 3189 | * +0x0002 Position Y |
| 3183 | 3190 | */ |
| 3184 | | AM_RANGE(0x900a0000, 0x900a000f) AM_RAM AM_BASE(&namcos22_tilemapattr) |
| 3191 | AM_RANGE(0x900a0000, 0x900a000f) AM_RAM AM_BASE_MEMBER(namcos22_state, m_tilemapattr) |
| 3185 | 3192 | ADDRESS_MAP_END |
| 3186 | 3193 | |
| 3187 | 3194 | static INTERRUPT_GEN( namcos22_interrupt ) |
| 3188 | 3195 | { |
| 3196 | namcos22_state *state = device->machine().driver_data<namcos22_state>(); |
| 3189 | 3197 | int irq_level1 = 5; |
| 3190 | 3198 | int irq_level2 = 6; |
| 3191 | 3199 | |
| 3192 | | switch( namcos22_gametype ) |
| 3200 | switch( state->m_gametype ) |
| 3193 | 3201 | { |
| 3194 | 3202 | case NAMCOS22_RIDGE_RACER: |
| 3195 | 3203 | HandleDrivingIO(device->machine()); |
| r11160 | r11161 | |
| 3230 | 3238 | // a60 irq |
| 3231 | 3239 | // abe indirect to 27f1e (SCI) |
| 3232 | 3240 | // ac4 (rte) |
| 3233 | | irq_level1 = nthbyte(namcos22_system_controller,0x04)&0x7; |
| 3234 | | irq_level2 = nthbyte(namcos22_system_controller,0x02)&0x7; |
| 3241 | irq_level1 = nthbyte(state->m_system_controller,0x04)&0x7; |
| 3242 | irq_level2 = nthbyte(state->m_system_controller,0x02)&0x7; |
| 3235 | 3243 | break; |
| 3236 | 3244 | |
| 3237 | 3245 | case NAMCOS22_ACE_DRIVER: |
| r11160 | r11161 | |
| 3254 | 3262 | // |
| 3255 | 3263 | //move.b #$34, $40000004.l |
| 3256 | 3264 | HandleCyberCommandoIO(device->machine()); |
| 3257 | | irq_level1 = nthbyte(namcos22_system_controller,0x04)&0x7; |
| 3258 | | irq_level2 = nthbyte(namcos22_system_controller,0x02)&0x7; |
| 3265 | irq_level1 = nthbyte(state->m_system_controller,0x04)&0x7; |
| 3266 | irq_level2 = nthbyte(state->m_system_controller,0x02)&0x7; |
| 3259 | 3267 | break; |
| 3260 | 3268 | |
| 3261 | 3269 | default: |
| r11160 | r11161 | |
| 3279 | 3287 | } |
| 3280 | 3288 | } |
| 3281 | 3289 | |
| 3282 | | static MACHINE_RESET(namcos22) |
| 3283 | | { |
| 3284 | | InitDSP(machine, 0); |
| 3285 | | } |
| 3286 | | |
| 3287 | 3290 | static MACHINE_CONFIG_START( namcos22, namcos22_state ) |
| 3288 | 3291 | MCFG_CPU_ADD("maincpu", M68020,SS22_MASTER_CLOCK/2) /* 25 MHz? */ |
| 3289 | 3292 | MCFG_CPU_PROGRAM_MAP(namcos22_am) |
| r11160 | r11161 | |
| 3392 | 3395 | ROM_LOAD32_BYTE( "ar2ver-c.1", 0x00003, 0x100000, CRC(61323842) SHA1(e3c33248340bee252f230124fa9b7fa935a60565) ) |
| 3393 | 3396 | ROM_LOAD32_BYTE( "ar2ver-c.2", 0x00002, 0x100000, CRC(43795b2d) SHA1(e060f3259661279a36300431c5ca7347bde8b6ec) ) |
| 3394 | 3397 | ROM_LOAD32_BYTE( "ar2ver-c.3", 0x00001, 0x100000, CRC(acb3003b) SHA1(ea0cbf3a1607b06b108df051f38fec1f214f42d2) ) |
| 3395 | | ROM_LOAD32_BYTE( "ar2ver-c.4", 0x00000, 0x100000, CRC(800acc21) SHA1(41d26766da2db46954a2351bbc50aea94bc1d564) ) |
| 3398 | ROM_LOAD32_BYTE( "ar2ver-c.4", 0x00000, 0x100000, CRC(800acc21) SHA1(41d26766da2db46954a2351bbc50aea94bc1d564) ) |
| 3396 | 3399 | |
| 3397 | 3400 | ROM_REGION( 0x10000*2, "master", 0 ) /* Master DSP */ |
| 3398 | 3401 | ROM_LOAD16_WORD( "c71.bin", 0,0x1000*2, CRC(47c623ab) SHA1(e363ac50f5556f83308d4cc191b455e9b62bcfc8) ) |
| r11160 | r11161 | |
| 3501 | 3504 | |
| 3502 | 3505 | ROM_START( alpinr2b ) |
| 3503 | 3506 | ROM_REGION( 0x800000, "maincpu", 0 ) /* main program */ |
| 3504 | | ROM_LOAD32_BYTE( "ars2ver-b.2", 0x000003, 0x200000, CRC(ed977f83) SHA1(26c57cdfc15f799a999ee22f141e1c0cabfc91dc) ) |
| 3505 | | ROM_LOAD32_BYTE( "ars2ver-b.3", 0x000001, 0x200000, CRC(8e7a9983) SHA1(34c82e5f080efe04d6b77a77a8391cb48b69c1af) ) |
| 3506 | | ROM_LOAD32_BYTE( "ars2ver-b.4", 0x000002, 0x200000, CRC(610e49c2) SHA1(433c6d2216551bac31584306f748af1c912c3b07) ) |
| 3507 | | ROM_LOAD32_BYTE( "ars2ver-b.5", 0x000000, 0x200000, CRC(7f3517b0) SHA1(3e6ba1a51bf235f40f933aae1f00638b88bba522) ) |
| 3507 | ROM_LOAD32_BYTE( "ars2ver-b.2", 0x000003, 0x200000, CRC(ed977f83) SHA1(26c57cdfc15f799a999ee22f141e1c0cabfc91dc) ) |
| 3508 | ROM_LOAD32_BYTE( "ars2ver-b.3", 0x000001, 0x200000, CRC(8e7a9983) SHA1(34c82e5f080efe04d6b77a77a8391cb48b69c1af) ) |
| 3509 | ROM_LOAD32_BYTE( "ars2ver-b.4", 0x000002, 0x200000, CRC(610e49c2) SHA1(433c6d2216551bac31584306f748af1c912c3b07) ) |
| 3510 | ROM_LOAD32_BYTE( "ars2ver-b.5", 0x000000, 0x200000, CRC(7f3517b0) SHA1(3e6ba1a51bf235f40f933aae1f00638b88bba522) ) |
| 3508 | 3511 | |
| 3509 | 3512 | ROM_REGION( 0x10000*2, "master", 0 ) /* Master DSP */ |
| 3510 | 3513 | ROM_LOAD16_WORD( "c71.bin", 0,0x1000*2, CRC(47c623ab) SHA1(e363ac50f5556f83308d4cc191b455e9b62bcfc8) ) |
| r11160 | r11161 | |
| 3515 | 3518 | ROM_REGION( 0x080000, "mcu", ROMREGION_ERASE00 ) /* S22-BIOS ver1.30 */ |
| 3516 | 3519 | |
| 3517 | 3520 | ROM_REGION16_LE( 0x080000, "user4", 0 ) /* MCU BIOS */ |
| 3518 | | ROM_LOAD( "ars2data.8k", 0x000000, 0x080000, CRC(29b36dcb) SHA1(70fde130c11789c822829493a70ecefb077c0c15) ) |
| 3521 | ROM_LOAD( "ars2data.8k", 0x000000, 0x080000, CRC(29b36dcb) SHA1(70fde130c11789c822829493a70ecefb077c0c15) ) |
| 3519 | 3522 | |
| 3520 | 3523 | ROM_REGION( 0x200000*2, "sprite", 0 ) /* 32x32x8bpp sprite tiles */ |
| 3521 | | ROM_LOAD( "ars1scg0.12f", 0x000000, 0x200000, CRC(bc49ed86) SHA1(289b39f2cb21c723dbe4ddd64ee4b2c5fa65c368) ) |
| 3524 | ROM_LOAD( "ars1scg0.12f", 0x000000, 0x200000, CRC(bc49ed86) SHA1(289b39f2cb21c723dbe4ddd64ee4b2c5fa65c368) ) |
| 3522 | 3525 | |
| 3523 | 3526 | ROM_REGION( 0xc00000, "textile", 0) /* 16x16x8bpp texture tiles */ |
| 3524 | | ROM_LOAD( "ars1cg0.8d", 0x000000, 0x200000, CRC(74f4515c) SHA1(1e3a96281d543213d10c962b4d387c414d76e0c3) ) |
| 3525 | | ROM_LOAD( "ars1cg1.10d", 0x200000, 0x200000, CRC(329a95c1) SHA1(2cad7fd9e5ca7c64729ca2548ef4f873a0b8de64) ) |
| 3526 | | ROM_LOAD( "ars1cg2.12d", 0x400000, 0x200000, CRC(5648345a) SHA1(0dc7aedba65b7d97687a9e38a63597f16cee6179) ) |
| 3527 | | ROM_LOAD( "ars1cg3.13d", 0x600000, 0x200000, CRC(a752f205) SHA1(373b5a69e4488bc30763568ceae512ab7039f5f8) ) |
| 3528 | | ROM_LOAD( "ars1cg4.14d", 0x800000, 0x200000, CRC(54bf35b6) SHA1(aec43b66e7597ad7d113ae785417bf26164c1bca) ) |
| 3529 | | ROM_LOAD( "ars1cg5.16d", 0xa00000, 0x200000, CRC(e24a19a2) SHA1(34c1b51eea954ae3000602e550eb1cef0a10e651) ) |
| 3527 | ROM_LOAD( "ars1cg0.8d", 0x000000, 0x200000, CRC(74f4515c) SHA1(1e3a96281d543213d10c962b4d387c414d76e0c3) ) |
| 3528 | ROM_LOAD( "ars1cg1.10d", 0x200000, 0x200000, CRC(329a95c1) SHA1(2cad7fd9e5ca7c64729ca2548ef4f873a0b8de64) ) |
| 3529 | ROM_LOAD( "ars1cg2.12d", 0x400000, 0x200000, CRC(5648345a) SHA1(0dc7aedba65b7d97687a9e38a63597f16cee6179) ) |
| 3530 | ROM_LOAD( "ars1cg3.13d", 0x600000, 0x200000, CRC(a752f205) SHA1(373b5a69e4488bc30763568ceae512ab7039f5f8) ) |
| 3531 | ROM_LOAD( "ars1cg4.14d", 0x800000, 0x200000, CRC(54bf35b6) SHA1(aec43b66e7597ad7d113ae785417bf26164c1bca) ) |
| 3532 | ROM_LOAD( "ars1cg5.16d", 0xa00000, 0x200000, CRC(e24a19a2) SHA1(34c1b51eea954ae3000602e550eb1cef0a10e651) ) |
| 3530 | 3533 | |
| 3531 | 3534 | ROM_REGION16_LE( 0x280000, "textilemap", 0 ) /* texture tilemap */ |
| 3532 | | ROM_LOAD( "ars1ccrl.3d", 0x000000, 0x200000, CRC(fc8c9161) SHA1(ad0fcfae27e02d68a6f8d1d03c514dc2f12d9ee8) ) |
| 3533 | | ROM_LOAD( "ars1ccrh.1d", 0x200000, 0x080000, CRC(a17660bb) SHA1(bae2c3f20772c6cea99f271ee3f39b1f999038c6) ) |
| 3535 | ROM_LOAD( "ars1ccrl.3d", 0x000000, 0x200000, CRC(fc8c9161) SHA1(ad0fcfae27e02d68a6f8d1d03c514dc2f12d9ee8) ) |
| 3536 | ROM_LOAD( "ars1ccrh.1d", 0x200000, 0x080000, CRC(a17660bb) SHA1(bae2c3f20772c6cea99f271ee3f39b1f999038c6) ) |
| 3534 | 3537 | |
| 3535 | 3538 | ROM_REGION( 0x80000*12, "pointrom", 0 ) /* 3d model data */ |
| 3536 | | ROM_LOAD( "ars1ptrl0.18k", 0x000000, 0x080000, CRC(f04e0e61) SHA1(d58a1d3ca1d0922e134db21a04feaee7dc97b020) ) |
| 3537 | | ROM_LOAD( "ars1ptrl1.16k", 0x080000, 0x080000, CRC(8bdb4970) SHA1(a504cd4beca4bedd1a7a228c83dd6b844ca3a1e0) ) |
| 3538 | | ROM_LOAD( "ars1ptrl2.15k", 0x100000, 0x080000, CRC(ec993a4f) SHA1(883f64e3e8d951415e9cef589c354eba9406c0aa) ) |
| 3539 | | ROM_LOAD( "ars1ptrl3.14k", 0x180000, 0x080000, CRC(4d453f3c) SHA1(7a82e5d8f974d9e56d0031b35e73647fe6aeec2e) ) |
| 3539 | ROM_LOAD( "ars1ptrl0.18k", 0x000000, 0x080000, CRC(f04e0e61) SHA1(d58a1d3ca1d0922e134db21a04feaee7dc97b020) ) |
| 3540 | ROM_LOAD( "ars1ptrl1.16k", 0x080000, 0x080000, CRC(8bdb4970) SHA1(a504cd4beca4bedd1a7a228c83dd6b844ca3a1e0) ) |
| 3541 | ROM_LOAD( "ars1ptrl2.15k", 0x100000, 0x080000, CRC(ec993a4f) SHA1(883f64e3e8d951415e9cef589c354eba9406c0aa) ) |
| 3542 | ROM_LOAD( "ars1ptrl3.14k", 0x180000, 0x080000, CRC(4d453f3c) SHA1(7a82e5d8f974d9e56d0031b35e73647fe6aeec2e) ) |
| 3540 | 3543 | |
| 3541 | | ROM_LOAD( "ars1ptrm0.18j", 0x200000, 0x080000, CRC(d1bdc524) SHA1(b898bb38de397551ada4da4677dd733bf8fa5010) ) |
| 3542 | | ROM_LOAD( "ars1ptrm1.16j", 0x280000, 0x080000, CRC(86b81c81) SHA1(45096abf46794f06a4b647f5e4222798d8467632) ) |
| 3543 | | ROM_LOAD( "ars1ptrm2.15j", 0x300000, 0x080000, CRC(24116b83) SHA1(41c6a880abce7b543c409fda767682b2537b0d99) ) |
| 3544 | | ROM_LOAD( "ars1ptrm3.14j", 0x380000, 0x080000, CRC(772bede3) SHA1(f9565b7a40f0bbf11081d619fe5a46feafce2e56) ) |
| 3544 | ROM_LOAD( "ars1ptrm0.18j", 0x200000, 0x080000, CRC(d1bdc524) SHA1(b898bb38de397551ada4da4677dd733bf8fa5010) ) |
| 3545 | ROM_LOAD( "ars1ptrm1.16j", 0x280000, 0x080000, CRC(86b81c81) SHA1(45096abf46794f06a4b647f5e4222798d8467632) ) |
| 3546 | ROM_LOAD( "ars1ptrm2.15j", 0x300000, 0x080000, CRC(24116b83) SHA1(41c6a880abce7b543c409fda767682b2537b0d99) ) |
| 3547 | ROM_LOAD( "ars1ptrm3.14j", 0x380000, 0x080000, CRC(772bede3) SHA1(f9565b7a40f0bbf11081d619fe5a46feafce2e56) ) |
| 3545 | 3548 | |
| 3546 | | ROM_LOAD( "ars1ptru0.18f", 0x400000, 0x080000, CRC(a4cf197a) SHA1(ee78cc259e87395df75179bbe5b6e521e762b582) ) |
| 3547 | | ROM_LOAD( "ars1ptru1.16f", 0x480000, 0x080000, CRC(1deb1fc0) SHA1(bfd1dfcaccf5a0f851b6757995fa7195452a3965) ) |
| 3548 | | ROM_LOAD( "ars1ptru2.15f", 0x500000, 0x080000, CRC(bcfad0ba) SHA1(bee7f2f9ecd2b289c6706e19fa86863913b286b5) ) |
| 3549 | | ROM_LOAD( "ars1ptru3.14f", 0x580000, 0x080000, CRC(73ce6958) SHA1(918b0fb0fca33dbe3be3ac679b8b28f58213f75b) ) |
| 3549 | ROM_LOAD( "ars1ptru0.18f", 0x400000, 0x080000, CRC(a4cf197a) SHA1(ee78cc259e87395df75179bbe5b6e521e762b582) ) |
| 3550 | ROM_LOAD( "ars1ptru1.16f", 0x480000, 0x080000, CRC(1deb1fc0) SHA1(bfd1dfcaccf5a0f851b6757995fa7195452a3965) ) |
| 3551 | ROM_LOAD( "ars1ptru2.15f", 0x500000, 0x080000, CRC(bcfad0ba) SHA1(bee7f2f9ecd2b289c6706e19fa86863913b286b5) ) |
| 3552 | ROM_LOAD( "ars1ptru3.14f", 0x580000, 0x080000, CRC(73ce6958) SHA1(918b0fb0fca33dbe3be3ac679b8b28f58213f75b) ) |
| 3550 | 3553 | |
| 3551 | 3554 | ROM_REGION( 0x1000000, "c352", 0 ) /* sound samples */ |
| 3552 | | ROM_LOAD( "ars1wavea.2l", 0x000000, 0x400000, CRC(f8d107e9) SHA1(5c418691f0b35403553f21f5570eda8bbb66890f) ) |
| 3553 | | ROM_LOAD( "ars2waveb.1l", 0x800000, 0x400000, CRC(deab4ad1) SHA1(580ad88d516280baaf6cc92b2e07cdc0cfc486f3) ) |
| 3555 | ROM_LOAD( "ars1wavea.2l", 0x000000, 0x400000, CRC(f8d107e9) SHA1(5c418691f0b35403553f21f5570eda8bbb66890f) ) |
| 3556 | ROM_LOAD( "ars2waveb.1l", 0x800000, 0x400000, CRC(deab4ad1) SHA1(580ad88d516280baaf6cc92b2e07cdc0cfc486f3) ) |
| 3554 | 3557 | ROM_END |
| 3555 | 3558 | |
| 3556 | 3559 | ROM_START( alpinr2a ) |
| 3557 | 3560 | ROM_REGION( 0x800000, "maincpu", 0 ) /* main program */ |
| 3558 | | ROM_LOAD32_BYTE( "ars2ver-a.2", 0x000003, 0x200000, CRC(b07b15a4) SHA1(ea3b2d7b4ef4ccf3aafeef7e7eac92e8d446f4e7) ) |
| 3559 | | ROM_LOAD32_BYTE( "ars2ver-a.3", 0x000002, 0x200000, CRC(90a92e40) SHA1(bf8083256e56e7e33e61b4cdaf9fd03dabfb36ba) ) |
| 3560 | | ROM_LOAD32_BYTE( "ars2ver-a.4", 0x000001, 0x200000, CRC(9e9d771d) SHA1(6fb983e3f4f8233544667b1bbf87864e4fb8698c) ) |
| 3561 | | ROM_LOAD32_BYTE( "ars2ver-a.5", 0x000000, 0x200000, CRC(e93c7771) SHA1(305f35488a55be1b845702df972bba8334c0726c) ) |
| 3561 | ROM_LOAD32_BYTE( "ars2ver-a.2", 0x000003, 0x200000, CRC(b07b15a4) SHA1(ea3b2d7b4ef4ccf3aafeef7e7eac92e8d446f4e7) ) |
| 3562 | ROM_LOAD32_BYTE( "ars2ver-a.3", 0x000002, 0x200000, CRC(90a92e40) SHA1(bf8083256e56e7e33e61b4cdaf9fd03dabfb36ba) ) |
| 3563 | ROM_LOAD32_BYTE( "ars2ver-a.4", 0x000001, 0x200000, CRC(9e9d771d) SHA1(6fb983e3f4f8233544667b1bbf87864e4fb8698c) ) |
| 3564 | ROM_LOAD32_BYTE( "ars2ver-a.5", 0x000000, 0x200000, CRC(e93c7771) SHA1(305f35488a55be1b845702df972bba8334c0726c) ) |
| 3562 | 3565 | |
| 3563 | 3566 | ROM_REGION( 0x10000*2, "master", 0 ) /* Master DSP */ |
| 3564 | 3567 | ROM_LOAD16_WORD( "c71.bin", 0,0x1000*2, CRC(47c623ab) SHA1(e363ac50f5556f83308d4cc191b455e9b62bcfc8) ) |
| r11160 | r11161 | |
| 3569 | 3572 | ROM_REGION( 0x080000, "mcu", ROMREGION_ERASE00 ) /* S22-BIOS ver1.30 */ |
| 3570 | 3573 | |
| 3571 | 3574 | ROM_REGION16_LE( 0x080000, "user4", 0 ) /* MCU BIOS */ |
| 3572 | | ROM_LOAD( "ars2data.8k", 0x000000, 0x080000, CRC(29b36dcb) SHA1(70fde130c11789c822829493a70ecefb077c0c15) ) |
| 3575 | ROM_LOAD( "ars2data.8k", 0x000000, 0x080000, CRC(29b36dcb) SHA1(70fde130c11789c822829493a70ecefb077c0c15) ) |
| 3573 | 3576 | |
| 3574 | 3577 | ROM_REGION( 0x200000*2, "sprite", 0 ) /* 32x32x8bpp sprite tiles */ |
| 3575 | | ROM_LOAD( "ars1scg0.12f", 0x000000, 0x200000, CRC(bc49ed86) SHA1(289b39f2cb21c723dbe4ddd64ee4b2c5fa65c368) ) |
| 3578 | ROM_LOAD( "ars1scg0.12f", 0x000000, 0x200000, CRC(bc49ed86) SHA1(289b39f2cb21c723dbe4ddd64ee4b2c5fa65c368) ) |
| 3576 | 3579 | |
| 3577 | 3580 | ROM_REGION( 0xc00000, "textile", 0) /* 16x16x8bpp texture tiles */ |
| 3578 | | ROM_LOAD( "ars1cg0.8d", 0x000000, 0x200000, CRC(74f4515c) SHA1(1e3a96281d543213d10c962b4d387c414d76e0c3) ) |
| 3579 | | ROM_LOAD( "ars1cg1.10d", 0x200000, 0x200000, CRC(329a95c1) SHA1(2cad7fd9e5ca7c64729ca2548ef4f873a0b8de64) ) |
| 3580 | | ROM_LOAD( "ars1cg2.12d", 0x400000, 0x200000, CRC(5648345a) SHA1(0dc7aedba65b7d97687a9e38a63597f16cee6179) ) |
| 3581 | | ROM_LOAD( "ars1cg3.13d", 0x600000, 0x200000, CRC(a752f205) SHA1(373b5a69e4488bc30763568ceae512ab7039f5f8) ) |
| 3582 | | ROM_LOAD( "ars1cg4.14d", 0x800000, 0x200000, CRC(54bf35b6) SHA1(aec43b66e7597ad7d113ae785417bf26164c1bca) ) |
| 3583 | | ROM_LOAD( "ars1cg5.16d", 0xa00000, 0x200000, CRC(e24a19a2) SHA1(34c1b51eea954ae3000602e550eb1cef0a10e651) ) |
| 3581 | ROM_LOAD( "ars1cg0.8d", 0x000000, 0x200000, CRC(74f4515c) SHA1(1e3a96281d543213d10c962b4d387c414d76e0c3) ) |
| 3582 | ROM_LOAD( "ars1cg1.10d", 0x200000, 0x200000, CRC(329a95c1) SHA1(2cad7fd9e5ca7c64729ca2548ef4f873a0b8de64) ) |
| 3583 | ROM_LOAD( "ars1cg2.12d", 0x400000, 0x200000, CRC(5648345a) SHA1(0dc7aedba65b7d97687a9e38a63597f16cee6179) ) |
| 3584 | ROM_LOAD( "ars1cg3.13d", 0x600000, 0x200000, CRC(a752f205) SHA1(373b5a69e4488bc30763568ceae512ab7039f5f8) ) |
| 3585 | ROM_LOAD( "ars1cg4.14d", 0x800000, 0x200000, CRC(54bf35b6) SHA1(aec43b66e7597ad7d113ae785417bf26164c1bca) ) |
| 3586 | ROM_LOAD( "ars1cg5.16d", 0xa00000, 0x200000, CRC(e24a19a2) SHA1(34c1b51eea954ae3000602e550eb1cef0a10e651) ) |
| 3584 | 3587 | |
| 3585 | 3588 | ROM_REGION16_LE( 0x280000, "textilemap", 0 ) /* texture tilemap */ |
| 3586 | | ROM_LOAD( "ars1ccrl.3d", 0x000000, 0x200000, CRC(fc8c9161) SHA1(ad0fcfae27e02d68a6f8d1d03c514dc2f12d9ee8) ) |
| 3587 | | ROM_LOAD( "ars1ccrh.1d", 0x200000, 0x080000, CRC(a17660bb) SHA1(bae2c3f20772c6cea99f271ee3f39b1f999038c6) ) |
| 3589 | ROM_LOAD( "ars1ccrl.3d", 0x000000, 0x200000, CRC(fc8c9161) SHA1(ad0fcfae27e02d68a6f8d1d03c514dc2f12d9ee8) ) |
| 3590 | ROM_LOAD( "ars1ccrh.1d", 0x200000, 0x080000, CRC(a17660bb) SHA1(bae2c3f20772c6cea99f271ee3f39b1f999038c6) ) |
| 3588 | 3591 | |
| 3589 | 3592 | ROM_REGION( 0x80000*12, "pointrom", 0 ) /* 3d model data */ |
| 3590 | | ROM_LOAD( "ars1ptrl0.18k", 0x000000, 0x080000, CRC(f04e0e61) SHA1(d58a1d3ca1d0922e134db21a04feaee7dc97b020) ) |
| 3591 | | ROM_LOAD( "ars1ptrl1.16k", 0x080000, 0x080000, CRC(8bdb4970) SHA1(a504cd4beca4bedd1a7a228c83dd6b844ca3a1e0) ) |
| 3592 | | ROM_LOAD( "ars1ptrl2.15k", 0x100000, 0x080000, CRC(ec993a4f) SHA1(883f64e3e8d951415e9cef589c354eba9406c0aa) ) |
| 3593 | | ROM_LOAD( "ars1ptrl3.14k", 0x180000, 0x080000, CRC(4d453f3c) SHA1(7a82e5d8f974d9e56d0031b35e73647fe6aeec2e) ) |
| 3593 | ROM_LOAD( "ars1ptrl0.18k", 0x000000, 0x080000, CRC(f04e0e61) SHA1(d58a1d3ca1d0922e134db21a04feaee7dc97b020) ) |
| 3594 | ROM_LOAD( "ars1ptrl1.16k", 0x080000, 0x080000, CRC(8bdb4970) SHA1(a504cd4beca4bedd1a7a228c83dd6b844ca3a1e0) ) |
| 3595 | ROM_LOAD( "ars1ptrl2.15k", 0x100000, 0x080000, CRC(ec993a4f) SHA1(883f64e3e8d951415e9cef589c354eba9406c0aa) ) |
| 3596 | ROM_LOAD( "ars1ptrl3.14k", 0x180000, 0x080000, CRC(4d453f3c) SHA1(7a82e5d8f974d9e56d0031b35e73647fe6aeec2e) ) |
| 3594 | 3597 | |
| 3595 | | ROM_LOAD( "ars1ptrm0.18j", 0x200000, 0x080000, CRC(d1bdc524) SHA1(b898bb38de397551ada4da4677dd733bf8fa5010) ) |
| 3596 | | ROM_LOAD( "ars1ptrm1.16j", 0x280000, 0x080000, CRC(86b81c81) SHA1(45096abf46794f06a4b647f5e4222798d8467632) ) |
| 3597 | | ROM_LOAD( "ars1ptrm2.15j", 0x300000, 0x080000, CRC(24116b83) SHA1(41c6a880abce7b543c409fda767682b2537b0d99) ) |
| 3598 | | ROM_LOAD( "ars1ptrm3.14j", 0x380000, 0x080000, CRC(772bede3) SHA1(f9565b7a40f0bbf11081d619fe5a46feafce2e56) ) |
| 3598 | ROM_LOAD( "ars1ptrm0.18j", 0x200000, 0x080000, CRC(d1bdc524) SHA1(b898bb38de397551ada4da4677dd733bf8fa5010) ) |
| 3599 | ROM_LOAD( "ars1ptrm1.16j", 0x280000, 0x080000, CRC(86b81c81) SHA1(45096abf46794f06a4b647f5e4222798d8467632) ) |
| 3600 | ROM_LOAD( "ars1ptrm2.15j", 0x300000, 0x080000, CRC(24116b83) SHA1(41c6a880abce7b543c409fda767682b2537b0d99) ) |
| 3601 | ROM_LOAD( "ars1ptrm3.14j", 0x380000, 0x080000, CRC(772bede3) SHA1(f9565b7a40f0bbf11081d619fe5a46feafce2e56) ) |
| 3599 | 3602 | |
| 3600 | | ROM_LOAD( "ars1ptru0.18f", 0x400000, 0x080000, CRC(a4cf197a) SHA1(ee78cc259e87395df75179bbe5b6e521e762b582) ) |
| 3601 | | ROM_LOAD( "ars1ptru1.16f", 0x480000, 0x080000, CRC(1deb1fc0) SHA1(bfd1dfcaccf5a0f851b6757995fa7195452a3965) ) |
| 3602 | | ROM_LOAD( "ars1ptru2.15f", 0x500000, 0x080000, CRC(bcfad0ba) SHA1(bee7f2f9ecd2b289c6706e19fa86863913b286b5) ) |
| 3603 | | ROM_LOAD( "ars1ptru3.14f", 0x580000, 0x080000, CRC(73ce6958) SHA1(918b0fb0fca33dbe3be3ac679b8b28f58213f75b) ) |
| 3603 | ROM_LOAD( "ars1ptru0.18f", 0x400000, 0x080000, CRC(a4cf197a) SHA1(ee78cc259e87395df75179bbe5b6e521e762b582) ) |
| 3604 | ROM_LOAD( "ars1ptru1.16f", 0x480000, 0x080000, CRC(1deb1fc0) SHA1(bfd1dfcaccf5a0f851b6757995fa7195452a3965) ) |
| 3605 | ROM_LOAD( "ars1ptru2.15f", 0x500000, 0x080000, CRC(bcfad0ba) SHA1(bee7f2f9ecd2b289c6706e19fa86863913b286b5) ) |
| 3606 | ROM_LOAD( "ars1ptru3.14f", 0x580000, 0x080000, CRC(73ce6958) SHA1(918b0fb0fca33dbe3be3ac679b8b28f58213f75b) ) |
| 3604 | 3607 | |
| 3605 | 3608 | ROM_REGION( 0x1000000, "c352", 0 ) /* sound samples */ |
| 3606 | | ROM_LOAD( "ars1wavea.2l", 0x000000, 0x400000, CRC(f8d107e9) SHA1(5c418691f0b35403553f21f5570eda8bbb66890f) ) |
| 3607 | | ROM_LOAD( "ars2waveb.1l", 0x800000, 0x400000, CRC(deab4ad1) SHA1(580ad88d516280baaf6cc92b2e07cdc0cfc486f3) ) |
| 3609 | ROM_LOAD( "ars1wavea.2l", 0x000000, 0x400000, CRC(f8d107e9) SHA1(5c418691f0b35403553f21f5570eda8bbb66890f) ) |
| 3610 | ROM_LOAD( "ars2waveb.1l", 0x800000, 0x400000, CRC(deab4ad1) SHA1(580ad88d516280baaf6cc92b2e07cdc0cfc486f3) ) |
| 3608 | 3611 | ROM_END |
| 3609 | 3612 | |
| 3610 | 3613 | ROM_START( alpinesa ) |
| 3611 | 3614 | ROM_REGION( 0x800000, "maincpu", 0 ) /* main program */ |
| 3612 | | ROM_LOAD32_BYTE( "af2ver-a_ll.ic2", 0x000003, 0x200000, CRC(e776159d) SHA1(5110364afb7ec606074d58a1d216d7d687b9df62) ) |
| 3613 | | ROM_LOAD32_BYTE( "af2ver-a_lm.ic3", 0x000002, 0x200000, CRC(c5333d38) SHA1(9486cead964f95f8e56dac2f88486f3b98561aa6) ) |
| 3614 | | ROM_LOAD32_BYTE( "af2ver-a_um.ic4", 0x000001, 0x200000, CRC(5977fc6e) SHA1(19b8041789f8987934fa461972976a3570b1b87b) ) |
| 3615 | | ROM_LOAD32_BYTE( "af2ver-a_uu.ic5", 0x000000, 0x200000, CRC(54ee33a1) SHA1(0eaa8707ab13a0a66551f61a08986c98f5c9e446) ) |
| 3615 | ROM_LOAD32_BYTE( "af2ver-a_ll.ic2", 0x000003, 0x200000, CRC(e776159d) SHA1(5110364afb7ec606074d58a1d216d7d687b9df62) ) |
| 3616 | ROM_LOAD32_BYTE( "af2ver-a_lm.ic3", 0x000002, 0x200000, CRC(c5333d38) SHA1(9486cead964f95f8e56dac2f88486f3b98561aa6) ) |
| 3617 | ROM_LOAD32_BYTE( "af2ver-a_um.ic4", 0x000001, 0x200000, CRC(5977fc6e) SHA1(19b8041789f8987934fa461972976a3570b1b87b) ) |
| 3618 | ROM_LOAD32_BYTE( "af2ver-a_uu.ic5", 0x000000, 0x200000, CRC(54ee33a1) SHA1(0eaa8707ab13a0a66551f61a08986c98f5c9e446) ) |
| 3616 | 3619 | |
| 3617 | 3620 | ROM_REGION( 0x10000*2, "master", 0 ) /* Master DSP */ |
| 3618 | 3621 | ROM_LOAD16_WORD( "c71.bin", 0,0x1000*2, CRC(47c623ab) SHA1(e363ac50f5556f83308d4cc191b455e9b62bcfc8) ) |
| r11160 | r11161 | |
| 3623 | 3626 | ROM_REGION( 0x080000, "mcu", ROMREGION_ERASE00 ) /* S22-BIOS ver1.41 */ |
| 3624 | 3627 | |
| 3625 | 3628 | ROM_REGION16_LE( 0x080000, "user4", 0 ) /* MCU BIOS */ |
| 3626 | | ROM_LOAD( "af1data.8k", 0x000000, 0x080000, CRC(ef13ebe8) SHA1(5d3f697994d4b5b19ee7fea1e2aef8e39449b68e) ) |
| 3629 | ROM_LOAD( "af1data.8k", 0x000000, 0x080000, CRC(ef13ebe8) SHA1(5d3f697994d4b5b19ee7fea1e2aef8e39449b68e) ) |
| 3627 | 3630 | |
| 3628 | | ROM_REGION( 0x200000*2, "sprite", 0 ) /* 32x32x8bpp sprite tiles */ |
| 3629 | | ROM_LOAD( "af1scg0b.12f", 0x000000, 0x200000, CRC(46a6222a) SHA1(5322ef60690625b9b8dbe1cfe0c49dcd9c8b1a4c) ) |
| 3631 | ROM_REGION( 0x200000*2, "sprite", 0 ) /* 32x32x8bpp sprite tiles */ |
| 3632 | ROM_LOAD( "af1scg0b.12f", 0x000000, 0x200000, CRC(46a6222a) SHA1(5322ef60690625b9b8dbe1cfe0c49dcd9c8b1a4c) ) |
| 3630 | 3633 | |
| 3631 | 3634 | ROM_REGION( 0xa00000, "textile", 0) /* 16x16x8bpp texture tiles */ |
| 3632 | | ROM_LOAD( "af1cg0.8d", 0x000000, 0x200000, CRC(7423f3ff) SHA1(6a2fd44823ef46111deb57d328b1b75cc355d413) ) |
| 3633 | | ROM_LOAD( "af1cg1.10d", 0x200000, 0x200000, CRC(ea76689a) SHA1(73dd3af737a3e9903abe5ed9c9ae7eded51d8350) ) |
| 3634 | | ROM_LOAD( "af1cg2.12d", 0x400000, 0x200000, CRC(2a38943a) SHA1(15d737996f49bf6374ef6191bbfbe0298d398378) ) |
| 3635 | | ROM_LOAD( "af1cg3.13d", 0x600000, 0x200000, CRC(7f5a3e0f) SHA1(241f9995323b28df23d20a75e1f43ce6e05434cd) ) |
| 3636 | | ROM_LOAD( "af1cg4.14d", 0x800000, 0x200000, CRC(a5ee13e2) SHA1(48fd3c912690f21cbbc2a39bed0a82be41a0d011) ) |
| 3635 | ROM_LOAD( "af1cg0.8d", 0x000000, 0x200000, CRC(7423f3ff) SHA1(6a2fd44823ef46111deb57d328b1b75cc355d413) ) |
| 3636 | ROM_LOAD( "af1cg1.10d", 0x200000, 0x200000, CRC(ea76689a) SHA1(73dd3af737a3e9903abe5ed9c9ae7eded51d8350) ) |
| 3637 | ROM_LOAD( "af1cg2.12d", 0x400000, 0x200000, CRC(2a38943a) SHA1(15d737996f49bf6374ef6191bbfbe0298d398378) ) |
| 3638 | ROM_LOAD( "af1cg3.13d", 0x600000, 0x200000, CRC(7f5a3e0f) SHA1(241f9995323b28df23d20a75e1f43ce6e05434cd) ) |
| 3639 | ROM_LOAD( "af1cg4.14d", 0x800000, 0x200000, CRC(a5ee13e2) SHA1(48fd3c912690f21cbbc2a39bed0a82be41a0d011) ) |
| 3637 | 3640 | |
| 3638 | 3641 | ROM_REGION16_LE( 0x280000, "textilemap", 0 ) /* texture tilemap */ |
| 3639 | | ROM_LOAD( "af1ccrl.3d", 0x000000, 0x200000, CRC(6c054698) SHA1(8537607646b183883c5aa4060fb0af640da4af87) ) |
| 3640 | | ROM_LOAD( "af1ccrh.1d", 0x200000, 0x080000, CRC(95a02a27) SHA1(32ee87b76ae9fcec6d825e3cf4d5cbb97db39544) ) |
| 3642 | ROM_LOAD( "af1ccrl.3d", 0x000000, 0x200000, CRC(6c054698) SHA1(8537607646b183883c5aa4060fb0af640da4af87) ) |
| 3643 | ROM_LOAD( "af1ccrh.1d", 0x200000, 0x080000, CRC(95a02a27) SHA1(32ee87b76ae9fcec6d825e3cf4d5cbb97db39544) ) |
| 3641 | 3644 | |
| 3642 | 3645 | ROM_REGION( 0x80000*6, "pointrom", 0 ) /* 3d model data */ |
| 3643 | | ROM_LOAD( "af1ptrl0.18k", 0x80000*0, 0x80000, CRC(31ce46d3) SHA1(568fb9ee9ac14e613a4fd7668cb38315c10be62b) ) |
| 3644 | | ROM_LOAD( "af1ptrl1.16k", 0x80000*1, 0x80000, CRC(e869bf00) SHA1(b3c3026891ae3958d1774c905e97c3b57a414ea7) ) |
| 3645 | | ROM_LOAD( "af1ptrm0.18j", 0x80000*2, 0x80000, CRC(ef7f4d8a) SHA1(02f77c68004b7dccc99b61126e7d07960eb15028) ) |
| 3646 | | ROM_LOAD( "af1ptrm1.16j", 0x80000*3, 0x80000, CRC(7dd01d52) SHA1(adc1087435d31ed6163ad046466955f01517450f) ) |
| 3647 | | ROM_LOAD( "af1ptru0.18f", 0x80000*4, 0x80000, CRC(177f1591) SHA1(3969e780e5603eca0a65f65c1ad14d1cef918b39) ) |
| 3648 | | ROM_LOAD( "af1ptru1.16f", 0x80000*5, 0x80000, CRC(7521d18e) SHA1(dc03ef369db16f59c138ff4e22260d1c04782d1f) ) |
| 3646 | ROM_LOAD( "af1ptrl0.18k", 0x80000*0, 0x80000, CRC(31ce46d3) SHA1(568fb9ee9ac14e613a4fd7668cb38315c10be62b) ) |
| 3647 | ROM_LOAD( "af1ptrl1.16k", 0x80000*1, 0x80000, CRC(e869bf00) SHA1(b3c3026891ae3958d1774c905e97c3b57a414ea7) ) |
| 3648 | ROM_LOAD( "af1ptrm0.18j", 0x80000*2, 0x80000, CRC(ef7f4d8a) SHA1(02f77c68004b7dccc99b61126e7d07960eb15028) ) |
| 3649 | ROM_LOAD( "af1ptrm1.16j", 0x80000*3, 0x80000, CRC(7dd01d52) SHA1(adc1087435d31ed6163ad046466955f01517450f) ) |
| 3650 | ROM_LOAD( "af1ptru0.18f", 0x80000*4, 0x80000, CRC(177f1591) SHA1(3969e780e5603eca0a65f65c1ad14d1cef918b39) ) |
| 3651 | ROM_LOAD( "af1ptru1.16f", 0x80000*5, 0x80000, CRC(7521d18e) SHA1(dc03ef369db16f59c138ff4e22260d1c04782d1f) ) |
| 3649 | 3652 | |
| 3650 | 3653 | ROM_REGION( 0x1000000, "c352", 0 ) /* sound samples */ |
| 3651 | | ROM_LOAD( "af1wavea.2l", 0x000000, 0x400000, CRC(28cca494) SHA1(4ff87ab85fd17bf8dbee5b03d99cc5c31dd6349a) ) |
| 3654 | ROM_LOAD( "af1wavea.2l", 0x000000, 0x400000, CRC(28cca494) SHA1(4ff87ab85fd17bf8dbee5b03d99cc5c31dd6349a) ) |
| 3652 | 3655 | ROM_END |
| 3653 | 3656 | |
| 3654 | 3657 | ROM_START( cybrcomm ) |
| r11160 | r11161 | |
| 4437 | 4440 | |
| 4438 | 4441 | ROM_START( ridgerac3 ) |
| 4439 | 4442 | ROM_REGION( 0x200000, "maincpu", 0 ) /* main program */ |
| 4440 | | ROM_LOAD32_BYTE( "rr3prgll-3s.4d", 0x000003, 0x080000, CRC(2c3d8cb7) SHA1(46a7b62938fe3edde5c52ce3fdfe447000cd6af0) ) |
| 4441 | | ROM_LOAD32_BYTE( "rr3prglm-3s.2d", 0x000002, 0x080000, CRC(b15343f2) SHA1(3056eb5a3036a74b2ac641a4c3221986c0be1e27) ) |
| 4442 | | ROM_LOAD32_BYTE( "rr3prgum-3s.8d", 0x000001, 0x080000, CRC(8fda06ac) SHA1(7e9adba198eb0941100cda64ecedac504f6ac696) ) |
| 4443 | | ROM_LOAD32_BYTE( "rr3prguu-3s.6d", 0x000000, 0x080000, CRC(868398df) SHA1(422e0f9884904b0df93fcacd1468b8da0458eb8e) ) |
| 4443 | ROM_LOAD32_BYTE( "rr3prgll-3s.4d", 0x000003, 0x080000, CRC(2c3d8cb7) SHA1(46a7b62938fe3edde5c52ce3fdfe447000cd6af0) ) |
| 4444 | ROM_LOAD32_BYTE( "rr3prglm-3s.2d", 0x000002, 0x080000, CRC(b15343f2) SHA1(3056eb5a3036a74b2ac641a4c3221986c0be1e27) ) |
| 4445 | ROM_LOAD32_BYTE( "rr3prgum-3s.8d", 0x000001, 0x080000, CRC(8fda06ac) SHA1(7e9adba198eb0941100cda64ecedac504f6ac696) ) |
| 4446 | ROM_LOAD32_BYTE( "rr3prguu-3s.6d", 0x000000, 0x080000, CRC(868398df) SHA1(422e0f9884904b0df93fcacd1468b8da0458eb8e) ) |
| 4444 | 4447 | |
| 4445 | 4448 | ROM_REGION( 0x10000*2, "master", 0 ) /* Master DSP */ |
| 4446 | 4449 | ROM_LOAD16_WORD( "c71.bin", 0,0x1000*2, CRC(47c623ab) SHA1(e363ac50f5556f83308d4cc191b455e9b62bcfc8) ) |
| r11160 | r11161 | |
| 4611 | 4614 | ROM_REGION16_LE( 0x080000, "user4", 0 ) /* MCU BIOS */ |
| 4612 | 4615 | ROM_LOAD( "ts1data.8k", 0, 0x080000, CRC(e68aa973) SHA1(663e80d249be5d5841139d98a9d72e2396851272) ) |
| 4613 | 4616 | |
| 4614 | | ROM_REGION( 0x200000*6, "sprite", 0 ) /* 32x32x8bpp sprite tiles */ |
| 4617 | ROM_REGION( 0x200000*6, "sprite", 0 ) /* 32x32x8bpp sprite tiles */ |
| 4615 | 4618 | ROM_LOAD( "ts1scg0.12f",0x200000*0, 0x200000,CRC(14a3674d) SHA1(c5792a385572452b43bbc7eb8428335b19daa3c0) ) |
| 4616 | 4619 | ROM_LOAD( "ts1scg1.10f",0x200000*1, 0x200000,CRC(11791dbf) SHA1(3d75b468d69a8bf398d45f310cdb8bc88b63f25c) ) |
| 4617 | 4620 | ROM_LOAD( "ts1scg2.8f", 0x200000*2, 0x200000,CRC(d630fff9) SHA1(691394027b858702f06282f965f5b53e6fed496b) ) |
| r11160 | r11161 | |
| 4650 | 4653 | |
| 4651 | 4654 | ROM_START( tokyowar ) |
| 4652 | 4655 | ROM_REGION( 0x400000, "maincpu", 0 ) /* main program */ |
| 4653 | | ROM_LOAD32_BYTE( "tw2ver-a.1", 0x000003, 0x100000, CRC(2b17ca92) SHA1(7bcb1658059c59fb1a0131a41ede7157855130a8) ) |
| 4654 | | ROM_LOAD32_BYTE( "tw2ver-a.2", 0x000002, 0x100000, CRC(12da84e3) SHA1(a9406d0b77f60ba930c30e60bf4b3656c8905585) ) |
| 4655 | | ROM_LOAD32_BYTE( "tw2ver-a.3", 0x000001, 0x100000, CRC(7d42c516) SHA1(28c1596dd55c15207bbb41a8b9a5abc97abc2bc8) ) |
| 4656 | | ROM_LOAD32_BYTE( "tw2ver-a.4", 0x000000, 0x100000, CRC(b904ed16) SHA1(773e11536e1b3fe4971608a63a8e6eca702f8667) ) |
| 4656 | ROM_LOAD32_BYTE( "tw2ver-a.1", 0x000003, 0x100000, CRC(2b17ca92) SHA1(7bcb1658059c59fb1a0131a41ede7157855130a8) ) |
| 4657 | ROM_LOAD32_BYTE( "tw2ver-a.2", 0x000002, 0x100000, CRC(12da84e3) SHA1(a9406d0b77f60ba930c30e60bf4b3656c8905585) ) |
| 4658 | ROM_LOAD32_BYTE( "tw2ver-a.3", 0x000001, 0x100000, CRC(7d42c516) SHA1(28c1596dd55c15207bbb41a8b9a5abc97abc2bc8) ) |
| 4659 | ROM_LOAD32_BYTE( "tw2ver-a.4", 0x000000, 0x100000, CRC(b904ed16) SHA1(773e11536e1b3fe4971608a63a8e6eca702f8667) ) |
| 4657 | 4660 | |
| 4658 | 4661 | ROM_REGION( 0x10000*2, "master", 0 ) /* Master DSP */ |
| 4659 | 4662 | ROM_LOAD16_WORD( "c71.bin", 0,0x1000*2, CRC(47c623ab) SHA1(e363ac50f5556f83308d4cc191b455e9b62bcfc8) ) |
| r11160 | r11161 | |
| 4664 | 4667 | ROM_REGION( 0x80000, "mcu", ROMREGION_ERASE00 ) /* BIOS */ |
| 4665 | 4668 | |
| 4666 | 4669 | ROM_REGION16_LE( 0x080000, "user4", 0 ) /* MCU BIOS */ |
| 4667 | | ROM_LOAD( "tw1data.8k", 0x000000, 0x080000, CRC(bd046e4b) SHA1(162bc4ab69959ccab49fd69de291d34d472fb1c8) ) |
| 4670 | ROM_LOAD( "tw1data.8k", 0x000000, 0x080000, CRC(bd046e4b) SHA1(162bc4ab69959ccab49fd69de291d34d472fb1c8) ) |
| 4668 | 4671 | |
| 4669 | 4672 | ROM_REGION( 0x800000, "sprite", 0 ) /* 32x32x8bpp sprite tiles */ |
| 4670 | | ROM_LOAD( "tw1scg0.12f", 0x000000, 0x200000, CRC(e3ec4daa) SHA1(f3a71ae9820d62075b814ffa2fecf3343ae09ffe) ) |
| 4671 | | ROM_LOAD( "tw1scg1.10f", 0x200000, 0x200000, CRC(b18a06e9) SHA1(ecf6a1e11603b8ea5119a036a57595dea021d778) ) |
| 4672 | | ROM_LOAD( "tw1scg2.8f", 0x400000, 0x200000, CRC(36f8c3d8) SHA1(d5c965d5cdd258c77b9db3137ce33404a5a3641c) ) |
| 4673 | | ROM_LOAD( "tw1scg3.7f", 0x600000, 0x200000, CRC(8e14d013) SHA1(ca63105a5c07bb9653499eef7a757db52612b59b) ) |
| 4673 | ROM_LOAD( "tw1scg0.12f", 0x000000, 0x200000, CRC(e3ec4daa) SHA1(f3a71ae9820d62075b814ffa2fecf3343ae09ffe) ) |
| 4674 | ROM_LOAD( "tw1scg1.10f", 0x200000, 0x200000, CRC(b18a06e9) SHA1(ecf6a1e11603b8ea5119a036a57595dea021d778) ) |
| 4675 | ROM_LOAD( "tw1scg2.8f", 0x400000, 0x200000, CRC(36f8c3d8) SHA1(d5c965d5cdd258c77b9db3137ce33404a5a3641c) ) |
| 4676 | ROM_LOAD( "tw1scg3.7f", 0x600000, 0x200000, CRC(8e14d013) SHA1(ca63105a5c07bb9653499eef7a757db52612b59b) ) |
| 4674 | 4677 | |
| 4675 | 4678 | ROM_REGION( 0x200000*8, "textile", 0) /* 16x16x8bpp texture tiles */ |
| 4676 | | ROM_LOAD( "tw1cg0.8d", 0x000000, 0x200000, CRC(98b9b070) SHA1(cb920a34700dab330c967cc634717134c04b7e1d) ) |
| 4677 | | ROM_LOAD( "tw1cg1.10d", 0x200000, 0x200000, CRC(f96a723a) SHA1(5ba14963a4c51c875ac8d3b42049bc334de90038) ) |
| 4678 | | ROM_LOAD( "tw1cg2.12d", 0x400000, 0x200000, CRC(573e9ded) SHA1(815bda1ac000532c915c2d65ffdb04fee6fa8201) ) |
| 4679 | | ROM_LOAD( "tw1cg3.13d", 0x600000, 0x200000, CRC(302d5c74) SHA1(5a823f6842cf0f79eb93da47d5bf8c5f51e420db) ) |
| 4680 | | ROM_LOAD( "tw1cg4.14d", 0x800000, 0x200000, CRC(ab8aa1df) SHA1(355192d999f493e0761fbc822fa9b30c33d8e1c4) ) |
| 4681 | | ROM_LOAD( "tw1cg5.16d", 0xa00000, 0x200000, CRC(5063f3d0) SHA1(ad8dd2f4184373a3a3ca748b411a5eec1835dc97) ) |
| 4682 | | ROM_LOAD( "tw1cg6.18d", 0xc00000, 0x200000, CRC(d764027c) SHA1(5cbf93392683885c220628936ba50c09cb40fcfb) ) |
| 4683 | | ROM_LOAD( "tw1cg7.19d", 0xe00000, 0x200000, CRC(8d89877e) SHA1(7d76d48d64d7ac5411d714a4bb83f37e3e5b8df6) ) |
| 4679 | ROM_LOAD( "tw1cg0.8d", 0x000000, 0x200000, CRC(98b9b070) SHA1(cb920a34700dab330c967cc634717134c04b7e1d) ) |
| 4680 | ROM_LOAD( "tw1cg1.10d", 0x200000, 0x200000, CRC(f96a723a) SHA1(5ba14963a4c51c875ac8d3b42049bc334de90038) ) |
| 4681 | ROM_LOAD( "tw1cg2.12d", 0x400000, 0x200000, CRC(573e9ded) SHA1(815bda1ac000532c915c2d65ffdb04fee6fa8201) ) |
| 4682 | ROM_LOAD( "tw1cg3.13d", 0x600000, 0x200000, CRC(302d5c74) SHA1(5a823f6842cf0f79eb93da47d5bf8c5f51e420db) ) |
| 4683 | ROM_LOAD( "tw1cg4.14d", 0x800000, 0x200000, CRC(ab8aa1df) SHA1(355192d999f493e0761fbc822fa9b30c33d8e1c4) ) |
| 4684 | ROM_LOAD( "tw1cg5.16d", 0xa00000, 0x200000, CRC(5063f3d0) SHA1(ad8dd2f4184373a3a3ca748b411a5eec1835dc97) ) |
| 4685 | ROM_LOAD( "tw1cg6.18d", 0xc00000, 0x200000, CRC(d764027c) SHA1(5cbf93392683885c220628936ba50c09cb40fcfb) ) |
| 4686 | ROM_LOAD( "tw1cg7.19d", 0xe00000, 0x200000, CRC(8d89877e) SHA1(7d76d48d64d7ac5411d714a4bb83f37e3e5b8df6) ) |
| 4684 | 4687 | |
| 4685 | 4688 | ROM_REGION16_LE( 0x280000, "textilemap", 0 ) /* texture tilemap */ |
| 4686 | | ROM_LOAD( "tw1ccrl.3d", 0x000000, 0x200000, CRC(d08f5794) SHA1(336a97a2b060505e259e3bcedb9eb8aa4ea8815e) ) |
| 4687 | | ROM_LOAD( "tw1ccrh.1d", 0x200000, 0x080000, CRC(ad17e693) SHA1(4f06dc82c03159894fb8e10383862920f94563b1) ) |
| 4689 | ROM_LOAD( "tw1ccrl.3d", 0x000000, 0x200000, CRC(d08f5794) SHA1(336a97a2b060505e259e3bcedb9eb8aa4ea8815e) ) |
| 4690 | ROM_LOAD( "tw1ccrh.1d", 0x200000, 0x080000, CRC(ad17e693) SHA1(4f06dc82c03159894fb8e10383862920f94563b1) ) |
| 4688 | 4691 | |
| 4689 | 4692 | ROM_REGION( 0x600000, "pointrom", 0 ) /* 3d model data */ |
| 4690 | | ROM_LOAD( "tw1ptrl0.18k", 0x000000, 0x080000, CRC(44ac5e86) SHA1(5e42db58f2e352c0fe5e49588a9283817dd15ab1) ) |
| 4691 | | ROM_LOAD( "tw1ptrl1.16k", 0x080000, 0x080000, CRC(3c769860) SHA1(19b32c3d262f2a9d07354fbd6ac6be97b05f176e) ) |
| 4692 | | ROM_LOAD( "tw1ptrl2.15k", 0x100000, 0x080000, CRC(6e94103c) SHA1(ee90b77939a9f5780ce271882133cdf977eb643e) ) |
| 4693 | | ROM_LOAD( "tw1ptrl3.14k", 0x180000, 0x080000, CRC(e3ce5eb2) SHA1(4e15a6f630be15eb017cd51c5e7901db3138a061) ) |
| 4694 | | ROM_LOAD( "tw1ptrm0.18j", 0x200000, 0x080000, CRC(e170cea2) SHA1(ca259508d76fdab97a9d0502f871f0e560e6c308) ) |
| 4695 | | ROM_LOAD( "tw1ptrm1.16j", 0x280000, 0x080000, CRC(36a32237) SHA1(f46851dc5c094810ddc42d56310a9f85908bf715) ) |
| 4696 | | ROM_LOAD( "tw1ptrm2.15j", 0x300000, 0x080000, CRC(c426c278) SHA1(64232ac3c1649e0d0adb4b03e58b8b5ea4013f83) ) |
| 4697 | | ROM_LOAD( "tw1ptrm3.14j", 0x380000, 0x080000, CRC(d9b9a651) SHA1(0c49a051526081149d894d629f19cb0f2b66a698) ) |
| 4698 | | ROM_LOAD( "tw1ptru0.18f", 0x400000, 0x080000, CRC(62a9e9fb) SHA1(24739adba029b0acf2d7078962c9d01098a29a6c) ) |
| 4699 | | ROM_LOAD( "tw1ptru1.16f", 0x480000, 0x080000, CRC(2fd36177) SHA1(368b915261d914be01ae9daeb52571bead52d14d) ) |
| 4700 | | ROM_LOAD( "tw1ptru2.15f", 0x500000, 0x080000, CRC(ceacb1c9) SHA1(b86cf576e16bbe26ad0d6d6df8bf28d0071c25e2) ) |
| 4701 | | ROM_LOAD( "tw1ptru3.14f", 0x580000, 0x080000, CRC(939044c2) SHA1(f4c1c0a1c2f07ca7f784d59ef4162a2a6a8bbc43) ) |
| 4693 | ROM_LOAD( "tw1ptrl0.18k", 0x000000, 0x080000, CRC(44ac5e86) SHA1(5e42db58f2e352c0fe5e49588a9283817dd15ab1) ) |
| 4694 | ROM_LOAD( "tw1ptrl1.16k", 0x080000, 0x080000, CRC(3c769860) SHA1(19b32c3d262f2a9d07354fbd6ac6be97b05f176e) ) |
| 4695 | ROM_LOAD( "tw1ptrl2.15k", 0x100000, 0x080000, CRC(6e94103c) SHA1(ee90b77939a9f5780ce271882133cdf977eb643e) ) |
| 4696 | ROM_LOAD( "tw1ptrl3.14k", 0x180000, 0x080000, CRC(e3ce5eb2) SHA1(4e15a6f630be15eb017cd51c5e7901db3138a061) ) |
| 4697 | ROM_LOAD( "tw1ptrm0.18j", 0x200000, 0x080000, CRC(e170cea2) SHA1(ca259508d76fdab97a9d0502f871f0e560e6c308) ) |
| 4698 | ROM_LOAD( "tw1ptrm1.16j", 0x280000, 0x080000, CRC(36a32237) SHA1(f46851dc5c094810ddc42d56310a9f85908bf715) ) |
| 4699 | ROM_LOAD( "tw1ptrm2.15j", 0x300000, 0x080000, CRC(c426c278) SHA1(64232ac3c1649e0d0adb4b03e58b8b5ea4013f83) ) |
| 4700 | ROM_LOAD( "tw1ptrm3.14j", 0x380000, 0x080000, CRC(d9b9a651) SHA1(0c49a051526081149d894d629f19cb0f2b66a698) ) |
| 4701 | ROM_LOAD( "tw1ptru0.18f", 0x400000, 0x080000, CRC(62a9e9fb) SHA1(24739adba029b0acf2d7078962c9d01098a29a6c) ) |
| 4702 | ROM_LOAD( "tw1ptru1.16f", 0x480000, 0x080000, CRC(2fd36177) SHA1(368b915261d914be01ae9daeb52571bead52d14d) ) |
| 4703 | ROM_LOAD( "tw1ptru2.15f", 0x500000, 0x080000, CRC(ceacb1c9) SHA1(b86cf576e16bbe26ad0d6d6df8bf28d0071c25e2) ) |
| 4704 | ROM_LOAD( "tw1ptru3.14f", 0x580000, 0x080000, CRC(939044c2) SHA1(f4c1c0a1c2f07ca7f784d59ef4162a2a6a8bbc43) ) |
| 4702 | 4705 | |
| 4703 | 4706 | ROM_REGION( 0xa00000, "c352", 0 ) /* sound samples */ |
| 4704 | | ROM_LOAD( "tw1wavea.2l", 0x000000, 0x400000, CRC(ebce6366) SHA1(44ebe90ff3c7af5bebbf1baba3b7a2b1863daebb) ) |
| 4707 | ROM_LOAD( "tw1wavea.2l", 0x000000, 0x400000, CRC(ebce6366) SHA1(44ebe90ff3c7af5bebbf1baba3b7a2b1863daebb) ) |
| 4705 | 4708 | ROM_END |
| 4706 | 4709 | |
| 4707 | 4710 | ROM_START( dirtdash ) |
| 4708 | 4711 | ROM_REGION( 0x400000, "maincpu", 0 ) /* main program */ |
| 4709 | | ROM_LOAD32_WORD_SWAP( "dt2vera.1", 0x000002, 0x200000, CRC(402a3d73) SHA1(009b57ed0ea228ccedb139d945b9eaf2a36e2502) ) |
| 4710 | | ROM_LOAD32_WORD_SWAP( "dt2vera.2", 0x000000, 0x200000, CRC(66ed140d) SHA1(a472fdc7b6aaeb4b3643ecdafd32fa665e7c7aa2) ) |
| 4712 | ROM_LOAD32_WORD_SWAP( "dt2vera.1", 0x000002, 0x200000, CRC(402a3d73) SHA1(009b57ed0ea228ccedb139d945b9eaf2a36e2502) ) |
| 4713 | ROM_LOAD32_WORD_SWAP( "dt2vera.2", 0x000000, 0x200000, CRC(66ed140d) SHA1(a472fdc7b6aaeb4b3643ecdafd32fa665e7c7aa2) ) |
| 4711 | 4714 | |
| 4712 | 4715 | ROM_REGION( 0x10000*2, "master", 0 ) /* Master DSP */ |
| 4713 | 4716 | ROM_LOAD16_WORD( "c71.bin", 0,0x1000*2, CRC(47c623ab) SHA1(e363ac50f5556f83308d4cc191b455e9b62bcfc8) ) |
| r11160 | r11161 | |
| 4718 | 4721 | ROM_REGION( 0x80000, "mcu", ROMREGION_ERASE00 ) /* BIOS */ |
| 4719 | 4722 | |
| 4720 | 4723 | ROM_REGION16_LE( 0x080000, "user4", 0 ) /* MCU BIOS */ |
| 4721 | | ROM_LOAD( "dt1dataa.8k", 0x000000, 0x080000, CRC(9bcdea21) SHA1(26ae025cf746d3a703a82495eb2bb515b828a650) ) |
| 4724 | ROM_LOAD( "dt1dataa.8k", 0x000000, 0x080000, CRC(9bcdea21) SHA1(26ae025cf746d3a703a82495eb2bb515b828a650) ) |
| 4722 | 4725 | |
| 4723 | 4726 | ROM_REGION( 0x800000, "sprite", 0 ) /* 32x32x8bpp sprite tiles */ |
| 4724 | | ROM_LOAD( "dt1scg0.12f", 0x000000, 0x200000, CRC(a09b5760) SHA1(3dd54ebebf9da1de76874a1adf491ed15849e1b1) ) |
| 4725 | | ROM_LOAD( "dt1scg1.10f", 0x200000, 0x200000, CRC(f9ac8111) SHA1(814074ae8cc81c6c1201d764a84dd95fe914f19c) ) |
| 4727 | ROM_LOAD( "dt1scg0.12f", 0x000000, 0x200000, CRC(a09b5760) SHA1(3dd54ebebf9da1de76874a1adf491ed15849e1b1) ) |
| 4728 | ROM_LOAD( "dt1scg1.10f", 0x200000, 0x200000, CRC(f9ac8111) SHA1(814074ae8cc81c6c1201d764a84dd95fe914f19c) ) |
| 4726 | 4729 | |
| 4727 | 4730 | ROM_REGION( 0x200000*8, "textile", 0) /* 16x16x8bpp texture tiles */ |
| 4728 | | ROM_LOAD( "dt1cg0.8d", 0x000000, 0x200000, CRC(10ab95e0) SHA1(ffde1f00ac3e82a36fbcfa060c6b97c92dfcfc8b) ) |
| 4729 | | ROM_LOAD( "dt1cg1.10d", 0x200000, 0x200000, CRC(d9f1ba53) SHA1(5a1095b726c55001cc1d4c695adc38097e6a0201) ) |
| 4730 | | ROM_LOAD( "dt1cg2.12d", 0x400000, 0x200000, CRC(bd8b1e0b) SHA1(fcd94e33a0cbd17c9308cb8952e3c618ab56f9fc) ) |
| 4731 | | ROM_LOAD( "dt1cg3.13d", 0x600000, 0x200000, CRC(ba960663) SHA1(e98149bc4652ea7933ac47d760a6f7e6489f15e2) ) |
| 4732 | | ROM_LOAD( "dt1cg4.14d", 0x800000, 0x200000, CRC(424b9652) SHA1(fa8865110db03559740c4e633e123d1a009782c4) ) |
| 4733 | | ROM_LOAD( "dt1cg5.16d", 0xa00000, 0x200000, CRC(29516626) SHA1(1f12c5dc3975b88dc60d87d0409bf311837e9fa4) ) |
| 4734 | | ROM_LOAD( "dt1cg6.18d", 0xc00000, 0x200000, CRC(e6fa7180) SHA1(85316cde282cff1f913cf9f155cfa36adcc1108e) ) |
| 4735 | | ROM_LOAD( "dt1cg7.19d", 0xe00000, 0x200000, CRC(2ca19153) SHA1(c82403c8b40bf85daedf610b1bc7bfea9dfc6206) ) |
| 4731 | ROM_LOAD( "dt1cg0.8d", 0x000000, 0x200000, CRC(10ab95e0) SHA1(ffde1f00ac3e82a36fbcfa060c6b97c92dfcfc8b) ) |
| 4732 | ROM_LOAD( "dt1cg1.10d", 0x200000, 0x200000, CRC(d9f1ba53) SHA1(5a1095b726c55001cc1d4c695adc38097e6a0201) ) |
| 4733 | ROM_LOAD( "dt1cg2.12d", 0x400000, 0x200000, CRC(bd8b1e0b) SHA1(fcd94e33a0cbd17c9308cb8952e3c618ab56f9fc) ) |
| 4734 | ROM_LOAD( "dt1cg3.13d", 0x600000, 0x200000, CRC(ba960663) SHA1(e98149bc4652ea7933ac47d760a6f7e6489f15e2) ) |
| 4735 | ROM_LOAD( "dt1cg4.14d", 0x800000, 0x200000, CRC(424b9652) SHA1(fa8865110db03559740c4e633e123d1a009782c4) ) |
| 4736 | ROM_LOAD( "dt1cg5.16d", 0xa00000, 0x200000, CRC(29516626) SHA1(1f12c5dc3975b88dc60d87d0409bf311837e9fa4) ) |
| 4737 | ROM_LOAD( "dt1cg6.18d", 0xc00000, 0x200000, CRC(e6fa7180) SHA1(85316cde282cff1f913cf9f155cfa36adcc1108e) ) |
| 4738 | ROM_LOAD( "dt1cg7.19d", 0xe00000, 0x200000, CRC(2ca19153) SHA1(c82403c8b40bf85daedf610b1bc7bfea9dfc6206) ) |
| 4736 | 4739 | |
| 4737 | 4740 | ROM_REGION16_LE( 0x280000, "textilemap", 0 ) /* texture tilemap */ |
| 4738 | | ROM_LOAD( "dt1ccrl.3d", 0x000000, 0x200000, CRC(e536b313) SHA1(7357da993d2bb3fcc8c1c2feb53689ad368cd80a) ) |
| 4739 | | ROM_LOAD( "dt1ccrh.1d", 0x200000, 0x080000, CRC(af257064) SHA1(0da561d9f8824618c00209ccef6146e9f3ad72bb) ) |
| 4741 | ROM_LOAD( "dt1ccrl.3d", 0x000000, 0x200000, CRC(e536b313) SHA1(7357da993d2bb3fcc8c1c2feb53689ad368cd80a) ) |
| 4742 | ROM_LOAD( "dt1ccrh.1d", 0x200000, 0x080000, CRC(af257064) SHA1(0da561d9f8824618c00209ccef6146e9f3ad72bb) ) |
| 4740 | 4743 | |
| 4741 | 4744 | ROM_REGION( 0x600000, "pointrom", 0 ) /* 3d model data */ |
| 4742 | | ROM_LOAD( "dt1ptrl0.18k", 0x000000, 0x080000, CRC(4e0cac3a) SHA1(c2778e9e93be2de729c6f118caf62ac9f48efbb0) ) |
| 4743 | | ROM_LOAD( "dt1ptrl1.16k", 0x080000, 0x080000, CRC(59ba9dba) SHA1(a2e9488cf0ff255284c06a1ef653ae86c0d98adc) ) |
| 4744 | | ROM_LOAD( "dt1ptrl2.15k", 0x100000, 0x080000, CRC(cfe80c67) SHA1(ba3bc48aa39712e63c915070a76974fbd560dee6) ) |
| 4745 | | ROM_LOAD( "dt1ptrm0.18j", 0x180000, 0x080000, CRC(41f34337) SHA1(7e624e7b6fdefe156168b1c9cc5e919db3b2fbaa) ) |
| 4746 | | ROM_LOAD( "dt1ptrm1.16j", 0x200000, 0x080000, CRC(d68541fc) SHA1(6b00079bd8f2db26e71968de289cea93458aebe9) ) |
| 4747 | | ROM_LOAD( "dt1ptrm2.15j", 0x280000, 0x080000, CRC(71e6714d) SHA1(6aad6db3be5020213d7add61c7d927ae9c4fea4e) ) |
| 4748 | | ROM_LOAD( "dt1ptru0.18f", 0x300000, 0x080000, CRC(4909bd7d) SHA1(0e4ef3987c43ef0438331b82b50dcc97363a45d0) ) |
| 4749 | | ROM_LOAD( "dt1ptru1.16f", 0x380000, 0x080000, CRC(4a5097df) SHA1(a9c814b0ed4bd92accd0e57be8e3d887114b06a5) ) |
| 4750 | | ROM_LOAD( "dt1ptru2.15f", 0x400000, 0x080000, CRC(1171eaf5) SHA1(168365ea619386f218585c49025cdd7fd1224082) ) |
| 4745 | ROM_LOAD( "dt1ptrl0.18k", 0x000000, 0x080000, CRC(4e0cac3a) SHA1(c2778e9e93be2de729c6f118caf62ac9f48efbb0) ) |
| 4746 | ROM_LOAD( "dt1ptrl1.16k", 0x080000, 0x080000, CRC(59ba9dba) SHA1(a2e9488cf0ff255284c06a1ef653ae86c0d98adc) ) |
| 4747 | ROM_LOAD( "dt1ptrl2.15k", 0x100000, 0x080000, CRC(cfe80c67) SHA1(ba3bc48aa39712e63c915070a76974fbd560dee6) ) |
| 4748 | ROM_LOAD( "dt1ptrm0.18j", 0x180000, 0x080000, CRC(41f34337) SHA1(7e624e7b6fdefe156168b1c9cc5e919db3b2fbaa) ) |
| 4749 | ROM_LOAD( "dt1ptrm1.16j", 0x200000, 0x080000, CRC(d68541fc) SHA1(6b00079bd8f2db26e71968de289cea93458aebe9) ) |
| 4750 | ROM_LOAD( "dt1ptrm2.15j", 0x280000, 0x080000, CRC(71e6714d) SHA1(6aad6db3be5020213d7add61c7d927ae9c4fea4e) ) |
| 4751 | ROM_LOAD( "dt1ptru0.18f", 0x300000, 0x080000, CRC(4909bd7d) SHA1(0e4ef3987c43ef0438331b82b50dcc97363a45d0) ) |
| 4752 | ROM_LOAD( "dt1ptru1.16f", 0x380000, 0x080000, CRC(4a5097df) SHA1(a9c814b0ed4bd92accd0e57be8e3d887114b06a5) ) |
| 4753 | ROM_LOAD( "dt1ptru2.15f", 0x400000, 0x080000, CRC(1171eaf5) SHA1(168365ea619386f218585c49025cdd7fd1224082) ) |
| 4751 | 4754 | |
| 4752 | 4755 | ROM_REGION( 0x1000000, "c352", 0 ) /* sound samples */ |
| 4753 | | ROM_LOAD( "dt1wavea.2l", 0x000000, 0x400000, CRC(cbd52e40) SHA1(dc995dd919548c96a90efb0375e5b5f1055e05cb) ) |
| 4754 | | ROM_LOAD( "dt1waveb.1l", 0x400000, 0x400000, CRC(6b736f94) SHA1(ac3715480aa9a9c2dec099607f89859bb3b73a6a) ) |
| 4756 | ROM_LOAD( "dt1wavea.2l", 0x000000, 0x400000, CRC(cbd52e40) SHA1(dc995dd919548c96a90efb0375e5b5f1055e05cb) ) |
| 4757 | ROM_LOAD( "dt1waveb.1l", 0x400000, 0x400000, CRC(6b736f94) SHA1(ac3715480aa9a9c2dec099607f89859bb3b73a6a) ) |
| 4755 | 4758 | ROM_END |
| 4756 | 4759 | |
| 4757 | 4760 | ROM_START( aquajet ) |
| r11160 | r11161 | |
| 4770 | 4773 | ROM_REGION( 0x80000, "mcu", ROMREGION_ERASE00 ) /* BIOS */ |
| 4771 | 4774 | |
| 4772 | 4775 | ROM_REGION16_LE( 0x080000, "user4", 0 ) /* MCU BIOS */ |
| 4773 | | ROM_LOAD( "aj1data.8k", 0x000000, 0x080000, CRC(52bcc6d5) SHA1(25319ea6db35cc9bdcb39cc83d597a2a9f1690f3) ) |
| 4776 | ROM_LOAD( "aj1data.8k", 0x000000, 0x080000, CRC(52bcc6d5) SHA1(25319ea6db35cc9bdcb39cc83d597a2a9f1690f3) ) |
| 4774 | 4777 | |
| 4775 | 4778 | ROM_REGION( 0x800000, "sprite", 0 ) /* 32x32x8bpp sprite tiles */ |
| 4776 | | ROM_LOAD( "aj1scg0.12f", 0x000000, 0x200000, CRC(13ea766c) SHA1(a1a259bd8f468b90cbc891f1c2875fe03bba9802) ) |
| 4777 | | ROM_LOAD( "aj1scg1.10f", 0x200000, 0x200000, CRC(cb3638de) SHA1(0af99aaf00782036d7f479b00b0c3d9d7ad4fc37) ) |
| 4778 | | ROM_LOAD( "aj1scg2.8f", 0x400000, 0x200000, CRC(1048a09b) SHA1(6859533e24db5ac54e28d480aaac7b411a648dfe) ) |
| 4779 | ROM_LOAD( "aj1scg0.12f", 0x000000, 0x200000, CRC(13ea766c) SHA1(a1a259bd8f468b90cbc891f1c2875fe03bba9802) ) |
| 4780 | ROM_LOAD( "aj1scg1.10f", 0x200000, 0x200000, CRC(cb3638de) SHA1(0af99aaf00782036d7f479b00b0c3d9d7ad4fc37) ) |
| 4781 | ROM_LOAD( "aj1scg2.8f", 0x400000, 0x200000, CRC(1048a09b) SHA1(6859533e24db5ac54e28d480aaac7b411a648dfe) ) |
| 4779 | 4782 | |
| 4780 | 4783 | ROM_REGION( 0x200000*8, "textile", 0) /* 16x16x8bpp texture tiles */ |
| 4781 | | ROM_LOAD( "aj1cg0.8d", 0x000000, 0x200000, CRC(b814e1eb) SHA1(1af29897dcfd0a58743b4fcdd5049d9e6e3d4cbd) ) |
| 4782 | | ROM_LOAD( "aj1cg1.10d", 0x200000, 0x200000, CRC(dc63d496) SHA1(d3c3eea6b134850004062dd513c0f26096101227) ) |
| 4783 | | ROM_LOAD( "aj1cg2.12d", 0x400000, 0x200000, CRC(71fbb571) SHA1(40f84ab5a4a7bb4438fb53751762609671d17800) ) |
| 4784 | | ROM_LOAD( "aj1cg3.13d", 0x600000, 0x200000, CRC(e28052e2) SHA1(3dbc446d7a13312ed4c1d20c2e1209947853f2c4) ) |
| 4785 | | ROM_LOAD( "aj1cg4.14d", 0x800000, 0x200000, CRC(c77ae1a0) SHA1(e15f2ccbadb8634f6e5cfd2cf48f428d68bd92e1) ) |
| 4786 | | ROM_LOAD( "aj1cg5.16d", 0xa00000, 0x200000, CRC(15be0080) SHA1(ca14dfd2a66996f0b32fa1155c04f21d300e8f30) ) |
| 4787 | | ROM_LOAD( "aj1cg6.18d", 0xc00000, 0x200000, CRC(1a4f733a) SHA1(60a991f06e73667fa2c9016189999c4301cba24f) ) |
| 4788 | | ROM_LOAD( "aj1cg7.19d", 0xe00000, 0x200000, CRC(ea118130) SHA1(24ef22e5c8c6f6e8a01c72466be1e7acbfba63bc) ) |
| 4784 | ROM_LOAD( "aj1cg0.8d", 0x000000, 0x200000, CRC(b814e1eb) SHA1(1af29897dcfd0a58743b4fcdd5049d9e6e3d4cbd) ) |
| 4785 | ROM_LOAD( "aj1cg1.10d", 0x200000, 0x200000, CRC(dc63d496) SHA1(d3c3eea6b134850004062dd513c0f26096101227) ) |
| 4786 | ROM_LOAD( "aj1cg2.12d", 0x400000, 0x200000, CRC(71fbb571) SHA1(40f84ab5a4a7bb4438fb53751762609671d17800) ) |
| 4787 | ROM_LOAD( "aj1cg3.13d", 0x600000, 0x200000, CRC(e28052e2) SHA1(3dbc446d7a13312ed4c1d20c2e1209947853f2c4) ) |
| 4788 | ROM_LOAD( "aj1cg4.14d", 0x800000, 0x200000, CRC(c77ae1a0) SHA1(e15f2ccbadb8634f6e5cfd2cf48f428d68bd92e1) ) |
| 4789 | ROM_LOAD( "aj1cg5.16d", 0xa00000, 0x200000, CRC(15be0080) SHA1(ca14dfd2a66996f0b32fa1155c04f21d300e8f30) ) |
| 4790 | ROM_LOAD( "aj1cg6.18d", 0xc00000, 0x200000, CRC(1a4f733a) SHA1(60a991f06e73667fa2c9016189999c4301cba24f) ) |
| 4791 | ROM_LOAD( "aj1cg7.19d", 0xe00000, 0x200000, CRC(ea118130) SHA1(24ef22e5c8c6f6e8a01c72466be1e7acbfba63bc) ) |
| 4789 | 4792 | |
| 4790 | 4793 | ROM_REGION16_LE( 0x280000, "textilemap", 0 ) /* texture tilemap */ |
| 4791 | | ROM_LOAD( "aj1ccrl.3d", 0x000000, 0x200000, CRC(3cc7a247) SHA1(336e4dd506d932987e20a5890dd3b0db75c02ccf) ) |
| 4792 | | ROM_LOAD( "aj1ccrh.1d", 0x200000, 0x080000, CRC(9d936030) SHA1(a383bcca494a9f8d9a08fbe9940c8071d4525d65) ) |
| 4794 | ROM_LOAD( "aj1ccrl.3d", 0x000000, 0x200000, CRC(3cc7a247) SHA1(336e4dd506d932987e20a5890dd3b0db75c02ccf) ) |
| 4795 | ROM_LOAD( "aj1ccrh.1d", 0x200000, 0x080000, CRC(9d936030) SHA1(a383bcca494a9f8d9a08fbe9940c8071d4525d65) ) |
| 4793 | 4796 | |
| 4794 | 4797 | ROM_REGION( 0x600000, "pointrom", 0 ) /* 3d model data */ |
| 4795 | | ROM_LOAD( "aj1ptrl0.18k", 0x000000, 0x080000, CRC(16205d45) SHA1(7e9681af852e2e875f80cbbe350e4982eaf80884) ) |
| 4796 | | ROM_LOAD( "aj1ptrl1.16k", 0x080000, 0x080000, CRC(6f114da7) SHA1(a1e7349ef8eb0ef043fce06f88bfbb76c2967393) ) |
| 4797 | | ROM_LOAD( "aj1ptrl2.15k", 0x100000, 0x080000, CRC(719b73f0) SHA1(bf8530a706097ae663769090177f1f259c540aa6) ) |
| 4798 | | ROM_LOAD( "aj1ptrl3.14k", 0x180000, 0x080000, CRC(9555fe31) SHA1(03bdd0784817191b3600d643b775191181a21706) ) |
| 4799 | | ROM_LOAD( "aj1ptrm0.18j", 0x200000, 0x080000, CRC(89bee2e0) SHA1(d84b06ef1318814fcf4782fef09a85ae1a87beb8) ) |
| 4800 | | ROM_LOAD( "aj1ptrm1.16j", 0x280000, 0x080000, CRC(0ecf88c7) SHA1(20b7cb09a6a13599cac024ef19c73612ce2952f6) ) |
| 4801 | | ROM_LOAD( "aj1ptrm2.15j", 0x300000, 0x080000, CRC(829bc7ba) SHA1(7104d66a027911e38ecf521f01ff098ccb76d5fb) ) |
| 4802 | | ROM_LOAD( "aj1ptrm3.14j", 0x380000, 0x080000, CRC(7d0a222a) SHA1(e78c405d00429580015c6c7d1bcd35393317a769) ) |
| 4803 | | ROM_LOAD( "aj1ptru0.18f", 0x400000, 0x080000, CRC(90d4e36a) SHA1(bdc44aac6aef5266d289f03c816aa2abdb263e9b) ) |
| 4804 | | ROM_LOAD( "aj1ptru1.16f", 0x480000, 0x080000, CRC(bf0cf4bf) SHA1(bbf06c7605c083d2fb8c72528c5c9d3b8b067073) ) |
| 4805 | | ROM_LOAD( "aj1ptru2.15f", 0x500000, 0x080000, CRC(91ffbb77) SHA1(fbfe7d32ef22037f7190d1b8263b5e8c55f2d892) ) |
| 4806 | | ROM_LOAD( "aj1ptru3.14f", 0x580000, 0x080000, CRC(d83d8d42) SHA1(e1561ce4538b01db92b7e645ad008cd1a2ddaf8a) ) |
| 4798 | ROM_LOAD( "aj1ptrl0.18k", 0x000000, 0x080000, CRC(16205d45) SHA1(7e9681af852e2e875f80cbbe350e4982eaf80884) ) |
| 4799 | ROM_LOAD( "aj1ptrl1.16k", 0x080000, 0x080000, CRC(6f114da7) SHA1(a1e7349ef8eb0ef043fce06f88bfbb76c2967393) ) |
| 4800 | ROM_LOAD( "aj1ptrl2.15k", 0x100000, 0x080000, CRC(719b73f0) SHA1(bf8530a706097ae663769090177f1f259c540aa6) ) |
| 4801 | ROM_LOAD( "aj1ptrl3.14k", 0x180000, 0x080000, CRC(9555fe31) SHA1(03bdd0784817191b3600d643b775191181a21706) ) |
| 4802 | ROM_LOAD( "aj1ptrm0.18j", 0x200000, 0x080000, CRC(89bee2e0) SHA1(d84b06ef1318814fcf4782fef09a85ae1a87beb8) ) |
| 4803 | ROM_LOAD( "aj1ptrm1.16j", 0x280000, 0x080000, CRC(0ecf88c7) SHA1(20b7cb09a6a13599cac024ef19c73612ce2952f6) ) |
| 4804 | ROM_LOAD( "aj1ptrm2.15j", 0x300000, 0x080000, CRC(829bc7ba) SHA1(7104d66a027911e38ecf521f01ff098ccb76d5fb) ) |
| 4805 | ROM_LOAD( "aj1ptrm3.14j", 0x380000, 0x080000, CRC(7d0a222a) SHA1(e78c405d00429580015c6c7d1bcd35393317a769) ) |
| 4806 | ROM_LOAD( "aj1ptru0.18f", 0x400000, 0x080000, CRC(90d4e36a) SHA1(bdc44aac6aef5266d289f03c816aa2abdb263e9b) ) |
| 4807 | ROM_LOAD( "aj1ptru1.16f", 0x480000, 0x080000, CRC(bf0cf4bf) SHA1(bbf06c7605c083d2fb8c72528c5c9d3b8b067073) ) |
| 4808 | ROM_LOAD( "aj1ptru2.15f", 0x500000, 0x080000, CRC(91ffbb77) SHA1(fbfe7d32ef22037f7190d1b8263b5e8c55f2d892) ) |
| 4809 | ROM_LOAD( "aj1ptru3.14f", 0x580000, 0x080000, CRC(d83d8d42) SHA1(e1561ce4538b01db92b7e645ad008cd1a2ddaf8a) ) |
| 4807 | 4810 | |
| 4808 | 4811 | ROM_REGION( 0x1000000, "c352", 0 ) /* sound samples */ |
| 4809 | | ROM_LOAD( "aj1wavea.2l", 0x000000, 0x400000, CRC(8c72ea59) SHA1(3ae8dbd8baae08f1daab2b218932ba9d9451231d) ) |
| 4810 | | ROM_LOAD( "aj1waveb.1l", 0x800000, 0x400000, CRC(ab5a457f) SHA1(c34531fd574eb0c3e78fc31a9af8658df3446adc) ) |
| 4812 | ROM_LOAD( "aj1wavea.2l", 0x000000, 0x400000, CRC(8c72ea59) SHA1(3ae8dbd8baae08f1daab2b218932ba9d9451231d) ) |
| 4813 | ROM_LOAD( "aj1waveb.1l", 0x800000, 0x400000, CRC(ab5a457f) SHA1(c34531fd574eb0c3e78fc31a9af8658df3446adc) ) |
| 4811 | 4814 | ROM_END |
| 4812 | 4815 | |
| 4813 | 4816 | /*******************************************************************/ |
| r11160 | r11161 | |
| 5287 | 5290 | |
| 5288 | 5291 | static CUSTOM_INPUT( acedrvr_shift_read ) |
| 5289 | 5292 | { |
| 5293 | namcos22_state *state = field->port->machine().driver_data<namcos22_state>(); |
| 5290 | 5294 | int shift = input_port_read(field->port->machine(), "SHIFT"); |
| 5291 | 5295 | |
| 5292 | | if (shift > 0 && shift != prev_stick_state) |
| 5296 | if (shift > 0 && shift != state->m_prev_stick_state) |
| 5293 | 5297 | { |
| 5294 | | prev_stick_state = shift; |
| 5298 | state->m_prev_stick_state = shift; |
| 5295 | 5299 | |
| 5296 | 5300 | switch (shift) |
| 5297 | 5301 | { |
| 5298 | 5302 | case 0x01: |
| 5299 | | stick_input = 0x01; |
| 5303 | state->m_stick_input = 0x01; |
| 5300 | 5304 | break; |
| 5301 | 5305 | case 0x02: |
| 5302 | | stick_input = 0x03; |
| 5306 | state->m_stick_input = 0x03; |
| 5303 | 5307 | break; |
| 5304 | 5308 | case 0x04: |
| 5305 | | stick_input = 0x02; |
| 5309 | state->m_stick_input = 0x02; |
| 5306 | 5310 | break; |
| 5307 | 5311 | } |
| 5308 | 5312 | } |
| 5309 | 5313 | |
| 5310 | | return stick_input; |
| 5314 | return state->m_stick_input; |
| 5311 | 5315 | } |
| 5312 | 5316 | |
| 5313 | 5317 | static INPUT_PORTS_START( acedrvr ) |
| r11160 | r11161 | |
| 5467 | 5471 | |
| 5468 | 5472 | static CUSTOM_INPUT( ridger_gear_read ) |
| 5469 | 5473 | { |
| 5474 | namcos22_state *state = field->port->machine().driver_data<namcos22_state>(); |
| 5470 | 5475 | int gear = input_port_read(field->port->machine(), "GEARS"); |
| 5471 | 5476 | |
| 5472 | | if (gear > 0 && gear != prev_stick_state) |
| 5477 | if (gear > 0 && gear != state->m_prev_stick_state) |
| 5473 | 5478 | { |
| 5474 | | prev_stick_state = gear; |
| 5479 | state->m_prev_stick_state = gear; |
| 5475 | 5480 | |
| 5476 | 5481 | switch (gear) |
| 5477 | 5482 | { |
| 5478 | 5483 | case 0x01: |
| 5479 | | stick_input = 0x0a; |
| 5484 | state->m_stick_input = 0x0a; |
| 5480 | 5485 | break; |
| 5481 | 5486 | case 0x02: |
| 5482 | | stick_input = 0x09; |
| 5487 | state->m_stick_input = 0x09; |
| 5483 | 5488 | break; |
| 5484 | 5489 | case 0x04: |
| 5485 | | stick_input = 0x0e; |
| 5490 | state->m_stick_input = 0x0e; |
| 5486 | 5491 | break; |
| 5487 | 5492 | case 0x08: |
| 5488 | | stick_input = 0x0d; |
| 5493 | state->m_stick_input = 0x0d; |
| 5489 | 5494 | break; |
| 5490 | 5495 | case 0x10: |
| 5491 | | stick_input = 0x06; |
| 5496 | state->m_stick_input = 0x06; |
| 5492 | 5497 | break; |
| 5493 | 5498 | case 0x20: |
| 5494 | | stick_input = 0x05; |
| 5499 | state->m_stick_input = 0x05; |
| 5495 | 5500 | break; |
| 5496 | 5501 | } |
| 5497 | 5502 | } |
| 5498 | 5503 | |
| 5499 | | return stick_input; |
| 5504 | return state->m_stick_input; |
| 5500 | 5505 | } |
| 5501 | 5506 | |
| 5502 | 5507 | static INPUT_PORTS_START( ridgera ) |
| r11160 | r11161 | |
| 5735 | 5740 | /*****************************************************************************************************/ |
| 5736 | 5741 | |
| 5737 | 5742 | // MCU speed cheats (every bit helps with these games) |
| 5738 | | static UINT16 su_82; |
| 5739 | 5743 | |
| 5740 | 5744 | // for MCU BIOS v1.41 |
| 5741 | 5745 | static READ16_HANDLER( mcu141_speedup_r ) |
| 5742 | 5746 | { |
| 5743 | | if ((cpu_get_pc(&space->device()) == 0xc12d) && (!(su_82 & 0xff00))) |
| 5747 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 5748 | if ((cpu_get_pc(&space->device()) == 0xc12d) && (!(state->m_su_82 & 0xff00))) |
| 5744 | 5749 | { |
| 5745 | 5750 | device_spin_until_interrupt(&space->device()); |
| 5746 | 5751 | } |
| 5747 | 5752 | |
| 5748 | | return su_82; |
| 5753 | return state->m_su_82; |
| 5749 | 5754 | } |
| 5750 | 5755 | |
| 5751 | 5756 | static WRITE16_HANDLER( mcu_speedup_w ) |
| 5752 | 5757 | { |
| 5753 | | COMBINE_DATA(&su_82); |
| 5758 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 5759 | COMBINE_DATA(&state->m_su_82); |
| 5754 | 5760 | } |
| 5755 | 5761 | |
| 5756 | 5762 | // for MCU BIOS v1.30 |
| 5757 | 5763 | static READ16_HANDLER( mcu130_speedup_r ) |
| 5758 | 5764 | { |
| 5759 | | if ((cpu_get_pc(&space->device()) == 0xc12a) && (!(su_82 & 0xff00))) |
| 5765 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 5766 | if ((cpu_get_pc(&space->device()) == 0xc12a) && (!(state->m_su_82 & 0xff00))) |
| 5760 | 5767 | { |
| 5761 | 5768 | device_spin_until_interrupt(&space->device()); |
| 5762 | 5769 | } |
| 5763 | 5770 | |
| 5764 | | return su_82; |
| 5771 | return state->m_su_82; |
| 5765 | 5772 | } |
| 5766 | 5773 | |
| 5767 | 5774 | // for NSTX7702 v1.00 (C74) |
| 5768 | 5775 | static READ16_HANDLER( mcuc74_speedup_r ) |
| 5769 | 5776 | { |
| 5770 | | if (((cpu_get_pc(&space->device()) == 0xc0df) || (cpu_get_pc(&space->device()) == 0xc101)) && (!(su_82 & 0xff00))) |
| 5777 | namcos22_state *state = space->machine().driver_data<namcos22_state>(); |
| 5778 | if (((cpu_get_pc(&space->device()) == 0xc0df) || (cpu_get_pc(&space->device()) == 0xc101)) && (!(state->m_su_82 & 0xff00))) |
| 5771 | 5779 | { |
| 5772 | 5780 | device_spin_until_interrupt(&space->device()); |
| 5773 | 5781 | } |
| 5774 | 5782 | |
| 5775 | | return su_82; |
| 5783 | return state->m_su_82; |
| 5776 | 5784 | } |
| 5777 | 5785 | |
| 5778 | 5786 | static void install_c74_speedup(running_machine &machine) |
| r11160 | r11161 | |
| 5792 | 5800 | machine.device("mcu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x82, 0x83, FUNC(mcu141_speedup_r), FUNC(mcu_speedup_w)); |
| 5793 | 5801 | } |
| 5794 | 5802 | |
| 5795 | | static void namcos22_init( running_machine &machine, enum namcos22_gametype game_type ) |
| 5803 | static void namcos22_init( running_machine &machine, int game_type ) |
| 5796 | 5804 | { |
| 5797 | | namcos22_gametype = game_type; |
| 5798 | | mpPointRAM = auto_alloc_array(machine, UINT32, 0x20000); |
| 5805 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 5806 | state->m_gametype = game_type; |
| 5807 | state->m_mpPointRAM = auto_alloc_array(machine, UINT32, 0x20000); |
| 5799 | 5808 | } |
| 5800 | 5809 | |
| 5801 | | static void namcos22s_init( running_machine &machine, enum namcos22_gametype game_type ) |
| 5810 | static void namcos22s_init( running_machine &machine, int game_type ) |
| 5802 | 5811 | { |
| 5803 | 5812 | namcos22_init(machine, game_type); |
| 5804 | 5813 | mSpotRAM.RAM = auto_alloc_array(machine, UINT16, SPOTRAM_SIZE); |
| r11160 | r11161 | |
| 5866 | 5875 | |
| 5867 | 5876 | static DRIVER_INIT( ridgeraj ) |
| 5868 | 5877 | { |
| 5878 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 5869 | 5879 | namcos22_init(machine, NAMCOS22_RIDGE_RACER); |
| 5870 | 5880 | |
| 5871 | 5881 | install_c74_speedup(machine); |
| 5872 | 5882 | |
| 5873 | | old_coin_state = 0; |
| 5874 | | credits1 = credits2 = 0; |
| 5875 | | stick_input = 0xa; |
| 5883 | state->m_old_coin_state = 0; |
| 5884 | state->m_credits1 = state->m_credits2 = 0; |
| 5885 | state->m_stick_input = 0xa; |
| 5876 | 5886 | } |
| 5877 | 5887 | |
| 5878 | 5888 | static DRIVER_INIT( ridger2j ) |
| 5879 | 5889 | { |
| 5890 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 5880 | 5891 | namcos22_init(machine, NAMCOS22_RIDGE_RACER2); |
| 5881 | 5892 | |
| 5882 | 5893 | install_c74_speedup(machine); |
| 5883 | 5894 | |
| 5884 | | old_coin_state = 0; |
| 5885 | | credits1 = credits2 = 0; |
| 5886 | | stick_input = 0xa; |
| 5895 | state->m_old_coin_state = 0; |
| 5896 | state->m_credits1 = state->m_credits2 = 0; |
| 5897 | state->m_stick_input = 0xa; |
| 5887 | 5898 | } |
| 5888 | 5899 | |
| 5889 | 5900 | static DRIVER_INIT( acedrvr ) |
| 5890 | 5901 | { |
| 5902 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 5891 | 5903 | namcos22_init(machine, NAMCOS22_ACE_DRIVER); |
| 5892 | 5904 | |
| 5893 | 5905 | install_c74_speedup(machine); |
| 5894 | 5906 | |
| 5895 | | old_coin_state = 0; |
| 5896 | | credits1 = credits2 = 0; |
| 5897 | | stick_input = 0x3; |
| 5907 | state->m_old_coin_state = 0; |
| 5908 | state->m_credits1 = state->m_credits2 = 0; |
| 5909 | state->m_stick_input = 0x3; |
| 5898 | 5910 | } |
| 5899 | 5911 | |
| 5900 | 5912 | static DRIVER_INIT( victlap ) |
| 5901 | 5913 | { |
| 5914 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 5902 | 5915 | namcos22_init(machine, NAMCOS22_VICTORY_LAP); |
| 5903 | 5916 | |
| 5904 | 5917 | install_c74_speedup(machine); |
| 5905 | 5918 | |
| 5906 | | old_coin_state = 0; |
| 5907 | | credits1 = credits2 = 0; |
| 5908 | | stick_input = 0x3; |
| 5919 | state->m_old_coin_state = 0; |
| 5920 | state->m_credits1 = state->m_credits2 = 0; |
| 5921 | state->m_stick_input = 0x3; |
| 5909 | 5922 | } |
| 5910 | 5923 | |
| 5911 | 5924 | static DRIVER_INIT( raveracw ) |
| 5912 | 5925 | { |
| 5926 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 5913 | 5927 | namcos22_init(machine, NAMCOS22_RAVE_RACER); |
| 5914 | 5928 | |
| 5915 | 5929 | install_c74_speedup(machine); |
| 5916 | 5930 | |
| 5917 | | old_coin_state = 0; |
| 5918 | | credits1 = credits2 = 0; |
| 5919 | | stick_input = 0xa; |
| 5931 | state->m_old_coin_state = 0; |
| 5932 | state->m_credits1 = state->m_credits2 = 0; |
| 5933 | state->m_stick_input = 0xa; |
| 5920 | 5934 | } |
| 5921 | 5935 | |
| 5922 | 5936 | static DRIVER_INIT( cybrcomm ) |
| 5923 | 5937 | { |
| 5938 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 5924 | 5939 | UINT32 *pROM = (UINT32 *)machine.region("maincpu")->base(); |
| 5925 | 5940 | pROM[0x18ade8/4] = 0x4e714e71; |
| 5926 | 5941 | pROM[0x18ae38/4] = 0x4e714e71; |
| r11160 | r11161 | |
| 5932 | 5947 | |
| 5933 | 5948 | install_c74_speedup(machine); |
| 5934 | 5949 | |
| 5935 | | old_coin_state = 0; |
| 5936 | | credits1 = credits2 = 0; |
| 5950 | state->m_old_coin_state = 0; |
| 5951 | state->m_credits1 = state->m_credits2 = 0; |
| 5937 | 5952 | } |
| 5938 | 5953 | |
| 5939 | 5954 | static DRIVER_INIT( cybrcyc ) |
src/mame/drivers/galaxold.c
| r11160 | r11161 | |
| 410 | 410 | static ADDRESS_MAP_START( galaxold_map, AS_PROGRAM, 8 ) |
| 411 | 411 | AM_RANGE(0x0000, 0x3fff) AM_ROM |
| 412 | 412 | AM_RANGE(0x4000, 0x47ff) AM_RAM |
| 413 | | AM_RANGE(0x5000, 0x53ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) |
| 413 | AM_RANGE(0x5000, 0x53ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) |
| 414 | 414 | AM_RANGE(0x5400, 0x57ff) AM_READ(galaxold_videoram_r) |
| 415 | | AM_RANGE(0x5800, 0x583f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) |
| 416 | | AM_RANGE(0x5840, 0x585f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) |
| 417 | | AM_RANGE(0x5860, 0x587f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) |
| 415 | AM_RANGE(0x5800, 0x583f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) |
| 416 | AM_RANGE(0x5840, 0x585f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) |
| 417 | AM_RANGE(0x5860, 0x587f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) |
| 418 | 418 | AM_RANGE(0x5880, 0x58ff) AM_RAM |
| 419 | 419 | AM_RANGE(0x6000, 0x6000) AM_READ_PORT("IN0") |
| 420 | 420 | AM_RANGE(0x6000, 0x6001) AM_WRITE(galaxold_leds_w) |
| r11160 | r11161 | |
| 440 | 440 | static ADDRESS_MAP_START( mooncrst_map, AS_PROGRAM, 8 ) |
| 441 | 441 | AM_RANGE(0x0000, 0x5fff) AM_ROM |
| 442 | 442 | AM_RANGE(0x8000, 0x87ff) AM_RAM |
| 443 | | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) |
| 443 | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) |
| 444 | 444 | AM_RANGE(0x9400, 0x97ff) AM_READ(galaxold_videoram_r) |
| 445 | | AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) |
| 446 | | AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) |
| 447 | | AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) |
| 445 | AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) |
| 446 | AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) |
| 447 | AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) |
| 448 | 448 | AM_RANGE(0x9880, 0x98ff) AM_RAM |
| 449 | 449 | AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0") |
| 450 | 450 | AM_RANGE(0xa003, 0xa003) AM_WRITE(galaxold_coin_counter_w) |
| r11160 | r11161 | |
| 465 | 465 | |
| 466 | 466 | static ADDRESS_MAP_START( rockclim_map, AS_PROGRAM, 8 ) |
| 467 | 467 | AM_RANGE(0x0000, 0x3fff) AM_ROM |
| 468 | | AM_RANGE(0x4000, 0x47ff) AM_READWRITE(rockclim_videoram_r, rockclim_videoram_w) AM_BASE(&rockclim_videoram)//4800 - 4803 = bg scroll ? |
| 468 | AM_RANGE(0x4000, 0x47ff) AM_READWRITE(rockclim_videoram_r, rockclim_videoram_w) AM_BASE_MEMBER(galaxold_state, m_rockclim_videoram)//4800 - 4803 = bg scroll ? |
| 469 | 469 | AM_RANGE(0x4800, 0x4803) AM_WRITE(rockclim_scroll_w) |
| 470 | 470 | AM_RANGE(0x5000, 0x53ff) AM_RAM //? |
| 471 | 471 | AM_RANGE(0x5800, 0x5800) AM_READ_PORT("IN2") |
| 472 | 472 | AM_RANGE(0x6000, 0x7fff) AM_ROM |
| 473 | 473 | AM_RANGE(0x8000, 0x87ff) AM_RAM |
| 474 | 474 | AM_RANGE(0x8800, 0x8800) AM_READ_PORT("DSW1") |
| 475 | | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) |
| 475 | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) |
| 476 | 476 | AM_RANGE(0x9400, 0x97ff) AM_READ(galaxold_videoram_r) |
| 477 | | AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) |
| 478 | | AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) |
| 479 | | AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) |
| 477 | AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) |
| 478 | AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) |
| 479 | AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) |
| 480 | 480 | AM_RANGE(0x9880, 0x98ff) AM_RAM |
| 481 | 481 | AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0") |
| 482 | 482 | AM_RANGE(0xa000, 0xa002) AM_WRITE(galaxold_gfxbank_w)// a002 - sprite bank |
| r11160 | r11161 | |
| 498 | 498 | static ADDRESS_MAP_START( ckongg_map, AS_PROGRAM, 8 ) |
| 499 | 499 | AM_RANGE(0x0000, 0x5fff) AM_ROM |
| 500 | 500 | AM_RANGE(0x6000, 0x6fff) AM_RAM |
| 501 | | AM_RANGE(0x9000, 0x93ff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE(&galaxold_videoram) |
| 502 | | AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) |
| 503 | | AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) |
| 504 | | AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) |
| 501 | AM_RANGE(0x9000, 0x93ff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) |
| 502 | AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) |
| 503 | AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) |
| 504 | AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) |
| 505 | 505 | AM_RANGE(0x9880, 0x98ff) AM_RAM |
| 506 | 506 | AM_RANGE(0xc000, 0xc000) AM_READ_PORT("IN0") |
| 507 | 507 | AM_RANGE(0xc000, 0xc001) AM_WRITE(galaxold_leds_w) |
| r11160 | r11161 | |
| 525 | 525 | static ADDRESS_MAP_START( ckongmc_map, AS_PROGRAM, 8 ) |
| 526 | 526 | AM_RANGE(0x0000, 0x5fff) AM_ROM |
| 527 | 527 | AM_RANGE(0x6000, 0x6fff) AM_RAM |
| 528 | | AM_RANGE(0x9000, 0x93ff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE(&galaxold_videoram) |
| 529 | | AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) |
| 530 | | AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) |
| 531 | | AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) |
| 528 | AM_RANGE(0x9000, 0x93ff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) |
| 529 | AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) |
| 530 | AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) |
| 531 | AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) |
| 532 | 532 | AM_RANGE(0x9880, 0x98ff) AM_RAM |
| 533 | 533 | AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0") |
| 534 | 534 | AM_RANGE(0xa001, 0xa002) AM_WRITE(galaxold_leds_w) /* GUESS */ |
| r11160 | r11161 | |
| 552 | 552 | static ADDRESS_MAP_START( scramblb_map, AS_PROGRAM, 8 ) |
| 553 | 553 | AM_RANGE(0x0000, 0x3fff) AM_ROM |
| 554 | 554 | AM_RANGE(0x4000, 0x47ff) AM_RAM |
| 555 | | AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) |
| 556 | | AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) |
| 557 | | AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) |
| 558 | | AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) |
| 555 | AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) |
| 556 | AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) |
| 557 | AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) |
| 558 | AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) |
| 559 | 559 | AM_RANGE(0x5080, 0x50ff) AM_RAM |
| 560 | 560 | AM_RANGE(0x6000, 0x6000) AM_READ_PORT("IN0") |
| 561 | 561 | AM_RANGE(0x6000, 0x6001) AM_WRITENOP /* sound triggers */ |
| r11160 | r11161 | |
| 587 | 587 | static ADDRESS_MAP_START( scramb2_map, AS_PROGRAM, 8 ) |
| 588 | 588 | AM_RANGE(0x0000, 0x3fff) AM_ROM |
| 589 | 589 | AM_RANGE(0x4000, 0x47ff) AM_RAM |
| 590 | | AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) |
| 590 | AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) |
| 591 | 591 | AM_RANGE(0x4c00, 0x4fff) AM_WRITE(galaxold_videoram_w) // mirror |
| 592 | | AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) |
| 593 | | AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) |
| 594 | | AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) |
| 592 | AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) |
| 593 | AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) |
| 594 | AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) |
| 595 | 595 | AM_RANGE(0x5080, 0x50ff) AM_RAM |
| 596 | 596 | AM_RANGE(0x5800, 0x5fff) AM_READ(scramb2_protection_r) // must return 0x25 |
| 597 | 597 | AM_RANGE(0x6000, 0x6007) AM_READ(scramb2_port0_r) // reads from 8 addresses, 1 bit per address |
| r11160 | r11161 | |
| 612 | 612 | static ADDRESS_MAP_START( _4in1_map, AS_PROGRAM, 8 ) |
| 613 | 613 | AM_RANGE(0x0000, 0x3fff) AM_ROMBANK("bank1") /* banked game code */ |
| 614 | 614 | AM_RANGE(0x4000, 0x47ff) AM_RAM |
| 615 | | AM_RANGE(0x5000, 0x53ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) |
| 615 | AM_RANGE(0x5000, 0x53ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) |
| 616 | 616 | AM_RANGE(0x5400, 0x57ff) AM_READ(galaxold_videoram_r) |
| 617 | | AM_RANGE(0x5800, 0x583f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) |
| 618 | | AM_RANGE(0x5840, 0x585f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) |
| 619 | | AM_RANGE(0x5860, 0x587f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) |
| 617 | AM_RANGE(0x5800, 0x583f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) |
| 618 | AM_RANGE(0x5840, 0x585f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) |
| 619 | AM_RANGE(0x5860, 0x587f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) |
| 620 | 620 | AM_RANGE(0x5880, 0x58ff) AM_RAM |
| 621 | 621 | AM_RANGE(0x6000, 0x6000) AM_READ_PORT("IN0") |
| 622 | 622 | AM_RANGE(0x6000, 0x6001) AM_WRITE(galaxold_leds_w) |
| r11160 | r11161 | |
| 643 | 643 | static ADDRESS_MAP_START( bagmanmc_map, AS_PROGRAM, 8 ) |
| 644 | 644 | AM_RANGE(0x0000, 0x5fff) AM_ROM |
| 645 | 645 | AM_RANGE(0x6000, 0x67ff) AM_RAM |
| 646 | | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) |
| 646 | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) |
| 647 | 647 | AM_RANGE(0x9400, 0x97ff) AM_READ(galaxold_videoram_r) |
| 648 | | AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) |
| 649 | | AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) |
| 650 | | AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) |
| 648 | AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) |
| 649 | AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) |
| 650 | AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) |
| 651 | 651 | AM_RANGE(0x9880, 0x98ff) AM_RAM |
| 652 | 652 | AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0") |
| 653 | 653 | AM_RANGE(0xa003, 0xa003) AM_WRITE(galaxold_coin_counter_w) |
| r11160 | r11161 | |
| 665 | 665 | AM_RANGE(0x0000, 0x5fff) AM_ROM |
| 666 | 666 | AM_RANGE(0x6000, 0x6fff) AM_RAM |
| 667 | 667 | AM_RANGE(0x7000, 0x7fff) AM_ROM |
| 668 | | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) |
| 669 | | AM_RANGE(0x9800, 0x983f) AM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) |
| 670 | | AM_RANGE(0x9840, 0x987f) AM_WRITEONLY AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) |
| 671 | | AM_RANGE(0x98c0, 0x98ff) AM_WRITEONLY AM_BASE(&galaxold_spriteram2) AM_SIZE(&galaxold_spriteram2_size) |
| 668 | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) |
| 669 | AM_RANGE(0x9800, 0x983f) AM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) |
| 670 | AM_RANGE(0x9840, 0x987f) AM_WRITEONLY AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) |
| 671 | AM_RANGE(0x98c0, 0x98ff) AM_WRITEONLY AM_BASE_MEMBER(galaxold_state, m_spriteram2) AM_SIZE_MEMBER(galaxold_state, m_spriteram2_size) |
| 672 | 672 | AM_RANGE(0xa000, 0xa0ff) AM_READ_PORT("IN0") |
| 673 | 673 | AM_RANGE(0xa003, 0xa003) AM_WRITE(galaxold_coin_counter_w) |
| 674 | 674 | //AM_RANGE(0xa004, 0xa007) AM_WRITE(galaxian_lfo_freq_w) |
| r11160 | r11161 | |
| 691 | 691 | AM_RANGE(0x0000, 0x5fff) AM_ROM |
| 692 | 692 | AM_RANGE(0x7000, 0x7000) AM_READ_PORT("DSW0") /* mirror */ |
| 693 | 693 | AM_RANGE(0x8000, 0x87ff) AM_RAM |
| 694 | | AM_RANGE(0x8800, 0x883f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) |
| 695 | | AM_RANGE(0x8840, 0x885f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) |
| 696 | | AM_RANGE(0x8860, 0x887f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) |
| 694 | AM_RANGE(0x8800, 0x883f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) |
| 695 | AM_RANGE(0x8840, 0x885f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) |
| 696 | AM_RANGE(0x8860, 0x887f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) |
| 697 | 697 | AM_RANGE(0x8880, 0x8bff) AM_WRITENOP |
| 698 | | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) |
| 698 | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) |
| 699 | 699 | AM_RANGE(0x9800, 0x9800) AM_READ(watchdog_reset_r) |
| 700 | 700 | AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0") |
| 701 | 701 | AM_RANGE(0xa7ff, 0xa7ff) AM_READ_PORT("IN0") /* mirror */ |
| r11160 | r11161 | |
| 716 | 716 | AM_RANGE(0x0000, 0x5fff) AM_ROM |
| 717 | 717 | AM_RANGE(0x8000, 0x83ff) AM_RAM |
| 718 | 718 | AM_RANGE(0x8400, 0x87ff) AM_WRITENOP // not used |
| 719 | | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) |
| 719 | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) |
| 720 | 720 | AM_RANGE(0x9400, 0x97ff) AM_WRITENOP // not used |
| 721 | | AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) |
| 722 | | AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) |
| 723 | | AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) |
| 721 | AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) |
| 722 | AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) |
| 723 | AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) |
| 724 | 724 | AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0") |
| 725 | 725 | AM_RANGE(0xa800, 0xa800) AM_READ_PORT("IN1") |
| 726 | 726 | AM_RANGE(0xb000, 0xb000) AM_READ_PORT("DSW0") |
| r11160 | r11161 | |
| 742 | 742 | AM_RANGE(0x0000, 0x2fff) AM_ROM |
| 743 | 743 | AM_RANGE(0x4000, 0x4200) AM_RAM |
| 744 | 744 | AM_RANGE(0x4300, 0x43ff) AM_RAM |
| 745 | | AM_RANGE(0x4800, 0x4bff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE(&galaxold_videoram) |
| 745 | AM_RANGE(0x4800, 0x4bff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) |
| 746 | 746 | AM_RANGE(0x4c00, 0x4fff) AM_WRITE(galaxold_videoram_w) |
| 747 | | AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) |
| 748 | | AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) |
| 747 | AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) |
| 748 | AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) |
| 749 | 749 | AM_RANGE(0x6801, 0x6801) AM_WRITENOP //continuosly 0 and 1 |
| 750 | 750 | AM_RANGE(0x6802, 0x6802) AM_WRITE(galaxold_coin_counter_w) |
| 751 | 751 | AM_RANGE(0x6806, 0x6806) AM_WRITE(galaxold_flip_screen_x_w) |
| r11160 | r11161 | |
| 766 | 766 | AM_RANGE(0x0000, 0x1fff) AM_ROM |
| 767 | 767 | AM_RANGE(0x2000, 0x27ff) AM_RAM |
| 768 | 768 | AM_RANGE(0x4000, 0x47ff) AM_RAM |
| 769 | | AM_RANGE(0x4800, 0x4fff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE(&galaxold_videoram) |
| 769 | AM_RANGE(0x4800, 0x4fff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) |
| 770 | 770 | AM_RANGE(0x5000, 0x5000) AM_WRITENOP |
| 771 | 771 | AM_RANGE(0x5800, 0x5800) AM_READNOP AM_WRITE(interrupt_enable_w) |
| 772 | 772 | AM_RANGE(0x5801, 0x5807) AM_WRITENOP |
| 773 | 773 | AM_RANGE(0x6101, 0x6101) AM_READ_PORT("IN0") |
| 774 | 774 | AM_RANGE(0x6102, 0x6102) AM_READ_PORT("IN1") |
| 775 | 775 | AM_RANGE(0x6103, 0x6103) AM_WRITENOP |
| 776 | | AM_RANGE(0x6200, 0x6203) AM_WRITENOP AM_BASE(&galaxold_attributesram) |
| 776 | AM_RANGE(0x6200, 0x6203) AM_WRITENOP AM_BASE_MEMBER(galaxold_state, m_attributesram) |
| 777 | 777 | AM_RANGE(0x8000, 0x9fff) AM_ROM |
| 778 | | AM_RANGE(0xffe6, 0xffff) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) |
| 778 | AM_RANGE(0xffe6, 0xffff) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) |
| 779 | 779 | ADDRESS_MAP_END |
| 780 | 780 | |
| 781 | 781 | static ADDRESS_MAP_START( harem_cpu2, AS_PROGRAM, 8 ) |
| r11160 | r11161 | |
| 797 | 797 | |
| 798 | 798 | static ADDRESS_MAP_START( hunchbkg, AS_PROGRAM, 8 ) |
| 799 | 799 | AM_RANGE(0x0000, 0x0fff) AM_ROM |
| 800 | | AM_RANGE(0x1480, 0x14bf) AM_MIRROR(0x6000) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) |
| 801 | | AM_RANGE(0x14c0, 0x14ff) AM_MIRROR(0x6000) AM_WRITEONLY AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) |
| 800 | AM_RANGE(0x1480, 0x14bf) AM_MIRROR(0x6000) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) |
| 801 | AM_RANGE(0x14c0, 0x14ff) AM_MIRROR(0x6000) AM_WRITEONLY AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) |
| 802 | 802 | AM_RANGE(0x1500, 0x1500) AM_MIRROR(0x6000) AM_READ_PORT("IN0") |
| 803 | 803 | AM_RANGE(0x1500, 0x1501) AM_MIRROR(0x6000) AM_WRITE(galaxold_leds_w) /* not connected ... */ |
| 804 | 804 | AM_RANGE(0x1502, 0x1502) AM_MIRROR(0x6000) AM_WRITE(galaxold_coin_lockout_w) /* not connected ... */ |
| r11160 | r11161 | |
| 815 | 815 | AM_RANGE(0x1606, 0x1606) AM_MIRROR(0x6000) AM_WRITE(galaxold_flip_screen_x_w) |
| 816 | 816 | AM_RANGE(0x1607, 0x1607) AM_MIRROR(0x6000) AM_WRITE(galaxold_flip_screen_y_w) |
| 817 | 817 | AM_RANGE(0x1680, 0x1680) AM_MIRROR(0x6000) AM_READ(watchdog_reset_r) AM_DEVWRITE(GAL_AUDIO, galaxian_pitch_w) |
| 818 | | AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) |
| 818 | AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) |
| 819 | 819 | AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM |
| 820 | 820 | AM_RANGE(0x2000, 0x2fff) AM_ROM |
| 821 | 821 | AM_RANGE(0x4000, 0x4fff) AM_ROM |
| r11160 | r11161 | |
| 832 | 832 | |
| 833 | 833 | static ADDRESS_MAP_START( drivfrcg, AS_PROGRAM, 8 ) |
| 834 | 834 | AM_RANGE(0x0000, 0x0fff) AM_ROM |
| 835 | | AM_RANGE(0x1480, 0x14bf) AM_MIRROR(0x6000) AM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) |
| 836 | | AM_RANGE(0x14c0, 0x14ff) AM_MIRROR(0x6000) AM_WRITEONLY AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) |
| 835 | AM_RANGE(0x1480, 0x14bf) AM_MIRROR(0x6000) AM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) |
| 836 | AM_RANGE(0x14c0, 0x14ff) AM_MIRROR(0x6000) AM_WRITEONLY AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) |
| 837 | 837 | AM_RANGE(0x1500, 0x1500) AM_MIRROR(0x6000) AM_READ_PORT("IN0") |
| 838 | 838 | AM_RANGE(0x1503, 0x1503) AM_MIRROR(0x6000) AM_WRITE(galaxold_coin_counter_w) |
| 839 | 839 | AM_RANGE(0x1580, 0x1580) AM_MIRROR(0x6000) AM_READ_PORT("IN1") |
| r11160 | r11161 | |
| 845 | 845 | AM_RANGE(0x1700, 0x1700) AM_MIRROR(0x6000) AM_READ_PORT("DSW1") AM_WRITENOP |
| 846 | 846 | AM_RANGE(0x1701, 0x1701) AM_MIRROR(0x6000) AM_WRITENOP |
| 847 | 847 | AM_RANGE(0x1704, 0x1707) AM_MIRROR(0x6000) AM_DEVWRITE(GAL_AUDIO, galaxian_vol_w) |
| 848 | | AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) |
| 848 | AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) |
| 849 | 849 | AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM |
| 850 | 850 | AM_RANGE(0x2000, 0x2fff) AM_ROM |
| 851 | 851 | AM_RANGE(0x4000, 0x4fff) AM_ROM |
| r11160 | r11161 | |
| 860 | 860 | |
| 861 | 861 | static ADDRESS_MAP_START( racknrol, AS_PROGRAM, 8 ) |
| 862 | 862 | AM_RANGE(0x0000, 0x0fff) AM_ROM |
| 863 | | AM_RANGE(0x1400, 0x143f) AM_MIRROR(0x6000) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) |
| 864 | | AM_RANGE(0x1440, 0x14bf) AM_MIRROR(0x6000) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) |
| 863 | AM_RANGE(0x1400, 0x143f) AM_MIRROR(0x6000) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) |
| 864 | AM_RANGE(0x1440, 0x14bf) AM_MIRROR(0x6000) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) |
| 865 | 865 | AM_RANGE(0x14c0, 0x14ff) AM_MIRROR(0x6000) AM_RAM |
| 866 | 866 | AM_RANGE(0x1500, 0x1500) AM_MIRROR(0x6000) AM_READ_PORT("IN0") |
| 867 | 867 | AM_RANGE(0x1580, 0x1580) AM_MIRROR(0x6000) AM_READ_PORT("IN1") |
| r11160 | r11161 | |
| 872 | 872 | AM_RANGE(0x1680, 0x1680) AM_MIRROR(0x6000) AM_READNOP |
| 873 | 873 | // AM_RANGE(0x1700, 0x1700) AM_MIRROR(0x6000) AM_READ(trvchlng_question_r) |
| 874 | 874 | // AM_RANGE(0x1701, 0x1703) AM_MIRROR(0x6000) AM_READ(trvchlng_question_w) |
| 875 | | AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) |
| 875 | AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) |
| 876 | 876 | AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM |
| 877 | 877 | AM_RANGE(0x2000, 0x2fff) AM_ROM |
| 878 | 878 | AM_RANGE(0x4000, 0x4fff) AM_ROM |
| r11160 | r11161 | |
| 883 | 883 | AM_RANGE(0x1d, 0x1d) AM_DEVWRITE("sn1", sn76496_w) |
| 884 | 884 | AM_RANGE(0x1e, 0x1e) AM_DEVWRITE("sn2", sn76496_w) |
| 885 | 885 | AM_RANGE(0x1f, 0x1f) AM_DEVWRITE("sn3", sn76496_w) |
| 886 | | AM_RANGE(0x20, 0x3f) AM_WRITE(racknrol_tiles_bank_w) AM_BASE(&racknrol_tiles_bank) |
| 886 | AM_RANGE(0x20, 0x3f) AM_WRITE(racknrol_tiles_bank_w) AM_BASE_MEMBER(galaxold_state, m_racknrol_tiles_bank) |
| 887 | 887 | AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ_PORT("SENSE") |
| 888 | 888 | ADDRESS_MAP_END |
| 889 | 889 | |
| r11160 | r11161 | |
| 903 | 903 | |
| 904 | 904 | static ADDRESS_MAP_START( hexpoola_io, AS_IO, 8 ) |
| 905 | 905 | AM_RANGE(0x00, 0x00) AM_READNOP |
| 906 | | AM_RANGE(0x20, 0x3f) AM_WRITE(racknrol_tiles_bank_w) AM_BASE(&racknrol_tiles_bank) |
| 906 | AM_RANGE(0x20, 0x3f) AM_WRITE(racknrol_tiles_bank_w) AM_BASE_MEMBER(galaxold_state, m_racknrol_tiles_bank) |
| 907 | 907 | AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_READ(hexpoola_data_port_r) AM_DEVWRITE("snsnd", sn76496_w) |
| 908 | 908 | AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ_PORT("SENSE") |
| 909 | 909 | ADDRESS_MAP_END |
| r11160 | r11161 | |
| 2117 | 2117 | }; |
| 2118 | 2118 | |
| 2119 | 2119 | |
| 2120 | | static MACHINE_CONFIG_START( galaxold_base, driver_device ) |
| 2120 | static MACHINE_CONFIG_START( galaxold_base, galaxold_state ) |
| 2121 | 2121 | |
| 2122 | 2122 | /* basic machine hardware */ |
| 2123 | 2123 | MCFG_CPU_ADD("maincpu", Z80, PIXEL_CLOCK/2) /* 3.072 MHz */ |
| r11160 | r11161 | |
| 2276 | 2276 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 2277 | 2277 | MACHINE_CONFIG_END |
| 2278 | 2278 | |
| 2279 | | static MACHINE_CONFIG_START( drivfrcg, driver_device ) |
| 2279 | static MACHINE_CONFIG_START( drivfrcg, galaxold_state ) |
| 2280 | 2280 | |
| 2281 | 2281 | /* basic machine hardware */ |
| 2282 | 2282 | MCFG_CPU_ADD("maincpu", S2650, MASTER_CLOCK/6) |
| r11160 | r11161 | |
| 2370 | 2370 | MCFG_CPU_PROGRAM_MAP(tazzmang) |
| 2371 | 2371 | MACHINE_CONFIG_END |
| 2372 | 2372 | |
| 2373 | | static MACHINE_CONFIG_START( racknrol, driver_device ) |
| 2373 | static MACHINE_CONFIG_START( racknrol, galaxold_state ) |
| 2374 | 2374 | |
| 2375 | 2375 | /* basic machine hardware */ |
| 2376 | 2376 | MCFG_CPU_ADD("maincpu", S2650, PIXEL_CLOCK/2) |
| r11160 | r11161 | |
| 2426 | 2426 | MACHINE_CONFIG_END |
| 2427 | 2427 | |
| 2428 | 2428 | |
| 2429 | | static MACHINE_CONFIG_START( hexpoola, driver_device ) |
| 2429 | static MACHINE_CONFIG_START( hexpoola, galaxold_state ) |
| 2430 | 2430 | |
| 2431 | 2431 | /* basic machine hardware */ |
| 2432 | 2432 | MCFG_CPU_ADD("maincpu", S2650, PIXEL_CLOCK/2) |
src/mame/drivers/spoker.c
| r11160 | r11161 | |
| 6 | 6 | - Understand how to reset NVRAM |
| 7 | 7 | - Map DSW (Operator mode doesn't help) |
| 8 | 8 | - Map Leds and Coin counters |
| 9 | - 3super8 randomly crashes |
| 10 | - 3super8 doesn't have the 8x32 tilemap, change the video emulation accordingly |
| 9 | 11 | ***************************************************************************/ |
| 10 | 12 | |
| 11 | 13 | #include "emu.h" |
| 12 | 14 | #include "cpu/z180/z180.h" |
| 15 | #include "cpu/z80/z80.h" |
| 13 | 16 | #include "sound/2413intf.h" |
| 14 | 17 | #include "sound/okim6295.h" |
| 15 | 18 | #include "machine/nvram.h" |
| r11160 | r11161 | |
| 33 | 36 | tilemap_t *m_fg_tilemap; |
| 34 | 37 | |
| 35 | 38 | int m_video_enable; |
| 36 | | int m_nmi_enable; |
| 39 | int m_nmi_ack; |
| 37 | 40 | int m_hopper; |
| 38 | 41 | UINT8 m_igs_magic[2]; |
| 39 | 42 | UINT8 m_out[3]; |
| r11160 | r11161 | |
| 120 | 123 | { |
| 121 | 124 | spoker_state *state = space->machine().driver_data<spoker_state>(); |
| 122 | 125 | |
| 123 | | if ((state->m_nmi_enable ^ data) & (~0xdd)) |
| 126 | if ((data) & (0x22)) |
| 124 | 127 | { |
| 125 | 128 | logerror("PC %06X: nmi_and_coins = %02x\n",cpu_get_pc(&space->device()),data); |
| 126 | 129 | // popmessage("%02x",data); |
| r11160 | r11161 | |
| 133 | 136 | |
| 134 | 137 | set_led_status(space->machine(), 6, data & 0x40); // led for coin out / hopper active |
| 135 | 138 | |
| 136 | | state->m_nmi_enable = data; // data & 0x80 // nmi enable? |
| 139 | if(((state->m_nmi_ack & 0x80) == 0) && data & 0x80) |
| 140 | cputag_set_input_line(space->machine(), "maincpu", INPUT_LINE_NMI, CLEAR_LINE); |
| 137 | 141 | |
| 142 | state->m_nmi_ack = data & 0x80; // nmi acknowledge, 0 -> 1 |
| 143 | |
| 138 | 144 | state->m_out[0] = data; |
| 139 | 145 | show_out(state->m_out); |
| 140 | 146 | } |
| r11160 | r11161 | |
| 227 | 233 | |
| 228 | 234 | AM_RANGE( 0x5000, 0x5fff ) AM_RAM_WRITE( fg_tile_w ) AM_BASE_MEMBER( spoker_state,m_fg_tile_ram ) |
| 229 | 235 | |
| 236 | /* TODO: ppi #1 */ |
| 230 | 237 | AM_RANGE( 0x6480, 0x6480 ) AM_WRITE( spoker_nmi_and_coins_w ) |
| 231 | | |
| 232 | 238 | AM_RANGE( 0x6481, 0x6481 ) AM_READ_PORT( "SERVICE" ) |
| 233 | 239 | AM_RANGE( 0x6482, 0x6482 ) AM_READ_PORT( "COINS" ) |
| 240 | |
| 241 | /* TODO: ppi #2 */ |
| 234 | 242 | AM_RANGE( 0x6490, 0x6490 ) AM_READ_PORT( "BUTTONS1" ) |
| 235 | 243 | AM_RANGE( 0x6491, 0x6491 ) AM_WRITE( spoker_video_and_leds_w ) |
| 236 | 244 | AM_RANGE( 0x6492, 0x6492 ) AM_WRITE( spoker_leds_w ) |
| 245 | |
| 237 | 246 | AM_RANGE( 0x64a0, 0x64a0 ) AM_READ_PORT( "BUTTONS2" ) |
| 238 | 247 | |
| 239 | 248 | AM_RANGE( 0x64b0, 0x64b1 ) AM_DEVWRITE( "ymsnd", ym2413_w ) |
| r11160 | r11161 | |
| 245 | 254 | AM_RANGE( 0x7000, 0x7fff ) AM_RAM_WRITE( fg_color_w ) AM_BASE_MEMBER( spoker_state,m_fg_color_ram ) |
| 246 | 255 | ADDRESS_MAP_END |
| 247 | 256 | |
| 257 | static ADDRESS_MAP_START( 3super8_portmap, AS_IO, 8 ) |
| 258 | // AM_RANGE( 0x1000, 0x1fff ) AM_WRITENOP |
| 248 | 259 | |
| 260 | AM_RANGE( 0x2000, 0x27ff ) AM_RAM_WRITE( paletteram_xBBBBBGGGGGRRRRR_split1_w ) AM_BASE_GENERIC( paletteram ) |
| 261 | AM_RANGE( 0x2800, 0x2fff ) AM_RAM_WRITE( paletteram_xBBBBBGGGGGRRRRR_split2_w ) AM_BASE_GENERIC( paletteram2 ) |
| 249 | 262 | |
| 263 | AM_RANGE( 0x3000, 0x33ff ) AM_RAM_WRITE( bg_tile_w ) AM_BASE_MEMBER( spoker_state,m_bg_tile_ram ) |
| 250 | 264 | |
| 265 | AM_RANGE( 0x4000, 0x4000 ) AM_READ_PORT( "DSW1" ) |
| 266 | AM_RANGE( 0x4001, 0x4001 ) AM_READ_PORT( "DSW2" ) |
| 267 | AM_RANGE( 0x4002, 0x4002 ) AM_READ_PORT( "DSW3" ) |
| 268 | AM_RANGE( 0x4003, 0x4003 ) AM_READ_PORT( "DSW4" ) |
| 269 | AM_RANGE( 0x4004, 0x4004 ) AM_READ_PORT( "DSW5" ) |
| 270 | |
| 271 | // AM_RANGE( 0x4000, 0x40ff ) AM_WRITENOP |
| 272 | |
| 273 | AM_RANGE( 0x5000, 0x5fff ) AM_RAM_WRITE( fg_tile_w ) AM_BASE_MEMBER( spoker_state,m_fg_tile_ram ) |
| 274 | |
| 275 | AM_RANGE( 0x6480, 0x6480 ) AM_READ_PORT( "IN0" ) |
| 276 | AM_RANGE( 0x6490, 0x6490 ) AM_READ_PORT( "IN1" ) |
| 277 | AM_RANGE( 0x6491, 0x6491 ) AM_DEVREADWRITE_MODERN("oki", okim6295_device, read, write) |
| 278 | AM_RANGE( 0x64a0, 0x64a0 ) AM_READ_PORT( "IN2" ) |
| 279 | AM_RANGE( 0x64b0, 0x64b0 ) AM_WRITE( spoker_leds_w ) |
| 280 | AM_RANGE( 0x64c0, 0x64c0 ) AM_READNOP //irq ack? |
| 281 | |
| 282 | AM_RANGE( 0x64f0, 0x64f0 ) AM_WRITE(spoker_nmi_and_coins_w ) |
| 283 | |
| 284 | AM_RANGE( 0x7000, 0x7fff ) AM_RAM_WRITE( fg_color_w ) AM_BASE_MEMBER( spoker_state,m_fg_color_ram ) |
| 285 | ADDRESS_MAP_END |
| 286 | |
| 287 | |
| 251 | 288 | /*************************************************************************** |
| 252 | 289 | Input Ports |
| 253 | 290 | ***************************************************************************/ |
| r11160 | r11161 | |
| 324 | 361 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 325 | 362 | INPUT_PORTS_END |
| 326 | 363 | |
| 364 | static INPUT_PORTS_START( 3super8 ) |
| 365 | PORT_START("DSW1") |
| 366 | PORT_DIPUNKNOWN( 0x01, 0x01 ) |
| 367 | PORT_DIPUNKNOWN( 0x02, 0x02 ) |
| 368 | PORT_DIPUNKNOWN( 0x04, 0x04 ) |
| 369 | PORT_DIPUNKNOWN( 0x08, 0x08 ) |
| 370 | PORT_DIPUNKNOWN( 0x10, 0x10 ) |
| 371 | PORT_DIPUNKNOWN( 0x20, 0x20 ) |
| 372 | PORT_DIPUNKNOWN( 0x40, 0x40 ) |
| 373 | PORT_DIPUNKNOWN( 0x80, 0x80 ) |
| 374 | |
| 375 | PORT_START("DSW2") |
| 376 | PORT_DIPUNKNOWN( 0x01, 0x01 ) |
| 377 | PORT_DIPUNKNOWN( 0x02, 0x02 ) |
| 378 | PORT_DIPUNKNOWN( 0x04, 0x04 ) |
| 379 | PORT_DIPUNKNOWN( 0x08, 0x08 ) |
| 380 | PORT_DIPUNKNOWN( 0x10, 0x10 ) |
| 381 | PORT_DIPUNKNOWN( 0x20, 0x20 ) |
| 382 | PORT_DIPUNKNOWN( 0x40, 0x40 ) |
| 383 | PORT_DIPUNKNOWN( 0x80, 0x80 ) |
| 384 | |
| 385 | PORT_START("DSW3") |
| 386 | PORT_DIPUNKNOWN( 0x01, 0x01 ) |
| 387 | PORT_DIPUNKNOWN( 0x02, 0x02 ) |
| 388 | PORT_DIPUNKNOWN( 0x04, 0x04 ) |
| 389 | PORT_DIPUNKNOWN( 0x08, 0x08 ) |
| 390 | PORT_DIPUNKNOWN( 0x10, 0x10 ) |
| 391 | PORT_DIPUNKNOWN( 0x20, 0x20 ) |
| 392 | PORT_DIPUNKNOWN( 0x40, 0x40 ) |
| 393 | PORT_DIPUNKNOWN( 0x80, 0x80 ) |
| 394 | |
| 395 | PORT_START("DSW4") |
| 396 | PORT_DIPUNKNOWN( 0xff, 0xff ) |
| 397 | |
| 398 | PORT_START("DSW5") |
| 399 | PORT_DIPUNKNOWN( 0xff, 0xff ) |
| 400 | |
| 401 | PORT_START("IN0") |
| 402 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 403 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM( hopper_r, (void *)0 ) PORT_NAME("HPSW") // hopper sensor |
| 404 | PORT_SERVICE( 0x04, IP_ACTIVE_LOW ) |
| 405 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Statistics") |
| 406 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 407 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 408 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) PORT_NAME("Key Down") |
| 409 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) |
| 410 | |
| 411 | PORT_START("IN1") |
| 412 | PORT_DIPNAME( 0x01, 0x01, "IN1" ) |
| 413 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 414 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 415 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) |
| 416 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 417 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 418 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) |
| 419 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 420 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 421 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) |
| 422 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 423 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 424 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) |
| 425 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 426 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 427 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) |
| 428 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 429 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 430 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
| 431 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 432 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 433 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
| 434 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 435 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 436 | |
| 437 | PORT_START("IN2") |
| 438 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) |
| 439 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_HOLD1 ) PORT_NAME("Hold 1 / High / Low") |
| 440 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) PORT_NAME("Hold 5 / Bet") |
| 441 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) PORT_NAME("Hold 4 / Take") |
| 442 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD3 ) PORT_NAME("Hold 3 / W-Up") |
| 443 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_POKER_HOLD2 ) PORT_NAME("Hold 2 / Red / Black") |
| 444 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 445 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 446 | INPUT_PORTS_END |
| 447 | |
| 327 | 448 | /*************************************************************************** |
| 328 | 449 | Graphics Layout |
| 329 | 450 | ***************************************************************************/ |
| r11160 | r11161 | |
| 354 | 475 | 8*32*2 |
| 355 | 476 | }; |
| 356 | 477 | |
| 478 | static const gfx_layout layout3s8_8x8x6 = |
| 479 | { |
| 480 | 8,8, |
| 481 | RGN_FRAC(1,3), |
| 482 | 6, |
| 483 | { RGN_FRAC(0,3)+2*8, RGN_FRAC(0,3)+0, RGN_FRAC(1,3)+2*8, RGN_FRAC(1,3)+0,RGN_FRAC(2,3)+2*8, RGN_FRAC(2,3)+0 }, |
| 484 | { 0, 1,2,3,4,5,6,7 }, |
| 485 | { 0*8, 1*8, 4*8, 5*8, 8*8, 9*8, 12*8, 13*8 }, |
| 486 | 16*8 |
| 487 | }; |
| 488 | |
| 357 | 489 | static GFXDECODE_START( spoker ) |
| 358 | 490 | GFXDECODE_ENTRY( "gfx1", 0x00000, layout_8x8x6, 0, 16 ) |
| 359 | 491 | GFXDECODE_ENTRY( "gfx2", 0x04000, layout_8x32x6, 0, 16 ) |
| r11160 | r11161 | |
| 362 | 494 | GFXDECODE_ENTRY( "gfx2", 0x00000, layout_8x32x6, 0, 16 ) |
| 363 | 495 | GFXDECODE_END |
| 364 | 496 | |
| 497 | static GFXDECODE_START( 3super8 ) |
| 498 | GFXDECODE_ENTRY( "gfx1", 0x00000, layout3s8_8x8x6, 0, 16 ) |
| 499 | GFXDECODE_ENTRY( "gfx2", 0x04000, layout_8x32x6, 0, 16 ) |
| 500 | GFXDECODE_ENTRY( "gfx2", 0x08000, layout_8x32x6, 0, 16 ) |
| 501 | GFXDECODE_ENTRY( "gfx2", 0x0c000, layout_8x32x6, 0, 16 ) |
| 502 | GFXDECODE_ENTRY( "gfx2", 0x00000, layout_8x32x6, 0, 16 ) |
| 503 | GFXDECODE_END |
| 365 | 504 | |
| 366 | 505 | |
| 367 | | |
| 368 | 506 | /*************************************************************************** |
| 369 | 507 | Machine Drivers |
| 370 | 508 | ***************************************************************************/ |
| r11160 | r11161 | |
| 373 | 511 | { |
| 374 | 512 | spoker_state *state = machine.driver_data<spoker_state>(); |
| 375 | 513 | |
| 376 | | state->m_nmi_enable = 0; |
| 514 | state->m_nmi_ack = 0; |
| 377 | 515 | state->m_hopper = 0; |
| 378 | 516 | state->m_video_enable = 1; |
| 379 | 517 | } |
| 380 | 518 | |
| 381 | 519 | static INTERRUPT_GEN( spoker_interrupt ) |
| 382 | 520 | { |
| 383 | | spoker_state *state = device->machine().driver_data<spoker_state>(); |
| 521 | // spoker_state *state = device->machine().driver_data<spoker_state>(); |
| 384 | 522 | |
| 385 | | if (state->m_nmi_enable & 0x80) |
| 386 | | device_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); |
| 523 | device_set_input_line(device, INPUT_LINE_NMI, ASSERT_LINE); |
| 387 | 524 | } |
| 388 | 525 | |
| 389 | 526 | static MACHINE_CONFIG_START( spoker, spoker_state ) |
| r11160 | r11161 | |
| 421 | 558 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 422 | 559 | MACHINE_CONFIG_END |
| 423 | 560 | |
| 561 | static MACHINE_CONFIG_DERIVED( 3super8, spoker ) |
| 424 | 562 | |
| 563 | MCFG_CPU_REPLACE("maincpu", Z80, XTAL_24MHz / 4) /* z840006, 24/4 MHz? */ |
| 564 | MCFG_CPU_MODIFY("maincpu") |
| 565 | MCFG_CPU_PROGRAM_MAP(spoker_map) |
| 566 | MCFG_CPU_IO_MAP(3super8_portmap) |
| 567 | MCFG_CPU_VBLANK_INT("screen",spoker_interrupt) |
| 568 | MCFG_CPU_PERIODIC_INT(irq0_line_hold,120) // this signal comes from the PIC |
| 569 | |
| 570 | MCFG_GFXDECODE(3super8) |
| 571 | |
| 572 | MCFG_DEVICE_REMOVE("ymsnd") |
| 573 | MACHINE_CONFIG_END |
| 574 | |
| 425 | 575 | static DRIVER_INIT( spk116it ) |
| 426 | 576 | { |
| 427 | 577 | int A; |
| r11160 | r11161 | |
| 438 | 588 | } |
| 439 | 589 | } |
| 440 | 590 | |
| 441 | | |
| 442 | | ROM_START( spk115it ) |
| 591 | ROM_START( spk116it ) |
| 443 | 592 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 444 | | ROM_LOAD( "v.bin", 0x0000, 0x10000, CRC(df52997b) SHA1(72a76e84aeedfdebd4c6cb47809117a28b5d3892) ) |
| 593 | ROM_LOAD( "v.bin", 0x0000, 0x10000, CRC(e44e943a) SHA1(78e32d07e2be9a452be10735641cbcf269068c55) ) |
| 445 | 594 | |
| 446 | 595 | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 447 | | ROM_LOAD( "6.bin", 0x80000, 0x40000, CRC(f9b027f8) SHA1(c4686a4024062482f9864e0445087e32899fc775) ) |
| 448 | | ROM_LOAD( "5.bin", 0x40000, 0x40000, CRC(baca51b6) SHA1(c97322c814729332378b6304a79062fea385ca97) ) |
| 449 | | ROM_LOAD( "4.bin", 0x00000, 0x40000, CRC(1172c790) SHA1(43f1d019ecae5c605722e3fe77ae2f022b01260b) ) |
| 596 | ROM_LOAD( "6.bin", 0x80000, 0x40000, CRC(55b54b11) SHA1(decf27d40ec842374af02c93d761375690be83a3) ) |
| 597 | ROM_LOAD( "5.bin", 0x40000, 0x40000, CRC(163f5b64) SHA1(5d3a5c2a64691ee9e2bb3a7c283aa9efa53fb35e) ) |
| 598 | ROM_LOAD( "4.bin", 0x00000, 0x40000, CRC(ec2c6ac3) SHA1(e0a38da26202d2b9a481060fe5b88a38e284201e) ) |
| 450 | 599 | |
| 451 | 600 | ROM_REGION( 0x30000, "gfx2", 0 ) |
| 452 | 601 | ROM_LOAD( "3.bin", 0x20000, 0x10000, CRC(5f18b012) SHA1(c9a96237eaf3138f136bbaffb29dde0ef568ce73) ) |
| r11160 | r11161 | |
| 457 | 606 | ROM_LOAD( "7.bin", 0x0000, 0x40000, CRC(67789f1c) SHA1(1bef621b4d6399f76020c6310e2e1c2f861679de) ) |
| 458 | 607 | ROM_END |
| 459 | 608 | |
| 460 | | |
| 461 | | ROM_START( spk116it ) |
| 609 | ROM_START( spk115it ) |
| 462 | 610 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 463 | | ROM_LOAD( "v.bin", 0x0000, 0x10000, CRC(e44e943a) SHA1(78e32d07e2be9a452be10735641cbcf269068c55) ) |
| 611 | ROM_LOAD( "v.bin", 0x0000, 0x10000, CRC(df52997b) SHA1(72a76e84aeedfdebd4c6cb47809117a28b5d3892) ) |
| 464 | 612 | |
| 465 | 613 | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 466 | | ROM_LOAD( "6.bin", 0x80000, 0x40000, CRC(55b54b11) SHA1(decf27d40ec842374af02c93d761375690be83a3) ) |
| 467 | | ROM_LOAD( "5.bin", 0x40000, 0x40000, CRC(163f5b64) SHA1(5d3a5c2a64691ee9e2bb3a7c283aa9efa53fb35e) ) |
| 468 | | ROM_LOAD( "4.bin", 0x00000, 0x40000, CRC(ec2c6ac3) SHA1(e0a38da26202d2b9a481060fe5b88a38e284201e) ) |
| 614 | ROM_LOAD( "6.bin", 0x80000, 0x40000, CRC(f9b027f8) SHA1(c4686a4024062482f9864e0445087e32899fc775) ) |
| 615 | ROM_LOAD( "5.bin", 0x40000, 0x40000, CRC(baca51b6) SHA1(c97322c814729332378b6304a79062fea385ca97) ) |
| 616 | ROM_LOAD( "4.bin", 0x00000, 0x40000, CRC(1172c790) SHA1(43f1d019ecae5c605722e3fe77ae2f022b01260b) ) |
| 469 | 617 | |
| 470 | 618 | ROM_REGION( 0x30000, "gfx2", 0 ) |
| 471 | 619 | ROM_LOAD( "3.bin", 0x20000, 0x10000, CRC(5f18b012) SHA1(c9a96237eaf3138f136bbaffb29dde0ef568ce73) ) |
| r11160 | r11161 | |
| 476 | 624 | ROM_LOAD( "7.bin", 0x0000, 0x40000, CRC(67789f1c) SHA1(1bef621b4d6399f76020c6310e2e1c2f861679de) ) |
| 477 | 625 | ROM_END |
| 478 | 626 | |
| 479 | | GAME( 1993?, spk116it, 0, spoker, spoker, spk116it, ROT0, "IGS", "Super Poker (v116IT)", 0 ) |
| 480 | | GAME( 1993?, spk115it, spk116it, spoker, spoker, spk116it, ROT0, "IGS", "Super Poker (v115IT)", 0 ) |
| 627 | /* |
| 628 | |
| 629 | Produttore ?Italy? |
| 630 | N.revisione |
| 631 | CPU |
| 632 | |
| 633 | 1x 24mhz osc |
| 634 | 2x fpga |
| 635 | 1x z840006 |
| 636 | 1x PIC16c65a-20/p |
| 637 | 1x 6295 oki |
| 638 | |
| 639 | ROMs |
| 640 | |
| 641 | Note |
| 642 | |
| 643 | 4x 8 dipswitch |
| 644 | 1x 4 dispwitch |
| 645 | |
| 646 | */ |
| 647 | |
| 648 | // all gfx / sound roms are bad. they're definitely meant to have different data |
| 649 | // in each half, and maybe even be twice the size. |
| 650 | // in all cases the first half is missing (the sample table in the samples rom for example) |
| 651 | //1.bin 1ST AND 2ND HALF IDENTICAL |
| 652 | //2.bin 1ST AND 2ND HALF IDENTICAL |
| 653 | //3.bin 1ST AND 2ND HALF IDENTICAL |
| 654 | //sound.bin 1ST AND 2ND HALF IDENTICAL |
| 655 | |
| 656 | |
| 657 | ROM_START( 3super8 ) |
| 658 | ROM_REGION( 0x20000, "maincpu", 0 ) |
| 659 | ROM_LOAD( "prgrom.bin", 0x00000, 0x20000, CRC(37c85dfe) SHA1(56bd2fb859b17dda1e675a385b6bcd6867ecceb0) ) |
| 660 | |
| 661 | ROM_REGION( 0x1000, "pic", 0 ) |
| 662 | ROM_LOAD( "pic16c65a-20-p", 0x0000, 0x1000, NO_DUMP ) |
| 663 | |
| 664 | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 665 | ROM_LOAD( "1.bin", 0x00000, 0x40000, BAD_DUMP CRC(d9d3e21e) SHA1(2f3f07ca427d9f56f0ff143d15d95cbf15255e33) ) |
| 666 | ROM_LOAD( "2.bin", 0x40000, 0x40000, BAD_DUMP CRC(fbb50ab1) SHA1(50a7ef9219c38d59117c510fe6d53fb3ba1fa456) ) |
| 667 | ROM_LOAD( "3.bin", 0x80000, 0x40000, BAD_DUMP CRC(545aa4e6) SHA1(3348d4b692900c9e9cd4a52b20922a84e596cd35) ) |
| 668 | ROM_FILL( 0x00000 ,0x20000, 0x00 ) |
| 669 | ROM_FILL( 0x40000 ,0x20000, 0x00 ) |
| 670 | ROM_FILL( 0x80000 ,0x20000, 0x00 ) |
| 671 | |
| 672 | ROM_REGION( 0x30000, "gfx2", ROMREGION_ERASE00 ) |
| 673 | |
| 674 | ROM_REGION( 0xc0000, "rep_gfx", 0 ) //not real, taken from spk116it |
| 675 | ROM_LOAD( "4.bin", 0x00000, 0x40000, BAD_DUMP CRC(ec2c6ac3) SHA1(e0a38da26202d2b9a481060fe5b88a38e284201e) ) |
| 676 | ROM_LOAD( "5.bin", 0x40000, 0x40000, BAD_DUMP CRC(163f5b64) SHA1(5d3a5c2a64691ee9e2bb3a7c283aa9efa53fb35e) ) |
| 677 | ROM_LOAD( "6.bin", 0x80000, 0x40000, BAD_DUMP CRC(55b54b11) SHA1(decf27d40ec842374af02c93d761375690be83a3) ) |
| 678 | |
| 679 | ROM_REGION( 0x40000, "oki", 0 ) |
| 680 | ROM_LOAD( "sound.bin", 0x00000, 0x40000, BAD_DUMP CRC(230b31c3) SHA1(38c107325d3a4e9781912078b1317dc9ba3e1ced) ) |
| 681 | ROM_END |
| 682 | |
| 683 | static DRIVER_INIT( 3super8 ) |
| 684 | { |
| 685 | UINT8 *ROM = machine.region("maincpu")->base(); |
| 686 | int i; |
| 687 | |
| 688 | /* Decryption is probably done using one macrocell/output on an address decoding pal which we do not have a dump of */ |
| 689 | /* The encryption is quite awful actually, especially since the program rom is entirely blank/0xFF but encrypted on its second half, exposing the entire function in plaintext */ |
| 690 | /* Input: A6, A7, A8, A9, A11; Output: D5 XOR */ |
| 691 | /* function: (A6&A8)&((!A7&A11)|(A9&!A11)); */ |
| 692 | /* nor-reduced: !(!(!(!A6|!A8))|!(!(A7|!A11)|!(!A9|A11))); */ |
| 693 | for(i=0;i<0x20000;i++) |
| 694 | { |
| 695 | UINT8 a6, a7, a8, a9, a11, d5 = 0; |
| 696 | a6 = BIT(i,6); a7 = BIT(i,7); a8 = BIT(i,8); a9 = BIT(i,9); a11 = BIT(i,11); |
| 697 | d5 = (a6&a8)&((!a7&a11)|(a9&!a11)); |
| 698 | ROM[i] ^= d5*0x20; |
| 699 | } |
| 700 | |
| 701 | /* cheesy hack: take gfx roms from spk116it and rearrange them for this game needs */ |
| 702 | { |
| 703 | UINT8 *src = machine.region("rep_gfx")->base(); |
| 704 | UINT8 *dst = machine.region("gfx1")->base(); |
| 705 | UINT8 x; |
| 706 | |
| 707 | for(x=0;x<3;x++) |
| 708 | { |
| 709 | for(i=0;i<0x20000;i+=4) |
| 710 | { |
| 711 | dst[i+0+x*0x40000] = src[i+0+x*0x40000]; |
| 712 | dst[i+1+x*0x40000] = src[i+2+x*0x40000]; |
| 713 | dst[i+2+x*0x40000] = src[i+1+x*0x40000]; |
| 714 | dst[i+3+x*0x40000] = src[i+3+x*0x40000]; |
| 715 | } |
| 716 | } |
| 717 | } |
| 718 | } |
| 719 | |
| 720 | GAME( 1993?, spk116it, 0, spoker, spoker, spk116it, ROT0, "IGS", "Super Poker (v116IT)", 0 ) |
| 721 | GAME( 1993?, spk115it, spk116it, spoker, spoker, spk116it, ROT0, "IGS", "Super Poker (v115IT)", 0 ) |
| 722 | GAME( 1993?, 3super8, spk116it, 3super8,3super8, 3super8, ROT0, "<unknown>", "3 Super 8 (Italy)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) //roms are badly dumped |
src/mame/drivers/funworld.c
| r11160 | r11161 | |
| 1 | 1 | /********************************************************************************** |
| 2 | 2 | |
| 3 | | |
| 4 | 3 | FUNWORLD / TAB. |
| 5 | 4 | |
| 6 | 5 | Original preliminary driver: Curt Coder, Peter Trauner. |
| r11160 | r11161 | |
| 9 | 8 | |
| 10 | 9 | Games running on this hardware: |
| 11 | 10 | |
| 12 | | * Jolly Card (austrian), TAB Austria, 1985. |
| 11 | * Jolly Card (Austrian), TAB Austria, 1985. |
| 13 | 12 | * Jolly Card (3x3 deal), TAB Austria, 1985. |
| 14 | 13 | * Jolly Card Professional 2.0 (MZS Tech), MZS Tech, 1993. |
| 15 | 14 | * Jolly Card Professional 2.0 (Spale Soft), Spale Soft, 2000. |
| 16 | 15 | * Jolly Card (Evona Electronic), Evona Electronic 1998. |
| 17 | | * Jolly Card (croatian, set 1), TAB Austria, 1985. |
| 18 | | * Jolly Card (croatian, set 2), Soft Design, 1993. |
| 19 | | * Jolly Card (italian, blue TAB board, encrypted), bootleg, 199?. |
| 20 | | * Jolly Card (italian, encrypted bootleg), bootleg, 1990. |
| 16 | * Jolly Card (Croatian, set 1), TAB Austria, 1985. |
| 17 | * Jolly Card (Croatian, set 2), Soft Design, 1993. |
| 18 | * Jolly Card (Italian, blue TAB board, encrypted), bootleg, 199?. |
| 19 | * Jolly Card (Italian, encrypted bootleg), bootleg, 1990. |
| 21 | 20 | * Super Joly 2000 - 3x, M.P. 1985. |
| 22 | | * Jolly Card (austrian, Funworld, bootleg), Inter Games, 1986. |
| 23 | | * Big Deal (hungarian, set 1), Funworld, 1986. |
| 24 | | * Big Deal (hungarian, set 2), Funworld, 1986. |
| 25 | | * Jolly Card (austrian, Funworld), Funworld, 1986. |
| 26 | | * Cuore 1 (italian), C.M.C., 1996. |
| 27 | | * Elephant Family (italian, new), C.M.C., 1997. |
| 28 | | * Elephant Family (italian, old), C.M.C., 1996. |
| 29 | | * Pool 10 (italian, set 1), C.M.C., 1996. |
| 30 | | * Pool 10 (italian, set 2), C.M.C., 1996. |
| 31 | | * Pool 10 (italian, set 3), C.M.C., 1996. |
| 32 | | * Pool 10 (italian, set 4), C.M.C., 1997. |
| 33 | | * Tortuga Family (italian), C.M.C., 1997. |
| 34 | | * Pot Game (italian), C.M.C., 1996. |
| 35 | | * Bottle 10 (italian, set 1), C.M.C., 1996. |
| 36 | | * Bottle 10 (italian, set 2), C.M.C., 1996. |
| 37 | | * Royal Card (austrian, set 1), TAB Austria, 1991. |
| 38 | | * Royal Card (austrian, set 2), TAB Austria, 1991. |
| 39 | | * Royal Card (austrian/polish, set 3), TAB Austria, 1991. |
| 40 | | * Royal Card (austrian, set 4), TAB Austria, 1991. |
| 41 | | * Royal Card (austrian, set 5), TAB Austria, 1991. |
| 42 | | * Royal Card (austrian, set 6), TAB Austria, 1991. |
| 21 | * Jolly Card (Austrian, Funworld, bootleg), Inter Games, 1986. |
| 22 | * Big Deal (Hungarian, set 1), Funworld, 1986. |
| 23 | * Big Deal (Hungarian, set 2), Funworld, 1986. |
| 24 | * Jolly Card (Austrian, Funworld), Funworld, 1986. |
| 25 | * Cuore 1 (Italian), C.M.C., 1996. |
| 26 | * Elephant Family (Italian, new), C.M.C., 1997. |
| 27 | * Elephant Family (Italian, old), C.M.C., 1996. |
| 28 | * Pool 10 (Italian, set 1), C.M.C., 1996. |
| 29 | * Pool 10 (Italian, set 2), C.M.C., 1996. |
| 30 | * Pool 10 (Italian, set 3), C.M.C., 1996. |
| 31 | * Pool 10 (Italian, set 4), C.M.C., 1997. |
| 32 | * Tortuga Family (Italian), C.M.C., 1997. |
| 33 | * Pot Game (Italian), C.M.C., 1996. |
| 34 | * Bottle 10 (Italian, set 1), C.M.C., 1996. |
| 35 | * Bottle 10 (Italian, set 2), C.M.C., 1996. |
| 36 | * Royal Card (Austrian, set 1), TAB Austria, 1991. |
| 37 | * Royal Card (Austrian, set 2), TAB Austria, 1991. |
| 38 | * Royal Card (Austrian/Polish, set 3), TAB Austria, 1991. |
| 39 | * Royal Card (Austrian, set 4), TAB Austria, 1991. |
| 40 | * Royal Card (Austrian, set 5), TAB Austria, 1991. |
| 41 | * Royal Card (Austrian, set 6), TAB Austria, 1991. |
| 43 | 42 | * Royal Card (TAB original), TAB Austria, 1991. |
| 44 | | * Royal Card (slovak, encrypted), Evona Electronic, 1991. |
| 43 | * Royal Card (Slovak, encrypted), Evona Electronic, 1991. |
| 45 | 44 | * Royal Card Professional 2.0, Digital Dreams, 1993. |
| 46 | 45 | * Lucky Lady (3x3 deal), TAB Austria, 1991. |
| 47 | 46 | * Lucky Lady (4x1 aces), TAB Austria, 1991. |
| 48 | | * Magic Card II (bulgarian), Impera, 1996. |
| 49 | | * Magic Card II (green TAB or Impera board), Impera, 1996. |
| 50 | | * Magic Card II (blue TAB board, encrypted), Impera, 1996. |
| 51 | | * Royal Vegas Joker Card (slow deal), Funworld, 1993. |
| 52 | | * Royal Vegas Joker Card (fast deal), Soft Design, 1993. |
| 53 | | * Royal Vegas Joker Card (fast deal, english gfx), Soft Design, 1993. |
| 54 | | * Royal Vegas Joker Card (fast deal, Mile), Mile, 1993. |
| 47 | * Magic Card II (Bulgarian), Impera, 1996. |
| 48 | * Magic Card II (Green TAB or Impera board), Impera, 1996. |
| 49 | * Magic Card II (Blue TAB board, encrypted), Impera, 1996. |
| 50 | * Royal Vegas Joker Card (Slow deal), Funworld, 1993. |
| 51 | * Royal Vegas Joker Card (Fast deal), Soft Design, 1993. |
| 52 | * Royal Vegas Joker Card (Fast deal, english gfx), Soft Design, 1993. |
| 53 | * Royal Vegas Joker Card (Fast deal, Mile), Mile, 1993. |
| 55 | 54 | * Jolly Joker (98bet, set 1). Impera, 198?. |
| 56 | 55 | * Jolly Joker (98bet, set 2). Impera, 198?. |
| 57 | 56 | * Jolly Joker (40bet, croatian hack), Impera, 198?. |
| 58 | 57 | * Multi Win (Ver.0167, encrypted), Funworld, 1992. |
| 59 | 58 | * Joker Card (Ver.A267BC, encrypted), Vesely Svet, 1993. |
| 60 | | * Mongolfier New (italian), bootleg, 199?. |
| 61 | | * Soccer New (italian), bootleg, 199?. |
| 62 | | * Saloon (french, encrypted), unknown, 199?. |
| 63 | | * Fun World Quiz (austrian), Funworld, 198?. |
| 59 | * Mongolfier New (Italian), bootleg, 199?. |
| 60 | * Soccer New (Italian), bootleg, 199?. |
| 61 | * Saloon (French, encrypted), unknown, 199?. |
| 62 | * Fun World Quiz (Austrian), Funworld, 198?. |
| 63 | * Witch Royal (Export version 2.1), Video Klein, 199?. |
| 64 | 64 | |
| 65 | | |
| 66 | 65 | *********************************************************************************** |
| 67 | 66 | |
| 68 | | |
| 69 | 67 | The hardware is generally composed by: |
| 70 | 68 | |
| 71 | 69 | CPU: 1x 65SC02 or 65C02 at 2MHz. |
| r11160 | r11161 | |
| 321 | 319 | Beschreibung / Description |
| 322 | 320 | -------------------------- |
| 323 | 321 | |
| 324 | | F?r OES 5,-- Einwurf werden 3 Kredite gegeben. F?r einen Kredit bekommt der Spieler |
| 322 | Fur OES 5,-- Einwurf werden 3 Kredite gegeben. Fur einen Kredit bekommt der Spieler |
| 325 | 323 | 500 Spielpunkte. Bei jeder Frage kann der Spieler 100, 500 oder alle Punkte einsetzen. |
| 326 | 324 | Wird die Frage richtig beantwortet, wird der Einsatz aufaddiert. Erreicht der Spieler |
| 327 | 325 | nach 5 Fragen mehr als 2500 Punkte, bekommt er Bonusfragen. Das Spiel endet bei einer |
| r11160 | r11161 | |
| 350 | 348 | as soon as the current game ends. |
| 351 | 349 | |
| 352 | 350 | |
| 353 | | |
| 354 | 351 | *********************************************************************************** |
| 355 | 352 | |
| 356 | 353 | |
| r11160 | r11161 | |
| 719 | 716 | - Now principal Royal Card sets have a working bet button. |
| 720 | 717 | - Added default NVRAM to the new sets. |
| 721 | 718 | |
| 719 | [2011/04/04] |
| 720 | - Added 'Witch Royal' from Video Klein. Seems a hybrid game |
| 721 | from Witch Card and Royal Card... |
| 722 | - Reworked the button-lamps layout to get the hold buttons |
| 723 | more centered. |
| 722 | 724 | |
| 723 | 725 | |
| 724 | 726 | *** TO DO *** |
| r11160 | r11161 | |
| 902 | 904 | |
| 903 | 905 | */ |
| 904 | 906 | |
| 907 | static ADDRESS_MAP_START( witchryl_map, AS_PROGRAM, 8 ) |
| 908 | AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram") |
| 909 | AM_RANGE(0x0800, 0x0803) AM_DEVREADWRITE("pia0", pia6821_r, pia6821_w) |
| 910 | AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE("pia1", pia6821_r, pia6821_w) |
| 911 | AM_RANGE(0x0c00, 0x0c00) AM_DEVREAD("ay8910", ay8910_r) |
| 912 | AM_RANGE(0x0c00, 0x0c01) AM_DEVWRITE("ay8910", ay8910_address_data_w) |
| 913 | AM_RANGE(0x0e00, 0x0e00) AM_DEVWRITE("crtc", mc6845_address_w) |
| 914 | AM_RANGE(0x0e01, 0x0e01) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w) |
| 915 | AM_RANGE(0x4000, 0x4fff) AM_RAM_WRITE(funworld_videoram_w) AM_BASE_MEMBER(funworld_state, m_videoram) |
| 916 | AM_RANGE(0x5000, 0x5fff) AM_RAM_WRITE(funworld_colorram_w) AM_BASE_MEMBER(funworld_state, m_colorram) |
| 917 | AM_RANGE(0x6000, 0x6000) AM_READ_PORT("DSW2") |
| 918 | AM_RANGE(0x8000, 0xffff) AM_ROM |
| 919 | ADDRESS_MAP_END |
| 905 | 920 | |
| 921 | |
| 906 | 922 | /************************* |
| 907 | 923 | * Input ports * |
| 908 | 924 | *************************/ |
| r11160 | r11161 | |
| 1954 | 1970 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1955 | 1971 | INPUT_PORTS_END |
| 1956 | 1972 | |
| 1973 | static INPUT_PORTS_START( witchryl ) |
| 1974 | PORT_START("IN0") |
| 1975 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN ) PORT_NAME("Remote") |
| 1976 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_HOLD1 ) PORT_NAME("Halten (Hold) 1 / Hoch (High)") |
| 1977 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_POKER_CANCEL ) PORT_NAME("Loeschen/Gamble (Cancel/Play)") |
| 1978 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Geben (Start)") |
| 1979 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) PORT_NAME("Halten (Hold) 5 / Half Gamble") |
| 1980 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Buchhalt (Service1)") |
| 1981 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Einstellen (Service2)") |
| 1982 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) PORT_NAME("Halten (Hold) 4 / Kassieren (Take)") |
| 1957 | 1983 | |
| 1984 | PORT_START("IN1") |
| 1985 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_HOLD2 ) PORT_NAME("Halten (Hold) 2") |
| 1986 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_HOLD3 ) PORT_NAME("Halten (Hold) 3 / Tief (Low)") |
| 1987 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1988 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("unknown bit 08") PORT_CODE(KEYCODE_8) |
| 1989 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hoppersch") PORT_CODE(KEYCODE_H) |
| 1990 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 1991 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1992 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) PORT_NAME("Abschreib (Payout)") |
| 1993 | |
| 1994 | PORT_START("IN2") |
| 1995 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 1996 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1997 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1998 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1999 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2000 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2001 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2002 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2003 | |
| 2004 | PORT_START("DSW") |
| 2005 | PORT_DIPNAME( 0x01, 0x01, "State" ) PORT_DIPLOCATION("SW1:8") |
| 2006 | PORT_DIPSETTING( 0x00, "Keyboard Test" ) |
| 2007 | PORT_DIPSETTING( 0x01, "Game" ) |
| 2008 | PORT_DIPNAME( 0x02, 0x02, "Remote Value" ) PORT_DIPLOCATION("SW1:7") |
| 2009 | PORT_DIPSETTING( 0x00, "10 Points/Pulse" ) |
| 2010 | PORT_DIPSETTING( 0x02, "100 Points/Pulse" ) |
| 2011 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:6") |
| 2012 | PORT_DIPSETTING( 0x00, "5 Points/Coin" ) |
| 2013 | PORT_DIPSETTING( 0x04, "10 Points/Coin" ) |
| 2014 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:5") |
| 2015 | PORT_DIPSETTING( 0x00, "5 Points/Coin" ) |
| 2016 | PORT_DIPSETTING( 0x08, "10 Points/Coin" ) |
| 2017 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4") |
| 2018 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 2019 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2020 | PORT_DIPNAME( 0x20, 0x00, "Joker" ) PORT_DIPLOCATION("SW1:3") |
| 2021 | PORT_DIPSETTING( 0x00, "With Joker" ) /* also enable Five of a Kind */ |
| 2022 | PORT_DIPSETTING( 0x20, "Without Joker" ) |
| 2023 | PORT_DIPNAME( 0x40, 0x00, "Hold" ) PORT_DIPLOCATION("SW1:2") |
| 2024 | PORT_DIPSETTING( 0x00, "Auto Hold" ) |
| 2025 | PORT_DIPSETTING( 0x40, "No Auto Hold" ) |
| 2026 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:1") |
| 2027 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 2028 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2029 | |
| 2030 | PORT_START("DSW2") |
| 2031 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:8") |
| 2032 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 2033 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2034 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:7") |
| 2035 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 2036 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2037 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:6") |
| 2038 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 2039 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2040 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:5") |
| 2041 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 2042 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2043 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:4") |
| 2044 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 2045 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2046 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:3") |
| 2047 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 2048 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2049 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:2") |
| 2050 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 2051 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2052 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:1") |
| 2053 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 2054 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2055 | INPUT_PORTS_END |
| 2056 | |
| 2057 | |
| 1958 | 2058 | /************************* |
| 1959 | 2059 | * Graphics Layouts * |
| 1960 | 2060 | *************************/ |
| r11160 | r11161 | |
| 2209 | 2309 | MCFG_CPU_VBLANK_INT("screen", nmi_line_pulse) |
| 2210 | 2310 | MACHINE_CONFIG_END |
| 2211 | 2311 | |
| 2312 | static MACHINE_CONFIG_DERIVED( witchryl, fw1stpal ) |
| 2212 | 2313 | |
| 2314 | MCFG_CPU_REPLACE("maincpu", M65C02, MASTER_CLOCK/8) /* 2MHz */ |
| 2315 | MCFG_CPU_PROGRAM_MAP(witchryl_map) |
| 2316 | MCFG_CPU_VBLANK_INT("screen", nmi_line_pulse) |
| 2317 | MACHINE_CONFIG_END |
| 2213 | 2318 | |
| 2319 | |
| 2214 | 2320 | /************************* |
| 2215 | 2321 | * Rom Load * |
| 2216 | 2322 | *************************/ |
| r11160 | r11161 | |
| 3919 | 4025 | /**** Fun World Quiz **** |
| 3920 | 4026 | |
| 3921 | 4027 | Fun World Quiz |
| 3922 | | ?hlinger Ges.m.b.H. |
| 4028 | Oehlinger Ges.m.b.H. |
| 3923 | 4029 | |
| 3924 | 4030 | Horizontal Display |
| 3925 | 4031 | Currents |
| r11160 | r11161 | |
| 4022 | 4128 | ROM_END |
| 4023 | 4129 | |
| 4024 | 4130 | |
| 4131 | /* |
| 4132 | Witch Royal |
| 4133 | by Video Klein |
| 4025 | 4134 | |
| 4135 | Original Video Klein PCB |
| 4136 | with CPU box. |
| 4137 | |
| 4138 | */ |
| 4139 | ROM_START( witchryl ) |
| 4140 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 4141 | ROM_LOAD( "hn58c256.bin", 0x8000, 0x8000, CRC(b89a47b9) SHA1(11fcdd5756f2998748d2f1084b1db459e90126df) ) |
| 4142 | |
| 4143 | ROM_REGION( 0x10000, "gfx1", 0 ) |
| 4144 | ROM_LOAD( "2.u11", 0x0000, 0x8000, CRC(7edc8f44) SHA1(cabad613fa8a72dc12587d19a72bc9c6861486bd) ) |
| 4145 | ROM_IGNORE( 0x8000 ) /* Identical halves. Discarding 2nd half */ |
| 4146 | ROM_LOAD( "3.u4", 0x8000, 0x8000, CRC(5e4a0d59) SHA1(08eb9b1a617a7b2e6f87377819dba07082cf38b4) ) |
| 4147 | ROM_IGNORE( 0x8000 ) /* Identical halves. Discarding 2nd half */ |
| 4148 | |
| 4149 | ROM_REGION( 0x0800, "nvram", 0 ) /* default NVRAM */ |
| 4150 | ROM_LOAD( "witchryl_nvram.bin", 0x0000, 0x0800, CRC(98366bed) SHA1(279a5ce4639b8b2ac29146b32512615253c45991) ) |
| 4151 | |
| 4152 | ROM_REGION( 0x0200, "proms", 0 ) |
| 4153 | ROM_LOAD( "27s29.u26", 0x0000, 0x0200, CRC(8bc86f48) SHA1(4c677ab9314a1f571e35104b22659e6811aeb194) ) |
| 4154 | ROM_END |
| 4155 | |
| 4156 | |
| 4026 | 4157 | /************************** |
| 4027 | 4158 | * Driver Initialization * |
| 4028 | 4159 | **************************/ |
| r11160 | r11161 | |
| 4369 | 4500 | GAME( 199?, mongolnw, 0, royalcd1, royalcrd, 0, ROT0, "bootleg", "Mongolfier New (Italian)", GAME_NOT_WORKING ) |
| 4370 | 4501 | GAME( 199?, soccernw, 0, royalcd1, royalcrd, soccernw, ROT0, "bootleg", "Soccer New (Italian)", GAME_NOT_WORKING ) |
| 4371 | 4502 | GAME( 198?, saloon, 0, saloon, saloon, saloon, ROT0, "<unknown>", "Saloon (French, encrypted)", GAME_NOT_WORKING ) |
| 4372 | | GAME( 198?, funquiz, 0, funquiz, funquiz, 0, ROT0, "Funworld / " O_UMLAUT "hlinger", "Fun World Quiz (Austrian)", 0 ) |
| 4373 | | |
| 4503 | GAME( 198?, funquiz, 0, funquiz, funquiz, 0, ROT0, "Funworld / " O_UMLAUT "hlinger", "Fun World Quiz (Austrian)", 0 ) |
| 4504 | GAMEL( 199?, witchryl, 0, witchryl, witchryl, 0, ROT0, "Video Klein", "Witch Royal (Export version 2.1)", 0, layout_jollycrd ) |
src/mame/drivers/2mindril.c
| r11160 | r11161 | |
| 7 | 7 | preliminary driver by |
| 8 | 8 | David Haywood |
| 9 | 9 | Tomasz Slanina |
| 10 | Angelo Salese |
| 10 | 11 | |
| 11 | 12 | TODO: |
| 12 | 13 | - understand the ball hit sensor |
| 13 | 14 | - simulate the sensors (there are still some shutter errors/defender errors that pops up) |
| 14 | 15 | - Hook-up timers for shutter/defender sensors (check service mode) |
| 15 | 16 | - Dip-Switches |
| 16 | | - find video control regs (layer enable, scroll) |
| 17 | 17 | |
| 18 | | BG scroll: |
| 19 | | BG maps are 2048x256 (128x16 16x16 tiles). |
| 20 | | There's some kind of double buffering - odd/even screens are at |
| 21 | | x offsets 0 and 512 (it's visible during distance count after throw (odd/even numbers)) |
| 22 | | |
| 23 | | looks like regs @460000 are used, pairs at N, and N+8, so |
| 24 | | 460000, 460008 |
| 25 | | 460002, 46000a |
| 26 | | 460004, 46000c |
| 27 | | 460006, 46000e |
| 28 | | |
| 29 | | |
| 30 | 18 | Brief hardware overview: |
| 31 | 19 | ------------------------ |
| 32 | 20 | |
| r11160 | r11161 | |
| 34 | 22 | |
| 35 | 23 | Sound - Yamaha YM2610B |
| 36 | 24 | |
| 37 | | Taito custom ICs - TC0400YSC |
| 38 | | - TC0260DAR |
| 39 | | - TC0630FDP |
| 40 | | - TC0510NI0 |
| 25 | Taito custom ICs - TC0400YSC (m68k -> ym2610 communication) |
| 26 | - TC0260DAR (palette chip) |
| 27 | - TC0630FDP (Taito F3 video chip) |
| 28 | - TC0510NIO (known input chip) |
| 41 | 29 | |
| 42 | 30 | DAC -26.6860Mhz |
| 43 | 31 | -32.0000Mhz |
| r11160 | r11161 | |
| 47 | 35 | #include "emu.h" |
| 48 | 36 | #include "cpu/m68000/m68000.h" |
| 49 | 37 | #include "sound/2610intf.h" |
| 38 | #include "includes/taito_f3.h" |
| 50 | 39 | |
| 51 | 40 | |
| 52 | | class _2mindril_state : public driver_device |
| 41 | class _2mindril_state : public taito_f3_state |
| 53 | 42 | { |
| 54 | 43 | public: |
| 55 | 44 | _2mindril_state(running_machine &machine, const driver_device_config_base &config) |
| 56 | | : driver_device(machine, config) { } |
| 45 | : taito_f3_state(machine, config) { } |
| 57 | 46 | |
| 58 | 47 | /* memory pointers */ |
| 59 | | UINT16 * m_map1ram; |
| 60 | | UINT16 * m_map2ram; |
| 61 | | UINT16 * m_map3ram; |
| 62 | | UINT16 * m_map4ram; |
| 63 | | UINT16 * m_charram; |
| 64 | | UINT16 * m_textram; |
| 65 | | UINT16 * m_unkram; |
| 66 | | // UINT16 * m_paletteram; // currently this uses generic palette handling |
| 67 | 48 | UINT16 * m_iodata; |
| 68 | 49 | |
| 69 | 50 | /* input-related */ |
| 70 | 51 | UINT16 m_defender_sensor; |
| 71 | 52 | UINT16 m_shutter_sensor; |
| 53 | UINT16 irq_reg; |
| 72 | 54 | |
| 73 | 55 | /* devices */ |
| 74 | 56 | device_t *m_maincpu; |
| 75 | 57 | }; |
| 76 | 58 | |
| 77 | 59 | |
| 78 | | |
| 79 | | #define DRAW_MAP(map,num) \ |
| 80 | | { int x, y; \ |
| 81 | | for (y = 0; y < 16; y++) \ |
| 82 | | for (x = 0; x < 128; x++) \ |
| 83 | | { \ |
| 84 | | UINT16 data0 = map[y * 128 + x * 2]; \ |
| 85 | | UINT16 data1 = map[y * 128 + x * 2 + 1]; \ |
| 86 | | drawgfx_transpen(bitmap, \ |
| 87 | | cliprect,screen->machine().gfx[0], data1, \ |
| 88 | | data0 & 0xff, \ |
| 89 | | data0 & 0x4000, data0 & 0x8000, \ |
| 90 | | x * 16 - 512 /*+(((INT16)(state->m_unkram[0x60000 / 2 + num])) / 32)*/, \ |
| 91 | | y * 16 /*+(((INT16)(state->m_unkram[0x60008 / 2 + num])) / 32)*/,0); \ |
| 92 | | } \ |
| 93 | | } |
| 94 | | |
| 95 | | static SCREEN_UPDATE( drill ) |
| 96 | | { |
| 97 | | _2mindril_state *state = screen->machine().driver_data<_2mindril_state>(); |
| 98 | | bitmap_fill(bitmap, NULL, 0); |
| 99 | | |
| 100 | | DRAW_MAP(state->m_map1ram, 0) |
| 101 | | DRAW_MAP(state->m_map2ram, 1) |
| 102 | | DRAW_MAP(state->m_map3ram, 2) |
| 103 | | DRAW_MAP(state->m_map4ram, 3) |
| 104 | | |
| 105 | | { |
| 106 | | int x, y; |
| 107 | | for (y = 0; y < 64; y++) |
| 108 | | for(x = 0; x < 64; x++) |
| 109 | | { |
| 110 | | drawgfx_transpen( bitmap, |
| 111 | | cliprect, |
| 112 | | screen->machine().gfx[1], |
| 113 | | state->m_textram[y * 64 + x] & 0xff, //1ff ?? |
| 114 | | ((state->m_textram[y * 64 + x] >> 9) & 0xf), |
| 115 | | 0, 0, |
| 116 | | x*8,y*8,0); |
| 117 | | } |
| 118 | | } |
| 119 | | /*printf("%.4X %.4X %.4X %.4X %.4X %.4X\n", state->m_unkram[0x60000 / 2], state->m_unkram[0x60000 / 2 + 1], state->m_unkram[0x60000 / 2 + 2], |
| 120 | | state->m_unkram[0x60000 / 2 + 3], state->m_unkram[0x60000 / 2 + 4], state->m_unkram[0x60000 / 2 + 5]);*/ |
| 121 | | return 0; |
| 122 | | } |
| 123 | | |
| 124 | | static VIDEO_START( drill ) |
| 125 | | { |
| 126 | | _2mindril_state *state = machine.driver_data<_2mindril_state>(); |
| 127 | | |
| 128 | | machine.gfx[0]->color_granularity = 16; |
| 129 | | gfx_element_set_source(machine.gfx[1], (UINT8 *)state->m_charram); |
| 130 | | } |
| 131 | | |
| 132 | 60 | static READ16_HANDLER( drill_io_r ) |
| 133 | 61 | { |
| 134 | 62 | _2mindril_state *state = space->machine().driver_data<_2mindril_state>(); |
| r11160 | r11161 | |
| 235 | 163 | } |
| 236 | 164 | } |
| 237 | 165 | |
| 238 | | static WRITE16_HANDLER( charram_w ) |
| 166 | static READ16_HANDLER( drill_irq_r ) |
| 239 | 167 | { |
| 240 | 168 | _2mindril_state *state = space->machine().driver_data<_2mindril_state>(); |
| 169 | return state->irq_reg; |
| 170 | } |
| 241 | 171 | |
| 242 | | COMBINE_DATA(&state->m_charram[offset]); |
| 243 | | gfx_element_mark_dirty(space->machine().gfx[1], offset / 16); |
| 172 | static WRITE16_HANDLER( drill_irq_w ) |
| 173 | { |
| 174 | _2mindril_state *state = space->machine().driver_data<_2mindril_state>(); |
| 175 | /* |
| 176 | (note: could rather be irq mask) |
| 177 | ---- ---- ---x ---- irq lv 5 ack, 0->1 latch |
| 178 | ---- ---- ---- x--- irq lv 4 ack, 0->1 latch |
| 179 | ---- ---- -??- -??? connected to the other levels? |
| 180 | */ |
| 181 | if(((state->irq_reg & 8) == 0) && data & 8) |
| 182 | cputag_set_input_line(space->machine(), "maincpu", 4, CLEAR_LINE); |
| 183 | |
| 184 | if(((state->irq_reg & 0x10) == 0) && data & 0x10) |
| 185 | cputag_set_input_line(space->machine(), "maincpu", 5, CLEAR_LINE); |
| 186 | |
| 187 | if(data & 0xffe7) |
| 188 | printf("%04x\n",data); |
| 189 | |
| 190 | COMBINE_DATA(&state->irq_reg); |
| 244 | 191 | } |
| 245 | 192 | |
| 246 | 193 | static ADDRESS_MAP_START( drill_map, AS_PROGRAM, 16 ) |
| 247 | 194 | AM_RANGE(0x000000, 0x07ffff) AM_ROM |
| 248 | 195 | AM_RANGE(0x200000, 0x20ffff) AM_RAM |
| 249 | 196 | AM_RANGE(0x300000, 0x3000ff) AM_RAM |
| 250 | | AM_RANGE(0x410000, 0x411fff) AM_RAM AM_BASE_MEMBER(_2mindril_state, m_map1ram) |
| 251 | | AM_RANGE(0x412000, 0x413fff) AM_RAM AM_BASE_MEMBER(_2mindril_state, m_map2ram) |
| 252 | | AM_RANGE(0x414000, 0x415fff) AM_RAM AM_BASE_MEMBER(_2mindril_state, m_map3ram) |
| 253 | | AM_RANGE(0x416000, 0x417fff) AM_RAM AM_BASE_MEMBER(_2mindril_state, m_map4ram) |
| 254 | | AM_RANGE(0x41c000, 0x41dfff) AM_RAM AM_BASE_MEMBER(_2mindril_state, m_textram) |
| 255 | | AM_RANGE(0x41e000, 0x41ffff) AM_RAM_WRITE(charram_w) AM_BASE_MEMBER(_2mindril_state, m_charram) |
| 256 | | AM_RANGE(0x400000, 0x4fffff) AM_RAM AM_BASE_MEMBER(_2mindril_state, m_unkram)// video stuff, 460000 - video regs ? |
| 197 | AM_RANGE(0x400000, 0x40ffff) AM_READWRITE(f3_spriteram_r,f3_spriteram_w) |
| 198 | AM_RANGE(0x410000, 0x41bfff) AM_READWRITE(f3_pf_data_r,f3_pf_data_w) |
| 199 | AM_RANGE(0x41c000, 0x41dfff) AM_READWRITE(f3_videoram_r,f3_videoram_w) |
| 200 | AM_RANGE(0x41e000, 0x41ffff) AM_READWRITE(f3_vram_r,f3_vram_w) |
| 201 | AM_RANGE(0x420000, 0x42ffff) AM_READWRITE(f3_lineram_r,f3_lineram_w) |
| 202 | AM_RANGE(0x430000, 0x43ffff) AM_READWRITE(f3_pivot_r,f3_pivot_w) |
| 203 | AM_RANGE(0x460000, 0x46000f) AM_WRITE(f3_control_0_w) |
| 204 | AM_RANGE(0x460010, 0x46001f) AM_WRITE(f3_control_1_w) |
| 257 | 205 | AM_RANGE(0x500000, 0x501fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE_GENERIC(paletteram) |
| 258 | | AM_RANGE(0x502000, 0x503fff) AM_RAM |
| 206 | AM_RANGE(0x502022, 0x502023) AM_WRITENOP //countinously switches between 0 and 2 |
| 259 | 207 | AM_RANGE(0x600000, 0x600007) AM_DEVREADWRITE8("ymsnd", ym2610_r, ym2610_w, 0x00ff) |
| 260 | | AM_RANGE(0x60000c, 0x60000d) AM_RAM |
| 261 | | AM_RANGE(0x60000e, 0x60000f) AM_RAM |
| 208 | AM_RANGE(0x60000c, 0x60000d) AM_READWRITE(drill_irq_r,drill_irq_w) |
| 209 | AM_RANGE(0x60000e, 0x60000f) AM_RAM // unknown purpose, zeroed at start-up and nothing else |
| 262 | 210 | AM_RANGE(0x700000, 0x70000f) AM_READWRITE(drill_io_r,drill_io_w) AM_BASE_MEMBER(_2mindril_state, m_iodata) // i/o |
| 263 | 211 | AM_RANGE(0x800000, 0x800001) AM_WRITE(sensors_w) |
| 264 | 212 | ADDRESS_MAP_END |
| r11160 | r11161 | |
| 379 | 327 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Select SW-4") |
| 380 | 328 | INPUT_PORTS_END |
| 381 | 329 | |
| 382 | | static const gfx_layout drill_layout = |
| 330 | static const gfx_layout charlayout = |
| 383 | 331 | { |
| 332 | 8,8, |
| 333 | 256, |
| 334 | 4, |
| 335 | { 0,1,2,3 }, |
| 336 | { 20, 16, 28, 24, 4, 0, 12, 8 }, |
| 337 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, |
| 338 | 32*8 |
| 339 | }; |
| 340 | |
| 341 | static const gfx_layout pivotlayout = |
| 342 | { |
| 343 | 8,8, |
| 344 | 2048, |
| 345 | 4, |
| 346 | { 0,1,2,3 }, |
| 347 | { 20, 16, 28, 24, 4, 0, 12, 8 }, |
| 348 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, |
| 349 | 32*8 |
| 350 | }; |
| 351 | |
| 352 | static const gfx_layout spriteram_layout = |
| 353 | { |
| 384 | 354 | 16,16, |
| 385 | 355 | RGN_FRAC(1,2), |
| 386 | | 6, |
| 387 | | { RGN_FRAC(1,2)+1, RGN_FRAC(1,2)+0 ,0,1,2,3 }, |
| 388 | | { 20, 16, 28, 24, 4, 0, 12, 8, 52, 48, 60, 56, 36, 32, 44, 40 }, |
| 389 | | { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64, 8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 }, |
| 390 | | 16*64 |
| 356 | 6, /* Palettes have 4 bpp indexes despite up to 6 bpp data */ |
| 357 | { RGN_FRAC(1,2)+0, RGN_FRAC(1,2)+1, 0, 1, 2, 3 }, |
| 358 | { |
| 359 | 4, 0, 12, 8, |
| 360 | 16+4, 16+0, 16+12, 16+8, |
| 361 | 32+4, 32+0, 32+12, 32+8, |
| 362 | 48+4, 48+0, 48+12, 48+8 }, |
| 363 | { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64, |
| 364 | 8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 }, |
| 365 | 128*8 /* every sprite takes 128 consecutive bytes */ |
| 391 | 366 | }; |
| 392 | 367 | |
| 393 | | static const gfx_layout vramlayout= |
| 368 | static const gfx_layout tile_layout = |
| 394 | 369 | { |
| 395 | | 8,8, |
| 396 | | 256, |
| 397 | | 4, |
| 398 | | { 0, 1, 2, 3 }, |
| 399 | | {20,16,28,24,4,0,12,8}, |
| 400 | | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, |
| 401 | | 32*8 |
| 370 | 16,16, |
| 371 | RGN_FRAC(1,2), |
| 372 | 6, /* Palettes have 4 bpp indexes despite up to 6 bpp data */ |
| 373 | { RGN_FRAC(1,2)+2, RGN_FRAC(1,2)+3, 0, 1, 2, 3 }, |
| 374 | { |
| 375 | 4, 0, 16+4, 16+0, |
| 376 | 8+4, 8+0, 24+4, 24+0, |
| 377 | 32+4, 32+0, 48+4, 48+0, |
| 378 | 40+4, 40+0, 56+4, 56+0, |
| 379 | }, |
| 380 | { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64, |
| 381 | 8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 }, |
| 382 | 128*8 /* every sprite takes 128 consecutive bytes */ |
| 402 | 383 | }; |
| 403 | 384 | |
| 404 | 385 | static GFXDECODE_START( 2mindril ) |
| 405 | | GFXDECODE_ENTRY( "gfx1", 0, drill_layout, 0, 256 ) |
| 406 | | GFXDECODE_ENTRY( NULL, 0, vramlayout, 0, 256 ) |
| 386 | GFXDECODE_ENTRY( NULL, 0x000000, charlayout, 0x0000, 0x0400>>4 ) /* Dynamically modified */ |
| 387 | GFXDECODE_ENTRY( "gfx2", 0x000000, tile_layout, 0x0000, 0x2000>>4 ) /* Tiles area */ |
| 388 | GFXDECODE_ENTRY( "gfx1", 0x000000, spriteram_layout, 0x1000, 0x1000>>4 ) /* Sprites area */ |
| 389 | GFXDECODE_ENTRY( NULL, 0x000000, pivotlayout, 0x0000, 0x400>>4 ) /* Dynamically modified */ |
| 407 | 390 | GFXDECODE_END |
| 408 | 391 | |
| 409 | 392 | |
| 410 | | static INTERRUPT_GEN( drill_interrupt ) |
| 393 | static INTERRUPT_GEN( drill_vblank_irq ) |
| 411 | 394 | { |
| 412 | | device_set_input_line(device, 4, HOLD_LINE); |
| 395 | device_set_input_line(device, 4, ASSERT_LINE); |
| 413 | 396 | } |
| 414 | 397 | |
| 398 | #if 0 |
| 399 | static INTERRUPT_GEN( drill_device_irq ) |
| 400 | { |
| 401 | device_set_input_line(device, 5, ASSERT_LINE); |
| 402 | } |
| 403 | #endif |
| 404 | |
| 415 | 405 | /* WRONG,it does something with 60000c & 700002,likely to be called when the player throws the ball.*/ |
| 416 | 406 | static void irqhandler(device_t *device, int irq) |
| 417 | 407 | { |
| r11160 | r11161 | |
| 441 | 431 | |
| 442 | 432 | state->m_defender_sensor = 0; |
| 443 | 433 | state->m_shutter_sensor = 0; |
| 434 | state->irq_reg = 0; |
| 444 | 435 | } |
| 445 | 436 | |
| 446 | 437 | static MACHINE_CONFIG_START( drill, _2mindril_state ) |
| 447 | 438 | |
| 448 | 439 | MCFG_CPU_ADD("maincpu", M68000, 16000000 ) |
| 449 | 440 | MCFG_CPU_PROGRAM_MAP(drill_map) |
| 450 | | MCFG_CPU_VBLANK_INT("screen", drill_interrupt) |
| 441 | MCFG_CPU_VBLANK_INT("screen", drill_vblank_irq) |
| 442 | //MCFG_CPU_PERIODIC_INT(drill_device_irq,60) |
| 451 | 443 | MCFG_GFXDECODE(2mindril) |
| 452 | 444 | |
| 453 | 445 | MCFG_MACHINE_START(drill) |
| r11160 | r11161 | |
| 455 | 447 | |
| 456 | 448 | MCFG_SCREEN_ADD("screen", RASTER) |
| 457 | 449 | MCFG_SCREEN_REFRESH_RATE(60) |
| 458 | | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 459 | | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 460 | | MCFG_SCREEN_SIZE(128*16, 64*8) |
| 461 | | MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239-16) |
| 462 | | MCFG_SCREEN_UPDATE(drill) |
| 450 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* inaccurate, same as Taito F3? (needs screen raw params anyway) */ |
| 451 | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| 452 | MCFG_SCREEN_SIZE(40*8+48*2, 32*8) |
| 453 | MCFG_SCREEN_VISIBLE_AREA(46, 40*8-1 + 46, 24, 24+224-1) |
| 454 | MCFG_SCREEN_UPDATE(f3) |
| 455 | MCFG_SCREEN_EOF(f3) |
| 463 | 456 | |
| 464 | | MCFG_PALETTE_LENGTH(0x1000) |
| 457 | MCFG_PALETTE_LENGTH(0x2000) |
| 465 | 458 | |
| 466 | | MCFG_VIDEO_START(drill) |
| 459 | MCFG_VIDEO_START(f3) |
| 467 | 460 | |
| 468 | 461 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 469 | 462 | |
| 470 | | MCFG_SOUND_ADD("ymsnd", YM2610, 16000000/2) |
| 463 | MCFG_SOUND_ADD("ymsnd", YM2610B, 16000000/2) |
| 471 | 464 | MCFG_SOUND_CONFIG(ym2610_config) |
| 472 | 465 | MCFG_SOUND_ROUTE(0, "lspeaker", 0.25) |
| 473 | 466 | MCFG_SOUND_ROUTE(0, "rspeaker", 0.25) |
| r11160 | r11161 | |
| 485 | 478 | ROM_LOAD( "d58-11.ic31", 0x000000, 0x200000, CRC(dc26d58d) SHA1(cffb18667da18f5367b02af85a2f7674dd61ae97) ) |
| 486 | 479 | |
| 487 | 480 | ROM_REGION( 0x800000, "gfx1", ROMREGION_ERASE00 ) |
| 488 | | ROM_LOAD32_WORD( "d58-09.ic28", 0x000000, 0x200000, CRC(d8f6a86a) SHA1(d6b2ec309e21064574ee63e025ae4716b1982a98) ) |
| 489 | | ROM_LOAD32_WORD( "d58-08.ic27", 0x000002, 0x200000, CRC(9f5a3f52) SHA1(7b696bd823819965b974c853cebc1660750db61e) ) |
| 490 | 481 | |
| 491 | | ROM_REGION( 0x400000, "gfx2", 0 ) |
| 492 | | ROM_LOAD32_WORD( "d58-10.ic29", 0x000000, 0x200000, CRC(74c87e08) SHA1(f39b3a64f8338ccf5ca6eb76cee92a10fe0aad8f) ) |
| 482 | ROM_REGION( 0x800000, "gfx2", 0 ) |
| 483 | ROM_LOAD16_BYTE( "d58-09.ic28", 0x000001, 0x200000, CRC(d8f6a86a) SHA1(d6b2ec309e21064574ee63e025ae4716b1982a98) ) |
| 484 | ROM_LOAD16_BYTE( "d58-08.ic27", 0x000000, 0x200000, CRC(9f5a3f52) SHA1(7b696bd823819965b974c853cebc1660750db61e) ) |
| 485 | ROM_LOAD( "d58-10.ic29", 0x400000, 0x200000, CRC(74c87e08) SHA1(f39b3a64f8338ccf5ca6eb76cee92a10fe0aad8f) ) |
| 486 | ROM_RELOAD( 0x600000, 0x200000 ) |
| 493 | 487 | ROM_END |
| 494 | 488 | |
| 495 | | static DRIVER_INIT( drill ) |
| 489 | static void tile_decode(running_machine &machine) |
| 496 | 490 | { |
| 497 | | // rearrange gfx roms to something we can decode, two of the roms form 4bpp of the graphics, the third forms another 2bpp but is in a different format |
| 498 | | UINT32 *src = (UINT32*)machine.region( "gfx2" )->base(); |
| 499 | | UINT32 *dst = (UINT32*)machine.region( "gfx1" )->base();// + 0x400000; |
| 500 | | // UINT8 *rom = machine.region( "maincpu" )->base(); |
| 501 | | int i; |
| 491 | UINT8 lsb,msb; |
| 492 | UINT32 offset,i; |
| 493 | UINT8 *gfx = machine.region("gfx2")->base(); |
| 494 | int size=machine.region("gfx2")->bytes(); |
| 495 | int data; |
| 502 | 496 | |
| 503 | | for (i = 0; i < 0x400000 / 4; i++) |
| 497 | /* Setup ROM formats: |
| 498 | |
| 499 | Some games will only use 4 or 5 bpp sprites, and some only use 4 bpp tiles, |
| 500 | I don't believe this is software or prom controlled but simply the unused data lines |
| 501 | are tied low on the game board if unused. This is backed up by the fact the palette |
| 502 | indices are always related to 4 bpp data, even in 6 bpp games. |
| 503 | |
| 504 | Most (all?) games with 5bpp tiles have the sixth bit set. Also, in Arabian Magic |
| 505 | sprites 1200-120f contain 6bpp data which is probably bogus. |
| 506 | VIDEO_START( f3 ) clears the fifth and sixth bit of the decoded graphics according |
| 507 | to the bit depth specified in f3_config_table. |
| 508 | |
| 509 | */ |
| 510 | |
| 511 | offset = size/2; |
| 512 | for (i = size/2+size/4; i<size; i+=2) |
| 504 | 513 | { |
| 505 | | UINT32 dat1 = src[i]; |
| 506 | | dat1 = BITSWAP32(dat1, 3, 11, 19, 27, 2, 10, 18, 26, 1, 9, 17, 25, 0, 8, 16, 24, 7, 15, 23, 31, 6, 14, 22, 30, 5, 13, 21, 29, 4, 12, 20, 28 ); |
| 507 | | dst[(0x400000 / 4) + i] = dat1; |
| 514 | /* Expand 2bits into 4bits format */ |
| 515 | lsb = gfx[i+1]; |
| 516 | msb = gfx[i]; |
| 517 | |
| 518 | gfx[offset+0]=((msb&0x02)<<3) | ((msb&0x01)>>0) | ((lsb&0x02)<<4) | ((lsb&0x01)<<1); |
| 519 | gfx[offset+2]=((msb&0x08)<<1) | ((msb&0x04)>>2) | ((lsb&0x08)<<2) | ((lsb&0x04)>>1); |
| 520 | gfx[offset+1]=((msb&0x20)>>1) | ((msb&0x10)>>4) | ((lsb&0x20)<<0) | ((lsb&0x10)>>3); |
| 521 | gfx[offset+3]=((msb&0x80)>>3) | ((msb&0x40)>>6) | ((lsb&0x80)>>2) | ((lsb&0x40)>>5); |
| 522 | |
| 523 | offset+=4; |
| 508 | 524 | } |
| 509 | 525 | |
| 510 | | //enable some kind of debug mode (ignore errors) |
| 511 | | // rom[0x7fffb] = 0; |
| 512 | | // rom[0x7fffc] = 0; |
| 513 | | // rom[0x7fffd] = 0; |
| 514 | | // rom[0x7fffe] = 0; |
| 526 | gfx = machine.region("gfx1")->base(); |
| 527 | size=machine.region("gfx1")->bytes(); |
| 528 | |
| 529 | offset = size/2; |
| 530 | for (i = size/2+size/4; i<size; i++) |
| 531 | { |
| 532 | int d1,d2,d3,d4; |
| 533 | |
| 534 | /* Expand 2bits into 4bits format */ |
| 535 | data = gfx[i]; |
| 536 | d1 = (data>>0) & 3; |
| 537 | d2 = (data>>2) & 3; |
| 538 | d3 = (data>>4) & 3; |
| 539 | d4 = (data>>6) & 3; |
| 540 | |
| 541 | gfx[offset] = (d1<<2) | (d2<<6); |
| 542 | offset++; |
| 543 | |
| 544 | gfx[offset] = (d3<<2) | (d4<<6); |
| 545 | offset++; |
| 546 | } |
| 515 | 547 | } |
| 516 | 548 | |
| 549 | static DRIVER_INIT( drill ) |
| 550 | { |
| 551 | taito_f3_state *state = machine.driver_data<taito_f3_state>(); |
| 552 | state->m_f3_game=TMDRILL; |
| 553 | tile_decode(machine); |
| 554 | } |
| 555 | |
| 517 | 556 | GAME( 1993, 2mindril, 0, drill, drill, drill, ROT0, "Taito", "Two Minute Drill", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE | GAME_MECHANICAL) |
src/mame/drivers/taito_f3.c
| r11160 | r11161 | |
| 12 | 12 | |
| 13 | 13 | Other Issues: |
| 14 | 14 | - Dsp isn't hooked up. |
| 15 | | - Crowd/boards not shown in the football games |
| 15 | - Various hacks in video core that needs squashing; |
| 16 | 16 | - Sound doesn't work in RidingF/RingRage? |
| 17 | 17 | (for RingRage it's probably a timing / cpu sync bug, if you go into test mode |
| 18 | 18 | for a while then exit you'll have sound, this doesn't work on RidingF) |
| 19 | | - It does work in ringrage but you have to enter test mode first |
| 19 | \- It does work in ringrage but you have to enter test mode first |
| 20 | 20 | - Sound balance is not emulated (see arabianm test mode) |
| 21 | 21 | - When playing space invaders dx in original mode, t.t. with overlay, the |
| 22 | | alpha blending effect is wrong (see Taito B version of game) |
| 22 | alpha blending effect is wrong (see Taito B version of game) |
| 23 | 23 | - Bubble Symphony has an alpha transition effect that doesn't appear in Mame |
| 24 | 24 | - Various other missing blending effects (see Mametesters) |
| 25 | - Find how this HW drives the CRTC, and convert video timings to use screen raw params; |
| 25 | 26 | |
| 26 | 27 | Feel free to report any other issues to me. |
| 27 | 28 | |
| r11160 | r11161 | |
| 147 | 148 | } |
| 148 | 149 | } |
| 149 | 150 | |
| 151 | static WRITE16_HANDLER( f3_unk_w ) |
| 152 | { |
| 153 | /* |
| 154 | Several games writes a value here at POST, dunno what kind of config this is ... |
| 155 | ringrage: 0x0000 |
| 156 | arabianm: 0x0000 |
| 157 | ridingf: (no init) |
| 158 | gseeker: (no init) |
| 159 | commandw:(no init) |
| 160 | cupfinal: 0x0100 |
| 161 | trstar: (no init) |
| 162 | gunlock: 0x0000 |
| 163 | scfinals: 0x0100 |
| 164 | lightbr: (no init) |
| 165 | intcup94: 0x0100 |
| 166 | kaiserkn: 0x0100 |
| 167 | dariusg: 0x278b |
| 168 | bublbob2:(no init) |
| 169 | pwrgoal: 0x0100 |
| 170 | qtheater: 0x0090 |
| 171 | elvactr: 0x278b |
| 172 | recalh: 0x0090 |
| 173 | spcinv95: 0x0100 |
| 174 | twinqix: (no init) |
| 175 | quizhuhu: 0x0000 |
| 176 | pbobble2: 0x278b |
| 177 | gekiridn: 0x278b |
| 178 | tcobra2: 0x0000 |
| 179 | bubblem: (no init) |
| 180 | cleopatr: 0x0100 |
| 181 | pbobble3: 0x278b |
| 182 | arkretn: 0x0000 |
| 183 | kirameki: 0x0100 |
| 184 | puchicar: 0x0000 |
| 185 | pbobble4: 0x278b |
| 186 | popnpop: 0x0000 |
| 187 | landmakr: 0x278b |
| 188 | */ |
| 189 | if(offset == 0) |
| 190 | logerror("0x4c0000 write %04x\n",data); |
| 191 | else |
| 192 | popmessage("0x4c0002 write %04x, contact MAMEdev",data); //shouldn't happen |
| 193 | } |
| 194 | |
| 150 | 195 | /******************************************************************************/ |
| 151 | 196 | |
| 152 | 197 | static ADDRESS_MAP_START( f3_map, AS_PROGRAM, 32 ) |
| r11160 | r11161 | |
| 155 | 200 | AM_RANGE(0x400000, 0x41ffff) AM_MIRROR(0x20000) AM_RAM AM_BASE_MEMBER(taito_f3_state, m_f3_ram) |
| 156 | 201 | AM_RANGE(0x440000, 0x447fff) AM_RAM_WRITE(f3_palette_24bit_w) AM_BASE_GENERIC(paletteram) |
| 157 | 202 | AM_RANGE(0x4a0000, 0x4a001f) AM_READWRITE(f3_control_r, f3_control_w) |
| 158 | | AM_RANGE(0x600000, 0x60ffff) AM_RAM AM_BASE_SIZE_MEMBER(taito_f3_state, m_spriteram, m_spriteram_size) |
| 159 | | AM_RANGE(0x610000, 0x61bfff) AM_RAM_WRITE(f3_pf_data_w) AM_BASE_MEMBER(taito_f3_state, m_f3_pf_data) |
| 160 | | AM_RANGE(0x61c000, 0x61dfff) AM_RAM_WRITE(f3_videoram_w) AM_BASE_MEMBER(taito_f3_state, m_videoram) |
| 161 | | AM_RANGE(0x61e000, 0x61ffff) AM_RAM_WRITE(f3_vram_w) AM_BASE_MEMBER(taito_f3_state, m_f3_vram) |
| 162 | | AM_RANGE(0x620000, 0x62ffff) AM_RAM_WRITE(f3_lineram_w) AM_BASE_MEMBER(taito_f3_state, m_f3_line_ram) |
| 163 | | AM_RANGE(0x630000, 0x63ffff) AM_RAM_WRITE(f3_pivot_w) AM_BASE_MEMBER(taito_f3_state, m_f3_pivot_ram) |
| 164 | | AM_RANGE(0x660000, 0x66000f) AM_WRITE(f3_control_0_w) |
| 165 | | AM_RANGE(0x660010, 0x66001f) AM_WRITE(f3_control_1_w) |
| 203 | AM_RANGE(0x4c0000, 0x4c0003) AM_WRITE16(f3_unk_w,0xffffffff) |
| 204 | AM_RANGE(0x600000, 0x60ffff) AM_READWRITE16(f3_spriteram_r,f3_spriteram_w,0xffffffff) //AM_BASE_SIZE_MEMBER(taito_f3_state, m_spriteram, m_spriteram_size) |
| 205 | AM_RANGE(0x610000, 0x61bfff) AM_READWRITE16(f3_pf_data_r,f3_pf_data_w,0xffffffff) //AM_BASE_MEMBER(taito_f3_state, m_f3_pf_data) |
| 206 | AM_RANGE(0x61c000, 0x61dfff) AM_READWRITE16(f3_videoram_r,f3_videoram_w,0xffffffff) //AM_BASE_MEMBER(taito_f3_state, m_videoram) |
| 207 | AM_RANGE(0x61e000, 0x61ffff) AM_READWRITE16(f3_vram_r,f3_vram_w,0xffffffff) //AM_BASE_MEMBER(taito_f3_state, m_f3_vram) |
| 208 | AM_RANGE(0x620000, 0x62ffff) AM_READWRITE16(f3_lineram_r,f3_lineram_w,0xffffffff) //AM_BASE_MEMBER(taito_f3_state, m_f3_line_ram) |
| 209 | AM_RANGE(0x630000, 0x63ffff) AM_READWRITE16(f3_pivot_r,f3_pivot_w,0xffffffff) //AM_BASE_MEMBER(taito_f3_state, m_f3_pivot_ram) |
| 210 | AM_RANGE(0x660000, 0x66000f) AM_WRITE16(f3_control_0_w,0xffffffff) |
| 211 | AM_RANGE(0x660010, 0x66001f) AM_WRITE16(f3_control_1_w,0xffffffff) |
| 166 | 212 | AM_RANGE(0xc00000, 0xc007ff) AM_RAM AM_SHARE("f3_shared") |
| 167 | 213 | AM_RANGE(0xc80000, 0xc80003) AM_WRITE(f3_sound_reset_0_w) |
| 168 | 214 | AM_RANGE(0xc80100, 0xc80103) AM_WRITE(f3_sound_reset_1_w) |
| r11160 | r11161 | |
| 288 | 334 | |
| 289 | 335 | /******************************************************************************/ |
| 290 | 336 | |
| 291 | | #define XOR(a) WORD2_XOR_BE(a) |
| 292 | | |
| 293 | 337 | static const gfx_layout charlayout = |
| 294 | 338 | { |
| 295 | 339 | 8,8, |
| 296 | 340 | 256, |
| 297 | 341 | 4, |
| 298 | 342 | { 0,1,2,3 }, |
| 299 | | { XOR(7)*4, XOR(6)*4, XOR(5)*4, XOR(4)*4, XOR(3)*4, XOR(2)*4, XOR(1)*4, XOR(0)*4 }, |
| 343 | { 20, 16, 28, 24, 4, 0, 12, 8 }, |
| 300 | 344 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, |
| 301 | 345 | 32*8 |
| 302 | 346 | }; |
| r11160 | r11161 | |
| 307 | 351 | 2048, |
| 308 | 352 | 4, |
| 309 | 353 | { 0,1,2,3 }, |
| 310 | | { XOR(7)*4, XOR(6)*4, XOR(5)*4, XOR(4)*4, XOR(3)*4, XOR(2)*4, XOR(1)*4, XOR(0)*4 }, |
| 354 | { 20, 16, 28, 24, 4, 0, 12, 8 }, |
| 311 | 355 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, |
| 312 | 356 | 32*8 |
| 313 | 357 | }; |
| r11160 | r11161 | |
| 346 | 390 | }; |
| 347 | 391 | |
| 348 | 392 | static GFXDECODE_START( taito_f3 ) |
| 349 | | GFXDECODE_ENTRY( NULL, 0x000000, charlayout, 0x0000, 0x400>>4 ) /* Dynamically modified */ |
| 350 | | GFXDECODE_ENTRY( "gfx2", 0x000000, tile_layout, 0x0000, 0x2000>>4 ) /* Tiles area */ |
| 393 | GFXDECODE_ENTRY( NULL, 0x000000, charlayout, 0x0000, 0x0400>>4 ) /* Dynamically modified */ |
| 394 | GFXDECODE_ENTRY( "gfx2", 0x000000, tile_layout, 0x0000, 0x2000>>4 ) /* Tiles area */ |
| 351 | 395 | GFXDECODE_ENTRY( "gfx1", 0x000000, spriteram_layout, 0x1000, 0x1000>>4 ) /* Sprites area */ |
| 352 | | GFXDECODE_ENTRY( NULL, 0x000000, pivotlayout, 0x0000, 0x400>>4 ) /* Dynamically modified */ |
| 396 | GFXDECODE_ENTRY( NULL, 0x000000, pivotlayout, 0x0000, 0x400>>4 ) /* Dynamically modified */ |
| 353 | 397 | GFXDECODE_END |
| 354 | 398 | |
| 355 | 399 | /******************************************************************************/ |
| r11160 | r11161 | |
| 445 | 489 | |
| 446 | 490 | MCFG_DEVICE_REMOVE("eeprom") |
| 447 | 491 | MCFG_EEPROM_93C46_ADD("eeprom") |
| 448 | | MCFG_EEPROM_DATA(recalh_eeprom, 128) |
| 492 | MCFG_EEPROM_DATA(recalh_eeprom, 128) //TODO: convert this into ROM |
| 449 | 493 | MACHINE_CONFIG_END |
| 450 | 494 | |
| 451 | 495 | static MACHINE_CONFIG_DERIVED( f3_224b_eeprom, f3 ) |
| 452 | 496 | |
| 453 | 497 | MCFG_DEVICE_REMOVE("eeprom") |
| 454 | 498 | MCFG_EEPROM_93C46_ADD("eeprom") |
| 455 | | MCFG_EEPROM_DATA(recalh_eeprom, 128) |
| 499 | MCFG_EEPROM_DATA(recalh_eeprom, 128) //TODO: convert this into ROM |
| 456 | 500 | MACHINE_CONFIG_END |
| 457 | 501 | |
| 458 | 502 | static const gfx_layout bubsympb_sprite_layout = |
| r11160 | r11161 | |
| 538 | 582 | ROM_LOAD ("d21-08.51", 0x180000, 0x080000, CRC(a0d95be9) SHA1(1746097e827ac10906f012c5c4f93c388a30f4b3) ) |
| 539 | 583 | ROM_FILL ( 0x100000, 0x080000, 0 ) |
| 540 | 584 | |
| 585 | |
| 586 | |
| 541 | 587 | ROM_REGION(0x140000, "audiocpu", 0) /* sound CPU */ |
| 542 | 588 | ROM_LOAD16_BYTE("d21-18.5", 0x100000, 0x20000, CRC(133b55d0) SHA1(feb5c9d0b1adcae3b16eb206c8ac4e73fd88bef4) ) |
| 543 | 589 | ROM_LOAD16_BYTE("d21-19.6", 0x100001, 0x20000, CRC(1f98908f) SHA1(972c8f7e4e417831466714efd0b4cadca1f3e8e5) ) |
| r11160 | r11161 | |
| 567 | 613 | ROM_LOAD ("d21-08.51", 0x180000, 0x080000, CRC(a0d95be9) SHA1(1746097e827ac10906f012c5c4f93c388a30f4b3) ) |
| 568 | 614 | ROM_FILL ( 0x100000, 0x080000, 0 ) |
| 569 | 615 | |
| 616 | |
| 617 | |
| 570 | 618 | ROM_REGION(0x140000, "audiocpu", 0) /* sound CPU */ |
| 571 | 619 | ROM_LOAD16_BYTE("d21-18.5", 0x100000, 0x20000, CRC(133b55d0) SHA1(feb5c9d0b1adcae3b16eb206c8ac4e73fd88bef4) ) |
| 572 | 620 | ROM_LOAD16_BYTE("d21-19.6", 0x100001, 0x20000, CRC(1f98908f) SHA1(972c8f7e4e417831466714efd0b4cadca1f3e8e5) ) |
| r11160 | r11161 | |
| 1172 | 1220 | ROM_LOAD ("d53-11.50", 0x300000, 0x100000, CRC(39c0a546) SHA1(53f03586f6586032fc3b4f90e987c1128edbb0a7) ) |
| 1173 | 1221 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 1174 | 1222 | |
| 1223 | |
| 1224 | |
| 1175 | 1225 | ROM_REGION(0x140000, "audiocpu", 0) /* 68000 sound CPU */ |
| 1176 | 1226 | ROM_LOAD16_BYTE("d53-13.10", 0x100000, 0x20000, CRC(877f0361) SHA1(eda58d71fb06f739bee1451d7aa7e7e6dee10e03) ) |
| 1177 | 1227 | ROM_LOAD16_BYTE("d53-14.23", 0x100001, 0x20000, CRC(a8664867) SHA1(dffddca469019abac33a1abe41c3fe83fbf553ce) ) |
| r11160 | r11161 | |
| 1200 | 1250 | ROM_LOAD ("d66-08.ic49", 0x300000, 0x100000, CRC(9959f30b) SHA1(64bf2bf995c283c00d968e3c078b824de4084d3d) ) |
| 1201 | 1251 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 1202 | 1252 | |
| 1253 | |
| 1254 | |
| 1203 | 1255 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 code */ |
| 1204 | 1256 | ROM_LOAD16_BYTE("d66-23.ic10", 0x100000, 0x40000, CRC(57fb7c49) SHA1(f8709fd1e9ea7cee10ee2288d13339f675a7d3ae) ) |
| 1205 | 1257 | ROM_LOAD16_BYTE("d66-22.ic23", 0x100001, 0x40000, CRC(83dd7f9b) SHA1(dae21f64232d3e268f22b5e9899e0b726fdc9a9f) ) |
| r11160 | r11161 | |
| 1228 | 1280 | ROM_LOAD ("d66-08.ic49", 0x300000, 0x100000, CRC(9959f30b) SHA1(64bf2bf995c283c00d968e3c078b824de4084d3d) ) |
| 1229 | 1281 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 1230 | 1282 | |
| 1283 | |
| 1284 | |
| 1231 | 1285 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 code */ |
| 1232 | 1286 | ROM_LOAD16_BYTE("d66-23.ic10", 0x100000, 0x40000, CRC(57fb7c49) SHA1(f8709fd1e9ea7cee10ee2288d13339f675a7d3ae) ) |
| 1233 | 1287 | ROM_LOAD16_BYTE("d66-22.ic23", 0x100001, 0x40000, CRC(83dd7f9b) SHA1(dae21f64232d3e268f22b5e9899e0b726fdc9a9f) ) |
| r11160 | r11161 | |
| 1256 | 1310 | ROM_LOAD ("d66-08.ic49", 0x300000, 0x100000, CRC(9959f30b) SHA1(64bf2bf995c283c00d968e3c078b824de4084d3d) ) |
| 1257 | 1311 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 1258 | 1312 | |
| 1313 | |
| 1314 | |
| 1259 | 1315 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 code */ |
| 1260 | 1316 | ROM_LOAD16_BYTE("d66-23.ic10", 0x100000, 0x40000, CRC(57fb7c49) SHA1(f8709fd1e9ea7cee10ee2288d13339f675a7d3ae) ) |
| 1261 | 1317 | ROM_LOAD16_BYTE("d66-22.ic23", 0x100001, 0x40000, CRC(83dd7f9b) SHA1(dae21f64232d3e268f22b5e9899e0b726fdc9a9f) ) |
| r11160 | r11161 | |
| 1287 | 1343 | ROM_LOAD ("d49-11", 0x180000, 0x080000, CRC(11318b26) SHA1(a7153f9f406d52189f59cbe58d65f88f4e2e6fcc) ) |
| 1288 | 1344 | ROM_FILL ( 0x100000, 0x080000, 0 ) |
| 1289 | 1345 | |
| 1346 | |
| 1347 | |
| 1290 | 1348 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 1291 | 1349 | ROM_LOAD16_BYTE("d49-17.32", 0x100000, 0x40000, CRC(49942466) SHA1(5e355a079b81f129919c7599c0cc09a9e193ea41) ) |
| 1292 | 1350 | ROM_LOAD16_BYTE("d49-18.33", 0x100001, 0x40000, CRC(9d75b7d4) SHA1(1dc823327294f5c81b78f151fcd3d0550c208697) ) |
| r11160 | r11161 | |
| 1319 | 1377 | ROM_LOAD ("d69-05.bin", 0x600000, 0x200000, CRC(f9f5433c) SHA1(d3de66385d883c72967c44bc29983d7a79f665d1) ) |
| 1320 | 1378 | ROM_FILL ( 0x400000, 0x200000, 0 ) |
| 1321 | 1379 | |
| 1380 | |
| 1381 | |
| 1322 | 1382 | ROM_REGION(0x140000, "audiocpu", 0) /* 68000 sound CPU */ |
| 1323 | 1383 | ROM_LOAD16_BYTE("d69-18.bin", 0x100000, 0x20000, CRC(04600d7b) SHA1(666cfab09b61fd6e0bc4ff277018ebf1cda01b0e) ) |
| 1324 | 1384 | ROM_LOAD16_BYTE("d69-19.bin", 0x100001, 0x20000, CRC(1484e853) SHA1(4459c18ba005786483c652857e527c6093efb036) ) |
| r11160 | r11161 | |
| 1350 | 1410 | ROM_LOAD ("d69-05.bin", 0x600000, 0x200000, CRC(f9f5433c) SHA1(d3de66385d883c72967c44bc29983d7a79f665d1) ) |
| 1351 | 1411 | ROM_FILL ( 0x400000, 0x200000, 0 ) |
| 1352 | 1412 | |
| 1413 | |
| 1414 | |
| 1353 | 1415 | ROM_REGION(0x140000, "audiocpu", 0) /* 68000 sound CPU */ |
| 1354 | 1416 | ROM_LOAD16_BYTE("d69-18.bin", 0x100000, 0x20000, CRC(04600d7b) SHA1(666cfab09b61fd6e0bc4ff277018ebf1cda01b0e) ) |
| 1355 | 1417 | ROM_LOAD16_BYTE("d69-19.bin", 0x100001, 0x20000, CRC(1484e853) SHA1(4459c18ba005786483c652857e527c6093efb036) ) |
| r11160 | r11161 | |
| 1381 | 1443 | ROM_LOAD ("d69-05.bin", 0x600000, 0x200000, CRC(f9f5433c) SHA1(d3de66385d883c72967c44bc29983d7a79f665d1) ) |
| 1382 | 1444 | ROM_FILL ( 0x400000, 0x200000, 0 ) |
| 1383 | 1445 | |
| 1446 | |
| 1447 | |
| 1384 | 1448 | ROM_REGION(0x140000, "audiocpu", 0) /* 68000 sound CPU */ |
| 1385 | 1449 | ROM_LOAD16_BYTE("d69-18.bin", 0x100000, 0x20000, CRC(04600d7b) SHA1(666cfab09b61fd6e0bc4ff277018ebf1cda01b0e) ) |
| 1386 | 1450 | ROM_LOAD16_BYTE("d69-19.bin", 0x100001, 0x20000, CRC(1484e853) SHA1(4459c18ba005786483c652857e527c6093efb036) ) |
| r11160 | r11161 | |
| 1472 | 1536 | ROM_LOAD ("d69-05.bin", 0x600000, 0x200000, CRC(f9f5433c) SHA1(d3de66385d883c72967c44bc29983d7a79f665d1) ) |
| 1473 | 1537 | ROM_FILL ( 0x400000, 0x200000, 0 ) |
| 1474 | 1538 | |
| 1539 | |
| 1540 | |
| 1475 | 1541 | ROM_REGION(0x140000, "audiocpu", 0) /* 68000 sound CPU */ |
| 1476 | 1542 | ROM_LOAD16_BYTE("d69-18.bin", 0x100000, 0x20000, CRC(04600d7b) SHA1(666cfab09b61fd6e0bc4ff277018ebf1cda01b0e) ) |
| 1477 | 1543 | ROM_LOAD16_BYTE("d69-19.bin", 0x100001, 0x20000, CRC(1484e853) SHA1(4459c18ba005786483c652857e527c6093efb036) ) |
| r11160 | r11161 | |
| 1503 | 1569 | ROM_LOAD ("d78-03.43", 0x180000, 0x080000, CRC(a8bc36e5) SHA1(5777b9457292e8a9cbb4e8226ba939530ffab07c) ) |
| 1504 | 1570 | ROM_FILL ( 0x100000, 0x080000, 0 ) |
| 1505 | 1571 | |
| 1572 | |
| 1573 | |
| 1506 | 1574 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 1507 | 1575 | ROM_LOAD16_BYTE("d78-08.32", 0x100000, 0x20000, CRC(a629d07c) SHA1(b2904e106633a3960ceb2bc58b600ea60034ff0b) ) |
| 1508 | 1576 | ROM_LOAD16_BYTE("d78-09.33", 0x100001, 0x20000, CRC(1f0efe01) SHA1(7bff748b9fcee170e430d90ee07eb9975d8fba59) ) |
| r11160 | r11161 | |
| 1535 | 1603 | ROM_LOAD ("d78-03.43", 0x180000, 0x080000, CRC(a8bc36e5) SHA1(5777b9457292e8a9cbb4e8226ba939530ffab07c) ) |
| 1536 | 1604 | ROM_FILL ( 0x100000, 0x080000, 0 ) |
| 1537 | 1605 | |
| 1606 | |
| 1607 | |
| 1538 | 1608 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 1539 | 1609 | ROM_LOAD16_BYTE("d78-08.32", 0x100000, 0x20000, CRC(a629d07c) SHA1(b2904e106633a3960ceb2bc58b600ea60034ff0b) ) |
| 1540 | 1610 | ROM_LOAD16_BYTE("d78-09.33", 0x100001, 0x20000, CRC(1f0efe01) SHA1(7bff748b9fcee170e430d90ee07eb9975d8fba59) ) |
| r11160 | r11161 | |
| 1562 | 1632 | ROM_LOAD16_BYTE("rh_scrm.bin", 0x000001, 0x100000, CRC(37200968) SHA1(4a8d5a17af7eb732f481bf174099845e8d8d6b87) ) |
| 1563 | 1633 | ROM_FILL ( 0x200000, 0x200000, 0 ) |
| 1564 | 1634 | |
| 1635 | |
| 1636 | |
| 1565 | 1637 | ROM_REGION(0x140000, "audiocpu", 0) /* sound CPU */ |
| 1566 | 1638 | ROM_LOAD16_BYTE("rh_spr1.bin", 0x100000, 0x20000, CRC(504cbc1d) SHA1(35a775c1ebc8107c553e43b9d84eb735446c26fd) ) |
| 1567 | 1639 | ROM_LOAD16_BYTE("rh_spr0.bin", 0x100001, 0x20000, CRC(78fba467) SHA1(4586b061724be7ec413784b820c33cc0d6bbcd0c) ) |
| r11160 | r11161 | |
| 1603 | 1675 | ROM_LOAD ("d84-18.rom", 0xb00000, 0x100000, CRC(e812bcc5) SHA1(3574e4a99232d9fc7989ec5d1e8fe76b4b30784a) ) |
| 1604 | 1676 | ROM_FILL ( 0x600000, 0x300000, 0 ) |
| 1605 | 1677 | |
| 1678 | |
| 1679 | |
| 1606 | 1680 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 1607 | 1681 | ROM_LOAD16_BYTE("d84-26.32", 0x100000, 0x40000, CRC(4f5b8563) SHA1(1d4e06cbea7bc73a99d6e30be714fff420151bbc) ) |
| 1608 | 1682 | ROM_LOAD16_BYTE("d84-27.33", 0x100001, 0x40000, CRC(fb0cb1ba) SHA1(16a79b53651a6131f7636db19738b456b7c28bff) ) |
| r11160 | r11161 | |
| 1646 | 1720 | ROM_LOAD ("d84-18.rom", 0xb00000, 0x100000, CRC(e812bcc5) SHA1(3574e4a99232d9fc7989ec5d1e8fe76b4b30784a) ) |
| 1647 | 1721 | ROM_FILL ( 0x600000, 0x300000, 0 ) |
| 1648 | 1722 | |
| 1723 | |
| 1724 | |
| 1649 | 1725 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 1650 | 1726 | ROM_LOAD16_BYTE("d84-26.32", 0x100000, 0x40000, CRC(4f5b8563) SHA1(1d4e06cbea7bc73a99d6e30be714fff420151bbc) ) |
| 1651 | 1727 | ROM_LOAD16_BYTE("d84-27.33", 0x100001, 0x40000, CRC(fb0cb1ba) SHA1(16a79b53651a6131f7636db19738b456b7c28bff) ) |
| r11160 | r11161 | |
| 1689 | 1765 | ROM_LOAD ("d84-18.rom", 0xb00000, 0x100000, CRC(e812bcc5) SHA1(3574e4a99232d9fc7989ec5d1e8fe76b4b30784a) ) |
| 1690 | 1766 | ROM_FILL ( 0x600000, 0x300000, 0 ) |
| 1691 | 1767 | |
| 1768 | |
| 1769 | |
| 1692 | 1770 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 1693 | 1771 | ROM_LOAD16_BYTE("d84-26.32", 0x100000, 0x40000, CRC(4f5b8563) SHA1(1d4e06cbea7bc73a99d6e30be714fff420151bbc) ) |
| 1694 | 1772 | ROM_LOAD16_BYTE("d84-27.33", 0x100001, 0x40000, CRC(fb0cb1ba) SHA1(16a79b53651a6131f7636db19738b456b7c28bff) ) |
| r11160 | r11161 | |
| 1732 | 1810 | ROM_LOAD ("d84-18.rom", 0xb00000, 0x100000, CRC(e812bcc5) SHA1(3574e4a99232d9fc7989ec5d1e8fe76b4b30784a) ) |
| 1733 | 1811 | ROM_FILL ( 0x600000, 0x300000, 0 ) |
| 1734 | 1812 | |
| 1813 | |
| 1814 | |
| 1735 | 1815 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 1736 | 1816 | ROM_LOAD16_BYTE("d84-26.32", 0x100000, 0x40000, CRC(4f5b8563) SHA1(1d4e06cbea7bc73a99d6e30be714fff420151bbc) ) |
| 1737 | 1817 | ROM_LOAD16_BYTE("d84-27.33", 0x100001, 0x40000, CRC(fb0cb1ba) SHA1(16a79b53651a6131f7636db19738b456b7c28bff) ) |
| r11160 | r11161 | |
| 1763 | 1843 | ROM_LOAD ("d87-08.bin", 0x600000, 0x200000, CRC(76d23602) SHA1(ca53ea6641182c44a4038bbeaa5effb1687f1980) ) |
| 1764 | 1844 | ROM_FILL ( 0x400000, 0x200000, 0 ) |
| 1765 | 1845 | |
| 1846 | |
| 1847 | |
| 1766 | 1848 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 1767 | 1849 | ROM_LOAD16_BYTE("d87-13.bin", 0x100000, 0x40000, CRC(15b1fff4) SHA1(28692b731ae98a47c2c5e11a8a71b61a813d9a64) ) |
| 1768 | 1850 | ROM_LOAD16_BYTE("d87-14.bin", 0x100001, 0x40000, CRC(eecda29a) SHA1(6eb238e47bc7bf635ffbdbb25fb06a37db980ef8) ) |
| r11160 | r11161 | |
| 1791 | 1873 | ROM_LOAD ("d87-08.bin", 0x600000, 0x200000, CRC(76d23602) SHA1(ca53ea6641182c44a4038bbeaa5effb1687f1980) ) |
| 1792 | 1874 | ROM_FILL ( 0x400000, 0x200000, 0 ) |
| 1793 | 1875 | |
| 1876 | |
| 1877 | |
| 1794 | 1878 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 1795 | 1879 | ROM_LOAD16_BYTE("d87-13.bin", 0x100000, 0x40000, CRC(15b1fff4) SHA1(28692b731ae98a47c2c5e11a8a71b61a813d9a64) ) |
| 1796 | 1880 | ROM_LOAD16_BYTE("d87-14.bin", 0x100001, 0x40000, CRC(eecda29a) SHA1(6eb238e47bc7bf635ffbdbb25fb06a37db980ef8) ) |
| r11160 | r11161 | |
| 1819 | 1903 | ROM_LOAD ("d87-08.bin", 0x600000, 0x200000, CRC(76d23602) SHA1(ca53ea6641182c44a4038bbeaa5effb1687f1980) ) |
| 1820 | 1904 | ROM_FILL ( 0x400000, 0x200000, 0 ) |
| 1821 | 1905 | |
| 1906 | |
| 1907 | |
| 1822 | 1908 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 1823 | 1909 | ROM_LOAD16_BYTE("d87-13.bin", 0x100000, 0x40000, CRC(15b1fff4) SHA1(28692b731ae98a47c2c5e11a8a71b61a813d9a64) ) |
| 1824 | 1910 | ROM_LOAD16_BYTE("d87-14.bin", 0x100001, 0x40000, CRC(eecda29a) SHA1(6eb238e47bc7bf635ffbdbb25fb06a37db980ef8) ) |
| r11160 | r11161 | |
| 1847 | 1933 | ROM_LOAD ("d87-08.bin", 0x600000, 0x200000, CRC(76d23602) SHA1(ca53ea6641182c44a4038bbeaa5effb1687f1980) ) |
| 1848 | 1934 | ROM_FILL ( 0x400000, 0x200000, 0 ) |
| 1849 | 1935 | |
| 1936 | |
| 1937 | |
| 1850 | 1938 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 1851 | 1939 | ROM_LOAD16_BYTE("d87-13.bin", 0x100000, 0x40000, CRC(15b1fff4) SHA1(28692b731ae98a47c2c5e11a8a71b61a813d9a64) ) |
| 1852 | 1940 | ROM_LOAD16_BYTE("d87-14.bin", 0x100001, 0x40000, CRC(eecda29a) SHA1(6eb238e47bc7bf635ffbdbb25fb06a37db980ef8) ) |
| r11160 | r11161 | |
| 1875 | 1963 | ROM_LOAD ("d90-06", 0x300000, 0x100000, CRC(166a72b8) SHA1(7f70b8c960794322e1dc88e6600a2d13d948d873) ) |
| 1876 | 1964 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 1877 | 1965 | |
| 1966 | |
| 1967 | |
| 1878 | 1968 | ROM_REGION(0x180000, "audiocpu", 0) /* sound CPU */ |
| 1879 | 1969 | ROM_LOAD16_BYTE("d90-13", 0x100000, 0x40000, CRC(6762bd90) SHA1(771db0382bc8dab2caf13d0fc20648366c685829) ) |
| 1880 | 1970 | ROM_LOAD16_BYTE("d90-14", 0x100001, 0x40000, CRC(8e33357e) SHA1(68b81693c22e6357e37244f2a416818a81338138) ) |
| r11160 | r11161 | |
| 1903 | 1993 | ROM_LOAD ("d90-06", 0x300000, 0x100000, CRC(166a72b8) SHA1(7f70b8c960794322e1dc88e6600a2d13d948d873) ) |
| 1904 | 1994 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 1905 | 1995 | |
| 1996 | |
| 1997 | |
| 1906 | 1998 | ROM_REGION(0x180000, "audiocpu", 0) /* sound CPU */ |
| 1907 | 1999 | ROM_LOAD16_BYTE("d90-13", 0x100000, 0x40000, CRC(6762bd90) SHA1(771db0382bc8dab2caf13d0fc20648366c685829) ) |
| 1908 | 2000 | ROM_LOAD16_BYTE("d90-14", 0x100001, 0x40000, CRC(8e33357e) SHA1(68b81693c22e6357e37244f2a416818a81338138) ) |
| r11160 | r11161 | |
| 1931 | 2023 | ROM_LOAD ("d90-06", 0x300000, 0x100000, CRC(166a72b8) SHA1(7f70b8c960794322e1dc88e6600a2d13d948d873) ) |
| 1932 | 2024 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 1933 | 2025 | |
| 2026 | |
| 2027 | |
| 1934 | 2028 | ROM_REGION(0x180000, "audiocpu", 0) /* sound CPU */ |
| 1935 | 2029 | ROM_LOAD16_BYTE("d90-13", 0x100000, 0x40000, CRC(6762bd90) SHA1(771db0382bc8dab2caf13d0fc20648366c685829) ) |
| 1936 | 2030 | ROM_LOAD16_BYTE("d90-14", 0x100001, 0x40000, CRC(8e33357e) SHA1(68b81693c22e6357e37244f2a416818a81338138) ) |
| r11160 | r11161 | |
| 2020 | 2114 | ROM_LOAD ("d90-06", 0x300000, 0x100000, CRC(166a72b8) SHA1(7f70b8c960794322e1dc88e6600a2d13d948d873) ) |
| 2021 | 2115 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 2022 | 2116 | |
| 2117 | |
| 2118 | |
| 2023 | 2119 | ROM_REGION(0x180000, "audiocpu", 0) /* sound CPU */ |
| 2024 | 2120 | ROM_LOAD16_BYTE("d90-13", 0x100000, 0x40000, CRC(6762bd90) SHA1(771db0382bc8dab2caf13d0fc20648366c685829) ) |
| 2025 | 2121 | ROM_LOAD16_BYTE("d90-14", 0x100001, 0x40000, CRC(8e33357e) SHA1(68b81693c22e6357e37244f2a416818a81338138) ) |
| r11160 | r11161 | |
| 2046 | 2142 | ROM_LOAD16_BYTE("d93-10.45", 0x000001, 0x20000, CRC(8a3f531b) SHA1(69f9971c45971018108a5d312d5bbcfd3caf9bd0) ) |
| 2047 | 2143 | ROM_FILL ( 0x040000, 0x40000, 0 ) |
| 2048 | 2144 | |
| 2145 | |
| 2146 | |
| 2049 | 2147 | ROM_REGION(0x140000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2050 | 2148 | ROM_LOAD16_BYTE("d93-05.bin", 0x100000, 0x20000, CRC(ff365596) SHA1(4cf2e0d6f42cf3fb69796be6092eff8a47f7f8b9) ) |
| 2051 | 2149 | ROM_LOAD16_BYTE("d93-06.bin", 0x100001, 0x20000, CRC(ef7ad400) SHA1(01be403d575a543f089b910a5a8c381a6603e67e) ) |
| r11160 | r11161 | |
| 2082 | 2180 | ROM_LOAD ("d94-12.bin", 0x300000, 0x100000, CRC(47064189) SHA1(99ceeb326dcc2e1c3acba8ac14d94dcb17c6e032) ) |
| 2083 | 2181 | ROM_FILL ( 0x200000, 0x100000,0 ) |
| 2084 | 2182 | |
| 2183 | |
| 2184 | |
| 2085 | 2185 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2086 | 2186 | ROM_LOAD16_BYTE("d94-19.bin", 0x100000, 0x40000, CRC(c93dbcf4) SHA1(413520e652d809651aff9b1b74e6353112d34c12) ) |
| 2087 | 2187 | ROM_LOAD16_BYTE("d94-20.bin", 0x100001, 0x40000, CRC(f232bf64) SHA1(bbfeae0785fc49c12aa6d9b1bd6ff7c8515f8fe7) ) |
| r11160 | r11161 | |
| 2116 | 2216 | ROM_LOAD ("d94-12.bin", 0x300000, 0x100000, CRC(47064189) SHA1(99ceeb326dcc2e1c3acba8ac14d94dcb17c6e032) ) |
| 2117 | 2217 | ROM_FILL ( 0x200000, 0x100000,0 ) |
| 2118 | 2218 | |
| 2219 | |
| 2220 | |
| 2119 | 2221 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2120 | 2222 | ROM_LOAD16_BYTE("d94-19.bin", 0x100000, 0x40000, CRC(c93dbcf4) SHA1(413520e652d809651aff9b1b74e6353112d34c12) ) |
| 2121 | 2223 | ROM_LOAD16_BYTE("d94-20.bin", 0x100001, 0x40000, CRC(f232bf64) SHA1(bbfeae0785fc49c12aa6d9b1bd6ff7c8515f8fe7) ) |
| r11160 | r11161 | |
| 2150 | 2252 | ROM_LOAD ("d94-12.bin", 0x300000, 0x100000, CRC(47064189) SHA1(99ceeb326dcc2e1c3acba8ac14d94dcb17c6e032) ) |
| 2151 | 2253 | ROM_FILL ( 0x200000, 0x100000,0 ) |
| 2152 | 2254 | |
| 2255 | |
| 2256 | |
| 2153 | 2257 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2154 | 2258 | ROM_LOAD16_BYTE("d94-19.bin", 0x100000, 0x40000, CRC(c93dbcf4) SHA1(413520e652d809651aff9b1b74e6353112d34c12) ) |
| 2155 | 2259 | ROM_LOAD16_BYTE("d94-20.bin", 0x100001, 0x40000, CRC(f232bf64) SHA1(bbfeae0785fc49c12aa6d9b1bd6ff7c8515f8fe7) ) |
| r11160 | r11161 | |
| 2176 | 2280 | ROM_LOAD16_BYTE("d95-05.45", 0x000001, 0x200000, CRC(1a1a852b) SHA1(89827485a31af4e2457775a5d16f747a764b6d67) ) |
| 2177 | 2281 | ROM_FILL ( 0x400000, 0x400000, 0 ) |
| 2178 | 2282 | |
| 2283 | |
| 2284 | |
| 2179 | 2285 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2180 | 2286 | ROM_LOAD16_BYTE("d95-07.32", 0x100000, 0x40000, CRC(3c201d70) SHA1(89fe4d363f4e1a847ba7d2894a2092708b287a33) ) |
| 2181 | 2287 | ROM_LOAD16_BYTE("d95-08.33", 0x100001, 0x40000, CRC(01c23354) SHA1(7b332edc844b1b1c1513e879215089987645fa3f) ) |
| r11160 | r11161 | |
| 2204 | 2310 | ROM_LOAD ("e06-06", 0x300000, 0x100000, CRC(9380db3c) SHA1(83f5a46a01b9c15499e0dc2222df496d26baa0d4) ) |
| 2205 | 2311 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 2206 | 2312 | |
| 2313 | |
| 2314 | |
| 2207 | 2315 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2208 | 2316 | ROM_LOAD16_BYTE("e06-09.32", 0x100000, 0x40000, CRC(9bcafc87) SHA1(10b3f6da00a41550fe6a705232f0e33fda3c7e7c) ) |
| 2209 | 2317 | ROM_LOAD16_BYTE("e06-10.33", 0x100001, 0x40000, CRC(b752b61f) SHA1(e948a8af19c70ba8b8e908c869bc88ed0cac8420) ) |
| r11160 | r11161 | |
| 2239 | 2347 | ROM_LOAD ("e06-06", 0x300000, 0x100000, CRC(9380db3c) SHA1(83f5a46a01b9c15499e0dc2222df496d26baa0d4) ) |
| 2240 | 2348 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 2241 | 2349 | |
| 2350 | |
| 2351 | |
| 2242 | 2352 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2243 | 2353 | ROM_LOAD16_BYTE("e06-09.32", 0x100000, 0x40000, CRC(9bcafc87) SHA1(10b3f6da00a41550fe6a705232f0e33fda3c7e7c) ) |
| 2244 | 2354 | ROM_LOAD16_BYTE("e06-10.33", 0x100001, 0x40000, CRC(b752b61f) SHA1(e948a8af19c70ba8b8e908c869bc88ed0cac8420) ) |
| r11160 | r11161 | |
| 2274 | 2384 | ROM_LOAD ("e06-06", 0x300000, 0x100000, CRC(9380db3c) SHA1(83f5a46a01b9c15499e0dc2222df496d26baa0d4) ) |
| 2275 | 2385 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 2276 | 2386 | |
| 2387 | |
| 2388 | |
| 2277 | 2389 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2278 | 2390 | ROM_LOAD16_BYTE("e06-09.32", 0x100000, 0x40000, CRC(9bcafc87) SHA1(10b3f6da00a41550fe6a705232f0e33fda3c7e7c) ) |
| 2279 | 2391 | ROM_LOAD16_BYTE("e06-10.33", 0x100001, 0x40000, CRC(b752b61f) SHA1(e948a8af19c70ba8b8e908c869bc88ed0cac8420) ) |
| r11160 | r11161 | |
| 2387 | 2499 | ROM_LOAD ("e02-06.43", 0x600000, 0x200000, CRC(4c8726e9) SHA1(8ce2320a087f43c49428a39dafffec8c40d61b03) ) |
| 2388 | 2500 | ROM_FILL ( 0x400000, 0x200000, 0 ) |
| 2389 | 2501 | |
| 2502 | |
| 2503 | |
| 2390 | 2504 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2391 | 2505 | ROM_LOAD16_BYTE("e02-13.32", 0x100000, 0x40000, CRC(80932702) SHA1(c468234d03aa31b2aa0c3bd6bec32034216c2ae4) ) |
| 2392 | 2506 | ROM_LOAD16_BYTE("e02-14.33", 0x100001, 0x40000, CRC(706671a5) SHA1(1ac90647d617e73f12a67274a025ae43a6b3a316) ) |
| r11160 | r11161 | |
| 2424 | 2538 | ROM_LOAD ("e02-06.43", 0x600000, 0x200000, CRC(4c8726e9) SHA1(8ce2320a087f43c49428a39dafffec8c40d61b03) ) |
| 2425 | 2539 | ROM_FILL ( 0x400000, 0x200000, 0 ) |
| 2426 | 2540 | |
| 2541 | |
| 2542 | |
| 2427 | 2543 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2428 | 2544 | ROM_LOAD16_BYTE("e02-13.32", 0x100000, 0x40000, CRC(80932702) SHA1(c468234d03aa31b2aa0c3bd6bec32034216c2ae4) ) |
| 2429 | 2545 | ROM_LOAD16_BYTE("e02-14.33", 0x100001, 0x40000, CRC(706671a5) SHA1(1ac90647d617e73f12a67274a025ae43a6b3a316) ) |
| r11160 | r11161 | |
| 2452 | 2568 | ROM_LOAD ("e02-06.43", 0x600000, 0x200000, CRC(4c8726e9) SHA1(8ce2320a087f43c49428a39dafffec8c40d61b03) ) |
| 2453 | 2569 | ROM_FILL ( 0x400000, 0x200000, 0 ) |
| 2454 | 2570 | |
| 2571 | |
| 2572 | |
| 2455 | 2573 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2456 | 2574 | ROM_LOAD16_BYTE("e02-13.32", 0x100000, 0x40000, CRC(80932702) SHA1(c468234d03aa31b2aa0c3bd6bec32034216c2ae4) ) |
| 2457 | 2575 | ROM_LOAD16_BYTE("e02-14.33", 0x100001, 0x40000, CRC(706671a5) SHA1(1ac90647d617e73f12a67274a025ae43a6b3a316) ) |
| r11160 | r11161 | |
| 2481 | 2599 | ROM_LOAD16_BYTE("scr0-4.b03", 0x300000, 0x080000, CRC(d32280fe) SHA1(56b120128c5e4b8c6598a1de51269e6702a63175) ) |
| 2482 | 2600 | ROM_LOAD16_BYTE("scr0-5.b02", 0x300001, 0x080000, CRC(fdd1a85b) SHA1(1d94a4858baef3e78c456049dc58249a574205fe) ) |
| 2483 | 2601 | |
| 2602 | |
| 2603 | |
| 2484 | 2604 | ROM_REGION(0x180000, "audiocpu", 0) /* sound CPU */ |
| 2485 | 2605 | ROM_LOAD16_BYTE("spr0-1.b66", 0x100000, 0x40000, CRC(4b20e99d) SHA1(faf184daea0f1131bafa50edb48bd470d4c0b141) ) |
| 2486 | 2606 | ROM_LOAD16_BYTE("spr0-0.b65", 0x100001, 0x40000, CRC(2569eb30) SHA1(ec804131025e600198cd8342925823340e7ef458) ) |
| r11160 | r11161 | |
| 2523 | 2643 | ROM_LOAD ("e08-10.43", 0x300000, 0x100000, CRC(60abc71b) SHA1(f4aa906920c6134c33a4dfb51724f3adbd3d7de4) ) |
| 2524 | 2644 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 2525 | 2645 | |
| 2646 | |
| 2647 | |
| 2526 | 2648 | ROM_REGION(0x140000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2527 | 2649 | ROM_LOAD16_BYTE("e08-18.32", 0x100000, 0x20000, CRC(e695497e) SHA1(9d845b4c0bd9b40471fb4b5ab2f9240058bc324f) ) |
| 2528 | 2650 | ROM_LOAD16_BYTE("e08-17.33", 0x100001, 0x20000, CRC(fafc7e4e) SHA1(26f46d5900fbf26d25651e7e818e486fc7a878ec) ) |
| r11160 | r11161 | |
| 2553 | 2675 | ROM_LOAD ("e10-05.rom", 0x300000, 0x100000, CRC(81266151) SHA1(aa3b144f32995425db97efce440e234a3c7a6715) ) |
| 2554 | 2676 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 2555 | 2677 | |
| 2678 | |
| 2679 | |
| 2556 | 2680 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2557 | 2681 | ROM_LOAD16_BYTE("e10-12.32", 0x100000, 0x40000, CRC(b92dc8ad) SHA1(0c1428d313507b1ae5a2af3b2fbaaa5650135e1e) ) |
| 2558 | 2682 | ROM_LOAD16_BYTE("e10-13.33", 0x100001, 0x40000, CRC(87842c13) SHA1(d15b47c7430e677ae172f86fd5be595e4fe72e42) ) |
| r11160 | r11161 | |
| 2585 | 2709 | ROM_LOAD ("e10-05.rom", 0x300000, 0x100000, CRC(81266151) SHA1(aa3b144f32995425db97efce440e234a3c7a6715) ) |
| 2586 | 2710 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 2587 | 2711 | |
| 2712 | |
| 2713 | |
| 2588 | 2714 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2589 | 2715 | ROM_LOAD16_BYTE("e10-12.32", 0x100000, 0x40000, CRC(b92dc8ad) SHA1(0c1428d313507b1ae5a2af3b2fbaaa5650135e1e) ) |
| 2590 | 2716 | ROM_LOAD16_BYTE("e10-13.33", 0x100001, 0x40000, CRC(87842c13) SHA1(d15b47c7430e677ae172f86fd5be595e4fe72e42) ) |
| r11160 | r11161 | |
| 2612 | 2738 | ROM_LOAD ("e10-05.rom", 0x300000, 0x100000, CRC(81266151) SHA1(aa3b144f32995425db97efce440e234a3c7a6715) ) |
| 2613 | 2739 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 2614 | 2740 | |
| 2741 | |
| 2742 | |
| 2615 | 2743 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2616 | 2744 | ROM_LOAD16_BYTE("e10-12.32", 0x100000, 0x40000, CRC(b92dc8ad) SHA1(0c1428d313507b1ae5a2af3b2fbaaa5650135e1e) ) |
| 2617 | 2745 | ROM_LOAD16_BYTE("e10-13.33", 0x100001, 0x40000, CRC(87842c13) SHA1(d15b47c7430e677ae172f86fd5be595e4fe72e42) ) |
| r11160 | r11161 | |
| 2639 | 2767 | ROM_LOAD ("e10-05.rom", 0x300000, 0x100000, CRC(81266151) SHA1(aa3b144f32995425db97efce440e234a3c7a6715) ) |
| 2640 | 2768 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 2641 | 2769 | |
| 2770 | |
| 2771 | |
| 2642 | 2772 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2643 | 2773 | ROM_LOAD16_BYTE("e10-16.32", 0x100000, 0x40000, CRC(765ce77a) SHA1(e2723bd6238da91d28307081909a7172a1825c83) ) |
| 2644 | 2774 | ROM_LOAD16_BYTE("e10-17.33", 0x100001, 0x40000, CRC(0aec3b1e) SHA1(a76a020cefcfbf86b0d893a6eb8ff93cb571abeb) ) |
| r11160 | r11161 | |
| 2666 | 2796 | ROM_LOAD ("e10-05.rom", 0x300000, 0x100000, CRC(81266151) SHA1(aa3b144f32995425db97efce440e234a3c7a6715) ) |
| 2667 | 2797 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 2668 | 2798 | |
| 2799 | |
| 2800 | |
| 2669 | 2801 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2670 | 2802 | ROM_LOAD16_BYTE("e10-30.32", 0x100000, 0x40000, CRC(bb090c1e) SHA1(af2ff23d6f9bd56c25530cb9bf9f452b6f5210f5) ) |
| 2671 | 2803 | ROM_LOAD16_BYTE("e10-31.33", 0x100001, 0x40000, CRC(f4b88d65) SHA1(c74dcb4bed979039fad1d5c7528c14ce4db1d5ec) ) |
| r11160 | r11161 | |
| 2701 | 2833 | ROM_LOAD ("e11-06.ic43", 0x600000, 0x200000, CRC(200ce305) SHA1(c80a0b96510913a6411e6763fb72bf413fb792da) ) |
| 2702 | 2834 | ROM_FILL ( 0x400000, 0x200000, 0 ) |
| 2703 | 2835 | |
| 2836 | |
| 2837 | |
| 2704 | 2838 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2705 | 2839 | ROM_LOAD16_BYTE("e11-13.ic32", 0x100000, 0x40000, CRC(f5c5486a) SHA1(4091f3ddb1e6cbc9dc89485e1e784a4b6fa191b7) ) |
| 2706 | 2840 | ROM_LOAD16_BYTE("e11-14.ic33", 0x100001, 0x40000, CRC(7fa10f96) SHA1(50efefd890535e952022a494c5b4e9b33bb90fad) ) |
| r11160 | r11161 | |
| 2729 | 2863 | ROM_LOAD ("e11-06.ic43", 0x600000, 0x200000, CRC(200ce305) SHA1(c80a0b96510913a6411e6763fb72bf413fb792da) ) |
| 2730 | 2864 | ROM_FILL ( 0x400000, 0x200000, 0 ) |
| 2731 | 2865 | |
| 2866 | |
| 2867 | |
| 2732 | 2868 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2733 | 2869 | ROM_LOAD16_BYTE("e11-13.ic32", 0x100000, 0x40000, CRC(f5c5486a) SHA1(4091f3ddb1e6cbc9dc89485e1e784a4b6fa191b7) ) |
| 2734 | 2870 | ROM_LOAD16_BYTE("e11-14.ic33", 0x100001, 0x40000, CRC(7fa10f96) SHA1(50efefd890535e952022a494c5b4e9b33bb90fad) ) |
| r11160 | r11161 | |
| 2759 | 2895 | ROM_LOAD16_BYTE("e15-07.bin", 0x400001, 0x100000, CRC(8164f7ee) SHA1(4550521f820e93ec08b86d148135966d016cbf22) ) |
| 2760 | 2896 | ROM_FILL ( 0x600000, 0x600000, 0 ) |
| 2761 | 2897 | |
| 2898 | |
| 2899 | |
| 2762 | 2900 | ROM_REGION(0x140000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2763 | 2901 | ROM_LOAD16_BYTE("e15-15.bin", 0x100000, 0x20000, CRC(22126dfb) SHA1(a1af17e5c3440f1bab50d79f92c251f1a4536ca0) ) |
| 2764 | 2902 | ROM_LOAD16_BYTE("e15-16.bin", 0x100001, 0x20000, CRC(f8b58ea0) SHA1(c9e196620765efc4c7b535793a5d1f586698ce55) ) |
| r11160 | r11161 | |
| 2789 | 2927 | ROM_LOAD16_BYTE("e15-07.bin", 0x400001, 0x100000, CRC(8164f7ee) SHA1(4550521f820e93ec08b86d148135966d016cbf22) ) |
| 2790 | 2928 | ROM_FILL ( 0x600000, 0x600000, 0 ) |
| 2791 | 2929 | |
| 2930 | |
| 2931 | |
| 2792 | 2932 | ROM_REGION(0x140000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2793 | 2933 | ROM_LOAD16_BYTE("e15-15.bin", 0x100000, 0x20000, CRC(22126dfb) SHA1(a1af17e5c3440f1bab50d79f92c251f1a4536ca0) ) |
| 2794 | 2934 | ROM_LOAD16_BYTE("e15-16.bin", 0x100001, 0x20000, CRC(f8b58ea0) SHA1(c9e196620765efc4c7b535793a5d1f586698ce55) ) |
| r11160 | r11161 | |
| 2819 | 2959 | ROM_LOAD16_BYTE("e15-07.bin", 0x400001, 0x100000, CRC(8164f7ee) SHA1(4550521f820e93ec08b86d148135966d016cbf22) ) |
| 2820 | 2960 | ROM_FILL ( 0x600000, 0x600000, 0 ) |
| 2821 | 2961 | |
| 2962 | |
| 2963 | |
| 2822 | 2964 | ROM_REGION(0x140000, "audiocpu", 0) /* 68000 sound CPU */ |
| 2823 | 2965 | ROM_LOAD16_BYTE("e15-15.bin", 0x100000, 0x20000, CRC(22126dfb) SHA1(a1af17e5c3440f1bab50d79f92c251f1a4536ca0) ) |
| 2824 | 2966 | ROM_LOAD16_BYTE("e15-16.bin", 0x100001, 0x20000, CRC(f8b58ea0) SHA1(c9e196620765efc4c7b535793a5d1f586698ce55) ) |
| r11160 | r11161 | |
| 2846 | 2988 | ROM_LOAD ("e21-05.rom", 0x300000, 0x100000, CRC(07eab58f) SHA1(ae2d7b839b39d88d11652df74804a39230674467) ) |
| 2847 | 2989 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 2848 | 2990 | |
| 2991 | |
| 2992 | |
| 2849 | 2993 | ROM_REGION(0x180000, "audiocpu", 0) /* Sound CPU */ |
| 2850 | 2994 | ROM_LOAD16_BYTE("e21-12.32", 0x100000, 0x40000, CRC(34093de1) SHA1(d69d6b5f10b8fe86f727d739ed5aecceb15e01f7) ) |
| 2851 | 2995 | ROM_LOAD16_BYTE("e21-13.33", 0x100001, 0x40000, CRC(9e9ec437) SHA1(b0265b688846c642d240b2f3677d2330d31eaa87) ) |
| r11160 | r11161 | |
| 2876 | 3020 | ROM_LOAD ("e21-05.rom", 0x300000, 0x100000, CRC(07eab58f) SHA1(ae2d7b839b39d88d11652df74804a39230674467) ) |
| 2877 | 3021 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 2878 | 3022 | |
| 3023 | |
| 3024 | |
| 2879 | 3025 | ROM_REGION(0x180000, "audiocpu", 0) /* Sound CPU */ |
| 2880 | 3026 | ROM_LOAD16_BYTE("e21-12.32", 0x100000, 0x40000, CRC(34093de1) SHA1(d69d6b5f10b8fe86f727d739ed5aecceb15e01f7) ) |
| 2881 | 3027 | ROM_LOAD16_BYTE("e21-13.33", 0x100001, 0x40000, CRC(9e9ec437) SHA1(b0265b688846c642d240b2f3677d2330d31eaa87) ) |
| r11160 | r11161 | |
| 2906 | 3052 | ROM_LOAD ("e28-04.bin", 0x300000, 0x100000, CRC(57aef029) SHA1(5c07209015d4749d1ffb3e9c1a890e6cfeec8cb0) ) |
| 2907 | 3053 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 2908 | 3054 | |
| 3055 | |
| 3056 | |
| 2909 | 3057 | ROM_REGION(0x140000, "audiocpu", 0) /* Sound CPU */ |
| 2910 | 3058 | ROM_LOAD16_BYTE("e28-11.bin", 0x100000, 0x20000, CRC(01a06950) SHA1(94d22cd839f9027e9d45264c366e0cb5d698e0b6) ) |
| 2911 | 3059 | ROM_LOAD16_BYTE("e28-12.bin", 0x100001, 0x20000, CRC(dc19260f) SHA1(fa0ca03a236326652e4f9898d07cd837c1507a9d) ) |
| r11160 | r11161 | |
| 2932 | 3080 | ROM_LOAD ("e29-06.rom", 0x300000, 0x100000, CRC(c16184f8) SHA1(ded417d9d116b5a2f7518fa404bc2dda1c6a6366) ) |
| 2933 | 3081 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 2934 | 3082 | |
| 3083 | |
| 3084 | |
| 2935 | 3085 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 code */ |
| 2936 | 3086 | ROM_LOAD16_BYTE("e29-13.rom", 0x100000, 0x40000, CRC(1ef551ef) SHA1(527defe8f35314304adb4b483285b08cd6ebe865) ) |
| 2937 | 3087 | ROM_LOAD16_BYTE("e29-14.rom", 0x100001, 0x40000, CRC(7ee7e688) SHA1(d65aa9c449e1d64f10d1be9727a9d93ab1571e65) ) |
| r11160 | r11161 | |
| 2961 | 3111 | ROM_LOAD ("e29-06.rom", 0x300000, 0x100000, CRC(c16184f8) SHA1(ded417d9d116b5a2f7518fa404bc2dda1c6a6366) ) |
| 2962 | 3112 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 2963 | 3113 | |
| 3114 | |
| 3115 | |
| 2964 | 3116 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 code */ |
| 2965 | 3117 | ROM_LOAD16_BYTE("e29-13.rom", 0x100000, 0x40000, CRC(1ef551ef) SHA1(527defe8f35314304adb4b483285b08cd6ebe865) ) |
| 2966 | 3118 | ROM_LOAD16_BYTE("e29-14.rom", 0x100001, 0x40000, CRC(7ee7e688) SHA1(d65aa9c449e1d64f10d1be9727a9d93ab1571e65) ) |
| r11160 | r11161 | |
| 2990 | 3142 | ROM_LOAD ("e29-06.rom", 0x300000, 0x100000, CRC(c16184f8) SHA1(ded417d9d116b5a2f7518fa404bc2dda1c6a6366) ) |
| 2991 | 3143 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 2992 | 3144 | |
| 3145 | |
| 3146 | |
| 2993 | 3147 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 code */ |
| 2994 | 3148 | ROM_LOAD16_BYTE("e29-13.rom", 0x100000, 0x40000, CRC(1ef551ef) SHA1(527defe8f35314304adb4b483285b08cd6ebe865) ) |
| 2995 | 3149 | ROM_LOAD16_BYTE("e29-14.rom", 0x100001, 0x40000, CRC(7ee7e688) SHA1(d65aa9c449e1d64f10d1be9727a9d93ab1571e65) ) |
| r11160 | r11161 | |
| 3008 | 3162 | ROM_LOAD32_BYTE("e36-09", 0x000002, 0x040000, CRC(f16985e0) SHA1(a74cfee8f958e7a32354d4353eeb199a7fb1ce64) ) |
| 3009 | 3163 | ROM_LOAD32_BYTE("e36-08", 0x000003, 0x040000, CRC(aa699e1b) SHA1(6bde0759940e0f238e4fa5bd228115574ff927d8) ) |
| 3010 | 3164 | |
| 3165 | |
| 3166 | |
| 3011 | 3167 | ROM_REGION(0x180000, "audiocpu", 0) /* Sound CPU */ |
| 3012 | 3168 | ROM_LOAD16_BYTE("e36-12", 0x100000, 0x40000, CRC(3bae39be) SHA1(777142ecc24799b934ed51ac4cd8700bb6da7e3c) ) |
| 3013 | 3169 | ROM_LOAD16_BYTE("e36-13", 0x100001, 0x40000, CRC(94448e82) SHA1(d7766490318623be770545918391c5e6144dd619) ) |
| r11160 | r11161 | |
| 3060 | 3216 | ROM_LOAD ("e44-09.42", 0xb00000, 0x100000, CRC(a8e68eb7) SHA1(843bbb8a61bd4b9cbb14c7242281ce0c83c432ff) ) |
| 3061 | 3217 | ROM_FILL ( 0x600000, 0x300000, 0 ) |
| 3062 | 3218 | |
| 3219 | |
| 3220 | |
| 3063 | 3221 | ROM_REGION(0x400000, "audiocpu", 0) /* 68000 sound CPU */ |
| 3064 | 3222 | ROM_LOAD16_BYTE("e44-20.51", 0x100000, 0x080000, CRC(4df7e051) SHA1(db0f5758458764a1c04116d5d5bbb20d4d36c875) ) |
| 3065 | 3223 | ROM_LOAD16_BYTE("e44-21.52", 0x100001, 0x080000, CRC(d31b94b8) SHA1(41ee381d10254dc6e7163c5f353568539a96fc20) ) |
| r11160 | r11161 | |
| 3092 | 3250 | ROM_LOAD ("e46-10", 0x300000, 0x100000, CRC(1999b76a) SHA1(83d6d2efe250bf3b119982bbf701f9b9d856af2d) ) |
| 3093 | 3251 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 3094 | 3252 | |
| 3253 | |
| 3254 | |
| 3095 | 3255 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 3096 | 3256 | ROM_LOAD16_BYTE("e46-21", 0x100000, 0x40000, CRC(b466cff6) SHA1(0757984f15a6ac9939c1e8625d5b9bfcbc788acc) ) |
| 3097 | 3257 | ROM_LOAD16_BYTE("e46-22", 0x100001, 0x40000, CRC(c67b767e) SHA1(19f3db6615d7a6ed4d2636b6beabe2f3ed6d0c38) ) |
| r11160 | r11161 | |
| 3132 | 3292 | ROM_LOAD ("e46-10", 0x300000, 0x100000, CRC(1999b76a) SHA1(83d6d2efe250bf3b119982bbf701f9b9d856af2d) ) |
| 3133 | 3293 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 3134 | 3294 | |
| 3295 | |
| 3296 | |
| 3135 | 3297 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 3136 | 3298 | ROM_LOAD16_BYTE("e46-19", 0x100000, 0x40000, CRC(2624eba0) SHA1(ba0b13bda241c648c7f8520106acd8c0c888fe29) ) |
| 3137 | 3299 | ROM_LOAD16_BYTE("e46-20", 0x100001, 0x40000, CRC(065e934f) SHA1(0ec1b5ae33b1c43776b9327c9d380787d64ed5f9) ) |
| r11160 | r11161 | |
| 3168 | 3330 | ROM_LOAD ("e49-06", 0x300000, 0x100000, CRC(ec85f7ce) SHA1(9fead68c38fc9ca84d34d70343b13665978c362b) ) |
| 3169 | 3331 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 3170 | 3332 | |
| 3333 | |
| 3334 | |
| 3171 | 3335 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 code */ |
| 3172 | 3336 | ROM_LOAD16_BYTE("e49-13.32", 0x100000, 0x40000, CRC(83536f7f) SHA1(2252cee00ae260954cc76d92af8eb2a87d23cbfb) ) |
| 3173 | 3337 | ROM_LOAD16_BYTE("e49-14.33", 0x100001, 0x40000, CRC(19815bdb) SHA1(38ad682236c7df0710055dd8dbdec30d5da0839d) ) |
| r11160 | r11161 | |
| 3204 | 3368 | ROM_LOAD ("e49-06", 0x300000, 0x100000, CRC(ec85f7ce) SHA1(9fead68c38fc9ca84d34d70343b13665978c362b) ) |
| 3205 | 3369 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 3206 | 3370 | |
| 3371 | |
| 3372 | |
| 3207 | 3373 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 code */ |
| 3208 | 3374 | ROM_LOAD16_BYTE("e49-13.32", 0x100000, 0x40000, CRC(83536f7f) SHA1(2252cee00ae260954cc76d92af8eb2a87d23cbfb) ) |
| 3209 | 3375 | ROM_LOAD16_BYTE("e49-14.33", 0x100001, 0x40000, CRC(19815bdb) SHA1(38ad682236c7df0710055dd8dbdec30d5da0839d) ) |
| r11160 | r11161 | |
| 3240 | 3406 | ROM_LOAD ("e49-06", 0x300000, 0x100000, CRC(ec85f7ce) SHA1(9fead68c38fc9ca84d34d70343b13665978c362b) ) |
| 3241 | 3407 | ROM_FILL ( 0x200000, 0x100000, 0 ) |
| 3242 | 3408 | |
| 3409 | |
| 3410 | |
| 3243 | 3411 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 code */ |
| 3244 | 3412 | ROM_LOAD16_BYTE("e49-13.32", 0x100000, 0x40000, CRC(83536f7f) SHA1(2252cee00ae260954cc76d92af8eb2a87d23cbfb) ) |
| 3245 | 3413 | ROM_LOAD16_BYTE("e49-14.33", 0x100001, 0x40000, CRC(19815bdb) SHA1(38ad682236c7df0710055dd8dbdec30d5da0839d) ) |
| r11160 | r11161 | |
| 3277 | 3445 | ROM_LOAD ("e51-06.43", 0x600000, 0x200000, CRC(c240d6c8) SHA1(6f3b5224b7eb8783893375d432bbbfc37f81c230) ) |
| 3278 | 3446 | ROM_FILL ( 0x400000, 0x200000, 0 ) |
| 3279 | 3447 | |
| 3448 | |
| 3449 | |
| 3280 | 3450 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 3281 | 3451 | ROM_LOAD16_BYTE("e51-13.32", 0x100000, 0x40000, CRC(3b9e3986) SHA1(26340bda0ad2ea580e2395135617966676a71ad5) ) |
| 3282 | 3452 | ROM_LOAD16_BYTE("e51-14.33", 0x100001, 0x40000, CRC(1f9a5015) SHA1(5da38c5fe2a50bcde6bd46ab1cb9a56dbab1a882) ) |
| r11160 | r11161 | |
| 3312 | 3482 | ROM_LOAD ("e51-06.43", 0x600000, 0x200000, CRC(c240d6c8) SHA1(6f3b5224b7eb8783893375d432bbbfc37f81c230) ) |
| 3313 | 3483 | ROM_FILL ( 0x400000, 0x200000, 0 ) |
| 3314 | 3484 | |
| 3485 | |
| 3486 | |
| 3315 | 3487 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 3316 | 3488 | ROM_LOAD16_BYTE("e51-13.32", 0x100000, 0x40000, CRC(3b9e3986) SHA1(26340bda0ad2ea580e2395135617966676a71ad5) ) |
| 3317 | 3489 | ROM_LOAD16_BYTE("e51-14.33", 0x100001, 0x40000, CRC(1f9a5015) SHA1(5da38c5fe2a50bcde6bd46ab1cb9a56dbab1a882) ) |
| r11160 | r11161 | |
| 3347 | 3519 | ROM_LOAD ("e51-06.43", 0x600000, 0x200000, CRC(c240d6c8) SHA1(6f3b5224b7eb8783893375d432bbbfc37f81c230) ) |
| 3348 | 3520 | ROM_FILL ( 0x400000, 0x200000, 0 ) |
| 3349 | 3521 | |
| 3522 | |
| 3523 | |
| 3350 | 3524 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 3351 | 3525 | ROM_LOAD16_BYTE("e51-13.32", 0x100000, 0x40000, CRC(3b9e3986) SHA1(26340bda0ad2ea580e2395135617966676a71ad5) ) |
| 3352 | 3526 | ROM_LOAD16_BYTE("e51-14.33", 0x100001, 0x40000, CRC(1f9a5015) SHA1(5da38c5fe2a50bcde6bd46ab1cb9a56dbab1a882) ) |
| r11160 | r11161 | |
| 3424 | 3598 | ROM_LOAD ("e61-07.43", 0x600000, 0x200000, CRC(4a57965d) SHA1(8e80788e0f47fb242da9af3aa19077dc0ec829b8) ) |
| 3425 | 3599 | ROM_FILL ( 0x400000, 0x200000, 0 ) |
| 3426 | 3600 | |
| 3601 | |
| 3602 | |
| 3427 | 3603 | ROM_REGION(0x140000, "audiocpu", 0) /* 68000 sound CPU */ |
| 3428 | 3604 | ROM_LOAD16_BYTE("e61-14.32", 0x100000, 0x20000, CRC(b905f4a7) SHA1(613b954e3e129fd44b4ce64958f16e5636012d6e) ) |
| 3429 | 3605 | ROM_LOAD16_BYTE("e61-15.33", 0x100001, 0x20000, CRC(87909869) SHA1(7b90c23899a673966cac3352d375d17b83e66596) ) |
| r11160 | r11161 | |
| 3472 | 3648 | ROM_LOAD16_BYTE("scr1-5.14",0x700001, 0x080000, CRC(24aba128) SHA1(b03804c738d86bfafc1f8fb91f8e77e878d2dc83) ) |
| 3473 | 3649 | ROM_FILL ( 0x400000, 0x200000, 0 ) |
| 3474 | 3650 | |
| 3651 | |
| 3652 | |
| 3475 | 3653 | ROM_REGION(0x180000, "audiocpu", 0) /* 68000 sound CPU */ |
| 3476 | 3654 | ROM_LOAD16_BYTE("spro-1.66", 0x100000, 0x40000, CRC(18961bbb) SHA1(df054def35a49c0754356c15ec15336cbf28b063) ) |
| 3477 | 3655 | ROM_LOAD16_BYTE("spro-0.65", 0x100001, 0x40000, CRC(2c64557a) SHA1(768007162d5d2cbe650c735bc1af2c10ed13b046) ) |
src/mame/drivers/cave.c
| r11160 | r11161 | |
| 441 | 441 | AM_RANGE(0x300000, 0x300003) AM_DEVREADWRITE8("ymz", ymz280b_r, ymz280b_w, 0x00ff) // YMZ280 |
| 442 | 442 | /**/AM_RANGE(0x400000, 0x407fff) AM_RAM AM_BASE_SIZE_MEMBER(cave_state, m_spriteram, m_spriteram_size) // Sprites |
| 443 | 443 | /**/AM_RANGE(0x408000, 0x40ffff) AM_RAM AM_BASE_MEMBER(cave_state, m_spriteram_2) // Sprites? |
| 444 | | /**/AM_RANGE(0x500000, 0x507fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram_0) // Layer 0 |
| 445 | | /**/AM_RANGE(0x600000, 0x607fff) AM_RAM_WRITE(cave_vram_1_w) AM_BASE_MEMBER(cave_state, m_vram_1) // Layer 1 |
| 444 | /**/AM_RANGE(0x500000, 0x507fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram[0]) // Layer 0 |
| 445 | /**/AM_RANGE(0x600000, 0x607fff) AM_RAM_WRITE(cave_vram_1_w) AM_BASE_MEMBER(cave_state, m_vram[1]) // Layer 1 |
| 446 | 446 | /**/AM_RANGE(0x708000, 0x708fff) AM_RAM AM_BASE_SIZE_MEMBER(cave_state, m_paletteram, m_paletteram_size) // Palette |
| 447 | 447 | /**/AM_RANGE(0x710000, 0x710bff) AM_READONLY // ? |
| 448 | 448 | AM_RANGE(0x710c00, 0x710fff) AM_RAM // ? |
| 449 | 449 | AM_RANGE(0x800000, 0x800007) AM_READ(cave_irq_cause_r) // IRQ Cause |
| 450 | 450 | AM_RANGE(0x800000, 0x80007f) AM_WRITEONLY AM_BASE_MEMBER(cave_state, m_videoregs) // Video Regs |
| 451 | | /**/AM_RANGE(0x900000, 0x900005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_0) // Layer 0 Control |
| 452 | | /**/AM_RANGE(0xa00000, 0xa00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_1) // Layer 1 Control |
| 451 | /**/AM_RANGE(0x900000, 0x900005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[0]) // Layer 0 Control |
| 452 | /**/AM_RANGE(0xa00000, 0xa00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[1]) // Layer 1 Control |
| 453 | 453 | AM_RANGE(0xb00000, 0xb00001) AM_READ_PORT("IN0") // Inputs |
| 454 | 454 | AM_RANGE(0xb00002, 0xb00003) AM_READ_PORT("IN1") // Inputs + EEPROM |
| 455 | 455 | AM_RANGE(0xc00000, 0xc00001) AM_DEVWRITE("eeprom", cave_eeprom_msb_w) // EEPROM |
| r11160 | r11161 | |
| 466 | 466 | AM_RANGE(0x300000, 0x300003) AM_DEVREADWRITE8("ymz", ymz280b_r, ymz280b_w, 0x00ff) // YMZ280 |
| 467 | 467 | /**/AM_RANGE(0x400000, 0x407fff) AM_RAM AM_BASE_SIZE_MEMBER(cave_state, m_spriteram, m_spriteram_size) // Sprites |
| 468 | 468 | /**/AM_RANGE(0x408000, 0x40ffff) AM_RAM AM_BASE_MEMBER(cave_state, m_spriteram_2) // Sprites? |
| 469 | | /**/AM_RANGE(0x500000, 0x507fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram_0) // Layer 0 |
| 470 | | /**/AM_RANGE(0x600000, 0x607fff) AM_RAM_WRITE(cave_vram_1_w) AM_BASE_MEMBER(cave_state, m_vram_1) // Layer 1 |
| 471 | | /**/AM_RANGE(0x700000, 0x70ffff) AM_RAM_WRITE(cave_vram_2_8x8_w) AM_BASE_MEMBER(cave_state, m_vram_2) // Layer 2 |
| 469 | /**/AM_RANGE(0x500000, 0x507fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram[0]) // Layer 0 |
| 470 | /**/AM_RANGE(0x600000, 0x607fff) AM_RAM_WRITE(cave_vram_1_w) AM_BASE_MEMBER(cave_state, m_vram[1]) // Layer 1 |
| 471 | /**/AM_RANGE(0x700000, 0x70ffff) AM_RAM_WRITE(cave_vram_2_8x8_w) AM_BASE_MEMBER(cave_state, m_vram[2]) // Layer 2 |
| 472 | 472 | AM_RANGE(0x800000, 0x800007) AM_READ(cave_irq_cause_r) // IRQ Cause |
| 473 | 473 | AM_RANGE(0x800000, 0x80007f) AM_WRITEONLY AM_BASE_MEMBER(cave_state, m_videoregs) // Video Regs |
| 474 | | /**/AM_RANGE(0x900000, 0x900005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_0) // Layer 0 Control |
| 475 | | /**/AM_RANGE(0xa00000, 0xa00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_1) // Layer 1 Control |
| 476 | | /**/AM_RANGE(0xb00000, 0xb00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_2) // Layer 2 Control |
| 474 | /**/AM_RANGE(0x900000, 0x900005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[0]) // Layer 0 Control |
| 475 | /**/AM_RANGE(0xa00000, 0xa00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[1]) // Layer 1 Control |
| 476 | /**/AM_RANGE(0xb00000, 0xb00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[2]) // Layer 2 Control |
| 477 | 477 | /**/AM_RANGE(0xc00000, 0xc0ffff) AM_RAM AM_BASE_SIZE_MEMBER(cave_state, m_paletteram, m_paletteram_size) // Palette |
| 478 | 478 | AM_RANGE(0xd00000, 0xd00001) AM_READ_PORT("IN0") // Inputs |
| 479 | 479 | AM_RANGE(0xd00002, 0xd00003) AM_READ_PORT("IN1") // Inputs + EEPROM |
| r11160 | r11161 | |
| 514 | 514 | static ADDRESS_MAP_START( donpachi_map, AS_PROGRAM, 16 ) |
| 515 | 515 | AM_RANGE(0x000000, 0x07ffff) AM_ROM // ROM |
| 516 | 516 | AM_RANGE(0x100000, 0x10ffff) AM_RAM // RAM |
| 517 | | AM_RANGE(0x200000, 0x207fff) AM_RAM_WRITE(cave_vram_1_w) AM_BASE_MEMBER(cave_state, m_vram_1) // Layer 1 |
| 518 | | AM_RANGE(0x300000, 0x307fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram_0) // Layer 0 |
| 519 | | AM_RANGE(0x400000, 0x407fff) AM_RAM_WRITE(cave_vram_2_8x8_w) AM_BASE_MEMBER(cave_state, m_vram_2) // Layer 2 |
| 517 | AM_RANGE(0x200000, 0x207fff) AM_RAM_WRITE(cave_vram_1_w) AM_BASE_MEMBER(cave_state, m_vram[1]) // Layer 1 |
| 518 | AM_RANGE(0x300000, 0x307fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram[0]) // Layer 0 |
| 519 | AM_RANGE(0x400000, 0x407fff) AM_RAM_WRITE(cave_vram_2_8x8_w) AM_BASE_MEMBER(cave_state, m_vram[2]) // Layer 2 |
| 520 | 520 | AM_RANGE(0x500000, 0x507fff) AM_RAM AM_BASE_SIZE_MEMBER(cave_state, m_spriteram, m_spriteram_size) // Sprites |
| 521 | 521 | AM_RANGE(0x508000, 0x50ffff) AM_RAM AM_BASE_MEMBER(cave_state, m_spriteram_2) // Sprites? |
| 522 | | /**/AM_RANGE(0x600000, 0x600005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_1) // Layer 1 Control |
| 523 | | /**/AM_RANGE(0x700000, 0x700005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_0) // Layer 0 Control |
| 524 | | /**/AM_RANGE(0x800000, 0x800005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_2) // Layer 2 Control |
| 522 | /**/AM_RANGE(0x600000, 0x600005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[1]) // Layer 1 Control |
| 523 | /**/AM_RANGE(0x700000, 0x700005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[0]) // Layer 0 Control |
| 524 | /**/AM_RANGE(0x800000, 0x800005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[2]) // Layer 2 Control |
| 525 | 525 | AM_RANGE(0x900000, 0x90007f) AM_RAM_READ(donpachi_videoregs_r) AM_BASE_MEMBER(cave_state, m_videoregs) // Video Regs |
| 526 | 526 | /**/AM_RANGE(0xa08000, 0xa08fff) AM_RAM AM_BASE_SIZE_MEMBER(cave_state, m_paletteram, m_paletteram_size) // Palette |
| 527 | 527 | AM_RANGE(0xb00000, 0xb00003) AM_DEVREADWRITE8_MODERN("oki1", okim6295_device, read, write, 0x00ff) // M6295 |
| r11160 | r11161 | |
| 543 | 543 | AM_RANGE(0x300000, 0x300003) AM_DEVREADWRITE8("ymz", ymz280b_r, ymz280b_w, 0x00ff) // YMZ280 |
| 544 | 544 | /**/AM_RANGE(0x400000, 0x407fff) AM_RAM AM_BASE_SIZE_MEMBER(cave_state, m_spriteram, m_spriteram_size) // Sprites |
| 545 | 545 | /**/AM_RANGE(0x408000, 0x40ffff) AM_RAM AM_BASE_MEMBER(cave_state, m_spriteram_2) // Sprites? |
| 546 | | /**/AM_RANGE(0x500000, 0x507fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram_0) // Layer 0 |
| 547 | | /**/AM_RANGE(0x600000, 0x607fff) AM_RAM_WRITE(cave_vram_1_w) AM_BASE_MEMBER(cave_state, m_vram_1) // Layer 1 |
| 548 | | /**/AM_RANGE(0x700000, 0x707fff) AM_RAM_WRITE(cave_vram_2_w) AM_BASE_MEMBER(cave_state, m_vram_2) // Layer 2 |
| 546 | /**/AM_RANGE(0x500000, 0x507fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram[0]) // Layer 0 |
| 547 | /**/AM_RANGE(0x600000, 0x607fff) AM_RAM_WRITE(cave_vram_1_w) AM_BASE_MEMBER(cave_state, m_vram[1]) // Layer 1 |
| 548 | /**/AM_RANGE(0x700000, 0x707fff) AM_RAM_WRITE(cave_vram_2_w) AM_BASE_MEMBER(cave_state, m_vram[2]) // Layer 2 |
| 549 | 549 | AM_RANGE(0x800000, 0x800007) AM_READ(cave_irq_cause_r) // IRQ Cause |
| 550 | 550 | AM_RANGE(0x800000, 0x80007f) AM_WRITEONLY AM_BASE_MEMBER(cave_state, m_videoregs) // Video Regs |
| 551 | | /**/AM_RANGE(0x900000, 0x900005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_0) // Layer 0 Control |
| 552 | | /**/AM_RANGE(0xa00000, 0xa00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_1) // Layer 1 Control |
| 553 | | /**/AM_RANGE(0xb00000, 0xb00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_2) // Layer 2 Control |
| 551 | /**/AM_RANGE(0x900000, 0x900005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[0]) // Layer 0 Control |
| 552 | /**/AM_RANGE(0xa00000, 0xa00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[1]) // Layer 1 Control |
| 553 | /**/AM_RANGE(0xb00000, 0xb00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[2]) // Layer 2 Control |
| 554 | 554 | /**/AM_RANGE(0xc00000, 0xc0ffff) AM_RAM AM_BASE_SIZE_MEMBER(cave_state, m_paletteram, m_paletteram_size) // Palette |
| 555 | 555 | AM_RANGE(0xd00000, 0xd00001) AM_READ_PORT("IN0" ) // Inputs |
| 556 | 556 | AM_RANGE(0xd00002, 0xd00003) AM_READ_PORT("IN1" ) // Inputs + EEPROM |
| r11160 | r11161 | |
| 568 | 568 | AM_RANGE(0x300000, 0x300003) AM_DEVREADWRITE8("ymz", ymz280b_r, ymz280b_w, 0x00ff) // YMZ280 |
| 569 | 569 | AM_RANGE(0x400000, 0x407fff) AM_RAM AM_BASE_SIZE_MEMBER(cave_state, m_spriteram, m_spriteram_size) // Sprite bank 1 |
| 570 | 570 | AM_RANGE(0x408000, 0x40ffff) AM_RAM AM_BASE_MEMBER(cave_state, m_spriteram_2) // Sprite bank 2 |
| 571 | | AM_RANGE(0x500000, 0x507fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram_0) // Layer 0 |
| 571 | AM_RANGE(0x500000, 0x507fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram[0]) // Layer 0 |
| 572 | 572 | AM_RANGE(0x508000, 0x50ffff) AM_RAM // More Layer 0, Tested but not used? |
| 573 | | AM_RANGE(0x600000, 0x607fff) AM_RAM_WRITE(cave_vram_1_w) AM_BASE_MEMBER(cave_state, m_vram_1) // Layer 1 |
| 573 | AM_RANGE(0x600000, 0x607fff) AM_RAM_WRITE(cave_vram_1_w) AM_BASE_MEMBER(cave_state, m_vram[1]) // Layer 1 |
| 574 | 574 | AM_RANGE(0x608000, 0x60ffff) AM_RAM // More Layer 1, Tested but not used? |
| 575 | | AM_RANGE(0x700000, 0x707fff) AM_RAM_WRITE(cave_vram_2_w) AM_BASE_MEMBER(cave_state, m_vram_2) // Layer 2 |
| 575 | AM_RANGE(0x700000, 0x707fff) AM_RAM_WRITE(cave_vram_2_w) AM_BASE_MEMBER(cave_state, m_vram[2]) // Layer 2 |
| 576 | 576 | AM_RANGE(0x708000, 0x70ffff) AM_RAM // More Layer 2, Tested but not used? |
| 577 | 577 | AM_RANGE(0x800000, 0x800007) AM_READ(cave_irq_cause_r) // IRQ Cause |
| 578 | 578 | AM_RANGE(0x800000, 0x80007f) AM_WRITEONLY AM_BASE_MEMBER(cave_state, m_videoregs) // Video Regs |
| 579 | | /**/AM_RANGE(0x900000, 0x900005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_0) // Layer 0 Control |
| 580 | | /**/AM_RANGE(0xa00000, 0xa00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_1) // Layer 1 Control |
| 581 | | /**/AM_RANGE(0xb00000, 0xb00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_2) // Layer 2 Control |
| 579 | /**/AM_RANGE(0x900000, 0x900005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[0]) // Layer 0 Control |
| 580 | /**/AM_RANGE(0xa00000, 0xa00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[1]) // Layer 1 Control |
| 581 | /**/AM_RANGE(0xb00000, 0xb00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[2]) // Layer 2 Control |
| 582 | 582 | AM_RANGE(0xc00000, 0xc0ffff) AM_RAM AM_BASE_SIZE_MEMBER(cave_state, m_paletteram, m_paletteram_size) // Palette |
| 583 | 583 | AM_RANGE(0xd00010, 0xd00011) AM_READ_PORT("IN0") // Inputs |
| 584 | 584 | AM_RANGE(0xd00010, 0xd00011) AM_WRITE(gaia_coin_lsb_w) // Coin counter only |
| r11160 | r11161 | |
| 599 | 599 | AM_RANGE(0x300000, 0x30007f) AM_WRITEONLY AM_BASE_MEMBER(cave_state, m_videoregs) // Video Regs |
| 600 | 600 | /**/AM_RANGE(0x400000, 0x407fff) AM_RAM AM_BASE_SIZE_MEMBER(cave_state, m_spriteram, m_spriteram_size) // Sprites |
| 601 | 601 | /**/AM_RANGE(0x408000, 0x40ffff) AM_RAM AM_BASE_MEMBER(cave_state, m_spriteram_2) // Sprites? |
| 602 | | /**/AM_RANGE(0x500000, 0x507fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram_0) // Layer 0 |
| 603 | | /**/AM_RANGE(0x600000, 0x607fff) AM_RAM_WRITE(cave_vram_1_w) AM_BASE_MEMBER(cave_state, m_vram_1) // Layer 1 |
| 604 | | /**/AM_RANGE(0x700000, 0x707fff) AM_RAM_WRITE(cave_vram_2_w) AM_BASE_MEMBER(cave_state, m_vram_2) // Layer 2 |
| 602 | /**/AM_RANGE(0x500000, 0x507fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram[0]) // Layer 0 |
| 603 | /**/AM_RANGE(0x600000, 0x607fff) AM_RAM_WRITE(cave_vram_1_w) AM_BASE_MEMBER(cave_state, m_vram[1]) // Layer 1 |
| 604 | /**/AM_RANGE(0x700000, 0x707fff) AM_RAM_WRITE(cave_vram_2_w) AM_BASE_MEMBER(cave_state, m_vram[2]) // Layer 2 |
| 605 | 605 | AM_RANGE(0x800000, 0x800003) AM_DEVREADWRITE8("ymz", ymz280b_r, ymz280b_w, 0x00ff) // YMZ280 |
| 606 | | /**/AM_RANGE(0x900000, 0x900005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_0) // Layer 0 Control |
| 607 | | /**/AM_RANGE(0xa00000, 0xa00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_1) // Layer 1 Control |
| 608 | | /**/AM_RANGE(0xb00000, 0xb00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_2) // Layer 2 Control |
| 606 | /**/AM_RANGE(0x900000, 0x900005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[0]) // Layer 0 Control |
| 607 | /**/AM_RANGE(0xa00000, 0xa00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[1]) // Layer 1 Control |
| 608 | /**/AM_RANGE(0xb00000, 0xb00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[2]) // Layer 2 Control |
| 609 | 609 | /**/AM_RANGE(0xc00000, 0xc0ffff) AM_RAM AM_BASE_SIZE_MEMBER(cave_state, m_paletteram, m_paletteram_size) // Palette |
| 610 | 610 | AM_RANGE(0xd00010, 0xd00011) AM_READ_PORT("IN0") // Inputs |
| 611 | 611 | AM_RANGE(0xd00010, 0xd00011) AM_DEVWRITE("eeprom", cave_eeprom_lsb_w) // EEPROM |
| r11160 | r11161 | |
| 623 | 623 | AM_RANGE(0x000000, 0x0fffff) AM_ROM // ROM |
| 624 | 624 | AM_RANGE(0x300000, 0x30ffff) AM_RAM // RAM |
| 625 | 625 | /**/AM_RANGE(0x408000, 0x408fff) AM_RAM AM_BASE_SIZE_MEMBER(cave_state, m_paletteram, m_paletteram_size) // Palette |
| 626 | | /**/AM_RANGE(0x880000, 0x887fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram_0) // Layer 0 |
| 627 | | /**/AM_RANGE(0x900000, 0x907fff) AM_RAM_WRITE(cave_vram_1_w) AM_BASE_MEMBER(cave_state, m_vram_1) // Layer 1 |
| 628 | | /**/AM_RANGE(0x980000, 0x987fff) AM_RAM_WRITE(cave_vram_2_w) AM_BASE_MEMBER(cave_state, m_vram_2) // Layer 2 |
| 626 | /**/AM_RANGE(0x880000, 0x887fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram[0]) // Layer 0 |
| 627 | /**/AM_RANGE(0x900000, 0x907fff) AM_RAM_WRITE(cave_vram_1_w) AM_BASE_MEMBER(cave_state, m_vram[1]) // Layer 1 |
| 628 | /**/AM_RANGE(0x980000, 0x987fff) AM_RAM_WRITE(cave_vram_2_w) AM_BASE_MEMBER(cave_state, m_vram[2]) // Layer 2 |
| 629 | 629 | AM_RANGE(0xa80000, 0xa80007) AM_READ(cave_irq_cause_r) // IRQ Cause |
| 630 | 630 | // AM_RANGE(0xa8006e, 0xa8006f) AM_READ(soundlatch_ack_r) // From Sound CPU |
| 631 | 631 | AM_RANGE(0xa8006e, 0xa8006f) AM_WRITE(sound_cmd_w) // To Sound CPU |
| 632 | 632 | AM_RANGE(0xa80000, 0xa8007f) AM_WRITEONLY AM_BASE_MEMBER(cave_state, m_videoregs) // Video Regs |
| 633 | | /**/AM_RANGE(0xb00000, 0xb00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_0) // Layer 0 Control |
| 634 | | /**/AM_RANGE(0xb80000, 0xb80005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_1) // Layer 1 Control |
| 635 | | /**/AM_RANGE(0xc00000, 0xc00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_2) // Layer 2 Control |
| 633 | /**/AM_RANGE(0xb00000, 0xb00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[0]) // Layer 0 Control |
| 634 | /**/AM_RANGE(0xb80000, 0xb80005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[1]) // Layer 1 Control |
| 635 | /**/AM_RANGE(0xc00000, 0xc00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[2]) // Layer 2 Control |
| 636 | 636 | AM_RANGE(0xc80000, 0xc80001) AM_READ_PORT("IN0") // Inputs |
| 637 | 637 | AM_RANGE(0xc80002, 0xc80003) AM_READ_PORT("IN1") // Inputs + EEPROM |
| 638 | 638 | AM_RANGE(0xd00000, 0xd00001) AM_DEVWRITE("eeprom", hotdogst_eeprom_msb_w) // EEPROM |
| r11160 | r11161 | |
| 713 | 713 | |
| 714 | 714 | static ADDRESS_MAP_START( korokoro_map, AS_PROGRAM, 16 ) |
| 715 | 715 | AM_RANGE(0x000000, 0x07ffff) AM_ROM // ROM |
| 716 | | AM_RANGE(0x100000, 0x107fff) AM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram_0) // Layer 0 |
| 717 | | AM_RANGE(0x140000, 0x140005) AM_WRITEONLY AM_BASE_MEMBER(cave_state, m_vctrl_0) // Layer 0 Control |
| 716 | AM_RANGE(0x100000, 0x107fff) AM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram[0]) // Layer 0 |
| 717 | AM_RANGE(0x140000, 0x140005) AM_WRITEONLY AM_BASE_MEMBER(cave_state, m_vctrl[0]) // Layer 0 Control |
| 718 | 718 | AM_RANGE(0x180000, 0x187fff) AM_WRITEONLY AM_BASE_SIZE_MEMBER(cave_state, m_spriteram, m_spriteram_size) // Sprites |
| 719 | 719 | AM_RANGE(0x1c0000, 0x1c0007) AM_READ(cave_irq_cause_r) // IRQ Cause |
| 720 | 720 | AM_RANGE(0x1c0000, 0x1c007f) AM_WRITEONLY AM_BASE_MEMBER(cave_state, m_videoregs) // Video Regs |
| r11160 | r11161 | |
| 731 | 731 | |
| 732 | 732 | static ADDRESS_MAP_START( crusherm_map, AS_PROGRAM, 16 ) |
| 733 | 733 | AM_RANGE(0x000000, 0x07ffff) AM_ROM // ROM |
| 734 | | AM_RANGE(0x100000, 0x107fff) AM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram_0) // Layer 0 |
| 735 | | AM_RANGE(0x140000, 0x140005) AM_WRITEONLY AM_BASE_MEMBER(cave_state, m_vctrl_0) // Layer 0 Control |
| 734 | AM_RANGE(0x100000, 0x107fff) AM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram[0]) // Layer 0 |
| 735 | AM_RANGE(0x140000, 0x140005) AM_WRITEONLY AM_BASE_MEMBER(cave_state, m_vctrl[0]) // Layer 0 Control |
| 736 | 736 | AM_RANGE(0x180000, 0x187fff) AM_WRITEONLY AM_BASE_SIZE_MEMBER(cave_state, m_spriteram, m_spriteram_size) // Sprites |
| 737 | 737 | AM_RANGE(0x200000, 0x207fff) AM_WRITEONLY AM_BASE_SIZE_MEMBER(cave_state, m_paletteram, m_paletteram_size) // Palette |
| 738 | 738 | AM_RANGE(0x240000, 0x240003) AM_DEVWRITE8( "ymz", ymz280b_w, 0x00ff) // YMZ280 |
| r11160 | r11161 | |
| 759 | 759 | AM_RANGE(0x300068, 0x300069) AM_WRITE(watchdog_reset16_w) // Watchdog |
| 760 | 760 | AM_RANGE(0x30006e, 0x30006f) AM_READWRITE(soundlatch_ack_r, sound_cmd_w) // From Sound CPU |
| 761 | 761 | AM_RANGE(0x300000, 0x30007f) AM_WRITEONLY AM_BASE_MEMBER(cave_state, m_videoregs) // Video Regs |
| 762 | | AM_RANGE(0x400000, 0x407fff) AM_RAM_WRITE(cave_vram_1_8x8_w) AM_BASE_MEMBER(cave_state, m_vram_1) // Layer 1 |
| 763 | | /**/AM_RANGE(0x500000, 0x507fff) AM_RAM_WRITE(cave_vram_0_8x8_w) AM_BASE_MEMBER(cave_state, m_vram_0) // Layer 0 |
| 764 | | /**/AM_RANGE(0x600000, 0x600005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_1) // Layer 1 Control |
| 765 | | /**/AM_RANGE(0x700000, 0x700005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_0) // Layer 0 Control |
| 762 | AM_RANGE(0x400000, 0x407fff) AM_RAM_WRITE(cave_vram_1_8x8_w) AM_BASE_MEMBER(cave_state, m_vram[1]) // Layer 1 |
| 763 | /**/AM_RANGE(0x500000, 0x507fff) AM_RAM_WRITE(cave_vram_0_8x8_w) AM_BASE_MEMBER(cave_state, m_vram[0]) // Layer 0 |
| 764 | /**/AM_RANGE(0x600000, 0x600005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[1]) // Layer 1 Control |
| 765 | /**/AM_RANGE(0x700000, 0x700005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[0]) // Layer 0 Control |
| 766 | 766 | AM_RANGE(0x800000, 0x800001) AM_READ_PORT("IN0") // Inputs |
| 767 | 767 | AM_RANGE(0x800002, 0x800003) AM_READ_PORT("IN1") // Inputs + EEPROM |
| 768 | 768 | AM_RANGE(0x900000, 0x900001) AM_DEVWRITE("eeprom", cave_eeprom_msb_w) // EEPROM |
| r11160 | r11161 | |
| 781 | 781 | AM_RANGE(0x200000, 0x27ffff) AM_ROM // ROM |
| 782 | 782 | AM_RANGE(0x408000, 0x408fff) AM_RAM AM_BASE_SIZE_MEMBER(cave_state, m_paletteram, m_paletteram_size) // Palette |
| 783 | 783 | AM_RANGE(0x600000, 0x600001) AM_READ(watchdog_reset16_r) // Watchdog? |
| 784 | | AM_RANGE(0x880000, 0x887fff) AM_RAM_WRITE(cave_vram_2_w) AM_BASE_MEMBER(cave_state, m_vram_2) // Layer 2 |
| 784 | AM_RANGE(0x880000, 0x887fff) AM_RAM_WRITE(cave_vram_2_w) AM_BASE_MEMBER(cave_state, m_vram[2]) // Layer 2 |
| 785 | 785 | AM_RANGE(0x888000, 0x88ffff) AM_RAM // |
| 786 | | AM_RANGE(0x900000, 0x907fff) AM_RAM_WRITE(cave_vram_1_w) AM_BASE_MEMBER(cave_state, m_vram_1) // Layer 1 |
| 786 | AM_RANGE(0x900000, 0x907fff) AM_RAM_WRITE(cave_vram_1_w) AM_BASE_MEMBER(cave_state, m_vram[1]) // Layer 1 |
| 787 | 787 | AM_RANGE(0x908000, 0x90ffff) AM_RAM // |
| 788 | | AM_RANGE(0x980000, 0x987fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram_0) // Layer 0 |
| 788 | AM_RANGE(0x980000, 0x987fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram[0]) // Layer 0 |
| 789 | 789 | AM_RANGE(0x988000, 0x98ffff) AM_RAM // |
| 790 | 790 | AM_RANGE(0xa80000, 0xa80007) AM_READ(cave_irq_cause_r) // IRQ Cause |
| 791 | 791 | AM_RANGE(0xa80068, 0xa80069) AM_WRITE(watchdog_reset16_w) // Watchdog? |
| 792 | 792 | AM_RANGE(0xa8006c, 0xa8006d) AM_READ(soundflags_ack_r) AM_WRITENOP // Communication |
| 793 | 793 | AM_RANGE(0xa8006e, 0xa8006f) AM_READWRITE(soundlatch_ack_r, sound_cmd_w) // From Sound CPU |
| 794 | 794 | AM_RANGE(0xa80000, 0xa8007f) AM_WRITEONLY AM_BASE_MEMBER(cave_state, m_videoregs) // Video Regs |
| 795 | | /**/AM_RANGE(0xb00000, 0xb00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_2) // Layer 2 Control |
| 796 | | /**/AM_RANGE(0xb80000, 0xb80005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_1) // Layer 1 Control |
| 797 | | /**/AM_RANGE(0xc00000, 0xc00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_0) // Layer 0 Control |
| 795 | /**/AM_RANGE(0xb00000, 0xb00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[2]) // Layer 2 Control |
| 796 | /**/AM_RANGE(0xb80000, 0xb80005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[1]) // Layer 1 Control |
| 797 | /**/AM_RANGE(0xc00000, 0xc00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[0]) // Layer 0 Control |
| 798 | 798 | AM_RANGE(0xc80000, 0xc80001) AM_READ_PORT("IN0") // Inputs |
| 799 | 799 | AM_RANGE(0xc80002, 0xc80003) AM_READ_PORT("IN1") // Inputs + EEPROM |
| 800 | 800 | AM_RANGE(0xd00000, 0xd00001) AM_DEVWRITE("eeprom", metmqstr_eeprom_msb_w) // EEPROM |
| r11160 | r11161 | |
| 812 | 812 | return ~8 + ((eeprom_read_bit(device) & 1) ? 8 : 0); |
| 813 | 813 | } |
| 814 | 814 | |
| 815 | | INLINE void vctrl_w(UINT16 *VCTRL, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 data, ATTR_UNUSED UINT16 mem_mask) |
| 815 | INLINE void vctrl_w(address_space *space, offs_t offset, UINT16 data, UINT16 mem_mask, int GFX) |
| 816 | 816 | { |
| 817 | cave_state *state = space->machine().driver_data<cave_state>(); |
| 818 | UINT16 *VCTRL = state->m_vctrl[GFX]; |
| 817 | 819 | if (offset == 4 / 2) |
| 818 | 820 | { |
| 819 | 821 | switch (data & 0x000f) |
| r11160 | r11161 | |
| 827 | 829 | } |
| 828 | 830 | COMBINE_DATA(&VCTRL[offset]); |
| 829 | 831 | } |
| 830 | | static WRITE16_HANDLER( pwrinst2_vctrl_0_w ) { cave_state *state = space->machine().driver_data<cave_state>(); vctrl_w(state->m_vctrl_0, offset, data, mem_mask); } |
| 831 | | static WRITE16_HANDLER( pwrinst2_vctrl_1_w ) { cave_state *state = space->machine().driver_data<cave_state>(); vctrl_w(state->m_vctrl_1, offset, data, mem_mask); } |
| 832 | | static WRITE16_HANDLER( pwrinst2_vctrl_2_w ) { cave_state *state = space->machine().driver_data<cave_state>(); vctrl_w(state->m_vctrl_2, offset, data, mem_mask); } |
| 833 | | static WRITE16_HANDLER( pwrinst2_vctrl_3_w ) { cave_state *state = space->machine().driver_data<cave_state>(); vctrl_w(state->m_vctrl_3, offset, data, mem_mask); } |
| 832 | static WRITE16_HANDLER( pwrinst2_vctrl_0_w ) { vctrl_w(space, offset, data, mem_mask, 0); } |
| 833 | static WRITE16_HANDLER( pwrinst2_vctrl_1_w ) { vctrl_w(space, offset, data, mem_mask, 1); } |
| 834 | static WRITE16_HANDLER( pwrinst2_vctrl_2_w ) { vctrl_w(space, offset, data, mem_mask, 2); } |
| 835 | static WRITE16_HANDLER( pwrinst2_vctrl_3_w ) { vctrl_w(space, offset, data, mem_mask, 3); } |
| 834 | 836 | |
| 835 | 837 | static ADDRESS_MAP_START( pwrinst2_map, AS_PROGRAM, 16 ) |
| 836 | 838 | AM_RANGE(0x000000, 0x1fffff) AM_ROM // ROM |
| r11160 | r11161 | |
| 839 | 841 | AM_RANGE(0x500002, 0x500003) AM_READ_PORT("IN1") // |
| 840 | 842 | AM_RANGE(0x600000, 0x6fffff) AM_ROM AM_REGION("user1", 0) // extra data ROM space |
| 841 | 843 | AM_RANGE(0x700000, 0x700001) AM_DEVWRITE("eeprom", cave_eeprom_msb_w) // EEPROM |
| 842 | | AM_RANGE(0x800000, 0x807fff) AM_RAM_WRITE(cave_vram_2_w) AM_BASE_MEMBER(cave_state, m_vram_2) // Layer 2 |
| 843 | | AM_RANGE(0x880000, 0x887fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram_0) // Layer 0 |
| 844 | | AM_RANGE(0x900000, 0x907fff) AM_RAM_WRITE(cave_vram_1_w) AM_BASE_MEMBER(cave_state, m_vram_1) // Layer 1 |
| 845 | | AM_RANGE(0x980000, 0x987fff) AM_RAM_WRITE(cave_vram_3_8x8_w) AM_BASE_MEMBER(cave_state, m_vram_3) // Layer 3 |
| 844 | AM_RANGE(0x800000, 0x807fff) AM_RAM_WRITE(cave_vram_2_w) AM_BASE_MEMBER(cave_state, m_vram[2]) // Layer 2 |
| 845 | AM_RANGE(0x880000, 0x887fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram[0]) // Layer 0 |
| 846 | AM_RANGE(0x900000, 0x907fff) AM_RAM_WRITE(cave_vram_1_w) AM_BASE_MEMBER(cave_state, m_vram[1]) // Layer 1 |
| 847 | AM_RANGE(0x980000, 0x987fff) AM_RAM_WRITE(cave_vram_3_8x8_w) AM_BASE_MEMBER(cave_state, m_vram[3]) // Layer 3 |
| 846 | 848 | AM_RANGE(0xa00000, 0xa07fff) AM_RAM AM_BASE_SIZE_MEMBER(cave_state, m_spriteram, m_spriteram_size) // Sprites |
| 847 | 849 | AM_RANGE(0xa08000, 0xa0ffff) AM_RAM AM_BASE_MEMBER(cave_state, m_spriteram_2) // Sprites? |
| 848 | 850 | AM_RANGE(0xa10000, 0xa1ffff) AM_RAM // Sprites? |
| 849 | 851 | AM_RANGE(0xa80000, 0xa8007f) AM_RAM_READ(donpachi_videoregs_r) AM_BASE_MEMBER(cave_state, m_videoregs) // Video Regs |
| 850 | | /**/AM_RANGE(0xb00000, 0xb00005) AM_RAM_WRITE(pwrinst2_vctrl_2_w) AM_BASE_MEMBER(cave_state, m_vctrl_2) // Layer 2 Control |
| 851 | | /**/AM_RANGE(0xb80000, 0xb80005) AM_RAM_WRITE(pwrinst2_vctrl_0_w) AM_BASE_MEMBER(cave_state, m_vctrl_0) // Layer 0 Control |
| 852 | | /**/AM_RANGE(0xc00000, 0xc00005) AM_RAM_WRITE(pwrinst2_vctrl_1_w) AM_BASE_MEMBER(cave_state, m_vctrl_1) // Layer 1 Control |
| 853 | | /**/AM_RANGE(0xc80000, 0xc80005) AM_RAM_WRITE(pwrinst2_vctrl_3_w) AM_BASE_MEMBER(cave_state, m_vctrl_3) // Layer 3 Control |
| 852 | /**/AM_RANGE(0xb00000, 0xb00005) AM_RAM_WRITE(pwrinst2_vctrl_2_w) AM_BASE_MEMBER(cave_state, m_vctrl[2]) // Layer 2 Control |
| 853 | /**/AM_RANGE(0xb80000, 0xb80005) AM_RAM_WRITE(pwrinst2_vctrl_0_w) AM_BASE_MEMBER(cave_state, m_vctrl[0]) // Layer 0 Control |
| 854 | /**/AM_RANGE(0xc00000, 0xc00005) AM_RAM_WRITE(pwrinst2_vctrl_1_w) AM_BASE_MEMBER(cave_state, m_vctrl[1]) // Layer 1 Control |
| 855 | /**/AM_RANGE(0xc80000, 0xc80005) AM_RAM_WRITE(pwrinst2_vctrl_3_w) AM_BASE_MEMBER(cave_state, m_vctrl[3]) // Layer 3 Control |
| 854 | 856 | AM_RANGE(0xd80000, 0xd80001) AM_READ(soundlatch_ack_r) // ? From Sound CPU |
| 855 | 857 | AM_RANGE(0xe00000, 0xe00001) AM_WRITE(sound_cmd_w) // To Sound CPU |
| 856 | 858 | AM_RANGE(0xe80000, 0xe80001) AM_DEVREAD("eeprom", pwrinst2_eeprom_r) // EEPROM |
| r11160 | r11161 | |
| 883 | 885 | AM_RANGE(0x600000, 0x600001) AM_READ(sailormn_input0_r) // Inputs + Watchdog! |
| 884 | 886 | AM_RANGE(0x600002, 0x600003) AM_READ_PORT("IN1") // Inputs + EEPROM |
| 885 | 887 | AM_RANGE(0x700000, 0x700001) AM_DEVWRITE("eeprom", sailormn_eeprom_msb_w) // EEPROM |
| 886 | | AM_RANGE(0x800000, 0x807fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram_0) // Layer 0 |
| 887 | | AM_RANGE(0x880000, 0x887fff) AM_RAM_WRITE(cave_vram_1_w) AM_BASE_MEMBER(cave_state, m_vram_1) // Layer 1 |
| 888 | | AM_RANGE(0x900000, 0x907fff) AM_RAM_WRITE(cave_vram_2_w) AM_BASE_MEMBER(cave_state, m_vram_2) // Layer 2 |
| 888 | AM_RANGE(0x800000, 0x807fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram[0]) // Layer 0 |
| 889 | AM_RANGE(0x880000, 0x887fff) AM_RAM_WRITE(cave_vram_1_w) AM_BASE_MEMBER(cave_state, m_vram[1]) // Layer 1 |
| 890 | AM_RANGE(0x900000, 0x907fff) AM_RAM_WRITE(cave_vram_2_w) AM_BASE_MEMBER(cave_state, m_vram[2]) // Layer 2 |
| 889 | 891 | AM_RANGE(0x908000, 0x908001) AM_RAM // (agallet) |
| 890 | | /**/AM_RANGE(0xa00000, 0xa00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_0) // Layer 0 Control |
| 891 | | /**/AM_RANGE(0xa80000, 0xa80005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_1) // Layer 1 Control |
| 892 | | /**/AM_RANGE(0xb00000, 0xb00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_2) // Layer 2 Control |
| 892 | /**/AM_RANGE(0xa00000, 0xa00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[0]) // Layer 0 Control |
| 893 | /**/AM_RANGE(0xa80000, 0xa80005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[1]) // Layer 1 Control |
| 894 | /**/AM_RANGE(0xb00000, 0xb00005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[2]) // Layer 2 Control |
| 893 | 895 | AM_RANGE(0xb80000, 0xb80007) AM_READ(cave_irq_cause_r) // IRQ Cause (bit 2 tested!) |
| 894 | 896 | AM_RANGE(0xb8006c, 0xb8006d) AM_READ(soundflags_ack_r) // Communication |
| 895 | 897 | AM_RANGE(0xb8006e, 0xb8006f) AM_READ(soundlatch_ack_r) // From Sound CPU |
| r11160 | r11161 | |
| 950 | 952 | AM_RANGE(0x200000, 0x207fff) AM_RAM AM_BASE_SIZE_MEMBER(cave_state, m_spriteram, m_spriteram_size) // Sprites |
| 951 | 953 | AM_RANGE(0x208000, 0x20ffff) AM_RAM AM_BASE_MEMBER(cave_state, m_spriteram_2) // Sprite bank 2 |
| 952 | 954 | AM_RANGE(0x304000, 0x307fff) AM_WRITE(cave_vram_0_w) // Layer 0 - 16x16 tiles mapped here |
| 953 | | AM_RANGE(0x300000, 0x307fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram_0) // Layer 0 |
| 954 | | AM_RANGE(0x400000, 0x400005) AM_WRITEONLY AM_BASE_MEMBER(cave_state, m_vctrl_0) // Layer 0 Control |
| 955 | AM_RANGE(0x300000, 0x307fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram[0]) // Layer 0 |
| 956 | AM_RANGE(0x400000, 0x400005) AM_WRITEONLY AM_BASE_MEMBER(cave_state, m_vctrl[0]) // Layer 0 Control |
| 955 | 957 | AM_RANGE(0x500000, 0x50ffff) AM_RAM AM_BASE_SIZE_MEMBER(cave_state, m_paletteram, m_paletteram_size) // Palette |
| 956 | 958 | AM_RANGE(0x600000, 0x600001) AM_READ_PORT("IN0") // Inputs + EEPROM + Hopper |
| 957 | 959 | AM_RANGE(0x600002, 0x600003) AM_READ_PORT("IN1") // Inputs |
| r11160 | r11161 | |
| 990 | 992 | AM_RANGE(0x100000, 0x10ffff) AM_RAM AM_SHARE("nvram") // RAM |
| 991 | 993 | AM_RANGE(0x200000, 0x207fff) AM_RAM AM_BASE_SIZE_MEMBER(cave_state, m_spriteram, m_spriteram_size) // Sprites |
| 992 | 994 | AM_RANGE(0x208000, 0x20ffff) AM_RAM AM_BASE_MEMBER(cave_state, m_spriteram_2) // Sprite bank 2 |
| 993 | | AM_RANGE(0x300000, 0x307fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram_0) // Layer 0 |
| 995 | AM_RANGE(0x300000, 0x307fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram[0]) // Layer 0 |
| 994 | 996 | AM_RANGE(0x400000, 0x400007) AM_READ(cave_irq_cause_r) // IRQ Cause |
| 995 | 997 | AM_RANGE(0x400068, 0x400069) AM_WRITE(watchdog_reset16_w) // Watchdog |
| 996 | 998 | AM_RANGE(0x400000, 0x40007f) AM_WRITEONLY AM_BASE_MEMBER(cave_state, m_videoregs) // Video Regs |
| 997 | | AM_RANGE(0x500000, 0x500005) AM_WRITEONLY AM_BASE_MEMBER(cave_state, m_vctrl_0) // Layer 0 Control |
| 999 | AM_RANGE(0x500000, 0x500005) AM_WRITEONLY AM_BASE_MEMBER(cave_state, m_vctrl[0]) // Layer 0 Control |
| 998 | 1000 | AM_RANGE(0x600000, 0x60ffff) AM_RAM AM_BASE_SIZE_MEMBER(cave_state, m_paletteram, m_paletteram_size) // Palette |
| 999 | 1001 | AM_RANGE(0x700000, 0x700001) AM_READ_PORT("IN0") // Inputs + EEPROM + Hopper |
| 1000 | 1002 | AM_RANGE(0x700002, 0x700003) AM_READ_PORT("IN1") // Inputs |
| r11160 | r11161 | |
| 1014 | 1016 | AM_RANGE(0x300000, 0x300003) AM_DEVREADWRITE8("ymz", ymz280b_r, ymz280b_w, 0x00ff) // YMZ280 |
| 1015 | 1017 | /**/AM_RANGE(0x400000, 0x407fff) AM_RAM AM_BASE_SIZE_MEMBER(cave_state, m_spriteram, m_spriteram_size) // Sprites |
| 1016 | 1018 | /**/AM_RANGE(0x408000, 0x40ffff) AM_RAM AM_BASE_MEMBER(cave_state, m_spriteram_2) // Sprites? |
| 1017 | | /**/AM_RANGE(0x500000, 0x507fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram_0) // Layer 0 |
| 1019 | /**/AM_RANGE(0x500000, 0x507fff) AM_RAM_WRITE(cave_vram_0_w) AM_BASE_MEMBER(cave_state, m_vram[0]) // Layer 0 |
| 1018 | 1020 | AM_RANGE(0x600000, 0x600007) AM_READ(cave_irq_cause_r) // IRQ Cause |
| 1019 | 1021 | AM_RANGE(0x600000, 0x60007f) AM_WRITEONLY AM_BASE_MEMBER(cave_state, m_videoregs) // Video Regs |
| 1020 | | /**/AM_RANGE(0x700000, 0x700005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl_0) // Layer 0 Control |
| 1022 | /**/AM_RANGE(0x700000, 0x700005) AM_RAM AM_BASE_MEMBER(cave_state, m_vctrl[0]) // Layer 0 Control |
| 1021 | 1023 | /**/AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE_SIZE_MEMBER(cave_state, m_paletteram, m_paletteram_size) // Palette |
| 1022 | 1024 | AM_RANGE(0x900000, 0x900001) AM_READ_PORT("IN0") // Inputs |
| 1023 | 1025 | AM_RANGE(0x900002, 0x900003) AM_READ_PORT("IN1") // Inputs + EEPROM |