Skip to content

Commit

Permalink
Merge pull request #51 from y0014984/graphics-rewrite
Browse files Browse the repository at this point in the history
Graphics rewrite
  • Loading branch information
y0014984 authored Jan 17, 2025
2 parents 4810c7b + 8531590 commit 7f156e8
Show file tree
Hide file tree
Showing 7 changed files with 432 additions and 119 deletions.
Binary file modified src/assets/games/snake.prg
Binary file not shown.
Binary file modified src/assets/roms/bios.prg
Binary file not shown.
10 changes: 6 additions & 4 deletions src/logic/Computer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class Computer {
updateCallback: () => void;
breakPoints: number[] = [];

constructor({ memorySize = 65536, monitorWidth = 320, monitorHeight = 240, updateCallback = () => {} }: ComputerParams) {
constructor({ memorySize = 65536, updateCallback = () => {} }: ComputerParams) {
this.updateCallback = updateCallback;

this.mem = new Memory(
Expand All @@ -67,7 +67,7 @@ export class Computer {
}
);

this.gfx = new Graphics(monitorWidth, monitorHeight, this.mem);
this.gfx = new Graphics(this.mem);

this.snd = new Sound(this.mem);

Expand Down Expand Up @@ -152,6 +152,8 @@ export class Computer {
async turnOn() {
if (this.status === Status.ON) return;

this.gfx.clearCanvasBackground();

await this.loadBios();

this.cpu.pc.setInt(this.mem.int[resetVector], this.mem.int[resetVector + 1]);
Expand Down Expand Up @@ -231,9 +233,9 @@ export class Computer {
this.currentCyclesPerSec = 0;
this.currentFps = 0;
this.breakPoints = [];
this.gfx.reset();
this.mem.reset();
this.cpu.reset();
this.mem.reset();
this.gfx.reset();
}

reset() {
Expand Down
Loading

0 comments on commit 7f156e8

Please sign in to comment.