From 683e90fa06abf5168d65c049e51216cf325ef3fc Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sat, 29 Mar 2014 22:53:52 -0700 Subject: [PATCH] Remove special treatment for DISPSTAT --- src/gba/gba-io.c | 5 +---- src/gba/gba-video.c | 6 ++---- src/gba/gba-video.h | 1 - 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/gba/gba-io.c b/src/gba/gba-io.c index 59c2ec678..217ee8c25 100644 --- a/src/gba/gba-io.c +++ b/src/gba/gba-io.c @@ -355,10 +355,6 @@ void GBAIOWrite32(struct GBA* gba, uint32_t address, uint32_t value) { uint16_t GBAIORead(struct GBA* gba, uint32_t address) { switch (address) { - case REG_DISPSTAT: - return gba->memory.io[REG_DISPSTAT >> 1] | GBAVideoReadDISPSTAT(&gba->video); - break; - case REG_TM0CNT_LO: GBATimerUpdateRegister(gba, 0); break; @@ -390,6 +386,7 @@ uint16_t GBAIORead(struct GBA* gba, uint32_t address) { // Write-only register return 0; case REG_DISPCNT: + case REG_DISPSTAT: case REG_VCOUNT: case REG_BG0CNT: case REG_BG1CNT: diff --git a/src/gba/gba-video.c b/src/gba/gba-video.c index 3fd89e7cc..63bc9a304 100644 --- a/src/gba/gba-video.c +++ b/src/gba/gba-video.c @@ -134,6 +134,8 @@ int32_t GBAVideoProcessEvents(struct GBAVideo* video, int32_t cycles) { video->eventDiff = 0; } + video->p->memory.io[REG_DISPSTAT >> 1] &= 0xFFF8; + video->p->memory.io[REG_DISPSTAT >> 1] |= (video->inVblank) | (video->inHblank << 1) | (video->vcounter << 2); return video->nextEvent; } @@ -154,10 +156,6 @@ void GBAVideoWriteDISPSTAT(struct GBAVideo* video, uint16_t value) { } } -uint16_t GBAVideoReadDISPSTAT(struct GBAVideo* video) { - return (video->inVblank) | (video->inHblank << 1) | (video->vcounter << 2); -} - static void GBAVideoDummyRendererInit(struct GBAVideoRenderer* renderer) { (void)(renderer); // Nothing to do diff --git a/src/gba/gba-video.h b/src/gba/gba-video.h index d75bc9f6c..1bd752128 100644 --- a/src/gba/gba-video.h +++ b/src/gba/gba-video.h @@ -218,7 +218,6 @@ void GBAVideoAssociateRenderer(struct GBAVideo* video, struct GBAVideoRenderer* int32_t GBAVideoProcessEvents(struct GBAVideo* video, int32_t cycles); void GBAVideoWriteDISPSTAT(struct GBAVideo* video, uint16_t value); -uint16_t GBAVideoReadDISPSTAT(struct GBAVideo* video); struct GBASerializedState; void GBAVideoSerialize(struct GBAVideo* video, struct GBASerializedState* state);