diff options
| author | crecher <crecher@crecher.net> | 2026-10-12 04:27:53 +0200 |
|---|---|---|
| committer | crecher <crecher@crecher.net> | 2026-10-12 04:27:53 +0200 |
| commit | fe7ae6e696811a39828dd9727295aa73ae4e5873 (patch) | |
| tree | 503f3c353cbd9e10714df80999da1738d13eb180 /nes/bus.go | |
| parent | be4d8cb438b1b0f0a66681adc319875b5ee69eed (diff) | |
| download | gones-fe7ae6e696811a39828dd9727295aa73ae4e5873.tar.gz gones-fe7ae6e696811a39828dd9727295aa73ae4e5873.zip | |
nes: add console with cpu bus and step loop
tests: run nestest through nes console
Diffstat (limited to 'nes/bus.go')
| -rw-r--r-- | nes/bus.go | 21 |
1 files changed, 21 insertions, 0 deletions
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 |