From fe7ae6e696811a39828dd9727295aa73ae4e5873 Mon Sep 17 00:00:00 2001 From: crecher Date: Mon, 12 Oct 2026 04:27:53 +0200 Subject: nes: add console with cpu bus and step loop tests: run nestest through nes console --- nes/bus.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 nes/bus.go (limited to 'nes/bus.go') diff --git a/nes/bus.go b/nes/bus.go new file mode 100644 index 0000000..480d178 --- /dev/null +++ b/nes/bus.go @@ -0,0 +1,21 @@ +package nes + +func (n *Console) Read(addr uint16) uint8 { + switch { + case addr < 0x2000: + return n.RAM[addr&0x7FF] + case addr >= 0x4020: + return n.Cart.Mapper.CPURead(addr) + default: + return 0 + } +} + +func (n *Console) Write(addr uint16, v uint8) { + switch { + case addr < 0x2000: + n.RAM[addr&0x7FF] = v + case addr >= 0x4020: + n.Cart.Mapper.CPUWrite(addr, v) + } +} \ No newline at end of file -- cgit v1.2.3