Skip to content

Commit

Permalink
Romdisk: Merge index feature from upstream, fix popout position, modi…
Browse files Browse the repository at this point in the history
…fied index algorithm from upstream
  • Loading branch information
JasonMo1 committed Sep 2, 2023
2 parents 4d2ff79 + 01cf555 commit f82d33a
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 18 deletions.
6 changes: 0 additions & 6 deletions frontend/breakpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@

var breakpoints = [];

$("#step").on("click", () => zealcom.step());
$("#stop").on("click", () => zealcom.stop());
$("#stepover").on("click", () => zealcom.step_over());
$("#continue").on("click", () => zealcom.cont());
$("#restart").on("click", () => zealcom.restart());

$("#bps").on("click", "li", function() {
/* Get the breakpoint address */
const bkpaddr = $(this).data("addr");
Expand Down
2 changes: 1 addition & 1 deletion frontend/css/emulator.css
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ button {
}

#popup-message {
position: sticky;
position: fixed;
display: none;
left: calc(50% - 17.5em);
top: 0.5em;
Expand Down
11 changes: 8 additions & 3 deletions frontend/panel.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
/**
* SPDX-FileCopyrightText: 2022 Zeal 8-bit Computer <[email protected]>
* SPDX-FileCopyrightText: 2022-2023 Zeal 8-bit Computer <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/

var mousepressed = false;

$("#step").on("click", () => zealcom.step());
$("#stop").on("click", () => zealcom.stop());
$("#stepover").on("click", () => zealcom.step_over());
$("#continue").on("click", () => zealcom.cont());
$("#reset").on("click", () => zealcom.reset());
$("#clean").on("click", () => zealcom.restart());

$("#dumpnow").on("click", function() {
const virtaddr = parseInt($("#dumpaddr").val(), 16);
const size = parseInt($("#dumpsize").val());
Expand Down Expand Up @@ -262,5 +269,3 @@ function setMemoryByteAddress(object) {
const val = hex(str, true, 4);
$("#current_memaddr").text(val);
}


24 changes: 17 additions & 7 deletions frontend/readrom.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,24 @@ const prebuilt_json_url = "https://zeal8bit.com/roms/index.json";

/* Process the index JSON object that contains all the ROMs available */
function processIndex(index) {
/* Generate an HTML option out of each entry */
const options = index.index.map(entry =>
`<option value="${entry.urls}" data-version="${entry.version}" data-hash="${entry.hash}">${entry.name}</option>`
);
const to_option = entry => `<option value="${entry.urls}" data-version="${entry.version}" data-hash="${entry.hash}">${entry.name}</option>`;
const to_separator = entry => `<option value="" disabled>--- ${entry[0].toUpperCase()+key.substr(1)} ---</option>`
var all_options = `<option value="">Choose an image...</option>`

const all_options =
`<option value="">Choose an image...</option>` +
options.join("");
/* Generate an HTML option out of each entry */
for (var key in index) {
if (typeof index[key] == "object") {
let this_option = to_separator(key);
if (typeof index[key][0] == "object") {
this_option += Object.values(index[key]).map(to_option).join("");
}
else {
this_option += to_option(index[key]);
}
all_options += this_option;
break;
}
}

$("#romchoice").html(all_options);
}
Expand Down
4 changes: 4 additions & 0 deletions hardemu/machine.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ function Zeal8bitComputer() {

function restart(reset_rom_selected=true, resetinterval=true) {
running = false;
vchip.clear();
terminal.clear();
zealcom = new Zeal8bitComputer();
if (reset_rom_selected == true) {
/* Reset all the file inputs */
Expand All @@ -320,6 +322,8 @@ function Zeal8bitComputer() {

function reset() {
zpu.reset();
vchip.clear();
terminal.clear();
step_cpu();
}

Expand Down
1 change: 1 addition & 0 deletions hardemu/screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,4 +362,5 @@ function VideoChip(Zeal, PIO, scale) {
this.mem_write = mem_write;
this.io_read = io_read;
this.io_write = io_write;
this.clear = initialize;
}
Binary file added imgs/clean.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ <h4>Ready?</h4>
<img id="step" title="Step (F10)" src="imgs/step.png" alt="Step" />
<img id="stepover" title="Step Over (F11)" src="imgs/stepover.png" alt="Step over" />
<img id="stop" title="Stop" src="imgs/stop.png" alt="Stop" />
<img id="restart" title="Restart" src="imgs/restart.png" alt="Restart">
<img id="reset" title="Reset" src="imgs/restart.png" alt="Reset">
<img id="clean" title="Clean" src="imgs/clean.png" alt="Clean">
</section>

<section class="menu">
Expand Down

0 comments on commit f82d33a

Please sign in to comment.