From dd7a4efc643c20c56b845aa11af1fec4b0760d92 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Sun, 3 Dec 2023 07:45:53 +0100 Subject: First day of advent of code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- include/ppu.s | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 include/ppu.s (limited to 'include/ppu.s') diff --git a/include/ppu.s b/include/ppu.s new file mode 100644 index 0000000..23fd978 --- /dev/null +++ b/include/ppu.s @@ -0,0 +1,27 @@ +.segment "CODE" + +.scope PPU + CONTROL = $2000 + MASK = $2001 + STATUS = $2002 + SCROLL = $2005 + ADDRESS = $2006 + DATA = $2007 +.endscope + +.macro PPU_ADDR address + lda #.HIBYTE(address) + sta PPU::ADDRESS + lda #.LOBYTE(address) + sta PPU::ADDRESS +.endmacro + +;; WRITE_PPU_DATA is a macro that will write into PPU::ADDRESS the given address +;; and into PPU::DATA the given byte value. +.macro WRITE_PPU_DATA address, value + bit PPU::STATUS + + PPU_ADDR address + lda #value + sta PPU::DATA +.endmacro -- cgit v1.2.3