Skip to content

Commit bfa8270

Browse files
committed
webRars memory update
1 parent 65ac40d commit bfa8270

File tree

10 files changed

+130
-14
lines changed

10 files changed

+130
-14
lines changed

dist/webpage/emulator/emulator.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/emulator/emulator.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: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,18 @@ tr:nth-of-type(even) {
176176
display: flex;
177177
flex-direction: column;
178178
}
179-
179+
.memView{
180+
flex-shrink:1;
181+
min-height:0;
182+
}
183+
.controls{
184+
flex-shrink:0;
185+
display:flex;
186+
justify-content: center;
187+
gap: 4px;
188+
padding: 4px 0px;
189+
background: lightgray;
190+
}
180191
.start {
181192
display: flex;
182193
align-items: center;

dist/webpage/translations/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"runio": "Run I/O",
8181
"programDone": "--- The program has finished running ($1) ----",
8282
"address": "Address",
83+
"memvalue":"Value (+$1)",
8384
"code": "Code",
8485
"basic": "Basic",
8586
"startScreen": "Open a file or start a project!",

src/webpage/emulator/emulator.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,30 +188,30 @@ class Symstem {
188188
return;
189189
}
190190
}
191+
setMem = (_addr: number) => {};
191192
runS(inst: {type: "S"; opcode: number; funct3: number; rs1: number; rs2: number; imm: number}) {
193+
const addr = this.intRegis[inst.rs1] + BigInt(inst.imm);
192194
switch (inst.opcode) {
193195
case 0b0100011:
194196
switch (inst.funct3) {
195197
case 0x0:
196-
this.ram.setInt8(this.intRegis[inst.rs1] + BigInt(inst.imm), this.intRegis[inst.rs2]);
198+
this.ram.setInt8(addr, this.intRegis[inst.rs2]);
197199
break;
198200
case 0x1:
199-
this.ram.setInt16(this.intRegis[inst.rs1] + BigInt(inst.imm), this.intRegis[inst.rs2]);
201+
this.ram.setInt16(addr, this.intRegis[inst.rs2]);
200202
break;
201203
case 0x2:
202-
this.ram.setInt32(this.intRegis[inst.rs1] + BigInt(inst.imm), this.intRegis[inst.rs2]);
204+
this.ram.setInt32(addr, this.intRegis[inst.rs2]);
203205
break;
204206
case 0x3:
205207
console.log(inst.rs1, inst.rs2);
206-
this.ram.setBigInt64(
207-
this.intRegis[inst.rs1] + BigInt(inst.imm),
208-
this.intRegis[inst.rs2],
209-
);
208+
this.ram.setBigInt64(addr, this.intRegis[inst.rs2]);
210209
break;
211210
default:
212211
throw new runTimeError(I18n.runTimeErrors.unknownInstruction(inst.opcode + ""));
213212
}
214213
this.pc += 4;
214+
this.setMem(Number(addr));
215215
return;
216216
default:
217217
throw new runTimeError(I18n.runTimeErrors.unknownInstruction(inst.opcode + ""));

0 commit comments

Comments
 (0)