# HG changeset patch # User Michael Pavone # Date 1711834067 25200 # Node ID f0645adddf0de05616bd4a5375e852a64520da04 # Parent 369a52e302e28cf01a9bb2662098df6ded468386 Implement some flow control instructions in new 68K core. WIP implementation of movem in new 68K core. diff -r 369a52e302e2 -r f0645adddf0d m68k.cpu --- a/m68k.cpu Sat Mar 30 14:26:48 2024 -0700 +++ b/m68k.cpu Sat Mar 30 14:27:47 2024 -0700 @@ -71,9 +71,7 @@ and 0x20 status tmp if tmp else - - xchg other_sp a7 - + xchg other_sp a7 end m68k_get_sr @@ -1218,6 +1216,7 @@ invalid M 7 R 5 invalid M 7 R 6 invalid M 7 R 7 + #TODO: privilege violation exception if in user mode m68k_fetch_src_ea M R 1 mov scratch1 ccr lsr scratch1 8 status @@ -1846,3 +1845,110 @@ 0100111001110001 nop m68k_prefetch + +0100111001110011 rte + #TODO: privilege violation exception if in user mode + #Read saved SR + scratch1 = a7 + ocall read_16 + a7 += 2 + ccr = scratch1 + status = scratch1 >> 8 + #Read saved PC + scratch1 = a7 + m68k_read32 + a7 += 4 + pc = scratch1 + + check_user_mode_swap_ssp_usp + cycles 4 + update_sync + m68k_prefetch + +0100111001110101 m68k_rts + scratch1 = a7 + m68k_read32 + a7 += 4 + pc = scratch1 + + cycles 4 + m68k_prefetch + +0100111001110111 rtr + #Read saved CCR + scratch1 = a7 + ocall read_16 + a7 += 2 + ccr = scratch1 + #Read saved PC + scratch1 = a7 + m68k_read32 + a7 += 4 + pc = scratch1 + + cycles 4 + m68k_prefetch + +0100111010MMMRRR jsr + invalid M 0 + invalid M 1 + invalid M 3 + invalid M 4 + invalid M 7 R 4 + invalid M 7 R 5 + invalid M 7 R 6 + invalid M 7 R 7 + + a7 -= 4 + scratch1 = a7 + m68k_write32 pc + + m68k_calc_ea M R + pc = ea + + cycles 4 + m68k_prefetch + +0100111010MMMRRR jmp + invalid M 0 + invalid M 1 + invalid M 3 + invalid M 4 + invalid M 7 R 4 + invalid M 7 R 5 + invalid M 7 R 6 + invalid M 7 R 7 + + m68k_calc_ea M R + pc = ea + + cycles 4 + m68k_prefetch + +010010001ZMMMRRR movem_reg_to_mem + invalid M 0 + invalid M 1 + invalid M 3 + invalid M 7 R 2 + invalid M 7 R 3 + invalid M 7 R 4 + invalid M 7 R 5 + invalid M 7 R 6 + invalid M 7 R 7 + local reglist 16 + + m68k_prefetch + reglist = scratch1 + +010011001ZMMMRRR movem_mem_to_reg + invalid M 0 + invalid M 1 + invalid M 4 + invalid M 7 R 4 + invalid M 7 R 5 + invalid M 7 R 6 + invalid M 7 R 7 + local reglist 16 + + m68k_prefetch + reglist = scratch1