Only call pcspeaker-update on writes to counter2 (performance)
This commit is contained in:
parent
65899d2073
commit
4567188324
10
src/pit.js
10
src/pit.js
|
@ -62,7 +62,10 @@ function PIT(cpu, bus)
|
||||||
|
|
||||||
cpu.io.register_write(0x40, this, function(data) { this.counter_write(0, data); });
|
cpu.io.register_write(0x40, this, function(data) { this.counter_write(0, data); });
|
||||||
cpu.io.register_write(0x41, this, function(data) { this.counter_write(1, data); });
|
cpu.io.register_write(0x41, this, function(data) { this.counter_write(1, data); });
|
||||||
cpu.io.register_write(0x42, this, function(data) { this.counter_write(2, data); });
|
cpu.io.register_write(0x42, this, function(data) {
|
||||||
|
this.counter_write(2, data);
|
||||||
|
this.bus.send("pcspeaker-update", [this.counter_mode[2], this.counter_reload[2]]);
|
||||||
|
});
|
||||||
|
|
||||||
cpu.io.register_write(0x43, this, this.port43_write);
|
cpu.io.register_write(0x43, this, this.port43_write);
|
||||||
}
|
}
|
||||||
|
@ -259,8 +262,6 @@ PIT.prototype.counter_write = function(i, value)
|
||||||
{
|
{
|
||||||
this.counter_next_low[i] ^= 1;
|
this.counter_next_low[i] ^= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.bus.send("pcspeaker-update", [this.counter_mode[2], this.counter_reload[2]]);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PIT.prototype.port43_write = function(reg_byte)
|
PIT.prototype.port43_write = function(reg_byte)
|
||||||
|
@ -337,7 +338,10 @@ PIT.prototype.port43_write = function(reg_byte)
|
||||||
this.counter_mode[i] = mode;
|
this.counter_mode[i] = mode;
|
||||||
this.counter_read_mode[i] = read_mode;
|
this.counter_read_mode[i] = read_mode;
|
||||||
|
|
||||||
|
if(i === 2)
|
||||||
|
{
|
||||||
this.bus.send("pcspeaker-update", [this.counter_mode[2], this.counter_reload[2]]);
|
this.bus.send("pcspeaker-update", [this.counter_mode[2], this.counter_reload[2]]);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PIT.prototype.dump = function()
|
PIT.prototype.dump = function()
|
||||||
|
|
Loading…
Reference in a new issue