;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Patch written by CloudMax
;This patch is for TLoZ: Ocarina of Time Master Quest Debug ROM
;
;It will make a few minor changes to the games code to allow 
;setting up all the RGB colors of the A, B, C and Start buttons
;on the Interface individually.
;
;The colors are set to the ones used in Majora's Mask.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Check if ROM ID or Version is Incorrect
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;We look up the ID and Version number of the ROM.
;If the ROM ID & Version isn't 0x4E5A4C450F or 0x435A4C450F 
;an alert will appear, and the patch is aborted.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
var,romID,([0x3B]*0x100)+([0x3C]&0xFF)
con,patchable,!({romID}==0x4E5A4C450F||{romID}==0x435A4C450F)
alert,The provided ROM has an incorrect ID or Version.
abort
endCon,patchable
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Set up variables
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;First we set variable dma to the address of the dma table.
;Then we take that and add 0x10 multiplied by the code.zasm 
;entry ID in the table, which is 28.
;We set variable code to the pointer at that address.
;We set variable codeRAMtoROM to code subtracted by the offset 
;of code.zasm when it is loaded into RAM so that we can convert
;RAM addresses to ROM addresses.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
var,dma,0x12F70
var,code,[{dma}+0x10*28]
var,codeRAMtoROM,{code}-0x8001CE60
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Patch
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;A Button Red (0x64)              RR
{codeRAMtoROM}+0x80110F3C, 240E 0064 A5AE 0AC0
;A Button Green (0xC8)            GG
{codeRAMtoROM}+0x80110F08, 240F 00C8
;A Button Blue (0xFF)             BB
{codeRAMtoROM}+0x80110F1C, 2419 00FF
;B Button Red (0x64)              RR
{codeRAMtoROM}+0x80110EE8, 240E 0064
;B Button Green (0xFF)            GG
{codeRAMtoROM}+0x80110EF4, 2403 00FF
;B Button Blue (0x78)             BB
{codeRAMtoROM}+0x80110F10, 2419 0078 A719 06EE
;C Button Red (0xFF)              RR
{codeRAMtoROM}+0x801110E8, 240D 00FF
;C Button Green (0xFF)            GG
{codeRAMtoROM}+0x80111494, 2418 00FF
;C Button Blue (0x00)             BB
{codeRAMtoROM}+0x801114B4, 240E 0000 A72E 07E6
;S Button RGB (0xFF,0x82,0x3C)  RRGG      BB
{codeRAMtoROM}+0x80089180, 3C01 FF82 3421 3C00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;