Additional assertions for the return value of mmap_read8 and mmap_read16
This commit is contained in:
parent
23d4f862e6
commit
65a75d4fe3
|
@ -3,7 +3,9 @@
|
||||||
|
|
||||||
CPU.prototype.mmap_read8 = function(addr)
|
CPU.prototype.mmap_read8 = function(addr)
|
||||||
{
|
{
|
||||||
return this.memory_map_read8[addr >>> MMAP_BLOCK_BITS](addr);
|
const value = this.memory_map_read8[addr >>> MMAP_BLOCK_BITS](addr);
|
||||||
|
dbg_assert(value >= 0 && value <= 0xFF);
|
||||||
|
return value;
|
||||||
};
|
};
|
||||||
|
|
||||||
CPU.prototype.mmap_write8 = function(addr, value)
|
CPU.prototype.mmap_write8 = function(addr, value)
|
||||||
|
@ -15,8 +17,9 @@ CPU.prototype.mmap_write8 = function(addr, value)
|
||||||
CPU.prototype.mmap_read16 = function(addr)
|
CPU.prototype.mmap_read16 = function(addr)
|
||||||
{
|
{
|
||||||
var fn = this.memory_map_read8[addr >>> MMAP_BLOCK_BITS];
|
var fn = this.memory_map_read8[addr >>> MMAP_BLOCK_BITS];
|
||||||
|
const value = fn(addr) | fn(addr + 1 | 0) << 8;
|
||||||
return fn(addr) | fn(addr + 1 | 0) << 8;
|
dbg_assert(value >= 0 && value <= 0xFFFF);
|
||||||
|
return value;
|
||||||
};
|
};
|
||||||
|
|
||||||
CPU.prototype.mmap_write16 = function(addr, value)
|
CPU.prototype.mmap_write16 = function(addr, value)
|
||||||
|
|
Loading…
Reference in a new issue