aboutsummaryrefslogtreecommitdiff
path: root/nes/dma.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/dma.go
parent96ff6d8eda2ba434682909f4ff4ce350d78b2273 (diff)
downloadgones-99cae5a5a37f41f878a84857361eda47910303ba.tar.gz
gones-99cae5a5a37f41f878a84857361eda47910303ba.zip
sprites!!!!!!
Diffstat (limited to 'nes/dma.go')
-rw-r--r--nes/dma.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/nes/dma.go b/nes/dma.go
new file mode 100644
index 0000000..ebdbcea
--- /dev/null
+++ b/nes/dma.go
@@ -0,0 +1,19 @@
+package nes
+
+// im too lazy to write an explanation so heres the nesdev page
+// https://www.nesdev.org/wiki/DMA#OAM_DMA
+func (n *Console) oamDMA(page uint8) {
+ base := uint16(page) << 8
+ for i := uint16(0); i < 256; i++ {
+ n.PPU.WriteRegister(0x2004, n.Read(base+i))
+ }
+ n.dmaPending = true
+}
+
+func (n *Console) dmaStallCycles() int {
+ stall := 513
+ if n.CPU.Cycles&1 == 1 {
+ stall++
+ }
+ return stall
+}