diff --git a/index.html b/index.html index f80f9bf..4982290 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,9 @@ MatCat's 8SA1 CPU Simulator +
+ +
ADDRESS:
diff --git a/js/main.js b/js/main.js index 2878378..a0a8144 100644 --- a/js/main.js +++ b/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(); }); \ No newline at end of file