Created
December 8, 2009 04:59
-
-
Save ddribin/251413 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.include "ines.h" | |
INesHeaderStart | |
INesPrgSizeInKilobytes 32 | |
INesChrSizeInKilobytes 8 | |
INesMapper = INesMapperNone | |
INesMirroring = INesMirroringHorizontal | |
INesHeaderEnd | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INesMirroringHorizontal = 0 | |
INesMirroringVertical = 1 | |
;; Some common mappers | |
INesMapperNone = 0 | |
INesMapperMMC1 = 1 | |
INesMapperUNROM = 2 | |
INesMapperCNROM = 3 | |
INesMapperMMC3 = 4 | |
INesMapperMMC5 = 5 | |
.macro INesPrgSizeInKilobytes size | |
.assert size > 0, error, "Size must be greater than zero" | |
.assert ((size & $f) = 0), error, "Size must be a multiple of 16k" | |
INesPrgSize = size / 16 | |
.endmacro | |
.macro INesChrSizeInKilobytes size | |
.assert size > 0, error, "Size must be greater than zero" | |
.assert ((size & $7) = 0), error, "Size must be a multiple of 8k" | |
INesChrSize = size / 8 | |
.endmacro | |
.macro INesHeaderStart | |
.pushseg | |
.segment "HEADER" | |
.endmacro | |
.macro INesHeaderEnd | |
;; iNES header identifier: "NES" + $1A. Don't use a string in case | |
;; a non-standard charmap is setup | |
.byte $4e, $45, $53, $1A | |
.byte INesPrgSize ; PRG code | |
.byte INesChrSize ; CHR data | |
.byte ((INesMapper & $0F) << 4) | INesMirroring | |
.byte (INesMapper & $F0) | |
;; Filler | |
.byte $00, $00, $00, $00 | |
.byte $00, $00, $00, $00 | |
.popseg | |
.endmacro | |
; Local Variables: | |
; mode: asm | |
; End: | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment