diff --git a/.eslintrc.yaml b/.eslintrc.yaml new file mode 100644 index 0000000..0d5e756 --- /dev/null +++ b/.eslintrc.yaml @@ -0,0 +1,140 @@ +env: + node: true + es6: true + +parserOptions: + ecmaVersion: 2017 + +rules: + # Possible Errors + # http://eslint.org/docs/rules/#possible-errors + comma-dangle: [2, only-multiline] + no-control-regex: 2 + no-debugger: 2 + no-dupe-args: 2 + no-dupe-keys: 2 + no-duplicate-case: 2 + no-empty-character-class: 2 + no-ex-assign: 2 + no-extra-boolean-cast: 2 + no-extra-parens: [2, functions] + no-extra-semi: 2 + no-func-assign: 2 + no-invalid-regexp: 2 + no-irregular-whitespace: 2 + no-obj-calls: 2 + no-proto: 2 + no-template-curly-in-string: 2 + no-unexpected-multiline: 2 + no-unreachable: 2 + no-unsafe-negation: 2 + use-isnan: 2 + valid-typeof: 2 + + # Best Practices + # http://eslint.org/docs/rules/#best-practices + dot-location: [2, property] + no-fallthrough: 2 + no-global-assign: 2 + no-octal: 2 + no-redeclare: 2 + no-self-assign: 2 + no-throw-literal: 2 + no-unused-labels: 2 + no-useless-call: 2 + no-useless-escape: 2 + no-void: 2 + no-with: 2 + + # Variables + # http://eslint.org/docs/rules/#variables + no-delete-var: 2 + no-undef: 2 + no-unused-vars: [2, {args: none}] + + # Node.js and CommonJS + # http://eslint.org/docs/rules/#nodejs-and-commonjs + no-mixed-requires: 2 + no-new-require: 2 + no-path-concat: 2 + no-restricted-modules: [2, sys, _linklist] + no-restricted-properties: + - 2 + - object: assert + property: deepEqual + message: Use assert.deepStrictEqual(). + - object: assert + property: equal + message: Use assert.strictEqual() rather than assert.equal(). + - object: assert + property: notEqual + message: Use assert.notStrictEqual() rather than assert.notEqual(). + - property: __defineGetter__ + message: __defineGetter__ is deprecated. + - property: __defineSetter__, + message: __defineSetter__ is deprecated. + + # Stylistic Issues + # http://eslint.org/docs/rules/#stylistic-issues + block-spacing: 2 + brace-style: [2, 1tbs, {allowSingleLine: true}] + comma-spacing: 2 + comma-style: 2 + computed-property-spacing: 2 + eol-last: 2 + indent: ["error", 2, {CallExpression: {arguments: first}, + MemberExpression: 1, + SwitchCase: 1}] + key-spacing: [2, {mode: minimum}] + linebreak-style: [2, unix] + max-len: [2, {ignoreUrls: true, tabWidth: 2}] + new-parens: 2 + no-mixed-spaces-and-tabs: 2 + no-multiple-empty-lines: [2, {max: 2, maxEOF: 0, maxBOF: 0}] + no-tabs: 2 + no-trailing-spaces: 2 + one-var-declaration-per-line: 2 + operator-linebreak: [2, after] + quotes: [2, single, avoid-escape] + semi-spacing: 2 + space-before-blocks: [2, always] + space-in-parens: [2, never] + space-infix-ops: 2 + space-unary-ops: 2 + unicode-bom: 2 + + # ECMAScript 6 + # http://eslint.org/docs/rules/#ecmascript-6 + arrow-parens: [2, always] + arrow-spacing: [2, {before: true, after: true}] + constructor-super: 2 + no-class-assign: 2 + no-confusing-arrow: 2 + no-const-assign: 2 + no-dupe-class-members: 2 + no-new-symbol: 2 + no-this-before-super: 2 + prefer-const: [2, {ignoreReadBeforeAssign: true}] + rest-spread-spacing: 2 + template-curly-spacing: 2 + +# Global scoped method and vars +globals: + COUNTER_HTTP_CLIENT_REQUEST: false + COUNTER_HTTP_CLIENT_RESPONSE: false + COUNTER_HTTP_SERVER_REQUEST: false + COUNTER_HTTP_SERVER_RESPONSE: false + COUNTER_NET_SERVER_CONNECTION: false + COUNTER_NET_SERVER_CONNECTION_CLOSE: false + DTRACE_HTTP_CLIENT_REQUEST: false + DTRACE_HTTP_CLIENT_RESPONSE: false + DTRACE_HTTP_SERVER_REQUEST: false + DTRACE_HTTP_SERVER_RESPONSE: false + DTRACE_NET_SERVER_CONNECTION: false + DTRACE_NET_STREAM_END: false + LTTNG_HTTP_CLIENT_REQUEST: false + LTTNG_HTTP_CLIENT_RESPONSE: false + LTTNG_HTTP_SERVER_REQUEST: false + LTTNG_HTTP_SERVER_RESPONSE: false + LTTNG_NET_SERVER_CONNECTION: false + LTTNG_NET_STREAM_END: false diff --git a/.gitignore b/.gitignore index 92e18c7..56817dd 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,5 @@ node_modules *.log out -# VSCode +#VSCode .vscode/* \ No newline at end of file diff --git a/README.md b/README.md index b8053c0..98d6d9f 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ First things first, clone the repository! ## ToDo List +* Fix Hexdump * Create Snazzy Icon (In process) * Test on Windows/Linux * Build Packages for Win/Linux Platforms (Mac build done) diff --git a/app/assembler.js b/app/assembler.js index 33ff326..4747f68 100644 --- a/app/assembler.js +++ b/app/assembler.js @@ -8,6 +8,7 @@ * Released under the GNU General Public License * see http://gnu.org/licenses/gpl.html */ +/* eslint no-use-before-define: 0 */ // --> OFF 'use strict'; @@ -34,8 +35,9 @@ function SimulatorWidget(node) { $node.find('.resetButton').click(simulator.reset); $node.find('.hexdumpButton').click(assembler.hexdump); $node.find('.disassembleButton').click(assembler.disassemble); - $node.find('.debug').change(function () { - var debug = $(this).is(':checked'); + $node.find('.debug').on('click', function () { + $(this).toggleClass('active'); + var debug = $(this).hasClass('active'); if (debug) { ui.debugOn(); simulator.enableDebugger(); @@ -44,7 +46,11 @@ function SimulatorWidget(node) { simulator.stopDebugger(); } }); - $node.find('.monitoring').change(function () { + $node.find('.monitoring').on('click', function () { + $(this).toggleClass('active'); + if($(this).hasClass('active')) { + + } ui.toggleMonitor(); simulator.toggleMonitor(); }); @@ -155,7 +161,7 @@ function SimulatorWidget(node) { } function toggleMonitor() { - $node.find('.monitor').toggle(); + $node.find('.monitor-container').toggle(); } function showNotes() { @@ -1632,10 +1638,8 @@ function SimulatorWidget(node) { } function updateDebugInfo() { - var html = "A=$" + num2hex(regA) + " X=$" + num2hex(regX) + " Y=$" + num2hex(regY) + "
"; - html += "SP=$" + num2hex(regSP) + " PC=$" + addr2hex(regPC); - html += "
"; - html += "NV-BDIZC
"; + var html = "A=$" + num2hex(regA) + " X=$" + num2hex(regX) + " Y=$" + num2hex(regY) + + " SP=$" + num2hex(regSP) + " PC=$" + addr2hex(regPC) + " NV-BDIZC: "; for (var i = 7; i >=0; i--) { html += regP >> i & 1; } @@ -2435,24 +2439,21 @@ function SimulatorWidget(node) { pushByte((value >> 8) & 0xff); } - function openPopup(content, title) { - var w = window.open('', title, 'width=500,height=300,resizable=yes,scrollbars=yes,toolbar=no,location=no,menubar=no,status=no'); - - var html = ""; - html += ""; - html += "" + title + ""; - html += "
";
-
-      html += content;
-
-      html += "
"; - w.document.write(html); - w.document.close(); + function openDiv(content, title) { + var w = document.querySelector('.banner'); + var ele = document.createElement('div'); + // var html = ""; + // html += "" + title + ""; + // html += "
";
+      // html += content;
+      // html += "
"; + ele.innerHTML = '' + content + ''; + w.appendChild(ele); } // Dump binary as hex to new window function hexdump() { - openPopup(memory.format(0x600, codeLen), 'Hexdump'); + openDiv(memory.format(0x600, codeLen), 'Hexdump'); } // TODO: Create separate disassembler object? @@ -2616,7 +2617,7 @@ function SimulatorWidget(node) { var html = 'Address Hexdump Dissassembly\n'; html += '-------------------------------\n'; html += instructions.join('\n'); - openPopup(html, 'Disassembly'); + openDiv(html, 'Disassembly'); } return { diff --git a/app/electron/menu.js b/app/electron/menu.js index 18b4247..749a112 100644 --- a/app/electron/menu.js +++ b/app/electron/menu.js @@ -1,47 +1,62 @@ const { app } = require('electron') const OSXtemplate = [ { - label: "Application", + label: 'Application', submenu: [ - { label: "About 6502Desktop", selector: "orderFrontStandardAboutPanel:" }, - { label: "Quit", accelerator: "Command+Q", click: function () { app.quit(); } } + { label: 'About 6502Desktop', selector: 'orderFrontStandardAboutPanel:' }, + { label: 'Quit', accelerator: 'Command+Q', click: function () { app.quit(); } } ] }, { - label: "Edit", + label: 'Edit', submenu: [ - { label: "Undo", accelerator: "Cmd+Z", selector: "undo:" }, - { label: "Redo", accelerator: "Shift+Cmd+Z", selector: "redo:" }, - { label: "Cut", accelerator: "Cmd+X", selector: "cut:" }, - { label: "Copy", accelerator: "Cmd+C", selector: "copy:" }, - { label: "Paste", accelerator: "Cmd+V", selector: "paste:" }, - { label: "Select All", accelerator: "Cmd+A", selector: "selectAll:" } + { label: 'Undo', accelerator: 'Cmd+Z', selector: 'undo:' }, + { label: 'Redo', accelerator: 'Shift+Cmd+Z', selector: 'redo:' }, + { label: 'Cut', accelerator: 'Cmd+X', selector: 'cut:' }, + { label: 'Copy', accelerator: 'Cmd+C', selector: 'copy:' }, + { label: 'Paste', accelerator: 'Cmd+V', selector: 'paste:' }, + { label: 'Select All', accelerator: 'Cmd+A', selector: 'selectAll:' } + ] + }, + { + label: 'View', + submenu: (process.env.NODE_ENV === 'development') ? [ + { label: '&Reload', accelerator: 'Ctrl+R', + click() { mainWindow.webContents.reload(); } }, + { label: 'Toggle &Full Screen', accelerator: 'F11', + click() { mainWindow.setFullScreen(!mainWindow.isFullScreen()); } + }, + { label: 'Toggle &Developer Tools', accelerator: 'Alt+Ctrl+I', + click() { mainWindow.toggleDevTools(); } } + ] : [ + { label: 'Toggle &Full Screen', accelerator: 'F11', + click() { mainWindow.setFullScreen(!mainWindow.isFullScreen()); } } ] } ] const PCtemplate = [ { - label: "File", + label: 'File', submenu: [ - { label: "Quit", accelerator: "Alt+F4", click: function () { app.quit(); } } + { label: 'Quit', accelerator: 'Alt+F4', click: function () { app.quit(); } } ] }, { - label: "Edit", + label: 'Edit', submenu: [ - { label: "Undo", accelerator: "Ctrl+Z", selector: "undo:" }, - { label: "Redo", accelerator: "Shift+Ctrl+Z", selector: "redo:" }, - { label: "Cut", accelerator: "Ctrl+X", selector: "cut:" }, - { label: "Copy", accelerator: "Ctrl+C", selector: "copy:" }, - { label: "Paste", accelerator: "Ctrl+V", selector: "paste:" }, - { label: "Select All", accelerator: "Ctrl+A", selector: "selectAll:" } + { label: 'Undo', accelerator: 'Ctrl+Z', selector: 'undo:' }, + { label: 'Redo', accelerator: 'Shift+Ctrl+Z', selector: 'redo:' }, + { label: 'Cut', accelerator: 'Ctrl+X', selector: 'cut:' }, + { label: 'Copy', accelerator: 'Ctrl+C', selector: 'copy:' }, + { label: 'Paste', accelerator: 'Ctrl+V', selector: 'paste:' }, + { label: 'Select All', accelerator: 'Ctrl+A', selector: 'selectAll:' } ] }, { - label: "Help", + label: 'Help', submenu: [ - { label: "About 6502Desktop", selector: "orderFrontStandardAboutPanel:" }, + { label: 'About 6502Desktop', selector: 'orderFrontStandardAboutPanel:' }, ] }, ] diff --git a/app/index.html b/app/index.html index 0905f9a..32c2d1d 100644 --- a/app/index.html +++ b/app/index.html @@ -5,43 +5,52 @@ Easy 6502 Desktop Simulator - -
-
- - - - - - -
- - - - - -
- - -
+
+ + + + + + +
+
+
-
- - - - - - - +
+
+
+ + + + + +
+ +
+
+
+ + + + +
+
-
+