aboutsummaryrefslogtreecommitdiff
path: root/scroll/include/ppu.s
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-04-09 00:33:04 +0200
committerMiquel Sabaté Solà <mssola@mssola.com>2026-04-10 13:32:44 +0200
commit1978afbc18ffb227f0ce36663648e00d1d2d7945 (patch)
tree10584b63468ca718be84a40ef2c34ef99cb75924 /scroll/include/ppu.s
parent21a599651c07ee021d0f211ba45add538acd0f4a (diff)
downloadcode.nes-1978afbc18ffb227f0ce36663648e00d1d2d7945.tar.gz
code.nes-1978afbc18ffb227f0ce36663648e00d1d2d7945.zip
Add the sound/beep.s example
This is the most simple example you can come up when it comes to producing sound on the NES/Famicom. Basically, a single note is delivered to the APU which is continuously on. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'scroll/include/ppu.s')
-rw-r--r--scroll/include/ppu.s12
1 files changed, 12 insertions, 0 deletions
diff --git a/scroll/include/ppu.s b/scroll/include/ppu.s
index 34410a0..f62d702 100644
--- a/scroll/include/ppu.s
+++ b/scroll/include/ppu.s
@@ -1,3 +1,15 @@
+;; WRITE_PPU_DATA is a macro that will write into PPUADDR the given address and
+;; into PPUDATA the given byte value.
+.macro WRITE_PPU_DATA address, value
+ bit $2002
+ lda #.HIBYTE(address)
+ sta $2006
+ lda #.LOBYTE(address)
+ sta $2006
+ lda #value
+ sta $2007
+.endmacro
+
.scope PPU
CONTROL = $2000
MASK = $2001