[SMS] fixed number of pages for ROM sizes which are not a factor of page size

This commit is contained in:
ekeeke31 2012-04-05 21:26:06 +00:00
parent c294796fdc
commit d042eebd83

View File

@ -427,17 +427,17 @@ void sms_cart_init(void)
if (cart_rom.mapper < MAPPER_SEGA)
{
/* 1k ROM banks */
cart_rom.pages = cart.romsize >> 10;
cart_rom.pages = (cart.romsize + (1 << 10) - 1) >> 10;
}
else if (cart_rom.mapper & MAPPER_KOREA_8K)
{
/* 8k ROM banks */
cart_rom.pages = cart.romsize >> 13;
cart_rom.pages = (cart.romsize + (1 << 13) - 1) >> 13;
}
else
{
/* 16k ROM banks */
cart_rom.pages = cart.romsize >> 14;
cart_rom.pages = (cart.romsize + (1 << 14) - 1) >> 14;
}
/* initialize extra hardware */