From 1978afbc18ffb227f0ce36663648e00d1d2d7945 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Thu, 9 Apr 2026 00:33:04 +0200 Subject: Add the sound/beep.s example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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à --- scroll/include/all.s | 1 - scroll/include/ppu.s | 12 ++++++++++++ scroll/toggle.s | 1 - 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'scroll') diff --git a/scroll/include/all.s b/scroll/include/all.s index 763feb4..e9f059d 100644 --- a/scroll/include/all.s +++ b/scroll/include/all.s @@ -6,7 +6,6 @@ .include "ppu.s" .include "../../shared/asm.s" .include "../../shared/joypad.s" -.include "../../shared/ppu.s" .include "reset.s" .include "palettes.s" 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 diff --git a/scroll/toggle.s b/scroll/toggle.s index 57f403f..bba0e97 100644 --- a/scroll/toggle.s +++ b/scroll/toggle.s @@ -31,7 +31,6 @@ .include "./include/ppu.s" .include "./include/oam.s" .include "./include/globals.s" -.include "../shared/ppu.s" .include "../shared/clear.s" ;; Variables used on this example. -- cgit v1.2.3