responseBuild merge

This commit is contained in:
Dennis Brown 2017-03-29 20:37:26 -05:00
commit 5da1c2e185
9 changed files with 311 additions and 86 deletions

140
.eslintrc.yaml Normal file
View File

@ -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

2
.gitignore vendored
View File

@ -2,5 +2,5 @@ node_modules
*.log *.log
out out
# VSCode #VSCode
.vscode/* .vscode/*

View File

@ -19,6 +19,7 @@ First things first, clone the repository!
## ToDo List ## ToDo List
* Fix Hexdump
* Create Snazzy Icon (In process) * Create Snazzy Icon (In process)
* Test on Windows/Linux * Test on Windows/Linux
* Build Packages for Win/Linux Platforms (Mac build done) * Build Packages for Win/Linux Platforms (Mac build done)

View File

@ -8,6 +8,7 @@
* Released under the GNU General Public License * Released under the GNU General Public License
* see http://gnu.org/licenses/gpl.html * see http://gnu.org/licenses/gpl.html
*/ */
/* eslint no-use-before-define: 0 */ // --> OFF
'use strict'; 'use strict';
@ -34,8 +35,9 @@ function SimulatorWidget(node) {
$node.find('.resetButton').click(simulator.reset); $node.find('.resetButton').click(simulator.reset);
$node.find('.hexdumpButton').click(assembler.hexdump); $node.find('.hexdumpButton').click(assembler.hexdump);
$node.find('.disassembleButton').click(assembler.disassemble); $node.find('.disassembleButton').click(assembler.disassemble);
$node.find('.debug').change(function () { $node.find('.debug').on('click', function () {
var debug = $(this).is(':checked'); $(this).toggleClass('active');
var debug = $(this).hasClass('active');
if (debug) { if (debug) {
ui.debugOn(); ui.debugOn();
simulator.enableDebugger(); simulator.enableDebugger();
@ -44,7 +46,11 @@ function SimulatorWidget(node) {
simulator.stopDebugger(); simulator.stopDebugger();
} }
}); });
$node.find('.monitoring').change(function () { $node.find('.monitoring').on('click', function () {
$(this).toggleClass('active');
if($(this).hasClass('active')) {
}
ui.toggleMonitor(); ui.toggleMonitor();
simulator.toggleMonitor(); simulator.toggleMonitor();
}); });
@ -155,7 +161,7 @@ function SimulatorWidget(node) {
} }
function toggleMonitor() { function toggleMonitor() {
$node.find('.monitor').toggle(); $node.find('.monitor-container').toggle();
} }
function showNotes() { function showNotes() {
@ -1632,10 +1638,8 @@ function SimulatorWidget(node) {
} }
function updateDebugInfo() { function updateDebugInfo() {
var html = "A=$" + num2hex(regA) + " X=$" + num2hex(regX) + " Y=$" + num2hex(regY) + "<br />"; var html = "A=$" + num2hex(regA) + " X=$" + num2hex(regX) + " Y=$" + num2hex(regY) +
html += "SP=$" + num2hex(regSP) + " PC=$" + addr2hex(regPC); " SP=$" + num2hex(regSP) + " PC=$" + addr2hex(regPC) + " NV-BDIZC: ";
html += "<br />";
html += "NV-BDIZC<br />";
for (var i = 7; i >=0; i--) { for (var i = 7; i >=0; i--) {
html += regP >> i & 1; html += regP >> i & 1;
} }
@ -2435,24 +2439,21 @@ function SimulatorWidget(node) {
pushByte((value >> 8) & 0xff); pushByte((value >> 8) & 0xff);
} }
function openPopup(content, title) { function openDiv(content, title) {
var w = window.open('', title, 'width=500,height=300,resizable=yes,scrollbars=yes,toolbar=no,location=no,menubar=no,status=no'); var w = document.querySelector('.banner');
var ele = document.createElement('div');
var html = "<html><head>"; // var html = "<link href='style.css' rel='stylesheet' type='text/css' />";
html += "<link href='style.css' rel='stylesheet' type='text/css' />"; // html += "<title>" + title + "</title></head><body>";
html += "<title>" + title + "</title></head><body>"; // html += "<pre><code>";
html += "<pre><code>"; // html += content;
// html += "</code></pre></body></html>";
html += content; ele.innerHTML = '<code>' + content + '</code>';
w.appendChild(ele);
html += "</code></pre></body></html>";
w.document.write(html);
w.document.close();
} }
// Dump binary as hex to new window // Dump binary as hex to new window
function hexdump() { function hexdump() {
openPopup(memory.format(0x600, codeLen), 'Hexdump'); openDiv(memory.format(0x600, codeLen), 'Hexdump');
} }
// TODO: Create separate disassembler object? // TODO: Create separate disassembler object?
@ -2616,7 +2617,7 @@ function SimulatorWidget(node) {
var html = 'Address Hexdump Dissassembly\n'; var html = 'Address Hexdump Dissassembly\n';
html += '-------------------------------\n'; html += '-------------------------------\n';
html += instructions.join('\n'); html += instructions.join('\n');
openPopup(html, 'Disassembly'); openDiv(html, 'Disassembly');
} }
return { return {

View File

@ -1,47 +1,62 @@
const { app } = require('electron') const { app } = require('electron')
const OSXtemplate = [ const OSXtemplate = [
{ {
label: "Application", label: 'Application',
submenu: [ submenu: [
{ label: "About 6502Desktop", selector: "orderFrontStandardAboutPanel:" }, { label: 'About 6502Desktop', selector: 'orderFrontStandardAboutPanel:' },
{ label: "Quit", accelerator: "Command+Q", click: function () { app.quit(); } } { label: 'Quit', accelerator: 'Command+Q', click: function () { app.quit(); } }
] ]
}, },
{ {
label: "Edit", label: 'Edit',
submenu: [ submenu: [
{ label: "Undo", accelerator: "Cmd+Z", selector: "undo:" }, { label: 'Undo', accelerator: 'Cmd+Z', selector: 'undo:' },
{ label: "Redo", accelerator: "Shift+Cmd+Z", selector: "redo:" }, { label: 'Redo', accelerator: 'Shift+Cmd+Z', selector: 'redo:' },
{ label: "Cut", accelerator: "Cmd+X", selector: "cut:" }, { label: 'Cut', accelerator: 'Cmd+X', selector: 'cut:' },
{ label: "Copy", accelerator: "Cmd+C", selector: "copy:" }, { label: 'Copy', accelerator: 'Cmd+C', selector: 'copy:' },
{ label: "Paste", accelerator: "Cmd+V", selector: "paste:" }, { label: 'Paste', accelerator: 'Cmd+V', selector: 'paste:' },
{ label: "Select All", accelerator: "Cmd+A", selector: "selectAll:" } { 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 = [ const PCtemplate = [
{ {
label: "File", label: 'File',
submenu: [ submenu: [
{ label: "Quit", accelerator: "Alt+F4", click: function () { app.quit(); } } { label: 'Quit', accelerator: 'Alt+F4', click: function () { app.quit(); } }
] ]
}, },
{ {
label: "Edit", label: 'Edit',
submenu: [ submenu: [
{ label: "Undo", accelerator: "Ctrl+Z", selector: "undo:" }, { label: 'Undo', accelerator: 'Ctrl+Z', selector: 'undo:' },
{ label: "Redo", accelerator: "Shift+Ctrl+Z", selector: "redo:" }, { label: 'Redo', accelerator: 'Shift+Ctrl+Z', selector: 'redo:' },
{ label: "Cut", accelerator: "Ctrl+X", selector: "cut:" }, { label: 'Cut', accelerator: 'Ctrl+X', selector: 'cut:' },
{ label: "Copy", accelerator: "Ctrl+C", selector: "copy:" }, { label: 'Copy', accelerator: 'Ctrl+C', selector: 'copy:' },
{ label: "Paste", accelerator: "Ctrl+V", selector: "paste:" }, { label: 'Paste', accelerator: 'Ctrl+V', selector: 'paste:' },
{ label: "Select All", accelerator: "Ctrl+A", selector: "selectAll:" } { label: 'Select All', accelerator: 'Ctrl+A', selector: 'selectAll:' }
] ]
}, },
{ {
label: "Help", label: 'Help',
submenu: [ submenu: [
{ label: "About 6502Desktop", selector: "orderFrontStandardAboutPanel:" }, { label: 'About 6502Desktop', selector: 'orderFrontStandardAboutPanel:' },
] ]
}, },
] ]

View File

@ -5,43 +5,52 @@
<title>Easy 6502 Desktop Simulator</title> <title>Easy 6502 Desktop Simulator</title>
</head> </head>
<body> <body>
<div class="banner">6502 Assembly Simulator/Debugger</div>
<div class="widget"> <div class="widget">
<div class="buttons"> <div class="button-container">
<input type="button" value="Assemble" class="assembleButton" />
<input type="button" value="Run" class="runButton" />
<input type="button" value="Reset" class="resetButton" />
<input type="button" value="Hexdump" class="hexdumpButton" />
<input type="button" value="Disassemble" class="disassembleButton" />
<input type="button" value="Notes" class="notesButton" />
</div>
<textarea class="code"></textarea>
<canvas class="screen" width="160" height="160"></canvas>
<div class="debugger">
<input type="checkbox" class="debug" name="debug" />
<label for="debug">Debugger</label>
<div class="minidebugger"></div>
<div class="buttons"> <div class="buttons">
<input type="button" value="Assemble" class="assembleButton" />
<input type="button" value="Run" class="runButton" />
<input type="button" value="Reset" class="resetButton" />
<input type="button" value="Hexdump" class="hexdumpButton" />
<input type="button" value="Disassemble" class="disassembleButton" />
<input type="button" value="Notes" class="notesButton" />
</div>
<div class="buttons-right">
<input type="button" value="Debug" class="debug" name="debug" />
<input type="button" value="Step" class="stepButton" /> <input type="button" value="Step" class="stepButton" />
<input type="button" value="Jump to ..." class="gotoButton" /> <input type="button" value="Jump to ..." class="gotoButton" />
</div> </div>
</div> </div>
<div class="monitorControls"> <div class="debugger">
<label for="monitoring">Monitor</label> <div class="minidebugger"></div>
<input type="checkbox" class="monitoring" name="monitoring" /> </div>
<label for="start">Start: $</label> <textarea class="code">
<input type="text" value="0" class="start" name="start" /> LDA #$01
<label for="length">Length: $</label> STA $0200
<input type="text" value="ff" class="length" name="length" /> LDA #$05
STA $0201
LDA #$08
STA $0202
</textarea>
<canvas class="screen" width="160" height="160"></canvas>
<div class="monitorControls">
<input type="button" class="monitoring" value="Monitor" name="monitoring" />
</div>
<div class="monitor-container">
<div class="monitor-range">
<label class="left" for="start">Start: $</label>
<input class="left" type="text" value="0" size="5" maxlength="5" class="start" name="start" />
<label class="left" for="length">Length: $</label>
<input class="left" type="text" value="ff" size="5" maxlength="5" class="length" name="length" />
</div>
<div class="monitor"><pre><code></code></pre></div>
</div> </div>
<div class="monitor"><pre><code></code></pre></div>
<div class="messages"><pre><code></code></pre></div> <div class="messages"><pre><code></code></pre></div>
<div class="banner"></div>
<div class="notes" style="display: none">Notes: <div class="notes" style="display: none">Notes:

View File

@ -1,3 +1,7 @@
html {
box-sizing: border-box;
}
.widget { .widget {
width: 600px; width: 600px;
margin: 15px auto; margin: 15px auto;
@ -11,8 +15,32 @@
font-style: bold; font-style: bold;
} }
.button-container {
text-align: center;
}
.buttons { .buttons {
display: inline-block;
margin: 8px 0; margin: 8px 0;
margin-right: 20px;
outline: none;
}
.buttons-right {
display: inline;
margin: 8px 0;
margin-left: 20px;
outline: none;
}
.active {
color: #fff;
background-color: #3272cc;
outline: none;
padding: 2px 8px 3px;
border-radius:5px;
-moz-border-radius:5px;
-webkit-border-radius:5px; border:none;
} }
.start, .length { .start, .length {
@ -30,11 +58,14 @@
margin: 0 0 6px 0; margin: 0 0 6px 0;
padding: 6px; padding: 6px;
border: 1px solid black; border: 1px solid black;
width: 420px; max-width: 420px;
height: 290px; min-width: 200px;
height: 200px;
font-family: monospace; font-family: monospace;
overflow: auto; overflow-y: scroll;
overflow-x: auto;
float: left; float: left;
/* disable size handle */
} }
.screen { .screen {
@ -42,22 +73,26 @@
} }
.debugger { .debugger {
border: 1px black solid; display: inline-block;
margin-top: 6px; margin-top: 6px;
padding: 3px; padding: 3px;
padding-top: 8px; padding-top: 8px;
height: 125px; height: 40px;
width: 152px;
text-align: center; text-align: center;
float: right;
} }
.minidebugger { .minidebugger {
margin: 0; margin: 0;
margin-top: 6px; margin-top: 6px;
padding: 0; margin-left: 10px;
padding: 0 10px;
font-family: monospace; font-family: monospace;
font-size: 11px; font-size: 11px;
font-weight: 400;
}
.left {
display: block;
} }
.monitorControls { .monitorControls {
@ -71,15 +106,30 @@
margin-right: 0.5em; margin-right: 0.5em;
} }
.monitor-container {
text-align: right;
display: none;
height: 110px;
}
.monitor { .monitor {
display: inline-block;
margin: 10px 0; margin: 10px 0;
padding: 6px; padding: 6px;
border: 1px solid #999; border: 1px solid #999;
background-color: #ddd; background-color: #ddd;
width: 587px; width: 80%;
height: 100px; height: 100px;
overflow: auto; overflow: auto;
display: none; }
.monitor-range {
float: left;
display: inline-block;
padding: 20px;
height: 100px;
text-align: left;
width: 50px;
} }
.monitor-invalid { .monitor-invalid {
@ -99,3 +149,11 @@
font-size: 12px; font-size: 12px;
color: #444; color: #444;
} }
@media (min-width: 600) {
}
@media (max-width: 200) {
}

View File

@ -14,9 +14,10 @@ function createWindow () {
protocol: 'file:', protocol: 'file:',
slashes: true slashes: true
})) }))
// mainWindow.webContents.openDevTools()
if(process.platform === 'darwin') { if(process.platform === 'darwin') {
Menu.setApplicationMenu(Menu.buildFromTemplate(OSXtemplate)); Menu.setApplicationMenu(Menu.buildFromTemplate(OSXtemplate))
} else if(process.platform !== 'darwin') { } else if(process.platform !== 'darwin') {
BrowserWindow.setMenu(Menu.buildFromTemplate(PCtemplate)) BrowserWindow.setMenu(Menu.buildFromTemplate(PCtemplate))
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "6502desktop", "name": "6502desktop",
"version": "0.2.2", "version": "0.3.3",
"description": "Desktop version of 6502 Simulator", "description": "Desktop version of 6502 Simulator",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {