The mem.c fix needed for the PCnet not to BSoD.

This commit is contained in:
OBattler
2019-12-02 20:15:30 +01:00
parent 7f488e14b9
commit 7fec4a20fa
2 changed files with 42 additions and 32 deletions

View File

@@ -12,7 +12,7 @@
* the DYNAMIC_TABLES=1 enables this. Will eventually go * the DYNAMIC_TABLES=1 enables this. Will eventually go
* away, either way... * away, either way...
* *
* Version: @(#)mem.c 1.0.21 2019/10/19 * Version: @(#)mem.c 1.0.22 2019/12/02
* *
* Authors: Sarah Walker, <tommowalker@tommowalker.co.uk> * Authors: Sarah Walker, <tommowalker@tommowalker.co.uk>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -866,11 +866,11 @@ mem_readb_phys(uint32_t addr)
mem_readb_phys(uint32_t addr) mem_readb_phys(uint32_t addr)
{ {
mem_mapping_t *map = read_mapping[addr >> MEM_GRANULARITY_BITS]; mem_mapping_t *map = read_mapping[addr >> MEM_GRANULARITY_BITS];
mem_logical_addr = 0xffffffff; if (_mem_exec[addr >> MEM_GRANULARITY_BITS])
return _mem_exec[addr >> MEM_GRANULARITY_BITS][addr & MEM_GRANULARITY_MASK];
else if (map && map->read_b) else if (map && map->read_b)
return map->read_b(addr, map->p); return map->read_b(addr, map->p);
else else
return 0xff; return 0xff;
} }
@@ -879,13 +879,18 @@ uint16_t
uint16_t uint16_t
mem_readw_phys(uint32_t addr) mem_readw_phys(uint32_t addr)
{ {
mem_mapping_t *map = read_mapping[addr >> MEM_GRANULARITY_BITS];
uint16_t temp; uint16_t temp;
mem_logical_addr = 0xffffffff; if (_mem_exec[addr >> MEM_GRANULARITY_BITS])
return ((uint16_t *) _mem_exec[addr >> MEM_GRANULARITY_BITS])[(addr >> 1) & MEM_GRANULARITY_HMASK];
else if (map && map->read_w) else if (map && map->read_w)
return map->read_w(addr, map->p);
else {
temp = mem_readb_phys(addr + 1) << 8;
temp |= mem_readb_phys(addr);
} }
return temp; return temp;
} }
@@ -894,9 +899,9 @@ mem_writeb_phys(uint32_t addr, uint8_t val)
mem_writeb_phys(uint32_t addr, uint8_t val) mem_writeb_phys(uint32_t addr, uint8_t val)
{ {
mem_mapping_t *map = write_mapping[addr >> MEM_GRANULARITY_BITS]; mem_mapping_t *map = write_mapping[addr >> MEM_GRANULARITY_BITS];
mem_logical_addr = 0xffffffff; if (_mem_exec[addr >> MEM_GRANULARITY_BITS])
_mem_exec[addr >> MEM_GRANULARITY_BITS][addr & MEM_GRANULARITY_MASK] = val;
else if (map && map->write_b) else if (map && map->write_b)
map->write_b(addr, val, map->p); map->write_b(addr, val, map->p);
} }

View File

@@ -12,7 +12,7 @@
* the DYNAMIC_TABLES=1 enables this. Will eventually go * the DYNAMIC_TABLES=1 enables this. Will eventually go
* away, either way... * away, either way...
* *
* Version: @(#)mem.c 1.0.21 2019/10/19 * Version: @(#)mem.c 1.0.22 2019/12/02
* *
* Authors: Sarah Walker, <tommowalker@tommowalker.co.uk> * Authors: Sarah Walker, <tommowalker@tommowalker.co.uk>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -843,11 +843,11 @@ mem_readb_phys(uint32_t addr)
{ {
mem_mapping_t *map = read_mapping[addr >> MEM_GRANULARITY_BITS]; mem_mapping_t *map = read_mapping[addr >> MEM_GRANULARITY_BITS];
mem_logical_addr = 0xffffffff; if (_mem_exec[addr >> MEM_GRANULARITY_BITS])
return _mem_exec[addr >> MEM_GRANULARITY_BITS][addr & MEM_GRANULARITY_MASK];
if (map && map->read_b) else if (map && map->read_b)
return map->read_b(addr, map->p); return map->read_b(addr, map->p);
else
return 0xff; return 0xff;
} }
@@ -856,13 +856,18 @@ uint16_t
mem_readw_phys(uint32_t addr) mem_readw_phys(uint32_t addr)
{ {
mem_mapping_t *map = read_mapping[addr >> MEM_GRANULARITY_BITS]; mem_mapping_t *map = read_mapping[addr >> MEM_GRANULARITY_BITS];
uint16_t temp;
mem_logical_addr = 0xffffffff; if (_mem_exec[addr >> MEM_GRANULARITY_BITS])
return ((uint16_t *) _mem_exec[addr >> MEM_GRANULARITY_BITS])[(addr >> 1) & MEM_GRANULARITY_HMASK];
if (map && map->read_w) else if (map && map->read_w)
return map->read_w(addr, map->p); return map->read_w(addr, map->p);
else {
temp = mem_readb_phys(addr + 1) << 8;
temp |= mem_readb_phys(addr);
}
return mem_readb_phys(addr) | (mem_readb_phys(addr + 1) << 8); return temp;
} }
@@ -871,9 +876,9 @@ mem_writeb_phys(uint32_t addr, uint8_t val)
{ {
mem_mapping_t *map = write_mapping[addr >> MEM_GRANULARITY_BITS]; mem_mapping_t *map = write_mapping[addr >> MEM_GRANULARITY_BITS];
mem_logical_addr = 0xffffffff; if (_mem_exec[addr >> MEM_GRANULARITY_BITS])
_mem_exec[addr >> MEM_GRANULARITY_BITS][addr & MEM_GRANULARITY_MASK] = val;
if (map && map->write_b) else if (map && map->write_b)
map->write_b(addr, val, map->p); map->write_b(addr, val, map->p);
} }