Let CPU use bus to emit cpu-halt event

This commit is contained in:
Amaan Cheval 2017-06-01 19:58:03 +05:30 committed by Fabian
parent 281841492c
commit bfefe38ade

View file

@ -11,7 +11,7 @@ var CPU_LOG_VERBOSE = true;
/** @constructor */
function CPU()
function CPU(bus)
{
/** @type {number} */
this.memory_size = 0;
@ -243,6 +243,8 @@ function CPU()
this.io = undefined;
this.fpu = undefined;
this.bus = bus;
dbg_assert(this.table16 && this.table32);
dbg_assert(this.table0F_16 && this.table0F_32);
@ -3022,6 +3024,7 @@ CPU.prototype.hlt_op = function()
if((this.flags & flag_interrupt) === 0)
{
this.debug.show("cpu halted");
this.bus.send("cpu-halt");
if(DEBUG) this.debug.dump_regs();
throw "HALT";
}