comparison vdp.c @ 1997:e08c489d5602

Fix regressions from most recent address/cd latch change. Need to do more research still, but probably good enough for now
author Mike Pavone <pavone@retrodev.com>
date Sun, 28 Jun 2020 21:31:09 -0700
parents 00873afe1fe9
children 0740d90812ee
comparison
equal deleted inserted replaced
1996:e35b00626b3e 1997:e08c489d5602
3753 context->address_latch = (context->address_latch & 0x1C000) | (value & 0x3FFF); 3753 context->address_latch = (context->address_latch & 0x1C000) | (value & 0x3FFF);
3754 context->cd_latch = (context->cd_latch & 0x3C) | (value >> 14); 3754 context->cd_latch = (context->cd_latch & 0x3C) | (value >> 14);
3755 if ((value & 0xC000) == 0x8000) { 3755 if ((value & 0xC000) == 0x8000) {
3756 //Register write 3756 //Register write
3757 uint8_t reg = (value >> 8) & 0x1F; 3757 uint8_t reg = (value >> 8) & 0x1F;
3758 // The fact that this is needed seems to pour some cold water on my theory
3759 // about how the address latch actually works. Needs more search to definitively confirm
3760 context->address = (context->address & 0x1C000) | (value & 0x3FFF);
3761 context->cd = (context->cd & 0x3C) | (value >> 14);
3758 if (reg < (mode_5 ? VDP_REGS : 0xB)) { 3762 if (reg < (mode_5 ? VDP_REGS : 0xB)) {
3759 //printf("register %d set to %X\n", reg, value & 0xFF); 3763 //printf("register %d set to %X\n", reg, value & 0xFF);
3760 if (reg == REG_MODE_1 && (value & BIT_HVC_LATCH) && !(context->regs[reg] & BIT_HVC_LATCH)) { 3764 if (reg == REG_MODE_1 && (value & BIT_HVC_LATCH) && !(context->regs[reg] & BIT_HVC_LATCH)) {
3761 vdp_latch_hv(context); 3765 vdp_latch_hv(context);
3762 } 3766 }
3777 } 3781 }
3778 if (reg == REG_MODE_1 || reg == REG_MODE_2 || reg == REG_MODE_4) { 3782 if (reg == REG_MODE_1 || reg == REG_MODE_2 || reg == REG_MODE_4) {
3779 update_video_params(context); 3783 update_video_params(context);
3780 } 3784 }
3781 } 3785 }
3782 // The fact that this is needed seems to pour some cold water on my theory
3783 // about how the address latch actually works. Needs more search to definitively confirm
3784 clear_pending(context);
3785 context->flags &= ~FLAG_READ_FETCHED;
3786 context->flags2 &= ~FLAG2_READ_PENDING;
3787 } else if (mode_5) { 3786 } else if (mode_5) {
3788 context->flags |= FLAG_PENDING; 3787 context->flags |= FLAG_PENDING;
3789 //Should these be taken care of here or after the second write? 3788 //Should these be taken care of here or after the second write?
3790 //context->flags &= ~FLAG_READ_FETCHED; 3789 //context->flags &= ~FLAG_READ_FETCHED;
3791 //context->flags2 &= ~FLAG2_READ_PENDING; 3790 //context->flags2 &= ~FLAG2_READ_PENDING;