1.1 --- a/src/musashi/m68kcpu.c Wed Apr 16 02:07:24 2014 -0600 1.2 +++ b/src/musashi/m68kcpu.c Wed Apr 16 02:20:43 2014 -0600 1.3 @@ -66,6 +66,9 @@ 1.4 jmp_buf m68ki_address_error_trap; 1.5 #endif /* M68K_EMULATE_ADDRESS_ERROR */ 1.6 1.7 +jmp_buf m68ki_bus_error_jmp_buf; 1.8 +jmp_buf m68ki_bus_error_return_jmp_buf; 1.9 + 1.10 /* Used by shift & rotate instructions */ 1.11 uint8 m68ki_shift_8_table[65] = 1.12 { 1.13 @@ -638,9 +641,12 @@ 1.14 /* Return point if we had an address error */ 1.15 m68ki_set_address_error_trap(); /* auto-disable (see m68kcpu.h) */ 1.16 1.17 + m68ki_check_bus_error_trap(); 1.18 + 1.19 /* Main loop. Keep going until we run out of clock cycles */ 1.20 do 1.21 { 1.22 + int i; 1.23 /* Set tracing accodring to T1. (T0 is done inside instruction) */ 1.24 m68ki_trace_t1(); /* auto-disable (see m68kcpu.h) */ 1.25 1.26 @@ -653,20 +659,16 @@ 1.27 /* Record previous program counter */ 1.28 REG_PPC = REG_PC; 1.29 1.30 + for (i = 15; i >= 0; i--){ 1.31 + REG_DA_SAVE[i] = REG_DA[i]; 1.32 + } 1.33 /* Read an instruction and call its handler */ 1.34 REG_IR = m68ki_read_imm_16(); 1.35 - if (!BUS_ERROR_OCCURRED){ 1.36 - m68ki_instruction_jump_table[REG_IR](); 1.37 - } 1.38 + m68ki_instruction_jump_table[REG_IR](); 1.39 USE_CYCLES(CYC_INSTRUCTION[REG_IR]); 1.40 - 1.41 /* Trace m68k_exception, if necessary */ 1.42 m68ki_exception_if_trace(); /* auto-disable (see m68kcpu.h) */ 1.43 - 1.44 - if (BUS_ERROR_OCCURRED){ 1.45 - m68ki_jump_bus_error_vector(); 1.46 - BUS_ERROR_OCCURRED = 0; 1.47 - } 1.48 + 1.49 } while(GET_CYCLES() > 0); 1.50 1.51 /* set previous PC to current PC for the next entry into the loop */