irqtest.asm 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. ;============================================================================
  2. ; Includes
  3. ;============================================================================
  4. ;== Include MemoryMap, Vector Table, and HeaderInfo ==
  5. .INCLUDE "header.inc"
  6. ;== Include SNES Initialization routines ==
  7. .INCLUDE "init.inc"
  8. .INCLUDE "LoadGraphics.asm"
  9. .INCLUDE "debug.asm"
  10. ;============================================================================
  11. ; Main Code
  12. ;============================================================================
  13. .EQU PalNum $0000 ; Use some RAM
  14. .BANK 0 SLOT 0
  15. .ORG 0
  16. .SECTION "MainCode"
  17. Start:
  18. InitSNES ; Clear registers, etc.
  19. ; Load Palette for our tiles
  20. LoadPalette OptixxPalette, 0, 16
  21. ; Load Tile data to VRAM
  22. ;LoadBlockToVRAM TilesData, $0000, $0020 ; 2 tiles, 2bpp, = 32 bytes
  23. ;LoadBlockToVRAM OptixxData, $0000, 0xa00 ; 160 tiles, 2bpp, = 2560 bytes
  24. ;LoadBlockToVRAM OptixxData, $0000, 0x1e00 ; 480 tiles, 2bpp, = 7680 bytes
  25. LoadBlockToVRAM OptixxData, $0000, 0x3c00 ; 960 tiles, 2bpp, = 15360 bytes
  26. lda #$80
  27. sta $2115
  28. ;ldx #$0800 ; 5AF
  29. ldx #$4000 ; 5AF
  30. stx $2116
  31. ldx #$0
  32. Start_do:
  33. stx $2118
  34. inx
  35. cpx #960
  36. bne Start_do
  37. ; Setup Video modes and other stuff, then turn on the screen
  38. jsr SetupVideo
  39. lda #$00
  40. sta $4200
  41. rep #$31
  42. Infinity:
  43. ; lda.b PalNum
  44. ; clc
  45. ; adc.w #$01
  46. ; and.w #$ffff ; If > palette starting color > 24 (00011100), make 0
  47. ; sta.b PalNum
  48. inc.b PalNum
  49. jmp Infinity ; bwa hahahahaha
  50. ;============================================================================
  51. ; SetupVideo -- Sets up the video mode and tile-related registers
  52. ;----------------------------------------------------------------------------
  53. ; In: None
  54. ;----------------------------------------------------------------------------
  55. ; Out: None
  56. ;----------------------------------------------------------------------------
  57. SetupVideo:
  58. php
  59. lda #$00
  60. sta $2105 ; Set Video mode 0, 8x8 tiles, 4 color BG1/BG2/BG3/BG4
  61. ;lda #$08 ; Set BG1's Tile Map offset to $0800 (Word address)
  62. lda #$40 ; Set BG1's Tile Map offset to $2000 (Word address)
  63. sta $2107 ; And the Tile Map size to 32x32
  64. stz $210B ; Set BG1's Character VRAM offset to $0000 (word address)
  65. lda #$01 ; Enable BG1
  66. sta $212C
  67. lda #$FF
  68. sta $210E
  69. sta $210E
  70. lda #$0F
  71. sta $2100 ; Turn on screen, full Brightness
  72. plp
  73. rts
  74. ;.ENDS
  75. ;.SECTION "IRQHandlers"
  76. COPHandler:
  77. rti
  78. BRKHandler:
  79. rti
  80. ABRTHandler:
  81. rti
  82. NMIHandler:
  83. rti
  84. IRQHandler:
  85. ;pha
  86. ;php
  87. ;rep #$31
  88. lda PalNum
  89. ;sep #$20
  90. stz $2121
  91. ;sta.w $2122
  92. ;xba
  93. sta $2122
  94. sta $2122
  95. ; lda.w $4211
  96. ; lda #65
  97. ; sta $3000
  98. ;idle:
  99. ; lda $3001
  100. ; rep #$31
  101. plp
  102. pla
  103. rti
  104. str_COP:
  105. .db "COP",10,0
  106. str_ABORT:
  107. .db "ABORT",10,0
  108. str_NMI:
  109. .db "NMI",10,0
  110. str_RESET:
  111. .db "RESET",10,0
  112. str_IRQBRK:
  113. .db "IRQBRK",10,0
  114. ;============================================================================
  115. .ENDS
  116. ;============================================================================
  117. ; Character Data
  118. ;============================================================================
  119. .BANK 0 SLOT 0
  120. .SECTION "CharacterData02"
  121. .INCLUDE "optixx.inc"
  122. .ENDS