trunk/src/emu/cpu/z8000/z8000ops.c
| r18823 | r18824 | |
| 5829 | 5829 | } |
| 5830 | 5830 | |
| 5831 | 5831 | /****************************************** |
| 5832 | | trtib @rd,@rs,rr |
| 5833 | | flags: -ZSV-- |
| 5832 | trtib @rd,@rs,rr |
| 5833 | flags: -ZSV-- |
| 5834 | 5834 | ******************************************/ |
| 5835 | 5835 | static void ZB8_ddN0_0010_0000_rrrr_ssN0_0000(z8000_state *cpustate) |
| 5836 | | {//@@@ |
| 5836 | { |
| 5837 | 5837 | GET_DST(OP0,NIB2); |
| 5838 | 5838 | GET_SRC(OP1,NIB2); |
| 5839 | 5839 | GET_CNT(OP1,NIB1); |
| 5840 | | UINT8 xlt = RDMEM_B(cpustate, (UINT16)(cpustate->RW(src) + RDMEM_B(cpustate, cpustate->RW(dst)))); |
| 5841 | | cpustate->RB(2) = xlt; |
| 5840 | UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst))); |
| 5841 | cpustate->RB(1) = xlt; /* load RH1 */ |
| 5842 | 5842 | if (xlt) CLR_Z; else SET_Z; |
| 5843 | | cpustate->RW(dst)++; |
| 5843 | addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, dst), 1)); |
| 5844 | 5844 | if (--cpustate->RW(cnt)) CLR_V; else SET_V; |
| 5845 | 5845 | } |
| 5846 | 5846 | |
| 5847 | 5847 | /****************************************** |
| 5848 | | trtirb @rd,@rs,rbr |
| 5849 | | flags: -ZSV-- |
| 5848 | trtirb @rd,@rs,rbr |
| 5849 | flags: -ZSV-- |
| 5850 | 5850 | ******************************************/ |
| 5851 | 5851 | static void ZB8_ddN0_0110_0000_rrrr_ssN0_1110(z8000_state *cpustate) |
| 5852 | | {//@@@ |
| 5852 | { |
| 5853 | 5853 | GET_DST(OP0,NIB2); |
| 5854 | 5854 | GET_SRC(OP1,NIB2); |
| 5855 | 5855 | GET_CNT(OP1,NIB1); |
| 5856 | | UINT8 xlt = RDMEM_B(cpustate, (UINT16)(cpustate->RW(src) + RDMEM_B(cpustate, cpustate->RW(dst)))); |
| 5857 | | cpustate->RB(2) = xlt; |
| 5856 | UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst))); |
| 5857 | cpustate->RB(1) = xlt; /* load RH1 */ |
| 5858 | 5858 | if (xlt) CLR_Z; else SET_Z; |
| 5859 | | cpustate->RW(dst)++; |
| 5860 | | if (--cpustate->RW(cnt)) { CLR_V; cpustate->pc -= 4; } else SET_V; |
| 5859 | addr_to_reg(cpustate, dst, addr_sub(cpustate, addr_from_reg(cpustate, dst), 1)); |
| 5860 | if (--cpustate->RW(cnt)) { |
| 5861 | CLR_V; |
| 5862 | if (!xlt) |
| 5863 | cpustate->pc -= 4; |
| 5864 | } |
| 5865 | else SET_V; |
| 5861 | 5866 | } |
| 5862 | 5867 | |
| 5863 | 5868 | /****************************************** |
| 5864 | | trtdb @rd,@rs,rbr |
| 5865 | | flags: -ZSV-- |
| 5869 | trtdb @rd,@rs,rbr |
| 5870 | flags: -ZSV-- |
| 5866 | 5871 | ******************************************/ |
| 5867 | 5872 | static void ZB8_ddN0_1010_0000_rrrr_ssN0_0000(z8000_state *cpustate) |
| 5868 | | {//@@@ |
| 5873 | { |
| 5869 | 5874 | GET_DST(OP0,NIB2); |
| 5870 | 5875 | GET_SRC(OP1,NIB2); |
| 5871 | 5876 | GET_CNT(OP1,NIB1); |
| 5872 | | UINT8 xlt = RDMEM_B(cpustate, (UINT16)(cpustate->RW(src) + RDMEM_B(cpustate, cpustate->RW(dst)))); |
| 5873 | | cpustate->RB(2) = xlt; |
| 5877 | UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst))); |
| 5878 | cpustate->RB(1) = xlt; /* load RH1 */ |
| 5874 | 5879 | if (xlt) CLR_Z; else SET_Z; |
| 5875 | | cpustate->RW(dst)--; |
| 5880 | addr_to_reg(cpustate, dst, addr_sub(cpustate, addr_from_reg(cpustate, dst), 1)); |
| 5876 | 5881 | if (--cpustate->RW(cnt)) CLR_V; else SET_V; |
| 5877 | 5882 | } |
| 5878 | 5883 | |
| 5879 | 5884 | /****************************************** |
| 5880 | | trtdrb @rd,@rs,rbr |
| 5881 | | flags: -ZSV-- |
| 5885 | trtdrb @rd,@rs,rbr |
| 5886 | flags: -ZSV-- |
| 5882 | 5887 | ******************************************/ |
| 5883 | 5888 | static void ZB8_ddN0_1110_0000_rrrr_ssN0_1110(z8000_state *cpustate) |
| 5884 | | {//@@@ |
| 5889 | { |
| 5885 | 5890 | GET_DST(OP0,NIB2); |
| 5886 | 5891 | GET_SRC(OP1,NIB2); |
| 5887 | 5892 | GET_CNT(OP1,NIB1); |
| 5888 | | UINT8 xlt = RDMEM_B(cpustate, (UINT16)(cpustate->RW(src) + RDMEM_B(cpustate, cpustate->RW(dst)))); |
| 5889 | | cpustate->RB(2) = xlt; |
| 5893 | UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst))); |
| 5894 | cpustate->RB(1) = xlt; /* load RH1 */ |
| 5890 | 5895 | if (xlt) CLR_Z; else SET_Z; |
| 5891 | | cpustate->RW(dst)--; |
| 5892 | | if (--cpustate->RW(cnt)) { CLR_V; cpustate->pc -= 4; } else SET_V; |
| 5896 | addr_to_reg(cpustate, dst, addr_sub(cpustate, addr_from_reg(cpustate, dst), 1)); |
| 5897 | if (--cpustate->RW(cnt)) { |
| 5898 | CLR_V; |
| 5899 | if (!xlt) |
| 5900 | cpustate->pc -= 4; |
| 5901 | } |
| 5902 | else SET_V; |
| 5893 | 5903 | } |
| 5894 | 5904 | |
| 5895 | 5905 | /****************************************** |
| 5896 | | trib @rd,@rs,rbr |
| 5897 | | flags: -ZSV-- |
| 5906 | trib @rd,@rs,rbr |
| 5907 | flags: -ZSV-- |
| 5898 | 5908 | ******************************************/ |
| 5899 | 5909 | static void ZB8_ddN0_0000_0000_rrrr_ssN0_0000(z8000_state *cpustate) |
| 5900 | | {//@@@ |
| 5910 | { |
| 5901 | 5911 | GET_DST(OP0,NIB2); |
| 5902 | 5912 | GET_SRC(OP1,NIB2); |
| 5903 | 5913 | GET_CNT(OP1,NIB1); |
| 5904 | | UINT8 xlt = RDMEM_B(cpustate, (UINT16)(cpustate->RW(src) + RDMEM_B(cpustate, cpustate->RW(dst)))); |
| 5905 | | WRMEM_B(cpustate, cpustate->RW(dst), xlt); |
| 5906 | | cpustate->RW(dst)++; |
| 5914 | UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst))); |
| 5915 | WRMEM_B(cpustate, addr_from_reg(cpustate, dst), xlt); |
| 5916 | cpustate->RB(1) = xlt; /* destroy RH1 */ |
| 5917 | addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, dst), 1)); |
| 5907 | 5918 | if (--cpustate->RW(cnt)) CLR_V; else SET_V; |
| 5908 | 5919 | } |
| 5909 | 5920 | |
| 5910 | 5921 | /****************************************** |
| 5911 | | trirb @rd,@rs,rbr |
| 5912 | | flags: -ZSV-- |
| 5922 | trirb @rd,@rs,rbr |
| 5923 | flags: -ZSV-- |
| 5913 | 5924 | ******************************************/ |
| 5914 | 5925 | static void ZB8_ddN0_0100_0000_rrrr_ssN0_0000(z8000_state *cpustate) |
| 5915 | | {//@@@ |
| 5926 | { |
| 5916 | 5927 | GET_DST(OP0,NIB2); |
| 5917 | 5928 | GET_SRC(OP1,NIB2); |
| 5918 | 5929 | GET_CNT(OP1,NIB1); |
| 5919 | | UINT8 xlt = RDMEM_B(cpustate, (UINT16)(cpustate->RW(src) + RDMEM_B(cpustate, cpustate->RW(dst)))); |
| 5920 | | WRMEM_B(cpustate, cpustate->RW(dst), xlt); |
| 5921 | | cpustate->RW(dst)++; |
| 5930 | UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst))); |
| 5931 | WRMEM_B(cpustate, addr_from_reg(cpustate, dst), xlt); |
| 5932 | cpustate->RB(1) = xlt; /* destroy RH1 */ |
| 5933 | addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, dst), 1)); |
| 5922 | 5934 | if (--cpustate->RW(cnt)) { CLR_V; cpustate->pc -= 4; } else SET_V; |
| 5923 | 5935 | } |
| 5924 | 5936 | |
| 5925 | 5937 | /****************************************** |
| 5926 | | trdb @rd,@rs,rbr |
| 5927 | | flags: -ZSV-- |
| 5938 | trdb @rd,@rs,rbr |
| 5939 | flags: -ZSV-- |
| 5928 | 5940 | ******************************************/ |
| 5929 | 5941 | static void ZB8_ddN0_1000_0000_rrrr_ssN0_0000(z8000_state *cpustate) |
| 5930 | | {//@@@ |
| 5942 | { |
| 5931 | 5943 | GET_DST(OP0,NIB2); |
| 5932 | 5944 | GET_SRC(OP1,NIB2); |
| 5933 | 5945 | GET_CNT(OP1,NIB1); |
| 5934 | | UINT8 xlt = RDMEM_B(cpustate, (UINT16)(cpustate->RW(src) + RDMEM_B(cpustate, cpustate->RW(dst)))); |
| 5935 | | WRMEM_B(cpustate, cpustate->RW(dst), xlt); |
| 5936 | | cpustate->RW(dst)--; |
| 5946 | UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst))); |
| 5947 | WRMEM_B(cpustate, addr_from_reg(cpustate, dst), xlt); |
| 5948 | cpustate->RB(1) = xlt; /* destroy RH1 */ |
| 5949 | addr_to_reg(cpustate, dst, addr_sub(cpustate, addr_from_reg(cpustate, dst), 1)); |
| 5937 | 5950 | if (--cpustate->RW(cnt)) CLR_V; else SET_V; |
| 5938 | 5951 | } |
| 5939 | 5952 | |
| 5940 | 5953 | /****************************************** |
| 5941 | | trdrb @rd,@rs,rbr |
| 5942 | | flags: -ZSV-- |
| 5954 | trdrb @rd,@rs,rbr |
| 5955 | flags: -ZSV-- |
| 5943 | 5956 | ******************************************/ |
| 5944 | 5957 | static void ZB8_ddN0_1100_0000_rrrr_ssN0_0000(z8000_state *cpustate) |
| 5945 | | {//@@@ |
| 5958 | { |
| 5946 | 5959 | GET_DST(OP0,NIB2); |
| 5947 | 5960 | GET_SRC(OP1,NIB2); |
| 5948 | 5961 | GET_CNT(OP1,NIB1); |
| 5949 | | UINT8 xlt = RDMEM_B(cpustate, (UINT16)(cpustate->RW(src) + RDMEM_B(cpustate, cpustate->RW(dst)))); |
| 5950 | | WRMEM_B(cpustate, cpustate->RW(dst), xlt); |
| 5951 | | cpustate->RW(dst)--; |
| 5962 | UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst))); |
| 5963 | WRMEM_B(cpustate, addr_from_reg(cpustate, dst), xlt); |
| 5964 | cpustate->RB(1) = xlt; /* destroy RH1 */ |
| 5965 | addr_to_reg(cpustate, dst, addr_sub(cpustate, addr_from_reg(cpustate, dst), 1)); |
| 5952 | 5966 | if (--cpustate->RW(cnt)) { CLR_V; cpustate->pc -= 4; } else SET_V; |
| 5953 | 5967 | } |
| 5954 | 5968 | |