All files / use-chip8-emulator/src useChip8Emulator.ts

100% Statements 33/33
100% Branches 1/1
100% Functions 1/1
100% Lines 33/33

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 372x 2x   2x 2x 2x 2x 2x 2x 2x 2x   2x 2x 2x 2x 2x 2x 2x 2x 2x   2x 2x 2x 2x 2x 2x 2x 2x 2x 2x   2x 2x 2x 2x
import { Cpu, Emulator, Graphics, Input, Memory, Registers, Stack, Timer } from "@mawsfr/chip8";
import { ref } from "vue";
 
export const useChip8Emulator = () => {
    const graphics = new Graphics();
    const stack = new Stack();
    const registers = new Registers();
    const memory = new Memory(registers);
    const input = new Input();
    const delayTimer = new Timer();
    const soundTimer = new Timer();
 
    const cpu = new Cpu({
        graphics,
        stack,
        registers,
        memory,
        input,
        delayTimer,
        soundTimer,
    });
 
    const emulator = ref(new Emulator({
        cpu,
        graphics,
        stack,
        registers,
        memory,
        input,
        delayTimer,
        soundTimer
    }))
 
    return {
        emulator
    };
}