; 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 "dma.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 on VBlank
NMI_ROUTINE:
	php
        sep #$20 : .as
	pha
        lda $4210	; ack interrupt
;	lda #$0e
;	sta $420c  ; enable HDMA ch. 1-3
	pla
	plp
        rtl

; IRQ - called when triggered
IRQ_ROUTINE:
	php
        sep #$20 : .as
	pha
        lda $4211  ;Acknowledge irq
	lda #$01
	sta isr_flag
	pla
	plp
        rtl

