vram2.asm 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. ;============================================================================
  10. ; Main Code
  11. ;============================================================================
  12. .BANK 0 SLOT 0
  13. .ORG 0
  14. .SECTION "MainCode"
  15. Start:
  16. InitSNES ; Clear registers, etc.
  17. ; Load Palette for our tiles
  18. LoadPalette OptixxPalette, 0, 16
  19. ; Load Tile data to VRAM
  20. ;LoadBlockToVRAM TilesData, $0000, $0020 ; 2 tiles, 2bpp, = 32 bytes
  21. ;LoadBlockToVRAM OptixxData, $0000, 0xa00 ; 160 tiles, 2bpp, = 2560 bytes
  22. ;LoadBlockToVRAM OptixxData, $0000, 0x1e00 ; 480 tiles, 2bpp, = 7680 bytes
  23. LoadBlockToVRAM OptixxData, $0000, 0x3c00 ; 960 tiles, 2bpp, = 15360 bytes
  24. lda #$80
  25. sta $2115
  26. ;ldx #$0800 ; 5AF
  27. ldx #$4000 ; 5AF
  28. stx $2116
  29. ldx #$0
  30. Start_do:
  31. stx $2118
  32. inx
  33. cpx #960
  34. bne Start_do
  35. ; Setup Video modes and other stuff, then turn on the screen
  36. jsr SetupVideo
  37. Infinity:
  38. jmp Infinity ; bwa hahahahaha
  39. ;============================================================================
  40. ; SetupVideo -- Sets up the video mode and tile-related registers
  41. ;----------------------------------------------------------------------------
  42. ; In: None
  43. ;----------------------------------------------------------------------------
  44. ; Out: None
  45. ;----------------------------------------------------------------------------
  46. SetupVideo:
  47. php
  48. lda #$00
  49. sta $2105 ; Set Video mode 0, 8x8 tiles, 4 color BG1/BG2/BG3/BG4
  50. ;lda #$08 ; Set BG1's Tile Map offset to $0800 (Word address)
  51. lda #$40 ; Set BG1's Tile Map offset to $2000 (Word address)
  52. sta $2107 ; And the Tile Map size to 32x32
  53. stz $210B ; Set BG1's Character VRAM offset to $0000 (word address)
  54. lda #$01 ; Enable BG1
  55. sta $212C
  56. lda #$FF
  57. sta $210E
  58. sta $210E
  59. lda #$0F
  60. sta $2100 ; Turn on screen, full Brightness
  61. plp
  62. rts
  63. ;============================================================================
  64. .ENDS
  65. ;============================================================================
  66. ; Character Data
  67. ;============================================================================
  68. .BANK 0 SLOT 0
  69. .SECTION "CharacterData02"
  70. .INCLUDE "optixx.inc"
  71. .ENDS