The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 895 - File: showthread.php PHP 7.3.33 (Linux)
File Line Function
/showthread.php 895 errorHandler->error




Users browsing this thread: 1 Guest(s)
ASM hack: improved Gale Hairpin; please help

#1
Posts: 281
Threads: 18
Thanks Received: 13
Thanks Given: 8
Joined: Mar 2014
Reputation: 8
Status
None
Hello,

I present for your titillation:

(This code deals with initializing ATB timers. Check the offset in Assassin's C2 disassembly for orientation.)
Code:
C2/25C1: A5 B0        LDA $B0
C2/25C3: 4C yy xx     JMP $xxyy     (jump to new routine)

New routine at xxyy (21 bytes):
C2/xx00: 0A           ASL
C2/xx01: 30 0C        BMI $xx0F      (skip to next target if Preemptive Attack)
C2/xx03: A9 E2        LDA #$E2
C2/xx05: D9 D0 3C     CMP $3CD0,Y
C2/xx08: F0 05        BEQ $xx0F      (Branch if item #226 (Gale Hairpin) equipped in relic slot 1)
C2/xx0A: D9 D1 3C     CMP $3CD1,Y    (Check Slot 2)
C2/xx0D: D0 03        BNE $xx12      (Branch if Gale Hairpin not equipped)
C2/xx0F: 4C FA 25     JMP $25FA      (Skip to next target)
C2/xx12: 4C C6 25     JMP $25C6      return to where we jumped from

This is a quick and dirty hack that makes item #226 (Gale Hairpin) grant a full ATB bar at the start of battle for the character wearing it, much like the ability called Initiative in FFVIII (or First Strike in FFX).

You see the problem, right? Hardcoding effects to item numbers is pretty lame. It may be excusable in the case of Tintinabar, Moogle Suit etc. since those are pretty unique items, but in this case, I would really like it if I could use the "Raise preemptive atk." bit in Item Special Effects byte 1 to trigger this effect.

Check this out. $3C44 is populated with item effects, but according to Assassin, only bit 0, 1 and 7 are actually checked elsewhere. So what I'd like to do is flip an unused bit in $3C44 and check for that bit instead of an item number. So far what I've come up with is to add a routine with a conditional branch that checks for the original Gale Hairpin bit, then flips bit 3 in $3C44 if it is set:

Code:
Original:
C2/28E7: 9D 44 3C     STA $3C44,X    (load and shift around some item property bytes, then save it in this variable)

Modified:
C2/28E7: 20 yy xx     JSR $xxyy

New routine at C2/xxyy:

C2/xx00: 9D 44 3C   STA $3C44,X
C2/xx03: AD D6 11   LDA $11D6         (load special byte 1)
C2/xx06: 4A         LSR               (shift out least byte into carry)
C2/xx07: 90 09      BCC $xx12         (if no Gale Hairpin, exit)
C2/xx09: A9 04 00   LDA #$0004
C2/xx0C: 1D 44 3C   ORA $3C44,X       (flip bit 3, unused "hp+25%")
C2/xx0F: 9D 44 3C   STA $3C44,X
C2/xx12: 60         RTS

If you look at C2/0FBA, it seems that $11D6 is initialized as the byte detailing the Gale Hairpin effect (among others) from $D8500A,X.

And if you look at C2/28D7, it also seems that $11D6 is partially used to populate $3C44 (actually just bit 7, which represents the Dragon Horn effect).

It also seems to be copied to $3A6D, which is a global variable checked by the "raise preemptive rate" and "disable back/pincer attacks" parts of the code). $3A6D is not an array indexed by actor ID, just the one byte.

The problem is, I can't get this conditional branch to work! If I leave it out and just do the ORA unconditionally, the bit seems indeed flipped because writing code to check for it instead of the item number does indeed cause (every) character to gain a full ATB bar.
I've tried checking $D8500A,X instead, no dice.
I've tried using BIT #$01 and BEQ instead of LSR/BCC, no dice. I'm at my wit's end. Maybe I misunderstand what the index register signifies in this part of the code. Maybe I'm checking the wrong byte. Help me troubleshoot, please?
  Find
Quote  



Messages In This Thread
ASM hack: improved Gale Hairpin; please help - by seibaby - 03-01-2014, 10:10 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite