Mercurial > repos > blastem
comparison vdp.c @ 2263:a98b2d0de2f1
Fix TMS9918A first line sprite bug
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 23 Dec 2022 09:08:47 -0800 |
parents | 3f155bc13183 |
children | c7781cc950e9 |
comparison
equal
deleted
inserted
replaced
2262:bc68560b4a04 | 2263:a98b2d0de2f1 |
---|---|
4315 vint_line = context->inactive_start + 1; | 4315 vint_line = context->inactive_start + 1; |
4316 vint_slot = VINT_SLOT_MODE4; | 4316 vint_slot = VINT_SLOT_MODE4; |
4317 line_change = LINE_CHANGE_MODE4; | 4317 line_change = LINE_CHANGE_MODE4; |
4318 jump_start = 147; | 4318 jump_start = 147; |
4319 jump_dest = 233; | 4319 jump_dest = 233; |
4320 if (context->regs[REG_MODE_1] & BIT_MODE_4 || context->type != VDP_GENESIS) { | 4320 if ((context->regs[REG_MODE_1] & BIT_MODE_4) || context->type != VDP_GENESIS) { |
4321 active_line = 0x1FF; | 4321 active_line = 0x1FF; |
4322 } else { | 4322 } else { |
4323 //never active unless either mode 4 or mode 5 is turned on | 4323 //never active unless either mode 4 or mode 5 is turned on |
4324 active_line = 0x200; | 4324 active_line = 0x200; |
4325 } | 4325 } |
4367 } | 4367 } |
4368 | 4368 |
4369 if (context->hslot == buf_clear_slot) { | 4369 if (context->hslot == buf_clear_slot) { |
4370 if (mode_5) { | 4370 if (mode_5) { |
4371 context->cur_slot = max_draws; | 4371 context->cur_slot = max_draws; |
4372 } else { | 4372 } else if ((context->regs[REG_MODE_1] & BIT_MODE_4) || context->type == VDP_GENESIS) { |
4373 context->cur_slot = context->sprite_index = MAX_DRAWS_H32_MODE4-1; | 4373 context->cur_slot = context->sprite_index = MAX_DRAWS_H32_MODE4-1; |
4374 context->sprite_draws = MAX_DRAWS_H32_MODE4; | 4374 context->sprite_draws = MAX_DRAWS_H32_MODE4; |
4375 } else { | |
4376 context->sprite_draws = 0; | |
4375 } | 4377 } |
4376 memset(context->linebuf, 0, LINEBUF_SIZE); | 4378 memset(context->linebuf, 0, LINEBUF_SIZE); |
4377 } else if (context->hslot == index_reset_slot) { | 4379 } else if (context->hslot == index_reset_slot) { |
4378 context->sprite_index = index_reset_value; | 4380 context->sprite_index = index_reset_value; |
4379 context->slot_counter = mode_5 ? 0 : max_sprites; | 4381 context->slot_counter = mode_5 ? 0 : max_sprites; |
4396 uint8_t bg_index; | 4398 uint8_t bg_index; |
4397 uint32_t bg_color; | 4399 uint32_t bg_color; |
4398 if (mode_5) { | 4400 if (mode_5) { |
4399 bg_index = context->regs[REG_BG_COLOR] & 0x3F; | 4401 bg_index = context->regs[REG_BG_COLOR] & 0x3F; |
4400 bg_color = context->colors[bg_index]; | 4402 bg_color = context->colors[bg_index]; |
4401 } else if (context->regs[REG_MODE_1] & BIT_MODE_4) { | 4403 } else if ((context->regs[REG_MODE_1] & BIT_MODE_4) || context->type != VDP_GENESIS) { |
4402 bg_index = 0x10 + (context->regs[REG_BG_COLOR] & 0xF); | 4404 bg_index = 0x10 + (context->regs[REG_BG_COLOR] & 0xF); |
4403 bg_color = context->colors[MODE4_OFFSET + bg_index]; | 4405 bg_color = context->colors[MODE4_OFFSET + bg_index]; |
4404 } else { | 4406 } else { |
4405 bg_color = render_map_color(0, 0, 0); | 4407 bg_color = context->colors[0]; |
4406 } | 4408 } |
4407 if (context->done_composite) { | 4409 if (context->done_composite) { |
4408 uint8_t pixel = context->compositebuf[dst-context->output]; | 4410 uint8_t pixel = context->compositebuf[dst-context->output]; |
4409 if (!(pixel & 0x3F | test_layer)) { | 4411 if (!(pixel & 0x3F | test_layer)) { |
4410 pixel = pixel & 0xC0 | bg_index; | 4412 pixel = pixel & 0xC0 | bg_index; |