1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- ; 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*10
- stx $2116
- DMA0(#$01, #34*64, #^BG1_TILE_BUF, #!BG1_TILE_BUF+64*10, #$18)
- ldx #BG2_TILE_BASE+32*10
- stx $2116
- DMA0(#$01, #34*64, #^BG2_TILE_BUF, #!BG2_TILE_BUF+64*10, #$18)
- ldx #BG2_TILE_BASE
- stx $2116
- DMA0(#$01, #64*10, #^BG2_TILE_BUF, #!BG2_TILE_BUF, #$18)
- lda bar_yl
- asl
- asl
- tax
- lda barstep
- php
- txa
- plp
- bne small_bar
- asl
- bra normal_bar
- small_bar
- clc
- adc #36
- 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
|