comparison genesis.c @ 1869:dc94354eab66

Fix accuracy bugs used by Novedicus to detect BlastEm/Exodus
author Michael Pavone <pavone@retrodev.com>
date Mon, 24 Jun 2019 23:47:16 -0700
parents 6b5147f08846
children 96971b673f51
comparison
equal deleted inserted replaced
1868:bfacedbae5f0 1869:dc94354eab66
646 //printf("HV Counter: %X at cycle %d\n", value, v_context->cycles); 646 //printf("HV Counter: %X at cycle %d\n", value, v_context->cycles);
647 } 647 }
648 } else if (vdp_port < 0x18){ 648 } else if (vdp_port < 0x18){
649 fatal_error("Illegal read from PSG port %X\n", vdp_port); 649 fatal_error("Illegal read from PSG port %X\n", vdp_port);
650 } else { 650 } else {
651 value = vdp_test_port_read(v_context); 651 value = get_open_bus_value(&gen->header);
652 } 652 }
653 if (v_context->cycles != before_cycle) { 653 if (v_context->cycles != before_cycle) {
654 //printf("68K paused for %d (%d) cycles at cycle %d (%d) for read\n", v_context->cycles - context->current_cycle, v_context->cycles - before_cycle, context->current_cycle, before_cycle); 654 //printf("68K paused for %d (%d) cycles at cycle %d (%d) for read\n", v_context->cycles - context->current_cycle, v_context->cycles - before_cycle, context->current_cycle, before_cycle);
655 context->current_cycle = v_context->cycles; 655 context->current_cycle = v_context->cycles;
656 //Lock the Z80 out of the bus until the VDP access is complete 656 //Lock the Z80 out of the bus until the VDP access is complete
1010 return context->mem_pointers[1][location ^ 1]; 1010 return context->mem_pointers[1][location ^ 1];
1011 } 1011 }
1012 uint32_t address = gen->z80_bank_reg << 15 | location; 1012 uint32_t address = gen->z80_bank_reg << 15 | location;
1013 if (address >= 0xC00000 && address < 0xE00000) { 1013 if (address >= 0xC00000 && address < 0xE00000) {
1014 return z80_vdp_port_read(location & 0xFF, context); 1014 return z80_vdp_port_read(location & 0xFF, context);
1015 } else if (address >= 0xA10000 && address <= 0xA10001) {
1016 //Apparently version reg can be read through Z80 banked area
1017 //TODO: Check rest of IO region addresses
1018 return gen->version_reg;
1015 } else { 1019 } else {
1016 fprintf(stderr, "Unhandled read by Z80 from address %X through banked memory area (%X)\n", address, gen->z80_bank_reg << 15); 1020 fprintf(stderr, "Unhandled read by Z80 from address %X through banked memory area (%X)\n", address, gen->z80_bank_reg << 15);
1017 } 1021 }
1018 return 0; 1022 return 0;
1019 } 1023 }