--- hatari/src/uae-cpu/newcpu.c 2019/04/01 07:11:55 1.1.1.9 +++ hatari/src/uae-cpu/newcpu.c 2019/04/01 07:12:20 1.1.1.10 @@ -10,7 +10,7 @@ * This file is distributed under the GNU Public License, version 2 or at * your option any later version. Read the file gpl.txt for details. */ -char NewCpu_rcsid[] = "Hatari $Id: newcpu.c,v 1.1.1.9 2019/04/01 07:11:55 root Exp $"; +char NewCpu_rcsid[] = "Hatari $Id: newcpu.c,v 1.1.1.10 2019/04/01 07:12:20 root Exp $"; #include "sysdeps.h" #include "hatari-glue.h" @@ -18,6 +18,7 @@ char NewCpu_rcsid[] = "Hatari $Id: newcp #include "memory.h" #include "newcpu.h" #include "../includes/main.h" +#include "../includes/log.h" #include "../includes/m68000.h" #include "../includes/mfp.h" #include "../includes/tos.h" @@ -124,8 +125,8 @@ void build_cpufunctbl(void) : ! cpu_compatible ? op_smalltbl_4_ff : op_smalltbl_5_ff); - write_log ("Building CPU function table (%d %d %d).\n", - cpu_level, cpu_compatible, address_space_24); + Log_Printf(LOG_DEBUG, "Building CPU function table (%d %d %d).\n", + cpu_level, cpu_compatible, address_space_24); for (opcode = 0; opcode < 65536; opcode++) cpufunctbl[opcode] = op_illg_1; @@ -225,19 +226,21 @@ void init_m68k (void) read_table68k (); do_merges (); - write_log ("%d CPU functions\n", nr_cpuop_funcs); + Log_Printf(LOG_DEBUG, "%d CPU functions\n", nr_cpuop_funcs); build_cpufunctbl (); } -struct regstruct regs, lastint_regs; /* not used ATM: static struct regstruct regs_backup[16]; static int backup_pointer = 0; +struct regstruct lastint_regs; +int lastint_no; */ +struct regstruct regs; static long int m68kpc_offset; -int lastint_no; + #define get_ibyte_1(o) get_byte(regs.pc + (regs.pc_p - regs.pc_oldp) + (o) + 1) #define get_iword_1(o) get_word(regs.pc + (regs.pc_p - regs.pc_oldp) + (o)) @@ -784,12 +787,12 @@ void Exception(int nr, uaecptr oldpc) if (bBusErrorReadWrite) specialstatus |= 0x10; put_word (m68k_areg(regs, 7), specialstatus); - put_long (m68k_areg(regs, 7)+2, BusAddressLocation); + put_long (m68k_areg(regs, 7)+2, BusErrorAddress); put_word (m68k_areg(regs, 7)+6, get_word(BusErrorPC)); /* Opcode */ /* Check for double bus errors: */ if (regs.spcflags & SPCFLAG_BUSERROR) { fprintf(stderr, "Detected double bus error at address $%x, PC=$%lx => CPU halted!\n", - BusAddressLocation, (long)currpc); + BusErrorAddress, (long)currpc); unset_special(SPCFLAG_BUSERROR); if (bEnableDebug) DebugUI(); @@ -797,8 +800,8 @@ void Exception(int nr, uaecptr oldpc) m68k_setstopped(TRUE); return; } - if (bEnableDebug && BusAddressLocation!=0xff8a00) { - fprintf(stderr,"Bus Error at address $%x, PC=$%lx\n",BusAddressLocation,(long)currpc); + if (bEnableDebug && BusErrorAddress!=0xff8a00) { + fprintf(stderr,"Bus Error at address $%x, PC=$%lx\n", BusErrorAddress, (long)currpc); DebugUI(); } } @@ -848,8 +851,8 @@ void Exception(int nr, uaecptr oldpc) static void Interrupt(int nr) { assert(nr < 8 && nr >= 0); - lastint_regs = regs; - lastint_no = nr; + /*lastint_regs = regs;*/ + /*lastint_no = nr;*/ Exception(nr+24, 0); regs.intmask = nr; @@ -932,12 +935,12 @@ int m68k_movec2 (int regno, uae_u32 *reg } STATIC_INLINE int -div_unsigned(uae_u32 src_hi, uae_u32 src_lo, uae_u32 div, uae_u32 *quot, uae_u32 *rem) +div_unsigned(uae_u32 src_hi, uae_u32 src_lo, uae_u32 ndiv, uae_u32 *quot, uae_u32 *rem) { uae_u32 q = 0, cbit = 0; int i; - if (div <= src_hi) { + if (ndiv <= src_hi) { return 1; } for (i = 0 ; i < 32 ; i++) { @@ -946,9 +949,9 @@ div_unsigned(uae_u32 src_hi, uae_u32 src if (src_lo & 0x80000000ul) src_hi++; src_lo <<= 1; q = q << 1; - if (cbit || div <= src_hi) { + if (cbit || ndiv <= src_hi) { q |= 1; - src_hi -= div; + src_hi -= ndiv; } } *quot = q;