10 static byte
readb(int a
)
12 byte
*p
= mbc
.rmap
[a
>>12];
14 else return mem_read(a
);
17 static void writeb(int a
, byte b
)
19 byte
*p
= mbc
.wmap
[a
>>12];
24 static int readw(int a
)
28 byte
*p
= mbc
.rmap
[a
>>12];
31 #ifdef IS_LITTLE_ENDIAN
32 #ifndef ALLOW_UNALIGNED_IO
33 if (a
&1) return p
[a
] | (p
[a
+1]<<8);
35 return *(word
*)(p
+a
);
37 return p
[a
] | (p
[a
+1]<<8);
41 return mem_read(a
) | (mem_read(a
+1)<<8);
44 static void writew(int a
, int w
)
48 byte
*p
= mbc
.wmap
[a
>>12];
51 #ifdef IS_LITTLE_ENDIAN
52 #ifndef ALLOW_UNALIGNED_IO
73 static byte
readhi(int a
)
75 return readb(a
| 0xff00);
78 static void writehi(int a
, byte b
)
80 writeb(a
| 0xff00, b
);
84 static byte
readhi(int a
)
86 byte (*rd
)() = hi_read
[a
];
87 return rd
? rd(a
) : (ram
.hi
[a
] | himask
[a
]);
90 static void writehi(int a
, byte b
)
92 byte (*wr
)() = hi_write
[a
];
94 else ram
.hi
[a
] = b
& ~himask
[a
];