Permalink
Browse files

Merge

  • Loading branch information...
Lorenzo Ganni Lorenzo Ganni
Lorenzo Ganni authored and Lorenzo Ganni committed May 16, 2018
2 parents 9271d86 + a75b715 commit 5f00c1832ea4ce3508161b303716ab1f8c7768db
Showing with 77 additions and 2 deletions.
  1. +3 −0 README.md
  2. +17 −2 gulpfile.babel.js
  3. +57 −0 src/js/services/run.js
View
@@ -54,6 +54,9 @@ If you were looking for that simulator (available only in italian), you can down
This changelog refers to the online version of the simulator.
### v2017.01.27
+ Bug fix: storing large values in memory cells resulted in misplaced digits
### v2017.01.04
+ All samples download button
+ Clear log button
View
@@ -23,6 +23,9 @@ import ngAnnotate from 'gulp-ng-annotate';
// production mode indicator
const production = argv.argv.production
// production mode indicator
const production = argv.argv.production;
// use 'dist' folder for production output, dest otherwise
const dest = production ? 'dist' : 'build';
@@ -50,7 +53,7 @@ gulp.task('styles', () => {
.pipe(sass(
{
importer: compass,
outputStyle: argv.production ? 'compressed' : 'nested',
outputStyle: production ? 'compressed' : 'nested',
functions: sassInlineImage({}),
includePaths: [fontAwesome.scssPath]
}
@@ -62,7 +65,7 @@ gulp.task('styles', () => {
merge(sassStream, codeMirrorLint, codeMirror)
.pipe(concat('app.css'))
.pipe(rename('style.min.css'))
.pipe(gulpif(argv.production, uglifycss({ 'uglyComments': true })))
.pipe(gulpif(production, uglifycss({ 'uglyComments': true })))
.pipe(gulp.dest(dest + '/src'));
});
@@ -74,6 +77,7 @@ gulp.task('fonts', () => {
// produce uglified app js code
gulp.task('scripts', () => {
<<<<<<< HEAD
var sources = browserify({
entries: 'src/js/index.js',
debug: true
@@ -85,6 +89,17 @@ gulp.task('scripts', () => {
.pipe(vinylBuffer())
.pipe(ngAnnotate())
.pipe(gulpif(argv.production, uglify()))
=======
gulp.src('src/js/index.js')
.pipe(
bro({
transform: [
babelify.configure( { presets: ['es2015'] } ),
production ? [ 'uglifyify', { global: true } ] : ''
]
})
)
>>>>>>> a75b7157a2d2315d8858fb213886a5ca9c2da1df
.pipe(rename('app.js'))
.pipe(gulp.dest(dest + '/src'));
});
View
@@ -151,8 +151,65 @@ export default class RunService {
eval("this.sim.acc" + this.sim.alu.op + "parseInt(this.sim.alu.e2)")
);
break;
<<<<<<< HEAD
}
this.sim.focus.el = 'acc';
=======
}
// aything but LOD instruction behaviour
if (sim.ir.cmd != 'LOD') sim.alu.e1 = sim.acc;
// parse data portion (instruction register loc)
if (sim.ir.loc.indexOf('#') != -1) { // #n
sim.alu.e2 = sim.ir.loc.replace('#','');
}
else if (sim.ir.loc.match(/T|X|Y|Z|W/)) { // variable
sim.focus.var = sim.ir.loc;
sim.alu.e2 = parseInt(sim.variables[sim.ir.loc]) || 0;
stats.variables_accesses++;
}
else { // memory cell
codeMirror.cell.focus(sim.ir.loc);
sim.alu.e2 = parseInt(codeMirror.doc.getLine(sim.ir.loc)) || 0;
stats.cells_accesses++;
}
sim.focus.el = 'aluE2';
break;
case 8:
if (sim.ir.cmd != 'STO') {
// execute operation
switch (sim.alu.op) {
case '=':
sim.acc = parseInt(sim.alu.e2) || 0;
break;
default:
stats.alu_calculations++;
sim.acc = parseInt(
eval("sim.acc" + sim.alu.op + "parseInt(sim.alu.e2)")
);
break;
}
sim.focus.el = 'acc';
}
// STO instruction -> edit cell / variable
else {
if (sim.ir.loc.match(/T|X|Y|Z|W/)) { // variable
sim.focus.var = sim.ir.loc;
sim.variables[sim.ir.loc] = sim.acc;
stats.variables_accesses++;
}
else { // memory cell
stats.cells_accesses++;
// focus that cell
codeMirror.cell.focus(sim.ir.loc);
// append to cell content
var line = sim.ir.loc,
start = { line: line, ch: 0 },
end = { line: line, ch: codeMirror.doc.getLine(sim.ir.loc).length };
codeMirror.doc.replaceRange(sim.acc.toString(), start, end);
}
}
break;
>>>>>>> a75b7157a2d2315d8858fb213886a5ca9c2da1df
}
// STO instruction -> edit cell / variable
else {

0 comments on commit 5f00c18

Please sign in to comment.