Skip to content

Commit

Permalink
UART: Merge uart record feature
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonMo1 committed Aug 31, 2023
2 parents 0d458c3 + 059d3e7 commit 1be80ed
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion component/assembler/asm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2588,7 +2588,7 @@ var Parser = function(e) {
n += "%" + function(e) {
return r(255 & e, 2)
}(e[s]);
t || (t = "asm80.sna"),
t || (t = "Zeal-WebEmulator-File.txt"),
download(t, n)
}
, tapdata = function(e, t) {
Expand Down
8 changes: 8 additions & 0 deletions frontend/css/emulator.css
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,14 @@ hr {
user-select: none;
}

.recterm-onfalse {
color: rgb(163, 49, 34);
}

.recterm-ontrue {
color: rgb(93, 199, 63);
}

#dumpfields {
margin-bottom: 1em;
}
Expand Down
4 changes: 0 additions & 4 deletions frontend/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ $(".tab").on("click", function(){
$(this).addClass("active");
});

$("#clearterm").on("click", function() {
terminal.reset();
});

$(".regaddr").click(function() {
const virtaddr = parseInt($(this).text(), 16);
if (virtaddr || virtaddr == 0) {
Expand Down
17 changes: 17 additions & 0 deletions frontend/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,23 @@ $("#uart-file-send").on("click", function() {
}
});

$("#clearterm").on("click", function() {
terminal.reset();
});

var recterm = false;
var reced_array = [];

$("#recterm").on("click", function() {
recterm =! recterm;
if (recterm == false) {
mkdown(reced_array, "uart_received.bin");
reced_array = [];
}
$("#recterm-on").removeClass();
$("#recterm-on").addClass("recterm-on"+recterm);
});

$("#baudrate").on("change", function() {
const baudrate = $(this).val();
uart.set_baudrate(baudrate);
Expand Down
3 changes: 3 additions & 0 deletions hardemu/uart.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ function UART(Zeal, PIO) {
}
value |= (line << i);
}
if (recterm == true) {
reced_array.push(value);
}
/* The terminal is a global variable */
terminal.write([value]);
/* Reset the FIFO in any case */
Expand Down
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ <h4>Ready?</h4>
</section>
<section id="uartview" class="panel">
<input type="button" id="clearterm" value="Clear" />
<input type="button" id="recterm" value="Record" />
<label for="recterm" id="recterm-on"></label>
<label for="baudrate">Baudrate: </label>
<select id="baudrate">
<option value="57600">57600</option>
Expand Down

0 comments on commit 1be80ed

Please sign in to comment.