src/emu/cpu/upd7810/7810tbl.c
| r6855 | r6856 | |
| 3549 | 3549 | {illegal2, 2, 8, 8,L0|L1}, {illegal2, 2, 8, 8,L0|L1}, |
| 3550 | 3550 | {SK_CY, 2, 8, 8,L0|L1}, {illegal2, 2, 8, 8,L0|L1}, |
| 3551 | 3551 | {SK_Z, 2, 8, 8,L0|L1}, {illegal2, 2, 8, 8,L0|L1}, |
| 3552 | | {PUSH_VA, 2,15,15,L0|L1}, {POP_VA, 2,15,15,L0|L1}, |
| 3552 | {PUSH_VA, 2,17,17,L0|L1}, {POP_VA, 2,15,15,L0|L1}, |
| 3553 | 3553 | |
| 3554 | 3554 | {SKNIT_F0, 2, 8, 8,L0|L1}, {SKNIT_FT0, 2, 8, 8,L0|L1}, |
| 3555 | 3555 | {SKNIT_F1, 2, 8, 8,L0|L1}, {SKNIT_F2, 2, 8, 8,L0|L1}, |
| r6855 | r6856 | |
| 3575 | 3575 | {SLL_A, 2, 8, 8,L0|L1}, {SLR_A, 2, 8, 8,L0|L1}, |
| 3576 | 3576 | {SLL_C, 2, 8, 8,L0|L1}, {SLR_C, 2, 8, 8,L0|L1}, |
| 3577 | 3577 | {RLD, 2,17,17,L0|L1}, {RRD, 2,17,17,L0|L1}, |
| 3578 | | {illegal2, 2, 8, 8,L0|L1}, {illegal2, 2,12,12,L0|L1}, |
| 3578 | {illegal2, 2, 8, 8,L0|L1}, {illegal2, 2, 8, 8,L0|L1}, |
| 3579 | 3579 | {PER, 2,11,11,L0|L1}, {illegal2, 2, 8, 8,L0|L1}, |
| 3580 | 3580 | {PUSH_HL, 2,17,17,L0|L1}, {POP_HL, 2,15,15,L0|L1}, |
| 3581 | 3581 | |
src/emu/cpu/upd7810/7810dasm.c
| r6855 | r6856 | |
| 4115 | 4115 | |
| 4116 | 4116 | /* 0xC0 - 0xFF */ |
| 4117 | 4117 | { MOV, "A,PA" }, { MOV, "A,PB" }, { MOV, "A,PC" }, { MOV, "A,MK" }, |
| 4118 | | { MOV, "A,MB" }, { MOV, "A,MC" }, { MOV, "A,TM0" }, { MOV, "A,TM1" }, |
| 4118 | { illegal, 0 }, { illegal, 0 }, { illegal, 0 }, { illegal, 0 }, |
| 4119 | 4119 | { MOV, "A,S" }, { illegal, 0 }, { illegal, 0 }, { illegal, 0 }, |
| 4120 | 4120 | { illegal, 0 }, { illegal, 0 }, { illegal, 0 }, { illegal, 0 }, |
| 4121 | 4121 | |
| r6855 | r6856 | |
| 4379 | 4379 | |
| 4380 | 4380 | { ACI, "PA,%b" }, { ACI, "PB,%b" }, { ACI, "PC,%b" }, { ACI, "MK,%b" }, |
| 4381 | 4381 | { illegal, 0 }, { illegal, 0 }, { illegal, 0 }, { illegal, 0 }, |
| 4382 | { OFFI, "PA,%b" }, { OFFI, "PB,%b" }, { OFFI, "PC,%b" }, { OFFI, "MK,%b" }, |
| 4383 | { illegal, 0 }, { illegal, 0 }, { illegal, 0 }, { illegal, 0 }, |
| 4384 | |
| 4382 | 4385 | { SUI, "PA,%b" }, { SUI, "PB,%b" }, { SUI, "PC,%b" }, { SUI, "MK,%b" }, |
| 4383 | 4386 | { illegal, 0 }, { illegal, 0 }, { illegal, 0 }, { illegal, 0 }, |
| 4384 | | |
| 4385 | 4387 | { NEI, "PA,%b" }, { NEI, "PB,%b" }, { NEI, "PC,%b" }, { NEI, "MK,%b" }, |
| 4386 | 4388 | { illegal, 0 }, { illegal, 0 }, { illegal, 0 }, { illegal, 0 }, |
| 4387 | | { SBI, "PA,%b" }, { SBI, "PB,%b" }, { SBI, "PC,%b" }, { SBI, "MK,%b" }, |
| 4388 | | { illegal, 0 }, { illegal, 0 }, { illegal, 0 }, { illegal, 0 }, |
| 4389 | 4389 | |
| 4390 | 4390 | { SBI, "PA,%b" }, { SBI, "PB,%b" }, { SBI, "PC,%b" }, { SBI, "MK,%b" }, |
| 4391 | 4391 | { illegal, 0 }, { illegal, 0 }, { illegal, 0 }, { illegal, 0 }, |
| r6855 | r6856 | |
| 4600 | 4600 | |
| 4601 | 4601 | { 0, dasm60_7801 }, { DAA, 0 }, { RETI, 0 }, { CALB, 0 }, |
| 4602 | 4602 | { 0, dasm64_7801 }, { NEIW, "%a,%b" }, { SUI, "A,%b" }, { NEI, "A,%b" }, |
| 4603 | | { MVI, "V,%b?" }, { MVI, "A,%b" }, { MVI, "B,%b" }, { MVI, "C,%b" }, |
| 4603 | { MVI, "V,%b" }, { MVI, "A,%b" }, { MVI, "B,%b" }, { MVI, "C,%b" }, |
| 4604 | 4604 | { MVI, "D,%b" }, { MVI, "E,%b" }, { MVI, "H,%b" }, { MVI, "L,%b" }, |
| 4605 | 4605 | |
| 4606 | 4606 | { 0, dasm70_7801 }, { MVIW, "%a,%b" }, { SOFTI, 0 }, { JB, 0 }, |
src/emu/cpu/upd7810/upd7810.c
| r6855 | r6856 | |
| 472 | 472 | UINT8 co1; |
| 473 | 473 | UINT16 irr; /* interrupt request register */ |
| 474 | 474 | UINT16 itf; /* interrupt test flag register */ |
| 475 | int int1; /* keep track of current int1 state. Needed for 7801 irq checking. */ |
| 476 | int int2; /* keep track to current int2 state. Needed for 7801 irq checking. */ |
| 475 | 477 | |
| 476 | 478 | /* internal helper variables */ |
| 477 | 479 | UINT16 txs; /* transmitter shift register */ |
| r6855 | r6856 | |
| 538 | 540 | #define INTFST 0x0400 |
| 539 | 541 | #define INTER 0x0800 |
| 540 | 542 | #define INTOV 0x1000 |
| 543 | #define INTF0 0x2000 |
| 541 | 544 | |
| 542 | 545 | /* ITF flags */ |
| 543 | 546 | #define INTAN4 0x0001 |
| r6855 | r6856 | |
| 843 | 846 | if (0 == IFF) |
| 844 | 847 | return; |
| 845 | 848 | |
| 846 | | /* check the interrupts in priority sequence */ |
| 847 | | if ((IRR & INTFT0) && 0 == (MKL & 0x02)) |
| 849 | switch ( cpustate->config.type ) |
| 848 | 850 | { |
| 849 | | switch (cpustate->config.type) |
| 851 | case TYPE_7801: |
| 852 | /* 1 - SOFTI - vector at 0x0060 */ |
| 853 | /* 2 - INT0 - Masked by MK0 bit */ |
| 854 | if ( IRR & INTF0 && 0 == (MKL & 0x01 ) ) |
| 850 | 855 | { |
| 851 | | case TYPE_7810_GAMEMASTER: |
| 852 | | vector = 0xff2a; |
| 853 | | break; |
| 854 | | default: |
| 855 | | vector = 0x0008; |
| 856 | irqline = UPD7810_INTF0; |
| 857 | vector = 0x0004; |
| 858 | IRR &= ~INTF0; |
| 856 | 859 | } |
| 857 | | if (!((IRR & INTFT1) && 0 == (MKL & 0x04))) |
| 858 | | IRR&=~INTFT0; |
| 859 | | } |
| 860 | | else |
| 861 | | if ((IRR & INTFT1) && 0 == (MKL & 0x04)) |
| 862 | | { |
| 863 | | switch (cpustate->config.type) |
| 860 | /* 3 - INTT - Masked by MKT bit */ |
| 861 | if ( IRR & INTFT0 && 0 == ( MKL & 0x02 ) ) |
| 864 | 862 | { |
| 865 | | case TYPE_7810_GAMEMASTER: |
| 866 | | vector = 0xff2a; |
| 867 | | break; |
| 868 | | default: |
| 869 | | vector = 0x0008; |
| 863 | vector = 0x0008; |
| 864 | IRR &= ~INTFT0; |
| 870 | 865 | } |
| 871 | | IRR&=~INTFT1; |
| 872 | | } |
| 873 | | else |
| 874 | | if ((IRR & INTF1) && 0 == (MKL & 0x08)) |
| 875 | | { |
| 876 | | irqline = UPD7810_INTF1; |
| 877 | | vector = 0x0010; |
| 878 | | if (!((IRR & INTF2) && 0 == (MKL & 0x10))) |
| 879 | | IRR&=~INTF1; |
| 880 | | } |
| 881 | | else |
| 882 | | if ((IRR & INTF2) && 0 == (MKL & 0x10)) |
| 883 | | { |
| 884 | | irqline = UPD7810_INTF2; |
| 885 | | vector = 0x0010; |
| 886 | | IRR&=~INTF2; |
| 887 | | } |
| 888 | | else |
| 889 | | if ((IRR & INTFE0) && 0 == (MKL & 0x20)) |
| 890 | | { |
| 891 | | switch (cpustate->config.type) |
| 866 | /* 4 - INT1 - Masked by MK1 bit */ |
| 867 | if ( IRR & INTF1 && 0 == ( MKL & 0x04 ) ) |
| 892 | 868 | { |
| 893 | | case TYPE_7810_GAMEMASTER: |
| 894 | | vector = 0xff2d; |
| 895 | | break; |
| 896 | | default: |
| 897 | | vector = 0x0018; |
| 869 | irqline = UPD7810_INTF1; |
| 870 | vector = 0x0010; |
| 871 | IRR &= ~INTF1; |
| 898 | 872 | } |
| 899 | | if (!((IRR & INTFE1) && 0 == (MKL & 0x40))) |
| 900 | | IRR&=~INTFE0; |
| 901 | | } |
| 902 | | else |
| 903 | | if ((IRR & INTFE1) && 0 == (MKL & 0x40)) |
| 904 | | { |
| 905 | | switch (cpustate->config.type) |
| 873 | /* 5 - INT2 - Masked by MK2 bit */ |
| 874 | if ( IRR & INTF2 && 0 == ( MKL & 0x08 ) ) |
| 906 | 875 | { |
| 907 | | case TYPE_7810_GAMEMASTER: |
| 908 | | vector = 0xff2d; |
| 909 | | break; |
| 910 | | default: |
| 911 | | vector = 0x0018; |
| 876 | irqline = UPD7810_INTF2; |
| 877 | vector = 0x0020; |
| 878 | IRR &= ~INTF2; |
| 912 | 879 | } |
| 913 | | IRR&=~INTFE1; |
| 880 | /* 6 - INTS - Masked by MKS bit */ |
| 881 | if ( IRR & INTFST && 0 == ( MKL & 0x10 ) ) |
| 882 | { |
| 883 | vector = 0x0040; |
| 884 | IRR &= ~INTFST; |
| 885 | } |
| 886 | break; |
| 887 | |
| 888 | default: |
| 889 | /* check the interrupts in priority sequence */ |
| 890 | if ((IRR & INTFT0) && 0 == (MKL & 0x02)) |
| 891 | { |
| 892 | switch (cpustate->config.type) |
| 893 | { |
| 894 | case TYPE_7810_GAMEMASTER: |
| 895 | vector = 0xff2a; |
| 896 | break; |
| 897 | default: |
| 898 | vector = 0x0008; |
| 899 | } |
| 900 | if (!((IRR & INTFT1) && 0 == (MKL & 0x04))) |
| 901 | IRR&=~INTFT0; |
| 902 | } |
| 903 | else |
| 904 | if ((IRR & INTFT1) && 0 == (MKL & 0x04)) |
| 905 | { |
| 906 | switch (cpustate->config.type) |
| 907 | { |
| 908 | case TYPE_7810_GAMEMASTER: |
| 909 | vector = 0xff2a; |
| 910 | break; |
| 911 | default: |
| 912 | vector = 0x0008; |
| 913 | } |
| 914 | IRR&=~INTFT1; |
| 915 | } |
| 916 | else |
| 917 | if ((IRR & INTF1) && 0 == (MKL & 0x08)) |
| 918 | { |
| 919 | irqline = UPD7810_INTF1; |
| 920 | vector = 0x0010; |
| 921 | if (!((IRR & INTF2) && 0 == (MKL & 0x10))) |
| 922 | IRR&=~INTF1; |
| 923 | } |
| 924 | else |
| 925 | if ((IRR & INTF2) && 0 == (MKL & 0x10)) |
| 926 | { |
| 927 | irqline = UPD7810_INTF2; |
| 928 | vector = 0x0010; |
| 929 | IRR&=~INTF2; |
| 930 | } |
| 931 | else |
| 932 | if ((IRR & INTFE0) && 0 == (MKL & 0x20)) |
| 933 | { |
| 934 | switch (cpustate->config.type) |
| 935 | { |
| 936 | case TYPE_7810_GAMEMASTER: |
| 937 | vector = 0xff2d; |
| 938 | break; |
| 939 | default: |
| 940 | vector = 0x0018; |
| 941 | } |
| 942 | if (!((IRR & INTFE1) && 0 == (MKL & 0x40))) |
| 943 | IRR&=~INTFE0; |
| 944 | } |
| 945 | else |
| 946 | if ((IRR & INTFE1) && 0 == (MKL & 0x40)) |
| 947 | { |
| 948 | switch (cpustate->config.type) |
| 949 | { |
| 950 | case TYPE_7810_GAMEMASTER: |
| 951 | vector = 0xff2d; |
| 952 | break; |
| 953 | default: |
| 954 | vector = 0x0018; |
| 955 | } |
| 956 | IRR&=~INTFE1; |
| 957 | } |
| 958 | else |
| 959 | if ((IRR & INTFEIN) && 0 == (MKL & 0x80)) |
| 960 | { |
| 961 | vector = 0x0020; |
| 962 | } |
| 963 | else |
| 964 | if ((IRR & INTFAD) && 0 == (MKH & 0x01)) |
| 965 | { |
| 966 | vector = 0x0020; |
| 967 | } |
| 968 | else |
| 969 | if ((IRR & INTFSR) && 0 == (MKH & 0x02)) |
| 970 | { |
| 971 | vector = 0x0028; |
| 972 | IRR&=~INTFSR; |
| 973 | } |
| 974 | else |
| 975 | if ((IRR & INTFST) && 0 == (MKH & 0x04)) |
| 976 | { |
| 977 | vector = 0x0028; |
| 978 | IRR&=~INTFST; |
| 979 | } |
| 980 | break; |
| 914 | 981 | } |
| 915 | | else |
| 916 | | if ((IRR & INTFEIN) && 0 == (MKL & 0x80)) |
| 917 | | { |
| 918 | | vector = 0x0020; |
| 919 | | } |
| 920 | | else |
| 921 | | if ((IRR & INTFAD) && 0 == (MKH & 0x01)) |
| 922 | | { |
| 923 | | vector = 0x0020; |
| 924 | | } |
| 925 | | else |
| 926 | | if ((IRR & INTFSR) && 0 == (MKH & 0x02)) |
| 927 | | { |
| 928 | | vector = 0x0028; |
| 929 | | IRR&=~INTFSR; |
| 930 | | } |
| 931 | | else |
| 932 | | if ((IRR & INTFST) && 0 == (MKH & 0x04)) |
| 933 | | { |
| 934 | | vector = 0x0028; |
| 935 | | IRR&=~INTFST; |
| 936 | | } |
| 982 | |
| 937 | 983 | if (vector) |
| 938 | 984 | { |
| 939 | 985 | /* acknowledge external IRQ */ |
| r6855 | r6856 | |
| 1704 | 1750 | state_save_register_device_item(device, 0, cpustate->ovcf); |
| 1705 | 1751 | state_save_register_device_item(device, 0, cpustate->ovcs); |
| 1706 | 1752 | state_save_register_device_item(device, 0, cpustate->edges); |
| 1753 | state_save_register_device_item(device, 0, cpustate->int1); |
| 1754 | state_save_register_device_item(device, 0, cpustate->int2); |
| 1707 | 1755 | } |
| 1708 | 1756 | |
| 1709 | 1757 | #include "7810tbl.c" |
| r6855 | r6856 | |
| 1898 | 1946 | |
| 1899 | 1947 | static void set_irq_line(upd7810_state *cpustate, int irqline, int state) |
| 1900 | 1948 | { |
| 1901 | | if (state != CLEAR_LINE) |
| 1949 | /* The uPD7801 can check for falling and rising edges changes on the INT2 input */ |
| 1950 | switch ( cpustate->config.type ) |
| 1902 | 1951 | { |
| 1903 | | if (irqline == INPUT_LINE_NMI) |
| 1952 | case TYPE_7801: |
| 1953 | switch ( irqline ) |
| 1904 | 1954 | { |
| 1905 | | /* no nested NMIs ? */ |
| 1906 | | // if (0 == (IRR & INTNMI)) |
| 1955 | case UPD7810_INTF0: |
| 1956 | /* INT0 is level sensitive */ |
| 1957 | if ( state == ASSERT_LINE ) |
| 1958 | IRR |= INTF0; |
| 1959 | else |
| 1960 | IRR &= INTF0; |
| 1961 | break; |
| 1962 | |
| 1963 | case UPD7810_INTF1: |
| 1964 | /* INT1 is rising edge sensitive */ |
| 1965 | if ( cpustate->int1 == CLEAR_LINE && state == ASSERT_LINE ) |
| 1966 | IRR |= INTF1; |
| 1967 | |
| 1968 | cpustate->int1 = state; |
| 1969 | break; |
| 1970 | |
| 1971 | case UPD7810_INTF2: |
| 1972 | /* INT2 is rising or falling edge sensitive */ |
| 1973 | /* Check if the ES bit is set then check for rising edge, otherwise falling edge */ |
| 1974 | if ( MKL & 0x20 ) |
| 1907 | 1975 | { |
| 1908 | | IRR |= INTNMI; |
| 1909 | | SP--; |
| 1910 | | WM( SP, PSW ); |
| 1911 | | SP--; |
| 1912 | | WM( SP, PCH ); |
| 1913 | | SP--; |
| 1914 | | WM( SP, PCL ); |
| 1915 | | IFF = 0; |
| 1916 | | PSW &= ~(SK|L0|L1); |
| 1917 | | PC = 0x0004; |
| 1976 | if ( cpustate->int2 == CLEAR_LINE && state == ASSERT_LINE ) |
| 1977 | { |
| 1978 | IRR |= INTF2; |
| 1979 | } |
| 1918 | 1980 | } |
| 1981 | else |
| 1982 | { |
| 1983 | if ( cpustate->int2 == ASSERT_LINE && state == CLEAR_LINE ) |
| 1984 | { |
| 1985 | IRR |= INTF2; |
| 1986 | } |
| 1987 | } |
| 1988 | cpustate->int2 = state; |
| 1989 | break; |
| 1919 | 1990 | } |
| 1920 | | else |
| 1921 | | if (irqline == UPD7810_INTF1) |
| 1922 | | IRR |= INTF1; |
| 1923 | | else |
| 1924 | | if (irqline == UPD7810_INTF2) |
| 1925 | | IRR |= INTF2; |
| 1926 | | // gamemaster hack |
| 1927 | | else |
| 1928 | | if (irqline == UPD7810_INTFE1) |
| 1929 | | IRR |= INTFE1; |
| 1930 | | else |
| 1931 | | logerror("upd7810_set_irq_line invalid irq line #%d\n", irqline); |
| 1991 | break; |
| 1992 | |
| 1993 | default: |
| 1994 | if (state != CLEAR_LINE) |
| 1995 | { |
| 1996 | if (irqline == INPUT_LINE_NMI) |
| 1997 | { |
| 1998 | /* no nested NMIs ? */ |
| 1999 | // if (0 == (IRR & INTNMI)) |
| 2000 | { |
| 2001 | IRR |= INTNMI; |
| 2002 | SP--; |
| 2003 | WM( SP, PSW ); |
| 2004 | SP--; |
| 2005 | WM( SP, PCH ); |
| 2006 | SP--; |
| 2007 | WM( SP, PCL ); |
| 2008 | IFF = 0; |
| 2009 | PSW &= ~(SK|L0|L1); |
| 2010 | PC = 0x0004; |
| 2011 | } |
| 2012 | } |
| 2013 | else |
| 2014 | if (irqline == UPD7810_INTF1) |
| 2015 | IRR |= INTF1; |
| 2016 | else |
| 2017 | if ( irqline == UPD7810_INTF2 && ( MKL & 0x20 ) ) |
| 2018 | IRR |= INTF2; |
| 2019 | // gamemaster hack |
| 2020 | else |
| 2021 | if (irqline == UPD7810_INTFE1) |
| 2022 | IRR |= INTFE1; |
| 2023 | else |
| 2024 | logerror("upd7810_set_irq_line invalid irq line #%d\n", irqline); |
| 2025 | } |
| 2026 | /* resetting interrupt requests is done with the SKIT/SKNIT opcodes only! */ |
| 1932 | 2027 | } |
| 1933 | | /* resetting interrupt requests is done with the SKIT/SKNIT opcodes only! */ |
| 1934 | 2028 | } |
| 1935 | 2029 | |
| 1936 | 2030 | |