From 1c25c32c114f8cb76674287d2c85ee5677bfacf7 Mon Sep 17 00:00:00 2001 From: notaz Date: Tue, 17 Oct 2017 00:53:35 +0300 Subject: [PATCH] sms: improve sr a bit --- pico/mode4.c | 11 ++++++++++- pico/sms.c | 9 ++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/pico/mode4.c b/pico/mode4.c index 0f3d766b..a13c38b0 100644 --- a/pico/mode4.c +++ b/pico/mode4.c @@ -91,7 +91,7 @@ static void draw_sprites(int scanline) } sprite_base = (pv->reg[6] & 4) << (13-2-1); - for (i = s = 0; i < 64 && s < 8; i++) + for (i = s = 0; i < 64; i++) { int y; y = sat[i] + 1; @@ -99,6 +99,10 @@ static void draw_sprites(int scanline) break; if (y + h <= scanline || scanline < y) continue; // not on this line + if (s >= 8) { + pv->status |= SR_SOVR; + break; + } sprites_x[s] = xoff + sat[0x80 + i*2]; sprites_addr[s] = sprite_base + ((sat[0x80 + i*2 + 1] & addr_mask) << (5-1)) + @@ -106,6 +110,10 @@ static void draw_sprites(int scanline) s++; } + // really half-assed but better than nothing + if (s > 1) + pv->status |= SR_C; + // now draw all sprites backwards for (--s; s >= 0; s--) TileNormM4(sprites_x[s], sprites_addr[s], 0x10); @@ -300,3 +308,4 @@ void PicoDrawSetOutputMode4(pdso_t which) } } +// vim:shiftwidth=2:ts=2:expandtab diff --git a/pico/sms.c b/pico/sms.c index a2351b0f..9e80c984 100644 --- a/pico/sms.c +++ b/pico/sms.c @@ -31,9 +31,12 @@ static unsigned char vdp_data_read(void) static unsigned char vdp_ctl_read(void) { - unsigned char d = Pico.video.pending_ints << 7; - Pico.video.pending = 0; - Pico.video.pending_ints = 0; + struct PicoVideo *pv = &Pico.video; + unsigned char d; + + d = pv->status | (pv->pending_ints << 7); + pv->pending = pv->pending_ints = 0; + pv->status = 0; elprintf(EL_SR, "VDP sr: %02x", d); return d; -- 2.39.5