aboutsummaryrefslogtreecommitdiff
path: root/nes/nes.go
diff options
context:
space:
mode:
authorcrecher <crecher@crecher.net>2026-10-13 01:13:13 +0200
committercrecher <crecher@crecher.net>2026-10-13 01:13:13 +0200
commit99cae5a5a37f41f878a84857361eda47910303ba (patch)
tree31c8665ca991f95e09e93bb2e6ec91d81d2427ff /nes/nes.go
parent96ff6d8eda2ba434682909f4ff4ce350d78b2273 (diff)
downloadgones-99cae5a5a37f41f878a84857361eda47910303ba.tar.gz
gones-99cae5a5a37f41f878a84857361eda47910303ba.zip
sprites!!!!!!
Diffstat (limited to 'nes/nes.go')
-rw-r--r--nes/nes.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/nes/nes.go b/nes/nes.go
index 79580b6..5d96e8f 100644
--- a/nes/nes.go
+++ b/nes/nes.go
@@ -11,7 +11,10 @@ type Console struct {
PPU *ppu.PPU
Cart *cart.Cartridge
RAM [0x800]uint8
- // APU, controllers once they exist
+
+ controllers [2]controller
+ dmaPending bool
+ // APU once it exists
cycles uint64
}
@@ -25,6 +28,12 @@ func New(c *cart.Cartridge) *Console {
func (n *Console) Step() int {
cycles := n.CPU.Step()
+ if n.dmaPending {
+ n.dmaPending = false
+ stall := n.dmaStallCycles()
+ n.CPU.Stall(stall)
+ cycles += stall
+ }
n.cycles += uint64(cycles)
for i := 0; i < cycles*3; i++ {
n.PPU.Tick()