Additional assertions for the return value of mmap_read8 and mmap_read16

This commit is contained in:
Fabian 2021-04-29 17:25:20 -05:00
parent 23d4f862e6
commit 65a75d4fe3

View file

@ -3,7 +3,9 @@
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)
@ -15,8 +17,9 @@ CPU.prototype.mmap_write8 = function(addr, value)
CPU.prototype.mmap_read16 = function(addr)
{
var fn = this.memory_map_read8[addr >>> MMAP_BLOCK_BITS];
return fn(addr) | fn(addr + 1 | 0) << 8;
const value = fn(addr) | fn(addr + 1 | 0) << 8;
dbg_assert(value >= 0 && value <= 0xFFFF);
return value;
};
CPU.prototype.mmap_write16 = function(addr, value)