Mercurial > repos > blastem
comparison vdp.c @ 2258:a28e1042f4de
Fix a few of the most glaring TMS9918A issues
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 18 Dec 2022 15:11:30 -0800 |
parents | 1e626d0ecf9c |
children | 425b44fd7bf1 |
comparison
equal
deleted
inserted
replaced
2257:1e626d0ecf9c | 2258:a28e1042f4de |
---|---|
246 } else { | 246 } else { |
247 static const uint8_t tms_to_sms[] = { | 247 static const uint8_t tms_to_sms[] = { |
248 0x00, 0x00, 0x08, 0x0C, 0x10, 0x30, 0x01, 0x3C, 0x02, 0x03, 0x05, 0x0F, 0x04, 0x33, 0x15, 0x3F | 248 0x00, 0x00, 0x08, 0x0C, 0x10, 0x30, 0x01, 0x3C, 0x02, 0x03, 0x05, 0x0F, 0x04, 0x33, 0x15, 0x3F |
249 }; | 249 }; |
250 index = tms_to_sms[index] << 1; | 250 index = tms_to_sms[index] << 1; |
251 index = (index & 0xE) | (index << 1 & 0x80); | 251 index = (index & 0xE) | (index << 1 & 0xE0); |
252 //TODO: Mode 4 has a separate DAC tap so this isn't quite correct | 252 //TODO: Mode 4 has a separate DAC tap so this isn't quite correct |
253 //TODO: blue channel has one of its taps offest on SMS1 and MD | 253 //TODO: blue channel has one of its taps offest on SMS1 and MD |
254 b = levels[(index >> 4 & 0xC) | (index >> 6 & 0x2)]; | 254 b = levels[(index >> 4 & 0xC) | (index >> 6 & 0x2)]; |
255 g = levels[(index >> 2 & 0x8) | (index >> 1 & 0x4) | (index >> 4 & 0x2)]; | 255 g = levels[(index >> 2 & 0x8) | (index >> 1 & 0x4) | (index >> 4 & 0x2)]; |
256 r = levels[(index << 1 & 0xC) | (index >> 1 & 0x2)]; | 256 r = levels[(index << 1 & 0xC) | (index >> 1 & 0x2)]; |
3609 pattern_name_mask = 0x07F8; | 3609 pattern_name_mask = 0x07F8; |
3610 } | 3610 } |
3611 address &= 0x2000; | 3611 address &= 0x2000; |
3612 address |= context->vcounter << 5 & upper_vcounter_mask; | 3612 address |= context->vcounter << 5 & upper_vcounter_mask; |
3613 address |= context->col_1 << 3 & pattern_name_mask; | 3613 address |= context->col_1 << 3 & pattern_name_mask; |
3614 address |= context->vcounter & 3; | 3614 address |= context->vcounter & 7; |
3615 } else { | 3615 } else { |
3616 address |= context->col_1 >> 3; | 3616 address |= context->col_1 >> 3; |
3617 } | 3617 } |
3618 //TODO: 4K/16K mode address remapping when emulating TMS9918A | 3618 //TODO: 4K/16K mode address remapping when emulating TMS9918A |
3619 address = mode4_address_map[address] ^ 1; | 3619 address = mode4_address_map[address] ^ 1; |
3767 for (int i = 0; i < 4; i++) { | 3767 for (int i = 0; i < 4; i++) { |
3768 if (x >= context->sprite_draw_list[i].x_pos) { | 3768 if (x >= context->sprite_draw_list[i].x_pos) { |
3769 if (context->sprite_draw_list[i].address & 0x8000) { | 3769 if (context->sprite_draw_list[i].address & 0x8000) { |
3770 if (output) { | 3770 if (output) { |
3771 context->flags2 |= FLAG2_SPRITE_COLLIDE; | 3771 context->flags2 |= FLAG2_SPRITE_COLLIDE; |
3772 } | 3772 } else { |
3773 output = context->sprite_draw_list[i].pal_priority; | 3773 output = context->sprite_draw_list[i].pal_priority; |
3774 } | |
3774 } | 3775 } |
3775 context->sprite_draw_list[i].address <<= 1; | 3776 context->sprite_draw_list[i].address <<= 1; |
3776 } | 3777 } |
3777 } | 3778 } |
3778 return output; | 3779 return output; |