diff options
author | Mike Pavone <pavone@retrodev.com> | 2013-05-10 23:16:06 -0700 |
---|---|---|
committer | Mike Pavone <pavone@retrodev.com> | 2013-05-10 23:16:06 -0700 |
commit | 4de2e3ee747fc30a1d111280a91309248846ef17 (patch) | |
tree | 2d5eefb729a790d7ef514dcbcdf4f858adfd8dc1 | |
parent | 4e397aba753736184ba07cb5d19a67b8e572745b (diff) |
Implement hblank flag in status register
-rw-r--r-- | vdp.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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; } |