trunk/src/mame/machine/n64.c
| r17797 | r17798 | |
| 565 | 565 | if (status & 0x1) |
| 566 | 566 | { |
| 567 | 567 | device_set_input_line(rspcpu, INPUT_LINE_HALT, ASSERT_LINE); |
| 568 | | cpu_set_reg(rspcpu, RSP_SR, cpu_get_reg(rspcpu, RSP_SR) | RSP_STATUS_HALT); |
| 568 | rspcpu->state().set_state_int(RSP_SR, rspcpu->state().state_int(RSP_SR) | RSP_STATUS_HALT); |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | if (status & 0x2) |
| 572 | 572 | { |
| 573 | | cpu_set_reg(rspcpu, RSP_SR, cpu_get_reg(rspcpu, RSP_SR) | RSP_STATUS_BROKE); |
| 573 | rspcpu->state().set_state_int(RSP_SR, rspcpu->state().state_int(RSP_SR) | RSP_STATUS_BROKE); |
| 574 | 574 | |
| 575 | | if (cpu_get_reg(rspcpu, RSP_SR) & RSP_STATUS_INTR_BREAK) |
| 575 | if (rspcpu->state().state_int(RSP_SR) & RSP_STATUS_INTR_BREAK) |
| 576 | 576 | { |
| 577 | 577 | signal_rcp_interrupt(SP_INTERRUPT); |
| 578 | 578 | } |
| r17797 | r17798 | |
| 599 | 599 | case 0x10/4: // SP_STATUS_REG |
| 600 | 600 | //machine().scheduler().synchronize(); |
| 601 | 601 | //machine().scheduler().boost_interleave(attotime::from_msec(1), attotime::from_msec(m)); |
| 602 | | ret = cpu_get_reg(rspcpu, RSP_SR); |
| 602 | ret = rspcpu->state().state_int(RSP_SR); |
| 603 | 603 | break; |
| 604 | 604 | |
| 605 | 605 | case 0x14/4: // SP_DMA_FULL_REG |
| r17797 | r17798 | |
| 669 | 669 | } |
| 670 | 670 | |
| 671 | 671 | case 0x40000/4: // PC |
| 672 | | ret = cpu_get_reg(rspcpu, RSP_PC) & 0x00000fff; |
| 672 | ret = rspcpu->state().state_int(RSP_PC) & 0x00000fff; |
| 673 | 673 | break; |
| 674 | 674 | |
| 675 | 675 | default: |
| r17797 | r17798 | |
| 677 | 677 | break; |
| 678 | 678 | } |
| 679 | 679 | |
| 680 | | //printf("%08x sp_reg_r %08x = %08x\n", (UINT32)cpu_get_reg(maincpu, MIPS3_PC), offset * 4, ret); fflush(stdout); |
| 680 | //printf("%08x sp_reg_r %08x = %08x\n", (UINT32)maincpu->state().state_int(MIPS3_PC), offset * 4, ret); fflush(stdout); |
| 681 | 681 | return ret; |
| 682 | 682 | } |
| 683 | 683 | |
| r17797 | r17798 | |
| 688 | 688 | |
| 689 | 689 | void n64_periphs::sp_reg_w(UINT32 offset, UINT32 data, UINT32 mem_mask) |
| 690 | 690 | { |
| 691 | | //printf("%08x sp_reg_w %08x %08x %08x\n", (UINT32)cpu_get_reg(maincpu, MIPS3_PC), offset * 4, data, mem_mask); fflush(stdout); |
| 691 | //printf("%08x sp_reg_w %08x %08x %08x\n", (UINT32)maincpu->state().state_int(MIPS3_PC), offset * 4, data, mem_mask); fflush(stdout); |
| 692 | 692 | |
| 693 | 693 | if ((offset & 0x10000) == 0) |
| 694 | 694 | { |
| r17797 | r17798 | |
| 718 | 718 | |
| 719 | 719 | case 0x10/4: // RSP_STATUS_REG |
| 720 | 720 | { |
| 721 | | UINT32 oldstatus = cpu_get_reg(rspcpu, RSP_SR); |
| 721 | UINT32 oldstatus = rspcpu->state().state_int(RSP_SR); |
| 722 | 722 | UINT32 newstatus = oldstatus; |
| 723 | 723 | |
| 724 | 724 | // printf( "RSP_STATUS_REG Write; %08x\n", data ); |
| r17797 | r17798 | |
| 760 | 760 | //printf("***SP SSTEP SET***\n"); fflush(stdout); |
| 761 | 761 | if(!(oldstatus & (RSP_STATUS_BROKE | RSP_STATUS_HALT))) |
| 762 | 762 | { |
| 763 | | cpu_set_reg(rspcpu, RSP_STEPCNT, 1 ); |
| 763 | rspcpu->state().set_state_int(RSP_STEPCNT, 1 ); |
| 764 | 764 | device_yield(machine().device("rsp")); |
| 765 | 765 | } |
| 766 | 766 | } |
| r17797 | r17798 | |
| 854 | 854 | newstatus |= RSP_STATUS_SIGNAL7; // set signal 7 |
| 855 | 855 | //printf("***SP SIG7 SET***\n"); fflush(stdout); |
| 856 | 856 | } |
| 857 | | cpu_set_reg(rspcpu, RSP_SR, newstatus); |
| 857 | rspcpu->state().set_state_int(RSP_SR, newstatus); |
| 858 | 858 | break; |
| 859 | 859 | } |
| 860 | 860 | |
| r17797 | r17798 | |
| 877 | 877 | switch (offset & 0xffff) |
| 878 | 878 | { |
| 879 | 879 | case 0x00/4: // SP_PC_REG |
| 880 | | if( cpu_get_reg(rspcpu, RSP_NEXTPC) != 0xffffffff ) |
| 880 | if( rspcpu->state().state_int(RSP_NEXTPC) != 0xffffffff ) |
| 881 | 881 | { |
| 882 | | cpu_set_reg(rspcpu, RSP_NEXTPC, 0x1000 | (data & 0xfff)); |
| 882 | rspcpu->state().set_state_int(RSP_NEXTPC, 0x1000 | (data & 0xfff)); |
| 883 | 883 | } |
| 884 | 884 | else |
| 885 | 885 | { |
| 886 | | cpu_set_reg(rspcpu, RSP_PC, 0x1000 | (data & 0xfff)); |
| 886 | rspcpu->state().set_state_int(RSP_PC, 0x1000 | (data & 0xfff)); |
| 887 | 887 | } |
| 888 | 888 | break; |
| 889 | 889 | |
| r17797 | r17798 | |
| 944 | 944 | break; |
| 945 | 945 | } |
| 946 | 946 | |
| 947 | | //printf("%08x dp_reg_r %08x = %08x\n", (UINT32)cpu_get_reg(device->machine().device("rsp"), RSP_PC), offset, ret); fflush(stdout); |
| 947 | //printf("%08x dp_reg_r %08x = %08x\n", (UINT32)device->machine().device("rsp")->state().state_int(RSP_PC), offset, ret); fflush(stdout); |
| 948 | 948 | return ret; |
| 949 | 949 | } |
| 950 | 950 | |
| r17797 | r17798 | |
| 953 | 953 | n64_state *state = device->machine().driver_data<n64_state>(); |
| 954 | 954 | n64_periphs *periphs = device->machine().device<n64_periphs>("rcp"); |
| 955 | 955 | |
| 956 | | //printf("%08x dp_reg_w %08x %08x %08x\n", (UINT32)cpu_get_reg(device->machine().device("rsp"), RSP_PC), offset, data, mem_mask); fflush(stdout); |
| 956 | //printf("%08x dp_reg_w %08x %08x %08x\n", (UINT32)device->machine().device("rsp")->state().state_int(RSP_PC), offset, data, mem_mask); fflush(stdout); |
| 957 | 957 | switch (offset) |
| 958 | 958 | { |
| 959 | 959 | case 0x00/4: // DP_START_REG |
trunk/src/mame/drivers/namcos23.c
| r17797 | r17798 | |
| 1518 | 1518 | case 0: return 0x8e | (machine().primary_screen->vblank() ? 0x0000 : 0x8000); |
| 1519 | 1519 | case 1: return c417.adr; |
| 1520 | 1520 | case 4: |
| 1521 | | // logerror("c417_r %04x = %04x (%08x, %08x)\n", c417.adr, c417.ram[c417.adr], space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); |
| 1521 | // logerror("c417_r %04x = %04x (%08x, %08x)\n", c417.adr, c417.ram[c417.adr], space.device().safe_pc(), (unsigned int)space.device().state().state_int(MIPS3_R31)); |
| 1522 | 1522 | return c417.ram[c417.adr]; |
| 1523 | 1523 | case 5: |
| 1524 | 1524 | if(c417.pointrom_adr >= m_ptrom_limit) |
| r17797 | r17798 | |
| 1531 | 1531 | |
| 1532 | 1532 | } |
| 1533 | 1533 | |
| 1534 | | logerror("c417_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); |
| 1534 | logerror("c417_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)space.device().state().state_int(MIPS3_R31)); |
| 1535 | 1535 | return 0; |
| 1536 | 1536 | } |
| 1537 | 1537 | |
| r17797 | r17798 | |
| 1553 | 1553 | c417.pointrom_adr = 0; |
| 1554 | 1554 | break; |
| 1555 | 1555 | case 4: |
| 1556 | | // logerror("c417_w %04x = %04x (%08x, %08x)\n", c417.adr, data, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); |
| 1556 | // logerror("c417_w %04x = %04x (%08x, %08x)\n", c417.adr, data, space.device().safe_pc(), (unsigned int)space.device().state().state_int(MIPS3_R31)); |
| 1557 | 1557 | COMBINE_DATA(c417.ram + c417.adr); |
| 1558 | 1558 | break; |
| 1559 | 1559 | case 7: |
| r17797 | r17798 | |
| 1561 | 1561 | cputag_set_input_line(machine(), "maincpu", MIPS3_IRQ2, CLEAR_LINE); |
| 1562 | 1562 | break; |
| 1563 | 1563 | default: |
| 1564 | | logerror("c417_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); |
| 1564 | logerror("c417_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, space.device().safe_pc(), (unsigned int)space.device().state().state_int(MIPS3_R31)); |
| 1565 | 1565 | break; |
| 1566 | 1566 | } |
| 1567 | 1567 | } |
| r17797 | r17798 | |
| 1570 | 1570 | { |
| 1571 | 1571 | c412_t &c412 = m_c412; |
| 1572 | 1572 | |
| 1573 | | // logerror("c412_ram_r %06x (%08x, %08x)\n", offset, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); |
| 1573 | // logerror("c412_ram_r %06x (%08x, %08x)\n", offset, space.device().safe_pc(), (unsigned int)space.device().state().state_int(MIPS3_R31)); |
| 1574 | 1574 | if(offset < 0x100000) |
| 1575 | 1575 | return c412.sdram_a[offset & 0xfffff]; |
| 1576 | 1576 | else if(offset < 0x200000) |
| r17797 | r17798 | |
| 1587 | 1587 | { |
| 1588 | 1588 | c412_t &c412 = m_c412; |
| 1589 | 1589 | |
| 1590 | | // logerror("c412_ram_w %06x = %04x (%08x, %08x)\n", offset, data, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); |
| 1590 | // logerror("c412_ram_w %06x = %04x (%08x, %08x)\n", offset, data, space.device().safe_pc(), (unsigned int)space.device().state().state_int(MIPS3_R31)); |
| 1591 | 1591 | if(offset < 0x100000) |
| 1592 | 1592 | COMBINE_DATA(c412.sdram_a + (offset & 0xfffff)); |
| 1593 | 1593 | else if(offset < 0x200000) |
| r17797 | r17798 | |
| 1611 | 1611 | case 10: return s23_c412_ram_r(space, c412.adr, mem_mask); |
| 1612 | 1612 | } |
| 1613 | 1613 | |
| 1614 | | logerror("c412_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); |
| 1614 | logerror("c412_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)space.device().state().state_int(MIPS3_R31)); |
| 1615 | 1615 | return 0; |
| 1616 | 1616 | } |
| 1617 | 1617 | |
| r17797 | r17798 | |
| 1624 | 1624 | case 9: c412.adr = ((data & mem_mask) << 16) | (c412.adr & (0xffffffff ^ (mem_mask << 16))); break; |
| 1625 | 1625 | case 10: s23_c412_ram_w(space, c412.adr, data, mem_mask); c412.adr += 2; break; |
| 1626 | 1626 | default: |
| 1627 | | logerror("c412_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); |
| 1627 | logerror("c412_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, space.device().safe_pc(), (unsigned int)space.device().state().state_int(MIPS3_R31)); |
| 1628 | 1628 | break; |
| 1629 | 1629 | } |
| 1630 | 1630 | } |
| r17797 | r17798 | |
| 1633 | 1633 | { |
| 1634 | 1634 | c421_t &c421 = m_c421; |
| 1635 | 1635 | |
| 1636 | | // logerror("c421_ram_r %06x (%08x, %08x)\n", offset, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); |
| 1636 | // logerror("c421_ram_r %06x (%08x, %08x)\n", offset, space.device().safe_pc(), (unsigned int)space.device().state().state_int(MIPS3_R31)); |
| 1637 | 1637 | if(offset < 0x40000) |
| 1638 | 1638 | return c421.dram_a[offset & 0x3ffff]; |
| 1639 | 1639 | else if(offset < 0x80000) |
| r17797 | r17798 | |
| 1648 | 1648 | { |
| 1649 | 1649 | c421_t &c421 = m_c421; |
| 1650 | 1650 | |
| 1651 | | // logerror("c421_ram_w %06x = %04x (%08x, %08x)\n", offset, data, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); |
| 1651 | // logerror("c421_ram_w %06x = %04x (%08x, %08x)\n", offset, data, space.device().safe_pc(), (unsigned int)space.device().state().state_int(MIPS3_R31)); |
| 1652 | 1652 | if(offset < 0x40000) |
| 1653 | 1653 | COMBINE_DATA(c421.dram_a + (offset & 0x3ffff)); |
| 1654 | 1654 | else if(offset < 0x80000) |
| r17797 | r17798 | |
| 1667 | 1667 | case 3: return c421.adr; |
| 1668 | 1668 | } |
| 1669 | 1669 | |
| 1670 | | logerror("c421_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); |
| 1670 | logerror("c421_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)space.device().state().state_int(MIPS3_R31)); |
| 1671 | 1671 | return 0; |
| 1672 | 1672 | } |
| 1673 | 1673 | |
| r17797 | r17798 | |
| 1680 | 1680 | case 2: c421.adr = ((data & mem_mask) << 16) | (c421.adr & (0xffffffff ^ (mem_mask << 16))); break; |
| 1681 | 1681 | case 3: c421.adr = (data & mem_mask) | (c421.adr & (0xffffffff ^ mem_mask)); break; |
| 1682 | 1682 | default: |
| 1683 | | logerror("c421_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); |
| 1683 | logerror("c421_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, space.device().safe_pc(), (unsigned int)space.device().state().state_int(MIPS3_R31)); |
| 1684 | 1684 | break; |
| 1685 | 1685 | } |
| 1686 | 1686 | } |
| r17797 | r17798 | |
| 1717 | 1717 | |
| 1718 | 1718 | case 6: // gmen wars spams this heavily with 0 prior to starting the GMEN board test |
| 1719 | 1719 | if (data != 0) |
| 1720 | | logerror("ctl_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); |
| 1720 | logerror("ctl_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, space.device().safe_pc(), (unsigned int)space.device().state().state_int(MIPS3_R31)); |
| 1721 | 1721 | break; |
| 1722 | 1722 | |
| 1723 | 1723 | default: |
| 1724 | | logerror("ctl_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); |
| 1724 | logerror("ctl_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, space.device().safe_pc(), (unsigned int)space.device().state().state_int(MIPS3_R31)); |
| 1725 | 1725 | } |
| 1726 | 1726 | } |
| 1727 | 1727 | |
| r17797 | r17798 | |
| 1736 | 1736 | return res; |
| 1737 | 1737 | } |
| 1738 | 1738 | } |
| 1739 | | logerror("ctl_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); |
| 1739 | logerror("ctl_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)space.device().state().state_int(MIPS3_R31)); |
| 1740 | 1740 | return 0xffff; |
| 1741 | 1741 | } |
| 1742 | 1742 | |
| r17797 | r17798 | |
| 1780 | 1780 | break; |
| 1781 | 1781 | |
| 1782 | 1782 | default: |
| 1783 | | logerror("c361_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); |
| 1783 | logerror("c361_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, space.device().safe_pc(), (unsigned int)space.device().state().state_int(MIPS3_R31)); |
| 1784 | 1784 | } |
| 1785 | 1785 | } |
| 1786 | 1786 | |
| r17797 | r17798 | |
| 1790 | 1790 | case 5: return machine().primary_screen->vpos()*2 | (machine().primary_screen->vblank() ? 1 : 0); |
| 1791 | 1791 | case 6: return machine().primary_screen->vblank(); |
| 1792 | 1792 | } |
| 1793 | | logerror("c361_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); |
| 1793 | logerror("c361_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)space.device().state().state_int(MIPS3_R31)); |
| 1794 | 1794 | return 0xffff; |
| 1795 | 1795 | } |
| 1796 | 1796 | |
| r17797 | r17798 | |
| 2185 | 2185 | case 0xa: return 1; // Busy flag |
| 2186 | 2186 | } |
| 2187 | 2187 | |
| 2188 | | logerror("p3d_r %02x @ %08x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); |
| 2188 | logerror("p3d_r %02x @ %08x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)space.device().state().state_int(MIPS3_R31)); |
| 2189 | 2189 | return 0; |
| 2190 | 2190 | } |
| 2191 | 2191 | |
| r17797 | r17798 | |
| 2203 | 2203 | m_c361.timer->adjust(attotime::never); |
| 2204 | 2204 | return; |
| 2205 | 2205 | } |
| 2206 | | logerror("p3d_w %02x, %08x @ %08x (%08x, %08x)\n", offset, data, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); |
| 2206 | logerror("p3d_w %02x, %08x @ %08x (%08x, %08x)\n", offset, data, mem_mask, space.device().safe_pc(), (unsigned int)space.device().state().state_int(MIPS3_R31)); |
| 2207 | 2207 | } |
| 2208 | 2208 | |
| 2209 | 2209 | static void render_apply_transform(INT32 xi, INT32 yi, INT32 zi, const namcos23_render_entry *re, poly_vertex &pv) |
trunk/src/mess/machine/primo.c
| r17797 | r17798 | |
| 273 | 273 | |
| 274 | 274 | /* Z80 registers */ |
| 275 | 275 | |
| 276 | | cpu_set_reg(machine.device("maincpu"), Z80_BC, snapshot_data[4] + snapshot_data[5]*256); |
| 277 | | cpu_set_reg(machine.device("maincpu"), Z80_DE, snapshot_data[6] + snapshot_data[7]*256); |
| 278 | | cpu_set_reg(machine.device("maincpu"), Z80_HL, snapshot_data[8] + snapshot_data[9]*256); |
| 279 | | cpu_set_reg(machine.device("maincpu"), Z80_AF, snapshot_data[10] + snapshot_data[11]*256); |
| 280 | | cpu_set_reg(machine.device("maincpu"), Z80_BC2, snapshot_data[12] + snapshot_data[13]*256); |
| 281 | | cpu_set_reg(machine.device("maincpu"), Z80_DE2, snapshot_data[14] + snapshot_data[15]*256); |
| 282 | | cpu_set_reg(machine.device("maincpu"), Z80_HL2, snapshot_data[16] + snapshot_data[17]*256); |
| 283 | | cpu_set_reg(machine.device("maincpu"), Z80_AF2, snapshot_data[18] + snapshot_data[19]*256); |
| 284 | | cpu_set_reg(machine.device("maincpu"), Z80_PC, snapshot_data[20] + snapshot_data[21]*256); |
| 285 | | cpu_set_reg(machine.device("maincpu"), Z80_SP, snapshot_data[22] + snapshot_data[23]*256); |
| 286 | | cpu_set_reg(machine.device("maincpu"), Z80_I, snapshot_data[24]); |
| 287 | | cpu_set_reg(machine.device("maincpu"), Z80_R, snapshot_data[25]); |
| 288 | | cpu_set_reg(machine.device("maincpu"), Z80_IX, snapshot_data[26] + snapshot_data[27]*256); |
| 289 | | cpu_set_reg(machine.device("maincpu"), Z80_IY, snapshot_data[28] + snapshot_data[29]*256); |
| 276 | machine.device("maincpu")->state().set_state_int(Z80_BC, snapshot_data[4] + snapshot_data[5]*256); |
| 277 | machine.device("maincpu")->state().set_state_int(Z80_DE, snapshot_data[6] + snapshot_data[7]*256); |
| 278 | machine.device("maincpu")->state().set_state_int(Z80_HL, snapshot_data[8] + snapshot_data[9]*256); |
| 279 | machine.device("maincpu")->state().set_state_int(Z80_AF, snapshot_data[10] + snapshot_data[11]*256); |
| 280 | machine.device("maincpu")->state().set_state_int(Z80_BC2, snapshot_data[12] + snapshot_data[13]*256); |
| 281 | machine.device("maincpu")->state().set_state_int(Z80_DE2, snapshot_data[14] + snapshot_data[15]*256); |
| 282 | machine.device("maincpu")->state().set_state_int(Z80_HL2, snapshot_data[16] + snapshot_data[17]*256); |
| 283 | machine.device("maincpu")->state().set_state_int(Z80_AF2, snapshot_data[18] + snapshot_data[19]*256); |
| 284 | machine.device("maincpu")->state().set_state_int(Z80_PC, snapshot_data[20] + snapshot_data[21]*256); |
| 285 | machine.device("maincpu")->state().set_state_int(Z80_SP, snapshot_data[22] + snapshot_data[23]*256); |
| 286 | machine.device("maincpu")->state().set_state_int(Z80_I, snapshot_data[24]); |
| 287 | machine.device("maincpu")->state().set_state_int(Z80_R, snapshot_data[25]); |
| 288 | machine.device("maincpu")->state().set_state_int(Z80_IX, snapshot_data[26] + snapshot_data[27]*256); |
| 289 | machine.device("maincpu")->state().set_state_int(Z80_IY, snapshot_data[28] + snapshot_data[29]*256); |
| 290 | 290 | |
| 291 | 291 | |
| 292 | 292 | /* IO ports */ |
| r17797 | r17798 | |
| 349 | 349 | for (i=4; i<quickload_size; i++) |
| 350 | 350 | machine.device("maincpu")->memory().space(AS_PROGRAM)->write_byte(start_addr+i-4, quickload_data[i]); |
| 351 | 351 | |
| 352 | | cpu_set_reg(machine.device("maincpu"), Z80_PC, start_addr); |
| 352 | machine.device("maincpu")->state().set_state_int(Z80_PC, start_addr); |
| 353 | 353 | |
| 354 | 354 | logerror ("Quickload .pp l: %04x r: %04x s: %04x\n", load_addr, start_addr, quickload_size-4); |
| 355 | 355 | } |
trunk/src/mess/machine/sorcerer.c
| r17797 | r17798 | |
| 330 | 330 | image.fread( RAM+0xc000, 0x4000); |
| 331 | 331 | |
| 332 | 332 | /* patch CPU registers */ |
| 333 | | cpu_set_reg(cpu, Z80_I, header[0]); |
| 334 | | cpu_set_reg(cpu, Z80_HL2, header[1] | (header[2] << 8)); |
| 335 | | cpu_set_reg(cpu, Z80_DE2, header[3] | (header[4] << 8)); |
| 336 | | cpu_set_reg(cpu, Z80_BC2, header[5] | (header[6] << 8)); |
| 337 | | cpu_set_reg(cpu, Z80_AF2, header[7] | (header[8] << 8)); |
| 338 | | cpu_set_reg(cpu, Z80_HL, header[9] | (header[10] << 8)); |
| 339 | | cpu_set_reg(cpu, Z80_DE, header[11] | (header[12] << 8)); |
| 340 | | cpu_set_reg(cpu, Z80_BC, header[13] | (header[14] << 8)); |
| 341 | | cpu_set_reg(cpu, Z80_IY, header[15] | (header[16] << 8)); |
| 342 | | cpu_set_reg(cpu, Z80_IX, header[17] | (header[18] << 8)); |
| 343 | | cpu_set_reg(cpu, Z80_IFF1, header[19]&2 ? 1 : 0); |
| 344 | | cpu_set_reg(cpu, Z80_IFF2, header[19]&4 ? 1 : 0); |
| 345 | | cpu_set_reg(cpu, Z80_R, header[20]); |
| 346 | | cpu_set_reg(cpu, Z80_AF, header[21] | (header[22] << 8)); |
| 347 | | cpu_set_reg(cpu, STATE_GENSP, header[23] | (header[24] << 8)); |
| 348 | | cpu_set_reg(cpu, Z80_IM, header[25]); |
| 349 | | cpu_set_reg(cpu, STATE_GENPC, header[26] | (header[27] << 8)); |
| 333 | cpu->state().set_state_int(Z80_I, header[0]); |
| 334 | cpu->state().set_state_int(Z80_HL2, header[1] | (header[2] << 8)); |
| 335 | cpu->state().set_state_int(Z80_DE2, header[3] | (header[4] << 8)); |
| 336 | cpu->state().set_state_int(Z80_BC2, header[5] | (header[6] << 8)); |
| 337 | cpu->state().set_state_int(Z80_AF2, header[7] | (header[8] << 8)); |
| 338 | cpu->state().set_state_int(Z80_HL, header[9] | (header[10] << 8)); |
| 339 | cpu->state().set_state_int(Z80_DE, header[11] | (header[12] << 8)); |
| 340 | cpu->state().set_state_int(Z80_BC, header[13] | (header[14] << 8)); |
| 341 | cpu->state().set_state_int(Z80_IY, header[15] | (header[16] << 8)); |
| 342 | cpu->state().set_state_int(Z80_IX, header[17] | (header[18] << 8)); |
| 343 | cpu->state().set_state_int(Z80_IFF1, header[19]&2 ? 1 : 0); |
| 344 | cpu->state().set_state_int(Z80_IFF2, header[19]&4 ? 1 : 0); |
| 345 | cpu->state().set_state_int(Z80_R, header[20]); |
| 346 | cpu->state().set_state_int(Z80_AF, header[21] | (header[22] << 8)); |
| 347 | cpu->state().set_state_int(STATE_GENSP, header[23] | (header[24] << 8)); |
| 348 | cpu->state().set_state_int(Z80_IM, header[25]); |
| 349 | cpu->state().set_pc(header[26] | (header[27] << 8)); |
| 350 | 350 | |
| 351 | 351 | return IMAGE_INIT_PASS; |
| 352 | 352 | } |
trunk/src/mess/machine/amstrad.c
| r17797 | r17798 | |
| 2184 | 2184 | |
| 2185 | 2185 | /* init Z80 */ |
| 2186 | 2186 | RegData = (pSnapshot[0x011] & 0x0ff) | ((pSnapshot[0x012] & 0x0ff)<<8); |
| 2187 | | cpu_set_reg(state->m_maincpu, Z80_AF, RegData); |
| 2187 | state->m_maincpu->set_state_int(Z80_AF, RegData); |
| 2188 | 2188 | |
| 2189 | 2189 | RegData = (pSnapshot[0x013] & 0x0ff) | ((pSnapshot[0x014] & 0x0ff)<<8); |
| 2190 | | cpu_set_reg(state->m_maincpu, Z80_BC, RegData); |
| 2190 | state->m_maincpu->set_state_int(Z80_BC, RegData); |
| 2191 | 2191 | |
| 2192 | 2192 | RegData = (pSnapshot[0x015] & 0x0ff) | ((pSnapshot[0x016] & 0x0ff)<<8); |
| 2193 | | cpu_set_reg(state->m_maincpu, Z80_DE, RegData); |
| 2193 | state->m_maincpu->set_state_int(Z80_DE, RegData); |
| 2194 | 2194 | |
| 2195 | 2195 | RegData = (pSnapshot[0x017] & 0x0ff) | ((pSnapshot[0x018] & 0x0ff)<<8); |
| 2196 | | cpu_set_reg(state->m_maincpu, Z80_HL, RegData); |
| 2196 | state->m_maincpu->set_state_int(Z80_HL, RegData); |
| 2197 | 2197 | |
| 2198 | 2198 | RegData = (pSnapshot[0x019] & 0x0ff) ; |
| 2199 | | cpu_set_reg(state->m_maincpu, Z80_R, RegData); |
| 2199 | state->m_maincpu->set_state_int(Z80_R, RegData); |
| 2200 | 2200 | |
| 2201 | 2201 | RegData = (pSnapshot[0x01a] & 0x0ff); |
| 2202 | | cpu_set_reg(state->m_maincpu, Z80_I, RegData); |
| 2202 | state->m_maincpu->set_state_int(Z80_I, RegData); |
| 2203 | 2203 | |
| 2204 | 2204 | if ((pSnapshot[0x01b] & 1)==1) |
| 2205 | 2205 | { |
| 2206 | | cpu_set_reg(state->m_maincpu, Z80_IFF1, (UINT64)1); |
| 2206 | state->m_maincpu->set_state_int(Z80_IFF1, (UINT64)1); |
| 2207 | 2207 | } |
| 2208 | 2208 | else |
| 2209 | 2209 | { |
| 2210 | | cpu_set_reg(state->m_maincpu, Z80_IFF1, (UINT64)0); |
| 2210 | state->m_maincpu->set_state_int(Z80_IFF1, (UINT64)0); |
| 2211 | 2211 | } |
| 2212 | 2212 | |
| 2213 | 2213 | if ((pSnapshot[0x01c] & 1)==1) |
| 2214 | 2214 | { |
| 2215 | | cpu_set_reg(state->m_maincpu, Z80_IFF2, (UINT64)1); |
| 2215 | state->m_maincpu->set_state_int(Z80_IFF2, (UINT64)1); |
| 2216 | 2216 | } |
| 2217 | 2217 | else |
| 2218 | 2218 | { |
| 2219 | | cpu_set_reg(state->m_maincpu, Z80_IFF2, (UINT64)0); |
| 2219 | state->m_maincpu->set_state_int(Z80_IFF2, (UINT64)0); |
| 2220 | 2220 | } |
| 2221 | 2221 | |
| 2222 | 2222 | RegData = (pSnapshot[0x01d] & 0x0ff) | ((pSnapshot[0x01e] & 0x0ff)<<8); |
| 2223 | | cpu_set_reg(state->m_maincpu, Z80_IX, RegData); |
| 2223 | state->m_maincpu->set_state_int(Z80_IX, RegData); |
| 2224 | 2224 | |
| 2225 | 2225 | RegData = (pSnapshot[0x01f] & 0x0ff) | ((pSnapshot[0x020] & 0x0ff)<<8); |
| 2226 | | cpu_set_reg(state->m_maincpu, Z80_IY, RegData); |
| 2226 | state->m_maincpu->set_state_int(Z80_IY, RegData); |
| 2227 | 2227 | |
| 2228 | 2228 | RegData = (pSnapshot[0x021] & 0x0ff) | ((pSnapshot[0x022] & 0x0ff)<<8); |
| 2229 | | cpu_set_reg(state->m_maincpu, Z80_SP, RegData); |
| 2230 | | cpu_set_reg(state->m_maincpu, STATE_GENSP, RegData); |
| 2229 | state->m_maincpu->set_state_int(Z80_SP, RegData); |
| 2230 | state->m_maincpu->set_state_int(STATE_GENSP, RegData); |
| 2231 | 2231 | |
| 2232 | 2232 | RegData = (pSnapshot[0x023] & 0x0ff) | ((pSnapshot[0x024] & 0x0ff)<<8); |
| 2233 | 2233 | |
| 2234 | | cpu_set_reg(state->m_maincpu, Z80_PC, RegData); |
| 2235 | | // cpu_set_reg(state->m_maincpu, REG_SP, RegData); |
| 2234 | state->m_maincpu->set_state_int(Z80_PC, RegData); |
| 2235 | // state->m_maincpu->set_state_int(REG_SP, RegData); |
| 2236 | 2236 | |
| 2237 | 2237 | RegData = (pSnapshot[0x025] & 0x0ff); |
| 2238 | | cpu_set_reg(state->m_maincpu, Z80_IM, RegData); |
| 2238 | state->m_maincpu->set_state_int(Z80_IM, RegData); |
| 2239 | 2239 | |
| 2240 | 2240 | RegData = (pSnapshot[0x026] & 0x0ff) | ((pSnapshot[0x027] & 0x0ff)<<8); |
| 2241 | | cpu_set_reg(state->m_maincpu, Z80_AF2, RegData); |
| 2241 | state->m_maincpu->set_state_int(Z80_AF2, RegData); |
| 2242 | 2242 | |
| 2243 | 2243 | RegData = (pSnapshot[0x028] & 0x0ff) | ((pSnapshot[0x029] & 0x0ff)<<8); |
| 2244 | | cpu_set_reg(state->m_maincpu, Z80_BC2, RegData); |
| 2244 | state->m_maincpu->set_state_int(Z80_BC2, RegData); |
| 2245 | 2245 | |
| 2246 | 2246 | RegData = (pSnapshot[0x02a] & 0x0ff) | ((pSnapshot[0x02b] & 0x0ff)<<8); |
| 2247 | | cpu_set_reg(state->m_maincpu, Z80_DE2, RegData); |
| 2247 | state->m_maincpu->set_state_int(Z80_DE2, RegData); |
| 2248 | 2248 | |
| 2249 | 2249 | RegData = (pSnapshot[0x02c] & 0x0ff) | ((pSnapshot[0x02d] & 0x0ff)<<8); |
| 2250 | | cpu_set_reg(state->m_maincpu, Z80_HL2, RegData); |
| 2250 | state->m_maincpu->set_state_int(Z80_HL2, RegData); |
| 2251 | 2251 | |
| 2252 | 2252 | /* init GA */ |
| 2253 | 2253 | for (i=0; i<17; i++) |
trunk/src/mess/machine/ti85.c
| r17797 | r17798 | |
| 523 | 523 | if (file) |
| 524 | 524 | { |
| 525 | 525 | file->read(state->m_ti8x_ram, sizeof(unsigned char)*32*1024); |
| 526 | | cpu_set_reg(state->m_maincpu, Z80_PC,0x0c59); |
| 526 | state->m_maincpu->set_state_int(Z80_PC,0x0c59); |
| 527 | 527 | } |
| 528 | 528 | else |
| 529 | 529 | memset(state->m_ti8x_ram, 0, sizeof(unsigned char)*32*1024); |
| r17797 | r17798 | |
| 542 | 542 | if (file) |
| 543 | 543 | { |
| 544 | 544 | file->read(state->m_ti8x_ram, sizeof(unsigned char)*128*1024); |
| 545 | | cpu_set_reg(state->m_maincpu, Z80_PC,0x0c59); |
| 545 | state->m_maincpu->set_state_int(Z80_PC,0x0c59); |
| 546 | 546 | } |
| 547 | 547 | else |
| 548 | 548 | memset(state->m_ti8x_ram, 0, sizeof(unsigned char)*128*1024); |
| r17797 | r17798 | |
| 562 | 562 | /* Set registers */ |
| 563 | 563 | lo = reg[0x00] & 0x0ff; |
| 564 | 564 | hi = reg[0x01] & 0x0ff; |
| 565 | | cpu_set_reg(state->m_maincpu, Z80_AF, (hi << 8) | lo); |
| 565 | state->m_maincpu->set_state_int(Z80_AF, (hi << 8) | lo); |
| 566 | 566 | lo = reg[0x04] & 0x0ff; |
| 567 | 567 | hi = reg[0x05] & 0x0ff; |
| 568 | | cpu_set_reg(state->m_maincpu, Z80_BC, (hi << 8) | lo); |
| 568 | state->m_maincpu->set_state_int(Z80_BC, (hi << 8) | lo); |
| 569 | 569 | lo = reg[0x08] & 0x0ff; |
| 570 | 570 | hi = reg[0x09] & 0x0ff; |
| 571 | | cpu_set_reg(state->m_maincpu, Z80_DE, (hi << 8) | lo); |
| 571 | state->m_maincpu->set_state_int(Z80_DE, (hi << 8) | lo); |
| 572 | 572 | lo = reg[0x0c] & 0x0ff; |
| 573 | 573 | hi = reg[0x0d] & 0x0ff; |
| 574 | | cpu_set_reg(state->m_maincpu, Z80_HL, (hi << 8) | lo); |
| 574 | state->m_maincpu->set_state_int(Z80_HL, (hi << 8) | lo); |
| 575 | 575 | lo = reg[0x10] & 0x0ff; |
| 576 | 576 | hi = reg[0x11] & 0x0ff; |
| 577 | | cpu_set_reg(state->m_maincpu, Z80_IX, (hi << 8) | lo); |
| 577 | state->m_maincpu->set_state_int(Z80_IX, (hi << 8) | lo); |
| 578 | 578 | lo = reg[0x14] & 0x0ff; |
| 579 | 579 | hi = reg[0x15] & 0x0ff; |
| 580 | | cpu_set_reg(state->m_maincpu, Z80_IY, (hi << 8) | lo); |
| 580 | state->m_maincpu->set_state_int(Z80_IY, (hi << 8) | lo); |
| 581 | 581 | lo = reg[0x18] & 0x0ff; |
| 582 | 582 | hi = reg[0x19] & 0x0ff; |
| 583 | | cpu_set_reg(state->m_maincpu, Z80_PC, (hi << 8) | lo); |
| 583 | state->m_maincpu->set_state_int(Z80_PC, (hi << 8) | lo); |
| 584 | 584 | lo = reg[0x1c] & 0x0ff; |
| 585 | 585 | hi = reg[0x1d] & 0x0ff; |
| 586 | | cpu_set_reg(state->m_maincpu, Z80_SP, (hi << 8) | lo); |
| 586 | state->m_maincpu->set_state_int(Z80_SP, (hi << 8) | lo); |
| 587 | 587 | lo = reg[0x20] & 0x0ff; |
| 588 | 588 | hi = reg[0x21] & 0x0ff; |
| 589 | | cpu_set_reg(state->m_maincpu, Z80_AF2, (hi << 8) | lo); |
| 589 | state->m_maincpu->set_state_int(Z80_AF2, (hi << 8) | lo); |
| 590 | 590 | lo = reg[0x24] & 0x0ff; |
| 591 | 591 | hi = reg[0x25] & 0x0ff; |
| 592 | | cpu_set_reg(state->m_maincpu, Z80_BC2, (hi << 8) | lo); |
| 592 | state->m_maincpu->set_state_int(Z80_BC2, (hi << 8) | lo); |
| 593 | 593 | lo = reg[0x28] & 0x0ff; |
| 594 | 594 | hi = reg[0x29] & 0x0ff; |
| 595 | | cpu_set_reg(state->m_maincpu, Z80_DE2, (hi << 8) | lo); |
| 595 | state->m_maincpu->set_state_int(Z80_DE2, (hi << 8) | lo); |
| 596 | 596 | lo = reg[0x2c] & 0x0ff; |
| 597 | 597 | hi = reg[0x2d] & 0x0ff; |
| 598 | | cpu_set_reg(state->m_maincpu, Z80_HL2, (hi << 8) | lo); |
| 599 | | cpu_set_reg(state->m_maincpu, Z80_IFF1, reg[0x30]&0x0ff); |
| 600 | | cpu_set_reg(state->m_maincpu, Z80_IFF2, reg[0x34]&0x0ff); |
| 601 | | cpu_set_reg(state->m_maincpu, Z80_HALT, reg[0x38]&0x0ff); |
| 602 | | cpu_set_reg(state->m_maincpu, Z80_IM, reg[0x3c]&0x0ff); |
| 603 | | cpu_set_reg(state->m_maincpu, Z80_I, reg[0x40]&0x0ff); |
| 598 | state->m_maincpu->set_state_int(Z80_HL2, (hi << 8) | lo); |
| 599 | state->m_maincpu->set_state_int(Z80_IFF1, reg[0x30]&0x0ff); |
| 600 | state->m_maincpu->set_state_int(Z80_IFF2, reg[0x34]&0x0ff); |
| 601 | state->m_maincpu->set_state_int(Z80_HALT, reg[0x38]&0x0ff); |
| 602 | state->m_maincpu->set_state_int(Z80_IM, reg[0x3c]&0x0ff); |
| 603 | state->m_maincpu->set_state_int(Z80_I, reg[0x40]&0x0ff); |
| 604 | 604 | |
| 605 | | cpu_set_reg(state->m_maincpu, Z80_R, (reg[0x44]&0x7f) | (reg[0x48]&0x80)); |
| 605 | state->m_maincpu->set_state_int(Z80_R, (reg[0x44]&0x7f) | (reg[0x48]&0x80)); |
| 606 | 606 | |
| 607 | 607 | device_set_input_line(state->m_maincpu, 0, 0); |
| 608 | 608 | device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, 0); |
trunk/src/mess/machine/galaxy.c
| r17797 | r17798 | |
| 72 | 72 | switch (size) |
| 73 | 73 | { |
| 74 | 74 | case GALAXY_SNAPSHOT_V1_SIZE: |
| 75 | | cpu_set_reg(cpu, Z80_AF, data[0x00] | data[0x01] << 8); |
| 76 | | cpu_set_reg(cpu, Z80_BC, data[0x04] | data[0x05] << 8); |
| 77 | | cpu_set_reg(cpu, Z80_DE, data[0x08] | data[0x09] << 8); |
| 78 | | cpu_set_reg(cpu, Z80_HL, data[0x0c] | data[0x0d] << 8); |
| 79 | | cpu_set_reg(cpu, Z80_IX, data[0x10] | data[0x11] << 8); |
| 80 | | cpu_set_reg(cpu, Z80_IY, data[0x14] | data[0x15] << 8); |
| 81 | | cpu_set_reg(cpu, Z80_PC, data[0x18] | data[0x19] << 8); |
| 82 | | cpu_set_reg(cpu, Z80_SP, data[0x1c] | data[0x1d] << 8); |
| 83 | | cpu_set_reg(cpu, Z80_AF2, data[0x20] | data[0x21] << 8); |
| 84 | | cpu_set_reg(cpu, Z80_BC2, data[0x24] | data[0x25] << 8); |
| 85 | | cpu_set_reg(cpu, Z80_DE2, data[0x28] | data[0x29] << 8); |
| 86 | | cpu_set_reg(cpu, Z80_HL2, data[0x2c] | data[0x2d] << 8); |
| 87 | | cpu_set_reg(cpu, Z80_IFF1, data[0x30]); |
| 88 | | cpu_set_reg(cpu, Z80_IFF2, data[0x34]); |
| 89 | | cpu_set_reg(cpu, Z80_HALT, data[0x38]); |
| 90 | | cpu_set_reg(cpu, Z80_IM, data[0x3c]); |
| 91 | | cpu_set_reg(cpu, Z80_I, data[0x40]); |
| 92 | | cpu_set_reg(cpu, Z80_R, (data[0x44] & 0x7f) | (data[0x48] & 0x80)); |
| 75 | cpu->state().set_state_int(Z80_AF, data[0x00] | data[0x01] << 8); |
| 76 | cpu->state().set_state_int(Z80_BC, data[0x04] | data[0x05] << 8); |
| 77 | cpu->state().set_state_int(Z80_DE, data[0x08] | data[0x09] << 8); |
| 78 | cpu->state().set_state_int(Z80_HL, data[0x0c] | data[0x0d] << 8); |
| 79 | cpu->state().set_state_int(Z80_IX, data[0x10] | data[0x11] << 8); |
| 80 | cpu->state().set_state_int(Z80_IY, data[0x14] | data[0x15] << 8); |
| 81 | cpu->state().set_state_int(Z80_PC, data[0x18] | data[0x19] << 8); |
| 82 | cpu->state().set_state_int(Z80_SP, data[0x1c] | data[0x1d] << 8); |
| 83 | cpu->state().set_state_int(Z80_AF2, data[0x20] | data[0x21] << 8); |
| 84 | cpu->state().set_state_int(Z80_BC2, data[0x24] | data[0x25] << 8); |
| 85 | cpu->state().set_state_int(Z80_DE2, data[0x28] | data[0x29] << 8); |
| 86 | cpu->state().set_state_int(Z80_HL2, data[0x2c] | data[0x2d] << 8); |
| 87 | cpu->state().set_state_int(Z80_IFF1, data[0x30]); |
| 88 | cpu->state().set_state_int(Z80_IFF2, data[0x34]); |
| 89 | cpu->state().set_state_int(Z80_HALT, data[0x38]); |
| 90 | cpu->state().set_state_int(Z80_IM, data[0x3c]); |
| 91 | cpu->state().set_state_int(Z80_I, data[0x40]); |
| 92 | cpu->state().set_state_int(Z80_R, (data[0x44] & 0x7f) | (data[0x48] & 0x80)); |
| 93 | 93 | |
| 94 | 94 | memcpy (machine.device<ram_device>(RAM_TAG)->pointer(), data + 0x084c, (machine.device<ram_device>(RAM_TAG)->size() < 0x1800) ? machine.device<ram_device>(RAM_TAG)->size() : 0x1800); |
| 95 | 95 | |
| 96 | 96 | break; |
| 97 | 97 | case GALAXY_SNAPSHOT_V2_SIZE: |
| 98 | | cpu_set_reg(cpu, Z80_AF, data[0x00] | data[0x01] << 8); |
| 99 | | cpu_set_reg(cpu, Z80_BC, data[0x02] | data[0x03] << 8); |
| 100 | | cpu_set_reg(cpu, Z80_DE, data[0x04] | data[0x05] << 8); |
| 101 | | cpu_set_reg(cpu, Z80_HL, data[0x06] | data[0x07] << 8); |
| 102 | | cpu_set_reg(cpu, Z80_IX, data[0x08] | data[0x09] << 8); |
| 103 | | cpu_set_reg(cpu, Z80_IY, data[0x0a] | data[0x0b] << 8); |
| 104 | | cpu_set_reg(cpu, Z80_PC, data[0x0c] | data[0x0d] << 8); |
| 105 | | cpu_set_reg(cpu, Z80_SP, data[0x0e] | data[0x0f] << 8); |
| 106 | | cpu_set_reg(cpu, Z80_AF2, data[0x10] | data[0x11] << 8); |
| 107 | | cpu_set_reg(cpu, Z80_BC2, data[0x12] | data[0x13] << 8); |
| 108 | | cpu_set_reg(cpu, Z80_DE2, data[0x14] | data[0x15] << 8); |
| 109 | | cpu_set_reg(cpu, Z80_HL2, data[0x16] | data[0x17] << 8); |
| 98 | cpu->state().set_state_int(Z80_AF, data[0x00] | data[0x01] << 8); |
| 99 | cpu->state().set_state_int(Z80_BC, data[0x02] | data[0x03] << 8); |
| 100 | cpu->state().set_state_int(Z80_DE, data[0x04] | data[0x05] << 8); |
| 101 | cpu->state().set_state_int(Z80_HL, data[0x06] | data[0x07] << 8); |
| 102 | cpu->state().set_state_int(Z80_IX, data[0x08] | data[0x09] << 8); |
| 103 | cpu->state().set_state_int(Z80_IY, data[0x0a] | data[0x0b] << 8); |
| 104 | cpu->state().set_state_int(Z80_PC, data[0x0c] | data[0x0d] << 8); |
| 105 | cpu->state().set_state_int(Z80_SP, data[0x0e] | data[0x0f] << 8); |
| 106 | cpu->state().set_state_int(Z80_AF2, data[0x10] | data[0x11] << 8); |
| 107 | cpu->state().set_state_int(Z80_BC2, data[0x12] | data[0x13] << 8); |
| 108 | cpu->state().set_state_int(Z80_DE2, data[0x14] | data[0x15] << 8); |
| 109 | cpu->state().set_state_int(Z80_HL2, data[0x16] | data[0x17] << 8); |
| 110 | 110 | |
| 111 | | cpu_set_reg(cpu, Z80_IFF1, data[0x18] & 0x01); |
| 112 | | cpu_set_reg(cpu, Z80_IFF2, (UINT64)0); |
| 111 | cpu->state().set_state_int(Z80_IFF1, data[0x18] & 0x01); |
| 112 | cpu->state().set_state_int(Z80_IFF2, (UINT64)0); |
| 113 | 113 | |
| 114 | | cpu_set_reg(cpu, Z80_HALT, (UINT64)0); |
| 114 | cpu->state().set_state_int(Z80_HALT, (UINT64)0); |
| 115 | 115 | |
| 116 | | cpu_set_reg(cpu, Z80_IM, (data[0x18] >> 1) & 0x03); |
| 116 | cpu->state().set_state_int(Z80_IM, (data[0x18] >> 1) & 0x03); |
| 117 | 117 | |
| 118 | | cpu_set_reg(cpu, Z80_I, data[0x19]); |
| 119 | | cpu_set_reg(cpu, Z80_R, data[0x1a]); |
| 118 | cpu->state().set_state_int(Z80_I, data[0x19]); |
| 119 | cpu->state().set_state_int(Z80_R, data[0x1a]); |
| 120 | 120 | |
| 121 | 121 | memcpy (machine.device<ram_device>(RAM_TAG)->pointer(), data + 0x0834, (machine.device<ram_device>(RAM_TAG)->size() < 0x1800) ? machine.device<ram_device>(RAM_TAG)->size() : 0x1800); |
| 122 | 122 | |
trunk/src/mess/machine/lviv.c
| r17797 | r17798 | |
| 282 | 282 | /* Set registers */ |
| 283 | 283 | lo = data[0x14112] & 0x0ff; |
| 284 | 284 | hi = data[0x14111] & 0x0ff; |
| 285 | | cpu_set_reg(machine.device("maincpu"), I8085_BC, (hi << 8) | lo); |
| 285 | machine.device("maincpu")->state().set_state_int(I8085_BC, (hi << 8) | lo); |
| 286 | 286 | lo = data[0x14114] & 0x0ff; |
| 287 | 287 | hi = data[0x14113] & 0x0ff; |
| 288 | | cpu_set_reg(machine.device("maincpu"), I8085_DE, (hi << 8) | lo); |
| 288 | machine.device("maincpu")->state().set_state_int(I8085_DE, (hi << 8) | lo); |
| 289 | 289 | lo = data[0x14116] & 0x0ff; |
| 290 | 290 | hi = data[0x14115] & 0x0ff; |
| 291 | | cpu_set_reg(machine.device("maincpu"), I8085_HL, (hi << 8) | lo); |
| 291 | machine.device("maincpu")->state().set_state_int(I8085_HL, (hi << 8) | lo); |
| 292 | 292 | lo = data[0x14118] & 0x0ff; |
| 293 | 293 | hi = data[0x14117] & 0x0ff; |
| 294 | | cpu_set_reg(machine.device("maincpu"), I8085_AF, (hi << 8) | lo); |
| 294 | machine.device("maincpu")->state().set_state_int(I8085_AF, (hi << 8) | lo); |
| 295 | 295 | lo = data[0x14119] & 0x0ff; |
| 296 | 296 | hi = data[0x1411a] & 0x0ff; |
| 297 | | cpu_set_reg(machine.device("maincpu"), I8085_SP, (hi << 8) | lo); |
| 297 | machine.device("maincpu")->state().set_state_int(I8085_SP, (hi << 8) | lo); |
| 298 | 298 | lo = data[0x1411b] & 0x0ff; |
| 299 | 299 | hi = data[0x1411c] & 0x0ff; |
| 300 | | cpu_set_reg(machine.device("maincpu"), I8085_PC, (hi << 8) | lo); |
| 300 | machine.device("maincpu")->state().set_state_int(I8085_PC, (hi << 8) | lo); |
| 301 | 301 | |
| 302 | 302 | /* Memory dump */ |
| 303 | 303 | memcpy (machine.device<ram_device>(RAM_TAG)->pointer(), data+0x0011, 0xc000); |
| r17797 | r17798 | |
| 313 | 313 | |
| 314 | 314 | static void dump_registers(running_machine &machine) |
| 315 | 315 | { |
| 316 | | logerror("PC = %04x\n", (unsigned) cpu_get_reg(machine.device("maincpu"), I8085_PC)); |
| 317 | | logerror("SP = %04x\n", (unsigned) cpu_get_reg(machine.device("maincpu"), I8085_SP)); |
| 318 | | logerror("AF = %04x\n", (unsigned) cpu_get_reg(machine.device("maincpu"), I8085_AF)); |
| 319 | | logerror("BC = %04x\n", (unsigned) cpu_get_reg(machine.device("maincpu"), I8085_BC)); |
| 320 | | logerror("DE = %04x\n", (unsigned) cpu_get_reg(machine.device("maincpu"), I8085_DE)); |
| 321 | | logerror("HL = %04x\n", (unsigned) cpu_get_reg(machine.device("maincpu"), I8085_HL)); |
| 316 | logerror("PC = %04x\n", (unsigned) machine.device("maincpu")->state().state_int(I8085_PC)); |
| 317 | logerror("SP = %04x\n", (unsigned) machine.device("maincpu")->state().state_int(I8085_SP)); |
| 318 | logerror("AF = %04x\n", (unsigned) machine.device("maincpu")->state().state_int(I8085_AF)); |
| 319 | logerror("BC = %04x\n", (unsigned) machine.device("maincpu")->state().state_int(I8085_BC)); |
| 320 | logerror("DE = %04x\n", (unsigned) machine.device("maincpu")->state().state_int(I8085_DE)); |
| 321 | logerror("HL = %04x\n", (unsigned) machine.device("maincpu")->state().state_int(I8085_HL)); |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | static int lviv_verify_snapshot (UINT8 * data, UINT32 size) |
trunk/src/mess/video/pdp1.c
| r17797 | r17798 | |
| 309 | 309 | static void pdp1_draw_panel(running_machine &machine, bitmap_ind16 &bitmap) |
| 310 | 310 | { |
| 311 | 311 | /* column 1: registers, test word, test address */ |
| 312 | | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset+16, y_panel_pc_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_PC), 16); |
| 313 | | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset+16, y_panel_ma_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_MA), 16); |
| 314 | | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_mb_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_MB), 18); |
| 315 | | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_ac_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_AC), 18); |
| 316 | | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_io_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_IO), 18); |
| 317 | | pdp1_draw_switch(machine, bitmap, x_panel_col1_offset, y_panel_ta_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_EXTEND_SW)); |
| 318 | | pdp1_draw_multipleswitch(machine, bitmap, x_panel_col1_offset+16, y_panel_ta_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_TA), 16); |
| 319 | | pdp1_draw_multipleswitch(machine, bitmap, x_panel_col1_offset, y_panel_tw_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_TW), 18); |
| 312 | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset+16, y_panel_pc_offset+8, machine.device("maincpu")->state().state_int(PDP1_PC), 16); |
| 313 | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset+16, y_panel_ma_offset+8, machine.device("maincpu")->state().state_int(PDP1_MA), 16); |
| 314 | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_mb_offset+8, machine.device("maincpu")->state().state_int(PDP1_MB), 18); |
| 315 | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_ac_offset+8, machine.device("maincpu")->state().state_int(PDP1_AC), 18); |
| 316 | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_io_offset+8, machine.device("maincpu")->state().state_int(PDP1_IO), 18); |
| 317 | pdp1_draw_switch(machine, bitmap, x_panel_col1_offset, y_panel_ta_offset+8, machine.device("maincpu")->state().state_int(PDP1_EXTEND_SW)); |
| 318 | pdp1_draw_multipleswitch(machine, bitmap, x_panel_col1_offset+16, y_panel_ta_offset+8, machine.device("maincpu")->state().state_int(PDP1_TA), 16); |
| 319 | pdp1_draw_multipleswitch(machine, bitmap, x_panel_col1_offset, y_panel_tw_offset+8, machine.device("maincpu")->state().state_int(PDP1_TW), 18); |
| 320 | 320 | |
| 321 | 321 | /* column 2: 1-bit indicators */ |
| 322 | | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset, cpu_get_reg(machine.device("maincpu"), PDP1_RUN)); |
| 323 | | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cyc_offset, cpu_get_reg(machine.device("maincpu"), PDP1_CYC)); |
| 324 | | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_defer_offset, cpu_get_reg(machine.device("maincpu"), PDP1_DEFER)); |
| 322 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset, machine.device("maincpu")->state().state_int(PDP1_RUN)); |
| 323 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cyc_offset, machine.device("maincpu")->state().state_int(PDP1_CYC)); |
| 324 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_defer_offset, machine.device("maincpu")->state().state_int(PDP1_DEFER)); |
| 325 | 325 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_hs_cyc_offset, 0); /* not emulated */ |
| 326 | | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_brk_ctr_1_offset, cpu_get_reg(machine.device("maincpu"), PDP1_BRK_CTR) & 1); |
| 327 | | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_brk_ctr_2_offset, cpu_get_reg(machine.device("maincpu"), PDP1_BRK_CTR) & 2); |
| 328 | | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ov_offset, cpu_get_reg(machine.device("maincpu"), PDP1_OV)); |
| 329 | | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset, cpu_get_reg(machine.device("maincpu"), PDP1_RIM)); |
| 330 | | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_sbm_offset, cpu_get_reg(machine.device("maincpu"), PDP1_SBM)); |
| 331 | | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_exd_offset, cpu_get_reg(machine.device("maincpu"), PDP1_EXD)); |
| 332 | | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset, cpu_get_reg(machine.device("maincpu"), PDP1_IOH)); |
| 333 | | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioc_offset, cpu_get_reg(machine.device("maincpu"), PDP1_IOC)); |
| 334 | | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset, cpu_get_reg(machine.device("maincpu"), PDP1_IOS)); |
| 326 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_brk_ctr_1_offset, machine.device("maincpu")->state().state_int(PDP1_BRK_CTR) & 1); |
| 327 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_brk_ctr_2_offset, machine.device("maincpu")->state().state_int(PDP1_BRK_CTR) & 2); |
| 328 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ov_offset, machine.device("maincpu")->state().state_int(PDP1_OV)); |
| 329 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset, machine.device("maincpu")->state().state_int(PDP1_RIM)); |
| 330 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_sbm_offset, machine.device("maincpu")->state().state_int(PDP1_SBM)); |
| 331 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_exd_offset, machine.device("maincpu")->state().state_int(PDP1_EXD)); |
| 332 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset, machine.device("maincpu")->state().state_int(PDP1_IOH)); |
| 333 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioc_offset, machine.device("maincpu")->state().state_int(PDP1_IOC)); |
| 334 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset, machine.device("maincpu")->state().state_int(PDP1_IOS)); |
| 335 | 335 | |
| 336 | 336 | /* column 3: power, single step, single inst, sense, flags, instr... */ |
| 337 | 337 | pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_power_offset, 1); /* always on */ |
| 338 | 338 | pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_power_offset, 1); /* always on */ |
| 339 | | pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_sngl_step_offset, cpu_get_reg(machine.device("maincpu"), PDP1_SNGL_STEP)); |
| 340 | | pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_sngl_step_offset, cpu_get_reg(machine.device("maincpu"), PDP1_SNGL_STEP)); |
| 341 | | pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_sngl_inst_offset, cpu_get_reg(machine.device("maincpu"), PDP1_SNGL_INST)); |
| 342 | | pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_sngl_inst_offset, cpu_get_reg(machine.device("maincpu"), PDP1_SNGL_INST)); |
| 343 | | pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_ss_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_SS), 6); |
| 344 | | pdp1_draw_multipleswitch(machine, bitmap, x_panel_col3_offset, y_panel_ss_offset+16, cpu_get_reg(machine.device("maincpu"), PDP1_SS), 6); |
| 345 | | pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_pf_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_PF), 6); |
| 346 | | pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_ir_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_IR), 5); |
| 339 | pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_sngl_step_offset, machine.device("maincpu")->state().state_int(PDP1_SNGL_STEP)); |
| 340 | pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_sngl_step_offset, machine.device("maincpu")->state().state_int(PDP1_SNGL_STEP)); |
| 341 | pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_sngl_inst_offset, machine.device("maincpu")->state().state_int(PDP1_SNGL_INST)); |
| 342 | pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_sngl_inst_offset, machine.device("maincpu")->state().state_int(PDP1_SNGL_INST)); |
| 343 | pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_ss_offset+8, machine.device("maincpu")->state().state_int(PDP1_SS), 6); |
| 344 | pdp1_draw_multipleswitch(machine, bitmap, x_panel_col3_offset, y_panel_ss_offset+16, machine.device("maincpu")->state().state_int(PDP1_SS), 6); |
| 345 | pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_pf_offset+8, machine.device("maincpu")->state().state_int(PDP1_PF), 6); |
| 346 | pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_ir_offset+8, machine.device("maincpu")->state().state_int(PDP1_IR), 5); |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | |
trunk/src/mess/video/tx0.c
| r17797 | r17798 | |
| 300 | 300 | int i; |
| 301 | 301 | |
| 302 | 302 | /* column 1: registers, test accumulator, test buffer, toggle switch storage */ |
| 303 | | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_pc_offset+8, cpu_get_reg(machine.device("maincpu"), TX0_PC), 16); |
| 304 | | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_mar_offset+8, cpu_get_reg(machine.device("maincpu"), TX0_MAR), 16); |
| 305 | | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_mbr_offset+8, cpu_get_reg(machine.device("maincpu"), TX0_MBR), 18); |
| 306 | | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_ac_offset+8, cpu_get_reg(machine.device("maincpu"), TX0_AC), 18); |
| 307 | | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_lr_offset+8, cpu_get_reg(machine.device("maincpu"), TX0_LR), 18); |
| 308 | | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+4*8, y_panel_xr_offset+8, cpu_get_reg(machine.device("maincpu"), TX0_XR), 14); |
| 309 | | tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tbr_offset+8, cpu_get_reg(machine.device("maincpu"), TX0_TBR), 18); |
| 310 | | tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tac_offset+8, cpu_get_reg(machine.device("maincpu"), TX0_TAC), 18); |
| 311 | | cm_sel = cpu_get_reg(machine.device("maincpu"), TX0_CM_SEL); |
| 312 | | lr_sel = cpu_get_reg(machine.device("maincpu"), TX0_LR_SEL); |
| 303 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_pc_offset+8, machine.device("maincpu")->state().state_int(TX0_PC), 16); |
| 304 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_mar_offset+8, machine.device("maincpu")->state().state_int(TX0_MAR), 16); |
| 305 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_mbr_offset+8, machine.device("maincpu")->state().state_int(TX0_MBR), 18); |
| 306 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_ac_offset+8, machine.device("maincpu")->state().state_int(TX0_AC), 18); |
| 307 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_lr_offset+8, machine.device("maincpu")->state().state_int(TX0_LR), 18); |
| 308 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+4*8, y_panel_xr_offset+8, machine.device("maincpu")->state().state_int(TX0_XR), 14); |
| 309 | tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tbr_offset+8, machine.device("maincpu")->state().state_int(TX0_TBR), 18); |
| 310 | tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tac_offset+8, machine.device("maincpu")->state().state_int(TX0_TAC), 18); |
| 311 | cm_sel = machine.device("maincpu")->state().state_int(TX0_CM_SEL); |
| 312 | lr_sel = machine.device("maincpu")->state().state_int(TX0_LR_SEL); |
| 313 | 313 | for (i=0; i<16; i++) |
| 314 | 314 | { |
| 315 | 315 | tx0_draw_switch(machine, bitmap, x_panel_col1a_offset+16, y_panel_tss_offset+8+i*8, (cm_sel >> i) & 1); |
| 316 | | tx0_draw_multipleswitch(machine, bitmap, x_panel_col1a_offset+24, y_panel_tss_offset+8+i*8, cpu_get_reg(machine.device("maincpu"), TX0_TSS00+i), 18); |
| 316 | tx0_draw_multipleswitch(machine, bitmap, x_panel_col1a_offset+24, y_panel_tss_offset+8+i*8, machine.device("maincpu")->state().state_int(TX0_TSS00+i), 18); |
| 317 | 317 | tx0_draw_switch(machine, bitmap, x_panel_col1a_offset+168, y_panel_tss_offset+8+i*8, (lr_sel >> i) & 1); |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | /* column 2: stop c0, stop c1, cm sel, 1-bit indicators, instr, flags */ |
| 321 | | tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c0_offset, cpu_get_reg(machine.device("maincpu"), TX0_STOP_CYC0)); |
| 322 | | tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c1_offset, cpu_get_reg(machine.device("maincpu"), TX0_STOP_CYC1)); |
| 323 | | tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_gbl_cm_sel_offset, cpu_get_reg(machine.device("maincpu"), TX0_GBL_CM_SEL)); |
| 324 | | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset, cpu_get_reg(machine.device("maincpu"), TX0_RUN)); |
| 325 | | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle1_offset, cpu_get_reg(machine.device("maincpu"), TX0_CYCLE) & 1); |
| 326 | | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle2_offset, cpu_get_reg(machine.device("maincpu"), TX0_CYCLE) & 2); |
| 327 | | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset, cpu_get_reg(machine.device("maincpu"), TX0_RIM)); |
| 328 | | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset, cpu_get_reg(machine.device("maincpu"), TX0_IOH)); |
| 329 | | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset, cpu_get_reg(machine.device("maincpu"), TX0_IOS)); |
| 330 | | tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_ir_offset+8, cpu_get_reg(machine.device("maincpu"), TX0_IR), 5); |
| 331 | | tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_pf_offset+8, cpu_get_reg(machine.device("maincpu"), TX0_PF), 6); |
| 321 | tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c0_offset, machine.device("maincpu")->state().state_int(TX0_STOP_CYC0)); |
| 322 | tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c1_offset, machine.device("maincpu")->state().state_int(TX0_STOP_CYC1)); |
| 323 | tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_gbl_cm_sel_offset, machine.device("maincpu")->state().state_int(TX0_GBL_CM_SEL)); |
| 324 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset, machine.device("maincpu")->state().state_int(TX0_RUN)); |
| 325 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle1_offset, machine.device("maincpu")->state().state_int(TX0_CYCLE) & 1); |
| 326 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle2_offset, machine.device("maincpu")->state().state_int(TX0_CYCLE) & 2); |
| 327 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset, machine.device("maincpu")->state().state_int(TX0_RIM)); |
| 328 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset, machine.device("maincpu")->state().state_int(TX0_IOH)); |
| 329 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset, machine.device("maincpu")->state().state_int(TX0_IOS)); |
| 330 | tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_ir_offset+8, machine.device("maincpu")->state().state_int(TX0_IR), 5); |
| 331 | tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_pf_offset+8, machine.device("maincpu")->state().state_int(TX0_PF), 6); |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | |
trunk/src/mess/formats/ace_ace.c
| r17797 | r17798 | |
| 85 | 85 | |
| 86 | 86 | if ((ace_index & 0x3FFF)==0) |
| 87 | 87 | { |
| 88 | | cpu_set_reg(cpu, Z80_AF, RAM[0x2100] | (RAM[0x2101] << 8)); |
| 89 | | cpu_set_reg(cpu, Z80_BC, RAM[0x2104] | (RAM[0x2105] << 8)); |
| 90 | | cpu_set_reg(cpu, Z80_DE, RAM[0x2108] | (RAM[0x2109] << 8)); |
| 91 | | cpu_set_reg(cpu, Z80_HL, RAM[0x210c] | (RAM[0x210d] << 8)); |
| 92 | | cpu_set_reg(cpu, Z80_IX, RAM[0x2110] | (RAM[0x2111] << 8)); |
| 93 | | cpu_set_reg(cpu, Z80_IY, RAM[0x2114] | (RAM[0x2115] << 8)); |
| 94 | | cpu_set_reg(cpu, STATE_GENPC, RAM[0x211c] | (RAM[0x211d] << 8)); |
| 95 | | cpu_set_reg(cpu, Z80_AF2, RAM[0x2120] | (RAM[0x2121] << 8)); |
| 96 | | cpu_set_reg(cpu, Z80_BC2, RAM[0x2124] | (RAM[0x2125] << 8)); |
| 97 | | cpu_set_reg(cpu, Z80_DE2, RAM[0x2128] | (RAM[0x2129] << 8)); |
| 98 | | cpu_set_reg(cpu, Z80_HL2, RAM[0x212c] | (RAM[0x212d] << 8)); |
| 99 | | cpu_set_reg(cpu, Z80_IM, RAM[0x2130]); |
| 100 | | cpu_set_reg(cpu, Z80_IFF1, RAM[0x2134]); |
| 101 | | cpu_set_reg(cpu, Z80_IFF2, RAM[0x2138]); |
| 102 | | cpu_set_reg(cpu, Z80_I, RAM[0x213c]); |
| 103 | | cpu_set_reg(cpu, Z80_R, RAM[0x2140]); |
| 88 | cpu->set_state_int(Z80_AF, RAM[0x2100] | (RAM[0x2101] << 8)); |
| 89 | cpu->set_state_int(Z80_BC, RAM[0x2104] | (RAM[0x2105] << 8)); |
| 90 | cpu->set_state_int(Z80_DE, RAM[0x2108] | (RAM[0x2109] << 8)); |
| 91 | cpu->set_state_int(Z80_HL, RAM[0x210c] | (RAM[0x210d] << 8)); |
| 92 | cpu->set_state_int(Z80_IX, RAM[0x2110] | (RAM[0x2111] << 8)); |
| 93 | cpu->set_state_int(Z80_IY, RAM[0x2114] | (RAM[0x2115] << 8)); |
| 94 | cpu->set_pc(RAM[0x211c] | (RAM[0x211d] << 8)); |
| 95 | cpu->set_state_int(Z80_AF2, RAM[0x2120] | (RAM[0x2121] << 8)); |
| 96 | cpu->set_state_int(Z80_BC2, RAM[0x2124] | (RAM[0x2125] << 8)); |
| 97 | cpu->set_state_int(Z80_DE2, RAM[0x2128] | (RAM[0x2129] << 8)); |
| 98 | cpu->set_state_int(Z80_HL2, RAM[0x212c] | (RAM[0x212d] << 8)); |
| 99 | cpu->set_state_int(Z80_IM, RAM[0x2130]); |
| 100 | cpu->set_state_int(Z80_IFF1, RAM[0x2134]); |
| 101 | cpu->set_state_int(Z80_IFF2, RAM[0x2138]); |
| 102 | cpu->set_state_int(Z80_I, RAM[0x213c]); |
| 103 | cpu->set_state_int(Z80_R, RAM[0x2140]); |
| 104 | 104 | |
| 105 | 105 | if ((RAM[0x2119] < 0x80) || !ace_index) |
| 106 | | cpu_set_reg(cpu, STATE_GENSP, RAM[0x2118] | (RAM[0x2119] << 8)); |
| 106 | cpu->set_state_int(STATE_GENSP, RAM[0x2118] | (RAM[0x2119] << 8)); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /* Copy data to the address space */ |
trunk/src/mess/formats/spec_snqk.c
| r17797 | r17798 | |
| 34 | 34 | |
| 35 | 35 | #define LOAD_REG(_cpu, _reg, _data) \ |
| 36 | 36 | do { \ |
| 37 | | cpu_set_reg(_cpu, _reg, (_data)); \ |
| 37 | _cpu->state().set_state_int(_reg, (_data)); \ |
| 38 | 38 | } while (0) |
| 39 | 39 | |
| 40 | 40 | #define EXEC_NA "N/A" |
| r17797 | r17798 | |
| 609 | 609 | space->write_byte(BASE_RAM + i, snapdata[SNA48_HDR + i]); |
| 610 | 610 | |
| 611 | 611 | /* Get PC from stack */ |
| 612 | | addr = cpu_get_reg(cpu, Z80_SP); |
| 612 | addr = cpu->state().state_int(Z80_SP); |
| 613 | 613 | |
| 614 | 614 | if (addr < BASE_RAM || addr > 4*SPECTRUM_BANK - 2) |
| 615 | 615 | logerror("Corrupted SP out of range:%04X", addr); |
| r17797 | r17798 | |
| 626 | 626 | |
| 627 | 627 | addr += 2; |
| 628 | 628 | logerror("Fixing SP:%04X\n", addr); |
| 629 | | cpu_set_reg(cpu, Z80_SP, addr); |
| 629 | cpu->state().set_state_int(Z80_SP, addr); |
| 630 | 630 | |
| 631 | 631 | /* Set border color */ |
| 632 | 632 | data = snapdata[SNA48_OFFSET + 26] & 0x07; |
| r17797 | r17798 | |
| 951 | 951 | |
| 952 | 952 | addr += 6; |
| 953 | 953 | logerror("Fixing SP:%04X\n", addr); |
| 954 | | cpu_set_reg(cpu, Z80_SP, addr); |
| 954 | cpu->state().set_state_int(Z80_SP, addr); |
| 955 | 955 | |
| 956 | 956 | /* Set border color */ |
| 957 | 957 | data = (space->read_byte(0x5c48) >> 3) & 0x07; // Get the current border color from BORDCR system variable. |
| r17797 | r17798 | |
| 1153 | 1153 | |
| 1154 | 1154 | addr += 6; |
| 1155 | 1155 | logerror("Fixing SP:%04X\n", addr); |
| 1156 | | cpu_set_reg(cpu, Z80_SP, addr); |
| 1156 | cpu->state().set_state_int(Z80_SP, addr); |
| 1157 | 1157 | |
| 1158 | 1158 | /* Set border color */ |
| 1159 | 1159 | data = (space->read_byte(0x5c48) >> 3) & 0x07; // Get the current border color from BORDCR system variable. |
| r17797 | r17798 | |
| 1886 | 1886 | spectrum_snx_decompress_block(machine, snapdata, BASE_RAM, 3*SPECTRUM_BANK); |
| 1887 | 1887 | |
| 1888 | 1888 | /* get pc from stack */ |
| 1889 | | addr = cpu_get_reg(cpu, Z80_SP); |
| 1889 | addr = cpu->state().state_int(Z80_SP); |
| 1890 | 1890 | |
| 1891 | 1891 | if (addr < BASE_RAM || addr > 4*SPECTRUM_BANK - 2) |
| 1892 | 1892 | logerror("Corrupted SP out of range:%04X", addr); |
| r17797 | r17798 | |
| 1902 | 1902 | |
| 1903 | 1903 | addr += 2; |
| 1904 | 1904 | logerror("Fixed the stack at SP:%04X\n", addr); |
| 1905 | | cpu_set_reg(cpu, Z80_SP, addr); |
| 1905 | cpu->state().set_state_int(Z80_SP, addr); |
| 1906 | 1906 | |
| 1907 | 1907 | /* Set border color */ |
| 1908 | 1908 | data = snapdata[SNX_OFFSET + 32] & 0x07; |
| r17797 | r17798 | |
| 2235 | 2235 | /* AF */ |
| 2236 | 2236 | hi = snapdata[0] & 0x0ff; |
| 2237 | 2237 | lo = snapdata[1] & 0x0ff; |
| 2238 | | cpu_set_reg(machine.device("maincpu"), Z80_AF, (hi << 8) | lo); |
| 2238 | machine.device("maincpu")->state().set_state_int(Z80_AF, (hi << 8) | lo); |
| 2239 | 2239 | /* BC */ |
| 2240 | 2240 | lo = snapdata[2] & 0x0ff; |
| 2241 | 2241 | hi = snapdata[3] & 0x0ff; |
| 2242 | | cpu_set_reg(machine.device("maincpu"), Z80_BC, (hi << 8) | lo); |
| 2242 | machine.device("maincpu")->state().set_state_int(Z80_BC, (hi << 8) | lo); |
| 2243 | 2243 | /* HL */ |
| 2244 | 2244 | lo = snapdata[4] & 0x0ff; |
| 2245 | 2245 | hi = snapdata[5] & 0x0ff; |
| 2246 | | cpu_set_reg(machine.device("maincpu"), Z80_HL, (hi << 8) | lo); |
| 2246 | machine.device("maincpu")->state().set_state_int(Z80_HL, (hi << 8) | lo); |
| 2247 | 2247 | |
| 2248 | 2248 | /* SP */ |
| 2249 | 2249 | lo = snapdata[8] & 0x0ff; |
| 2250 | 2250 | hi = snapdata[9] & 0x0ff; |
| 2251 | | cpu_set_reg(machine.device("maincpu"), Z80_SP, (hi << 8) | lo); |
| 2251 | machine.device("maincpu")->state().set_state_int(Z80_SP, (hi << 8) | lo); |
| 2252 | 2252 | |
| 2253 | 2253 | /* I */ |
| 2254 | | cpu_set_reg(machine.device("maincpu"), Z80_I, (snapdata[10] & 0x0ff)); |
| 2254 | machine.device("maincpu")->state().set_state_int(Z80_I, (snapdata[10] & 0x0ff)); |
| 2255 | 2255 | |
| 2256 | 2256 | /* R */ |
| 2257 | 2257 | data = (snapdata[11] & 0x07f) | ((snapdata[12] & 0x01) << 7); |
| 2258 | | cpu_set_reg(machine.device("maincpu"), Z80_R, data); |
| 2258 | machine.device("maincpu")->state().set_state_int(Z80_R, data); |
| 2259 | 2259 | |
| 2260 | 2260 | /* Set border color */ |
| 2261 | 2261 | state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | ((snapdata[12] & 0x0e) >> 1); |
| r17797 | r17798 | |
| 2263 | 2263 | |
| 2264 | 2264 | lo = snapdata[13] & 0x0ff; |
| 2265 | 2265 | hi = snapdata[14] & 0x0ff; |
| 2266 | | cpu_set_reg(machine.device("maincpu"), Z80_DE, (hi << 8) | lo); |
| 2266 | machine.device("maincpu")->state().set_state_int(Z80_DE, (hi << 8) | lo); |
| 2267 | 2267 | |
| 2268 | 2268 | lo = snapdata[15] & 0x0ff; |
| 2269 | 2269 | hi = snapdata[16] & 0x0ff; |
| 2270 | | cpu_set_reg(machine.device("maincpu"), Z80_BC2, (hi << 8) | lo); |
| 2270 | machine.device("maincpu")->state().set_state_int(Z80_BC2, (hi << 8) | lo); |
| 2271 | 2271 | |
| 2272 | 2272 | lo = snapdata[17] & 0x0ff; |
| 2273 | 2273 | hi = snapdata[18] & 0x0ff; |
| 2274 | | cpu_set_reg(machine.device("maincpu"), Z80_DE2, (hi << 8) | lo); |
| 2274 | machine.device("maincpu")->state().set_state_int(Z80_DE2, (hi << 8) | lo); |
| 2275 | 2275 | |
| 2276 | 2276 | lo = snapdata[19] & 0x0ff; |
| 2277 | 2277 | hi = snapdata[20] & 0x0ff; |
| 2278 | | cpu_set_reg(machine.device("maincpu"), Z80_HL2, (hi << 8) | lo); |
| 2278 | machine.device("maincpu")->state().set_state_int(Z80_HL2, (hi << 8) | lo); |
| 2279 | 2279 | |
| 2280 | 2280 | hi = snapdata[21] & 0x0ff; |
| 2281 | 2281 | lo = snapdata[22] & 0x0ff; |
| 2282 | | cpu_set_reg(machine.device("maincpu"), Z80_AF2, (hi << 8) | lo); |
| 2282 | machine.device("maincpu")->state().set_state_int(Z80_AF2, (hi << 8) | lo); |
| 2283 | 2283 | |
| 2284 | 2284 | lo = snapdata[23] & 0x0ff; |
| 2285 | 2285 | hi = snapdata[24] & 0x0ff; |
| 2286 | | cpu_set_reg(machine.device("maincpu"), Z80_IY, (hi << 8) | lo); |
| 2286 | machine.device("maincpu")->state().set_state_int(Z80_IY, (hi << 8) | lo); |
| 2287 | 2287 | |
| 2288 | 2288 | lo = snapdata[25] & 0x0ff; |
| 2289 | 2289 | hi = snapdata[26] & 0x0ff; |
| 2290 | | cpu_set_reg(machine.device("maincpu"), Z80_IX, (hi << 8) | lo); |
| 2290 | machine.device("maincpu")->state().set_state_int(Z80_IX, (hi << 8) | lo); |
| 2291 | 2291 | |
| 2292 | 2292 | /* Interrupt Flip/Flop */ |
| 2293 | 2293 | if (snapdata[27] == 0) |
| 2294 | 2294 | { |
| 2295 | | cpu_set_reg(machine.device("maincpu"), Z80_IFF1, (UINT64)0); |
| 2296 | | /* cpu_set_reg(machine.device("maincpu"), Z80_IRQ_STATE, 0); */ |
| 2295 | machine.device("maincpu")->state().set_state_int(Z80_IFF1, (UINT64)0); |
| 2296 | /* machine.device("maincpu")->state().set_state_int(Z80_IRQ_STATE, 0); */ |
| 2297 | 2297 | } |
| 2298 | 2298 | else |
| 2299 | 2299 | { |
| 2300 | | cpu_set_reg(machine.device("maincpu"), Z80_IFF1, 1); |
| 2301 | | /* cpu_set_reg(machine.device("maincpu"), Z80_IRQ_STATE, 1); */ |
| 2300 | machine.device("maincpu")->state().set_state_int(Z80_IFF1, 1); |
| 2301 | /* machine.device("maincpu")->state().set_state_int(Z80_IRQ_STATE, 1); */ |
| 2302 | 2302 | } |
| 2303 | 2303 | |
| 2304 | 2304 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_IRQ0, CLEAR_LINE); |
| r17797 | r17798 | |
| 2314 | 2314 | { |
| 2315 | 2315 | data = 0; |
| 2316 | 2316 | } |
| 2317 | | cpu_set_reg(machine.device("maincpu"), Z80_IFF2, data); |
| 2317 | machine.device("maincpu")->state().set_state_int(Z80_IFF2, data); |
| 2318 | 2318 | |
| 2319 | 2319 | /* Interrupt Mode */ |
| 2320 | | cpu_set_reg(machine.device("maincpu"), Z80_IM, (snapdata[29] & 0x03)); |
| 2320 | machine.device("maincpu")->state().set_state_int(Z80_IM, (snapdata[29] & 0x03)); |
| 2321 | 2321 | |
| 2322 | 2322 | if (z80_type == SPECTRUM_Z80_SNAPSHOT_48K_OLD) |
| 2323 | 2323 | { |
| 2324 | 2324 | lo = snapdata[6] & 0x0ff; |
| 2325 | 2325 | hi = snapdata[7] & 0x0ff; |
| 2326 | | cpu_set_reg(machine.device("maincpu"), Z80_PC, (hi << 8) | lo); |
| 2326 | machine.device("maincpu")->state().set_state_int(Z80_PC, (hi << 8) | lo); |
| 2327 | 2327 | |
| 2328 | 2328 | spectrum_page_basicrom(machine); |
| 2329 | 2329 | |
| r17797 | r17798 | |
| 2348 | 2348 | |
| 2349 | 2349 | lo = snapdata[32] & 0x0ff; |
| 2350 | 2350 | hi = snapdata[33] & 0x0ff; |
| 2351 | | cpu_set_reg(machine.device("maincpu"), Z80_PC, (hi << 8) | lo); |
| 2351 | machine.device("maincpu")->state().set_state_int(Z80_PC, (hi << 8) | lo); |
| 2352 | 2352 | |
| 2353 | 2353 | if ((z80_type == SPECTRUM_Z80_SNAPSHOT_128K) || ((z80_type == SPECTRUM_Z80_SNAPSHOT_TS2068) && !strcmp(machine.system().name,"ts2068"))) |
| 2354 | 2354 | { |
trunk/src/mess/drivers/pdp1.c
| r17797 | r17798 | |
| 935 | 935 | state->m_tape_reader.rcl = 0; |
| 936 | 936 | if (state->m_tape_reader.rcp) |
| 937 | 937 | { |
| 938 | | cpu_set_reg(machine.device("maincpu"), PDP1_IO, state->m_tape_reader.rb); /* transfer reader buffer to IO */ |
| 938 | machine.device("maincpu")->state().set_state_int(PDP1_IO, state->m_tape_reader.rb); /* transfer reader buffer to IO */ |
| 939 | 939 | pdp1_pulse_iot_done(machine.device("maincpu")); |
| 940 | 940 | } |
| 941 | 941 | else |
| r17797 | r17798 | |
| 1444 | 1444 | { |
| 1445 | 1445 | state->m_io_status |= io_st_pen; |
| 1446 | 1446 | |
| 1447 | | cpu_set_reg(device->machine().device("maincpu"), PDP1_PF3, 1); |
| 1447 | device->machine().device("maincpu")->state().set_state_int(PDP1_PF3, 1); |
| 1448 | 1448 | } |
| 1449 | 1449 | |
| 1450 | 1450 | if (nac) |
| r17797 | r17798 | |
| 1606 | 1606 | } while (state->m_parallel_drum.wc); |
| 1607 | 1607 | device_adjust_icount(device->machine().device("maincpu"),-device->machine().device<cpu_device>("maincpu")->attotime_to_cycles(delay)); |
| 1608 | 1608 | /* if no error, skip */ |
| 1609 | | cpu_set_reg(device->machine().device("maincpu"), PDP1_PC, cpu_get_reg(device->machine().device("maincpu"), PDP1_PC)+1); |
| 1609 | device->machine().device("maincpu")->state().set_state_int(PDP1_PC, device->machine().device("maincpu")->state().state_int(PDP1_PC)+1); |
| 1610 | 1610 | } |
| 1611 | 1611 | |
| 1612 | 1612 | static void iot_dra(device_t *device, int op2, int nac, int mb, int *io, int ac) |
| r17797 | r17798 | |
| 1737 | 1737 | #if USE_SBS |
| 1738 | 1738 | cputag_set_input_line_and_vector(machine, "maincpu", 0, ASSERT_LINE, 0); /* interrupt it, baby */ |
| 1739 | 1739 | #endif |
| 1740 | | cpu_set_reg(machine.device("maincpu"), PDP1_PF1, 1); |
| 1740 | machine.device("maincpu")->state().set_state_int(PDP1_PF1, 1); |
| 1741 | 1741 | pdp1_typewriter_drawchar(machine, state->m_typewriter.tb); /* we want to echo input */ |
| 1742 | 1742 | break; |
| 1743 | 1743 | } |
| r17797 | r17798 | |
| 1816 | 1816 | int ta_transitions; |
| 1817 | 1817 | |
| 1818 | 1818 | |
| 1819 | | cpu_set_reg(device, PDP1_SS, device->machine().root_device().ioport("SENSE")->read()); |
| 1819 | device->state().set_state_int(PDP1_SS, device->machine().root_device().ioport("SENSE")->read()); |
| 1820 | 1820 | |
| 1821 | 1821 | /* read new state of control keys */ |
| 1822 | 1822 | control_keys = state->ioport("CSW")->read(); |
| r17797 | r17798 | |
| 1828 | 1828 | |
| 1829 | 1829 | if (control_transitions & pdp1_extend) |
| 1830 | 1830 | { |
| 1831 | | cpu_set_reg(device, PDP1_EXTEND_SW, ! cpu_get_reg(device, PDP1_EXTEND_SW)); |
| 1831 | device->state().set_state_int(PDP1_EXTEND_SW, ! device->state().state_int(PDP1_EXTEND_SW)); |
| 1832 | 1832 | } |
| 1833 | 1833 | if (control_transitions & pdp1_start_nobrk) |
| 1834 | 1834 | { |
| 1835 | 1835 | pdp1_pulse_start_clear(device); /* pulse Start Clear line */ |
| 1836 | | cpu_set_reg(device, PDP1_EXD, cpu_get_reg(device, PDP1_EXTEND_SW)); |
| 1837 | | cpu_set_reg(device, PDP1_SBM, (UINT64)0); |
| 1838 | | cpu_set_reg(device, PDP1_OV, (UINT64)0); |
| 1839 | | cpu_set_reg(device, PDP1_PC, cpu_get_reg(device, PDP1_TA)); |
| 1840 | | cpu_set_reg(device, PDP1_RUN, 1); |
| 1836 | device->state().set_state_int(PDP1_EXD, device->state().state_int(PDP1_EXTEND_SW)); |
| 1837 | device->state().set_state_int(PDP1_SBM, (UINT64)0); |
| 1838 | device->state().set_state_int(PDP1_OV, (UINT64)0); |
| 1839 | device->state().set_state_int(PDP1_PC, device->state().state_int(PDP1_TA)); |
| 1840 | device->state().set_state_int(PDP1_RUN, 1); |
| 1841 | 1841 | } |
| 1842 | 1842 | if (control_transitions & pdp1_start_brk) |
| 1843 | 1843 | { |
| 1844 | 1844 | pdp1_pulse_start_clear(device); /* pulse Start Clear line */ |
| 1845 | | cpu_set_reg(device, PDP1_EXD, cpu_get_reg(device, PDP1_EXTEND_SW)); |
| 1846 | | cpu_set_reg(device, PDP1_SBM, 1); |
| 1847 | | cpu_set_reg(device, PDP1_OV, (UINT64)0); |
| 1848 | | cpu_set_reg(device, PDP1_PC, cpu_get_reg(device, PDP1_TA)); |
| 1849 | | cpu_set_reg(device, PDP1_RUN, 1); |
| 1845 | device->state().set_state_int(PDP1_EXD, device->state().state_int(PDP1_EXTEND_SW)); |
| 1846 | device->state().set_state_int(PDP1_SBM, 1); |
| 1847 | device->state().set_state_int(PDP1_OV, (UINT64)0); |
| 1848 | device->state().set_state_int(PDP1_PC, device->state().state_int(PDP1_TA)); |
| 1849 | device->state().set_state_int(PDP1_RUN, 1); |
| 1850 | 1850 | } |
| 1851 | 1851 | if (control_transitions & pdp1_stop) |
| 1852 | 1852 | { |
| 1853 | | cpu_set_reg(device, PDP1_RUN, (UINT64)0); |
| 1854 | | cpu_set_reg(device, PDP1_RIM, (UINT64)0); /* bug : we stop after reading an even-numbered word |
| 1853 | device->state().set_state_int(PDP1_RUN, (UINT64)0); |
| 1854 | device->state().set_state_int(PDP1_RIM, (UINT64)0); /* bug : we stop after reading an even-numbered word |
| 1855 | 1855 | (i.e. data), whereas a real pdp-1 stops after reading |
| 1856 | 1856 | an odd-numbered word (i.e. dio instruciton) */ |
| 1857 | 1857 | } |
| 1858 | 1858 | if (control_transitions & pdp1_continue) |
| 1859 | 1859 | { |
| 1860 | | cpu_set_reg(device, PDP1_RUN, 1); |
| 1860 | device->state().set_state_int(PDP1_RUN, 1); |
| 1861 | 1861 | } |
| 1862 | 1862 | if (control_transitions & pdp1_examine) |
| 1863 | 1863 | { |
| 1864 | 1864 | pdp1_pulse_start_clear(device); /* pulse Start Clear line */ |
| 1865 | | cpu_set_reg(device, PDP1_PC, cpu_get_reg(device, PDP1_TA)); |
| 1866 | | cpu_set_reg(device, PDP1_MA, cpu_get_reg(device, PDP1_PC)); |
| 1867 | | cpu_set_reg(device, PDP1_IR, LAC); /* this instruction is actually executed */ |
| 1865 | device->state().set_state_int(PDP1_PC, device->state().state_int(PDP1_TA)); |
| 1866 | device->state().set_state_int(PDP1_MA, device->state().state_int(PDP1_PC)); |
| 1867 | device->state().set_state_int(PDP1_IR, LAC); /* this instruction is actually executed */ |
| 1868 | 1868 | |
| 1869 | | cpu_set_reg(device, PDP1_MB, (signed)device->memory().space(AS_PROGRAM)->read_dword(PDP1_MA<<2)); |
| 1870 | | cpu_set_reg(device, PDP1_AC, cpu_get_reg(device, PDP1_MB)); |
| 1869 | device->state().set_state_int(PDP1_MB, (signed)device->memory().space(AS_PROGRAM)->read_dword(PDP1_MA<<2)); |
| 1870 | device->state().set_state_int(PDP1_AC, device->state().state_int(PDP1_MB)); |
| 1871 | 1871 | } |
| 1872 | 1872 | if (control_transitions & pdp1_deposit) |
| 1873 | 1873 | { |
| 1874 | 1874 | pdp1_pulse_start_clear(device); /* pulse Start Clear line */ |
| 1875 | | cpu_set_reg(device, PDP1_PC, cpu_get_reg(device, PDP1_TA)); |
| 1876 | | cpu_set_reg(device, PDP1_MA, cpu_get_reg(device, PDP1_PC)); |
| 1877 | | cpu_set_reg(device, PDP1_AC, cpu_get_reg(device, PDP1_TW)); |
| 1878 | | cpu_set_reg(device, PDP1_IR, DAC); /* this instruction is actually executed */ |
| 1875 | device->state().set_state_int(PDP1_PC, device->state().state_int(PDP1_TA)); |
| 1876 | device->state().set_state_int(PDP1_MA, device->state().state_int(PDP1_PC)); |
| 1877 | device->state().set_state_int(PDP1_AC, device->state().state_int(PDP1_TW)); |
| 1878 | device->state().set_state_int(PDP1_IR, DAC); /* this instruction is actually executed */ |
| 1879 | 1879 | |
| 1880 | | cpu_set_reg(device, PDP1_MB, cpu_get_reg(device, PDP1_AC)); |
| 1881 | | device->memory().space(AS_PROGRAM)->write_dword(cpu_get_reg(device, PDP1_MA)<<2, cpu_get_reg(device, PDP1_MB)); |
| 1880 | device->state().set_state_int(PDP1_MB, device->state().state_int(PDP1_AC)); |
| 1881 | device->memory().space(AS_PROGRAM)->write_dword(device->state().state_int(PDP1_MA)<<2, device->state().state_int(PDP1_MB)); |
| 1882 | 1882 | } |
| 1883 | 1883 | if (control_transitions & pdp1_read_in) |
| 1884 | 1884 | { /* set cpu to read instructions from perforated tape */ |
| 1885 | 1885 | pdp1_pulse_start_clear(device); /* pulse Start Clear line */ |
| 1886 | | cpu_set_reg(device, PDP1_PC, ( cpu_get_reg(device, PDP1_TA) & 0170000) |
| 1887 | | | (cpu_get_reg(device, PDP1_PC) & 0007777)); /* transfer ETA to EPC */ |
| 1888 | | /*cpu_set_reg(machine.device("maincpu"), PDP1_MA, cpu_get_reg(machine.device("maincpu"), PDP1_PC));*/ |
| 1889 | | cpu_set_reg(device, PDP1_EXD, cpu_get_reg(device, PDP1_EXTEND_SW)); |
| 1890 | | cpu_set_reg(device, PDP1_OV, (UINT64)0); /* right??? */ |
| 1891 | | cpu_set_reg(device, PDP1_RUN, (UINT64)0); |
| 1892 | | cpu_set_reg(device, PDP1_RIM, 1); |
| 1886 | device->state().set_state_int(PDP1_PC, ( device->state().state_int(PDP1_TA) & 0170000) |
| 1887 | | (device->state().state_int(PDP1_PC) & 0007777)); /* transfer ETA to EPC */ |
| 1888 | /*machine.device("maincpu")->state().set_state_int(PDP1_MA, machine.device("maincpu")->state().state_int(PDP1_PC));*/ |
| 1889 | device->state().set_state_int(PDP1_EXD, device->state().state_int(PDP1_EXTEND_SW)); |
| 1890 | device->state().set_state_int(PDP1_OV, (UINT64)0); /* right??? */ |
| 1891 | device->state().set_state_int(PDP1_RUN, (UINT64)0); |
| 1892 | device->state().set_state_int(PDP1_RIM, 1); |
| 1893 | 1893 | } |
| 1894 | 1894 | if (control_transitions & pdp1_reader) |
| 1895 | 1895 | { |
| r17797 | r17798 | |
| 1899 | 1899 | } |
| 1900 | 1900 | if (control_transitions & pdp1_single_step) |
| 1901 | 1901 | { |
| 1902 | | cpu_set_reg(device, PDP1_SNGL_STEP, ! cpu_get_reg(device, PDP1_SNGL_STEP)); |
| 1902 | device->state().set_state_int(PDP1_SNGL_STEP, ! device->state().state_int(PDP1_SNGL_STEP)); |
| 1903 | 1903 | } |
| 1904 | 1904 | if (control_transitions & pdp1_single_inst) |
| 1905 | 1905 | { |
| 1906 | | cpu_set_reg(device, PDP1_SNGL_INST, ! cpu_get_reg(device, PDP1_SNGL_INST)); |
| 1906 | device->state().set_state_int(PDP1_SNGL_INST, ! device->state().state_int(PDP1_SNGL_INST)); |
| 1907 | 1907 | } |
| 1908 | 1908 | |
| 1909 | 1909 | /* remember new state of control keys */ |
| r17797 | r17798 | |
| 1917 | 1917 | tw_transitions = tw_keys & (~ state->m_old_tw_keys); |
| 1918 | 1918 | |
| 1919 | 1919 | if (tw_transitions) |
| 1920 | | cpu_set_reg(device, PDP1_TW, cpu_get_reg(device, PDP1_TW) ^ tw_transitions); |
| 1920 | device->state().set_state_int(PDP1_TW, device->state().state_int(PDP1_TW) ^ tw_transitions); |
| 1921 | 1921 | |
| 1922 | 1922 | /* remember new state of test word keys */ |
| 1923 | 1923 | state->m_old_tw_keys = tw_keys; |
| r17797 | r17798 | |
| 1930 | 1930 | ta_transitions = ta_keys & (~ state->m_old_ta_keys); |
| 1931 | 1931 | |
| 1932 | 1932 | if (ta_transitions) |
| 1933 | | cpu_set_reg(device, PDP1_TA, cpu_get_reg(device, PDP1_TA) ^ ta_transitions); |
| 1933 | device->state().set_state_int(PDP1_TA, device->state().state_int(PDP1_TA) ^ ta_transitions); |
| 1934 | 1934 | |
| 1935 | 1935 | /* remember new state of test word keys */ |
| 1936 | 1936 | state->m_old_ta_keys = ta_keys; |
trunk/src/mess/drivers/tx0.c
| r17797 | r17798 | |
| 652 | 652 | if (data & 0100) |
| 653 | 653 | { |
| 654 | 654 | /* read current AC */ |
| 655 | | ac = cpu_get_reg(machine.device("maincpu"), TX0_AC); |
| 655 | ac = machine.device("maincpu")->state().state_int(TX0_AC); |
| 656 | 656 | /* cycle right */ |
| 657 | 657 | ac = (ac >> 1) | ((ac & 1) << 17); |
| 658 | 658 | /* shuffle and insert data into AC */ |
| 659 | 659 | ac = (ac /*& 0333333*/) | ((data & 001) << 17) | ((data & 002) << 13) | ((data & 004) << 9) | ((data & 010) << 5) | ((data & 020) << 1) | ((data & 040) >> 3); |
| 660 | 660 | /* write modified AC */ |
| 661 | | cpu_set_reg(machine.device("maincpu"), TX0_AC, ac); |
| 661 | machine.device("maincpu")->state().set_state_int(TX0_AC, ac); |
| 662 | 662 | |
| 663 | 663 | state->m_tape_reader.rc = (state->m_tape_reader.rc+1) & 3; |
| 664 | 664 | |
| 665 | 665 | if (state->m_tape_reader.rc == 0) |
| 666 | 666 | { /* IO complete */ |
| 667 | 667 | state->m_tape_reader.rcl = 0; |
| 668 | | cpu_set_reg(machine.device("maincpu"), TX0_IO_COMPLETE, (UINT64)0); |
| 668 | machine.device("maincpu")->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0); |
| 669 | 669 | } |
| 670 | 670 | } |
| 671 | 671 | } |
| r17797 | r17798 | |
| 701 | 701 | |
| 702 | 702 | static TIMER_CALLBACK(puncher_callback) |
| 703 | 703 | { |
| 704 | | cpu_set_reg(machine.device("maincpu"), TX0_IO_COMPLETE, (UINT64)0); |
| 704 | machine.device("maincpu")->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0); |
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | /* |
| r17797 | r17798 | |
| 731 | 731 | int ac; |
| 732 | 732 | |
| 733 | 733 | /* read current AC */ |
| 734 | | ac = cpu_get_reg(device, TX0_AC); |
| 734 | ac = device->state().state_int(TX0_AC); |
| 735 | 735 | /* shuffle and punch 6-bit word */ |
| 736 | 736 | tape_write(state, ((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5)); |
| 737 | 737 | |
| r17797 | r17798 | |
| 747 | 747 | int ac; |
| 748 | 748 | |
| 749 | 749 | /* read current AC */ |
| 750 | | ac = cpu_get_reg(device, TX0_AC); |
| 750 | ac = device->state().state_int(TX0_AC); |
| 751 | 751 | /* shuffle and punch 6-bit word */ |
| 752 | 752 | tape_write(state, ((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5) | 0100); |
| 753 | 753 | |
| r17797 | r17798 | |
| 796 | 796 | */ |
| 797 | 797 | static TIMER_CALLBACK(prt_callback) |
| 798 | 798 | { |
| 799 | | cpu_set_reg(machine.device("maincpu"), TX0_IO_COMPLETE, (UINT64)0); |
| 799 | machine.device("maincpu")->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0); |
| 800 | 800 | } |
| 801 | 801 | |
| 802 | 802 | /* |
| r17797 | r17798 | |
| 809 | 809 | int ch; |
| 810 | 810 | |
| 811 | 811 | /* read current AC */ |
| 812 | | ac = cpu_get_reg(device, TX0_AC); |
| 812 | ac = device->state().state_int(TX0_AC); |
| 813 | 813 | /* shuffle and print 6-bit word */ |
| 814 | 814 | ch = ((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5); |
| 815 | 815 | typewriter_out(device->machine(), ch); |
| r17797 | r17798 | |
| 823 | 823 | */ |
| 824 | 824 | static TIMER_CALLBACK(dis_callback) |
| 825 | 825 | { |
| 826 | | cpu_set_reg(machine.device("maincpu"), TX0_IO_COMPLETE, (UINT64)0); |
| 826 | machine.device("maincpu")->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0); |
| 827 | 827 | } |
| 828 | 828 | |
| 829 | 829 | /* |
| r17797 | r17798 | |
| 836 | 836 | int x; |
| 837 | 837 | int y; |
| 838 | 838 | |
| 839 | | ac = cpu_get_reg(device, TX0_AC); |
| 839 | ac = device->state().state_int(TX0_AC); |
| 840 | 840 | x = ac >> 9; |
| 841 | 841 | y = ac & 0777; |
| 842 | 842 | tx0_plot(device->machine(), x, y); |
| r17797 | r17798 | |
| 941 | 941 | if ((state->m_magtape.state == MTS_SELECTED) || ((state->m_magtape.state == MTS_SELECTING) && (state->m_magtape.command == 2))) |
| 942 | 942 | { /* unit has become unavailable */ |
| 943 | 943 | state->m_magtape.state = MTS_UNSELECTING; |
| 944 | | cpu_set_reg(machine().device("maincpu"), TX0_PF, cpu_get_reg(machine().device("maincpu"), TX0_PF) | PF_RWC); |
| 944 | machine().device("maincpu")->state().set_state_int(TX0_PF, machine().device("maincpu")->state().state_int(TX0_PF) | PF_RWC); |
| 945 | 945 | schedule_unselect(state); |
| 946 | 946 | } |
| 947 | 947 | } |
| r17797 | r17798 | |
| 963 | 963 | { |
| 964 | 964 | int mar; |
| 965 | 965 | |
| 966 | | mar = cpu_get_reg(device, TX0_MAR); |
| 966 | mar = device->state().state_int(TX0_MAR); |
| 967 | 967 | |
| 968 | 968 | if ((mar & 03) != 1) |
| 969 | 969 | { /* unimplemented device: remain in unselected state and set rwc |
| 970 | 970 | flag? */ |
| 971 | | cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_RWC); |
| 971 | device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_RWC); |
| 972 | 972 | } |
| 973 | 973 | else |
| 974 | 974 | { |
| r17797 | r17798 | |
| 983 | 983 | } |
| 984 | 984 | |
| 985 | 985 | state->m_magtape.sel_pending = FALSE; |
| 986 | | cpu_set_reg(device, TX0_IO_COMPLETE, (UINT64)0); |
| 986 | device->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0); |
| 987 | 987 | } |
| 988 | 988 | break; |
| 989 | 989 | |
| r17797 | r17798 | |
| 1026 | 1026 | if (state->m_magtape.img->ftell() == 0) |
| 1027 | 1027 | { /* tape at ldp */ |
| 1028 | 1028 | state->m_magtape.state = MTS_UNSELECTING; |
| 1029 | | cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_RWC); |
| 1029 | device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_RWC); |
| 1030 | 1030 | schedule_unselect(state); |
| 1031 | 1031 | } |
| 1032 | 1032 | else if (state->m_magtape.img->fseek( -1, SEEK_CUR)) |
| r17797 | r17798 | |
| 1095 | 1095 | logerror("invalid longitudinal parity\n"); |
| 1096 | 1096 | /* set EOR and unselect... */ |
| 1097 | 1097 | state->m_magtape.state = MTS_UNSELECTING; |
| 1098 | | cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_EOR); |
| 1098 | device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_EOR); |
| 1099 | 1099 | schedule_unselect(state); |
| 1100 | 1100 | state->m_magtape.irg_pos = MTIRGP_ENDMINUS1; |
| 1101 | 1101 | } |
| r17797 | r17798 | |
| 1151 | 1151 | /*state->m_magtape.img->unload();*/ |
| 1152 | 1152 | /* Or do we stop at EOT mark??? */ |
| 1153 | 1153 | state->m_magtape.state = MTS_UNSELECTING; |
| 1154 | | cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_EOT); |
| 1154 | device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_EOT); |
| 1155 | 1155 | schedule_unselect(state); |
| 1156 | 1156 | } |
| 1157 | 1157 | } |
| r17797 | r17798 | |
| 1168 | 1168 | if (state->m_magtape.cpy_pending) |
| 1169 | 1169 | { /* read command */ |
| 1170 | 1170 | state->m_magtape.u.read.space_flag = FALSE; |
| 1171 | | cpu_set_reg(device, TX0_IO_COMPLETE, (UINT64)0); |
| 1172 | | cpu_set_reg(device, TX0_LR, ((cpu_get_reg(device, TX0_LR) >> 1) & 0333333) |
| 1171 | device->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0); |
| 1172 | device->state().set_state_int(TX0_LR, ((device->state().state_int(TX0_LR) >> 1) & 0333333) |
| 1173 | 1173 | | ((buf & 040) << 12) | ((buf & 020) << 10) | ((buf & 010) << 8) | ((buf & 004) << 6) | ((buf & 002) << 4) | ((buf & 001) << 2)); |
| 1174 | 1174 | /* check parity */ |
| 1175 | 1175 | if (! (((buf ^ (buf >> 1) ^ (buf >> 2) ^ (buf >> 3) ^ (buf >> 4) ^ (buf >> 5) ^ (buf >> 6) ^ (buf >> 7)) & 1) ^ state->m_magtape.binary_flag)) |
| 1176 | | cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_PC); |
| 1176 | device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_PC); |
| 1177 | 1177 | } |
| 1178 | 1178 | else |
| 1179 | 1179 | { /* space command */ |
| r17797 | r17798 | |
| 1192 | 1192 | } |
| 1193 | 1193 | if (!state->m_magtape.u.read.space_flag) |
| 1194 | 1194 | { |
| 1195 | | cpu_set_reg(device, TX0_LR, ((cpu_get_reg(device, TX0_LR) >> 1) & 0333333) |
| 1195 | device->state().set_state_int(TX0_LR, ((device->state().state_int(TX0_LR) >> 1) & 0333333) |
| 1196 | 1196 | | ((buf & 040) << 12) | ((buf & 020) << 10) | ((buf & 010) << 8) | ((buf & 004) << 6) | ((buf & 002) << 4) | ((buf & 001) << 2)); |
| 1197 | 1197 | /* check parity */ |
| 1198 | 1198 | if (! (((buf ^ (buf >> 1) ^ (buf >> 2) ^ (buf >> 3) ^ (buf >> 4) ^ (buf >> 5) ^ (buf >> 6) ^ (buf >> 7)) & 1) ^ state->m_magtape.binary_flag)) |
| 1199 | | cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_PC); |
| 1199 | device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_PC); |
| 1200 | 1200 | } |
| 1201 | 1201 | state->m_magtape.u.read.state = MTRDS_STATE2; |
| 1202 | 1202 | break; |
| r17797 | r17798 | |
| 1210 | 1210 | } |
| 1211 | 1211 | if (!state->m_magtape.u.read.space_flag) |
| 1212 | 1212 | { |
| 1213 | | cpu_set_reg(device, TX0_LR, ((cpu_get_reg(device, TX0_LR) >> 1) & 0333333) |
| 1213 | device->state().set_state_int(TX0_LR, ((device->state().state_int(TX0_LR) >> 1) & 0333333) |
| 1214 | 1214 | | ((buf & 040) << 12) | ((buf & 020) << 10) | ((buf & 010) << 8) | ((buf & 004) << 6) | ((buf & 002) << 4) | ((buf & 001) << 2)); |
| 1215 | 1215 | /* check parity */ |
| 1216 | 1216 | if (! (((buf ^ (buf >> 1) ^ (buf >> 2) ^ (buf >> 3) ^ (buf >> 4) ^ (buf >> 5) ^ (buf >> 6) ^ (buf >> 7)) & 1) ^ state->m_magtape.binary_flag)) |
| 1217 | | cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_PC); |
| 1217 | device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_PC); |
| 1218 | 1218 | /* synchronize with cpy instruction */ |
| 1219 | 1219 | if (state->m_magtape.cpy_pending) |
| 1220 | | cpu_set_reg(device, TX0_IO_COMPLETE, (UINT64)0); |
| 1220 | device->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0); |
| 1221 | 1221 | else |
| 1222 | | cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_RWC); |
| 1222 | device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_RWC); |
| 1223 | 1223 | } |
| 1224 | 1224 | state->m_magtape.u.read.state = MTRDS_STATE3; |
| 1225 | 1225 | break; |
| r17797 | r17798 | |
| 1231 | 1231 | state->m_magtape.u.read.state = MTRDS_STATE1; |
| 1232 | 1232 | if (!state->m_magtape.u.read.space_flag) |
| 1233 | 1233 | { |
| 1234 | | cpu_set_reg(device, TX0_LR, ((cpu_get_reg(device, TX0_LR) >> 1) & 0333333) |
| 1234 | device->state().set_state_int(TX0_LR, ((device->state().state_int(TX0_LR) >> 1) & 0333333) |
| 1235 | 1235 | | ((buf & 040) << 12) | ((buf & 020) << 10) | ((buf & 010) << 8) | ((buf & 004) << 6) | ((buf & 002) << 4) | ((buf & 001) << 2)); |
| 1236 | 1236 | /* check parity */ |
| 1237 | 1237 | if (! (((buf ^ (buf >> 1) ^ (buf >> 2) ^ (buf >> 3) ^ (buf >> 4) ^ (buf >> 5) ^ (buf >> 6) ^ (buf >> 7)) & 1) ^ state->m_magtape.binary_flag)) |
| 1238 | | cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_PC); |
| 1238 | device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_PC); |
| 1239 | 1239 | } |
| 1240 | 1240 | } |
| 1241 | 1241 | else |
| r17797 | r17798 | |
| 1275 | 1275 | logerror("invalid longitudinal parity\n"); |
| 1276 | 1276 | /* no idea if the original tx-0 magtape controller |
| 1277 | 1277 | checks parity, but can't harm if we do */ |
| 1278 | | cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_PC); |
| 1278 | device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_PC); |
| 1279 | 1279 | } |
| 1280 | 1280 | /* set EOR and unselect... */ |
| 1281 | 1281 | state->m_magtape.state = MTS_UNSELECTING; |
| 1282 | | cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_EOR); |
| 1282 | device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_EOR); |
| 1283 | 1283 | schedule_unselect(state); |
| 1284 | 1284 | state->m_magtape.irg_pos = MTIRGP_START; |
| 1285 | 1285 | break; |
| r17797 | r17798 | |
| 1317 | 1317 | if (state->m_magtape.u.write.counter) |
| 1318 | 1318 | { |
| 1319 | 1319 | state->m_magtape.u.write.counter--; |
| 1320 | | lr = cpu_get_reg(device, TX0_LR); |
| 1320 | lr = device->state().state_int(TX0_LR); |
| 1321 | 1321 | buf = ((lr >> 10) & 040) | ((lr >> 8) & 020) | ((lr >> 6) & 010) | ((lr >> 4) & 004) | ((lr >> 2) & 002) | (lr & 001); |
| 1322 | 1322 | buf |= ((buf << 1) ^ (buf << 2) ^ (buf << 3) ^ (buf << 4) ^ (buf << 5) ^ (buf << 6) ^ ((!state->m_magtape.binary_flag) << 6)) & 0100; |
| 1323 | | cpu_set_reg(device, TX0_LR, lr >> 1); |
| 1323 | device->state().set_state_int(TX0_LR, lr >> 1); |
| 1324 | 1324 | } |
| 1325 | 1325 | else |
| 1326 | 1326 | { |
| 1327 | 1327 | if (state->m_magtape.cpy_pending) |
| 1328 | 1328 | { |
| 1329 | | cpu_set_reg(device, TX0_IO_COMPLETE, (UINT64)0); |
| 1330 | | lr = cpu_get_reg(device, TX0_LR); |
| 1329 | device->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0); |
| 1330 | lr = device->state().state_int(TX0_LR); |
| 1331 | 1331 | buf = ((lr >> 10) & 040) | ((lr >> 8) & 020) | ((lr >> 6) & 010) | ((lr >> 4) & 004) | ((lr >> 2) & 002) | (lr & 001); |
| 1332 | 1332 | buf |= ((buf << 1) ^ (buf << 2) ^ (buf << 3) ^ (buf << 4) ^ (buf << 5) ^ (buf << 6) ^ ((!state->m_magtape.binary_flag) << 6)) & 0100; |
| 1333 | | cpu_set_reg(device, TX0_LR, lr >> 1); |
| 1333 | device->state().set_state_int(TX0_LR, lr >> 1); |
| 1334 | 1334 | state->m_magtape.u.write.counter = 2; |
| 1335 | 1335 | break; |
| 1336 | 1336 | } |
| r17797 | r17798 | |
| 1409 | 1409 | case MTS_UNSELECTED: |
| 1410 | 1410 | case MTS_UNSELECTING: |
| 1411 | 1411 | /* ignore instruction and set rwc flag? */ |
| 1412 | | cpu_set_reg(device, TX0_IO_COMPLETE, (UINT64)0); |
| 1412 | device->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0); |
| 1413 | 1413 | break; |
| 1414 | 1414 | |
| 1415 | 1415 | case MTS_SELECTING: |
| r17797 | r17798 | |
| 1419 | 1419 | case 0: /* backspace */ |
| 1420 | 1420 | case 2: /* rewind */ |
| 1421 | 1421 | /* ignore instruction and set rwc flag? */ |
| 1422 | | cpu_set_reg(device, TX0_IO_COMPLETE, (UINT64)0); |
| 1422 | device->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0); |
| 1423 | 1423 | break; |
| 1424 | 1424 | case 1: /* read */ |
| 1425 | 1425 | case 3: /* write */ |
| r17797 | r17798 | |
| 1487 | 1487 | previous LR */ |
| 1488 | 1488 | lr = (1 << 17) | ((charcode & 040) << 10) | ((charcode & 020) << 8) | ((charcode & 010) << 6) | ((charcode & 004) << 4) | ((charcode & 002) << 2) | ((charcode & 001) << 1); |
| 1489 | 1489 | /* write modified LR */ |
| 1490 | | cpu_set_reg(machine.device("maincpu"), TX0_LR, lr); |
| 1490 | machine.device("maincpu")->state().set_state_int(TX0_LR, lr); |
| 1491 | 1491 | tx0_typewriter_drawchar(machine, charcode); /* we want to echo input */ |
| 1492 | 1492 | break; |
| 1493 | 1493 | } |
| r17797 | r17798 | |
| 1520 | 1520 | |
| 1521 | 1521 | if (control_transitions & tx0_stop_cyc0) |
| 1522 | 1522 | { |
| 1523 | | cpu_set_reg(device->machine().device("maincpu"), TX0_STOP_CYC0, !cpu_get_reg(device->machine().device("maincpu"), TX0_STOP_CYC0)); |
| 1523 | device->machine().device("maincpu")->state().set_state_int(TX0_STOP_CYC0, !device->machine().device("maincpu")->state().state_int(TX0_STOP_CYC0)); |
| 1524 | 1524 | } |
| 1525 | 1525 | if (control_transitions & tx0_stop_cyc1) |
| 1526 | 1526 | { |
| 1527 | | cpu_set_reg(device->machine().device("maincpu"), TX0_STOP_CYC1, !cpu_get_reg(device->machine().device("maincpu"), TX0_STOP_CYC1)); |
| 1527 | device->machine().device("maincpu")->state().set_state_int(TX0_STOP_CYC1, !device->machine().device("maincpu")->state().state_int(TX0_STOP_CYC1)); |
| 1528 | 1528 | } |
| 1529 | 1529 | if (control_transitions & tx0_gbl_cm_sel) |
| 1530 | 1530 | { |
| 1531 | | cpu_set_reg(device->machine().device("maincpu"), TX0_GBL_CM_SEL, !cpu_get_reg(device->machine().device("maincpu"), TX0_GBL_CM_SEL)); |
| 1531 | device->machine().device("maincpu")->state().set_state_int(TX0_GBL_CM_SEL, !device->machine().device("maincpu")->state().state_int(TX0_GBL_CM_SEL)); |
| 1532 | 1532 | } |
| 1533 | 1533 | if (control_transitions & tx0_stop) |
| 1534 | 1534 | { |
| 1535 | | cpu_set_reg(device->machine().device("maincpu"), TX0_RUN, (UINT64)0); |
| 1536 | | cpu_set_reg(device->machine().device("maincpu"), TX0_RIM, (UINT64)0); |
| 1535 | device->machine().device("maincpu")->state().set_state_int(TX0_RUN, (UINT64)0); |
| 1536 | device->machine().device("maincpu")->state().set_state_int(TX0_RIM, (UINT64)0); |
| 1537 | 1537 | } |
| 1538 | 1538 | if (control_transitions & tx0_restart) |
| 1539 | 1539 | { |
| 1540 | | cpu_set_reg(device->machine().device("maincpu"), TX0_RUN, 1); |
| 1541 | | cpu_set_reg(device->machine().device("maincpu"), TX0_RIM, (UINT64)0); |
| 1540 | device->machine().device("maincpu")->state().set_state_int(TX0_RUN, 1); |
| 1541 | device->machine().device("maincpu")->state().set_state_int(TX0_RIM, (UINT64)0); |
| 1542 | 1542 | } |
| 1543 | 1543 | if (control_transitions & tx0_read_in) |
| 1544 | 1544 | { /* set cpu to read instructions from perforated tape */ |
| 1545 | | cpu_set_reg(device->machine().device("maincpu"), TX0_RESET, (UINT64)0); |
| 1546 | | cpu_set_reg(device->machine().device("maincpu"), TX0_RUN, (UINT64)0); |
| 1547 | | cpu_set_reg(device->machine().device("maincpu"), TX0_RIM, 1); |
| 1545 | device->machine().device("maincpu")->state().set_state_int(TX0_RESET, (UINT64)0); |
| 1546 | device->machine().device("maincpu")->state().set_state_int(TX0_RUN, (UINT64)0); |
| 1547 | device->machine().device("maincpu")->state().set_state_int(TX0_RIM, 1); |
| 1548 | 1548 | } |
| 1549 | 1549 | if (control_transitions & tx0_toggle_dn) |
| 1550 | 1550 | { |
| r17797 | r17798 | |
| 1562 | 1562 | { |
| 1563 | 1563 | if (state->m_tsr_index >= 2) |
| 1564 | 1564 | { |
| 1565 | | UINT32 cm_sel = (UINT32) cpu_get_reg(device->machine().device("maincpu"), TX0_CM_SEL); |
| 1566 | | cpu_set_reg(device->machine().device("maincpu"), TX0_CM_SEL, cm_sel ^ (1 << (state->m_tsr_index - 2))); |
| 1565 | UINT32 cm_sel = (UINT32) device->machine().device("maincpu")->state().state_int(TX0_CM_SEL); |
| 1566 | device->machine().device("maincpu")->state().set_state_int(TX0_CM_SEL, cm_sel ^ (1 << (state->m_tsr_index - 2))); |
| 1567 | 1567 | } |
| 1568 | 1568 | } |
| 1569 | 1569 | if (control_transitions & tx0_lr_sel) |
| 1570 | 1570 | { |
| 1571 | 1571 | if (state->m_tsr_index >= 2) |
| 1572 | 1572 | { |
| 1573 | | UINT32 lr_sel = (UINT32) cpu_get_reg(device->machine().device("maincpu"), TX0_LR_SEL); |
| 1574 | | cpu_set_reg(device->machine().device("maincpu"), TX0_LR_SEL, (lr_sel ^ (1 << (state->m_tsr_index - 2)))); |
| 1573 | UINT32 lr_sel = (UINT32) device->machine().device("maincpu")->state().state_int(TX0_LR_SEL); |
| 1574 | device->machine().device("maincpu")->state().set_state_int(TX0_LR_SEL, (lr_sel ^ (1 << (state->m_tsr_index - 2)))); |
| 1575 | 1575 | } |
| 1576 | 1576 | } |
| 1577 | 1577 | |
| r17797 | r17798 | |
| 1587 | 1587 | |
| 1588 | 1588 | /* update toggle switch register */ |
| 1589 | 1589 | if (tsr_transitions) |
| 1590 | | cpu_set_reg(device->machine().device("maincpu"), TX0_TBR+state->m_tsr_index, cpu_get_reg(device->machine().device("maincpu"), TX0_TBR+state->m_tsr_index) ^ tsr_transitions); |
| 1590 | device->machine().device("maincpu")->state().set_state_int(TX0_TBR+state->m_tsr_index, device->machine().device("maincpu")->state().state_int(TX0_TBR+state->m_tsr_index) ^ tsr_transitions); |
| 1591 | 1591 | |
| 1592 | 1592 | /* remember new state of toggle switch register keys */ |
| 1593 | 1593 | state->m_old_tsr_keys = tsr_keys; |
trunk/src/mess/drivers/gmaster.c
| r17797 | r17798 | |
| 18 | 18 | if (m_gmachine.ports[2] & 1) |
| 19 | 19 | { |
| 20 | 20 | data = memregion("maincpu")->base()[0x4000 + offset]; |
| 21 | | logerror("%.4x external memory %.4x read %.2x\n", (int)cpu_get_reg(&space.device(), CPUINFO_INT_PC), 0x4000 + offset, data); |
| 21 | logerror("%.4x external memory %.4x read %.2x\n", (int)space.device().state().state_int(CPUINFO_INT_PC), 0x4000 + offset, data); |
| 22 | 22 | } |
| 23 | 23 | else |
| 24 | 24 | { |
| r17797 | r17798 | |
| 26 | 26 | { |
| 27 | 27 | case 1: |
| 28 | 28 | data=m_video.pixels[m_video.y][m_video.x]; |
| 29 | | logerror("%.4x lcd x:%.2x y:%.2x %.4x read %.2x\n", (int)cpu_get_reg(&space.device(), CPUINFO_INT_PC), m_video.x, m_video.y, 0x4000 + offset, data); |
| 29 | logerror("%.4x lcd x:%.2x y:%.2x %.4x read %.2x\n", (int)space.device().state().state_int(CPUINFO_INT_PC), m_video.x, m_video.y, 0x4000 + offset, data); |
| 30 | 30 | if (!(m_video.mode) && m_video.delayed) |
| 31 | 31 | m_video.x++; |
| 32 | 32 | m_video.delayed = TRUE; |
| 33 | 33 | break; |
| 34 | 34 | default: |
| 35 | | logerror("%.4x memory %.4x read %.2x\n", (int)cpu_get_reg(&space.device(), CPUINFO_INT_PC), 0x4000 + offset, data); |
| 35 | logerror("%.4x memory %.4x read %.2x\n", (int)space.device().state().state_int(CPUINFO_INT_PC), 0x4000 + offset, data); |
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | return data; |
| r17797 | r17798 | |
| 45 | 45 | if (m_gmachine.ports[2] & 1) |
| 46 | 46 | { |
| 47 | 47 | memregion("maincpu")->base()[0x4000 + offset] = data; |
| 48 | | logerror("%.4x external memory %.4x written %.2x\n", (int)cpu_get_reg(&space.device(), CPUINFO_INT_PC), 0x4000 + offset, data); |
| 48 | logerror("%.4x external memory %.4x written %.2x\n", (int)space.device().state().state_int(CPUINFO_INT_PC), 0x4000 + offset, data); |
| 49 | 49 | } |
| 50 | 50 | else |
| 51 | 51 | { |
| r17797 | r17798 | |
| 53 | 53 | { |
| 54 | 54 | case 0: |
| 55 | 55 | m_video.delayed=FALSE; |
| 56 | | logerror("%.4x lcd %.4x written %.2x\n", (int)cpu_get_reg(&space.device(), CPUINFO_INT_PC), 0x4000 + offset, data); |
| 56 | logerror("%.4x lcd %.4x written %.2x\n", (int)space.device().state().state_int(CPUINFO_INT_PC), 0x4000 + offset, data); |
| 57 | 57 | // e2 af a4 a0 a9 falling block init for both halves |
| 58 | 58 | if ((data & 0xfc) == 0xb8) |
| 59 | 59 | { |
| r17797 | r17798 | |
| 77 | 77 | if (m_video.x < ARRAY_LENGTH(m_video.pixels[0])) // continental galaxy flutlicht |
| 78 | 78 | m_video.pixels[m_video.y][m_video.x] = data; |
| 79 | 79 | logerror("%.4x lcd x:%.2x y:%.2x %.4x written %.2x\n", |
| 80 | | (int)cpu_get_reg(&space.device(), CPUINFO_INT_PC), m_video.x, m_video.y, 0x4000 + offset, data); |
| 80 | (int)space.device().state().state_int(CPUINFO_INT_PC), m_video.x, m_video.y, 0x4000 + offset, data); |
| 81 | 81 | m_video.x++; |
| 82 | 82 | /* 02 b8 1a |
| 83 | 83 | 02 bb 1a |
| r17797 | r17798 | |
| 95 | 95 | */ |
| 96 | 96 | break; |
| 97 | 97 | default: |
| 98 | | logerror("%.4x memory %.4x written %.2x\n", (int)cpu_get_reg(&space.device(), CPUINFO_INT_PC), 0x4000 + offset, data); |
| 98 | logerror("%.4x memory %.4x written %.2x\n", (int)space.device().state().state_int(CPUINFO_INT_PC), 0x4000 + offset, data); |
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | } |
| r17797 | r17798 | |
| 110 | 110 | data = ioport("JOY")->read(); |
| 111 | 111 | break; |
| 112 | 112 | default: |
| 113 | | logerror("%.4x port %d read %.2x\n", (int)cpu_get_reg(&space.device(), CPUINFO_INT_PC), offset, data); |
| 113 | logerror("%.4x port %d read %.2x\n", (int)space.device().state().state_int(CPUINFO_INT_PC), offset, data); |
| 114 | 114 | } |
| 115 | 115 | return data; |
| 116 | 116 | } |
| r17797 | r17798 | |
| 118 | 118 | WRITE8_MEMBER(gmaster_state::gmaster_port_w) |
| 119 | 119 | { |
| 120 | 120 | m_gmachine.ports[offset] = data; |
| 121 | | logerror("%.4x port %d written %.2x\n", (int)cpu_get_reg(&space.device(), CPUINFO_INT_PC), offset, data); |
| 121 | logerror("%.4x port %d written %.2x\n", (int)space.device().state().state_int(CPUINFO_INT_PC), offset, data); |
| 122 | 122 | switch (offset) |
| 123 | 123 | { |
| 124 | 124 | case UPD7810_PORTC: |