X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2F32x%2Fmemory.c;h=eaf1e3ad584730cf6dd28473d225bc563dba0c8d;hb=b8a1c09ad1ef0b807c2eb1632d34e6bfae14b633;hp=ea4051bc7e227185ff31f6a2fe85c128328f5749;hpb=71f68165b6e50f58ddbc6e98a38c7dd4968ccca2;p=picodrive.git diff --git a/pico/32x/memory.c b/pico/32x/memory.c index ea4051b..eaf1e3a 100644 --- a/pico/32x/memory.c +++ b/pico/32x/memory.c @@ -1178,7 +1178,7 @@ u32 REGPARM(2) p32x_sh2_read8(u32 a, SH2 *sh2) sh2_map += SH2MAP_ADDR2OFFS(a); p = sh2_map->addr; - if (p & (1 << 31)) + if (map_flag_set(p)) return ((sh2_read_handler *)(p << 1))(a, sh2->is_slave); else return *(u8 *)((p << 1) + ((a & sh2_map->mask) ^ 1)); @@ -1191,7 +1191,7 @@ u32 REGPARM(2) p32x_sh2_read16(u32 a, SH2 *sh2) sh2_map += SH2MAP_ADDR2OFFS(a); p = sh2_map->addr; - if (p & (1 << 31)) + if (map_flag_set(p)) return ((sh2_read_handler *)(p << 1))(a, sh2->is_slave); else return *(u16 *)((p << 1) + ((a & sh2_map->mask) & ~1)); @@ -1207,7 +1207,7 @@ u32 REGPARM(2) p32x_sh2_read32(u32 a, SH2 *sh2) offs = SH2MAP_ADDR2OFFS(a); sh2_map += offs; p = sh2_map->addr; - if (!(p & (1 << 31))) { + if (!map_flag_set(p)) { // XXX: maybe 32bit access instead with ror? u16 *pd = (u16 *)((p << 1) + ((a & sh2_map->mask) & ~1)); return (pd[0] << 16) | pd[1]; @@ -1376,7 +1376,7 @@ static void get_bios(void) } #define MAP_MEMORY(m) ((uptr)(m) >> 1) -#define MAP_HANDLER(h) (((uptr)(h) >> 1) | (1 << 31)) +#define MAP_HANDLER(h) ( ((uptr)(h) >> 1) | ((uptr)1 << (sizeof(uptr) * 8 - 1)) ) static sh2_memmap sh2_read8_map[0x20], sh2_read16_map[0x20]; // for writes we are using handlers only