# HG changeset patch # User Mike Pavone # Date 1355040195 28800 # Node ID 898e3d035f422bd093876f4a1514c621820307ab # Parent cd59519b26d95f4f0de08c7a5e6f8a5220756d76 Implement sprite index >= sprite limit triggers sprite limit behavior diff -r cd59519b26d9 -r 898e3d035f42 vdp.c --- a/vdp.c Sat Dec 08 23:49:51 2012 -0800 +++ b/vdp.c Sun Dec 09 00:03:15 2012 -0800 @@ -59,6 +59,15 @@ 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 -r cd59519b26d9 -r 898e3d035f42 vdp.h --- a/vdp.h Sat Dec 08 23:49:51 2012 -0800 +++ b/vdp.h Sun Dec 09 00:03:15 2012 -0800 @@ -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,