Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

optional offset

  • Loading branch information...
commit ea7b0f45c5f719474780a3bd3c0db280c4fcd670 1 parent 60afb44
@mental authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 javascripts/demo.js
View
7 javascripts/demo.js
@@ -33,6 +33,7 @@
function applyInputChange() {
vdu.cloneFrom(BLANK_VDU);
+ var lastAddr = 0;
var lines = input.value.split(/(?:#.*)?\n+/);
for (var i = 0; i < lines.length; i++) {
var line = lines[i];
@@ -40,15 +41,19 @@
if (compacted.length == 0) {
continue;
}
- var m = /^(?:([0-9a-fA-F]+):)([0-9a-fA-F]*)$/.exec(compacted);
+ var m = /^(?:([0-9a-fA-F]+):)?([0-9a-fA-F]*)$/.exec(compacted);
if (m == null) {
break;
}
var addr = parseInt(m[1], 16);
+ if (addr == null) {
+ addr = lastAddr;
+ }
var bytes = [];
for (var j = 0; j < m[2].length; j += 2) {
bytes.push(parseInt(m[2].substr(j, 2), 16));
}
+ lastAddr = addr + bytes.length;
vdu.write(addr, bytes);
}
ctx.putImageData(vdu.renderFrame(), 0, 0);
Please sign in to comment.
Something went wrong with that request. Please try again.