Skip to content

Commit

Permalink
memoryview: Fix memoryDisplay stuck on VM
Browse files Browse the repository at this point in the history
  • Loading branch information
ArhanChaudhary committed Apr 22, 2024
1 parent b0883b6 commit 2d62fed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ I've used a myriad of optimization techniques to snake around the following hard
- NAND has a limited RAM memory space, meaning the program has to be careful to optimize heap memory usage. In fact, the reason why the screen fills with static between generations is to use the screen memory space as temporary swap memory for the next generation — the RAM is already completely full!
- NAND has no floating point type (decimal numbers) and can only represent the integers between -32768 and 32767, making calculating fitness less precise and more challenging to implement. [Integer overflows](https://en.wikipedia.org/wiki/Integer_overflow) must also be accounted for.

To avoid beating around the bush, I've stuck to documenting these techniques and additional insights in this program's codebase for those interested.
To avoid beating around the bush, I've stuck to documenting these techniques and additional insights in this program's <a href="src/example-programs/GeneticAlgorithm">codebase</a> for those interested.

# Writing programs for NAND

Expand Down Expand Up @@ -194,7 +194,7 @@ Additionally, it uses `Keyboard.readLine` and `Keyboard.readInt` to read input f

### Custom Data Types

Every programming language has a fixed set of primitive data types. Jack supports three: `int`, `char`, and `boolean`. You can extend this basic repertoire with your own abstract data types as needed. Prior knowledge about [object-oriented programming](https://en.wikipedia.org/wiki/Object-oriented_programming) directly carries over to this section.
Every programming language has a fixed set of primitive data types. Jack supports three: `int`, `char`, and `boolean`. You can extend this basic repertoire with your own abstract data types as needed. Prior knowledge about [object-oriented programming](https://en.wikipedia.org/wiki/Object-oriented_programming) directly carries over to this section.
<!-- cSpell:disable -->
```js
/** Represents a point in 2D plane. */
Expand Down
3 changes: 3 additions & 0 deletions src/app/MemoryView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,16 @@
switch (memoryDisplay) {
case "bin":
highlightIndex = $computerMemory.pcRegister;
break;
case "asm":
highlightIndex = pcToAssembly[$computerMemory.pcRegister];
break;
case "vm":
let ret = assemblyToVMCode[pcToAssembly[$computerMemory.pcRegister]];
if (ret !== null) {
highlightIndex = ret;
}
break;
}
if (followPC) {
scrollToIndex = highlightIndex;
Expand Down

0 comments on commit 2d62fed

Please sign in to comment.