Mercurial > repos > blastem
comparison vdp.c @ 415:8c60c8c09a0f
Fix sprite y mask in interlace mode. Fix framebuffer selection when switching out of interlace mode.
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 23 Jun 2013 10:17:40 -0700 |
parents | 51ee0f117365 |
children | acdd6c5240fe |
comparison
equal
deleted
inserted
replaced
414:51ee0f117365 | 415:8c60c8c09a0f |
---|---|
166 } | 166 } |
167 //TODO: Read from SAT cache rather than from VRAM | 167 //TODO: Read from SAT cache rather than from VRAM |
168 uint16_t sat_address = (context->regs[REG_SAT] & 0x7F) << 9; | 168 uint16_t sat_address = (context->regs[REG_SAT] & 0x7F) << 9; |
169 uint16_t address = context->sprite_index * 8 + sat_address; | 169 uint16_t address = context->sprite_index * 8 + sat_address; |
170 line += ymin; | 170 line += ymin; |
171 uint16_t y = ((context->vdpmem[address] & 0x3) << 8 | context->vdpmem[address+1]) & 0x1FF; | 171 uint16_t y = ((context->vdpmem[address] & 0x3) << 8 | context->vdpmem[address+1]) & ymask; |
172 uint8_t height = ((context->vdpmem[address+2] & 0x3) + 1) * height_mult; | 172 uint8_t height = ((context->vdpmem[address+2] & 0x3) + 1) * height_mult; |
173 //printf("Sprite %d | y: %d, height: %d\n", context->sprite_index, y, height); | 173 //printf("Sprite %d | y: %d, height: %d\n", context->sprite_index, y, height); |
174 if (y <= line && line < (y + height)) { | 174 if (y <= line && line < (y + height)) { |
175 //printf("Sprite %d at y: %d with height %d is on line %d\n", context->sprite_index, y, height, line); | 175 //printf("Sprite %d at y: %d with height %d is on line %d\n", context->sprite_index, y, height, line); |
176 context->sprite_info_list[--(context->slot_counter)].size = context->vdpmem[address+2]; | 176 context->sprite_info_list[--(context->slot_counter)].size = context->vdpmem[address+2]; |
179 } | 179 } |
180 context->sprite_index = context->vdpmem[address+3] & 0x7F; | 180 context->sprite_index = context->vdpmem[address+3] & 0x7F; |
181 if (context->sprite_index && context->slot_counter) | 181 if (context->sprite_index && context->slot_counter) |
182 { | 182 { |
183 address = context->sprite_index * 8 + sat_address; | 183 address = context->sprite_index * 8 + sat_address; |
184 y = ((context->vdpmem[address] & 0x3) << 8 | context->vdpmem[address+1]) & 0x1FF; | 184 y = ((context->vdpmem[address] & 0x3) << 8 | context->vdpmem[address+1]) & ymask; |
185 height = ((context->vdpmem[address+2] & 0x3) + 1) * height_mult; | 185 height = ((context->vdpmem[address+2] & 0x3) + 1) * height_mult; |
186 //printf("Sprite %d | y: %d, height: %d\n", context->sprite_index, y, height); | 186 //printf("Sprite %d | y: %d, height: %d\n", context->sprite_index, y, height); |
187 if (y <= line && line < (y + height)) { | 187 if (y <= line && line < (y + height)) { |
188 //printf("Sprite %d at y: %d with height %d is on line %d\n", context->sprite_index, y, height, line); | 188 //printf("Sprite %d at y: %d with height %d is on line %d\n", context->sprite_index, y, height, line); |
189 context->sprite_info_list[--(context->slot_counter)].size = context->vdpmem[address+2]; | 189 context->sprite_info_list[--(context->slot_counter)].size = context->vdpmem[address+2]; |
1348 if (reg == REG_MODE_2) { | 1348 if (reg == REG_MODE_2) { |
1349 //printf("Display is now %s\n", (context->regs[REG_MODE_2] & DISPLAY_ENABLE) ? "enabled" : "disabled"); | 1349 //printf("Display is now %s\n", (context->regs[REG_MODE_2] & DISPLAY_ENABLE) ? "enabled" : "disabled"); |
1350 } | 1350 } |
1351 if (reg == REG_MODE_4) { | 1351 if (reg == REG_MODE_4) { |
1352 context->double_res = (value & (BIT_INTERLACE | BIT_DOUBLE_RES)) == (BIT_INTERLACE | BIT_DOUBLE_RES); | 1352 context->double_res = (value & (BIT_INTERLACE | BIT_DOUBLE_RES)) == (BIT_INTERLACE | BIT_DOUBLE_RES); |
1353 if (!context->double_res) { | |
1354 context->framebuf = context->oddbuf; | |
1355 } | |
1353 } | 1356 } |
1354 } | 1357 } |
1355 } else { | 1358 } else { |
1356 context->flags |= FLAG_PENDING; | 1359 context->flags |= FLAG_PENDING; |
1357 context->address = (context->address &0xC000) | (value & 0x3FFF); | 1360 context->address = (context->address &0xC000) | (value & 0x3FFF); |