comparison vdp.c @ 38:898e3d035f42

Implement sprite index >= sprite limit triggers sprite limit behavior
author Mike Pavone <pavone@retrodev.com>
date Sun, 09 Dec 2012 00:03:15 -0800
parents cd59519b26d9
children 3c69319269ef
comparison
equal deleted inserted replaced
37:cd59519b26d9 38:898e3d035f42
57 { 57 {
58 if (context->sprite_index && context->slot_counter) { 58 if (context->sprite_index && context->slot_counter) {
59 line += 1; 59 line += 1;
60 line &= 0xFF; 60 line &= 0xFF;
61 context->sprite_index &= 0x7F; 61 context->sprite_index &= 0x7F;
62 if (context->latched_mode & BIT_H40) {
63 if (context->sprite_index >= MAX_SPRITES_FRAME) {
64 context->sprite_index = 0;
65 return;
66 }
67 } else if(context->sprite_index >= MAX_SPRITES_FRAME_H32) {
68 context->sprite_index = 0;
69 return;
70 }
62 //TODO: Read from SAT cache rather than from VRAM 71 //TODO: Read from SAT cache rather than from VRAM
63 uint16_t sat_address = (context->regs[REG_SAT] & 0x7F) << 9; 72 uint16_t sat_address = (context->regs[REG_SAT] & 0x7F) << 9;
64 uint16_t address = context->sprite_index * 8 + sat_address; 73 uint16_t address = context->sprite_index * 8 + sat_address;
65 int16_t y = ((context->vdpmem[address] & 0x3) << 8 | context->vdpmem[address+1]) - 128; 74 int16_t y = ((context->vdpmem[address] & 0x3) << 8 | context->vdpmem[address+1]) - 128;
66 uint8_t height = ((context->vdpmem[address+2] & 0x3) + 1) * 8; 75 uint8_t height = ((context->vdpmem[address+2] & 0x3) + 1) * 8;