comparison vdp.c @ 499:27345a67225d

Merge
author Mike Pavone <pavone@retrodev.com>
date Tue, 29 Oct 2013 00:03:11 -0700
parents 32f053ad9b02 8ac0eb05642c
children eee6be465c47
comparison
equal deleted inserted replaced
498:51bf87f76d15 499:27345a67225d
157 } 157 }
158 //printf("Draw Slot %d of %d, Rendering sprite cell from %X to x: %d\n", context->cur_slot, context->sprite_draws, d->address, x); 158 //printf("Draw Slot %d of %d, Rendering sprite cell from %X to x: %d\n", context->cur_slot, context->sprite_draws, d->address, x);
159 context->cur_slot--; 159 context->cur_slot--;
160 for (uint16_t address = d->address; address != ((d->address+4) & 0xFFFF); address++) { 160 for (uint16_t address = d->address; address != ((d->address+4) & 0xFFFF); address++) {
161 if (x >= 0 && x < 320 && !(context->linebuf[x] & 0xF)) { 161 if (x >= 0 && x < 320 && !(context->linebuf[x] & 0xF)) {
162 if (context->linebuf[x] && (context->vdpmem[address] >> 4)) {
163 context->flags2 |= FLAG2_SPRITE_COLLIDE;
164 }
162 context->linebuf[x] = (context->vdpmem[address] >> 4) | d->pal_priority; 165 context->linebuf[x] = (context->vdpmem[address] >> 4) | d->pal_priority;
163 } 166 }
164 x += dir; 167 x += dir;
165 if (x >= 0 && x < 320 && !(context->linebuf[x] & 0xF)) { 168 if (x >= 0 && x < 320 && !(context->linebuf[x] & 0xF)) {
169 if (context->linebuf[x] && (context->vdpmem[address] & 0xF)) {
170 context->flags2 |= FLAG2_SPRITE_COLLIDE;
171 }
166 context->linebuf[x] = (context->vdpmem[address] & 0xF) | d->pal_priority; 172 context->linebuf[x] = (context->vdpmem[address] & 0xF) | d->pal_priority;
167 } 173 }
168 x += dir; 174 x += dir;
169 } 175 }
170 } 176 }
1540 value |= 0x100; 1546 value |= 0x100;
1541 } 1547 }
1542 if (context->flags2 & FLAG2_VINT_PENDING) { 1548 if (context->flags2 & FLAG2_VINT_PENDING) {
1543 value |= 0x80; 1549 value |= 0x80;
1544 } 1550 }
1551 if (context->flags & FLAG_DOT_OFLOW) {
1552 value |= 0x40;
1553 }
1554 if (context->flags2 & FLAG2_SPRITE_COLLIDE) {
1555 value |= 0x20;
1556 //TODO: Test when this is actually cleared
1557 context->flags2 &= ~FLAG2_SPRITE_COLLIDE;
1558 }
1545 if ((context->regs[REG_MODE_4] & BIT_INTERLACE) && context->framebuf == context->oddbuf) { 1559 if ((context->regs[REG_MODE_4] & BIT_INTERLACE) && context->framebuf == context->oddbuf) {
1546 value |= 0x10; 1560 value |= 0x10;
1547 } 1561 }
1548 uint32_t line= context->cycles / MCLKS_LINE; 1562 uint32_t line= context->cycles / MCLKS_LINE;
1549 uint32_t linecyc = context->cycles % MCLKS_LINE; 1563 uint32_t linecyc = context->cycles % MCLKS_LINE;
1558 } 1572 }
1559 if (context->latched_mode & BIT_PAL) {//Not sure about this, need to verify 1573 if (context->latched_mode & BIT_PAL) {//Not sure about this, need to verify
1560 value |= 0x1; 1574 value |= 0x1;
1561 } 1575 }
1562 //printf("status read at cycle %d returned %X\n", context->cycles, value); 1576 //printf("status read at cycle %d returned %X\n", context->cycles, value);
1563 //TODO: Sprite overflow, sprite collision, odd frame flag
1564 return value; 1577 return value;
1565 } 1578 }
1566 1579
1567 #define CRAM_BITS 0xEEE 1580 #define CRAM_BITS 0xEEE
1568 #define VSRAM_BITS 0x7FF 1581 #define VSRAM_BITS 0x7FF