123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- ; 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"
- #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:
- sep #$20 : .as
- rep #$10 : .xl
- lda #$00
- pha
- plb
- lda $4210
- ldx #BG1_TILE_BASE+32*9
- stx $2116
- DMA0(#$01, #36*64, #^BG1_TILE_BUF, #!BG1_TILE_BUF+64*9, #$18)
- ldx #BG2_TILE_BASE+32*9
- stx $2116
- DMA0(#$01, #36*64, #^BG2_TILE_BUF, #!BG2_TILE_BUF+64*9, #$18)
- ldx #BG2_TILE_BASE
- stx $2116
- DMA0(#$01, #64*9, #^BG2_TILE_BUF, #!BG2_TILE_BUF, #$18)
- lda bar_yl
- asl
- asl
- tax
- lda barstep
- php
- txa
- dec
- plp
- bne small_bar
- asl
- bra normal_bar
- small_bar
- clc
- adc #31
- normal_bar
- sta bar_y
- lda bar_y
- cmp #224
- bne +
- lda #1
- +
- sta bar_y
- cmp #113
- bcs lower_half
- sta hdma_math
- lda #$01
- sta hdma_math+3
- bra math_cont
- lower_half
- clc
- sbc #110
- sta hdma_math+3
- lda #112
- sta hdma_math
- math_cont
- lda #$3e ; ch. 1-5
- sta @$420c ; trigger HDMA
- lda #$01
- sta isr_done
- rtl
- ; IRQ - called when triggered
- IRQ_ROUTINE:
- sep #$20 : .as
- lda $4211 ;Acknowledge irq
- rtl
|