Skip to content

Commit

Permalink
Merge pull request #152 from jos0003/master
Browse files Browse the repository at this point in the history
Fixed Issue #148
  • Loading branch information
auroranil committed Sep 5, 2016
2 parents 4ead82f + 4223335 commit a10f250
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 71 deletions.
2 changes: 1 addition & 1 deletion doc/DataPath.html
Expand Up @@ -2008,7 +2008,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="DataPath.
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Aug 22 2016 15:57:53 GMT+1000 (AEST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Sep 05 2016 11:26:15 GMT+1000 (AEST)
</footer>

<script> prettyPrint(); </script>
Expand Down
6 changes: 3 additions & 3 deletions doc/MarieAsm.html
Expand Up @@ -140,7 +140,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line794">line 794</a>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line810">line 810</a>
</li></ul></dd>


Expand Down Expand Up @@ -247,7 +247,7 @@ <h4 class="name" id="assemble"><span class="type-signature"></span>assemble<span

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line814">line 814</a>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line830">line 830</a>
</li></ul></dd>


Expand Down Expand Up @@ -329,7 +329,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="DataPath.
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Aug 22 2016 15:57:53 GMT+1000 (AEST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Sep 05 2016 11:26:15 GMT+1000 (AEST)
</footer>

<script> prettyPrint(); </script>
Expand Down
4 changes: 2 additions & 2 deletions doc/MarieAsmError.html
Expand Up @@ -186,7 +186,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line770">line 770</a>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line786">line 786</a>
</li></ul></dd>


Expand Down Expand Up @@ -255,7 +255,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="DataPath.
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Aug 22 2016 15:57:53 GMT+1000 (AEST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Sep 05 2016 11:26:15 GMT+1000 (AEST)
</footer>

<script> prettyPrint(); </script>
Expand Down
30 changes: 15 additions & 15 deletions doc/MarieSim.html
Expand Up @@ -216,7 +216,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line34">line 34</a>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line33">line 33</a>
</li></ul></dd>


Expand Down Expand Up @@ -319,7 +319,7 @@ <h4 class="name" id="operators"><span class="type-signature"></span>operators<sp

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line564">line 564</a>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line580">line 580</a>
</li></ul></dd>


Expand Down Expand Up @@ -399,7 +399,7 @@ <h4 class="name" id="current"><span class="type-signature"></span>current<span c

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line179">line 179</a>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line178">line 178</a>
</li></ul></dd>


Expand Down Expand Up @@ -505,7 +505,7 @@ <h4 class="name" id="decode"><span class="type-signature"></span>decode<span cla

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line515">line 515</a>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line531">line 531</a>
</li></ul></dd>


Expand Down Expand Up @@ -601,7 +601,7 @@ <h4 class="name" id="execute"><span class="type-signature"></span>execute<span c

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line551">line 551</a>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line567">line 567</a>
</li></ul></dd>


Expand Down Expand Up @@ -685,7 +685,7 @@ <h4 class="name" id="fetch"><span class="type-signature"></span>fetch<span class

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line500">line 500</a>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line516">line 516</a>
</li></ul></dd>


Expand Down Expand Up @@ -768,7 +768,7 @@ <h4 class="name" id="microStep"><span class="type-signature"></span>microStep<sp

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line468">line 468</a>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line484">line 484</a>
</li></ul></dd>


Expand Down Expand Up @@ -949,7 +949,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line345">line 345</a>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line355">line 355</a>
</li></ul></dd>


Expand Down Expand Up @@ -1192,7 +1192,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line195">line 195</a>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line194">line 194</a>
</li></ul></dd>


Expand Down Expand Up @@ -1280,7 +1280,7 @@ <h4 class="name" id="restart"><span class="type-signature"></span>restart<span c

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line89">line 89</a>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line88">line 88</a>
</li></ul></dd>


Expand Down Expand Up @@ -1363,7 +1363,7 @@ <h4 class="name" id="run"><span class="type-signature"></span>run<span class="si

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line428">line 428</a>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line444">line 444</a>
</li></ul></dd>


Expand Down Expand Up @@ -1540,7 +1540,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line139">line 139</a>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line138">line 138</a>
</li></ul></dd>


Expand Down Expand Up @@ -1623,7 +1623,7 @@ <h4 class="name" id="step"><span class="type-signature"></span>step<span class="

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line449">line 449</a>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line465">line 465</a>
</li></ul></dd>


Expand Down Expand Up @@ -1706,7 +1706,7 @@ <h4 class="name" id="toJSON"><span class="type-signature"></span>toJSON<span cla

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line113">line 113</a>
<a href="marie.js.html">marie.js</a>, <a href="marie.js.html#line112">line 112</a>
</li></ul></dd>


Expand Down Expand Up @@ -1776,7 +1776,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="DataPath.
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Aug 22 2016 15:57:53 GMT+1000 (AEST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Sep 05 2016 11:26:15 GMT+1000 (AEST)
</footer>

<script> prettyPrint(); </script>
Expand Down
27 changes: 2 additions & 25 deletions doc/MarieSimError.html
Expand Up @@ -40,7 +40,7 @@ <h2>MarieSimError</h2>



<h4 class="name" id="MarieSimError"><span class="type-signature"></span>new MarieSimError<span class="signature">(name, lineNumber, message)</span><span class="type-signature"></span></h4>
<h4 class="name" id="MarieSimError"><span class="type-signature"></span>new MarieSimError<span class="signature">(name, message)</span><span class="type-signature"></span></h4>



Expand Down Expand Up @@ -104,29 +104,6 @@ <h5>Parameters:</h5>



<tr>

<td class="name"><code>lineNumber</code></td>


<td class="type">


<span class="param-type">number</span>



</td>





<td class="description last">Which line caused the error.</td>
</tr>



<tr>

<td class="name"><code>message</code></td>
Expand Down Expand Up @@ -255,7 +232,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="DataPath.
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Aug 22 2016 15:57:53 GMT+1000 (AEST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Sep 05 2016 11:26:15 GMT+1000 (AEST)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion doc/Utility.html
Expand Up @@ -1337,7 +1337,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="DataPath.
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Aug 22 2016 15:57:53 GMT+1000 (AEST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Sep 05 2016 11:26:15 GMT+1000 (AEST)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion doc/datapath.js.html
Expand Up @@ -621,7 +621,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="DataPath.
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Aug 22 2016 15:57:53 GMT+1000 (AEST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Sep 05 2016 11:26:15 GMT+1000 (AEST)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion doc/ext_jquery-1.12.3.js.html
Expand Up @@ -11057,7 +11057,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="DataPath.
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Aug 22 2016 15:57:53 GMT+1000 (AEST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Sep 05 2016 11:26:15 GMT+1000 (AEST)
</footer>

<script> prettyPrint(); </script>
Expand Down
4 changes: 2 additions & 2 deletions doc/index.html
Expand Up @@ -43,7 +43,7 @@ <h3> </h3>


<section>
<article><h1>MARIE.js</h1><h1><a href="https://travis-ci.org/MARIE-js/MARIE.js"><img src="https://travis-ci.org/MARIE-js/MARIE.js.svg?branch=master" alt="Build Status"></a> <a href="https://david-dm.org/marie-js/MARIE.js#info=devDependencies"><img src="https://david-dm.org/marie-js/MARIE.js/dev-status.svg" alt="devDependency Status"></a> <a href="http://gruntjs.com/"><img src="https://cdn.gruntjs.com/builtwith.svg" alt="Built with Grunt"></a> <a href="https://badge.fury.io/js/npm"><img src="https://badge.fury.io/js/npm.svg" alt="npm version"></a></h1><p>Current version: <code>0.8.0</code></p>
<article><h1>MARIE.js</h1><h1><a href="https://travis-ci.org/MARIE-js/MARIE.js"><img src="https://travis-ci.org/MARIE-js/MARIE.js.svg?branch=master" alt="Build Status"></a> <a href="https://gitter.im/MARIE-js/Lobby"><img src="https://badges.gitter.im/MARIE-js/gitter.png" alt="Gitter chat"></a> <a href="https://badge.fury.io/js/npm"><img src="https://badge.fury.io/js/npm.svg" alt="npm version"></a></h1><p>Current version: <code>0.8.7</code></p>
<p>MARIE.js is an implementation of a simulator for a 'Machine Architecture that is Really Intuitive and Easy'
from <a href="https://books.google.com.au/books/about/The_Essentials_of_Computer_Organization.html?id=3kQoAwAAQBAJ&amp;redir_esc=y">The Essentials of Computer Organization and Architecture</a> (Linda Null, Julia Lobur) in JavaScript.</p>
<p><strong><a href="https://marie-js.github.io/MARIE.js/">Try the simulator</a></strong></p>
Expand Down Expand Up @@ -99,7 +99,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="DataPath.
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Aug 22 2016 15:57:53 GMT+1000 (AEST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Sep 05 2016 11:26:15 GMT+1000 (AEST)
</footer>

<script> prettyPrint(); </script>
Expand Down
28 changes: 22 additions & 6 deletions doc/marie.js.html
Expand Up @@ -43,7 +43,6 @@ <h1 class="page-title">Source: marie.js</h1>
*
* @see MarieSim
* @param {string} name The name of the error.
* @param {number} lineNumber Which line caused the error.
* @param {string} message The error message.
*/
MarieSimError = function(name, message) {
Expand Down Expand Up @@ -222,6 +221,8 @@ <h1 class="page-title">Source: marie.js</h1>
*/
MarieSim.prototype.regSet = function(target, source, mask, alu_type) {
var oldValue;


if (source == "m") {
if (this.onRegLog) {
this.onRegLog([
Expand All @@ -231,6 +232,7 @@ <h1 class="page-title">Source: marie.js</h1>
].join(" "));
}


oldValue = this[target];
this[target] = Utility.uintToInt(this.memory[this.mar].contents);

Expand All @@ -245,12 +247,14 @@ <h1 class="page-title">Source: marie.js</h1>
address: this.mar
});



if (this.onRegWrite) {
this.onRegWrite.call(this, {
register: target,
oldValue: oldValue,
newValue: this[target]
});
register: target,
oldValue: oldValue,
newValue: this[target]
});
}

this.stateHistory.push({
Expand Down Expand Up @@ -327,6 +331,12 @@ <h1 class="page-title">Source: marie.js</h1>

this[target] = Utility.uintToInt(src &amp; msk);

if(target == "pc") {
if(0 &lt;= this[target] &amp;&amp; this[target] >= 4096) {
throw new MarieSimError("RuntimeError", "The address " + (this[target]).toString() + " is out of bounds.");
}
}

if (typeof source == "string") {
if(this.onRegRead) {
this.onRegRead.call(this, {
Expand Down Expand Up @@ -398,6 +408,12 @@ <h1 class="page-title">Source: marie.js</h1>
}

this[target] += typeof source == "string" ? this[source] : source;

if(target == "pc") {
if(0 &lt;= this[target] &amp;&amp; this[target] >= 4096) {
throw new MarieSimError("RuntimeError", "The address " + (this[target]).toString() + " is out of bounds.");
}
}
}

if(typeof source == "string") {
Expand Down Expand Up @@ -1068,7 +1084,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="DataPath.
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Aug 22 2016 15:57:53 GMT+1000 (AEST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Sep 05 2016 11:26:15 GMT+1000 (AEST)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion doc/utility.js.html
Expand Up @@ -223,7 +223,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="DataPath.
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Aug 22 2016 15:57:53 GMT+1000 (AEST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Sep 05 2016 11:26:15 GMT+1000 (AEST)
</footer>

<script> prettyPrint(); </script>
Expand Down

0 comments on commit a10f250

Please sign in to comment.