Merge branch 'master' of github.com:sehugg/8bitworkshop

This commit is contained in:
Steven Hugg 2018-07-30 22:46:24 -04:00
commit 94a932c08d
2 changed files with 15 additions and 1 deletions

@ -1 +1 @@
Subproject commit 4334727f0e07acd4541b0a7b8f81a5984cd4aafe
Subproject commit ebf81921f80024e3e94c7a8e1235ab59464fa5ef

View File

@ -224,6 +224,14 @@ var pixel_re = /([0#]?)([x$%]|\d'[bh])([0-9a-f]+)/gi;
function parseHexBytes(s) {
var arr = [];
var m;
// convert 'hex ....' asm format
s = s.replace(/(\shex\s+)([0-9a-f]+)/ig, function(m,hexprefix,hexstr) {
var rtn = hexprefix;
for (var i=0; i<hexstr.length; i+=2) {
rtn += '0x'+hexstr.substr(i,2)+',';
}
return rtn;
});
while (m = pixel_re.exec(s)) {
var n;
if (m[2].startsWith('%') || m[2].endsWith("b"))
@ -259,6 +267,12 @@ function replaceHexBytes(s, bytes) {
result += m[1] + bytes[i++].toString();
}
result += s.slice(li);
// convert 'hex ....' asm format
result = result.replace(/(\shex\s+)([,x0-9a-f]+)/ig, function(m,hexprefix,hexstr) {
var rtn = hexprefix + hexstr;
rtn = rtn.replace(/0x/,'').replace(',','')
return rtn;
});
return result;
}