atm959

header.inc

Sep 30th, 2016
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.00 KB | None | 0 0
  1. ;---------------------------------------------------------------------------------
  2. ; SNES ROM bank map
  3. ;---------------------------------------------------------------------------------
  4. ; Written by: Neviksti
  5. ; This is the standard include file I use for programming the main CPU processor
  6. ; with WLA. If anyone uses my code, please share your creations with me
  7. ; as I am always curious :)
  8. ;---------------------------------------------------------------------------------
  9.  
  10. ; == LoRom =========================
  11.  
  12. .MEMORYMAP ; Tell WLA that the SNES has ROM at locations ;$8000-$FFFF in every bank
  13. SLOTSIZE $8000 ; and that this area is $8000 bytes in size.
  14. DEFAULTSLOT 0 ; There is only a single slot in SNES, other consoles
  15. SLOT 0 $8000 ; may have more slots per bank.
  16. .ENDME
  17.  
  18. .ROMBANKSIZE $8000 ; Every ROM bank is 32 KBytes in size
  19. .ROMBANKS 8 ; 2Mbits -- Tells WLA that you want to use 8 ROM banks.
  20. .DEFINE HEADER_OFF $0000
  21. ; ===========================
  22.  
  23. ; == HiRom =========================
  24. ;
  25. ;.MEMORYMAP ; Tell WLA that the SNES has ROM at locations 0000-$FFFF in every bank
  26. ;SLOTSIZE $10000 ; and that this area is $10000 bytes in size.
  27. ;DEFAULTSLOT 0 ; There is only a single slot in SNES, other consoles
  28. ;SLOT 0 $0000 ; may have more slots per bank.
  29. ;.ENDME
  30. ;
  31. ;.ROMBANKSIZE $10000 ; Every ROM bank is 64 KBytes in size, also necessary.
  32. ;.ROMBANKS 32 ; 16Mbits -- Tells WLA that you want to use 32 ROM banks.
  33. ;.DEFINE HEADER_OFF $8000
  34. ; ===========================
  35.  
  36. ;-------------------------------------------------------------------------------
  37.  
  38. .BANK 0 SLOT 0 ; The SLOT 0 may be ommited, as SLOT 0 is the DEFAULTSLOT
  39. ; === Cartridge Header - part 1 - =====================
  40. .ORG $7FB0 + HEADER_OFF
  41. .DB "00" ; New Licensee Code
  42. .DB "SNES" ; ID
  43. .ORG $7FC0 + HEADER_OFF
  44. .DB "Test Program " ; Title (can't be more than 21 bytes, and should probably be a full 21 bytes)
  45. ; "123456789012345678901"
  46. .ORG $7FD5 + HEADER_OFF
  47. .DB $20 ; Memory Mode ( $20 = Slow LoRom, $21 = Slow HiRom )
  48.  
  49.  
  50. .BANK 0 SLOT 0
  51. ; === Cartridge Header - part 2 - =====================
  52. .ORG $7FD6 + HEADER_OFF
  53. .DB $00 ; Contents ( $00 = ROM only, $01 = ROM and RAM, $02 = ROM and Save RAM)
  54. .DB $08 ; ROM Size ( $08 = 2 Mbit, $09 = 4 Mbit, $0A = 8Mbit, $0B = 16Mbit ... etc )
  55. .DB $00 ; SRAM Size ( $00 = 0 bits, $01 = 16 kbits, $02 = 32 kbits, $03 = 64 kbits )
  56. .DB $01 ; Country ( $01 = USA )
  57. .DB $00 ; Licensee Code
  58. .DB $00 ; Version
  59. .DW $0000 ; Checksum Complement (not calculated ... but who cares?)
  60. .DW $0000 ; Checksum
  61.  
  62.  
  63. .BANK 0 SLOT 0
  64. ; === Interrupt Vector Table ====================
  65. .ORG $7FE4 + HEADER_OFF ; === Native Mode ===
  66. .DW EmptyHandler ; COP
  67. .DW EmptyHandler ; BRK
  68. .DW EmptyHandler ; ABORT
  69. .DW VBlank ; NMI
  70. .DW $0000 ; (Unused)
  71. .DW EmptyHandler ; IRQ
  72.  
  73. .ORG $7FF4 + HEADER_OFF ; === Emulation Mode ===
  74. .DW EmptyHandler ; COP
  75. .DW $0000 ; (Unused)
  76. .DW EmptyHandler ; ABORT
  77. .DW EmptyHandler ; NMI
  78. .DW Main ; RESET
  79. .DW EmptyHandler ; IRQ/BRK
  80.  
  81. ; ============================================
  82.  
  83.  
  84. .BANK 0 SLOT 0
  85. .org HEADER_OFF
  86. .SECTION "EmptyVectors" SEMIFREE
  87.  
  88. EmptyHandler:
  89. rti
  90.  
  91. EmptyVBlank:
  92. rep #30
  93. pha
  94. php
  95.  
  96. sep #$20
  97. lda $4210 ;clear NMI Flag
  98.  
  99. plp
  100. pla
  101. rti
  102.  
  103. .ENDS
  104.  
  105. .EMPTYFILL $FF
  106.  
  107.  
  108. ; --- Reminder to self: WLA doesn't seem to handle the .BASE directive
  109. ; correctly yet. I need to check into this
  110.  
  111. ;.BASE $40 ;SLOW HiRom
  112. ;.BASE $80 ;FAST LoRom
  113. ;.BASE $C0 ;FAST HiRom
Advertisement
Add Comment
Please, Sign In to add comment