Skip to content

Commit

Permalink
Refactoring: Fix comments and move the tabs into a new directory
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonMo1 committed Nov 28, 2023
1 parent fbe2821 commit d4cebff
Show file tree
Hide file tree
Showing 17 changed files with 301 additions and 346 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ The emulator has been tested on Opera, Google Chrome and Microsoft Edge.

The emulator is slower than the real hardware, even though the real hardware is using a Z80 running at 10MHz. This is due to the overhead of Javascript itself and the web browser itself. But as I said above, the main feature this was made for is **debugging** programs and for this, there is no doubt it is efficient.


Writing a native emulator in **C** (w/ SDL) would cover the requirement of a full-speed emulator. However, this needs some time investment. Feel free to contact me or contribute if such a project interest you.

## How to start using the emulator?
Expand Down Expand Up @@ -191,10 +190,6 @@ You are free to use it for personal and commercial use, the boilerplate present

## Contact

<!--
DO NOT MODIFY IT
discussion: https://github.com/Zeal8bit/Zeal-WebEmulator/pull/11#discussion_r1326039822
-->
For any suggestion or request, you can contact me at `contact [at] zeal8bit [dot] com`

For feature requests, you can also open an issue or a pull request.
4 changes: 0 additions & 4 deletions docs/README_zh_hans.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,6 @@ It is now possible to switch to 320x240 text-mode and display text.

## 📪联系方式

<!--
别改这个看似错误的邮箱地址,这是故意的。
discussion: https://github.com/Zeal8bit/Zeal-WebEmulator/pull/11#discussion_r1326039822
-->
如有任何建议或要求,您可以通过 `contact [at] zeal8bit [dot] com`与我联系

对于功能请求,还可以打开议题或拉取请求。
8 changes: 0 additions & 8 deletions hardemu/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,6 @@ function Keyboard(Zeal, PIO) {
return true;
}

function str_press(str) {
for (let i = 0; i < str.length; i++) {
let ascii = str.charCodeAt(i);
key_pressed(ascii);
}
}

function send_next_keypress() {
/* If the fifo is empty or a transfer is on-going, do nothing */
if (ps2_fifo.length == 0 || transfer_active) {
Expand Down Expand Up @@ -364,7 +357,6 @@ function Keyboard(Zeal, PIO) {
/* Public function */
this.key_pressed = key_pressed;
this.key_released = key_released;
this.str_press = str_press;

this.is_valid_port = function(read, port) {
/* Can only read from the keyboard */
Expand Down
18 changes: 4 additions & 14 deletions hardemu/machine.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ function Zeal8bitComputer() {
const filtered = breakpoints.find(elt => elt.address == registers.pc);
if (filtered != undefined && filtered.enabled) {
running = false;
updateRegistersHTML();
setRegView();
if (filtered.callback) {
filtered.callback(filtered);
}
Expand All @@ -255,7 +255,7 @@ function Zeal8bitComputer() {
tstatesutils.addTstates(zpu.run_instruction());
registers = zpu.getState();
}
updateRegistersHTML();
setRegView();
}

function step_over () {
Expand Down Expand Up @@ -296,25 +296,15 @@ function Zeal8bitComputer() {
/* Clear the interval that executes the CPU */
clearInterval(interval);
interval = null;
updateRegistersHTML();
setRegView();
running = false;
}

function restart(reset_rom_selected=true, resetinterval=true) {
function restart(resetinterval=true) {
running = false;
rom_choisen = 0;
vchip.clear();
terminal.clear();
zealcom = new Zeal8bitComputer();
if (reset_rom_selected == true) {
/* Reset all the file inputs */
$("#romfile [type=file]").val("");
/* Remove the ticks from the ready list */
$(".status").removeClass("ready");
$("#romchoice").each(function(){
$(this).find("option").eq(0).prop("selected",true)
});
}
if (resetinterval == true) {
clearInterval(interval);
interval = null;
Expand Down
7 changes: 6 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,13 @@ <h4>Ready?</h4>
<script src="view/breakpoint.js"></script>
<script src="view/menus.js"></script>
<script src="view/screen.js"></script>
<script src="view/panel.js"></script>
<script src="view/regs_panel.js"></script>
<script src="view/readrom.js"></script>
<script src="view/init.js"></script>
<!-- Tabs -->
<script src="view/tabs/tabs.js"></script>
<script src="view/tabs/disassemble.js"></script>
<script src="view/tabs/memdump.js"></script>
<script src="view/tabs/uart_terminal.js"></script>
</body>
</html>
5 changes: 2 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,10 @@ var menuBar = [
const createWindow = () => {

mainWindow = create_mainWindow();
versionWindow = create_versionWindow();

// 构建菜单项
// Set up the menu bar
const menu = Menu.buildFromTemplate(menuBar);
// 设置一个顶部菜单栏
// Set up the top menu
Menu.setApplicationMenu(menu);
};

Expand Down
4 changes: 0 additions & 4 deletions view/breakpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

/**
* Before initializing the components/peripherals, create the callback set.
* Indeed, one of them may need to register a callback on init. */

var breakpoints = [];

$("#bps").on("click", "li", function() {
Expand Down
27 changes: 0 additions & 27 deletions view/css/emulator.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

@font-face {
font-family:'cascadiacode';
src: url('../fonts/CascadiaCode.ttf');
}

:root, :root.dark {
--first-bg-color: #002b36;
--second-bg-color: #093642;
Expand Down Expand Up @@ -282,24 +277,6 @@ hr {
user-select: none;
}

#codeedit {
position: relative;
z-index: 3;
border-top: 2px black solid;
font-family: monospace;
font-size: 11pt;
display: inline-block;
width: 100%;
height: 56vh;
background-color:var(--second-bg-color);
padding-top: 1em;
padding-left: 0.5em;
cursor: pointer;
overflow-y:scroll;
box-sizing: border-box;
user-select: none;
}

#dumpfields {
margin-bottom: 1em;
}
Expand Down Expand Up @@ -344,10 +321,6 @@ hr {
padding-left:1.5em;
}

.memline, .dumpline {
font-family: 'cascadiacode';
}

.membytes div, .asciichars div {
display: inline-block;
padding: 0 0.37em 0 0.37em;
Expand Down
Binary file removed view/fonts/CascadiaCode.ttf
Binary file not shown.
11 changes: 9 additions & 2 deletions view/menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@
* SPDX-License-Identifier: Apache-2.0
*/

/* Memdump related */
const byte_per_line = 0x20;
$("#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();
resetRom();
});

/**
* Events for all menus and their content: breakpoints, CPU control, etc...
Expand Down
Loading

0 comments on commit d4cebff

Please sign in to comment.