Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- hirom
- ; header
- ; Regular Magic Gogo v1.0
- ;
- ; This patch adjusts some SRAM locations such that Gogo
- ; has a regular magic list and is able to learn spells
- ; from espers. It will be incompatible as-is with patches
- ; that affect:
- ;
- ; *Morph (now at $1E3A)
- ; *SwdTech (now at $1E3B)
- ; *Blitz (now at $1E3C)
- ; *Lores (now at $1E3D-$1E3F)
- ;
- ; as it adjusts the location-in-SRAM where information
- ; about them is stored. [DEPRECATED: It also uses 6 bytes at the end
- ; of the treasure chest bytes; only the first 33 are known
- ; to be used, so this shouldn't affect the vanilla game,
- ; but it limits any hacks to 42, rather than 48, treasure
- ; chest bytes.]
- ;
- ; If you need information on compatibility, feel free to
- ; drop me a line via email (in.the.afterlight@gmail.com)
- ; or via PM at ff6hacking.com (where I am known as
- ; GrayShadows). Patches with available .asm files should
- ; be relatively easy to render compatible; patches without
- ; sufficient documentation are more problematic, but not
- ; impossible, to make cooperative.
- ;
- ; NB: This is a specialised version of the mod that uses
- ; theoretically unused SRAM space immediately preceding the
- ; treasure chest bytes, coded specifically for Gi Nattak at
- ; ff6hacking.com. It should be fine to use with other mods,
- ; and in fact moves around fewer things, but there may be
- ; some issues with compatibility if it turns out the RAM space
- ; isn't as unused as is theorised. The goal of this version
- ; is to preserve all existing treasure chest bytes, so that
- ; they are usable in hacks with additional chests.
- ; Section 1: Moving RAM locations
- ; 1.1 Initialising RAM at New Game
- org $C0BB1A
- STZ $1E3A,X ; Part of the function that zeroes Treasure Chest
- INX ; bytes at game start. Expands to include six
- CPX #$0036 ; additional bytes, which cover new Morph/SwdTech/
- ; Blitz/Lore locations.
- org $C0BDD2
- CPX #$02DF ; Part of a function that governs zeroing
- ; starting magic lists. This bundles the
- ; new magic list, as well as a few additional
- ; bytes (including learned Rages and Dances)
- ; in to the same function, saving a few bytes
- ; that could potentially used in other patches.
- org $C0BDD7
- JSR $BB18 ; Closes treasure chests and zeroes moved SRAM
- ; bytes. Needs to be moved or it will overwrite
- ; the new Lore bytes.
- rep 23 : NOP ; Space cleared by consolidating functions.
- org $C0BE17
- LDA $E6F564 ; Initialises Strago's known lores at recruit.
- STA $1E3A ; Strago's known lores, byte 1
- LDA $E6F565
- STA $1E3B ; Strago's known lores, byte 2
- LDA $E6F566
- STA $1E3C ; Strago's known lores, byte 3
- org $C0BE8D
- rep 3 : NOP ; Originally a call to C0/BB18; we've moved that
- ; earlier in the code, so we can skip over it here.
- ; 1.2 SwdTech
- org $C0A1F6 ; Teaches SwdTech at recruit.
- LDA $1E3B
- org $C0A1FD ; Teaches SwdTech at recruit.
- STA $1E3B
- org $C0AFFA ; Teaches all SwdTech (gen. act. 8F)
- STA $1E3B
- org $C2580D
- LDA $1E3B
- org $C261D0
- TSB $1E3B
- org $C3537A
- LDA $1E3B
- ; 1.3 Blitzes
- org $C0A21D ; Teaches Blitz at recruit.
- LDA $1E3C
- org $C0A224 ; Teaches Blitz at recruit.
- STA $1E3C
- org $C0B002 ; Teaches Bum Rush (gen. act. 90)
- LDA $1E3C
- org $C0B007 ; Teaches Bum Rush (gen. act. 90)
- STA $1E3C
- org $C20576
- LDA $1E3C
- org $C24E07
- BIT $1E3C
- org $C25818
- LDA $1E3C
- org $C261EC
- TSB $1E3C
- org $C3561B
- LDA $1E3C
- ; 1.4 Morph
- org $C20559
- CMP $1E3A
- org $C20B1B
- LDX $1E3A
- org $C20B3B
- LDA $1E3A
- org $C20B46
- LDA $1E3A
- org $C25328
- CMP $1E3A ; Allows/disallows Morph menu slot
- org $C25424
- STA $1E3A ; Part of function that sets Morph timer to full.
- ; Commented out for compatibility with Hatzen's Resilient Morph
- ; org $C25E3F
- ; ADC $1E3A
- ; org $C25E46
- ; STA $1E3A
- ; 1.5 Lores
- org $C236FD
- BIT $1E3D,X
- org $C2556F
- BIT $1E3D,X
- org $C25ED0
- ORA $1E3D,X
- STA $1E3D,X
- org $C3521C
- LDA $1E3D,X
- ; Section 2: Teaching Gogo Magic
- org $C2558C
- CMP #$0E ; Branches for Umaro and above rather than Gogo and up.
- org $C25E5C
- CMP #$0E ; Branches if Umaro, rather than Umaro and/or Gogo
- org $C256CC
- CMP #$0E ; Umaro branches to Gogo's former branch (Y = 0),
- ; and then temporary characters will branch (Y = 2).
- org $C25EB2
- CMP #$0E ; Branches if Umaro so that spells aren't learned.
- ; Section 3: Gogo in the Menu
- org $C34D6F
- CMP #$0E ; This was originally a check for Gogo to disable
- ; the Espers option in the Skills menu. This increments
- ; by 1 to disable for Umaro instead.
- org $C30D3F
- CMP #$0E ; BEQ Umaro, BCS temp character.
- org $C350AA
- CMP #$0E ; BEQ Umaro, to build magic list from spells known
- ; by other characters.
- ; Bypasses Gogo's custom status menu code by altering the targets of a BRA
- ; and three JSR
- ;org $c32249 ; [BRA]
- ;db $09
- ;
- ;org $c31C50 ; [JSR]
- ;db $78
- ;
- ;org $c32219 ; [JSR]
- ;db $78
- ;
- ;org $c3223F ; [JSR]
- ;db $78
- ; Section 4: Compatibility
- ; 4.1: Hatzen's Resilient Morph
- org $C25E3C
- LDA #$FF
- STA $1E3A
- BRA MorphExitOne
- LSR $F1
- ROR $F0
- RTS
- NOP
- MorphExitOne:
- org $C20D00
- BCC MorphBra1
- LDA $3AA1,Y
- BIT #$02
- BEQ MorphBra2
- JSR $5E43
- MorphBra2:
- BIT #$20
- BEQ MorphBra1
- JSR $5E43
- MorphBra1:
- LDA $3EF9,Y
- BIT #$08
- BEQ MorphExit2
- LDA $F1
- BMI MorphExit2
- ASL $F0
- ROL $F1
- MorphExit2:
- ; 4.2 Natural Ability Learning Expansion
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; SKILLS LEARNED AT LEVEL UP
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; This points to the function governing learning abilities at
- ; level up, originally at C2/61B6 and now at C2/A736.
- org $C260BC
- JSR $A736
- ; Determine if the character learns natural magic at level up.
- org $C2A736
- LDX #$0000 ; Relm's spell list is the first two bytes
- ; of the natural magic table now located at
- ; EC/E3A0. In vanilla, this starts at EC/E3C0
- ; with Terra's table; Relm's occupies two bytes
- ; of free space preceding.
- CMP #$04 ;
- BEQ LvlUpMagic ; Branches to teach natural magic.
- LDX #$0020 ; Terra's spell list is second in the table.
- CMP #$00 ;
- BEQ LvlUpMagic ;
- LDX #$0040 ; Celes' spell list is third.
- CMP #$06 ;
- BEQ LvlUpMagic ;
- LDX #$0000 ; Cyan's SwdTech list is the first eight bytes
- ; of the SwdTech/Blitz table at E6/F490
- CMP #$02 ;
- BNE LvlUpSabin ; If not Cyan, branch to check for Sabin.
- ; Else, it is Cyan and the code can continue
- ; to check his level.
- ;;;;;;;;;;;;;;;;;;
- ; Cyan @ level up
- ;;;;;;;;;;;;;;;;;;
- JSR LvlAbility ; Check for SwdTechs at this level.
- BEQ ExitLearning ; If none, exit.
- TSB $1E3B ; Enable the new SwdTech.
- BNE ExitLearning ; If already enabled, exit.
- ; This should only occur after Cyan's dream,
- ; which teaches him SwdTechs through an event.
- LDA #$40
- TSB $F0
- BNE ExitLearning
- LDA #$42
- JMP $5FD4
- ;;;;;;;;;;;;;;;;;;
- ; Sabin @ level up
- ;;;;;;;;;;;;;;;;;;
- LvlUpSabin:
- LDX #$0008 ; Blitzes are in the second byte of the table.
- CMP #$05 ; Check for Sabin.
- BNE ExitLearning ; Exit if not Sabin.
- JSR LvlAbility ; Check for Blitzes at this level.
- BEQ ExitLearning ; If none, exist.
- TSB $1E3C ; Enable the new Blitz.
- BNE ExitLearning ; If already enabled, exit.
- ; This should only occur with Bum Rush, after
- ; meeting Duncan in the WoR.
- LDA #$80
- TSB $F0
- BNE ExitLearning
- LDA #$33
- JMP $5FD4
- ;;;;;;;;;;;;;;;;;;
- ; Magic @ level up
- ;;;;;;;;;;;;;;;;;;
- LvlUpMagic:
- PHY
- XBA
- LDY #$0010 ; The spell list is composed of 16 2-byte
- ; blocks for a total of 32 bytes.
- LvlCheckMag:
- CMP $ECE3A1,X ; Check against level at which spell is learned
- BNE IncSpell ; If no spell at this level, branch and
- ; increment to next spell in table.
- PHA
- PHY
- TDC ; [Clear 16-bit A]
- LDA $ECE3A0,X ; Get the spell ID from the table.
- TAY
- LDA ($F4),Y ; [(?? check entry in spell list ??)]
- CMP #$FF
- BEQ PullYA
- LDA #$80
- STA ($F4),Y
- PullYA:
- PLY
- PLA
- IncSpell: ; Increment to next 2-byte block.
- INX
- INX
- DEY ; Decrement Y
- BNE LvlCheckMag ; If we haven't checked all 32 bytes,
- ; branch back and continue.
- PLY
- RTS
- ;;;;;;;;;;;;;;;;;;
- ; Abilities/lvl up
- ;;;;;;;;;;;;;;;;;;
- LvlAbility:
- LDA #$01
- STA $EE ; Start by marking Tech/Blitz as #0
- XBA ; [Get current level from top of A?]
- LvlCheckAbi: ;
- CMP $E6F490,X ; Check level against Blitz/Tech table.
- BEQ AbiBitfield ; If equal, branch.
- INX ; Else, increment to check next index.
- ASL $EE ; Check next Tech against level.
- BCC LvlCheckAbi ; If carry is set, we've checked all 8 bits and
- ; no ability is learned. $EE will be #0.
- AbiBitfield:
- LDA $EE ; Get the SwdTech/Blitz bitfield. The bit that
- ; is set = the ability to learn at this level.
- ExitLearning:
- RTS
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; DEFAULT SKILLS AT RECRUITMENT
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; This section governs natural abilities learned at
- ; recruitment
- ;;;;;;;;;;;;;;;;;;
- ; DEFAULT DANCES
- ;;;;;;;;;;;;;;;;;;
- ; This sets default dances learned at the same time as default
- ; lores and rages. Rather than pulling the information from
- ; elsewhere in the rom, the bit is hardcoded in with an LDA
- ; to keep the code in-line.
- ;
- ; Originally I was teaching dances at recruitment the same way
- ; that Cyan and Sabin learn their initial SwdTechs and Blitzes.
- ; However, because they learn their skills through level up,
- ; they require more complex code to verify which skills they
- ; should already have when you meet them. This new code teaches
- ; Wind Song by default in the same way that Strago and Gau learn
- ; their default Lores and Rages, respectively.
- org $C0BE2F ; Originally this is used to set font to white.
- ; As this is also in C3, it's unnecessary here, and
- ; so we can use these addresses for teaching Dances.
- ; It follows immediately after the code teaching
- ; the default Lores.
- STA $1D4C ; Stores bits in location of learned Dances in RAM
- NOP ; The original code here is six bytes long.
- ; As the new code is only five, this blocks out the
- ; remaining byte preventing any further snarls.
- ;;;;;;;;;;;;;;;;;;
- ; NATURAL SKILLS
- ; AT RECRUITMENT
- ;;;;;;;;;;;;;;;;;;
- ; These originally called C0/A17F and are being redirected
- ; to the new location of the subroutine at C0/D68D.
- org $C09F6D
- JSR $D68D
- org $C0A177
- JSR $D68D
- org $C0C547
- JSR $D68D
- ; When recruiting a character, check if they learn abilities
- ; based on their level. If so, teach them all abilities up to
- ; their current level.
- org $C0D68D
- ;;;;;;;;;;;;;;;;;;
- LDA $1600,Y ; Grab the ID of the character being recruited.
- CMP #$04 ;
- BEQ RelmRecruit ; If Relm, branch.
- CMP #$00 ;
- BEQ TerraRecruit ; If Terra, branch.
- CMP #$06 ;
- BEQ CelesRecruit ; If Celes, branch.
- CMP #$02 ;
- BEQ CyanRecruit ; If Cyan, branch.
- CMP #$05 ;
- BNE ExitRecruit ; If not Sabin, exit.
- JMP SabinRecruit ; Else it is Sabin, so jump.
- ; Sabin's recruitment subroutine is to far away
- ; to branch, so we need to jump to it instead.
- ExitRecruit:
- RTS
- RelmRecruit:
- LDX $00
- TeachRelm:
- LDA $ECE3A1,X ; Get level from natural magic table.
- CMP $1608,Y ; Check against current level.
- BEQ RelmRecCont ; If equal, proceed to learn spell.
- BCS ExitRecruit ; If lower, exit.
- RelmRecCont:
- PHY
- LDA $ECE3A0,X ; Grab the spell learned at this level.
- TAY
- LDA #$FF
- STA $1C1E,Y ; Teach it.
- PLY
- INX
- INX
- CPX #$0020 ; Have we checked all 16 spells?
- BEQ ExitRecruit ; If yes, exit.
- BRA TeachRelm ; Else, continue checking.
- TerraRecruit:
- LDX $00
- TeachTerra:
- LDA $ECE3C1,X ; Get level from natural magic table.
- CMP $1608,Y ; Check against current level.
- BEQ TerraRecCont ; If equal, proceed to learn spell.
- BCS ExitRecruit ; If lower, exit
- TerraRecCont:
- PHY
- LDA $ECE3C0,X ; Grab the spell learned at this level
- TAY
- LDA #$FF
- STA $1A6E,Y ; Teach it
- PLY
- INX
- INX
- CPX #$0020 ; Have we checked all 16 spells?
- BEQ ExitRecruit ; If so, exit.
- BRA TeachTerra ; Else, continue checking.
- CelesRecruit:
- LDX $00
- TeachCeles:
- LDA $ECE3E1,X ; Get level from natural magic table.
- CMP $1608,Y ; Check against current level.
- BEQ CelesRecCont ; If equal, proceed to learn spell.
- BCS ExitRecruit ; If lower, exit
- CelesRecCont:
- PHY
- LDA $ECE3E0,X ; Grab the spell learned at this level
- TAY
- LDA #$FF
- STA $1BB2,Y ; Teach it
- PLY
- INX
- INX
- CPX #$0020 ; Have we checked all 16 spells?
- BEQ ExitRecruit ; If so, exit
- BRA TeachCeles ; Else, continue checking
- CyanRecruit:
- STZ $1B
- LDX $00
- TeachCyan:
- LDA $E6F490,X ; Get level at which Tech is learned
- CMP $1608,Y ; Is Cyan at that level?
- BEQ CyanRecCont ; If so, proceed with learning
- BCS SetCyan ; If he is lower, exit and teach Techs.
- CyanRecCont:
- INC $1B
- INX
- CPX #$0008 ; Have we checked all eight Techs?
- BEQ SetCyan ; If so, exit
- BRA TeachCyan ; Else, continue checking
- SetCyan:
- LDA $1B
- TAX
- LDA $1E3B ; Get currently known Techs
- ORA $C0A22C,X ; Add to bitfield of Techs learned at level
- STA $1E3B ; Set new Blitzes learned
- RTS
- SabinRecruit:
- STZ $1B
- LDX $00
- TeachSabin:
- LDA $E6F498,X ; Get level at which Blitz is learned
- CMP $1608,Y ; Is Sabin at that level?
- BEQ SabinRecCont ; If so, proceed with learning
- BCS SetSabin ; If he is lower, exit and teach Blitzes.
- SabinRecCont:
- INC $1B
- INX
- CPX #$0008 ; Have we checked all eight blitzes?
- BEQ SetSabin ; If so, exit
- BRA TeachSabin ; Else, continue checking
- SetSabin:
- LDA $1B
- TAX
- LDA $1E3C ; Get currently known Blitzes
- ORA $C0A22C,X ; Add to bitfield of Blitzes learned at level
- STA $1E3C ; Set new Blitzes learned
- RTS
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; NATURAL MAGIC
- ; TABLES
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; Relm's natural magic learning list.
- ; This precedes Celes and Terra's lists in the table,
- ; occupying free space right before it.
- org $ECE3A0
- DB $2D, $01 ; Cure @ 1
- DB $34, $03 ; Regen @ 3
- DB $00, $07 ; Fire @ 7
- DB $19, $0B ; Slow @ 11
- DB $30, $0F ; Life @ 15
- DB $04, $14 ; Fire 2 @ 20
- DB $29, $19 ; Osmose @ 25
- DB $0E, $1E ; Gust @ 30
- DB $2E, $23 ; Cure 2 @ 35
- DB $08, $28 ; Fire 3 @ 40
- DB $16, $2D ; Cyclon @ 45
- DB $28, $33 ; Slow 2 @ 51
- DB $0F, $39 ; Flare @ 57
- DB $31, $3E ; Life 2 @ 63
- DB $10, $45 ; Scorch @ 69
- DB $35, $4B ; Life 3 @ 75
- ; Adjusts Celes's list slightly.
- ; This fixes a glitch if she averages to a level above 32 that
- ; would prevent her learning Muddle and orders the spells more
- ; logically.
- org $ECE3F0
- DW $1E21 ; Muddle @ 33
- DW $2128 ; Berserk @ 40
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement