UNPKG

nes-emu

Version:

A NES emulator

23 lines (21 loc) 740 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _registers = require("../../registers"); /** Controls the frequency sweeper of a Pulse channel. */ class PulseSweep extends _registers.WriteOnlyInMemoryRegister { constructor(id) { super(); this.id = id; this.addReadOnlyField("shiftCount", 0, 3).addReadOnlyField("negateFlag", 3).addReadOnlyField("dividerPeriodMinusOne", 4, 3).addReadOnlyField("enabledFlag", 7); } /** Sets the start flag of the frequency sweeper. */ writeAt(__, byte) { this.setValue(byte); const channel = this.context.apu.channels.pulses[this.id]; channel.frequencySweeper.startFlag = true; } } exports.default = PulseSweep;