comparison m68k.cpu @ 2481:f0645adddf0d

Implement some flow control instructions in new 68K core. WIP implementation of movem in new 68K core.
author Michael Pavone <pavone@retrodev.com>
date Sat, 30 Mar 2024 14:27:47 -0700
parents 29baf8d5a579
children
comparison
equal deleted inserted replaced
2480:369a52e302e2 2481:f0645adddf0d
69 check_user_mode_swap_ssp_usp 69 check_user_mode_swap_ssp_usp
70 local tmp 8 70 local tmp 8
71 and 0x20 status tmp 71 and 0x20 status tmp
72 if tmp 72 if tmp
73 else 73 else
74 74 xchg other_sp a7
75 xchg other_sp a7
76
77 end 75 end
78 76
79 m68k_get_sr 77 m68k_get_sr
80 lsl status 8 scratch1 78 lsl status 8 scratch1
81 or ccr scratch1 scratch1 79 or ccr scratch1 scratch1
1216 0100011011MMMRRR move_to_sr 1214 0100011011MMMRRR move_to_sr
1217 invalid M 1 1215 invalid M 1
1218 invalid M 7 R 5 1216 invalid M 7 R 5
1219 invalid M 7 R 6 1217 invalid M 7 R 6
1220 invalid M 7 R 7 1218 invalid M 7 R 7
1219 #TODO: privilege violation exception if in user mode
1221 m68k_fetch_src_ea M R 1 1220 m68k_fetch_src_ea M R 1
1222 mov scratch1 ccr 1221 mov scratch1 ccr
1223 lsr scratch1 8 status 1222 lsr scratch1 8 status
1224 update_sync 1223 update_sync
1225 cycles 8 1224 cycles 8
1844 cycles 128 1843 cycles 128
1845 m68k_prefetch 1844 m68k_prefetch
1846 1845
1847 0100111001110001 nop 1846 0100111001110001 nop
1848 m68k_prefetch 1847 m68k_prefetch
1848
1849 0100111001110011 rte
1850 #TODO: privilege violation exception if in user mode
1851 #Read saved SR
1852 scratch1 = a7
1853 ocall read_16
1854 a7 += 2
1855 ccr = scratch1
1856 status = scratch1 >> 8
1857 #Read saved PC
1858 scratch1 = a7
1859 m68k_read32
1860 a7 += 4
1861 pc = scratch1
1862
1863 check_user_mode_swap_ssp_usp
1864 cycles 4
1865 update_sync
1866 m68k_prefetch
1867
1868 0100111001110101 m68k_rts
1869 scratch1 = a7
1870 m68k_read32
1871 a7 += 4
1872 pc = scratch1
1873
1874 cycles 4
1875 m68k_prefetch
1876
1877 0100111001110111 rtr
1878 #Read saved CCR
1879 scratch1 = a7
1880 ocall read_16
1881 a7 += 2
1882 ccr = scratch1
1883 #Read saved PC
1884 scratch1 = a7
1885 m68k_read32
1886 a7 += 4
1887 pc = scratch1
1888
1889 cycles 4
1890 m68k_prefetch
1891
1892 0100111010MMMRRR jsr
1893 invalid M 0
1894 invalid M 1
1895 invalid M 3
1896 invalid M 4
1897 invalid M 7 R 4
1898 invalid M 7 R 5
1899 invalid M 7 R 6
1900 invalid M 7 R 7
1901
1902 a7 -= 4
1903 scratch1 = a7
1904 m68k_write32 pc
1905
1906 m68k_calc_ea M R
1907 pc = ea
1908
1909 cycles 4
1910 m68k_prefetch
1911
1912 0100111010MMMRRR jmp
1913 invalid M 0
1914 invalid M 1
1915 invalid M 3
1916 invalid M 4
1917 invalid M 7 R 4
1918 invalid M 7 R 5
1919 invalid M 7 R 6
1920 invalid M 7 R 7
1921
1922 m68k_calc_ea M R
1923 pc = ea
1924
1925 cycles 4
1926 m68k_prefetch
1927
1928 010010001ZMMMRRR movem_reg_to_mem
1929 invalid M 0
1930 invalid M 1
1931 invalid M 3
1932 invalid M 7 R 2
1933 invalid M 7 R 3
1934 invalid M 7 R 4
1935 invalid M 7 R 5
1936 invalid M 7 R 6
1937 invalid M 7 R 7
1938 local reglist 16
1939
1940 m68k_prefetch
1941 reglist = scratch1
1942
1943 010011001ZMMMRRR movem_mem_to_reg
1944 invalid M 0
1945 invalid M 1
1946 invalid M 4
1947 invalid M 7 R 4
1948 invalid M 7 R 5
1949 invalid M 7 R 6
1950 invalid M 7 R 7
1951 local reglist 16
1952
1953 m68k_prefetch
1954 reglist = scratch1