From 4de2e3ee747fc30a1d111280a91309248846ef17 Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Fri, 10 May 2013 23:16:06 -0700 Subject: Implement hblank flag in status register --- vdp.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'vdp.c') diff --git a/vdp.c b/vdp.c index 095b9c4..bda38ba 100644 --- a/vdp.c +++ b/vdp.c @@ -1193,17 +1193,21 @@ uint16_t vdp_control_port_read(vdp_context * context) if (context->flags2 & FLAG2_VINT_PENDING) { value |- 0x80; } - if (context->flags & FLAG_DMA_RUN) { - value |= 0x2; - } uint32_t line= context->cycles / MCLKS_LINE; + uint32_t linecyc = context->cycles % MCLKS_LINE; if (line >= (context->latched_mode & BIT_PAL ? PAL_ACTIVE : NTSC_ACTIVE)) { value |= 0x8; } + if (linecyc < (context->latched_mode & BIT_H40 ? (148 + 61) * 4 : ( + 46) * 5)) { + value |= 0x4; + } + if (context->flags & FLAG_DMA_RUN) { + value |= 0x2; + } if (context->latched_mode & BIT_PAL) {//Not sure about this, need to verify value |= 0x1; } - //TODO: Lots of other bits in status port + //TODO: Sprite overflow, sprite collision, odd frame flag return value; } -- cgit v1.2.3