summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pavone <pavone@retrodev.com>2012-12-09 00:03:15 -0800
committerMike Pavone <pavone@retrodev.com>2012-12-09 00:03:15 -0800
commit3a5a40ac5415e6b4385b8c6d3604832b3c468b02 (patch)
tree4e1db427fedb16c95918df53c0357e89dedcadd4
parent6a40ba38c0f76b4253cd2727854f57f36282afee (diff)
Implement sprite index >= sprite limit triggers sprite limit behavior
-rw-r--r--vdp.c9
-rw-r--r--vdp.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/vdp.c b/vdp.c
index fc7f6ba..4a6d45b 100644
--- a/vdp.c
+++ b/vdp.c
@@ -59,6 +59,15 @@ void scan_sprite_table(uint32_t line, vdp_context * context)
line += 1;
line &= 0xFF;
context->sprite_index &= 0x7F;
+ if (context->latched_mode & BIT_H40) {
+ if (context->sprite_index >= MAX_SPRITES_FRAME) {
+ context->sprite_index = 0;
+ return;
+ }
+ } else if(context->sprite_index >= MAX_SPRITES_FRAME_H32) {
+ context->sprite_index = 0;
+ return;
+ }
//TODO: Read from SAT cache rather than from VRAM
uint16_t sat_address = (context->regs[REG_SAT] & 0x7F) << 9;
uint16_t address = context->sprite_index * 8 + sat_address;
diff --git a/vdp.h b/vdp.h
index 9ff787c..d4b7f49 100644
--- a/vdp.h
+++ b/vdp.h
@@ -15,6 +15,8 @@
#define MAX_DRAWS_H32 32
#define MAX_SPRITES_LINE 20
#define MAX_SPRITES_LINE_H32 16
+#define MAX_SPRITES_FRAME 80
+#define MAX_SPRITES_FRAME_H32 64
enum {
REG_MODE_1=0,