src/mess/machine/68901mfp.c
| r4234 | r4235 | |
| 2 | 2 | |
| 3 | 3 | TODO: |
| 4 | 4 | |
| 5 | | - poll TAI/TBI pins |
| 6 | 5 | - daisy chaining |
| 7 | 6 | - correct gpio_timer period |
| 8 | 7 | - disable GPIO3/4 interrupts when timer A/B in pulse mode |
| r4234 | r4235 | |
| 36 | 35 | #include "68901mfp.h" |
| 37 | 36 | #include "cpu/m68000/m68000.h" |
| 38 | 37 | |
| 38 | /*************************************************************************** |
| 39 | PARAMETERS |
| 40 | ***************************************************************************/ |
| 41 | |
| 42 | #define LOG (0) |
| 43 | |
| 39 | 44 | enum |
| 40 | 45 | { |
| 41 | 46 | MC68901_REGISTER_GPIP = 0, |
| r4234 | r4235 | |
| 205 | 210 | #define MC68901_TSR_UNDERRUN_ERROR 0x40 |
| 206 | 211 | #define MC68901_TSR_BUFFER_EMPTY 0x80 |
| 207 | 212 | |
| 208 | | #define LOG (0) |
| 209 | | |
| 210 | 213 | static const int MC68901_INT_MASK_GPIO[] = |
| 211 | 214 | { |
| 212 | 215 | MC68901_IR_GPIP_0, MC68901_IR_GPIP_1, MC68901_IR_GPIP_2, MC68901_IR_GPIP_3, |
| r4234 | r4235 | |
| 218 | 221 | MC68901_IR_TIMER_A, MC68901_IR_TIMER_B, MC68901_IR_TIMER_C, MC68901_IR_TIMER_D |
| 219 | 222 | }; |
| 220 | 223 | |
| 221 | | static const int MC68901_LOOPBACK_TIMER[] = |
| 222 | | { |
| 223 | | MC68901_TAO_LOOPBACK, MC68901_TBO_LOOPBACK, MC68901_TCO_LOOPBACK, MC68901_TDO_LOOPBACK |
| 224 | | }; |
| 225 | | |
| 226 | 224 | static const int MC68901_GPIO_TIMER[] = |
| 227 | 225 | { |
| 228 | 226 | MC68901_GPIP_4, MC68901_GPIP_3 |
| r4234 | r4235 | |
| 230 | 228 | |
| 231 | 229 | static const int PRESCALER[] = { 0, 4, 10, 16, 50, 64, 100, 200 }; |
| 232 | 230 | |
| 231 | #define TXD(_data) devcb_call_write_line(&mc68901->out_so_func, _data); |
| 232 | |
| 233 | /*************************************************************************** |
| 234 | TYPE DEFINITIONS |
| 235 | ***************************************************************************/ |
| 236 | |
| 233 | 237 | typedef struct _mc68901_t mc68901_t; |
| 234 | 238 | struct _mc68901_t |
| 235 | 239 | { |
| 240 | devcb_resolved_read8 in_gpio_func; |
| 241 | devcb_resolved_write8 out_gpio_func; |
| 242 | devcb_resolved_read_line in_si_func; |
| 243 | devcb_resolved_write_line out_so_func; |
| 244 | devcb_resolved_write_line out_tao_func; |
| 245 | devcb_resolved_write_line out_tbo_func; |
| 246 | devcb_resolved_write_line out_tco_func; |
| 247 | devcb_resolved_write_line out_tdo_func; |
| 248 | devcb_resolved_write_line out_irq_func; |
| 249 | |
| 236 | 250 | int device_type; /* device type */ |
| 237 | | const mc68901_interface *intf; /* interface */ |
| 251 | int timer_clock; /* timer clock */ |
| 238 | 252 | |
| 239 | 253 | /* registers */ |
| 240 | 254 | UINT8 gpip; /* general purpose I/O register */ |
| r4234 | r4235 | |
| 288 | 302 | |
| 289 | 303 | /* timers */ |
| 290 | 304 | emu_timer *timer[MC68901_MAX_TIMERS]; /* counter timers */ |
| 291 | | |
| 292 | 305 | emu_timer *rx_timer; /* receive timer */ |
| 293 | 306 | emu_timer *tx_timer; /* transmit timer */ |
| 294 | | |
| 295 | 307 | emu_timer *poll_timer; /* general purpose I/O poll timer */ |
| 296 | 308 | }; |
| 297 | 309 | |
| 310 | /*************************************************************************** |
| 311 | INLINE FUNCTIONS |
| 312 | ***************************************************************************/ |
| 313 | |
| 298 | 314 | INLINE mc68901_t *get_safe_token(const device_config *device) |
| 299 | 315 | { |
| 300 | 316 | assert(device != NULL); |
| 301 | 317 | assert(device->token != NULL); |
| 302 | | |
| 303 | 318 | return (mc68901_t *)device->token; |
| 304 | 319 | } |
| 305 | 320 | |
| 306 | | static void mc68901_check_interrupts(const device_config *device) |
| 321 | INLINE const mc68901_interface *get_interface(const device_config *device) |
| 307 | 322 | { |
| 323 | assert(device != NULL); |
| 324 | assert(device->type == MC68901); |
| 325 | return (const mc68901_interface *) device->static_config; |
| 326 | } |
| 327 | |
| 328 | /*************************************************************************** |
| 329 | IMPLEMENTATION |
| 330 | ***************************************************************************/ |
| 331 | |
| 332 | /*------------------------------------------------- |
| 333 | check_interrupts - set the interrupt request |
| 334 | line state |
| 335 | -------------------------------------------------*/ |
| 336 | |
| 337 | static void check_interrupts(const device_config *device) |
| 338 | { |
| 308 | 339 | mc68901_t *mc68901 = get_safe_token(device); |
| 309 | 340 | |
| 310 | 341 | if (mc68901->ipr & mc68901->imr) |
| 311 | 342 | { |
| 312 | | mc68901->intf->on_irq_changed(device, HOLD_LINE); |
| 343 | devcb_call_write_line(&mc68901->out_irq_func, ASSERT_LINE); |
| 313 | 344 | } |
| 314 | 345 | else |
| 315 | 346 | { |
| 316 | | mc68901->intf->on_irq_changed(device, CLEAR_LINE); |
| 347 | devcb_call_write_line(&mc68901->out_irq_func, CLEAR_LINE); |
| 317 | 348 | } |
| 318 | 349 | } |
| 319 | 350 | |
| 320 | | static void mc68901_interrupt(const device_config *device, UINT16 mask) |
| 351 | /*------------------------------------------------- |
| 352 | take_interrupt - mark an interrupt pending |
| 353 | -------------------------------------------------*/ |
| 354 | |
| 355 | static void take_interrupt(const device_config *device, UINT16 mask) |
| 321 | 356 | { |
| 322 | 357 | mc68901_t *mc68901 = get_safe_token(device); |
| 323 | 358 | |
| 324 | 359 | mc68901->ipr |= mask; |
| 325 | 360 | |
| 326 | | mc68901_check_interrupts(device); |
| 361 | check_interrupts(device); |
| 327 | 362 | } |
| 328 | 363 | |
| 329 | | static TIMER_CALLBACK( mc68901_gpio_poll_tick ) |
| 364 | /*------------------------------------------------- |
| 365 | TIMER_CALLBACK( gpio_poll_tick ) |
| 366 | -------------------------------------------------*/ |
| 367 | |
| 368 | static TIMER_CALLBACK( gpio_poll_tick ) |
| 330 | 369 | { |
| 331 | 370 | const device_config *device = ptr; |
| 332 | 371 | mc68901_t *mc68901 = get_safe_token(device); |
| 333 | 372 | |
| 334 | | UINT8 gpio = mc68901->intf->gpio_r(device); |
| 373 | UINT8 gpio = devcb_call_read8(&mc68901->in_gpio_func, 0); |
| 335 | 374 | |
| 336 | 375 | UINT8 gpold = (mc68901->gpip & ~mc68901->ddr) ^ mc68901->aer; |
| 337 | 376 | UINT8 gpnew = (gpio & ~mc68901->ddr) ^ mc68901->aer; |
| r4234 | r4235 | |
| 348 | 387 | { |
| 349 | 388 | if (LOG) logerror("MC68901 Interrupt Pending for GPIO%u\n", bit); |
| 350 | 389 | |
| 351 | | mc68901_interrupt(device, MC68901_INT_MASK_GPIO[bit]); // set interrupt pending bit |
| 390 | take_interrupt(device, MC68901_INT_MASK_GPIO[bit]); // set interrupt pending bit |
| 352 | 391 | } |
| 353 | 392 | } |
| 354 | 393 | } |
| r4234 | r4235 | |
| 356 | 395 | mc68901->gpip = (gpio & ~mc68901->ddr) | (mc68901->gpip & mc68901->ddr); |
| 357 | 396 | } |
| 358 | 397 | |
| 359 | | /* USART */ |
| 398 | /*------------------------------------------------- |
| 399 | rx_buffer_full - signal receive buffer full |
| 400 | interrupt |
| 401 | -------------------------------------------------*/ |
| 360 | 402 | |
| 361 | | static void mc68901_rx_buffer_full(const device_config *device) |
| 403 | static void rx_buffer_full(const device_config *device) |
| 362 | 404 | { |
| 363 | 405 | mc68901_t *mc68901 = get_safe_token(device); |
| 364 | 406 | |
| 365 | 407 | if (mc68901->ier & MC68901_IR_RCV_BUFFER_FULL) |
| 366 | 408 | { |
| 367 | | mc68901_interrupt(device, MC68901_IR_RCV_BUFFER_FULL); |
| 409 | take_interrupt(device, MC68901_IR_RCV_BUFFER_FULL); |
| 368 | 410 | } |
| 369 | 411 | } |
| 370 | 412 | |
| 371 | | static void mc68901_rx_error(const device_config *device) |
| 413 | /*------------------------------------------------- |
| 414 | rx_error - signal receive error interrupt |
| 415 | -------------------------------------------------*/ |
| 416 | |
| 417 | static void rx_error(const device_config *device) |
| 372 | 418 | { |
| 373 | 419 | mc68901_t *mc68901 = get_safe_token(device); |
| 374 | 420 | |
| 375 | 421 | if (mc68901->ier & MC68901_IR_RCV_ERROR) |
| 376 | 422 | { |
| 377 | | mc68901_interrupt(device, MC68901_IR_RCV_ERROR); |
| 423 | take_interrupt(device, MC68901_IR_RCV_ERROR); |
| 378 | 424 | } |
| 379 | 425 | else |
| 380 | 426 | { |
| 381 | | mc68901_rx_buffer_full(device); |
| 427 | rx_buffer_full(device); |
| 382 | 428 | } |
| 383 | 429 | } |
| 384 | 430 | |
| 385 | | static void mc68901_tx_buffer_empty(const device_config *device) |
| 431 | /*------------------------------------------------- |
| 432 | tx_buffer_empty - signal transmit buffer |
| 433 | empty interrupt |
| 434 | -------------------------------------------------*/ |
| 435 | |
| 436 | static void tx_buffer_empty(const device_config *device) |
| 386 | 437 | { |
| 387 | 438 | mc68901_t *mc68901 = get_safe_token(device); |
| 388 | 439 | |
| 389 | 440 | if (mc68901->ier & MC68901_IR_XMIT_BUFFER_EMPTY) |
| 390 | 441 | { |
| 391 | | mc68901_interrupt(device, MC68901_IR_XMIT_BUFFER_EMPTY); |
| 442 | take_interrupt(device, MC68901_IR_XMIT_BUFFER_EMPTY); |
| 392 | 443 | } |
| 393 | 444 | } |
| 394 | 445 | |
| 395 | | static void mc68901_tx_error(const device_config *device) |
| 446 | /*------------------------------------------------- |
| 447 | tx_error - signal transmit error interrupt |
| 448 | -------------------------------------------------*/ |
| 449 | |
| 450 | static void tx_error(const device_config *device) |
| 396 | 451 | { |
| 397 | 452 | mc68901_t *mc68901 = get_safe_token(device); |
| 398 | 453 | |
| 399 | 454 | if (mc68901->ier & MC68901_IR_XMIT_ERROR) |
| 400 | 455 | { |
| 401 | | mc68901_interrupt(device, MC68901_IR_XMIT_ERROR); |
| 456 | take_interrupt(device, MC68901_IR_XMIT_ERROR); |
| 402 | 457 | } |
| 403 | 458 | else |
| 404 | 459 | { |
| 405 | | mc68901_tx_buffer_empty(device); |
| 460 | tx_buffer_empty(device); |
| 406 | 461 | } |
| 407 | 462 | } |
| 408 | 463 | |
| 409 | | static int mc68901_parity(UINT8 b) |
| 464 | /*------------------------------------------------- |
| 465 | get_parity_bit - calculate parity bit |
| 466 | -------------------------------------------------*/ |
| 467 | |
| 468 | static int get_parity_bit(UINT8 b) |
| 410 | 469 | { |
| 411 | 470 | b ^= b >> 4; |
| 412 | 471 | b ^= b >> 2; |
| r4234 | r4235 | |
| 414 | 473 | return b & 1; |
| 415 | 474 | } |
| 416 | 475 | |
| 417 | | static void mc68901_serial_rx(const device_config *device) |
| 476 | /*------------------------------------------------- |
| 477 | serial_receive - receive serial bit |
| 478 | -------------------------------------------------*/ |
| 479 | |
| 480 | static void serial_receive(const device_config *device) |
| 418 | 481 | { |
| 419 | 482 | mc68901_t *mc68901 = get_safe_token(device); |
| 483 | int rxd; |
| 420 | 484 | |
| 421 | | if (mc68901->rsr & MC68901_RSR_RCV_ENABLE) |
| 485 | if (!(mc68901->rsr & MC68901_RSR_RCV_ENABLE)) return; |
| 486 | |
| 487 | rxd = devcb_call_read_line(&mc68901->in_si_func); |
| 488 | |
| 489 | switch (mc68901->rx_state) |
| 422 | 490 | { |
| 423 | | switch (mc68901->rx_state) |
| 491 | case MC68901_SERIAL_START: |
| 492 | if (!rxd) |
| 424 | 493 | { |
| 425 | | case MC68901_SERIAL_START: |
| 426 | | if (mc68901->intf->rx_pin == 0) |
| 427 | | { |
| 428 | | mc68901->rsr |= MC68901_RSR_CHAR_IN_PROGRESS; |
| 429 | | mc68901->rx_bits = 0; |
| 430 | | mc68901->rx_buffer = 0; |
| 431 | | mc68901->rx_state = MC68901_SERIAL_DATA; |
| 432 | | mc68901->next_rsr = MC68901_RSR_BREAK; |
| 433 | | } |
| 434 | | break; |
| 494 | mc68901->rsr |= MC68901_RSR_CHAR_IN_PROGRESS; |
| 495 | mc68901->rx_bits = 0; |
| 496 | mc68901->rx_buffer = 0; |
| 497 | mc68901->rx_state = MC68901_SERIAL_DATA; |
| 498 | mc68901->next_rsr = MC68901_RSR_BREAK; |
| 499 | } |
| 500 | break; |
| 435 | 501 | |
| 436 | | case MC68901_SERIAL_DATA: |
| 437 | | if ((mc68901->next_rsr & MC68901_RSR_BREAK) && (*mc68901->intf->rx_pin == 1) && mc68901->rsr_read) |
| 438 | | { |
| 439 | | mc68901->next_rsr &= ~MC68901_RSR_BREAK; |
| 440 | | } |
| 502 | case MC68901_SERIAL_DATA: |
| 503 | if ((mc68901->next_rsr & MC68901_RSR_BREAK) && (rxd == 1) && mc68901->rsr_read) |
| 504 | { |
| 505 | mc68901->next_rsr &= ~MC68901_RSR_BREAK; |
| 506 | } |
| 441 | 507 | |
| 442 | | mc68901->rx_buffer >>= 1; |
| 443 | | mc68901->rx_buffer |= (*mc68901->intf->rx_pin << 7); |
| 444 | | mc68901->rx_bits++; |
| 508 | mc68901->rx_buffer >>= 1; |
| 509 | mc68901->rx_buffer |= (rxd << 7); |
| 510 | mc68901->rx_bits++; |
| 445 | 511 | |
| 446 | | if (mc68901->rx_bits == mc68901->rxtx_word) |
| 512 | if (mc68901->rx_bits == mc68901->rxtx_word) |
| 513 | { |
| 514 | if (mc68901->rxtx_word < 8) |
| 447 | 515 | { |
| 448 | | if (mc68901->rxtx_word < 8) |
| 449 | | { |
| 450 | | mc68901->rx_buffer >>= (8 - mc68901->rxtx_word); |
| 451 | | } |
| 452 | | |
| 453 | | mc68901->rsr &= ~MC68901_RSR_CHAR_IN_PROGRESS; |
| 454 | | |
| 455 | | if (mc68901->ucr & MC68901_UCR_PARITY_ENABLED) |
| 456 | | { |
| 457 | | mc68901->rx_state = MC68901_SERIAL_PARITY; |
| 458 | | } |
| 459 | | else |
| 460 | | { |
| 461 | | mc68901->rx_state = MC68901_SERIAL_STOP; |
| 462 | | } |
| 516 | mc68901->rx_buffer >>= (8 - mc68901->rxtx_word); |
| 463 | 517 | } |
| 464 | | break; |
| 465 | 518 | |
| 466 | | case MC68901_SERIAL_PARITY: |
| 467 | | mc68901->rx_parity = *mc68901->intf->rx_pin; |
| 519 | mc68901->rsr &= ~MC68901_RSR_CHAR_IN_PROGRESS; |
| 468 | 520 | |
| 469 | | if (mc68901->rx_parity != (mc68901_parity(mc68901->rx_buffer) ^ ((mc68901->ucr & MC68901_UCR_PARITY_EVEN) >> 1))) |
| 521 | if (mc68901->ucr & MC68901_UCR_PARITY_ENABLED) |
| 470 | 522 | { |
| 471 | | mc68901->next_rsr |= MC68901_RSR_PARITY_ERROR; |
| 523 | mc68901->rx_state = MC68901_SERIAL_PARITY; |
| 472 | 524 | } |
| 525 | else |
| 526 | { |
| 527 | mc68901->rx_state = MC68901_SERIAL_STOP; |
| 528 | } |
| 529 | } |
| 530 | break; |
| 473 | 531 | |
| 474 | | mc68901->rx_state = MC68901_SERIAL_STOP; |
| 475 | | break; |
| 532 | case MC68901_SERIAL_PARITY: |
| 533 | mc68901->rx_parity = rxd; |
| 476 | 534 | |
| 477 | | case MC68901_SERIAL_STOP: |
| 478 | | if (*mc68901->intf->rx_pin == 1) |
| 535 | if (mc68901->rx_parity != (get_parity_bit(mc68901->rx_buffer) ^ ((mc68901->ucr & MC68901_UCR_PARITY_EVEN) >> 1))) |
| 536 | { |
| 537 | mc68901->next_rsr |= MC68901_RSR_PARITY_ERROR; |
| 538 | } |
| 539 | |
| 540 | mc68901->rx_state = MC68901_SERIAL_STOP; |
| 541 | break; |
| 542 | |
| 543 | case MC68901_SERIAL_STOP: |
| 544 | if (rxd == 1) |
| 545 | { |
| 546 | if (!((mc68901->rsr & MC68901_RSR_SYNC_STRIP_ENABLE) && (mc68901->rx_buffer == mc68901->scr))) |
| 479 | 547 | { |
| 480 | | if (!((mc68901->rsr & MC68901_RSR_SYNC_STRIP_ENABLE) && (mc68901->rx_buffer == mc68901->scr))) |
| 548 | if (!(mc68901->rsr & MC68901_RSR_OVERRUN_ERROR)) |
| 481 | 549 | { |
| 482 | | if (!(mc68901->rsr & MC68901_RSR_OVERRUN_ERROR)) |
| 550 | if (mc68901->rsr & MC68901_RSR_BUFFER_FULL) |
| 483 | 551 | { |
| 484 | | if (mc68901->rsr & MC68901_RSR_BUFFER_FULL) |
| 485 | | { |
| 486 | | // incoming word received but last word in receive buffer has not been read |
| 487 | | mc68901->next_rsr |= MC68901_RSR_OVERRUN_ERROR; |
| 488 | | } |
| 489 | | else |
| 490 | | { |
| 491 | | // incoming word received and receive buffer is empty |
| 492 | | mc68901->rsr |= MC68901_RSR_BUFFER_FULL; |
| 493 | | mc68901->udr = mc68901->rx_buffer; |
| 494 | | mc68901_rx_buffer_full(device); |
| 495 | | } |
| 552 | // incoming word received but last word in receive buffer has not been read |
| 553 | mc68901->next_rsr |= MC68901_RSR_OVERRUN_ERROR; |
| 496 | 554 | } |
| 555 | else |
| 556 | { |
| 557 | // incoming word received and receive buffer is empty |
| 558 | mc68901->rsr |= MC68901_RSR_BUFFER_FULL; |
| 559 | mc68901->udr = mc68901->rx_buffer; |
| 560 | rx_buffer_full(device); |
| 561 | } |
| 497 | 562 | } |
| 498 | 563 | } |
| 499 | | else |
| 564 | } |
| 565 | else |
| 566 | { |
| 567 | if (mc68901->rx_buffer) |
| 500 | 568 | { |
| 501 | | if (mc68901->rx_buffer) |
| 502 | | { |
| 503 | | // non-zero data word not followed by a stop bit |
| 504 | | mc68901->next_rsr |= MC68901_RSR_FRAME_ERROR; |
| 505 | | } |
| 569 | // non-zero data word not followed by a stop bit |
| 570 | mc68901->next_rsr |= MC68901_RSR_FRAME_ERROR; |
| 506 | 571 | } |
| 572 | } |
| 507 | 573 | |
| 508 | | mc68901->rx_state = MC68901_SERIAL_START; |
| 509 | | break; |
| 510 | | } |
| 574 | mc68901->rx_state = MC68901_SERIAL_START; |
| 575 | break; |
| 511 | 576 | } |
| 512 | 577 | } |
| 513 | 578 | |
| 579 | /*------------------------------------------------- |
| 580 | TIMER_CALLBACK( rx_tick ) |
| 581 | -------------------------------------------------*/ |
| 582 | |
| 514 | 583 | static TIMER_CALLBACK( rx_tick ) |
| 515 | 584 | { |
| 516 | 585 | const device_config *device = ptr; |
| 517 | 586 | |
| 518 | | mc68901_serial_rx(device); |
| 587 | serial_receive(device); |
| 519 | 588 | } |
| 520 | 589 | |
| 521 | | static void mc68901_transmit_disabled(const device_config *device) |
| 590 | /*------------------------------------------------- |
| 591 | tx_disabled - transmitter disabled handler |
| 592 | -------------------------------------------------*/ |
| 593 | |
| 594 | static void tx_disabled(const device_config *device) |
| 522 | 595 | { |
| 523 | 596 | mc68901_t *mc68901 = get_safe_token(device); |
| 524 | 597 | |
| 525 | 598 | switch (mc68901->tsr & MC68901_TSR_OUTPUT_MASK) |
| 526 | 599 | { |
| 527 | 600 | case MC68901_TSR_OUTPUT_HI_Z: |
| 528 | | // indeterminate |
| 601 | /* indeterminate state */ |
| 529 | 602 | case MC68901_TSR_OUTPUT_LOW: |
| 530 | | *mc68901->intf->tx_pin = 0; |
| 603 | TXD(0); |
| 531 | 604 | break; |
| 532 | 605 | |
| 533 | 606 | case MC68901_TSR_OUTPUT_HIGH: |
| 534 | 607 | case MC68901_TSR_OUTPUT_LOOP: |
| 535 | | *mc68901->intf->tx_pin = 1; |
| 608 | TXD(1); |
| 536 | 609 | break; |
| 537 | 610 | } |
| 538 | 611 | } |
| 539 | 612 | |
| 540 | | static void mc68901_transmit(const device_config *device) |
| 613 | /*------------------------------------------------- |
| 614 | tx_starting - transmitter starting handler |
| 615 | -------------------------------------------------*/ |
| 616 | |
| 617 | static void tx_starting(const device_config *device) |
| 541 | 618 | { |
| 542 | 619 | mc68901_t *mc68901 = get_safe_token(device); |
| 543 | 620 | |
| 621 | if (mc68901->tsr & MC68901_TSR_XMIT_ENABLE) |
| 622 | { |
| 623 | /* enable transmitter */ |
| 624 | TXD(1); |
| 625 | mc68901->xmit_state = MC68901_XMIT_ON; |
| 626 | } |
| 627 | else |
| 628 | { |
| 629 | /* disable transmitter */ |
| 630 | mc68901->tsr |= MC68901_TSR_END_OF_XMIT; |
| 631 | mc68901->xmit_state = MC68901_XMIT_OFF; |
| 632 | } |
| 633 | } |
| 634 | |
| 635 | /*------------------------------------------------- |
| 636 | tx_break - transmit break handler |
| 637 | -------------------------------------------------*/ |
| 638 | |
| 639 | static void tx_break(const device_config *device) |
| 640 | { |
| 641 | mc68901_t *mc68901 = get_safe_token(device); |
| 642 | |
| 643 | if (mc68901->tsr & MC68901_TSR_XMIT_ENABLE) |
| 644 | { |
| 645 | if (mc68901->tsr & MC68901_TSR_BREAK) |
| 646 | { |
| 647 | /* transmit break */ |
| 648 | TXD(1); |
| 649 | } |
| 650 | else |
| 651 | { |
| 652 | /* enable transmitter */ |
| 653 | mc68901->xmit_state = MC68901_XMIT_ON; |
| 654 | } |
| 655 | } |
| 656 | else |
| 657 | { |
| 658 | /* disable transmitter */ |
| 659 | mc68901->tsr |= MC68901_TSR_END_OF_XMIT; |
| 660 | mc68901->xmit_state = MC68901_XMIT_OFF; |
| 661 | } |
| 662 | } |
| 663 | |
| 664 | /*------------------------------------------------- |
| 665 | tx_enabled - transmitter enabled handler |
| 666 | -------------------------------------------------*/ |
| 667 | |
| 668 | static void tx_enabled(const device_config *device) |
| 669 | { |
| 670 | mc68901_t *mc68901 = get_safe_token(device); |
| 671 | |
| 544 | 672 | switch (mc68901->tx_state) |
| 545 | 673 | { |
| 546 | 674 | case MC68901_SERIAL_START: |
| 547 | 675 | if (mc68901->tsr & MC68901_TSR_UNDERRUN_ERROR) |
| 548 | 676 | { |
| 677 | /* buffer underrun condition */ |
| 549 | 678 | if (mc68901->tsr & MC68901_TSR_XMIT_ENABLE) |
| 550 | 679 | { |
| 551 | | *mc68901->intf->tx_pin = 1; |
| 680 | /* transmit break */ |
| 681 | TXD(1); |
| 552 | 682 | } |
| 553 | 683 | else |
| 554 | 684 | { |
| 555 | | mc68901_transmit_disabled(device); |
| 685 | /* transmitter disabled */ |
| 686 | tx_disabled(device); |
| 556 | 687 | } |
| 557 | 688 | } |
| 558 | 689 | else |
| 559 | 690 | { |
| 560 | 691 | if (mc68901->tsr & MC68901_TSR_BUFFER_EMPTY) |
| 561 | 692 | { |
| 693 | /* transmit buffer is empty, signal underrun error */ |
| 562 | 694 | mc68901->tsr |= MC68901_TSR_UNDERRUN_ERROR; |
| 563 | 695 | |
| 564 | 696 | if (mc68901->tsr & MC68901_TSR_XMIT_ENABLE) |
| 565 | 697 | { |
| 566 | | *mc68901->intf->tx_pin = 1; |
| 698 | /* transmit break */ |
| 699 | TXD(1); |
| 567 | 700 | } |
| 568 | 701 | else |
| 569 | 702 | { |
| 570 | | mc68901_transmit_disabled(device); |
| 703 | /* transmitter disabled */ |
| 704 | tx_disabled(device); |
| 571 | 705 | } |
| 572 | 706 | } |
| 573 | 707 | else |
| 574 | 708 | { |
| 575 | | *mc68901->intf->tx_pin = 0; |
| 709 | /* transmit start bit */ |
| 710 | TXD(0); |
| 711 | |
| 712 | /* load transmit buffer */ |
| 576 | 713 | mc68901->tx_buffer = mc68901->udr; |
| 577 | 714 | mc68901->tx_bits = 0; |
| 715 | |
| 716 | /* signal transmit buffer empty */ |
| 717 | mc68901->tsr |= MC68901_TSR_BUFFER_EMPTY; |
| 718 | tx_buffer_empty(device); |
| 719 | |
| 720 | /* calculate parity */ |
| 721 | mc68901->tx_parity = get_parity_bit(mc68901->tx_buffer); |
| 722 | |
| 723 | /* next bit is data */ |
| 578 | 724 | mc68901->tx_state = MC68901_SERIAL_DATA; |
| 579 | | mc68901->tsr |= MC68901_TSR_BUFFER_EMPTY; |
| 580 | | mc68901_tx_buffer_empty(device); |
| 581 | | mc68901->tx_parity = mc68901_parity(mc68901->tx_buffer); |
| 582 | 725 | } |
| 583 | 726 | } |
| 584 | 727 | break; |
| 585 | 728 | |
| 586 | 729 | case MC68901_SERIAL_DATA: |
| 587 | | *mc68901->intf->tx_pin = mc68901->tx_buffer & 0x01; |
| 730 | /* transmit data bit */ |
| 731 | TXD(mc68901->tx_buffer & 0x01); |
| 732 | |
| 733 | /* shift transmit buffer */ |
| 588 | 734 | mc68901->tx_buffer >>= 1; |
| 589 | 735 | mc68901->tx_bits++; |
| 590 | 736 | |
| 591 | 737 | if (mc68901->tx_bits == mc68901->rxtx_word) |
| 592 | 738 | { |
| 739 | /* all data bits transferred */ |
| 593 | 740 | if (mc68901->ucr & MC68901_UCR_PARITY_ENABLED) |
| 594 | 741 | { |
| 742 | /* next bit is parity */ |
| 595 | 743 | mc68901->tx_state = MC68901_SERIAL_PARITY; |
| 596 | 744 | } |
| 597 | 745 | else |
| 598 | 746 | { |
| 747 | /* next bit is stop */ |
| 599 | 748 | mc68901->tx_state = MC68901_SERIAL_STOP; |
| 600 | 749 | } |
| 601 | 750 | } |
| r4234 | r4235 | |
| 604 | 753 | case MC68901_SERIAL_PARITY: |
| 605 | 754 | if (mc68901->rxtx_word < 8) |
| 606 | 755 | { |
| 607 | | // highest bit in buffer is user-specified parity bit |
| 608 | | |
| 609 | | *mc68901->intf->tx_pin = mc68901->tx_buffer & 0x01; |
| 756 | /* transmit user-defined parity bit from buffer */ |
| 757 | TXD(mc68901->tx_buffer & 0x01); |
| 610 | 758 | } |
| 611 | 759 | else |
| 612 | 760 | { |
| 613 | | // use previously calculated parity |
| 614 | | |
| 615 | | *mc68901->intf->tx_pin = mc68901->tx_parity ^ ((mc68901->ucr & MC68901_UCR_PARITY_EVEN) >> 1); |
| 761 | /* transmit calculated parity bit */ |
| 762 | TXD(mc68901->tx_parity ^ ((mc68901->ucr & MC68901_UCR_PARITY_EVEN) >> 1)); |
| 616 | 763 | } |
| 617 | 764 | |
| 765 | /* next bit is stop */ |
| 618 | 766 | mc68901->tx_state = MC68901_SERIAL_STOP; |
| 619 | 767 | break; |
| 620 | 768 | |
| 621 | 769 | case MC68901_SERIAL_STOP: |
| 622 | | *mc68901->intf->tx_pin = 1; |
| 770 | /* transmit stop bit */ |
| 771 | TXD(1); |
| 623 | 772 | |
| 624 | 773 | if (mc68901->tsr & MC68901_TSR_XMIT_ENABLE) |
| 625 | 774 | { |
| 775 | /* next bit is start */ |
| 626 | 776 | mc68901->tx_state = MC68901_SERIAL_START; |
| 627 | 777 | } |
| 628 | 778 | else |
| 629 | 779 | { |
| 630 | 780 | if (mc68901->tsr & MC68901_TSR_AUTO_TURNAROUND) |
| 631 | 781 | { |
| 782 | /* enable transmitter */ |
| 632 | 783 | mc68901->tsr |= MC68901_TSR_XMIT_ENABLE; |
| 784 | |
| 785 | /* next bit is start */ |
| 633 | 786 | mc68901->tx_state = MC68901_SERIAL_START; |
| 634 | 787 | } |
| 635 | 788 | else |
| 636 | 789 | { |
| 790 | /* disable transmitter */ |
| 637 | 791 | mc68901->xmit_state = MC68901_XMIT_OFF; |
| 638 | 792 | mc68901->tsr |= MC68901_TSR_END_OF_XMIT; |
| 639 | | mc68901_tx_error(device); |
| 793 | |
| 794 | /* signal transmit error */ |
| 795 | tx_error(device); |
| 640 | 796 | } |
| 641 | 797 | } |
| 642 | 798 | break; |
| 643 | 799 | } |
| 644 | 800 | } |
| 645 | 801 | |
| 646 | | static void mc68901_serial_tx(const device_config *device) |
| 802 | /*------------------------------------------------- |
| 803 | serial_transmit - transmit serial bit |
| 804 | -------------------------------------------------*/ |
| 805 | |
| 806 | static void serial_transmit(const device_config *device) |
| 647 | 807 | { |
| 648 | 808 | mc68901_t *mc68901 = get_safe_token(device); |
| 649 | 809 | |
| 650 | 810 | switch (mc68901->xmit_state) |
| 651 | 811 | { |
| 652 | | case MC68901_XMIT_OFF: |
| 653 | | mc68901_transmit_disabled(device); |
| 654 | | break; |
| 655 | | |
| 656 | | case MC68901_XMIT_STARTING: |
| 657 | | if (mc68901->tsr & MC68901_TSR_XMIT_ENABLE) |
| 658 | | { |
| 659 | | *mc68901->intf->tx_pin = 1; |
| 660 | | mc68901->xmit_state = MC68901_XMIT_ON; |
| 661 | | } |
| 662 | | else |
| 663 | | { |
| 664 | | mc68901->xmit_state = MC68901_XMIT_OFF; |
| 665 | | mc68901->tsr |= MC68901_TSR_END_OF_XMIT; |
| 666 | | } |
| 667 | | break; |
| 668 | | |
| 669 | | case MC68901_XMIT_BREAK: |
| 670 | | if (mc68901->tsr & MC68901_TSR_XMIT_ENABLE) |
| 671 | | { |
| 672 | | if (mc68901->tsr & MC68901_TSR_BREAK) |
| 673 | | { |
| 674 | | *mc68901->intf->tx_pin = 1; |
| 675 | | } |
| 676 | | else |
| 677 | | { |
| 678 | | mc68901->xmit_state = MC68901_XMIT_ON; |
| 679 | | } |
| 680 | | } |
| 681 | | else |
| 682 | | { |
| 683 | | mc68901->xmit_state = MC68901_XMIT_OFF; |
| 684 | | mc68901->tsr |= MC68901_TSR_END_OF_XMIT; |
| 685 | | } |
| 686 | | break; |
| 687 | | |
| 688 | | case MC68901_XMIT_ON: |
| 689 | | mc68901_transmit(device); |
| 690 | | break; |
| 812 | case MC68901_XMIT_OFF: tx_disabled(device); break; |
| 813 | case MC68901_XMIT_STARTING: tx_starting(device); break; |
| 814 | case MC68901_XMIT_BREAK: tx_break(device); break; |
| 815 | case MC68901_XMIT_ON: tx_enabled(device); break; |
| 691 | 816 | } |
| 692 | 817 | } |
| 693 | 818 | |
| 819 | /*------------------------------------------------- |
| 820 | TIMER_CALLBACK( tx_tick ) |
| 821 | -------------------------------------------------*/ |
| 822 | |
| 694 | 823 | static TIMER_CALLBACK( tx_tick ) |
| 695 | 824 | { |
| 696 | 825 | const device_config *device = ptr; |
| 697 | 826 | |
| 698 | | mc68901_serial_tx(device); |
| 827 | serial_transmit(device); |
| 699 | 828 | } |
| 700 | 829 | |
| 701 | | /* Register Access */ |
| 830 | /*------------------------------------------------- |
| 831 | mc68901_register_r - register read |
| 832 | -------------------------------------------------*/ |
| 702 | 833 | |
| 703 | 834 | READ8_DEVICE_HANDLER( mc68901_register_r ) |
| 704 | 835 | { |
| r4234 | r4235 | |
| 738 | 869 | |
| 739 | 870 | case MC68901_REGISTER_TSR: |
| 740 | 871 | { |
| 741 | | // clear UE bit (in reality, this won't be cleared until one full clock cycle of the transmitter has passed since the bit was set) |
| 742 | | |
| 872 | /* clear UE bit (in reality, this won't be cleared until one full clock cycle of the transmitter has passed since the bit was set) */ |
| 743 | 873 | UINT8 tsr = mc68901->tsr; |
| 744 | 874 | mc68901->tsr &= 0xbf; |
| 745 | 875 | |
| r4234 | r4235 | |
| 747 | 877 | } |
| 748 | 878 | |
| 749 | 879 | case MC68901_REGISTER_UDR: |
| 750 | | // load RSR with latched value |
| 751 | | |
| 880 | /* load RSR with latched value */ |
| 752 | 881 | mc68901->rsr = (mc68901->next_rsr & 0x7c) | (mc68901->rsr & 0x03); |
| 753 | 882 | mc68901->next_rsr = 0; |
| 754 | 883 | |
| 755 | | // signal receiver error interrupt |
| 756 | | |
| 757 | 884 | if (mc68901->rsr & 0x78) |
| 758 | 885 | { |
| 759 | | mc68901_rx_error(device); |
| 886 | /* signal receiver error interrupt */ |
| 887 | rx_error(device); |
| 760 | 888 | } |
| 761 | 889 | |
| 762 | 890 | return mc68901->udr; |
| r4234 | r4235 | |
| 765 | 893 | } |
| 766 | 894 | } |
| 767 | 895 | |
| 896 | /*------------------------------------------------- |
| 897 | mc68901_register_w - register write |
| 898 | -------------------------------------------------*/ |
| 899 | |
| 768 | 900 | #define DIVISOR PRESCALER[data & 0x07] |
| 769 | 901 | |
| 770 | 902 | WRITE8_DEVICE_HANDLER( mc68901_register_w ) |
| r4234 | r4235 | |
| 777 | 909 | if (LOG) logerror("MC68901 General Purpose I/O : %x\n", data); |
| 778 | 910 | mc68901->gpip = data & mc68901->ddr; |
| 779 | 911 | |
| 780 | | if (mc68901->intf->gpio_w) |
| 781 | | { |
| 782 | | mc68901->intf->gpio_w(device, mc68901->gpip); |
| 783 | | } |
| 912 | devcb_call_write8(&mc68901->out_gpio_func, 0, mc68901->gpip); |
| 784 | 913 | break; |
| 785 | 914 | |
| 786 | 915 | case MC68901_REGISTER_AER: |
| r4234 | r4235 | |
| 797 | 926 | if (LOG) logerror("MC68901 Interrupt Enable Register A : %x\n", data); |
| 798 | 927 | mc68901->ier = (data << 8) | (mc68901->ier & 0xff); |
| 799 | 928 | mc68901->ipr &= mc68901->ier; |
| 800 | | mc68901_check_interrupts(device); |
| 929 | check_interrupts(device); |
| 801 | 930 | break; |
| 802 | 931 | |
| 803 | 932 | case MC68901_REGISTER_IERB: |
| 804 | 933 | if (LOG) logerror("MC68901 Interrupt Enable Register B : %x\n", data); |
| 805 | 934 | mc68901->ier = (mc68901->ier & 0xff00) | data; |
| 806 | 935 | mc68901->ipr &= mc68901->ier; |
| 807 | | mc68901_check_interrupts(device); |
| 936 | check_interrupts(device); |
| 808 | 937 | break; |
| 809 | 938 | |
| 810 | 939 | case MC68901_REGISTER_IPRA: |
| 811 | 940 | if (LOG) logerror("MC68901 Interrupt Pending Register A : %x\n", data); |
| 812 | 941 | mc68901->ipr &= (data << 8) | (mc68901->ipr & 0xff); |
| 813 | | mc68901_check_interrupts(device); |
| 942 | check_interrupts(device); |
| 814 | 943 | break; |
| 815 | 944 | |
| 816 | 945 | case MC68901_REGISTER_IPRB: |
| 817 | 946 | if (LOG) logerror("MC68901 Interrupt Pending Register B : %x\n", data); |
| 818 | 947 | mc68901->ipr &= (mc68901->ipr & 0xff00) | data; |
| 819 | | mc68901_check_interrupts(device); |
| 948 | check_interrupts(device); |
| 820 | 949 | break; |
| 821 | 950 | |
| 822 | 951 | case MC68901_REGISTER_ISRA: |
| r4234 | r4235 | |
| 833 | 962 | if (LOG) logerror("MC68901 Interrupt Mask Register A : %x\n", data); |
| 834 | 963 | mc68901->imr = (data << 8) | (mc68901->imr & 0xff); |
| 835 | 964 | mc68901->isr &= mc68901->imr; |
| 836 | | mc68901_check_interrupts(device); |
| 965 | check_interrupts(device); |
| 837 | 966 | break; |
| 838 | 967 | |
| 839 | 968 | case MC68901_REGISTER_IMRB: |
| 840 | 969 | if (LOG) logerror("MC68901 Interrupt Mask Register B : %x\n", data); |
| 841 | 970 | mc68901->imr = (mc68901->imr & 0xff00) | data; |
| 842 | 971 | mc68901->isr &= mc68901->imr; |
| 843 | | mc68901_check_interrupts(device); |
| 972 | check_interrupts(device); |
| 844 | 973 | break; |
| 845 | 974 | |
| 846 | 975 | case MC68901_REGISTER_VR: |
| r4234 | r4235 | |
| 880 | 1009 | { |
| 881 | 1010 | int divisor = PRESCALER[mc68901->tacr & 0x07]; |
| 882 | 1011 | if (LOG) logerror("MC68901 Timer A Delay Mode : %u Prescale\n", divisor); |
| 883 | | timer_adjust_periodic(mc68901->timer[MC68901_TIMER_A], ATTOTIME_IN_HZ(mc68901->intf->timer_clock / divisor), 0, ATTOTIME_IN_HZ(mc68901->intf->timer_clock / divisor)); |
| 1012 | timer_adjust_periodic(mc68901->timer[MC68901_TIMER_A], ATTOTIME_IN_HZ(mc68901->timer_clock / divisor), 0, ATTOTIME_IN_HZ(mc68901->timer_clock / divisor)); |
| 884 | 1013 | } |
| 885 | 1014 | break; |
| 886 | 1015 | |
| r4234 | r4235 | |
| 899 | 1028 | { |
| 900 | 1029 | int divisor = PRESCALER[mc68901->tacr & 0x07]; |
| 901 | 1030 | if (LOG) logerror("MC68901 Timer A Pulse Width Mode : %u Prescale\n", divisor); |
| 902 | | timer_adjust_periodic(mc68901->timer[MC68901_TIMER_A], attotime_never, 0, ATTOTIME_IN_HZ(mc68901->intf->timer_clock / divisor)); |
| 1031 | timer_adjust_periodic(mc68901->timer[MC68901_TIMER_A], attotime_never, 0, ATTOTIME_IN_HZ(mc68901->timer_clock / divisor)); |
| 903 | 1032 | timer_enable(mc68901->timer[MC68901_TIMER_A], 0); |
| 904 | 1033 | } |
| 905 | 1034 | break; |
| r4234 | r4235 | |
| 911 | 1040 | |
| 912 | 1041 | mc68901->to[MC68901_TIMER_A] = 0; |
| 913 | 1042 | |
| 914 | | if (mc68901->intf->on_to_changed) |
| 915 | | { |
| 916 | | mc68901->intf->on_to_changed(device, MC68901_TIMER_A, mc68901->to[MC68901_TIMER_A]); |
| 917 | | } |
| 1043 | devcb_call_write_line(&mc68901->out_tao_func, mc68901->to[MC68901_TIMER_A]); |
| 918 | 1044 | } |
| 919 | 1045 | break; |
| 920 | 1046 | |
| r4234 | r4235 | |
| 938 | 1064 | { |
| 939 | 1065 | int divisor = PRESCALER[mc68901->tbcr & 0x07]; |
| 940 | 1066 | if (LOG) logerror("MC68901 Timer B Delay Mode : %u Prescale\n", divisor); |
| 941 | | timer_adjust_periodic(mc68901->timer[MC68901_TIMER_B], ATTOTIME_IN_HZ(mc68901->intf->timer_clock / divisor), 0, ATTOTIME_IN_HZ(mc68901->intf->timer_clock / divisor)); |
| 1067 | timer_adjust_periodic(mc68901->timer[MC68901_TIMER_B], ATTOTIME_IN_HZ(mc68901->timer_clock / divisor), 0, ATTOTIME_IN_HZ(mc68901->timer_clock / divisor)); |
| 942 | 1068 | } |
| 943 | 1069 | break; |
| 944 | 1070 | |
| r4234 | r4235 | |
| 957 | 1083 | { |
| 958 | 1084 | int divisor = PRESCALER[mc68901->tbcr & 0x07]; |
| 959 | 1085 | if (LOG) logerror("MC68901 Timer B Pulse Width Mode : %u Prescale\n", DIVISOR); |
| 960 | | timer_adjust_periodic(mc68901->timer[MC68901_TIMER_B], attotime_never, 0, ATTOTIME_IN_HZ(mc68901->intf->timer_clock / divisor)); |
| 1086 | timer_adjust_periodic(mc68901->timer[MC68901_TIMER_B], attotime_never, 0, ATTOTIME_IN_HZ(mc68901->timer_clock / divisor)); |
| 961 | 1087 | timer_enable(mc68901->timer[MC68901_TIMER_B], 0); |
| 962 | 1088 | } |
| 963 | 1089 | break; |
| r4234 | r4235 | |
| 969 | 1095 | |
| 970 | 1096 | mc68901->to[MC68901_TIMER_B] = 0; |
| 971 | 1097 | |
| 972 | | if (mc68901->intf->on_to_changed) |
| 973 | | { |
| 974 | | mc68901->intf->on_to_changed(device, MC68901_TIMER_B, mc68901->to[MC68901_TIMER_B]); |
| 975 | | } |
| 1098 | devcb_call_write_line(&mc68901->out_tbo_func, mc68901->to[MC68901_TIMER_B]); |
| 976 | 1099 | } |
| 977 | 1100 | break; |
| 978 | 1101 | |
| r4234 | r4235 | |
| 996 | 1119 | { |
| 997 | 1120 | int divisor = PRESCALER[mc68901->tcdcr & 0x07]; |
| 998 | 1121 | if (LOG) logerror("MC68901 Timer D Delay Mode : %u Prescale\n", divisor); |
| 999 | | timer_adjust_periodic(mc68901->timer[MC68901_TIMER_D], ATTOTIME_IN_HZ(mc68901->intf->timer_clock / divisor), 0, ATTOTIME_IN_HZ(mc68901->intf->timer_clock / divisor)); |
| 1122 | timer_adjust_periodic(mc68901->timer[MC68901_TIMER_D], ATTOTIME_IN_HZ(mc68901->timer_clock / divisor), 0, ATTOTIME_IN_HZ(mc68901->timer_clock / divisor)); |
| 1000 | 1123 | } |
| 1001 | 1124 | break; |
| 1002 | 1125 | } |
| r4234 | r4235 | |
| 1018 | 1141 | { |
| 1019 | 1142 | int divisor = PRESCALER[(mc68901->tcdcr >> 4) & 0x07]; |
| 1020 | 1143 | if (LOG) logerror("MC68901 Timer C Delay Mode : %u Prescale\n", divisor); |
| 1021 | | timer_adjust_periodic(mc68901->timer[MC68901_TIMER_C], ATTOTIME_IN_HZ(mc68901->intf->timer_clock / divisor), 0, ATTOTIME_IN_HZ(mc68901->intf->timer_clock / divisor)); |
| 1144 | timer_adjust_periodic(mc68901->timer[MC68901_TIMER_C], ATTOTIME_IN_HZ(mc68901->timer_clock / divisor), 0, ATTOTIME_IN_HZ(mc68901->timer_clock / divisor)); |
| 1022 | 1145 | } |
| 1023 | 1146 | break; |
| 1024 | 1147 | } |
| r4234 | r4235 | |
| 1231 | 1354 | } |
| 1232 | 1355 | } |
| 1233 | 1356 | |
| 1234 | | static void mc68901_timer_count(const device_config *device, int index) |
| 1357 | /*------------------------------------------------- |
| 1358 | timer_count - timer count down |
| 1359 | -------------------------------------------------*/ |
| 1360 | |
| 1361 | static void timer_count(const device_config *device, int index) |
| 1235 | 1362 | { |
| 1236 | 1363 | mc68901_t *mc68901 = get_safe_token(device); |
| 1237 | 1364 | |
| 1238 | 1365 | if (mc68901->tmc[index] == 0x01) |
| 1239 | 1366 | { |
| 1240 | | mc68901->to[index] = mc68901->to[index] ? 0 : 1; |
| 1367 | /* toggle timer output signal */ |
| 1368 | mc68901->to[index] = !mc68901->to[index]; |
| 1241 | 1369 | |
| 1242 | | if (mc68901->to[index]) |
| 1370 | switch (index) |
| 1243 | 1371 | { |
| 1244 | | if (mc68901->intf->rx_clock == MC68901_LOOPBACK_TIMER[index]) |
| 1245 | | { |
| 1246 | | mc68901_serial_rx(device); |
| 1247 | | } |
| 1248 | | |
| 1249 | | if (mc68901->intf->tx_clock == MC68901_LOOPBACK_TIMER[index]) |
| 1250 | | { |
| 1251 | | mc68901_serial_tx(device); |
| 1252 | | } |
| 1372 | case MC68901_TIMER_A: devcb_call_write_line(&mc68901->out_tao_func, mc68901->to[index]); break; |
| 1373 | case MC68901_TIMER_B: devcb_call_write_line(&mc68901->out_tbo_func, mc68901->to[index]); break; |
| 1374 | case MC68901_TIMER_C: devcb_call_write_line(&mc68901->out_tco_func, mc68901->to[index]); break; |
| 1375 | case MC68901_TIMER_D: devcb_call_write_line(&mc68901->out_tdo_func, mc68901->to[index]); break; |
| 1253 | 1376 | } |
| 1254 | 1377 | |
| 1255 | | if (mc68901->intf->on_to_changed) |
| 1256 | | { |
| 1257 | | mc68901->intf->on_to_changed(device, index, mc68901->to[index]); |
| 1258 | | } |
| 1259 | | |
| 1260 | 1378 | if (mc68901->ier & MC68901_INT_MASK_TIMER[index]) |
| 1261 | 1379 | { |
| 1262 | | mc68901_interrupt(device, MC68901_INT_MASK_TIMER[index]); |
| 1380 | /* signal timer elapsed interrupt */ |
| 1381 | take_interrupt(device, MC68901_INT_MASK_TIMER[index]); |
| 1263 | 1382 | } |
| 1264 | 1383 | |
| 1384 | /* load main counter */ |
| 1265 | 1385 | mc68901->tmc[index] = mc68901->tdr[index]; |
| 1266 | 1386 | } |
| 1267 | 1387 | else |
| 1268 | 1388 | { |
| 1389 | /* count down */ |
| 1269 | 1390 | mc68901->tmc[index]--; |
| 1270 | 1391 | } |
| 1271 | 1392 | } |
| 1272 | 1393 | |
| 1273 | | static void mc68901_ti_w(const device_config *device, int index, int value) |
| 1394 | /*------------------------------------------------- |
| 1395 | timer_input - timer input |
| 1396 | -------------------------------------------------*/ |
| 1397 | |
| 1398 | static void timer_input(const device_config *device, int index, int value) |
| 1274 | 1399 | { |
| 1275 | 1400 | mc68901_t *mc68901 = get_safe_token(device); |
| 1276 | 1401 | |
| r4234 | r4235 | |
| 1283 | 1408 | case MC68901_TCR_TIMER_EVENT: |
| 1284 | 1409 | if (((mc68901->ti[index] ^ aer) == 1) && ((value ^ aer) == 0)) |
| 1285 | 1410 | { |
| 1286 | | mc68901_timer_count(device, index); |
| 1411 | timer_count(device, index); |
| 1287 | 1412 | } |
| 1288 | 1413 | |
| 1289 | 1414 | mc68901->ti[index] = value; |
| r4234 | r4235 | |
| 1302 | 1427 | { |
| 1303 | 1428 | if (mc68901->ier & MC68901_INT_MASK_GPIO[bit]) |
| 1304 | 1429 | { |
| 1305 | | mc68901_interrupt(device, MC68901_INT_MASK_GPIO[bit]); |
| 1430 | take_interrupt(device, MC68901_INT_MASK_GPIO[bit]); |
| 1306 | 1431 | } |
| 1307 | 1432 | } |
| 1308 | 1433 | |
| r4234 | r4235 | |
| 1311 | 1436 | } |
| 1312 | 1437 | } |
| 1313 | 1438 | |
| 1314 | | static TIMER_CALLBACK( timer_a ) |
| 1315 | | { |
| 1316 | | mc68901_timer_count(ptr, MC68901_TIMER_A); |
| 1317 | | } |
| 1439 | /*------------------------------------------------- |
| 1440 | TIMER_CALLBACK( timer_a ) |
| 1441 | -------------------------------------------------*/ |
| 1318 | 1442 | |
| 1319 | | static TIMER_CALLBACK( timer_b ) |
| 1320 | | { |
| 1321 | | mc68901_timer_count(ptr, MC68901_TIMER_B); |
| 1322 | | } |
| 1443 | static TIMER_CALLBACK( timer_a ) { timer_count(ptr, MC68901_TIMER_A); } |
| 1444 | static TIMER_CALLBACK( timer_b ) { timer_count(ptr, MC68901_TIMER_B); } |
| 1445 | static TIMER_CALLBACK( timer_c ) { timer_count(ptr, MC68901_TIMER_C); } |
| 1446 | static TIMER_CALLBACK( timer_d ) { timer_count(ptr, MC68901_TIMER_D); } |
| 1323 | 1447 | |
| 1324 | | static TIMER_CALLBACK( timer_c ) |
| 1325 | | { |
| 1326 | | mc68901_timer_count(ptr, MC68901_TIMER_C); |
| 1327 | | } |
| 1448 | /*------------------------------------------------- |
| 1449 | mc68901_get_vector - get interrupt vector |
| 1450 | -------------------------------------------------*/ |
| 1328 | 1451 | |
| 1329 | | static TIMER_CALLBACK( timer_d ) |
| 1330 | | { |
| 1331 | | mc68901_timer_count(ptr, MC68901_TIMER_D); |
| 1332 | | } |
| 1333 | | |
| 1334 | | /* External Interface */ |
| 1335 | | |
| 1336 | | void mc68901_tai_w(const device_config *device, int value) |
| 1337 | | { |
| 1338 | | mc68901_ti_w(device, MC68901_TIMER_A, value); |
| 1339 | | } |
| 1340 | | |
| 1341 | | void mc68901_tbi_w(const device_config *device, int value) |
| 1342 | | { |
| 1343 | | mc68901_ti_w(device, MC68901_TIMER_B, value); |
| 1344 | | } |
| 1345 | | |
| 1346 | 1452 | int mc68901_get_vector(const device_config *device) |
| 1347 | 1453 | { |
| 1348 | 1454 | mc68901_t *mc68901 = get_safe_token(device); |
| 1349 | 1455 | |
| 1350 | 1456 | int ch; |
| 1351 | 1457 | |
| 1352 | | assert(mc68901 != NULL); |
| 1353 | | |
| 1354 | 1458 | for (ch = 15; ch >= 0; ch--) |
| 1355 | 1459 | { |
| 1356 | 1460 | if (BIT(mc68901->imr, ch) && BIT(mc68901->ipr, ch)) |
| 1357 | 1461 | { |
| 1358 | 1462 | if (mc68901->vr & MC68901_VR_S) |
| 1359 | 1463 | { |
| 1464 | /* set interrupt-in-service bit */ |
| 1360 | 1465 | mc68901->isr |= (1 << ch); |
| 1361 | 1466 | } |
| 1362 | 1467 | |
| 1468 | /* clear interrupt pending bit */ |
| 1363 | 1469 | mc68901->ipr &= ~(1 << ch); |
| 1364 | 1470 | |
| 1365 | | mc68901_check_interrupts(device); |
| 1471 | check_interrupts(device); |
| 1366 | 1472 | |
| 1367 | 1473 | return (mc68901->vr & 0xf0) | ch; |
| 1368 | 1474 | } |
| r4234 | r4235 | |
| 1371 | 1477 | return M68K_INT_ACK_SPURIOUS; |
| 1372 | 1478 | } |
| 1373 | 1479 | |
| 1374 | | /* Device Interface */ |
| 1480 | /*------------------------------------------------- |
| 1481 | mc68901_tai_w - timer A input |
| 1482 | -------------------------------------------------*/ |
| 1375 | 1483 | |
| 1484 | void mc68901_tai_w(const device_config *device, int value) |
| 1485 | { |
| 1486 | timer_input(device, MC68901_TIMER_A, value); |
| 1487 | } |
| 1488 | |
| 1489 | /*------------------------------------------------- |
| 1490 | mc68901_tbi_w - timer B input |
| 1491 | -------------------------------------------------*/ |
| 1492 | |
| 1493 | void mc68901_tbi_w(const device_config *device, int value) |
| 1494 | { |
| 1495 | timer_input(device, MC68901_TIMER_B, value); |
| 1496 | } |
| 1497 | |
| 1498 | /*------------------------------------------------- |
| 1499 | mc68901_rx_clock_w - receiver clock input |
| 1500 | -------------------------------------------------*/ |
| 1501 | |
| 1502 | void mc68901_rx_clock_w(const device_config *device, int state) |
| 1503 | { |
| 1504 | if (state) |
| 1505 | { |
| 1506 | serial_receive(device); |
| 1507 | } |
| 1508 | } |
| 1509 | |
| 1510 | /*------------------------------------------------- |
| 1511 | mc68901_tx_clock_w - transmitter clock input |
| 1512 | -------------------------------------------------*/ |
| 1513 | |
| 1514 | void mc68901_tx_clock_w(const device_config *device, int state) |
| 1515 | { |
| 1516 | if (state) |
| 1517 | { |
| 1518 | serial_transmit(device); |
| 1519 | } |
| 1520 | } |
| 1521 | |
| 1522 | /*------------------------------------------------- |
| 1523 | DEVICE_START( mc68901 ) |
| 1524 | -------------------------------------------------*/ |
| 1525 | |
| 1376 | 1526 | static DEVICE_START( mc68901 ) |
| 1377 | 1527 | { |
| 1378 | 1528 | mc68901_t *mc68901 = device->token; |
| 1529 | const mc68901_interface *intf = get_interface(device); |
| 1379 | 1530 | |
| 1380 | | /* validate arguments */ |
| 1381 | | assert(device->tag != NULL); |
| 1531 | /* resolve callbacks */ |
| 1532 | devcb_resolve_read8(&mc68901->in_gpio_func, &intf->in_gpio_func, device); |
| 1533 | devcb_resolve_write8(&mc68901->out_gpio_func, &intf->out_gpio_func, device); |
| 1534 | devcb_resolve_read_line(&mc68901->in_si_func, &intf->in_si_func, device); |
| 1535 | devcb_resolve_write_line(&mc68901->out_so_func, &intf->out_so_func, device); |
| 1536 | devcb_resolve_write_line(&mc68901->out_tao_func, &intf->out_tao_func, device); |
| 1537 | devcb_resolve_write_line(&mc68901->out_tbo_func, &intf->out_tbo_func, device); |
| 1538 | devcb_resolve_write_line(&mc68901->out_tco_func, &intf->out_tco_func, device); |
| 1539 | devcb_resolve_write_line(&mc68901->out_tdo_func, &intf->out_tdo_func, device); |
| 1540 | devcb_resolve_write_line(&mc68901->out_irq_func, &intf->out_irq_func, device); |
| 1382 | 1541 | |
| 1383 | | mc68901->intf = device->static_config; |
| 1384 | | |
| 1385 | 1542 | /* set initial values */ |
| 1543 | mc68901->timer_clock = intf->timer_clock; |
| 1386 | 1544 | mc68901->tsr = MC68901_TSR_BUFFER_EMPTY; |
| 1387 | 1545 | |
| 1388 | 1546 | /* create the timers */ |
| r4234 | r4235 | |
| 1391 | 1549 | mc68901->timer[MC68901_TIMER_C] = timer_alloc(device->machine, timer_c, (void *)device); |
| 1392 | 1550 | mc68901->timer[MC68901_TIMER_D] = timer_alloc(device->machine, timer_d, (void *)device); |
| 1393 | 1551 | |
| 1394 | | if (mc68901->intf->rx_clock > 0) |
| 1552 | if (intf->rx_clock > 0) |
| 1395 | 1553 | { |
| 1396 | 1554 | mc68901->rx_timer = timer_alloc(device->machine, rx_tick, (void *)device); |
| 1397 | | timer_adjust_periodic(mc68901->rx_timer, attotime_zero, 0, ATTOTIME_IN_HZ(mc68901->intf->rx_clock)); |
| 1555 | timer_adjust_periodic(mc68901->rx_timer, attotime_zero, 0, ATTOTIME_IN_HZ(intf->rx_clock)); |
| 1398 | 1556 | } |
| 1399 | 1557 | |
| 1400 | | if (mc68901->intf->tx_clock > 0) |
| 1558 | if (intf->tx_clock > 0) |
| 1401 | 1559 | { |
| 1402 | 1560 | mc68901->tx_timer = timer_alloc(device->machine, tx_tick, (void *)device); |
| 1403 | | timer_adjust_periodic(mc68901->tx_timer, attotime_zero, 0, ATTOTIME_IN_HZ(mc68901->intf->tx_clock)); |
| 1561 | timer_adjust_periodic(mc68901->tx_timer, attotime_zero, 0, ATTOTIME_IN_HZ(intf->tx_clock)); |
| 1404 | 1562 | } |
| 1405 | 1563 | |
| 1406 | | if (mc68901->intf->gpio_r) |
| 1407 | | { |
| 1408 | | mc68901->poll_timer = timer_alloc(device->machine, mc68901_gpio_poll_tick, (void *)device); |
| 1409 | | timer_adjust_periodic(mc68901->poll_timer, attotime_zero, 0, ATTOTIME_IN_HZ(mc68901->intf->chip_clock / 4)); |
| 1410 | | } |
| 1564 | mc68901->poll_timer = timer_alloc(device->machine, gpio_poll_tick, (void *)device); |
| 1565 | timer_adjust_periodic(mc68901->poll_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / 4)); |
| 1411 | 1566 | |
| 1412 | 1567 | /* register for state saving */ |
| 1413 | 1568 | state_save_register_device_item(device, 0, mc68901->gpip); |
| r4234 | r4235 | |
| 1446 | 1601 | state_save_register_device_item(device, 0, mc68901->next_rsr); |
| 1447 | 1602 | } |
| 1448 | 1603 | |
| 1604 | /*------------------------------------------------- |
| 1605 | DEVICE_RESET( mc68901 ) |
| 1606 | -------------------------------------------------*/ |
| 1607 | |
| 1449 | 1608 | static DEVICE_RESET( mc68901 ) |
| 1450 | 1609 | { |
| 1451 | 1610 | mc68901_register_w(device, MC68901_REGISTER_GPIP, 0); |
| r4234 | r4235 | |
| 1468 | 1627 | mc68901_register_w(device, MC68901_REGISTER_RSR, 0); |
| 1469 | 1628 | } |
| 1470 | 1629 | |
| 1630 | /*------------------------------------------------- |
| 1631 | DEVICE_SET_INFO( mc68901 ) |
| 1632 | -------------------------------------------------*/ |
| 1633 | |
| 1471 | 1634 | static DEVICE_SET_INFO( mc68901 ) |
| 1472 | 1635 | { |
| 1473 | 1636 | switch (state) |
| r4234 | r4235 | |
| 1476 | 1639 | } |
| 1477 | 1640 | } |
| 1478 | 1641 | |
| 1642 | /*------------------------------------------------- |
| 1643 | DEVICE_GET_INFO( mc68901 ) |
| 1644 | -------------------------------------------------*/ |
| 1645 | |
| 1479 | 1646 | DEVICE_GET_INFO( mc68901 ) |
| 1480 | 1647 | { |
| 1481 | 1648 | switch (state) |
| r4234 | r4235 | |
| 1500 | 1667 | } |
| 1501 | 1668 | } |
| 1502 | 1669 | |
| 1670 | /*------------------------------------------------- |
| 1671 | DEVICE_GET_INFO( mk68901 ) |
| 1672 | -------------------------------------------------*/ |
| 1673 | |
| 1503 | 1674 | #ifdef UNUSED_FUNCTION |
| 1504 | 1675 | DEVICE_GET_INFO( mk68901 ) |
| 1505 | 1676 | { |
src/mess/drivers/atarist.c
| r4234 | r4235 | |
| 45 | 45 | static void atarist_fdc_dma_transfer(running_machine *machine) |
| 46 | 46 | { |
| 47 | 47 | device_config *fdc = (device_config*)devtag_get_device(machine, WD1772, "wd1772"); |
| 48 | | const address_space *program = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM); |
| 48 | const address_space *program = cputag_get_address_space(machine, M68000_TAG, ADDRESS_SPACE_PROGRAM); |
| 49 | 49 | atarist_state *state = machine->driver_data; |
| 50 | 50 | |
| 51 | 51 | if ((state->fdc_mode & ATARIST_FLOPPY_MODE_DMA_DISABLE) == 0) |
| r4234 | r4235 | |
| 478 | 478 | if (state->dmasnd_samples == 0) |
| 479 | 479 | { |
| 480 | 480 | int i; |
| 481 | | UINT8 *RAM = memory_region(machine, "main"); |
| 481 | UINT8 *RAM = memory_region(machine, M68000_TAG); |
| 482 | 482 | |
| 483 | 483 | for (i = 0; i < 8; i++) |
| 484 | 484 | { |
| r4234 | r4235 | |
| 1353 | 1353 | acia_interrupt |
| 1354 | 1354 | }; |
| 1355 | 1355 | |
| 1356 | | static MC68901_GPIO_READ( mfp_gpio_r ) |
| 1356 | static IRQ_CALLBACK( atarist_int_ack ) |
| 1357 | 1357 | { |
| 1358 | atarist_state *state = device->machine->driver_data; |
| 1359 | |
| 1360 | if (irqline == M68K_IRQ_6) |
| 1361 | { |
| 1362 | return mc68901_get_vector(state->mc68901); |
| 1363 | } |
| 1364 | |
| 1365 | return M68K_INT_ACK_AUTOVECTOR; |
| 1366 | } |
| 1367 | |
| 1368 | static READ8_DEVICE_HANDLER( mfp_gpio_r ) |
| 1369 | { |
| 1358 | 1370 | /* |
| 1359 | 1371 | |
| 1360 | 1372 | bit description |
| r4234 | r4235 | |
| 1383 | 1395 | return data; |
| 1384 | 1396 | } |
| 1385 | 1397 | |
| 1386 | | static IRQ_CALLBACK( atarist_int_ack ) |
| 1398 | static WRITE8_DEVICE_HANDLER( mfp_tdo_w ) |
| 1387 | 1399 | { |
| 1388 | | atarist_state *state = device->machine->driver_data; |
| 1389 | | |
| 1390 | | if (irqline == M68K_IRQ_6) |
| 1391 | | { |
| 1392 | | return mc68901_get_vector(state->mc68901); |
| 1393 | | } |
| 1394 | | |
| 1395 | | return M68K_INT_ACK_AUTOVECTOR; |
| 1400 | mc68901_rx_clock_w(device, data); |
| 1401 | mc68901_tx_clock_w(device, data); |
| 1396 | 1402 | } |
| 1397 | 1403 | |
| 1398 | | static MC68901_ON_IRQ_CHANGED( mfp_interrupt ) |
| 1399 | | { |
| 1400 | | cpu_set_input_line(device->machine->cpu[0], M68K_IRQ_6, level); |
| 1401 | | } |
| 1402 | | |
| 1403 | 1404 | static MC68901_INTERFACE( mfp_intf ) |
| 1404 | 1405 | { |
| 1405 | | Y2/8, |
| 1406 | | Y1, |
| 1407 | | MC68901_TDO_LOOPBACK, |
| 1408 | | MC68901_TDO_LOOPBACK, |
| 1409 | | &mfp_rx, |
| 1410 | | &mfp_tx, |
| 1411 | | NULL, |
| 1412 | | mfp_interrupt, |
| 1413 | | mfp_gpio_r, |
| 1414 | | NULL |
| 1406 | Y1, /* timer clock */ |
| 1407 | 0, /* receive clock */ |
| 1408 | 0, /* transmit clock */ |
| 1409 | DEVCB_DEVICE_HANDLER(MC68901, MC68901_TAG, mfp_gpio_r), /* GPIO read */ |
| 1410 | DEVCB_NULL, /* GPIO write */ |
| 1411 | DEVCB_NULL, /* serial input */ |
| 1412 | DEVCB_NULL, /* serial output */ |
| 1413 | DEVCB_NULL, /* TAO */ |
| 1414 | DEVCB_NULL, /* TBO */ |
| 1415 | DEVCB_NULL, /* TCO */ |
| 1416 | DEVCB_DEVICE_HANDLER(MC68901, MC68901_TAG, mfp_tdo_w), /* TDO */ |
| 1417 | DEVCB_CPU_INPUT_LINE(M68000_TAG, M68K_IRQ_6) /* interrupt */ |
| 1415 | 1418 | }; |
| 1416 | 1419 | |
| 1417 | 1420 | static const CENTRONICS_CONFIG atarist_centronics_config[1] = |
| r4234 | r4235 | |
| 1425 | 1428 | static void atarist_configure_memory(running_machine *machine) |
| 1426 | 1429 | { |
| 1427 | 1430 | const address_space *program = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 1428 | | UINT8 *RAM = memory_region(machine, "main"); |
| 1431 | UINT8 *RAM = memory_region(machine, M68000_TAG); |
| 1429 | 1432 | |
| 1430 | 1433 | switch (mess_ram_size) |
| 1431 | 1434 | { |
| r4234 | r4235 | |
| 1521 | 1524 | MACHINE_START_CALL(atarist); |
| 1522 | 1525 | } |
| 1523 | 1526 | |
| 1524 | | static MC68901_GPIO_READ( atariste_mfp_gpio_r ) |
| 1527 | static READ8_DEVICE_HANDLER( atariste_mfp_gpio_r ) |
| 1525 | 1528 | { |
| 1526 | 1529 | /* |
| 1527 | 1530 | |
| r4234 | r4235 | |
| 1551 | 1554 | |
| 1552 | 1555 | static MC68901_INTERFACE( atariste_mfp_intf ) |
| 1553 | 1556 | { |
| 1554 | | Y2/8, |
| 1555 | | Y1, |
| 1556 | | MC68901_TDO_LOOPBACK, |
| 1557 | | MC68901_TDO_LOOPBACK, |
| 1558 | | &mfp_rx, |
| 1559 | | &mfp_tx, |
| 1560 | | NULL, |
| 1561 | | mfp_interrupt, |
| 1562 | | atariste_mfp_gpio_r, |
| 1563 | | NULL |
| 1557 | Y1, /* timer clock */ |
| 1558 | 0, /* receive clock */ |
| 1559 | 0, /* transmit clock */ |
| 1560 | DEVCB_DEVICE_HANDLER(MC68901, MC68901_TAG, atariste_mfp_gpio_r), /* GPIO read */ |
| 1561 | DEVCB_NULL, /* GPIO write */ |
| 1562 | DEVCB_NULL, /* serial input */ |
| 1563 | DEVCB_NULL, /* serial output */ |
| 1564 | DEVCB_NULL, /* TAO */ |
| 1565 | DEVCB_NULL, /* TBO */ |
| 1566 | DEVCB_NULL, /* TCO */ |
| 1567 | DEVCB_DEVICE_HANDLER(MC68901, MC68901_TAG, mfp_tdo_w), /* TDO */ |
| 1568 | DEVCB_CPU_INPUT_LINE(M68000_TAG, M68K_IRQ_6) /* interrupt */ |
| 1564 | 1569 | }; |
| 1565 | 1570 | |
| 1566 | 1571 | static void atariste_state_save(running_machine *machine) |
| r4234 | r4235 | |
| 1621 | 1626 | static void stbook_configure_memory(running_machine *machine) |
| 1622 | 1627 | { |
| 1623 | 1628 | const address_space *program = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 1624 | | UINT8 *RAM = memory_region(machine, "main"); |
| 1629 | UINT8 *RAM = memory_region(machine, M68000_TAG); |
| 1625 | 1630 | |
| 1626 | 1631 | switch (mess_ram_size) |
| 1627 | 1632 | { |
| r4234 | r4235 | |
| 1695 | 1700 | acia_interrupt |
| 1696 | 1701 | }; |
| 1697 | 1702 | |
| 1698 | | static MC68901_GPIO_READ( stbook_mfp_gpio_r ) |
| 1703 | static READ8_DEVICE_HANDLER( stbook_mfp_gpio_r ) |
| 1699 | 1704 | { |
| 1700 | 1705 | /* |
| 1701 | 1706 | |
| r4234 | r4235 | |
| 1724 | 1729 | |
| 1725 | 1730 | static MC68901_INTERFACE( stbook_mfp_intf ) |
| 1726 | 1731 | { |
| 1727 | | Y2/8, |
| 1728 | | Y1, |
| 1729 | | MC68901_TDO_LOOPBACK, |
| 1730 | | MC68901_TDO_LOOPBACK, |
| 1731 | | &mfp_rx, |
| 1732 | | &mfp_tx, |
| 1733 | | NULL, |
| 1734 | | mfp_interrupt, |
| 1735 | | stbook_mfp_gpio_r, |
| 1736 | | NULL |
| 1732 | Y1, /* timer clock */ |
| 1733 | 0, /* receive clock */ |
| 1734 | 0, /* transmit clock */ |
| 1735 | DEVCB_DEVICE_HANDLER(MC68901, MC68901_TAG, mfp_gpio_r), /* GPIO read */ |
| 1736 | DEVCB_NULL, /* GPIO write */ |
| 1737 | DEVCB_NULL, /* serial input */ |
| 1738 | DEVCB_NULL, /* serial output */ |
| 1739 | DEVCB_NULL, /* TAO */ |
| 1740 | DEVCB_NULL, /* TBO */ |
| 1741 | DEVCB_NULL, /* TCO */ |
| 1742 | DEVCB_DEVICE_HANDLER(MC68901, MC68901_TAG, mfp_tdo_w), /* TDO */ |
| 1743 | DEVCB_CPU_INPUT_LINE(M68000_TAG, M68K_IRQ_6) /* interrupt */ |
| 1737 | 1744 | }; |
| 1738 | 1745 | |
| 1739 | 1746 | static MACHINE_START( stbook ) |
| r4234 | r4235 | |
| 1760 | 1767 | |
| 1761 | 1768 | static DEVICE_IMAGE_LOAD( atarist_cart ) |
| 1762 | 1769 | { |
| 1763 | | UINT8 *RAM = memory_region(image->machine, "main"); |
| 1770 | UINT8 *RAM = memory_region(image->machine, M68000_TAG); |
| 1764 | 1771 | UINT8 *ptr = RAM + 0xfa0000; |
| 1765 | 1772 | int filesize = image_length(image); |
| 1766 | 1773 | |
| r4234 | r4235 | |
| 1768 | 1775 | { |
| 1769 | 1776 | if (image_fread(image, ptr, filesize) == filesize) |
| 1770 | 1777 | { |
| 1771 | | memory_install_readwrite16_handler(cputag_get_address_space(image->machine, "main", ADDRESS_SPACE_PROGRAM), 0xfa0000, 0xfbffff, 0, 0, SMH_BANK3, SMH_BANK3); |
| 1778 | memory_install_readwrite16_handler(cputag_get_address_space(image->machine, M68000_TAG, ADDRESS_SPACE_PROGRAM), 0xfa0000, 0xfbffff, 0, 0, SMH_BANK3, SMH_BANK3); |
| 1772 | 1779 | |
| 1773 | 1780 | return INIT_PASS; |
| 1774 | 1781 | } |
| r4234 | r4235 | |
| 1788 | 1795 | MDRV_DRIVER_DATA(atarist_state) |
| 1789 | 1796 | |
| 1790 | 1797 | // basic machine hardware |
| 1791 | | MDRV_CPU_ADD("main", M68000, Y2/4) |
| 1798 | MDRV_CPU_ADD(M68000_TAG, M68000, Y2/4) |
| 1792 | 1799 | MDRV_CPU_PROGRAM_MAP(st_map, 0) |
| 1793 | 1800 | |
| 1794 | 1801 | MDRV_CPU_ADD("keyboard", HD63701, XTAL_4MHz) /* HD6301 */ |
| r4234 | r4235 | |
| 1798 | 1805 | MDRV_MACHINE_START(atarist) |
| 1799 | 1806 | |
| 1800 | 1807 | // device hardware |
| 1801 | | MDRV_MC68901_ADD(MC68901_TAG, mfp_intf) |
| 1808 | MDRV_MC68901_ADD(MC68901_TAG, Y2/8, mfp_intf) |
| 1802 | 1809 | MDRV_SCC8530_ADD("scc") |
| 1803 | 1810 | |
| 1804 | 1811 | // video hardware |
| 1805 | | MDRV_SCREEN_ADD("main", RASTER) |
| 1812 | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 1806 | 1813 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| 1807 | 1814 | MDRV_PALETTE_LENGTH(16) |
| 1808 | 1815 | MDRV_VIDEO_START( atarist ) |
| r4234 | r4235 | |
| 1831 | 1838 | static MACHINE_DRIVER_START( megast ) |
| 1832 | 1839 | MDRV_IMPORT_FROM(atarist) |
| 1833 | 1840 | |
| 1834 | | MDRV_CPU_MODIFY("main") |
| 1841 | MDRV_CPU_MODIFY(M68000_TAG) |
| 1835 | 1842 | MDRV_CPU_PROGRAM_MAP(megast_map, 0) |
| 1836 | 1843 | MDRV_RP5C15_ADD("rp5c15",rtc_intf) |
| 1837 | 1844 | |
| r4234 | r4235 | |
| 1842 | 1849 | MDRV_DRIVER_DATA(atarist_state) |
| 1843 | 1850 | |
| 1844 | 1851 | // basic machine hardware |
| 1845 | | MDRV_CPU_ADD("main", M68000, Y2/4) |
| 1852 | MDRV_CPU_ADD(M68000_TAG, M68000, Y2/4) |
| 1846 | 1853 | MDRV_CPU_PROGRAM_MAP(ste_map, 0) |
| 1847 | 1854 | |
| 1848 | 1855 | MDRV_CPU_ADD("keyboard", HD63701, XTAL_4MHz) /* HD6301 */ |
| r4234 | r4235 | |
| 1852 | 1859 | MDRV_MACHINE_START(atariste) |
| 1853 | 1860 | |
| 1854 | 1861 | // device hardware |
| 1855 | | MDRV_MC68901_ADD(MC68901_TAG, atariste_mfp_intf) |
| 1862 | MDRV_MC68901_ADD(MC68901_TAG, Y2/8, atariste_mfp_intf) |
| 1856 | 1863 | MDRV_SCC8530_ADD("scc") |
| 1857 | 1864 | |
| 1858 | 1865 | // video hardware |
| 1859 | | MDRV_SCREEN_ADD("main", RASTER) |
| 1866 | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 1860 | 1867 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| 1861 | 1868 | MDRV_PALETTE_LENGTH(512) |
| 1862 | 1869 | MDRV_VIDEO_START( atarist ) |
| r4234 | r4235 | |
| 1893 | 1900 | static MACHINE_DRIVER_START( megaste ) |
| 1894 | 1901 | MDRV_IMPORT_FROM(atariste) |
| 1895 | 1902 | |
| 1896 | | MDRV_CPU_MODIFY("main") |
| 1903 | MDRV_CPU_MODIFY(M68000_TAG) |
| 1897 | 1904 | MDRV_CPU_PROGRAM_MAP(megaste_map, 0) |
| 1898 | 1905 | MDRV_RP5C15_ADD("rp5c15",rtc_intf) |
| 1899 | 1906 | |
| r4234 | r4235 | |
| 1904 | 1911 | MDRV_DRIVER_DATA(atarist_state) |
| 1905 | 1912 | |
| 1906 | 1913 | // basic machine hardware |
| 1907 | | MDRV_CPU_ADD("main", M68000, U517/2) |
| 1914 | MDRV_CPU_ADD(M68000_TAG, M68000, U517/2) |
| 1908 | 1915 | MDRV_CPU_PROGRAM_MAP(stbook_map, 0) |
| 1909 | 1916 | MDRV_RP5C15_ADD("rp5c15",rtc_intf) |
| 1910 | 1917 | |
| r4234 | r4235 | |
| 1913 | 1920 | MDRV_MACHINE_START(stbook) |
| 1914 | 1921 | |
| 1915 | 1922 | // device hardware |
| 1916 | | MDRV_MC68901_ADD(MC68901_TAG, stbook_mfp_intf) |
| 1923 | MDRV_MC68901_ADD(MC68901_TAG, U517/8, stbook_mfp_intf) |
| 1917 | 1924 | MDRV_SCC8530_ADD("scc") |
| 1918 | 1925 | |
| 1919 | 1926 | // video hardware |
| 1920 | | MDRV_SCREEN_ADD("main", LCD) |
| 1927 | MDRV_SCREEN_ADD(SCREEN_TAG, LCD) |
| 1921 | 1928 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 1922 | 1929 | MDRV_SCREEN_REFRESH_RATE(60) |
| 1923 | 1930 | MDRV_SCREEN_SIZE(640, 400) |
| r4234 | r4235 | |
| 1949 | 1956 | /* ROMs */ |
| 1950 | 1957 | |
| 1951 | 1958 | ROM_START( atarist ) |
| 1952 | | ROM_REGION16_BE( 0x1000000, "main", 0 ) |
| 1959 | ROM_REGION16_BE( 0x1000000, M68000_TAG, 0 ) |
| 1953 | 1960 | ROM_SYSTEM_BIOS( 0, "default", "TOS 1.04 (Rainbow TOS)" ) |
| 1954 | 1961 | ROMX_LOAD( "tos104.img", 0xfc0000, 0x030000, BAD_DUMP CRC(a50d1d43) SHA1(9526ef63b9cb1d2a7109e278547ae78a5c1db6c6), ROM_BIOS(1) ) |
| 1955 | 1962 | ROM_SYSTEM_BIOS( 1, "tos102", "TOS 1.02 (MEGA TOS)" ) |
| r4234 | r4235 | |
| 1966 | 1973 | ROMX_LOAD( "st_7c1_a2.u2", 0xfe0000, 0x008000, CRC(d0513329) SHA1(49855a3585e2f75b2af932dd4414ed64e6d9501f), ROM_SKIP(1) | ROM_BIOS(5) ) |
| 1967 | 1974 | ROMX_LOAD( "st_7c1_b1.u5", 0xfe0001, 0x008000, CRC(c115cbc8) SHA1(2b52b81a1a4e0818d63f98ee4b25c30e2eba61cb), ROM_SKIP(1) | ROM_BIOS(5) ) |
| 1968 | 1975 | |
| 1969 | | ROM_COPY( "main", 0xfc0000, 0x000000, 0x000008 ) |
| 1976 | ROM_COPY( M68000_TAG, 0xfc0000, 0x000000, 0x000008 ) |
| 1970 | 1977 | |
| 1971 | 1978 | ROM_REGION( 0x10000, "keyboard", 0 ) |
| 1972 | 1979 | ROM_LOAD( "keyboard.u1", 0xf000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) |
| 1973 | 1980 | ROM_END |
| 1974 | 1981 | |
| 1975 | 1982 | ROM_START( megast ) |
| 1976 | | ROM_REGION16_BE( 0x1000000, "main", 0 ) |
| 1983 | ROM_REGION16_BE( 0x1000000, M68000_TAG, 0 ) |
| 1977 | 1984 | ROM_SYSTEM_BIOS( 0, "default", "TOS 1.04 (Rainbow TOS)" ) |
| 1978 | 1985 | ROMX_LOAD( "tos104.img", 0xfc0000, 0x030000, BAD_DUMP CRC(a50d1d43) SHA1(9526ef63b9cb1d2a7109e278547ae78a5c1db6c6), ROM_BIOS(1) ) |
| 1979 | 1986 | ROM_SYSTEM_BIOS( 1, "tos102", "TOS 1.02 (MEGA TOS)" ) |
| 1980 | 1987 | ROMX_LOAD( "tos102.img", 0xfc0000, 0x030000, BAD_DUMP CRC(3b5cd0c5) SHA1(87900a40a890fdf03bd08be6c60cc645855cbce5), ROM_BIOS(2) ) |
| 1981 | | ROM_COPY( "main", 0xfc0000, 0x000000, 0x000008 ) |
| 1988 | ROM_COPY( M68000_TAG, 0xfc0000, 0x000000, 0x000008 ) |
| 1982 | 1989 | |
| 1983 | 1990 | ROM_REGION( 0x10000, "keyboard", 0 ) |
| 1984 | 1991 | ROM_LOAD( "keyboard.u1", 0xf000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) |
| 1985 | 1992 | ROM_END |
| 1986 | 1993 | |
| 1987 | 1994 | ROM_START( stacy ) |
| 1988 | | ROM_REGION16_BE( 0x1000000, "main", 0 ) |
| 1995 | ROM_REGION16_BE( 0x1000000, M68000_TAG, 0 ) |
| 1989 | 1996 | ROM_SYSTEM_BIOS( 0, "tos104", "TOS 1.04 (Rainbow TOS)" ) |
| 1990 | 1997 | ROMX_LOAD( "tos104.img", 0xfc0000, 0x030000, BAD_DUMP CRC(a50d1d43) SHA1(9526ef63b9cb1d2a7109e278547ae78a5c1db6c6), ROM_BIOS(1) ) |
| 1991 | | ROM_COPY( "main", 0xfc0000, 0x000000, 0x000008 ) |
| 1998 | ROM_COPY( M68000_TAG, 0xfc0000, 0x000000, 0x000008 ) |
| 1992 | 1999 | |
| 1993 | 2000 | ROM_REGION( 0x10000, "keyboard", 0 ) |
| 1994 | 2001 | ROM_LOAD( "keyboard.u1", 0xf000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) |
| 1995 | 2002 | ROM_END |
| 1996 | 2003 | |
| 1997 | 2004 | ROM_START( atariste ) |
| 1998 | | ROM_REGION16_BE( 0x1000000, "main", 0 ) |
| 2005 | ROM_REGION16_BE( 0x1000000, M68000_TAG, 0 ) |
| 1999 | 2006 | ROM_SYSTEM_BIOS( 0, "default", "TOS 1.62 (STE TOS, Revision 2)" ) |
| 2000 | 2007 | ROMX_LOAD( "tos162.img", 0xe00000, 0x040000, BAD_DUMP CRC(d1c6f2fa) SHA1(70db24a7c252392755849f78940a41bfaebace71), ROM_BIOS(1) ) |
| 2001 | 2008 | ROM_SYSTEM_BIOS( 1, "tos106", "TOS 1.06 (STE TOS, Revision 1)" ) |
| 2002 | 2009 | ROMX_LOAD( "tos106.img", 0xe00000, 0x040000, BAD_DUMP CRC(d72fea29) SHA1(06f9ea322e74b682df0396acfaee8cb4d9c90cad), ROM_BIOS(2) ) |
| 2003 | | ROM_COPY( "main", 0xe00000, 0x000000, 0x000008 ) |
| 2010 | ROM_COPY( M68000_TAG, 0xe00000, 0x000000, 0x000008 ) |
| 2004 | 2011 | |
| 2005 | 2012 | ROM_REGION( 0x10000, "keyboard", 0 ) |
| 2006 | 2013 | ROM_LOAD( "keyboard.u1", 0xf000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) |
| 2007 | 2014 | ROM_END |
| 2008 | 2015 | |
| 2009 | 2016 | ROM_START( megaste ) |
| 2010 | | ROM_REGION16_BE( 0x1000000, "main", 0 ) |
| 2017 | ROM_REGION16_BE( 0x1000000, M68000_TAG, 0 ) |
| 2011 | 2018 | ROM_SYSTEM_BIOS( 0, "default", "TOS 2.06 (ST/STE TOS)" ) |
| 2012 | 2019 | ROMX_LOAD( "tos206.img", 0xe00000, 0x040000, BAD_DUMP CRC(08538e39) SHA1(2400ea95f547d6ea754a99d05d8530c03f8b28e3), ROM_BIOS(1) ) |
| 2013 | 2020 | ROM_SYSTEM_BIOS( 1, "tos205", "TOS 2.05 (Mega STE TOS)" ) |
| 2014 | 2021 | ROMX_LOAD( "tos205.img", 0xe00000, 0x030000, NO_DUMP, ROM_BIOS(2) ) |
| 2015 | 2022 | ROM_SYSTEM_BIOS( 2, "tos202", "TOS 2.02 (Mega STE TOS)" ) |
| 2016 | 2023 | ROMX_LOAD( "tos202.img", 0xe00000, 0x030000, NO_DUMP, ROM_BIOS(3) ) |
| 2017 | | ROM_COPY( "main", 0xe00000, 0x000000, 0x000008 ) |
| 2024 | ROM_COPY( M68000_TAG, 0xe00000, 0x000000, 0x000008 ) |
| 2018 | 2025 | |
| 2019 | 2026 | ROM_REGION( 0x10000, "keyboard", 0 ) |
| 2020 | 2027 | ROM_LOAD( "keyboard.u1", 0xf000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) |
| 2021 | 2028 | ROM_END |
| 2022 | 2029 | |
| 2023 | 2030 | ROM_START( stbook ) |
| 2024 | | ROM_REGION16_BE( 0x1000000, "main", 0 ) |
| 2031 | ROM_REGION16_BE( 0x1000000, M68000_TAG, 0 ) |
| 2025 | 2032 | ROM_SYSTEM_BIOS( 0, "tos208", "TOS 2.08" ) |
| 2026 | 2033 | ROMX_LOAD( "tos208.img", 0xe00000, 0x040000, NO_DUMP, ROM_BIOS(1) ) |
| 2027 | | ROM_COPY( "main", 0xe00000, 0x000000, 0x000008 ) |
| 2034 | ROM_COPY( M68000_TAG, 0xe00000, 0x000000, 0x000008 ) |
| 2028 | 2035 | |
| 2029 | 2036 | ROM_REGION( 0x10000, "cpu1", 0 ) |
| 2030 | 2037 | ROM_LOAD( "cop888c0.u703", 0x0000, 0x1000, NO_DUMP ) |
| 2031 | 2038 | ROM_END |
| 2032 | 2039 | |
| 2033 | 2040 | ROM_START( stpad ) |
| 2034 | | ROM_REGION16_BE( 0x1000000, "main", 0 ) |
| 2041 | ROM_REGION16_BE( 0x1000000, M68000_TAG, 0 ) |
| 2035 | 2042 | ROM_SYSTEM_BIOS( 0, "tos205", "TOS 2.05" ) |
| 2036 | 2043 | ROMX_LOAD( "tos205.img", 0xe00000, 0x040000, NO_DUMP, ROM_BIOS(1) ) |
| 2037 | | ROM_COPY( "main", 0xe00000, 0x000000, 0x000008 ) |
| 2044 | ROM_COPY( M68000_TAG, 0xe00000, 0x000000, 0x000008 ) |
| 2038 | 2045 | ROM_END |
| 2039 | 2046 | |
| 2040 | 2047 | ROM_START( tt030 ) |
| 2041 | | ROM_REGION32_BE( 0x4000000, "main", 0 ) |
| 2048 | ROM_REGION32_BE( 0x4000000, M68000_TAG, 0 ) |
| 2042 | 2049 | ROM_SYSTEM_BIOS( 0, "default", "TOS 3.06 (TT TOS)" ) |
| 2043 | 2050 | ROMX_LOAD( "tos306.img", 0xe00000, 0x080000, BAD_DUMP CRC(75dda215) SHA1(6325bdfd83f1b4d3afddb2b470a19428ca79478b), ROM_BIOS(1) ) |
| 2044 | 2051 | ROM_SYSTEM_BIOS( 1, "tos305", "TOS 3.05 (TT TOS)" ) |
| 2045 | 2052 | ROMX_LOAD( "tos305.img", 0xe00000, 0x080000, NO_DUMP, ROM_BIOS(2) ) |
| 2046 | 2053 | ROM_SYSTEM_BIOS( 2, "tos301", "TOS 3.01 (TT TOS)" ) |
| 2047 | 2054 | ROMX_LOAD( "tos301.img", 0xe00000, 0x080000, NO_DUMP, ROM_BIOS(3) ) |
| 2048 | | ROM_COPY( "main", 0xe00000, 0x000000, 0x000008 ) |
| 2055 | ROM_COPY( M68000_TAG, 0xe00000, 0x000000, 0x000008 ) |
| 2049 | 2056 | |
| 2050 | 2057 | ROM_REGION( 0x10000, "keyboard", 0 ) |
| 2051 | 2058 | ROM_LOAD( "keyboard.u1", 0xf000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) |
| 2052 | 2059 | ROM_END |
| 2053 | 2060 | |
| 2054 | 2061 | ROM_START( fx1 ) |
| 2055 | | ROM_REGION16_BE( 0x1000000, "main", 0 ) |
| 2062 | ROM_REGION16_BE( 0x1000000, M68000_TAG, 0 ) |
| 2056 | 2063 | ROM_SYSTEM_BIOS( 0, "tos207", "TOS 2.07" ) |
| 2057 | 2064 | ROMX_LOAD( "tos207.img", 0xe00000, 0x040000, NO_DUMP, ROM_BIOS(1) ) |
| 2058 | | ROM_COPY( "main", 0xe00000, 0x000000, 0x000008 ) |
| 2065 | ROM_COPY( M68000_TAG, 0xe00000, 0x000000, 0x000008 ) |
| 2059 | 2066 | |
| 2060 | 2067 | ROM_REGION( 0x10000, "keyboard", 0 ) |
| 2061 | 2068 | ROM_LOAD( "keyboard.u1", 0xf000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) |
| 2062 | 2069 | ROM_END |
| 2063 | 2070 | |
| 2064 | 2071 | ROM_START( falcon ) |
| 2065 | | ROM_REGION32_BE( 0x4000000, "main", 0 ) |
| 2072 | ROM_REGION32_BE( 0x4000000, M68000_TAG, 0 ) |
| 2066 | 2073 | ROM_SYSTEM_BIOS( 0, "default", "TOS 4.04" ) |
| 2067 | 2074 | ROMX_LOAD( "tos404.img", 0xe00000, 0x080000, BAD_DUMP CRC(028b561d) SHA1(27dcdb31b0951af99023b2fb8c370d8447ba6ebc), ROM_BIOS(1) ) |
| 2068 | 2075 | ROM_SYSTEM_BIOS( 1, "tos402", "TOS 4.02" ) |
| r4234 | r4235 | |
| 2071 | 2078 | ROMX_LOAD( "tos401.img", 0xe00000, 0x080000, NO_DUMP, ROM_BIOS(3) ) |
| 2072 | 2079 | ROM_SYSTEM_BIOS( 3, "tos400", "TOS 4.00" ) |
| 2073 | 2080 | ROMX_LOAD( "tos400.img", 0xe00000, 0x080000, BAD_DUMP CRC(1fbc5396) SHA1(d74d09f11a0bf37a86ccb50c6e7f91aac4d4b11b), ROM_BIOS(4) ) |
| 2074 | | ROM_COPY( "main", 0xe00000, 0x000000, 0x000008 ) |
| 2081 | ROM_COPY( M68000_TAG, 0xe00000, 0x000000, 0x000008 ) |
| 2075 | 2082 | |
| 2076 | 2083 | ROM_REGION( 0x10000, "keyboard", 0 ) |
| 2077 | 2084 | ROM_LOAD( "keyboard.u1", 0xf000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) |
| 2078 | 2085 | ROM_END |
| 2079 | 2086 | |
| 2080 | 2087 | ROM_START( falcon40 ) |
| 2081 | | ROM_REGION32_BE( 0x4000000, "main", 0 ) |
| 2088 | ROM_REGION32_BE( 0x4000000, M68000_TAG, 0 ) |
| 2082 | 2089 | ROM_SYSTEM_BIOS( 0, "tos492", "TOS 4.92" ) |
| 2083 | 2090 | ROMX_LOAD( "tos492.img", 0xe00000, 0x080000, BAD_DUMP CRC(bc8e497f) SHA1(747a38042844a6b632dcd9a76d8525fccb5eb892), ROM_BIOS(2) ) |
| 2084 | 2091 | ROM_END |