Added reset button
This commit is contained in:
parent
3d050b8b55
commit
50260f060e
@ -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>
|
||||
|
22
js/main.js
22
js/main.js
@ -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();
|
||||
});
|
Loading…
Reference in New Issue
Block a user