Mercurial > repos > blastem
comparison vdp.c @ 494:8ac0eb05642c
Initial implementation of sprite overflow and sprite collision status register flags
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 07 Oct 2013 10:02:08 -0700 |
parents | 1f3450d1129f |
children | 27345a67225d |
comparison
equal
deleted
inserted
replaced
493:36c080ece4ed | 494:8ac0eb05642c |
---|---|
154 } | 154 } |
155 //printf("Draw Slot %d of %d, Rendering sprite cell from %X to x: %d\n", context->cur_slot, context->sprite_draws, d->address, x); | 155 //printf("Draw Slot %d of %d, Rendering sprite cell from %X to x: %d\n", context->cur_slot, context->sprite_draws, d->address, x); |
156 context->cur_slot--; | 156 context->cur_slot--; |
157 for (uint16_t address = d->address; address != ((d->address+4) & 0xFFFF); address++) { | 157 for (uint16_t address = d->address; address != ((d->address+4) & 0xFFFF); address++) { |
158 if (x >= 0 && x < 320 && !(context->linebuf[x] & 0xF)) { | 158 if (x >= 0 && x < 320 && !(context->linebuf[x] & 0xF)) { |
159 if (context->linebuf[x] && (context->vdpmem[address] >> 4)) { | |
160 context->flags2 |= FLAG2_SPRITE_COLLIDE; | |
161 } | |
159 context->linebuf[x] = (context->vdpmem[address] >> 4) | d->pal_priority; | 162 context->linebuf[x] = (context->vdpmem[address] >> 4) | d->pal_priority; |
160 } | 163 } |
161 x += dir; | 164 x += dir; |
162 if (x >= 0 && x < 320 && !(context->linebuf[x] & 0xF)) { | 165 if (x >= 0 && x < 320 && !(context->linebuf[x] & 0xF)) { |
166 if (context->linebuf[x] && (context->vdpmem[address] & 0xF)) { | |
167 context->flags2 |= FLAG2_SPRITE_COLLIDE; | |
168 } | |
163 context->linebuf[x] = (context->vdpmem[address] & 0xF) | d->pal_priority; | 169 context->linebuf[x] = (context->vdpmem[address] & 0xF) | d->pal_priority; |
164 } | 170 } |
165 x += dir; | 171 x += dir; |
166 } | 172 } |
167 } | 173 } |
1537 value |= 0x100; | 1543 value |= 0x100; |
1538 } | 1544 } |
1539 if (context->flags2 & FLAG2_VINT_PENDING) { | 1545 if (context->flags2 & FLAG2_VINT_PENDING) { |
1540 value |= 0x80; | 1546 value |= 0x80; |
1541 } | 1547 } |
1548 if (context->flags & FLAG_DOT_OFLOW) { | |
1549 value |= 0x40; | |
1550 } | |
1551 if (context->flags2 & FLAG2_SPRITE_COLLIDE) { | |
1552 value |= 0x20; | |
1553 //TODO: Test when this is actually cleared | |
1554 context->flags2 &= ~FLAG2_SPRITE_COLLIDE; | |
1555 } | |
1542 if ((context->regs[REG_MODE_4] & BIT_INTERLACE) && context->framebuf == context->oddbuf) { | 1556 if ((context->regs[REG_MODE_4] & BIT_INTERLACE) && context->framebuf == context->oddbuf) { |
1543 value |= 0x10; | 1557 value |= 0x10; |
1544 } | 1558 } |
1545 uint32_t line= context->cycles / MCLKS_LINE; | 1559 uint32_t line= context->cycles / MCLKS_LINE; |
1546 uint32_t linecyc = context->cycles % MCLKS_LINE; | 1560 uint32_t linecyc = context->cycles % MCLKS_LINE; |
1555 } | 1569 } |
1556 if (context->latched_mode & BIT_PAL) {//Not sure about this, need to verify | 1570 if (context->latched_mode & BIT_PAL) {//Not sure about this, need to verify |
1557 value |= 0x1; | 1571 value |= 0x1; |
1558 } | 1572 } |
1559 //printf("status read at cycle %d returned %X\n", context->cycles, value); | 1573 //printf("status read at cycle %d returned %X\n", context->cycles, value); |
1560 //TODO: Sprite overflow, sprite collision, odd frame flag | |
1561 return value; | 1574 return value; |
1562 } | 1575 } |
1563 | 1576 |
1564 #define CRAM_BITS 0xEEE | 1577 #define CRAM_BITS 0xEEE |
1565 #define VSRAM_BITS 0x7FF | 1578 #define VSRAM_BITS 0x7FF |