Skip to content

Commit

Permalink
fix #526: vm emulator raises "call stack exceeded"… (#529)
Browse files Browse the repository at this point in the history
fix #526: vm emulator raises "call stack exceeded" when doing println in last row

move check for last screen row from printChar to println, so the check runs on every newline command

Co-authored-by: Dorian Ignee <dorian.ignee@posterselect.de>
  • Loading branch information
dorianignee and Dorian Ignee authored Dec 19, 2024
1 parent e1c8a29 commit cee36e6
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions simulator/src/vm/os/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class OutputLib {
}

println() {
this.row += 1;
this.row = this.row == MAX_HEIGHT ? 0 : this.row + 1;
this.col = 0;
}

Expand Down Expand Up @@ -83,9 +83,6 @@ export class OutputLib {
this.col += 1;
if (this.col == MAX_WIDTH) {
this.println();
if (this.row == MAX_HEIGHT) {
this.row = 0;
}
}
}

Expand Down

0 comments on commit cee36e6

Please sign in to comment.