Mercurial > repos > blastem
comparison genesis.c @ 1420:975b5b7eaa77
Fix DMA from byte-wide SRAM
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 26 Jun 2017 21:13:17 -0700 |
parents | 11ac0b511cff |
children | 4e5797b3935a |
comparison
equal
deleted
inserted
replaced
1419:92e7dafcc0dc | 1420:975b5b7eaa77 |
---|---|
33 #define MAX_SOUND_CYCLES 100000 | 33 #define MAX_SOUND_CYCLES 100000 |
34 | 34 |
35 uint16_t read_dma_value(uint32_t address) | 35 uint16_t read_dma_value(uint32_t address) |
36 { | 36 { |
37 genesis_context *genesis = (genesis_context *)current_system; | 37 genesis_context *genesis = (genesis_context *)current_system; |
38 //TODO: Figure out what happens when you try to DMA from weird adresses like IO or banked Z80 area | |
39 if ((address >= 0xA00000 && address < 0xB00000) || (address >= 0xC00000 && address <= 0xE00000)) { | |
40 return 0; | |
41 } | |
42 | |
38 //addresses here are word addresses (i.e. bit 0 corresponds to A1), so no need to do multiply by 2 | 43 //addresses here are word addresses (i.e. bit 0 corresponds to A1), so no need to do multiply by 2 |
39 uint16_t *ptr = get_native_pointer(address*2, (void **)genesis->m68k->mem_pointers, &genesis->m68k->options->gen); | 44 return read_word(address * 2, (void **)genesis->m68k->mem_pointers, &genesis->m68k->options->gen, genesis->m68k); |
40 if (ptr) { | |
41 return *ptr; | |
42 } | |
43 //TODO: Figure out what happens when you try to DMA from weird adresses like IO or banked Z80 area | |
44 return 0; | |
45 } | 45 } |
46 | 46 |
47 static uint16_t get_open_bus_value(system_header *system) | 47 static uint16_t get_open_bus_value(system_header *system) |
48 { | 48 { |
49 genesis_context *genesis = (genesis_context *)system; | 49 genesis_context *genesis = (genesis_context *)system; |