Skip to content

Instantly share code, notes, and snippets.

@nicholatian
Last active November 23, 2015 06:43
Show Gist options
  • Save nicholatian/38700fdd6578f9c464d2 to your computer and use it in GitHub Desktop.
Save nicholatian/38700fdd6578f9c464d2 to your computer and use it in GitHub Desktop.
GBA ROM Hack Extended 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 0x8FFF000, 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
@ Common ROM bases:
@ - BPE (Pokemon Emerald)
@ - BPR (Pokemon FireRed)
@ - AXV (Pokemon Ruby)
@ - B24 (PMD: Red Rescue Team)
.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
@@@@@ 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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment