]> git.sesse.net Git - pistorm/commitdiff
Update m68kconf.h, m68kcpu.c, and m68kcpu.h
authorbeeanyew <beeanyew@gmail.com>
Sat, 20 Feb 2021 07:33:40 +0000 (08:33 +0100)
committerbeeanyew <beeanyew@gmail.com>
Sat, 20 Feb 2021 07:33:40 +0000 (08:33 +0100)
m68kconf.h
m68kcpu.c
m68kcpu.h

index bcfcb1353a3e90a7a2eb82425ac5d105194f0eeb..71c42c296bc05eecb8536ad1ec860fbef08f7e80 100644 (file)
 
 
 /* If ON, the CPU will emulate the 4-byte prefetch queue of a real 68000 */
-#define M68K_EMULATE_PREFETCH       OPT_OFF
+#define M68K_EMULATE_PREFETCH       OPT_ON
 
 
 /* If ON, the CPU will generate address error exceptions if it tries to
index ecdf4dd7075aaed3d2632f792d9e9855148946da..f4d3f2c8252d6be8d3461c4cfffb96ae26b104b1 100644 (file)
--- a/m68kcpu.c
+++ b/m68kcpu.c
@@ -976,7 +976,9 @@ int m68k_execute(int num_cycles)
                /* Main loop.  Keep going until we run out of clock cycles */
                do
                {
+#ifdef M68K_BUSERR_THING
                        int i;
+#endif
                        /* Set tracing accodring to T1. (T0 is done inside instruction) */
                        m68ki_trace_t1(); /* auto-disable (see m68kcpu.h) */
 
@@ -1175,9 +1177,25 @@ void m68k_set_context(void* src)
 
 /* Read data immediately following the PC */
 inline unsigned int  m68k_read_immediate_16(unsigned int address) {
+#ifndef M68K_EMULATE_PREFETCH
+       for (int i = 0; i < read_ranges; i++) {
+               if(address >= read_addr[i] && address < read_upper[i]) {
+                       return be16toh(((unsigned short *)(read_data[i] + (address - read_addr[i])))[0]);
+               }
+       }
+#endif
+       
        return m68k_read_memory_16(address);
 }
 inline unsigned int  m68k_read_immediate_32(unsigned int address) {
+#ifndef M68K_EMULATE_PREFETCH
+       for (int i = 0; i < read_ranges; i++) {
+               if(address >= read_addr[i] && address < read_upper[i]) {
+                       return be32toh(((unsigned int *)(read_data[i] + (address - read_addr[i])))[0]);
+               }
+       }
+#endif
+
        return m68k_read_memory_32(address);
 }
 
index e1035c121c0ae0820d8fb20dc1a22f079045e3ac..ab47308fe245b5f4ff50e9837fb85a2a01c13f10 100644 (file)
--- a/m68kcpu.h
+++ b/m68kcpu.h
@@ -1107,7 +1107,6 @@ static inline uint m68ki_read_imm_32(void)
 
 #if M68K_EMULATE_PREFETCH
        uint temp_val;
-       uint32_t address = ADDRESS_68K(CPU_PREF_ADDR);
 
        m68ki_set_fc(FLAG_S | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */
        m68ki_check_address_error(REG_PC, MODE_READ, FLAG_S | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */