Mercurial > repos > blastem
comparison blastem.c @ 981:902c53d9c16f
Half assed, prefetch based open bus value emulation. Gets BlastEm up to 119/122 in VDP FIFO Testing
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 24 Apr 2016 02:19:48 -0700 |
parents | 34b811ea1e7c |
children | 2bc27415565b |
comparison
equal
deleted
inserted
replaced
980:928442068afe | 981:902c53d9c16f |
---|---|
140 return *ptr; | 140 return *ptr; |
141 } | 141 } |
142 } | 142 } |
143 //TODO: Figure out what happens when you try to DMA from weird adresses like IO or banked Z80 area | 143 //TODO: Figure out what happens when you try to DMA from weird adresses like IO or banked Z80 area |
144 return 0; | 144 return 0; |
145 } | |
146 | |
147 uint16_t get_open_bus_value() | |
148 { | |
149 return read_dma_value(genesis->m68k->last_prefetch_address/2); | |
145 } | 150 } |
146 | 151 |
147 void adjust_int_cycle(m68k_context * context, vdp_context * v_context) | 152 void adjust_int_cycle(m68k_context * context, vdp_context * v_context) |
148 { | 153 { |
149 //static int old_int_cycle = CYCLE_NEVER; | 154 //static int old_int_cycle = CYCLE_NEVER; |
703 value = 0xFF; | 708 value = 0xFF; |
704 } | 709 } |
705 } else { | 710 } else { |
706 if (location == 0x1100) { | 711 if (location == 0x1100) { |
707 value = z80_enabled ? !z80_get_busack(gen->z80, context->current_cycle) : !gen->z80->busack; | 712 value = z80_enabled ? !z80_get_busack(gen->z80, context->current_cycle) : !gen->z80->busack; |
708 //TODO: actual pre-fetch emulation | 713 value |= (get_open_bus_value() >> 8) & 0xFE; |
709 value |= 0x4E; | |
710 dprintf("Byte read of BUSREQ returned %d @ %d (reset: %d)\n", value, context->current_cycle, gen->z80->reset); | 714 dprintf("Byte read of BUSREQ returned %d @ %d (reset: %d)\n", value, context->current_cycle, gen->z80->reset); |
711 } else if (location == 0x1200) { | 715 } else if (location == 0x1200) { |
712 value = !gen->z80->reset; | 716 value = !gen->z80->reset; |
713 } else { | 717 } else { |
714 value = 0xFF; | 718 value = 0xFF; |
724 uint16_t value = io_read(location, context); | 728 uint16_t value = io_read(location, context); |
725 if (location < 0x10000 || (location & 0x1FFF) < 0x100) { | 729 if (location < 0x10000 || (location & 0x1FFF) < 0x100) { |
726 value = value | (value << 8); | 730 value = value | (value << 8); |
727 } else { | 731 } else { |
728 value <<= 8; | 732 value <<= 8; |
729 //TODO: actual pre-fetch emulation | 733 value |= get_open_bus_value() & 0xFF; |
730 value |= 0x73; | |
731 } | 734 } |
732 return value; | 735 return value; |
733 } | 736 } |
734 | 737 |
735 void * z80_write_ym(uint32_t location, void * vcontext, uint8_t value) | 738 void * z80_write_ym(uint32_t location, void * vcontext, uint8_t value) |