Skip to content

Instantly share code, notes, and snippets.

@nicholatian
Last active November 25, 2015 01:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicholatian/965f032f9ed6842c232b to your computer and use it in GitHub Desktop.
Save nicholatian/965f032f9ed6842c232b to your computer and use it in GitHub Desktop.
extMeta ROM Metadata Assembly
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@ Standard GBA ROM Hack Metadata @@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@ Copyright (C) 2015 Alexander Nicholi @@@@@@@@@@@@@@@@
@@@@@@@@@@ Released under the GNU General Public License v2 @@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@ @@
@@ Welcome! @@
@@ @@
@@ This is the assembly for the metadata block read by Lapis and @@
@@ Sapphire, and by other tools who opt to use it. For you, it @@
@@ provides basic information about your hack to all of the apps you @@
@@ use on a daily basis. It holds the full name of your hack, its @@
@@ real ROM base (so you may lock your ROM and not confuse apps), @@
@@ your name as the author, a timestamp showing when you released @@
@@ the version the ROM contains, as well as an alpha/beta/gamma plus @@
@@ major/minor/patch version counter. Optionally, you have the @@
@@ ability to purpose and partition the free space available in your @@
@@ ROM using a 16-slot miniature partition table. This may prove @@
@@ useful if you lose data or wish to provide RE abilities to others @@
@@ who wish to make cheat codes, or hack the game themselves, for @@
@@ instance. @@
@@ @@
@@ "That's great! So... how do I use it?" @@
@@ @@
@@ Since this is the manual version, contained in an actual assembly @@
@@ code file, you'll need to edit the pool of aliases at the top of @@
@@ this file, assemble it, insert it at offset 0xFFF000, and you're @@
@@ done. That's about it. :p @@
@@ @@
@@ I hope you like this little mini-project I created, and use it @@
@@ for all the flavour it provides. @@
@@ @@
@@ --Alexander Nicholi @@
@@ @@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.text
.set VersionStage, 'A' @ 'A' signifies alpha
@ 'B' signifies beta
@ 'G' signifies gamma (final)
.set VersionMajor, 0 @ Maximum value of 65535
.set VersionMinor, 0 @ Maximum value of 65535
.set VersionPatch, 0 @ Maximum value of 4294967295
.set ROMLangCode, 'E' @ 'D' signifies German
@ 'E' signifies English
@ 'F' signifies French
@ 'I' signifies Italian
@ 'J' signifies Japanese
@ 'S' signifies Spanish
.set ReleaseTimestamp, 0 @ Must be a UNIX timestamp
@ http://www.timestampgenerator.com
.set MapBankCount, 0 @
@@@@@ EDITING THE PARTITION TABLE:
@
@ Go to line 93 and edit the names and offsets in the partition slots.
@ Some rules to follow:
@ - Partition name must be 4 letters or less
@ - Start and end values are OFFSETS, not addresses.
@@@@@ EDITING THE HACK NAME, AUTHOR NAME, AND BASE GAME CODE
@
@ Unfortunately our trained monkeys aren't smart enough to figure out
@ how to .set string literals, so you'll just have to search for
@ comments starting with 3 '@'s for those values. You can't miss them,
@ trust us.
@@@@@@@@@@@@@@@@@@@@@@@
@ HERE BE BOILERPLATE @
@@@@@@@@@@@@@@@@@@@@@@@
.macro pasciz input, max
1:
.asciz "\input"
2:
.iflt \max - (2b - 1b)
.error "String too long"
.endif
.ifge \max - (2b - 1b)
.zero \max - (2b - 1b)
.endif
.endm
.macro partition name, start, end
1:
.ascii "\name"
2:
.ifge 4 - (2b - 1b)
.zero 4 - (2b - 1b)
.endif
3:
.word \start
4:
.word \end
.endm
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Real data assembly below @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.align 2
meta_version:
.hword 1
version_stage:
.byte VersionStage
.zero 1
version_major:
.hword VersionMajor
version_minor:
.hword VersionMinor
version_patch:
.word VersionPatch
rom_base:
@@@ BASE GAME CODE GOES HERE, MUST BE EXACTLY 3 CHARS
.ascii "000"
.byte ROMLangCode
name:
@@@ HACK NAME GOES HERE, MAXIMUM 31 CHARS NOT INCLUDING '\0'
pasciz "?", 32
author:
@@@ AUTHOR NAME GOES HERE, MAXIMUM 31 CHARS NOT INCLUDING '\0'
pasciz "?", 32
release_time:
.word ReleaseTimestamp
/* Free Space Partition Table */
partition_table: @ 16-slot purposed partitions for hack data
@ NAME START END
partition "", 0x0000000, 0x0000000
partition "", 0x0000000, 0x0000000
partition "", 0x0000000, 0x0000000
partition "", 0x0000000, 0x0000000
partition "", 0x0000000, 0x0000000
partition "", 0x0000000, 0x0000000
partition "", 0x0000000, 0x0000000
partition "", 0x0000000, 0x0000000
partition "", 0x0000000, 0x0000000
partition "", 0x0000000, 0x0000000
partition "", 0x0000000, 0x0000000
partition "", 0x0000000, 0x0000000
partition "", 0x0000000, 0x0000000
partition "", 0x0000000, 0x0000000
partition "", 0x0000000, 0x0000000
partition "", 0x0000000, 0x0000000
/* Scripting-related data */
script_stub_cut: @ Address to PokeScript code executing Cut
.byte 0x5
.word 0x8000000
script_stub_rsmash: @ Address to PokeScript code executing Rock Smash
.byte 0x5
.word 0x8000000
script_stub_strength: @ Address to PokeScript code executing Strength
.byte 0x5
.word 0x8000000
script_stub_surf: @ Address to PokeScript code executing Surf
.byte 0x5
.word 0x8000000
script_stub_pokecenter: @ Address to PKS code that runs Nurse Joy
.byte 0x5
.word 0x8000000
script_stub_custom1:
.byte 0x5
.word 0x8000000
script_stub_custom2:
.byte 0x5
.word 0x8000000
script_stub_custom3:
.byte 0x5
.word 0x8000000
/* Mapping-related data */
map_bank_count:
.byte MapBankCount
map_banks_lengths:
.byte 0
.byte 0
.byte 0
.byte 0
.byte 0
.zero 122 @ be sure to adjust this to 127 - the number of .byte
@ directives you have
map_blockset_lengths:
.byte 0
.byte 0
.byte 0
.byte 0
.byte 0
.zero 123 @ be sure to adjust this to 128 - the number of .byte
@ directives you have
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment