2017-04-22 13:54:00 +00:00
|
|
|
function getCookie(name) {
|
|
|
|
var prefix = name + "=";
|
|
|
|
var cookieStartIndex = document.cookie.indexOf(prefix);
|
|
|
|
if (cookieStartIndex == -1)
|
|
|
|
return null;
|
|
|
|
var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex
|
|
|
|
+ prefix.length);
|
|
|
|
if (cookieEndIndex == -1)
|
|
|
|
cookieEndIndex = document.cookie.length;
|
|
|
|
return unescape(document.cookie.substring(cookieStartIndex + prefix.length,
|
|
|
|
cookieEndIndex));
|
|
|
|
}
|
|
|
|
function setCookie(name, value) {
|
|
|
|
document.cookie = name + "=" + escape(value) + "; path=/";
|
|
|
|
}
|
|
|
|
function setCookieElem(name, defv) {
|
|
|
|
var val = getCookie(name);
|
|
|
|
if (val == null || val.charAt(0) != '0' || val.charAt(1) != 'x') {
|
|
|
|
val = defv;
|
|
|
|
setCookie(name, val);
|
|
|
|
}
|
|
|
|
document.getElementById(name).value = val;
|
|
|
|
}
|
|
|
|
function NewCookie(add) {
|
|
|
|
var val = parseInt(document.getElementById('start').value, 16) & 0xFFFFFFF0;
|
|
|
|
if (val == NaN)
|
2017-05-14 02:55:03 +00:00
|
|
|
setCookieElem('start', '0x10000000');
|
2017-04-22 13:54:00 +00:00
|
|
|
else {
|
|
|
|
val += add;
|
2017-05-14 02:55:03 +00:00
|
|
|
setCookie('start', '0x' + (val >>> 0).toString(16));
|
2017-04-22 13:54:00 +00:00
|
|
|
var nval = val + 256;
|
2017-05-14 02:55:03 +00:00
|
|
|
setCookie('stop', '0x' + (nval >>> 0).toString(16));
|
|
|
|
document.getElementById('start').value = '0x' + (val >>> 0).toString(16);
|
2017-04-22 13:54:00 +00:00
|
|
|
document.getElementById('pmem').contentWindow.location.reload();
|
|
|
|
}
|
|
|
|
}
|
2017-05-14 02:55:03 +00:00
|
|
|
setCookieElem('start', '0x10000000');
|
|
|
|
setCookieElem('set_ramaddr', '0x10000000');
|
2017-04-22 13:54:00 +00:00
|
|
|
setCookieElem('set_ramdata', '0x12345678');
|
|
|
|
function UpTxt(xD, n, v) {
|
|
|
|
var x = getXMLValue(xD, n, v);
|
|
|
|
if (x == '?')
|
|
|
|
document.getElementById("id_" + n).style.color = "#833";
|
|
|
|
else
|
|
|
|
document.getElementById("id_" + n).style.color = "#333";
|
|
|
|
document.getElementById("id_" + n).innerHTML = x + v;
|
|
|
|
}
|
|
|
|
function UpdateValuesRam(xD) {
|
|
|
|
if (xD) {
|
|
|
|
UpTxt(xD, "ramaddr", "");
|
|
|
|
UpTxt(xD, "ramdata", "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function SendRamVal(x) {
|
|
|
|
var addr = parseInt(document.getElementById('set_ramaddr').value, 16);
|
|
|
|
var val = parseInt(document.getElementById('set_ramdata').value, 16);
|
|
|
|
if (addr != NaN && val != NaN) {
|
2017-05-14 02:55:03 +00:00
|
|
|
document.getElementById('set_ramaddr').value = '0x' + (addr >>> 0).toString(16);
|
|
|
|
setCookie('set_ramaddr','0x' + (addr >>> 0).toString(16));
|
|
|
|
document.getElementById('set_ramdata').value = '0x' + (val >>> 0).toString(16);
|
|
|
|
setCookie('set_ramdata','0x' + (val >>> 0).toString(16));
|
2017-04-22 13:54:00 +00:00
|
|
|
if (x != 0)
|
2017-05-14 02:55:03 +00:00
|
|
|
newAJAXCommand('chiprams.xml?start=0x' + (addr >>> 0).toString(16),
|
2017-04-22 13:54:00 +00:00
|
|
|
UpdateValuesRam, 0);
|
|
|
|
else
|
2017-05-14 02:55:03 +00:00
|
|
|
newAJAXCommand('chiprams.xml?sys_ram0x' + (addr >>> 0).toString(16) + '=0x'
|
|
|
|
+ val.toString(16) + '&start=0x' + (addr >>> 0).toString(16),
|
2017-04-22 13:54:00 +00:00
|
|
|
UpdateValuesRam, 0);
|
|
|
|
}
|
|
|
|
}
|