From d042eebd8395947c90135870823f62a96a728e8f Mon Sep 17 00:00:00 2001 From: ekeeke31 Date: Thu, 5 Apr 2012 21:26:06 +0000 Subject: [PATCH] [SMS] fixed number of pages for ROM sizes which are not a factor of page size --- source/cart_hw/sms_cart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/cart_hw/sms_cart.c b/source/cart_hw/sms_cart.c index cd618bcc..d6bc94e6 100644 --- a/source/cart_hw/sms_cart.c +++ b/source/cart_hw/sms_cart.c @@ -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 */