Added reset button

This commit is contained in:
MatCat 2021-04-04 03:40:30 -07:00
parent 3d050b8b55
commit 50260f060e
2 changed files with 25 additions and 0 deletions

View File

@ -3,6 +3,9 @@
<title>MatCat's 8SA1 CPU Simulator</title>
</head>
<body style="font-family: monospace; font-size: 1.5em;">
<div>
<input type="button" id ="btn_rst" value="RESET" />
</div>
<div>
<span>ADDRESS: </span><span id="Address_BUS"></span>
</div>

View File

@ -17,6 +17,7 @@ cpu.RAM[12] = is_PLC.Bytecode;
updateHTML();
let btn_clk = document.getElementById("btn_clk");
let btn_rst = document.getElementById("btn_rst");
let clk_counter = document.getElementById("clk_counter");
let clk_count = 0;
@ -30,4 +31,25 @@ btn_clk.addEventListener('mousedown', function(evt) {
btn_clk.addEventListener('mouseup', function(evt) {
cpu.CLOCK(false);
updateHTML();
});
btn_rst.addEventListener('click', function(evt) {
cpu.PC = 0;
cpu.MCC = 0xf;
cpu.IR = 0;
cpu.DATABUS = 0;
cpu.ADDRBUS = 0;
cpu.MC_Controls = 0;
cpu.ALUSUM = 0;
cpu.RR = 0;
cpu.GPA = 0;
cpu.GPB = 0;
cpu.GPC = 0;
cpu.GPD = 0;
cpu.SR = 0;
cpu.SP = BITMASK_16;
clk_count = 0;
clk_counter.innerText = clk_count;
updateHTML();
});