nes-mm5-demo/asm/crt0.asm

103 lines
2.0 KiB
NASM
Raw Normal View History

2022-02-03 20:11:55 +00:00
;****************
; Author: Safyrus
;****************
.ifdef C_CODE
.export _exit,__STARTUP__:absolute=1
.import _main
.endif
; Header of the file (not part of the cartridge, used by the emulator)
.segment "HEADER"
.byte "NES", $1A; 0-3: Header
.byte $02 ; 4: PRG ROM
.byte $01 ; 5: CHR ROM
.if MMC5=1
.byte $51 ; 6: Flags 6
.else
2022-02-03 20:11:55 +00:00
.byte $01 ; 6: Flags 6
.endif
2022-02-03 20:11:55 +00:00
.byte $00 ; 7: Flags 7
.byte $00 ; 8: Flags 8
.byte $00 ; 9: Flags 9
.byte $00 ; 10: Flags 10
.byte $00,$00,$00,$00,$00 ; Padding
.include "constant.asm"
.include "macro.asm"
.include "memory.asm"
; This is the code to use when using the MMC5 mapper
.if MMC5=1
.segment "LAST_BNK"
; 6502 vectors subrountines
.include "vector/rst.asm"
.include "vector/nmi.asm"
.include "vector/irq.asm"
2022-02-03 20:11:55 +00:00
.if FAMISTUDIO=1
; FamiStudio Sound Engine
.include "audio/famistudio_config.asm"
.include "audio/famistudio_ca65.s"
.endif
2022-02-03 20:11:55 +00:00
.segment "STARTUP"
.ifdef C_CODE
_exit:
.endif
.ifndef C_CODE
; main file
.include "main.asm"
.endif
.segment "BNK1"
.if FAMISTUDIO=1
; Musics
.include "audio/music/arpeggio_mmc5.s"
.endif
; This is the code to use when not using any mapper
.else
.segment "STARTUP"
.ifdef C_CODE
_exit:
.endif
; 6502 vectors subrountines
.include "vector/rst.asm"
.include "vector/nmi.asm"
.include "vector/irq.asm"
.ifndef C_CODE
; main file
.include "main.asm"
.endif
2022-02-03 20:11:55 +00:00
.if FAMISTUDIO=1
; FamiStudio Sound Engine
.include "audio/famistudio_config.asm"
.include "audio/famistudio_ca65.s"
2022-02-03 20:11:55 +00:00
; Musics
.include "audio/music/arpeggio.s"
2022-02-03 20:11:55 +00:00
.endif
2022-02-03 20:11:55 +00:00
.endif
; 6502 vectors
.segment "VECTORS"
; 6502 vectors
.word NMI ; fffa nmi/vblank
.word RST ; fffc reset
.word IRQ ; fffe irq/brk
; CHR ROM data
.segment "CHARS"
.incbin GAME_CHR