Skip to content

Commit c2e8a2e

Browse files
committed
edit memory
1 parent 8e76f10 commit c2e8a2e

File tree

6 files changed

+50
-3
lines changed

6 files changed

+50
-3
lines changed

dist/webpage/emulator/parseInt.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/webpage/executeTab/etab.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/webpage/executeTab/etab.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/webpage/style.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ body {
6868
flex-shrink: 1;
6969
min-height: 0;
7070
border: 2px solid rgb(140 140 140);
71+
table{
72+
table-layout: fixed;
73+
}
7174
}
7275
table {
7376
font-size: 10px;
@@ -180,6 +183,13 @@ tr:nth-of-type(even) {
180183
flex-shrink:1;
181184
min-height:0;
182185
}
186+
.memView input{
187+
background:transparent;
188+
border:none;
189+
font-size: 10px;
190+
min-width: 100%;
191+
max-width: 100%;
192+
}
183193
.controls{
184194
flex-shrink:0;
185195
display:flex;

src/webpage/executeTab/etab.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,26 @@ class Etab {
402402
tr.append(address);
403403
for (let cell = 0; cell < 8; cell++) {
404404
const cellHTML = document.createElement("td");
405+
cellHTML.onclick = () => {
406+
if (cellHTML.children.length) {
407+
return;
408+
}
409+
const val = cellHTML.textContent || "";
410+
cellHTML.textContent = "";
411+
const input = document.createElement("input");
412+
input.value = val;
413+
cellHTML.append(input);
414+
input.focus();
415+
input.onkeydown = (e) => {
416+
if (e.key === "Enter") {
417+
input.blur();
418+
}
419+
};
420+
input.onblur = () => {
421+
this.write32(addr, globalThis.parseInt(input.value));
422+
this.updateMemCell(addr, false);
423+
};
424+
};
405425
const addr = offset + cell * 4;
406426
this.memMap.set(addr, cellHTML);
407427
this.updateMemCell(addr, false);
@@ -410,6 +430,13 @@ class Etab {
410430
table.append(tr);
411431
}
412432
}
433+
write32(addr: number, numb: number) {
434+
try {
435+
this.sys?.ram.setInt32(addr, numb);
436+
} catch {
437+
return;
438+
}
439+
}
413440
get32MemOr0(addr: number) {
414441
try {
415442
return this.sys?.ram.getUint32(addr) || 0;

src/webpage/style.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ body {
6868
flex-shrink: 1;
6969
min-height: 0;
7070
border: 2px solid rgb(140 140 140);
71+
table{
72+
table-layout: fixed;
73+
}
7174
}
7275
table {
7376
font-size: 10px;
@@ -180,6 +183,13 @@ tr:nth-of-type(even) {
180183
flex-shrink:1;
181184
min-height:0;
182185
}
186+
.memView input{
187+
background:transparent;
188+
border:none;
189+
font-size: 10px;
190+
min-width: 100%;
191+
max-width: 100%;
192+
}
183193
.controls{
184194
flex-shrink:0;
185195
display:flex;

0 commit comments

Comments
 (0)