From d0cb6cfa57bab000f5d171293566fbc42d51d336 Mon Sep 17 00:00:00 2001 From: kub Date: Thu, 21 Oct 2021 20:44:55 +0200 Subject: [PATCH] sms, minor fixes --- pico/mode4.c | 8 ++++---- pico/sms.c | 12 +++++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pico/mode4.c b/pico/mode4.c index 9ed6341e..c0327f95 100644 --- a/pico/mode4.c +++ b/pico/mode4.c @@ -56,8 +56,8 @@ static void TileBGM4(u16 sx, int pal) pd[0] = pd[1] = pal * 0x01010101; } -// 8 pixels are arranged are arranged in 4 bitplanes in a 32 bit word. To pull -// the 4 bitplanes together multiply with each bit distance (multiples of 1<<7) +// 8 pixels are arranged in 4 bitplane bytes in a 32 bit word. To pull the +// 4 bitplanes together multiply with each bit distance (multiples of 1<<7) #define PLANAR_PIXELBG(x,p) \ t = (pack>>(7-p)) & 0x01010101; \ t = (t*0x10204080) >> 28; \ @@ -142,7 +142,7 @@ static void TileDoubleSprM4(int sx, unsigned int pack, int pal) static void DrawSpritesM4(int scanline) { struct PicoVideo *pv = &Pico.video; - unsigned char mb[256/8+2] = {0}; + unsigned char mb[1+256/8+2] = {0}; // zoomed unsigned int sprites_addr[8]; unsigned int sprites_x[8]; unsigned int pack; @@ -375,7 +375,7 @@ static void TileDoubleSprTMS(u16 sx, unsigned int pack, int pal) static void DrawSpritesTMS(int scanline) { struct PicoVideo *pv = &Pico.video; - unsigned char mb[256/8+2] = {0}; + unsigned char mb[1+256/8+4] = {0}; // zoomed+doublesize unsigned int sprites_addr[4]; unsigned int sprites_x[4]; unsigned int pack; diff --git a/pico/sms.c b/pico/sms.c index 765a0ae8..67813420 100644 --- a/pico/sms.c +++ b/pico/sms.c @@ -295,6 +295,7 @@ static void write_bank_sega(unsigned short a, unsigned char d) // 8KB ROM mapping for MSX mapper static void write_bank_msx(unsigned short a, unsigned char d) { + if (Pico.ms.mapper != 2 && (a|d) == 0) return; elprintf(EL_Z80BNK, "bank 8k %04x %02x @ %04x", a, d, z80_pc()); Pico.ms.mapper = 2; // TODO define (more) mapper types Pico.ms.carthw[a] = d; @@ -325,7 +326,7 @@ static void xwrite(unsigned int a, unsigned char d) if (a == 0xa000 && Pico.ms.mapper != 2) write_bank_sega(0xffff, d); // MSX. 4 selectable 8KB banks at the top - if (a <= 0x0003 && Pico.ms.mapper != 1 && (a|d)) + if (a <= 0x0003 && Pico.ms.mapper != 1) write_bank_msx(a, d); } @@ -476,15 +477,20 @@ void PicoFrameMS(void) if (pv->reg[0] & 0x10) { elprintf(EL_INTS, "hint"); z80_int_assert(1); - } + } + } else if (pv->pending_ints & 2) { + pv->pending_ints &= ~2; + z80_int_assert(0); } } else if (y == lines_vis + 1) { + pv->pending_ints &= ~2; pv->pending_ints |= 1; if (pv->reg[1] & 0x20) { elprintf(EL_INTS, "vint"); z80_int_assert(1); - } + } else + z80_int_assert(0); } cycles_aim += cycles_line; -- 2.39.2