reset.a65 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. ; This file is part of the snescom-asm demo - a demo of how to build a SNES program.
  2. ; See http://bisqwit.iki.fi/source/snescom.html for details.
  3. #include "memmap.i65"
  4. #include "dma.i65"
  5. #define TILE_ADDR_REG_VAL(addr, scsize) \
  6. (((addr & $FC00) >> 8) + scsize)
  7. #define BMAP_ADDR_REG_VAL(addr, addr2) \
  8. (((addr & $F000) >> 12) | (((addr2 & $F000) >> 12) << 4))
  9. ; NMI - called on VBlank
  10. NMI_ROUTINE:
  11. sep #$20 : .as
  12. rep #$10 : .xl
  13. lda #$00
  14. pha
  15. plb
  16. lda $4210
  17. ldx #BG1_TILE_BASE+32*10
  18. stx $2116
  19. DMA0(#$01, #34*64, #^BG1_TILE_BUF, #!BG1_TILE_BUF+64*10, #$18)
  20. ldx #BG2_TILE_BASE+32*10
  21. stx $2116
  22. DMA0(#$01, #34*64, #^BG2_TILE_BUF, #!BG2_TILE_BUF+64*10, #$18)
  23. ldx #BG2_TILE_BASE
  24. stx $2116
  25. DMA0(#$01, #64*10, #^BG2_TILE_BUF, #!BG2_TILE_BUF, #$18)
  26. lda bar_yl
  27. asl
  28. asl
  29. tax
  30. lda barstep
  31. php
  32. txa
  33. plp
  34. bne small_bar
  35. asl
  36. bra normal_bar
  37. small_bar
  38. clc
  39. adc #36
  40. normal_bar
  41. sta bar_y
  42. lda bar_y
  43. cmp #224
  44. bne +
  45. lda #1
  46. +
  47. sta bar_y
  48. cmp #113
  49. bcs lower_half
  50. sta hdma_math
  51. lda #$01
  52. sta hdma_math+3
  53. bra math_cont
  54. lower_half
  55. clc
  56. sbc #110
  57. sta hdma_math+3
  58. lda #112
  59. sta hdma_math
  60. math_cont
  61. lda #$3e ; ch. 1-5
  62. sta @$420c ; trigger HDMA
  63. lda #$01
  64. sta isr_done
  65. rtl
  66. ; IRQ - called when triggered
  67. IRQ_ROUTINE:
  68. sep #$20 : .as
  69. lda $4211 ;Acknowledge irq
  70. rtl