]> git.sesse.net Git - pistorm/blobdiff - m68kcpu.h
Creepy CDTV experiments
[pistorm] / m68kcpu.h
index 4262cd90d508412dba513b07aa348f922d90fabe..a6bea82c231a4acc6e085336420f2ac7c09aa435 100644 (file)
--- a/m68kcpu.h
+++ b/m68kcpu.h
@@ -1126,14 +1126,14 @@ static inline uint m68ki_read_imm_32(void)
  * code if they are enabled in m68kconf.h.
  */
 
-static unsigned char read_ranges;
-static unsigned int read_addr[8];
-static unsigned int read_upper[8];
-static unsigned char *read_data[8];
-static unsigned char write_ranges;
-static unsigned int write_addr[8];
-static unsigned int write_upper[8];
-static unsigned char *write_data[8];
+extern unsigned char read_ranges;
+extern unsigned int read_addr[8];
+extern unsigned int read_upper[8];
+extern unsigned char *read_data[8];
+extern unsigned char write_ranges;
+extern unsigned int write_addr[8];
+extern unsigned int write_upper[8];
+extern unsigned char *write_data[8];
 
 static inline uint m68ki_read_8_fc(uint address, uint fc)
 {
@@ -1147,7 +1147,7 @@ static inline uint m68ki_read_8_fc(uint address, uint fc)
 
        for (int i = 0; i < read_ranges; i++) {
                if(address >= read_addr[i] && address < read_upper[i]) {
-                       return read_data[i][address];
+                       return read_data[i][address - read_addr[i]];
                }
        }
 
@@ -1204,7 +1204,7 @@ static inline void m68ki_write_8_fc(uint address, uint fc, uint value)
 
        for (int i = 0; i < write_ranges; i++) {
                if(address >= write_addr[i] && address < write_upper[i]) {
-                       write_data[i][address] = (unsigned char)value;
+                       write_data[i][address - write_addr[i]] = (unsigned char)value;
                        return;
                }
        }