src/mess/drivers/x1.c
| r10369 | r10370 | |
| 1013 | 1013 | static UINT16 check_pcg_addr(running_machine *machine) |
| 1014 | 1014 | { |
| 1015 | 1015 | x1_state *state = machine->driver_data<x1_state>(); |
| 1016 | |
| 1017 | |
| 1016 | 1018 | if(state->colorram[0x7ff] & 0x20) return 0x7ff; |
| 1017 | 1019 | if(state->colorram[0x3ff] & 0x20) return 0x3ff; |
| 1018 | 1020 | if(state->colorram[0x5ff] & 0x20) return 0x5ff; |
| r10369 | r10370 | |
| 1482 | 1484 | static READ8_HANDLER( x1_io_r ) |
| 1483 | 1485 | { |
| 1484 | 1486 | x1_state *state = space->machine->driver_data<x1_state>(); |
| 1485 | | UINT8 *videoram = state->videoram; |
| 1486 | 1487 | state->io_bank_mode = 0; //any read disables the extended mode. |
| 1487 | 1488 | |
| 1488 | 1489 | if(offset == 0x0e03) { return x1_rom_r(space, 0); } |
| r10369 | r10370 | |
| 1501 | 1502 | else if(offset >= 0x1fa8 && offset <= 0x1fab) { return z80ctc_r(space->machine->device("ctc"), offset-0x1fa8); } |
| 1502 | 1503 | // else if(offset >= 0x1fd0 && offset <= 0x1fdf) { return x1_scrn_r(space,offset-0x1fd0); } |
| 1503 | 1504 | // else if(offset == 0x1fe0) { return x1_blackclip_r(space,0); } |
| 1504 | | else if(offset >= 0x2000 && offset <= 0x2fff) { return state->colorram[offset-0x2000]; } |
| 1505 | | else if(offset >= 0x3000 && offset <= 0x37ff) { return videoram[offset-0x3000]; } |
| 1506 | | else if(offset >= 0x3800 && offset <= 0x3fff) { return videoram[offset-0x3800]; } // Ys checks x1/x1turbo by checking if this area is a mirror |
| 1505 | else if(offset >= 0x2000 && offset <= 0x2fff) { return state->colorram[offset & 0x7ff]; } |
| 1506 | else if(offset >= 0x3000 && offset <= 0x3fff) { return state->videoram[offset & 0x7ff]; } // Ys checks x1/x1turbo by checking if this area is a mirror |
| 1507 | 1507 | else if(offset >= 0x4000 && offset <= 0xffff) { return state->gfx_bitmap_ram[offset-0x4000+(state->scrn_reg.gfx_bank*0xc000)]; } |
| 1508 | 1508 | else |
| 1509 | 1509 | { |
| r10369 | r10370 | |
| 1515 | 1515 | static WRITE8_HANDLER( x1_io_w ) |
| 1516 | 1516 | { |
| 1517 | 1517 | x1_state *state = space->machine->driver_data<x1_state>(); |
| 1518 | | UINT8 *videoram = state->videoram; |
| 1518 | |
| 1519 | 1519 | if(state->io_bank_mode == 1) { x1_ex_gfxram_w(space, offset, data); } |
| 1520 | 1520 | // TODO: user could install ym2151 on plain X1 too |
| 1521 | 1521 | //0x700, 0x701 |
| r10369 | r10370 | |
| 1547 | 1547 | // else if(offset == 0x1fc5) { x1turbo_gfxpal_w(space,0,data); } |
| 1548 | 1548 | // else if(offset >= 0x1fd0 && offset <= 0x1fdf) { x1_scrn_w(space,0,data); } |
| 1549 | 1549 | // else if(offset == 0x1fe0) { x1_blackclip_w(space,0,data); } |
| 1550 | | else if(offset >= 0x2000 && offset <= 0x2fff) { state->colorram[offset-0x2000] = data; } |
| 1551 | | else if(offset >= 0x3000 && offset <= 0x37ff) { videoram[offset-0x3000] = state->pcg_write_addr = data; } |
| 1552 | | else if(offset >= 0x3800 && offset <= 0x3fff) { videoram[offset-0x3800] = state->pcg_write_addr = data; } |
| 1550 | else if(offset >= 0x2000 && offset <= 0x2fff) { state->colorram[offset & 0x7ff] = data; } |
| 1551 | else if(offset >= 0x3000 && offset <= 0x3fff) { state->videoram[offset & 0x7ff] = state->pcg_write_addr = data; } |
| 1553 | 1552 | else if(offset >= 0x4000 && offset <= 0xffff) { state->gfx_bitmap_ram[offset-0x4000+(state->scrn_reg.gfx_bank*0xc000)] = data; } |
| 1554 | 1553 | else |
| 1555 | 1554 | { |
| r10369 | r10370 | |
| 1561 | 1560 | static READ8_HANDLER( x1turbo_io_r ) |
| 1562 | 1561 | { |
| 1563 | 1562 | x1_state *state = space->machine->driver_data<x1_state>(); |
| 1564 | | UINT8 *videoram = state->videoram; |
| 1565 | 1563 | state->io_bank_mode = 0; //any read disables the extended mode. |
| 1566 | 1564 | |
| 1567 | 1565 | // a * at the end states devices used on plain X1 too |
| r10369 | r10370 | |
| 1597 | 1595 | // else if(offset >= 0x1fd0 && offset <= 0x1fdf) { return x1_scrn_r(space,offset-0x1fd0); } //Z only |
| 1598 | 1596 | else if(offset == 0x1fe0) { return x1_blackclip_r(space,0); } |
| 1599 | 1597 | else if(offset == 0x1ff0) { return input_port_read(space->machine, "X1TURBO_DSW"); } |
| 1600 | | else if(offset >= 0x2000 && offset <= 0x2fff) { return state->colorram[offset-0x2000]; } |
| 1601 | | else if(offset >= 0x3000 && offset <= 0x3fff) { return videoram[offset-0x3000]; } |
| 1598 | else if(offset >= 0x2000 && offset <= 0x2fff) { return state->colorram[offset & 0x7ff]; } |
| 1599 | else if(offset >= 0x3000 && offset <= 0x3fff) { return state->videoram[offset & 0xfff]; } |
| 1602 | 1600 | else if(offset >= 0x4000 && offset <= 0xffff) { return state->gfx_bitmap_ram[offset-0x4000+(state->scrn_reg.gfx_bank*0xc000)]; } |
| 1603 | 1601 | else |
| 1604 | 1602 | { |
| r10369 | r10370 | |
| 1610 | 1608 | static WRITE8_HANDLER( x1turbo_io_w ) |
| 1611 | 1609 | { |
| 1612 | 1610 | x1_state *state = space->machine->driver_data<x1_state>(); |
| 1613 | | UINT8 *videoram = state->videoram; |
| 1614 | 1611 | |
| 1615 | 1612 | // a * at the end states devices used on plain X1 too |
| 1616 | 1613 | if(state->io_bank_mode == 1) { x1_ex_gfxram_w(space, offset, data); } |
| r10369 | r10370 | |
| 1656 | 1653 | else if(offset == 0x1fc5) { x1turbo_gfxpal_w(space,0,data); } // Z only! |
| 1657 | 1654 | else if(offset >= 0x1fd0 && offset <= 0x1fdf) { x1_scrn_w(space,0,data); } |
| 1658 | 1655 | else if(offset == 0x1fe0) { x1_blackclip_w(space,0,data); } |
| 1659 | | else if(offset >= 0x2000 && offset <= 0x2fff) { state->colorram[offset-0x2000] = data; } |
| 1660 | | else if(offset >= 0x3000 && offset <= 0x3fff) { videoram[offset-0x3000] = state->pcg_write_addr = data; } |
| 1656 | else if(offset >= 0x2000 && offset <= 0x2fff) { state->colorram[offset & 0x7ff] = data; } |
| 1657 | else if(offset >= 0x3000 && offset <= 0x3fff) { state->videoram[offset & 0xfff] = state->pcg_write_addr = data; } |
| 1661 | 1658 | else if(offset >= 0x4000 && offset <= 0xffff) { state->gfx_bitmap_ram[offset-0x4000+(state->scrn_reg.gfx_bank*0xc000)] = data; } |
| 1662 | 1659 | else |
| 1663 | 1660 | { |