mirror of
https://github.com/pskupinski/65816.js.git
synced 2024-09-28 06:58:32 +00:00
added a reset function
This commit is contained in:
parent
5ada2b1daa
commit
4a9456f83f
15
cpu.js
15
cpu.js
@ -252,6 +252,7 @@ function CPU_65816() {
|
||||
this.mmu.load_rom(raw_hex);
|
||||
this.r.pc = 0x8000;
|
||||
|
||||
// Skip the header(the first 512 bytes) if there is one present for now.
|
||||
if(has_header) {
|
||||
this.r.pc += 4096;
|
||||
}
|
||||
@ -366,6 +367,15 @@ function CPU_65816() {
|
||||
executing = false;
|
||||
}
|
||||
};
|
||||
|
||||
this.reset = function() {
|
||||
this.waiting = false;
|
||||
this.stopped = false;
|
||||
this.interrupt = this.INTERRUPT.NO_INTERRUPT;
|
||||
this.r = { a:0, b:0, x:0, y:0, d:0, s:0xff, pc:0, dbr:0, k:0 };
|
||||
this.p = { e:1, c:0, z:0, i:0, d:0, x:0, m:0, v:0, n:0 };
|
||||
this.mmu.reset();
|
||||
};
|
||||
}
|
||||
|
||||
var MMU = {
|
||||
@ -373,6 +383,11 @@ var MMU = {
|
||||
memory: { 0: {} },
|
||||
memory_mapped_io_devices: {},
|
||||
|
||||
reset: function() {
|
||||
this.memory ={ 0: {} };
|
||||
this.memory_mapped_io_devices = {};
|
||||
},
|
||||
|
||||
add_memory_mapped_io_device: function(write_callback, read_callback, bank,
|
||||
location) {
|
||||
if(typeof this.memory_mapped_io_devices[bank] === 'undefined') {
|
||||
|
@ -13,7 +13,7 @@ $(document).ready(function() {
|
||||
updateFields();
|
||||
});
|
||||
$("#reset").click(function() {
|
||||
cpu = new CPU_65816();
|
||||
cpu.reset();
|
||||
$("#hex").val("");
|
||||
updateFields();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user