mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-01-27 08:31:17 +00:00
now support "hex" asm statements in bitmap editor
This commit is contained in:
parent
6490a49a85
commit
09ddea880b
@ -1 +1 @@
|
|||||||
Subproject commit 4334727f0e07acd4541b0a7b8f81a5984cd4aafe
|
Subproject commit ebf81921f80024e3e94c7a8e1235ab59464fa5ef
|
@ -224,6 +224,14 @@ var pixel_re = /([0#]?)([x$%]|\d'[bh])([0-9a-f]+)/gi;
|
|||||||
function parseHexBytes(s) {
|
function parseHexBytes(s) {
|
||||||
var arr = [];
|
var arr = [];
|
||||||
var m;
|
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)) {
|
while (m = pixel_re.exec(s)) {
|
||||||
var n;
|
var n;
|
||||||
if (m[2].startsWith('%') || m[2].endsWith("b"))
|
if (m[2].startsWith('%') || m[2].endsWith("b"))
|
||||||
@ -259,6 +267,12 @@ function replaceHexBytes(s, bytes) {
|
|||||||
result += m[1] + bytes[i++].toString();
|
result += m[1] + bytes[i++].toString();
|
||||||
}
|
}
|
||||||
result += s.slice(li);
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user