From 502dc171f45e5acf00c34521328b414d5285f598 Mon Sep 17 00:00:00 2001 From: Hannes Schulze Date: Sat, 18 Jan 2025 23:06:34 +0100 Subject: wip ppu --- src/nes/controller.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/nes/controller.cc') diff --git a/src/nes/controller.cc b/src/nes/controller.cc index e73f8e5..87842e2 100644 --- a/src/nes/controller.cc +++ b/src/nes/controller.cc @@ -4,12 +4,15 @@ namespace nes { auto controller::read() -> std::uint8_t { - // TODO - return 0x0; + auto const res = index_ < 8 ? (pressed_.get_raw_value() >> index_) & 1 : 0; + index_ += 1; + if (strobing_) { index_ = 0; } + return res; } - auto controller::write(std::uint8_t) -> void + auto controller::write(std::uint8_t const value) -> void { - // TODO + strobing_ = value & 1; + if (strobing_) { index_ = 0; } } } // namespace nes \ No newline at end of file -- cgit v1.3.1