sd2snes/snes/reset.a65
2009-10-19 01:17:43 +02:00

57 lines
1.0 KiB
Plaintext

; This file is part of the snescom-asm demo - a demo of how to build a SNES program.
; See http://bisqwit.iki.fi/source/snescom.html for details.
#include "memmap.i65"
#define TILE_ADDR_REG_VAL(addr, scsize) \
(((addr & $FC00) >> 8) + scsize)
#define BMAP_ADDR_REG_VAL(addr, addr2) \
(((addr & $F000) >> 12) | (((addr2 & $F000) >> 12) << 4))
; NMI - called once per screen refresh (or something like that)
NMI_ROUTINE:
sep #$20 : .as
lda @$4210
lda #$01
sta $4300
lda #^BG1_TILE_BUF
ldx #!BG1_TILE_BUF+64*10
stx $4302
sta $4304
ldx #$380*2-64*10
stx $4305
ldx #BG1_TILE_BASE+32*10
stx $2116
lda #$18
sta $4301
lda #$01
sta $420b
lda #$01
sta $4300
lda #^BG2_TILE_BUF
ldx #!BG2_TILE_BUF+64*10
stx $4302
sta $4304
ldx #$380*2-64*10
stx $4305
ldx #BG2_TILE_BASE+32*10
stx $2116
lda #$18
sta $4301
lda #$01
sta $420b
lda #$1e ; ch. 1-4
sta @$420c ; trigger HDMA
rtl
; IRQ - called when triggered (which is..?)
IRQ_ROUTINE:
sep #$20 : .as
lda $4211 ;Acknowledge irq
rtl