Final Fantasy VI/ROM map/Assembly C22

From Data Crystal
Jump to navigation Jump to search

This is a sub-page of Final Fantasy VI/ROM map.

C2/2011 unknow

(48) (49) (4A) (4B)
C2/2011: 8A           TXA
C2/2012: 38           SEC 
C2/2013: E9 24        SBC #$24
C2/2015: AA           TAX 
C2/2016: BD A0 3A     LDA $3AA0,X
C2/2019: 4A           LSR 
C2/201A: 90 83        BCC $1F9F
C2/201C: BD 18 30     LDA $3018,X
C2/201F: 85 B8        STA $B8
C2/2021: 80 A7        BRA $1FCA

C2/2023 unknow

(36)
C2/2023: C2 20        REP #$20
C2/2025: B9 18 30     LDA $3018,Y
C2/2028: 85 B8        STA $B8
C2/202A: 4C 93 1F     JMP $1F93

C2/202D remove self as target

C2/202D: 08           PHP
C2/202E: C2 20        REP #$20
C2/2030: B9 18 30     LDA $3018,Y
C2/2033: 14 B8        TRB $B8
C2/2035: 28           PLP 
C2/2036: 60           RTS 

C2/2037 sets targets to all dead monsters and characters

C2/2037: 08           PHP         (Set 16-bit Accumulator)
C2/2038: C2 20        REP #$20
C2/203A: 64 B8        STZ $B8
C2/203C: A2 12        LDX #$12
C2/203E: BD E3 3E     LDA $3EE3,X 
C2/2041: 10 05        BPL $2048   (Branch if not dead)
C2/2043: BD 18 30     LDA $3018,X
C2/2046: 04 B8        TSB $B8
C2/2048: CA           DEX 
C2/2049: CA           DEX 
C2/204A: 10 F2        BPL $203E
C2/204C: 28           PLP 
C2/204D: 60           RTS 

C2/204E set targets to all monsters and characters with reflect status

C2/204E: 08           PHP
C2/204F: C2 20        REP #$20    (Set 16-bit Accumulator)
C2/2051: 64 B8        STZ $B8
C2/2053: A2 12        LDX #$12
C2/2055: BD F7 3E     LDA $3EF7,X
C2/2058: 10 05        BPL $205F   (Branch if not Reflect status)
C2/205A: BD 18 30     LDA $3018,X
C2/205D: 04 B8        TSB $B8
C2/205F: CA           DEX 
C2/2060: CA           DEX 
C2/2061: 10 F2        BPL $2055
C2/2063: 28           PLP 
C2/2064: 60           RTS 

C2/2065 pointers: monster script: F1 opcode

C2/2065: 23 20     (36)
C2/2067: A5 1F     (37)
C2/2069: A8 1F     (38)
C2/206B: AC 1F     (39)
C2/206D: AF 1F     (3A)
C2/206F: B3 1F     (3B)
C2/2071: B8 1F     (3C)
C2/2073: BD 1F     (3D)
C2/2075: C2 1F     (3E)
C2/2077: C7 1F     (3F)
C2/2079: CC 1F     (40)
C2/207B: D1 1F     (41)
C2/207D: D6 1F     (42)
C2/207F: A1 1F     (43)
C2/2081: 88 1F     (44)
C2/2083: FB 1F     (45)
C2/2085: 93 1F     (46)
C2/2087: 9F 1F     (47)
C2/2089: 11 20     (48)
C2/208B: 11 20     (49)
C2/208D: 11 20     (4A)
C2/208F: 11 20     (4B)
C2/2091: DB 1F     (4C)
C2/2093: E5 1F     (4D)

C2/2095 recalculate characters data for equipments and relics

C2/2095: A2 03        LDX $#03
C2/2097: BD 2F 30     LDA $2F30,X   (was character flagged to have his/her properties be
                                     recalculated from his/her equipment at end of turn?)
C2/209A: F0 3E        BEQ $20DA     (skip to next character if not)
C2/209C: 9E 30 2F     STZ $2F30,X   (clear this character's flag)
C2/209F: DA           PHX 
C2/20A0: 5A           PHY 
C2/20A1: 8A           TXA 
C2/20A2: 85 EE        STA $EE
C2/20A4: 0A           ASL 
C2/20A5: 85 EF        STA $EF
C2/20A7: 0A           ASL 
C2/20A8: 65 EE        ADC $EE
C2/20AA: AA           TAX 
C2/20AB: BD 86 2B     LDA $2B86,X
C2/20AE: EB           XBA 
C2/20AF: BD 9A 2B     LDA $2B9A,X
C2/20B2: A6 EF        LDX $EF
C2/20B4: C2 10        REP #$10      (Set 16-bit X and Y)
C2/20B6: BC 10 30     LDY $3010,X   (get offset to character info block)  
C2/20B9: 99 20 16     STA $1620,Y
C2/20BC: EB           XBA 
C2/20BD: 99 1F 16     STA $161F,Y
C2/20C0: BD E4 3E     LDA $3EE4,X
C2/20C3: 99 14 16     STA $1614,Y
C2/20C6: E2 10        SEP #$10      (Set 8-bit X and Y)
C2/20C8: BD D9 3E     LDA $3ED9,X
C2/20CB: 22 77 0E C2  JSR $C20E77
C2/20CF: 20 6D 28     JSR $286D
C2/20D2: 20 7D 52     JSR $527D
C2/20D5: 20 75 26     JSR $2675
C2/20D8: 7A           PLY 
C2/20D9: FA           PLX 
C2/20DA: CA           DEX 
C2/20DB: 10 BA        BPL $2097     (loop for all 4 onscreen characters)
C2/20DD: 60           RTS 

C2/20DE command #$2A

C2/20DE: AD 45 2F     LDA $2F45   (characters trying to run)
C2/20E1: F0 7F        BEQ $2162   (exit if not trying to run)
C2/20E3: C2 20        REP #$20
C2/20E5: A9 02 09     LDA #$0902
C2/20E8: 8D 28 3A     STA $3A28   (default some animation variable to
                                   unsuccessful run?)
C2/20EB: E2 20        SEP #$20
C2/20ED: A5 B1        LDA $B1
C2/20EF: 89 02        BIT #$02    (is Can't Run set?)
C2/20F1: D0 6C        BNE $215F   (branch if so)
C2/20F3: AD 38 3A     LDA $3A38   (characters successfully running)
C2/20F6: F0 6A        BEQ $2162   (branch if none)
C2/20F8: 85 B8        STA $B8     (save successfully running characters)
C2/20FA: 9C 38 3A     STZ $3A38
C2/20FD: 20 00 64     JSR $6400   (Zero $A0 through $AF)
C2/2100: A2 06        LDX #$06
C2/2102: BD 18 30     LDA $3018,X
C2/2105: 14 B8        TRB $B8     (remove current party member from list
                                   of successfully running characters)
C2/2107: F0 3B        BEQ $2144   (skip to next party member if they were
                                   never in it) 
C2/2109: EB           XBA 
C2/210A: BD 19 32     LDA $3219,X  (top byte of ATB timer, which is zeroed
                                    when the gauge is full)
C2/210D: D0 35        BNE $2144    (it it's nonzero, the gauge isn't full,
                                    so skip to next party member)
C2/210F: BD A0 3A     LDA $3AA0,X
C2/2112: 89 50        BIT #$50     (???)
C2/2114: D0 2E        BNE $2144
C2/2116: 4A           LSR          (is entity even present in the battle?)
C2/2117: 90 2B        BCC $2144    (skip to next party member if not)
C2/2119: BD E4 3E     LDA $3EE4,X
C2/211C: 89 02        BIT #$02     (Check for Zombie status)
C2/211E: D0 24        BNE $2144
C2/2120: BD F9 3E     LDA $3EF9,X
C2/2123: 89 20        BIT #$20
C2/2125: D0 1D        BNE $2144    (Branch if Hide status)
C2/2127: EB           XBA 
C2/2128: 04 B8        TSB $B8      (mark character as successfully running,
                                    for realz now.)
C2/212A: 0C 39 3A     TSB $3A39
C2/212D: 0C 4C 2F     TSB $2F4C    (mark runner to be removed from the battlefield?)
C2/2130: BD A1 3A     LDA $3AA1,X
C2/2133: 09 40        ORA #$40
C2/2135: 9D A1 3A     STA $3AA1,X  (Set bit 6 of $3AA1)
C2/2138: BD 04 32     LDA $3204,X
C2/213B: 09 40        ORA #$40     (set bit 6 of $3204)
C2/213D: 9D 04 32     STA $3204,X
C2/2140: 20 C8 07     JSR $07C8
C2/2143: 9B           TXY 
C2/2144: CA           DEX 
C2/2145: CA           DEX 
C2/2146: 10 BA        BPL $2102    (loop for all 4 party members)
C2/2148: A5 B8        LDA $B8      (get successfully running characters)
C2/214A: F0 16        BEQ $2162    (branch if none)
C2/214C: 64 B9        STZ $B9
C2/214E: BB           TYX 
C2/214F: 20 C2 57     JSR $57C2    (Update $An variables, and do other stuff)
C2/2152: 20 DB 63     JSR $63DB    (Copy $An variables to ($78) buffer)
C2/2155: C2 20        REP #$20     (set 16-bit Accumulator)
C2/2157: A9 06 22     LDA #$2206
C2/215A: 8D 28 3A     STA $3A28    (change some animation variable to
                                    successful run?)
C2/215D: E2 20        SEP #$20     (set 8-bit Accumulator)
C2/215F: 20 9E 62     JSR $629E    
C2/2162: 60           RTS 

C2/2163 unknow

C2/2163: F4 18 00     PEA $0018
C2/2166: 48           PHA 
C2/2167: 0A           ASL 
C2/2168: A8           TAY 
C2/2169: 18           CLC 
C2/216A: 20 76 02     JSR $0276
C2/216D: 68           PLA 
C2/216E: A8           TAY 
C2/216F: B9 84 31     LDA $3184,Y
C2/2172: CD 0A 34     CMP $340A
C2/2175: D0 02        BNE $2179
C2/2177: A9 FF        LDA #$FF
C2/2179: 8D 0A 34     STA $340A
C2/217C: A9 FF        LDA #$FF
C2/217E: 99 84 31     STA $3184,Y
C2/2181: A9 01        LDA #$01
C2/2183: 04 B1        TSB $B1
C2/2185: 4C D3 13     JMP $13D3

C2/2188 unknow

C2/2188: A9 80        LDA #$80
C2/218A: 20 AB 5B     JSR $5BAB
C2/218D: BD A0 3A     LDA $3AA0,X
C2/2190: 89 50        BIT #$50
C2/2192: D0 76        BNE $220A
C2/2194: BD A1 3A     LDA $3AA1,X
C2/2197: 29 7F        AND #$7F    (Clear bit 7)
C2/2199: 09 01        ORA #$01    (Set bit 0)
C2/219B: 9D A1 3A     STA $3AA1,X
C2/219E: 20 1C 03     JSR $031C
C2/21A1: BD CC 32     LDA $32CC,X
C2/21A4: 30 64        BMI $220A
C2/21A6: 0A           ASL 
C2/21A7: A8           TAY 
C2/21A8: B9 20 34     LDA $3420,Y
C2/21AB: C9 1E        CMP #$1E
C2/21AD: B0 5B        BCS $220A
C2/21AF: 8D 6F 2D     STA $2D6F
C2/21B2: C9 16        CMP #$16
C2/21B4: F0 06        BEQ $21BC
C2/21B6: E0 08        CPX #$08
C2/21B8: 90 2C        BCC $21E6
C2/21BA: 80 4E        BRA $220A
C2/21BC: BD 05 32     LDA $3205,X
C2/21BF: 10 49        BPL $220A
C2/21C1: C2 20        REP #$20
C2/21C3: E0 08        CPX #$08
C2/21C5: B0 0C        BCS $21D3
C2/21C7: A9 16 00     LDA #$0016
C2/21CA: 8D 28 3F     STA $3F28
C2/21CD: B9 20 35     LDA $3520,X
C2/21D0: 8D 2A 3F     STA $3F2A
C2/21D3: BD 18 30     LDA $3018,X
C2/21D6: 0C 2C 3F     TSB $3F2C
C2/21D9: E2 20        SEP #$20
C2/21DB: BD F9 3E     LDA $3EF9,X
C2/21DE: 09 20        ORA #$20
C2/21E0: 9D F9 3E     STA $3EF9,X  (Set Hide Status)
C2/21E3: 20 26 5D     JSR $5D26
C2/21E6: 20 39 26     JSR $2639
C2/21E9: 20 00 64     JSR $6400    (Zero $A0 through $AF)
C2/21EC: C2 20        REP #$20
C2/21EE: B9 20 35     LDA $3520,Y
C2/21F1: 85 B8        STA $B8
C2/21F3: E2 20        SEP #$20
C2/21F5: A9 0C        LDA #$0C
C2/21F7: 8D 6E 2D     STA $2D6E
C2/21FA: A9 FF        LDA #$FF
C2/21FC: 8D 72 2D     STA $2D72
C2/21FF: 20 C2 57     JSR $57C2
C2/2202: 20 DB 63     JSR $63DB    (Copy $An variables to ($78) buffer)
C2/2205: A9 04        LDA #$04
C2/2207: 20 11 64     JSR $6411
C2/220A: 4C 19 00     JMP $0019

C2/220D determine if attack hits

C2/220D: 48           PHA
C2/220E: DA           PHX 
C2/220F: 18           CLC 
C2/2210: 08           PHP 
C2/2211: E2 20        SEP #$20
C2/2213: 64 FE        STZ $FE
C2/2215: A5 B3        LDA $B3
C2/2217: 10 1C        BPL $2235   (Skip Clear check if bit 7 of $B3 not set)
C2/2219: B9 E4 3E     LDA $3EE4,Y
C2/221C: 89 10        BIT #$10    (Check for Clear status)
C2/221E: F0 15        BEQ $2235   (Branch if not vanished)
C2/2220: AD A4 11     LDA $11A4
C2/2223: 0A           ASL 
C2/2224: 30 07        BMI $222D   (Branch if L.X spell)
C2/2226: AD A2 11     LDA $11A2
C2/2229: 4A           LSR 
C2/222A: 4C B3 22     JMP $22B3   (If physical attack then miss, otherwise hit)

C2/222D: B9 FC 3D     LDA $3DFC,Y
C2/2230: 09 10        ORA #$10
C2/2232: 99 FC 3D     STA $3DFC,Y  (mark Clear status to be cleared.  that way,
                                    it'll still be removed even if the attack
                                    misses and C2/4406, which is what normally
                                    removes Clear, is skipped.)
C2/2235: AD A3 11     LDA $11A3
C2/2238: 89 02        BIT #$02    (Check for not reflectable)
C2/223A: D0 0F        BNE $224B   (Branch if ^)
C2/223C: B9 F8 3E     LDA $3EF8,Y
C2/223F: 10 0A        BPL $224B   (Branch if target does not have Reflect)
C2/2241: C2 20        REP #$20    (set 16-bit accumulator)
C2/2243: B9 18 30     LDA $3018,Y
C2/2246: 04 A6        TSB $A6     (turn on target in "reflected off of" byte?)
C2/2248: 4C E5 22     JMP $22E5   (Always miss if target has Reflect)

C2/224B: AD A2 11     LDA $11A2
C2/224E: 89 02        BIT #$02    (Check for spell miss if death prot.)
C2/2250: F0 07        BEQ $2259   (Branch if not ^)
C2/2252: B9 A1 3A     LDA $3AA1,Y
C2/2255: 89 04        BIT #$04
C2/2257: D0 5C        BNE $22B5   (Always miss if Prot. from death)
C2/2259: AD A2 11     LDA $11A2
C2/225C: 89 04        BIT #$04    (Check for hit only (dead XOR undead) targets)
C2/225E: F0 08        BEQ $2268
C2/2260: B9 E4 3E     LDA $3EE4,Y
C2/2263: 59 95 3C     EOR $3C95,Y (death status XOR undead attribute)
C2/2266: 10 4D        BPL $22B5   (If neither or both of above set, then miss)
C2/2268: A5 B5        LDA $B5
C2/226A: C9 00        CMP #$00
C2/226C: F0 04        BEQ $2272   (Branch if command is Fight)
C2/226E: C9 06        CMP #$06
C2/2270: D0 2F        BNE $22A1   (Branch if command not Capture)
C2/2272: AD A9 11     LDA $11A9
C2/2275: D0 2A        BNE $22A1   (Branch if has special effect)
C2/2277: AD C9 3E     LDA $3EC9
C2/227A: C9 01        CMP #$01
C2/227C: D0 23        BNE $22A1   (branch if # of targets isn't 1)
C2/227E: C0 08        CPY #$08
C2/2280: B0 1F        BCS $22A1   (Branch if target is monster)
C2/2282: B9 F9 3E     LDA $3EF9,Y
C2/2285: 0A           ASL 
C2/2286: 10 0B        BPL $2293   (Branch if not dog block)
C2/2288: 20 53 4B     JSR $4B53   (0 or 1)
C2/228B: 90 06        BCC $2293   (50% chance)
C2/228D: A9 40        LDA #$40
C2/228F: 85 FE        STA $FE	    (set dog block animation flag)
C2/2291: 80 22        BRA $22B5   (Miss)
C2/2293: AD 36 3A     LDA $3A36
C2/2296: 0D 37 3A     ORA $3A37
C2/2299: F0 06        BEQ $22A1   (Branch if no Golem)
C2/229B: A9 20        LDA #$20
C2/229D: 85 FE        STA $FE     (set golem block animation flag)
C2/229F: 80 14        BRA $22B5   (Miss)
C2/22A1: AD A4 11     LDA $11A4
C2/22A4: 89 20        BIT #$20    (Check for can't be dodged)
C2/22A6: D0 40        BNE $22E8   (Always hit if can't be dodged)
C2/22A8: 89 40        BIT #$40
C2/22AA: D0 40        BNE $22EC   (Check if hit for L? Spells) 
C2/22AC: 89 10        BIT #$10
C2/22AE: F0 4B        BEQ $22FB   (Check if hit if Stamina not involved?)
C2/22B0: 20 9C 23     JSR $239C   (Check if hit if Stamina involved?)
C2/22B3: 90 33        BCC $22E8   (branch if hits)
C2/22B5: B9 E4 3E     LDA $3EE4,Y
C2/22B8: 89 1A        BIT #$1A    (Check target for Clear, M-Tek, or Zombie)
C2/22BA: D0 15        BNE $22D1   (Always miss if ^)
C2/22BC: C0 08        CPY #$08    (Check if target is monster)
C2/22BE: B0 11        BCS $22D1   (Always miss if ^)
C2/22C0: 20 BF 23     JSR $23BF   (Determine miss animation)
C2/22C3: C9 06        CMP #$06
C2/22C5: 90 0A        BCC $22D1   (Always miss)
C2/22C7: A2 03        LDX #$03
C2/22C9: 9E AA 11     STZ $11AA,X (Clear all status setting effects of attack)
C2/22CC: CA           DEX 
C2/22CD: 10 FA        BPL $22C9
C2/22CF: 80 17        BRA $22E8   (Always hit)
C2/22D1: A9 02        LDA #$02
C2/22D3: 04 B2        TSB $B2     (Set no critical and ignore True Knight)
C2/22D5: 9C 89 3A     STZ $3A89   (turn off random weapon spellcast)
C2/22D8: AD 1C 34     LDA $341C   (0 if current strike is missable weapon spellcast)
C2/22DB: F0 08        BEQ $22E5   (if it is, skip flagging the "Miss" message,
                                   since we'll be skipping the animation
                                   entirely.)
C2/22DD: C2 20        REP #$20
C2/22DF: B9 18 30     LDA $3018,Y
C2/22E2: 0C 5A 3A     TSB $3A5A   (Set target as missed)
C2/22E5: 28           PLP 
C2/22E6: 38           SEC         (Makes attack miss)
C2/22E7: 08           PHP 
C2/22E8: 28           PLP 
C2/22E9: FA           PLX 
C2/22EA: 68           PLA 
C2/22EB: 60           RTS 

C2/22EC determine if attack hits: L? spells

C2/22EC: AE A8 11     LDX $11A8   (Hit Rate)
C2/22EF: 7B           TDC 
C2/22F0: B9 18 3B     LDA $3B18,Y (Level)
C2/22F3: 20 92 47     JSR $4792   (Division)
C2/22F6: 8A           TXA 
C2/22F7: D0 D8        BNE $22D1   (Always miss)
C2/22F9: 80 ED        BRA $22E8   (Always Hit)

C2/22FB determine if attack hits

C2/22FB: F4 40 80     PEA $8040   (Sleep, Petrify)
C2/22FE: F4 10 02     PEA $0210   (Freeze, Stop)
C2/2301: 20 64 58     JSR $5864
C2/2304: 90 E2        BCC $22E8   (Always hit if any set)
C2/2306: C2 20        REP #$20
C2/2308: B9 18 30     LDA $3018,Y
C2/230B: 2C 54 3A     BIT $3A54
C2/230E: E2 20        SEP #$20
C2/2310: D0 D6        BNE $22E8   (Always hit)
C2/2312: AD A8 11     LDA $11A8   (Hit Rate)
C2/2315: C9 FF        CMP #$FF
C2/2317: F0 CF        BEQ $22E8   (Automatically hit if Hit Rate is 255)
C2/2319: 85 EE        STA $EE
C2/231B: AD A2 11     LDA $11A2   
C2/231E: 4A           LSR 
C2/231F: 90 1E        BCC $233F   (If Magic attack then skip this next code)
C2/2321: B9 4C 3E     LDA $3E4C,Y 
C2/2324: 4A           LSR         (Check for retort)
C2/2325: B0 C1        BCS $22E8   (Always hits)
C2/2327: B9 E5 3E     LDA $3EE5,Y (Check for image status)         
C2/232A: 89 04        BIT #$04
--------------------------------------------------
(Original Code)
C2/232C: F0 11        BEQ $233F   (Branch if not Image status on target)
C2/232E: 20 5A 4B     JSR $4B5A   
C2/2331: C9 40        CMP #$40    (1 in 4 chance clear Image status)
C2/2333: B0 9C        BCS $22D1   (Always misses)
C2/2335: B9 FD 3D     LDA $3DFD,Y 
C2/2338: 09 04        ORA #$04
C2/233A: 99 FD 3D     STA $3DFD,Y (Clear Image status)
C2/233D: 80 92        BRA $22D1   (Always misses)
C2/233F: B9 54 3B     LDA $3B54,Y (255 - Evade * 2 + 1)   
C2/2342: B0 03        BCS $2347             
C2/2344: B9 55 3B     LDA $3B55,Y (255 - MBlock * 2 + 1)
C2/2347: 48           PHA                   
C2/2348: 90 3E        BCC $2388             
(Evade Patch Applied)
C2/232C: F0 17        BEQ $2345   (Branch if not Image status on target)
C2/232E: 20 5A 4B     JSR $4B5A   
C2/2331: C9 40        CMP #$40    (1 in 4 chance clear Image status)
C2/2333: B0 9C        BCS $22D1   (Always misses)
C2/2335: B9 FD 3D     LDA $3DFD,Y 
C2/2338: 09 04        ORA #$04
C2/233A: 99 FD 3D     STA $3DFD,Y (Clear Image status)
C2/233D: 80 92        BRA $22D1   (Always misses)
C2/233F: B9 55 3B     LDA $3B55,Y (255 - MBlock * 2 + 1)   
C2/2342: 48           PHA
C2/2343: 80 43        BRA $2388
C2/2345: B9 54 3B     LDA $3B54,Y (255 - Evade * 2 + 1)
C2/2348: 48           PHA
C2/2349: EA           NOP
-------------------------------------------------
C2/234A: BD E4 3E     LDA $3EE4,X
C2/234D: 4A           LSR 
C2/234E: 90 02        BCC $2352   (Branch if attacker not blinded [Dark status])
C2/2350: 46 EE        LSR $EE     (Cut hit rate in half)
C2/2352: B9 58 3C     LDA $3C58,Y
C2/2355: 89 04        BIT #$04
C2/2357: F0 02        BEQ $235B   (Branch if no Beads)
C2/2359: 46 EE        LSR $EE     (Cut hit rate in half)
C2/235B: F4 03 20     PEA $2003   (Muddled, Dark, Zombie)
C2/235E: F4 04 04     PEA $0404   (Life 3, Slow)
C2/2361: 20 64 58     JSR $5864
C2/2364: B0 0C        BCS $2372   (Branch if none set on target)
C2/2366: A5 EE        LDA $EE
C2/2368: 4A           LSR 
C2/2369: 4A           LSR 
C2/236A: 65 EE        ADC $EE     (Adds 1/4 to hit rate)
C2/236C: 90 02        BCC $2370
C2/236E: A9 FF        LDA #$FF
C2/2370: 85 EE        STA $EE     (if hit rate overflowed, set to 255)
C2/2372: F4 04 42     PEA $4204   (Seizure, Near Fatal, Poison)
C2/2375: F4 08 00     PEA $0008   (Haste)
C2/2378: 20 64 58     JSR $5864
C2/237B: B0 0B        BCS $2388   (Branch if none set on target)
C2/237D: A5 EE        LDA $EE
C2/237F: 46 EE        LSR $EE
C2/2381: 46 EE        LSR $EE
C2/2383: 38           SEC 
C2/2384: E5 EE        SBC $EE     (Subtracts 1/4 from hit rate)
C2/2386: 85 EE        STA $EE
C2/2388: 68           PLA         
C2/2389: EB           XBA 
C2/238A: A5 EE        LDA $EE     (Hit Rate)
C2/238C: 20 81 47     JSR $4781   (Multiply Evade/Mblock * Hit Rate)
C2/238F: EB           XBA 
C2/2390: 85 EE        STA $EE     (High byte of Evade/Mblock * Hit Rate)
C2/2392: A9 64        LDA #$64
C2/2394: 20 65 4B     JSR $4B65   (Random number 0 to 99)
C2/2397: C5 EE        CMP $EE
C2/2399: 4C B3 22     JMP $22B3

C2/239C check if hit: stamina

C2/239C: B9 55 3B     LDA $3B55,Y (MBlock)
C2/239F: EB           XBA 
C2/23A0: AD A8 11     LDA $11A8   (Hit Rate)
C2/23A3: 20 81 47     JSR $4781   (Multiplication Function)
C2/23A6: EB           XBA 
C2/23A7: 85 EE        STA $EE     (High byte of Mblock * Hit Rate)
C2/23A9: A9 64        LDA #$64    
C2/23AB: 20 65 4B     JSR $4B65   (Random Number 0 to 99)
C2/23AE: C5 EE        CMP $EE
C2/23B0: B0 0C        BCS $23BE   (Attack misses, so exit)
C2/23B2: 20 5A 4B     JSR $4B5A   (Random Number 0 to 255)
C2/23B5: 29 7F        AND #$7F    (0 to 127)
C2/23B7: 85 EE        STA $EE
C2/23B9: B9 40 3B     LDA $3B40,Y (Stamina)
C2/23BC: C5 EE        CMP $EE
C2/23BE: 60           RTS 

C2/23BF check if hit: dog and golem

C2/23BF: 5A           PHY
C2/23C0: AD A2 11     LDA $11A2
C2/23C3: 4A           LSR 
C2/23C4: B0 01        BCS $23C7   (Branch if physical attack)
C2/23C6: C8           INY         (if it was magical, read from 3CE5,old_Y instead)
C2/23C7: 7B           TDC         
C2/23C8: B9 E4 3C     LDA $3CE4,Y (shield/weapon miss animations)
C2/23CB: 05 FE        ORA $FE     (miss due to Interceptor/Golem)
C2/23CD: F0 1C        BEQ $23EB   (Exit function if none of above)
C2/23CF: 20 2A 52     JSR $522A   (Pick a random bit that is set)
C2/23D2: 89 40        BIT #$40
C2/23D4: F0 03        BEQ $23D9   (Branch if no dog protection)
C2/23D6: 8C 83 3A     STY $3A83   (save character target in "Dog blocked" byte)
C2/23D9: 89 20        BIT #$20
C2/23DB: F0 03        BEQ $23E0   (Branch if no Golem protection)
C2/23DD: 8C 82 3A     STY $3A82   (save character target in "Golem blocked" byte)
C2/23E0: 20 F0 51     JSR $51F0   (X = position of highest [and only] bit that is set)
C2/23E3: 98           TYA 
C2/23E4: 4A           LSR 
C2/23E5: A8           TAY         (Y = Y DIV 2, so it won't matter if Y was incremented
                                   above.  it now holds a 0-3 character #.)
C2/23E6: 8A           TXA 
C2/23E7: 1A           INC 
C2/23E8: 99 AA 00     STA $00AA,Y  (save the dodge animation type for this character?)
C2/23EB: 7A           PLY 
C2/23EC: 60           RTS 

C2/23ED unknow

C2/23ED: 08           PHP
C2/23EE: C2 30        REP #$30    (Set 16-bit A, X, & Y)
C2/23F0: A2 58 02     LDX #$0258
C2/23F3: 9E 20 3A     STZ $3A20,X
C2/23F6: 9E 7A 3C     STZ $3C7A,X
C2/23F9: CA           DEX 
C2/23FA: CA           DEX
C2/23FB: 10 F6        BPL $23F3
C2/23FD: 7B           TDC 
C2/23FE: 3A           DEC 
C2/23FF: A2 0E 0A     LDX #$0A0E
C2/2402: 9D 00 20     STA $2000,X
C2/2405: 9D 10 2A     STA $2A10,X
C2/2408: CA           DEX 
C2/2409: CA           DEX 
C2/240A: 10 F6        BPL $2402
C2/240C: 9C 44 2F     STZ $2F44
C2/240F: 9C 4C 2F     STZ $2F4C
C2/2412: 9C 4E 2F     STZ $2F4E
C2/2415: 9C 53 2F     STZ $2F53
C2/2418: 64 B0        STZ $B0
C2/241A: 64 B2        STZ $B2
C2/241C: A2 02 26     LDX #$2602
C2/241F: A0 18 30     LDY #$3018
C2/2422: A9 1B 00     LDA #$001B
C2/2424: 54 7E C2     MVN #$C2,7E
C2/2427: AD 11 E0     LDA $11E0
C2/242B: C9 D7 01     CMP #$01D7  (Check for Short Arm, Long arm, Face formation)
C2/242E: E2 30        SEP #$30    (Set 8-bit A, X & Y)
C2/2430: D0 03        BNE $2435   (branch if it's not 1st tier of final 4-tier
                                   multi-battle)
C2/2432: 9C E0 3E     STZ $3EE0   (zero byte to indicate that we're in the final
                                   4-tier multi-battle)
C2/2435: A2 13        LDX #$13
C2/2437: BD C9 1D     LDA $1DC9,X
C2/243A: 9D B4 3E     STA $3EB4,X
C2/243D: CA           DEX 
C2/243E: 10 F7        BPL $2437
C2/2440: AD 1E 02     LDA $021E
C2/2443: 0A           ASL 
C2/2444: 0A           ASL 
C2/2445: 85 BE        STA $BE
C2/2447: 20 E8 30     JSR $30E8   (Loads battle formation data)
C2/244A: 20 2F 2F     JSR $2F2F
C2/244D: A9 80        LDA #$80
C2/244F: 1C BB 3E     TRB $3EBB
C2/2452: A9 91        LDA #$91
C2/2454: 1C BC 3E     TRB $3EBC
C2/2457: A2 12        LDX #$12
C2/2459: 20 5A 4B     JSR $4B5A   (0 to 255)
C2/245C: 9D F0 3A     STA $3AF0,X (Store random number at $3AF0,X)
C2/245F: A9 BC        LDA #$BC
C2/2461: EC E2 3E     CPX $3EE2
C2/2464: D0 02        BNE $2468
C2/2466: 09 02        ORA #$02
C2/2468: 9D 04 32     STA $3204,X
C2/246B: CA           DEX 
C2/246C: CA           DEX 
C2/246D: 10 EA        BPL $2459
C2/246F: 20 44 25     JSR $2544
C2/2472: AD 4D 1D     LDA $1D4D   (Battle Speed variable from user Configuration.
                                   Note that its actual value ranges from 0 to 5, but
                                   the menu choices the player sees are 1 thru 6.)
C2/2475: 30 03        BMI $247A   (branch if "Short" Command Set)
C2/2477: 9C 2E 2F     STZ $2F2E   (otherwise, it's "Window")
C2/247A: 89 08        BIT #$08    (is "Wait" Battle Mode set?)
C2/247C: F0 03        BEQ $2481   (branch if not, meaning it's Active)
C2/247E: EE 8F 3A     INC $3A8F
C2/2481: 29 07        AND #$07    (bottom 3 bits of Battle Speed)
C2/2483: 0A           ASL 
C2/2484: 0A           ASL 
C2/2485: 0A           ASL 
C2/2486: 85 EE        STA $EE     (Battle Speed * 8)
C2/2488: 0A           ASL         ( * 16)
C2/2489: 65 EE        ADC $EE     (Battle Speed * 24)
C2/248B: 49 FF        EOR #$FF    
C2/248D: 8D 90 3A     STA $3A90   (= 255 - (Battle Speed * 24) )
                                  (this variable is a multiplier which is used for
                                   slowing down enemies in the Battle Time Counter
                                   Function at C2/09D2.  as you can see here and
                                   from experience, a Battle Speed of zero will leave
                                   enemies the fastest.)
C2/2490: AD 4E 1D     LDA $1D4E
C2/2493: 10 03        BPL $2498   (branch if the Gauge is not disabled) 
C2/2495: 9C 21 20     STZ $2021
C2/2498: 9C 41 2F     STZ $2F41
C2/249B: 20 6E 54     JSR $546E
C2/249E: 20 0C 58     JSR $580C
C2/24A1: 20 E1 2E     JSR $2EE1
C2/24A4: 20 91 43     JSR $4391   (Status effects?)
C2/24A7: 20 9B 06     JSR $069B
C2/24AA: A9 14        LDA #$14
C2/24AC: 8D AF 11     STA $11AF
C2/24AF: 20 3F 08     JSR $083F
C2/24B2: 20 B9 4A     JSR $4AB9
C2/24B5: 20 3A 2E     JSR $2E3A
C2/24B8: 20 C9 26     JSR $26C9
C2/24BB: 20 68 2E     JSR $2E68
C2/24BE: 20 75 25     JSR $2575   (Initialize ATB Timers)
C2/24C1: A2 00        LDX #$00
C2/24C3: AD 4B 2F     LDA $2F4B   (extra formation data, byte 3)
C2/24C6: 89 04        BIT #$04
C2/24C8: D0 20        BNE $24EA   (branch if "hide starting messages" set)
C2/24CA: AD 1F 20     LDA $201F   (get encounter type.  0 = front, 1 = back,
                                   2 = pincer, 3 = side)
C2/24CD: C9 01        CMP #$01    
C2/24CF: D0 04        BNE $24D5   (branch if not back attack)
C2/24D1: A2 23        LDX #$23
C2/24D3: 80 15        BRA $24EA
C2/24D5: C9 02        CMP #$02
C2/24D7: D0 04        BNE $24DD   (branch if not pincer attack)
C2/24D9: A2 25        LDX #$25
C2/24DB: 80 0D        BRA $24EA
C2/24DD: C9 03        CMP #$03
C2/24DF: D0 02        BNE $24E3   (branch if not side attack)
C2/24E1: A2 24        LDX #$24
C2/24E3: A5 B0        LDA $B0
C2/24E5: 0A           ASL 
C2/24E6: 10 02        BPL $24EA   (branch if not preemptive attack)
C2/24E8: A2 22        LDX #$22
C2/24EA: 9B           TXY 
C2/24EB: F0 05        BEQ $24F2
C2/24ED: A9 25        LDA #$25
C2/24EF: 20 91 4E     JSR $4E91
C2/24F2: 20 73 5C     JSR $5C73
C2/24F5: 20 54 5C     JSR $5C54
C2/24F8: 64 B8        STZ $B8
C2/24FA: 64 B9        STZ $B9
C2/24FC: A2 06        LDX #$06
C2/24FE: BD 18 30     LDA $3018,X
C2/2501: 2C 2C 3F     BIT $3F2C
C2/2504: F0 16        BEQ $251C    (branch if not Jumping)
C2/2506: BD A0 3A     LDA $3AA0,X
C2/2509: 09 28        ORA #$28
C2/250B: 9D A0 3A     STA $3AA0,X
C2/250E: 9E 19 32     STZ $3219,X  (zero top byte of ATB Timer)
C2/2511: 20 77 4E     JSR $4E77    (put character in action queue)
C2/2514: A9 16        LDA #$16
C2/2516: 8D 7A 3A     STA $3A7A
C2/2519: 20 CB 4E     JSR $4ECB
C2/251C: CA           DEX 
C2/251D: CA           DEX 
C2/251E: 10 DE        BPL $24FE    (loop for all 4 party members)
C2/2520: AD E1 3E     LDA $3EE1
C2/2523: 1A           INC 
C2/2524: F0 19        BEQ $253F
C2/2526: 3A           DEC 
C2/2527: 8D 6F 2D     STA $2D6F
C2/252A: A9 12        LDA #$12
C2/252C: 8D 6E 2D     STA $2D6E
C2/252F: AD 75 3A     LDA $3A75
C2/2532: 8D 71 2D     STA $2D71
C2/2535: A9 FF        LDA #$FF
C2/2537: 8D 70 2D     STA $2D70
C2/253A: 8D 72 2D     STA $2D72
C2/253D: A9 04        LDA #$04
C2/253F: 20 11 64     JSR $6411
C2/2542: 28           PLP 
C2/2543: 60           RTS 

C2/2544 unknow

C2/2544: 20 51 55     JSR $5551
C2/2547: A2 06        LDX #$06
C2/2549: BD D8 3E     LDA $3ED8,X (Which character it is)
C2/254C: 30 22        BMI $2570   (Branch if monster?)
C2/254E: C9 10        CMP #$10
C2/2550: B0 05        BCS $2557
C2/2552: A8           TAY 
C2/2553: 8A           TXA 
C2/2554: 99 00 30     STA $3000,Y
C2/2557: BD 18 30     LDA $3018,X
C2/255A: 0C 8D 3A     TSB $3A8D
C2/255D: BD D9 3E     LDA $3ED9,X
C2/2560: 22 77 0E C2  JSR $C20E77
C2/2564: 20 6D 28     JSR $286D
C2/2567: 20 A8 27     JSR $27A8
C2/256A: 20 8D 56     JSR $568D
C2/256D: 20 2C 53     JSR $532C
C2/2570: CA           DEX 
C2/2571: CA           DEX 
C2/2572: 10 D5        BPL $2549
C2/2574: 60           RTS 

C2/2575 initialize ATB timers

C2/2575: 08           PHP
C2/2576: 64 F3        STZ $F3      (zero General Incrementor)
C2/2578: A0 12        LDY #$12
C2/257A: B9 A0 3A     LDA $3AA0,Y
C2/257D: 4A           LSR 
C2/257E: B0 07        BCS $2587    (branch if entity is present in battle?)
C2/2580: 18           CLC 
C2/2581: A9 10        LDA #$10
C2/2583: 65 F3        ADC $F3
C2/2585: 85 F3        STA $F3      (add 16 to $F3 [our General Incrementor] for
                                    each entity shy of the possible 10)
C2/2587: 88           DEY 
C2/2588: 88           DEY 
C2/2589: 10 EF        BPL $257A    (loop for all 10 characters and monsters)
C2/258B: C2 20        REP #$20     (Set 16-bit accumulator)
C2/258D: A9 FF 03     LDA #$03FF   (10 bits set, 10 possible entities in battle)
C2/2590: 85 F0        STA $F0
C2/2592: A0 12        LDY #$12
C2/2594: A5 F0        LDA $F0
C2/2596: 20 2A 52     JSR $522A   (randomly choose one of the 10 bits [targets])
C2/2599: 14 F0        TRB $F0     (and clear it, so it won't be used for
                                   subsequent iterations of loop)
C2/259B: 20 F0 51     JSR $51F0   (X = bit # of the chosen bit, thus a 0-9
                                   target #)
C2/259E: E2 20        SEP #$20    (Set 8-bit accumulator)
C2/25A0: 8A           TXA 
C2/25A1: 0A           ASL 
C2/25A2: 0A           ASL 
C2/25A3: 0A           ASL 
C2/25A4: 85 F2        STA $F2      (save [0..9] * 8 in our Specific Incrementor)
                                   (the result is that each entity is randomly
                                    assigned a different value for $F2:
                                    0, 8, 16, 24, 32, 40, 48, 56, 64, 72)
C2/25A6: B9 19 32     LDA $3219,Y  (get top byte of ATB Timer)
C2/25A9: 1A           INC 
C2/25AA: D0 4E        BNE $25FA    (skip to next target if it wasn't FFh)
C2/25AC: AD E1 3E     LDA $3EE1    (FFh in every case, except for last 3 tiers
                                    of final 4-tier multi-battle?)
C2/25AF: 1A           INC 
C2/25B0: D0 48        BNE $25FA    (skip to next target if one of those 3 tiers)
C2/25B2: AE 1F 20     LDX $201F    (get encounter type.  0 = front, 1 = back,
                                    2 = pincer, 3 = side)
C2/25B5: B9 18 30     LDA $3018,Y
C2/25B8: 2C 40 3A     BIT $3A40    (is target a character acting as enemy?)
C2/25BB: D0 14        BNE $25D1    (branch if so)
C2/25BD: C0 08        CPY #$08
C2/25BF: B0 10        BCS $25D1    (branch if target is a monster)
C2/25C1: A5 B0        LDA $B0
C2/25C3: 0A           ASL 
C2/25C4: 30 34        BMI $25FA    (skip to next target if Preemptive Attack)
C2/25C6: CA           DEX          (decrement encounter type)
C2/25C7: 30 15        BMI $25DE    (branch if front attack)
C2/25C9: CA           DEX 
C2/25CA: CA           DEX 
C2/25CB: F0 2D        BEQ $25FA    (skip to next target if side attack)
C2/25CD: A5 F2        LDA $F2
C2/25CF: 80 22        BRA $25F3    (it's a back or pincer attack)
                                   (go set top byte of ATB timer to $F2 + 1)
C2/25D1: A5 B0        LDA $B0      (we'll reach here only if target is monster
                                    or character acting as enemy)
C2/25D3: 0A           ASL 
C2/25D4: 30 04        BMI $25DA    (branch if Preemptive Attack)
C2/25D6: E0 03        CPX #$03     (checking encounter type again)
C2/25D8: D0 04        BNE $25DE    (branch if not side attack)
C2/25DA: A9 01        LDA #$01
C2/25DC: 80 15        BRA $25F3    (go set top byte of ATB timer to 2)
C2/25DE: B9 19 3B     LDA $3B19,Y  (A = Speed)
C2/25E1: 20 65 4B     JSR $4B65    (random #: 0 to A - 1)
C2/25E4: 79 19 3B     ADC $3B19,Y  (A = random: Speed to ((2 * Speed) - 1) )
C2/25E7: B0 08        BCS $25F1    (branch if exceeded 255)
C2/25E9: 65 F2        ADC $F2      (add entity's Specific Incrementor, a
                                    0,8,16,24,32,40,48,56,64,72 random boost)
C2/25EB: B0 04        BCS $25F1    (branch if exceeded 255)
C2/25ED: 65 F3        ADC $F3      (add our General Incrementor,
                                    (10 - number of valid entities) * 16 )
C2/25EF: 90 02        BCC $25F3    (branch if byte didn't exceed 255)
C2/25F1: A9 FF        LDA #$FF     (if it overflowed, set it to FFh [255d])
C2/25F3: 1A           INC 
C2/25F4: D0 01        BNE $25F7
C2/25F6: 3A           DEC          (so A is incremented if it was < FFh)
C2/25F7: 99 19 32     STA $3219,Y  (save top byte of ATB timer)
C2/25FA: C2 20        REP #$20
C2/25FC: 88           DEY 
C2/25FD: 88           DEY 
C2/25FE: 10 94        BPL $2594    (loop for all 10 possible characters and
                                    monsters)
C2/2600: 28           PLP 
C2/2601: 60           RTS 

C2/2602 data: unknow

Data to load into $3018 and $3019 
C2/2602: 01 00       
C2/2604: 02 00       
C2/2606: 04 00       
C2/2608: 08 00         
C2/260A: 00 01
C2/260C: 00 02       
C2/260E: 00 04       
C2/2610: 00 08       
C2/2612: 00 10       
C2/2614: 00 20       

Data

C2/2616: 8E
C2/2617: 20
C2/2618: CA
C2/2619: 21
C2/261A: 06
C2/261B: 23
C2/261C: 42
C2/261D: 24

C2/261E unknow

C2/261E: 7B           TDC
C2/261F: A2 5F        LDX #$5F
C2/2621: 9D E4 3E     STA $3EE4,X
C2/2624: CA           DEX 
C2/2625: 10 FA        BPL $2621
C2/2627: 3A           DEC 
C2/2628: A2 0F        LDX #$0F 
C2/262A: 9D D4 3E     STA $3ED4,X
C2/262D: CA           DEX 
C2/262E: 10 FA        BPL $262A
C2/2630: A9 12        LDA #$12
C2/2632: 8D 28 3F     STA $3F28
C2/2635: 8D 24 3F     STA $3F24
C2/2638: 60           RTS 

C2/2639 unknow

C2/2639: 08           PHP
C2/263A: 9C 72 3A     STZ $3A72
C2/263D: 9C 70 3A     STZ $3A70
C2/2640: C2 20        REP #$20
C2/2642: 9C 32 3A     STZ $3A32
C2/2645: 9C 34 3A     STZ $3A34
C2/2648: 9C 30 3A     STZ $3A30
C2/264B: 9C 4E 3A     STZ $3A4E
C2/264E: 28           PLP 
C2/264F: 60           RTS 

C2/2650 change death immunity into death protection

(Turn Death immunity into Instant Death protection by moving it into another byte; otherwise you'd
 be bloody immortal.  If the Poison elemental is nullified, make immune to Poison status.)
C2/2650: BD A1 3A     LDA $3AA1,X
C2/2653: 29 FB        AND #$FB    (Clear protection from "instant death")
C2/2655: EB           XBA 
C2/2656: BD 1C 33     LDA $331C,X (Blocked status byte 1)
C2/2659: 30 06        BMI $2661   (Branch if not block death)
C2/265B: 09 80        ORA #$80    (Clear block death)
C2/265D: EB           XBA 
C2/265E: 09 04        ORA #$04    (Set protection from "instant death")
C2/2660: EB           XBA 
C2/2661: EB           XBA 
C2/2662: 9D A1 3A     STA $3AA1,X
C2/2665: BD CD 3B     LDA $3BCD,X (Nullified elements)
C2/2668: 89 08        BIT #$08
C2/266A: F0 04        BEQ $2670   (Branch if not nullify poison)
C2/266C: EB           XBA 
C2/266D: 29 FB        AND #$FB    (Set block poison status if)
C2/266F: EB           XBA 
C2/2670: EB           XBA 
C2/2671: 9D 1C 33     STA $331C,X
C2/2674: 60           RTS 

C2/2675 check and set status as permanent

(Make some monster or equipment statuses permanent by setting immunity to them:
  Mute, Berserk, Muddled, Seizure, Regen, Slow, Haste, Shell, Safe, Reflect, Float *
 * If Float is only marked in Monster status byte 4, it won't be permanent
   [not to worry; no actual monsters do this].
 Then if you're immune to one status in a "mutually exclusive" pair, make immune to
 the other.  The pairs are Slow/Haste and Seizure/Regen.)
C2/2675: BD 31 33     LDA $3331,X
C2/2678: EB           XBA         (put blocked status byte 4 in top of A)
C2/2679: BD 6D 3C     LDA $3C6D,X (monster/equip status byte 3)
C2/267C: 4A           LSR 
C2/267D: 90 04        BCC $2683   (if perm-float (aka dance) wasn't set, branch)
C2/267F: EB           XBA 
C2/2680: 29 7F        AND #$7F
C2/2682: EB           XBA         (if it^ was, then block float.  thus the permanence)
C2/2683: AD BB 3E     LDA $3EBB
C2/2686: 89 04        BIT #$04
C2/2688: F0 04        BEQ $268E   (branch if we're not in Phunbaba battle #4
                                   [iow, Terra's second Phunbaba meeting])
C2/268A: EB           XBA 
C2/268B: 29 F7        AND #$F7    (if we are, give immunity to Morph to make it permanent)
C2/268D: EB           XBA 
C2/268E: EB           XBA 
C2/268F: 9D 31 33     STA $3331,X (update blocked status #4)
C2/2692: BD 30 33     LDA $3330,X
C2/2695: EB           XBA 
C2/2696: BD 1D 33     LDA $331D,X (A.top=blocked status byte 3, A.btm=blocked status #2)
C2/2699: C2 20        REP #$20
C2/269B: 85 EE        STA $EE
C2/269D: BD 6C 3C     LDA $3C6C,X (monster/equip status bytes 2-3)
C2/26A0: 29 78 EE     AND #$EE78  (Dance, Stop, Sleep, Condemned, Near Fatal, Image will all be 0)
C2/26A3: 49 FF FF     EOR #$FFFF  (now they'll all be 1)
C2/26A6: 25 EE        AND $EE     (SO Blocked Statuses = what you were blocking before, plus
                                   whatever the enemy/equip has.  with the exception of the
                                   above.. which will only be blocked if they were before)
C2/26A8: 89 00 02     BIT #$0200
C2/26AB: F0 05        BEQ $26B2   (if Regen blocked, branch)
C2/26AD: 89 40 00     BIT #$0040
C2/26B0: D0 03        BNE $26B5   (if Seizure isn't blocked, branch)
C2/26B2: 29 BF FD     AND #$FDBF  (SO if either Regen or Seizure is blocked, block both.
                                   should explain Regen failing on Ribbon)
C2/26B5: E2 20        SEP #$20
C2/26B7: 9D 1D 33     STA $331D,X (update blocked status byte #2.  we'll update byte #3 below.)
C2/26BA: EB           XBA         (now examine #3)
C2/26BB: 89 04        BIT #$04
C2/26BD: F0 04        BEQ $26C3   (if Slow blocked, branch)
C2/26BF: 89 08        BIT #$08
C2/26C1: D0 02        BNE $26C5   (if Haste isn't blocked, branch)
C2/26C3: 29 F3        AND #$F3    (SO if either Slow or Haste is blocked, block 'em both.
                                   should explain Slow failing on RunningShoes)
C2/26C5: 9D D0 33     STA $3330,X (update blocked status byte #3)
C2/26C8: 60           RTS

C2/26C9 unknow

C2/26C9: A2 12        LDX #$12    (start from 6th enemy)
C2/26CB: 20 75 26     JSR $2675
C2/26CE: CA           DEX 
C2/26CF: CA           DEX 
C2/26D0: 10 F9        BPL $26CB   (and do function 2675 for everybody in the battle)
C2/26D2: 60           RTS 

C2/26D3 unknow

When called:
A Low = $B5
A High = $B6  (or in some cases like Tools, $B6 appears to hold just the 0-7 Tool index
               rather than the item #.  some of the Item code indirectly puts $3A7D
               in top of A, and i believe that holds the full item number.)

C2/26D3: DA           PHX
C2/26D4: 5A           PHY 
C2/26D5: 48           PHA 
C2/26D6: 64 BA        STZ $BA
C2/26D8: A2 40        LDX #$40
C2/26DA: 86 BB        STX $BB        (default to targeting byte just being
                                      Cursor Start on Enemy)
C2/26DC: A2 00        LDX #$00
C2/26DE: C9 1E        CMP #$1E
C2/26E0: B0 1F        BCS $2701      (branch if command >= 1Eh)
C2/26E2: AA           TAX 
C2/26E3: BF 8A 27 C2  LDA $C2278A,X  (get miscellaneous Command properties byte)
C2/26E7: 48           PHA 
C2/26E8: 29 E1        AND #$E1       (isolate Abort on Characters, Randomize Target, beat on
                                      corpses if no valid targets left, and Exclude Attacker
                                      From Targets properties)
C2/26EA: 85 BA        STA $BA     
C2/26EC: A3 01        LDA $01,S
C2/26EE: 29 18        AND #$18       (now check what will become Can Target Dead/Hidden Entities
                                      and Don't Retarget if Target Invalid)
C2/26F0: 4A           LSR 
C2/26F1: 04 BA        TSB $BA
C2/26F3: 8A           TXA 
C2/26F4: 0A           ASL 
C2/26F5: AA           TAX            (multiply command number by 2)
C2/26F6: BF 01 FE CF  LDA $CFFE01,X  
C2/26FA: 85 BB        STA $BB        (get the command's targeting from some table)
C2/26FC: 68           PLA 
C2/26FD: 29 06        AND #$06       (two second lowest bits from C2/278A determine
                                      what function to call next)
C2/26FF: AA           TAX 
C2/2700: EB           XBA            (now get spell # or miscellaneous index.. ex- it might
                                      indicate the item Number)
C2/2701: FC 82 27     JSR ($2782,X)
C2/2704: 68           PLA 
C2/2705: 7A           PLY 
C2/2706: FA           PLX 
C2/2707: 60           RTS 

C2/2708 unknow

C2/2708: A2 04        LDX #$04
C2/270A: DF 78 27 C2  CMP $C22778,X (is the tool or skean one that uses a spell?)
C2/270E: D0 06        BNE $2716     (if not, branch)
C2/2710: FF 7D 27 C2  SBC $C2277D,X (if yes, subtract constant to determine its spell number)
C2/2714: 80 37        BRA $274D     (see, certain Tools and Skeans just load spells to do their work)

				    (Bio Blaster will use spell 7D, Bio Blast
				     Flash will use spell 7E, Flash
				     Fire Skean will use spell 51h, Fire Skean
				     Water Edge will use spell 52, Water Edge
				     Bolt Edge will use spell 53, Bolt Edge        )

C2/2716: CA           DEX 
C2/2717: 10 F1        BPL $270A     (loop 5 times, provided we didn't jump out of the loop)
C2/2719: 38           SEC           (set Carry.. for check at C2/18BD ??)
C2/271A: 8D 11 34     STA $3411     (save item #)
C2/271D: 20 63 2B     JSR $2B63     (Multiply A by 30)
C2/2720: C2 10        REP #$10      (Set 16-bit X and Y)
C2/2722: AA           TAX 
C2/2723: BF 0E 50 D8  LDA $D8500E,X (Targeting byte)
C2/2727: 85 BB        STA $BB
C2/2729: BF 15 50 D8  LDA $D85015,X (Condition 1 when Item used)
C2/272D: 89 C2        BIT #$C2
C2/272F: D0 04        BNE $2735     (Branch if Death, Zombie, or Petrify set)
C2/2731: A9 08        LDA #$08
C2/2733: 14 BA        TRB $BA       (Clear Can Target Dead/Hidden Entities)
C2/2735: BF 12 50 D8  LDA $D85012,X (equipment spell byte.
                                      Bits 0-5: spell #
                                      Bit 6: cast randomly after weapon strike [handled
                                             elsewhere, shouldn't apply here]
                                      Bit 7: 1 = remove from inventory upon usage, 0 = nope)
C2/2739: E2 10        SEP #$10      (Set 8-bit X and Y)
C2/273B: 60           RTS 


C2/273C: C9 E6        CMP #$E6    (Carry is set if item # >= 230, Sprint Shoes?  i.e. it's
                                   Item type.  Carry won't be set for Equipment Magic)
C2/273E: 20 1A 27     JSR $271A
C2/2741: B0 C4        BCS $2707   (if it's a plain ol' Item, always deduct from inventory,
                                   and don't attempt to save the [meaningless] spell # or
                                   load spell data)
C2/2743: 30 06        BMI $274B   (branch if equipment gets used up when used for Item Magic.
                                   i'm not aware of any equipment this *doesn't* happen with,
                                   though the game supports it.)
C2/2745: EB           XBA 
C2/2746: A9 10        LDA #$10
C2/2748: 04 B1        TSB $B1     (set "don't deplete from Item inventory" flag)
C2/274A: EB           XBA 
C2/274B: 29 3F        AND #$3F    (isolate spell # cast by equipment)
C2/274D: 8D 10 34     STA $3410   (Magic and numerous other commands enter here)
C2/2750: 80 02        BRA $2754   (load spell data for [equipment] magic)


C2/2752: A9 EE        LDA #$EE    (select Spell EEh - Battle)
C2/2754: 20 66 29     JSR $2966   (go load spell data)
C2/2757: A5 BB        LDA $BB     (targeting byte as read from $CFFE01 table?)
C2/2759: 1A           INC        
C2/275A: D0 05        BNE $2761   (branch if it wasn't FF.. if it was, it's null, so we use
                                   the spell byte instead)
C2/275C: AD A0 11     LDA $11A0   (spell aiming byte)
C2/275F: 85 BB        STA $BB
C2/2761: AD A2 11     LDA $11A2   
C2/2764: 48           PHA 
C2/2765: 29 04        AND #$04    (Isolate bit 2.  This spell bit is used for two properties:
                                   Bit 2 of $11A2 will be "Hit only (dead XOR undead) targets",
                                   and Bit 3 of $BA will be "Can Target Dead/Hidden entities".)
C2/2767: 0A           ASL 
C2/2768: 04 BA        TSB $BA     (Sets Can Target Dead/Hidden entities)
C2/276A: A3 01        LDA $01,S   (get $11A2 again)
C2/276C: 29 10        AND #$10    (Randomize target)
C2/276E: 0A           ASL 
C2/276F: 0A           ASL 
C2/2770: 04 BA        TSB $BA     (Sets randomize target)
C2/2772: 68           PLA         (get $11A2 again)
C2/2773: 29 80        AND #$80    (Abort on characters)
C2/2775: 04 BA        TSB $BA     (Sets abort on characters)
C2/2777: 60           RTS 

C2/2778 data: items with related spells: tools and skean

(Data - item numbers of Tools and Skeans that use spells to do a good chunk
 of their work)
C2/2778: A4  (Bio Blaster)
C2/2779: A5  (Flash)
C2/277A: AB  (Fire Skean)
C2/277B: AC  (Water Edge)
C2/277C: AD  (Bolt Edge)

C2/277D data: constants to subtract from C2/2778 table

(Data - constants we subtract from the above item #s to get the numbers
 of the spells they rely on)
C2/277D: 27
C2/277E: 27
C2/277F: 5A
C2/2780: 5A
C2/2781: 5A

C2/2782 pointers

Code Pointers (indexed by bits 1 and 2 of data values below)
C2/2782: 52 27  (Fight, Morph, Revert, Steal, Capture, Runic, Sketch, Control, Leap, Mimic,
                 Row, Def, Jump, GP Rain, Possess)
C2/2784: 3C 27  (Item)
C2/2786: 4D 27  (Magic, SwdTech, Blitz, Lore, Slot, Rage, Dance, X-Magic, Summon, Health,
                 Shock, MagiTek)
C2/2788: 08 27  (Throw, Tools)

C2/278A pointers: commands

(Data - indexed by command # 0 thru 1Dh?)
C2/278A: 20   (Fight)
C2/278B: 1A   (Item)
C2/278C: 04   (Magic)
C2/278D: 18   (Morph)
C2/278E: 18   (Revert)
C2/278F: 00   (Steal)
C2/2790: 20   (Capture)
C2/2791: 24   (SwdTech)
C2/2792: 06   (Throw)
C2/2793: 06   (Tools)
C2/2794: 04   (Blitz)
C2/2795: 18   (Runic)
C2/2796: 04   (Lore)
C2/2797: 80   (Sketch)
C2/2798: 80   (Control)
C2/2799: 04   (Slot)
C2/279A: 04   (Rage)
C2/279B: 80   (Leap)
C2/279C: 18   (Mimic)
C2/279D: 04   (Dance)
C2/279E: 18   (Row)
C2/279F: 18   (Def)
C2/27A0: 21   (Jump)
C2/27A1: 04   (X-Magic)
C2/27A2: 01   (GP Rain)
C2/27A3: 04   (Summon)
C2/27A4: 04   (Health)
C2/27A5: 04   (Shock)
C2/27A6: 81   (Possess)
C2/27A7: 04   (MagiTek)

C2/27A8 unknow

C2/27A8: 08           PHP
C2/27A9: C2 30        REP #$30    (Set 16-bit Accumulator & Index Registers)
C2/27AB: BC 10 30     LDY $3010,X (get offset to character info block)
C2/27AE: B9 09 16     LDA $1609,Y (get current HP)
C2/27B1: 9D F4 3B     STA $3BF4,X (HP)
C2/27B4: B9 0D 16     LDA $160D,Y (get current MP)
C2/27B7: 9D 08 3C     STA $3C08,X (MP)
C2/27BA: B9 0B 16     LDA $160B,Y (get maximum HP)
C2/27BD: 20 3C 28     JSR $283C   (get max HP after equipment/relic boosts)
C2/27C0: C9 10 27     CMP #$2710
C2/27C3: 90 03        BCC $27C8
C2/27C5: A9 0F 27     LDA #$270F  (if it was >= 10000, make it 9999)
C2/27C8: 9D 1C 3C     STA $3C1C,X (Max HP)
C2/27CB: B9 0F 16     LDA $160F,Y (get maximum MP)
C2/27CE: 20 3C 28     JSR $283C   (get max MP after equipment/relic boosts)
C2/27D1: C9 E8 03     CMP #$03E8
C2/27D4: 90 03        BCC $27D9
C2/27D6: A9 E7 03     LDA #$03E7  (if it was >= 1000, make it 999)
C2/27D9: 9D 30 3C     STA $3C30,X (Max MP)
C2/27DC: BD 18 30     LDA $3018,X
C2/27DF: 24 B8        BIT $B8
C2/27E1: F0 15        BEQ $27F8
C2/27E3: BD 1C 3C     LDA $3C1C,X (Max HP)
C2/27E6: 9D F4 3B     STA $3BF4,X (HP)
C2/27E9: BD 30 3C     LDA $3C30,X (Max MP)
C2/27EC: 9D 08 3C     STA $3C08,X (MP)
C2/27EF: B9 14 16     LDA $1614,Y (outside battle statuses 1-2?  from tashibana doc)
                                  (^ statuses correspond to in-battle statuses 1+4)
C2/27F2: 29 2D FF     AND #$FF2D
C2/27F5: 99 14 16     STA $1614,Y  (remove Clear, Petrify, death, zombie..  Colosseum related?)
C2/27F8: BD 6C 3C     LDA $3C6C,X  (monster/equip status bytes 2-3)
C2/27FB: E2 20        SEP #$20    (Set 8-bit Accumulator)
C2/27FD: 9D D5 3D     STA $3DD5,X (Status to set byte 2)
C2/2800: 4A           LSR 
C2/2801: 90 08        BCC $280B   (branch if Condemned not marked to be set)
C2/2803: BD 04 32     LDA $3204,X
C2/2806: 29 EF        AND #$EF
C2/2808: 9D 04 32     STA $3204,X (^ if it is going to be set, then turn off Bit 4)
C2/280B: B9 14 16     LDA $1614,Y
C2/280E: 9D D4 3D     STA $3DD4,X (Status to set byte 1)
C2/2811: 89 08        BIT #$08
C2/2813: F0 0A        BEQ $281F   (If not set M-Tek)
C2/2815: A9 1D        LDA #$1D
C2/2817: 8D 20 3F     STA $3F20   (save MagiTek as default last command for Mimic)
C2/281A: A9 83        LDA #$83
C2/281C: 8D 21 3F     STA $3F21   (save Fire Beam as default last attack for Mimic)
                                  (if Gogo uses Mimic before any other character acts in a
                                   battle, he'll normally use Fight.  all i can figure is that
                                   this code is here to make him use Fire Beam instead should
                                   anybody be found to be wearing MagiTek armor -- in the normal
                                   game, we can assume that if anybody's in armor, everybody
                                   [including Gogo] is in it.)

C2/281F: B9 15 16     LDA $1615,Y (outside battle status 2?  corresponds to
                                   in-battle status byte 4)
C2/2822: 29 C0        AND #$C0    (only keep Dog Block and Float)
C2/2824: EB           XBA         (get monster/equip status byte 3)
C2/2825: 4A           LSR         (shift out the lowest bit - Dance)
C2/2826: 90 04        BCC $282C   (branch if Dance aka Permanent Float isn't set)
C2/2828: EB           XBA         
C2/2829: 09 80        ORA #$80    (turn on Float in status byte 4)
C2/282B: EB           XBA 
C2/282C: 0A           ASL         (shift monster/equip status byte 3 back up, zeroing the
                                   lowest bit)
C2/282D: 9D E8 3D     STA $3DE8,X (Status to set byte 3)
C2/2830: EB           XBA 
C2/2831: 9D E9 3D     STA $3DE9,X (Status to set byte 4)
C2/2834: B9 08 16     LDA $1608,Y
C2/2837: 9D 18 3B     STA $3B18,X (Level)
C2/283A: 28           PLP 
C2/283B: 60           RTS 

C2/283C apply equipment boost to HP or MP

(Apply percentage boost to HP or MP.  Bit 14 set = 25% boost,
 Bit 15 set = 50% boost, Both of those bits set = 12.5% boost)
C2/283C: DA           PHX
C2/283D: 0A           ASL 
C2/283E: 2A           ROL 
C2/283F: 85 EE        STA $EE
C2/2841: 2A           ROL 
C2/2842: 2A           ROL         (Bit 15 is now in Bit 2, and Bit 14 is in Bit 1)
C2/2843: 29 06 00     AND #$0006  (isolate Bits 1 and 2)
C2/2846: AA           TAX         (and use them as function pointer)
C2/2847: A5 EE        LDA $EE
C2/2849: 4A           LSR 
C2/284A: 4A           LSR 
C2/284B: 85 EE        STA $EE     (all that crazy shifting was equivalent to
                                   $EE = A AND 16383.  gotta love Square =] )
C2/284D: 7C 59 28     JMP ($2859,X)

C2/2850 generic boost calculation

(Boost A by some fraction, if any)
C2/2850: 7B           TDC      (enter here for A = 0 + $EE)
C2/2851: 4A           LSR      (enter here for A = (A * 1/8) + $EE)
C2/2852: 4A           LSR      (enter here for A = (A * 1/4) + $EE)
C2/2853: 4A           LSR      (enter here for A = (A * 1/2) + $EE)
C2/2854: 18           CLC
C2/2855: 65 EE        ADC $EE
C2/2857: FA           PLX 
C2/2858: 60           RTS 

C2/2859 pointers: boosts formulae

C2/2859: 50 28  (A = A) (technically, A = $EE, but it's the same deal.)
C2/285B: 52 28  (A = A + (A * 1/4) )
C2/285D: 53 28  (A = A + (A * 1/2) )
C2/285F: 51 28  (A = A + (A * 1/8) )

C2/2861 math: A = 255 - (A * 2) + 1

(A = 255 - (A * 2) + 1
 If A was >= 128 to start with, then A = 1.
 If A was 0 to start with, then A ends up as 255.)
C2/2861: 0A           ASL
C2/2862: 90 02        BCC $2866
C2/2864: A9 FF        LDA #$FF
C2/2866: 49 FF        EOR #$FF
C2/2868: 1A           INC 
C2/2869: D0 01        BNE $286C
C2/286B: 3A           DEC 
C2/286C: 60           RTS 

C2/286D initialize battle characters: add equipments proprieties

(Initialize in-battle character properties from equipment properties.
 A lot of the equipment bytes in this function were explained in C2/0E77, C2/0F9A, and C2/10B2,
 so consult those functions.  Terii's Offsets List at http://www.rpglegion.com/ff6/hack/offset2.txt
 is another great resource.)
C2/286D: 0B           PHD
C2/286E: F4 00 11     PEA $1100         (Set direct page register 11 $1100)
C2/2871: 2B           PLD 
C2/2872: A5 C9        LDA $C9 ($11C9)
C2/2874: C9 9F        CMP #$9F          (Moogle Suit in character's Armor slot?)
C2/2876: D0 0B        BNE $2883         (if not, branch)
C2/2878: 8A           TXA
C2/2879: 0A           ASL
C2/287A: 0A           ASL
C2/287B: 0A           ASL
C2/287C: 0A           ASL
C2/287D: A8           TAY
C2/287E: A9 0A        LDA #$0A
C2/2880: 99 AE 2E     STA $2EAE,Y       (Use Mog's sprite?)
C2/2883: 8A           TXA 
C2/2884: 4A           LSR 
C2/2885: A8           TAY 
C2/2886: A5 D8        LDA $D8 ($11D8)
C2/2888: 29 10        AND #$10
C2/288A: 99 6E 2E     STA $2E6E,Y       (store Genji Glove effect.  this variable is used in Bank C1,
                                         apparently to check for Genji Glove's presence when handling
                                         mid-battle equipment changes via the Item menu.)
C2/288D: 18           CLC 
C2/288E: A5 A6        LDA $A6 ($11A6)
C2/2890: 65 A6        ADC $A6 ($11A6)   (add Vigor to itself)
C2/2892: 90 02        BCC $2896         (branch if it's under 256)
C2/2894: A9 FF        LDA #$FF          (else make it 255)
C2/2896: 9D 2C 3B     STA $3B2C,X       (store Vigor * 2)
C2/2899: A5 A4        LDA $A4 ($11A4)   (Speed)
C2/289B: 9D 2D 3B     STA $3B2D,X 
C2/289E: 9D 19 3B     STA $3B19,X
C2/28A1: A5 A2        LDA $A2 ($11A2)   (Stamina)
C2/28A3: 9D 40 3B     STA $3B40,X
C2/28A6: A5 A0        LDA $A0 ($11A0)   (Magic Power)
C2/28A8: 9D 41 3B     STA $3B41,X
C2/28AB: A5 A8        LDA $A8 ($11A8)
C2/28AD: 20 61 28     JSR $2861
C2/28B0: 9D 54 3B     STA $3B54,X      ( 255 - (Evade * 2) + 1 , capped at low of 1 and high of 255 )
C2/28B3: A5 AA        LDA $AA ($11AA)
C2/28B5: 20 61 28     JSR $2861
C2/28B8: 9D 55 3B     STA $3B55,X      ( 255 - (MBlock * 2) + 1 , capped at low of 1 and high of 255 )
C2/28BB: A5 CF        LDA $CF ($11CF)  
C2/28BD: 14 D8        TRB $D8 ($11D8)  (clear Genji Glove effect from "Battle Effects 2" if its bit
                                        was ON in $11CF [i.e. if both hands hold a weapon].  yes, this
                                        reeks of a bug.  likely, they instead wanted the GG effect
                                        cleared only when one or zero hands held a weapon.)
C2/28BF: A5 BC        LDA $BC ($11BC)
C2/28C1: 9D 6C 3C     STA $3C6C,X      (Equipment status byte 2)
C2/28C4: A5 D4        LDA $D4 ($11D4)
C2/28C6: 9D 6D 3C     STA $3C6D,X      (Equipment status byte 3)
C2/28C9: A5 DC        LDA $DC ($11DC)
C2/28CB: 9D 71 3D     STA $3D71,X      (Amount to add to character's "Run Success" variable.  has range
                                        of 2 thru 5.  higher means that, on average, they can run away
                                        quicker from battle.)
C2/28CE: A5 D9        LDA $D9 ($11D9)
C2/28D0: 29 80        AND #$80         (undead bit from relic ring)
C2/28D2: 09 10        ORA #$10         (always set Human for party members)
C2/28D4: 9D 95 3C     STA $3C95,X      (save in "Special Byte 3")
C2/28D7: A5 D5        LDA $D5 ($11D5)
C2/28D9: 0A           ASL              (A = 0, raise attack dmg, double earring, hp+25%, hp+50,
                                        hp+12.5, mp+25, mp+50)  (carry = mp+12.5)
C2/28DA: EB           XBA 
C2/28DB: A5 D6        LDA $D6 ($11D6)
C2/28DD: 0C 6D 3A     TSB $3A6D        (combine with existing "Battle Effects 1" properties)  
C2/28E0: 0A           ASL              (carry = jump continously)
C2/28E1: A5 D7        LDA $D7 ($11D7)
C2/28E3: EB           XBA 
C2/28E4: 6A           ROR              (Top half A [will be $3C45] = $11D7 =
                                        boost steal, single Earring, boost sketch,
                                        boost control, sniper sight, gold hairpin,
                                        economizer, vigor + 50%

                                        Bottom half [will be $3C44] = raise attack dmg,
                                        double Earring, hp+25%, hp+50%, hp+12.5%, mp+25%,
                                        mp+50%, jump continuously.  The HP/MP bonuses
                                        were already read from $11D5 earlier, so they're
                                        essentially junk in $3C44.  All that's read are
                                        Bits 0, 1, and 7.)

C2/28E5: C2 20        REP #$20         (Set 16-bit Accumulator)
C2/28E7: 9D 44 3C     STA $3C44,X
C2/28EA: A5 AC        LDA $AC ($11AC)
C2/28EC: 9D 68 3B     STA $3B68,X      ($3B68 = battle power for 1st hand,
                                        $3B69 = bat pwr for 2nd hand)
C2/28EF: A5 AE        LDA $AE ($11AE)
C2/28F1: 9D 7C 3B     STA $3B7C,X      (hit rate)
C2/28F4: A5 B4        LDA $B4 ($11B4)  
C2/28F6: 9D 34 3D     STA $3D34,X      (random weapon spellcast, for both hands)
C2/28F9: A5 B0        LDA $B0 ($11B0)
C2/28FB: 9D 90 3B     STA $3B90,X      (elemental properties of weapon)
C2/28FE: A5 D8        LDA $D8 ($11D8)
C2/2900: 89 08 00     BIT #$0008       (is Gauntlet bit set?)
C2/2903: D0 05        BNE $290A
C2/2905: A9 40 40     LDA #$4040       (if it's not, turn off 2-hand effect
                                        for both hands)
C2/2908: 14 DA        TRB $DA ($11DA)
C2/290A: A5 DA        LDA $DA ($11DA)
C2/290C: 9D A4 3B     STA $3BA4,X      (save "Weapon effects")
C2/290F: A5 BA        LDA $BA ($11BA)
C2/2911: 9D B8 3B     STA $3BB8,X      (bottom = Defense, top = Magic Defense)
C2/2914: A9 FF FF     LDA #$FFFF
C2/2917: 9D 1C 33     STA $331C,X      (Status Immunity Bytes 1 and 2: character is vulnerable
                                        to everything -- i.e. immune to nothing)
C2/291A: 45 D2        EOR $D2 ($11D2)  (equipment immunities)
C2/291C: 9D 1C 33     STA $331C,X      (for Immunity Bytes 1-2, character is now vulnerable to
                                        whatever the equipment doesn't block)
C2/291F: A5 B6        LDA $B6 ($11B6)
C2/2921: 9D CC 3B     STA $3BCC,X      (bottom = absorbed elements, top = nullified elements)
C2/2924: A5 B8        LDA $B8 ($11B8)   
C2/2926: 9D E0 3B     STA $3BE0,X      (bottom = weak elements, top = 50% resist elements)   
C2/2929: A5 BE        LDA $BE ($11BE)
C2/292B: 9D BC 3C     STA $3CBC,X      (bottom = special action for right hand,
                                        top = special action for left hand)
C2/292E: A5 C6        LDA $C6 ($11C6)  (item # of equipment in both hands)
C2/2930: 9D A8 3C     STA $3CA8,X
C2/2933: A5 CA        LDA $CA ($11CA)  (item # of equipment in both relic slots)
C2/2935: 9D D0 3C     STA $3CD0,X
C2/2938: A5 D0        LDA $D0 ($11D0)
C2/293A: 9D E4 3C     STA $3CE4,X      (deals with weapon and shield animation for blocking
                                        magical and physical attacks)
C2/293D: A5 D8        LDA $D8 ($11D8)
C2/293F: 9D 58 3C     STA $3C58,X      (save "Battle Effects 2")
C2/2942: E2 20        SEP #$20         (Set 8-bit Accumulator)
C2/2944: 1E 21 3A     ASL $3A21,X      (Bit X is set, where X is the actual character # of this
                                        onscreen character.  corresponding bits are set in Items
                                        to see if they're equippable.  shift out the top bit, as
                                        that corresponds to "heavy" merit awardable equipment and
                                        will be set below)
C2/2947: 0A           ASL             
C2/2948: 0A           ASL 
C2/2949: 0A           ASL              (rotate "wearer can equip heavy armor" bit from
                                        Battle Effects 2 into carry bit)
C2/294A: 7E 21 3A     ROR $3A21,X      (now put it in "character # for purposes of equipping" byte)
C2/294D: 2B           PLD 
C2/294E: 4C 50 26     JMP $2650        (deal with Instant Death protection, and Poison elemental
                                        nullification giving immunity to Poison status)


C2/2951: AD A2 11     LDA $11A2
C2/2954: 4A           LSR
C2/2955: BD 41 3B     LDA $3B41,X      (magic power * 1.5)
C2/2958: 90 03        BCC $295D        (Branch if not physical attack)
C2/295A: BD 2C 3B     LDA $3B2C,X      (vigor * 2)
C2/295D: 8D AE 11     STA $11AE
C2/2960: 9C 89 3A     STZ $3A89        (turn off random weapon spellcast)
C2/2963: 4C 21 2C     JMP $2C21

C2/2966 load spell data

(Load spell data)
C2/2966: DA           PHX
C2/2967: 08           PHP 
C2/2968: EB           XBA 
C2/2969: A9 0E        LDA #$0E     
C2/296B: 20 81 47     JSR $4781    (length of spell data * spell #)
C2/296E: C2 31        REP #$31     (Set 16-bit A, X, Y.  Clear carry flag)
C2/2970: 69 C0 6A     ADC #$6AC0   (spells start at 46CC0 ROM offset, or C4/6AC0)
C2/2973: AA           TAX 
C2/2974: A0 A0 11     LDY #$11A0
C2/2977: A9 0D 00     LDA #$000D
C2/297A: 54 7E C4     MVN #$C4,7E  (copy 14 spell bytes into RAM)
C2/297D: E2 20        SEP #$20
C2/297F: 0E A9 11     ASL $11A9    (multiply special effect by 2)
C2/2982: 90 03        BCC $2987   
C2/2984: 9C A9 11     STZ $11A9    (if it exceeded 255, make it 0)
C2/2987: 28           PLP 
C2/2988: FA           PLX 
C2/2989: 60           RTS 

C2/298A load command data

(Loads command data, clears special effect, sets unblockable, sets Level to 0,
 sets Vigor/Mag. Pwr to 0)
C2/298A: AD 7C 3A     LDA $3A7C
C2/298D: 20 D3 26     JSR $26D3
C2/2990: A9 20        LDA #$20
C2/2992: 0C A4 11     TSB $11A4   (Set Unblockable)
C2/2995: 9C A9 11     STZ $11A9   (Clear special effects)
C2/2998: 9C AF 11     STZ $11AF   (Set Level to 0)
C2/299B: 9C AE 11     STZ $11AE   (Set Vigor / M. Power to 0)
C2/299E: 60           RTS 

C2/299F load weapon data

(Load weapon data into attack data.  Also handles Offering, Sniper Sight, etc)
C2/299F: 08           PHP
C2/29A0: BD 2C 3B     LDA $3B2C,X
C2/29A3: 8D AE 11     STA $11AE   (Vigor * 2 / Magic Power)
C2/29A6: 20 21 2C     JSR $2C21
C2/29A9: BD 45 3C     LDA $3C45,X
C2/29AC: 89 10        BIT #$10
C2/29AE: F0 05        BEQ $29B5   (If no Sniper Sight)
C2/29B0: A9 20        LDA #$20
C2/29B2: 0C A4 11     TSB $11A4   (Sets Can't be Dodged)
C2/29B5: A5 B6        LDA $B6
C2/29B7: C9 EF        CMP #$EF
C2/29B9: D0 0C        BNE $29C7   (Branch if not Special)
C2/29BB: BD E4 3E     LDA $3EE4,X
C2/29BE: 89 20        BIT #$20    (Check for Imp status)
C2/29C0: D0 05        BNE $29C7   (if an Imp, branch)
C2/29C2: A9 06        LDA #$06
C2/29C4: 8D 12 34     STA $3412   
C2/29C7: 28           PLP 
C2/29C8: DA           PHX 
C2/29C9: 66 B6        ROR $B6     (if carry was set going into function, this is an
                                   odd-numbered attack of sequence, related to $3A70..
                                   top bit of $B6 will be used in animation:
                                   Clear = right hand, Set = left hand)

C2/29CB: 10 01        BPL $29CE   (if Carry wasn't set, branch and use right hand)
C2/29CD: E8           INX         (if it was, point to left weapon hand)
C2/29CE: BD 68 3B     LDA $3B68,X 
C2/29D1: 8D A6 11     STA $11A6   (Battle Power)
C2/29D4: A9 62        LDA #$62
C2/29D6: 04 B3        TSB $B3     (turn off Always Critical and Gauntlet.  Turn on
                                   ignore attacker row)
C2/29D8: BD A4 3B     LDA $3BA4,X
C2/29DB: 29 60        AND #$60    (isolate "Same damage from back row" and "2-hand" properties)
C2/29DD: 49 20        EOR #$20    (flip "Same damage from back row" to get "Damage affected
                                   by attacker row")
C2/29DF: 14 B3        TRB $B3     (Bit 6 = 0 for Gauntlet [2-hand] and Bit 5 = 0 for
                                   "Damage affected by attacker row")
C2/29E1: BD 90 3B     LDA $3B90,X
C2/29E4: 8D A1 11     STA $11A1   (Element)
C2/29E7: BD 7C 3B     LDA $3B7C,X
C2/29EA: 8D A8 11     STA $11A8   (Hit Rate)
C2/29ED: BD 34 3D     LDA $3D34,X
C2/29F0: 8D 89 3A     STA $3A89   (random weapon spellcast)
C2/29F3: BD BC 3C     LDA $3CBC,X
C2/29F6: 29 F0        AND #$F0
C2/29F8: 4A           LSR 
C2/29F9: 4A           LSR 
C2/29FA: 4A           LSR 
C2/29FB: 8D A9 11     STA $11A9   (Special effect)
C2/29FE: BD A8 3C     LDA $3CA8,X (Get equipment in current hand)
C2/2A01: 1A           INC 
C2/2A02: 85 B7        STA $B7
C2/2A04: FA           PLX 
C2/2A05: BD 58 3C     LDA $3C58,X (Check for offering)
C2/2A08: 4A           LSR 
C2/2A09: 90 10        BCC $2A1B   (Branch if no Offering)
C2/2A0B: A9 20        LDA #$20
C2/2A0D: 0C A4 11     TSB $11A4   (Set Can't be dodged)
C2/2A10: A9 40        LDA #$40
C2/2A12: 04 BA        TSB $BA     (Sets randomize target)
C2/2A14: A9 02        LDA #$02
C2/2A16: 04 B2        TSB $B2     (Set no critical and ignore True Knight)
C2/2A18: 9C 89 3A     STZ $3A89   (Turn off random spellcast)
C2/2A1B: AD A6 11     LDA $11A6
C2/2A1E: F0 16        BEQ $2A36   (Exit if 0 Battle Power)
C2/2A20: E0 08        CPX #$08
C2/2A22: 90 12        BCC $2A36   (Exit if character)
C2/2A24: A9 20        LDA #$20
C2/2A26: 3C E4 3E     BIT $3EE4,X
C2/2A29: F0 0B        BEQ $2A36   (Exit if not Imp)
C2/2A2B: 0A           ASL 
C2/2A2C: 3C 95 3C     BIT $3C95,X (Check for auto critical if Imp)
C2/2A2F: D0 05        BNE $2A36   (If set then exit)
C2/2A31: A9 01        LDA #$01
C2/2A33: 8D A6 11     STA $11A6   (Set Battle Power to 1)
C2/2A36: 60           RTS 

C2/2A37 item usage setup

(Item usage setup.  Used for Items, Skeans, Tools?)
(Going in: A = Item number.
  Carry flag = Command >= 2.  It's set for Magic or Throw or Tools, but not plain Item.)
C2/2A37: DA           PHX
C2/2A38: 08           PHP 
C2/2A39: 48           PHA 
C2/2A3A: DA           PHX 
C2/2A3B: A2 0F        LDX #$0F
C2/2A3D: 9E A0 11     STZ $11A0,X   (zero out all spell data -related bytes)
C2/2A40: CA           DEX 
C2/2A41: 10 FA        BPL $2A3D
C2/2A43: FA           PLX 
C2/2A44: A9 21        LDA #$21
C2/2A46: 8D A2 11     STA $11A2     (Set to ignore defense, physical attack)
C2/2A49: A9 22        LDA #$22
C2/2A4B: 8D A3 11     STA $11A3     (Set attack to retarget if target dead, not reflectable)
C2/2A4E: A9 20        LDA #$20
C2/2A50: 8D A4 11     STA $11A4     (Set to unblockable)
C2/2A53: 90 09        BCC $2A5E     (branch if not Skean or Item Magic or Tools)
C2/2A55: BD 2C 3B     LDA $3B2C,X
C2/2A58: 8D AE 11     STA $11AE     (Vigor * 2 or Magic Power)
C2/2A5B: 20 21 2C     JSR $2C21
C2/2A5E: A3 01        LDA $01,S
C2/2A60: 20 63 2B     JSR $2B63     (Multiply A by 30)
C2/2A63: C2 10        REP #$10      (Set 16-bit X and Y)
C2/2A65: AA           TAX 
C2/2A66: BF 14 50 D8  LDA $D85014,X (Item "HP/MP affected", aka power)
C2/2A6A: 8D A6 11     STA $11A6
C2/2A6D: BF 0F 50 D8  LDA $D8500F,X (Item's element)
C2/2A71: 8D A1 11     STA $11A1
C2/2A74: B0 66        BCS $2ADC     (branch if Skean or Item Magic or Tools)
C2/2A76: A9 01        LDA #$01
C2/2A78: 1C A2 11     TRB $11A2     (Sets to magical attack)
C2/2A7B: BF 1B 50 D8  LDA $D8501B,X (item special action)
C2/2A7F: 0A           ASL 
C2/2A80: B0 05        BCS $2A87     (Branch if top bit set, i.e. no action, usually FFh)
C2/2A82: 69 90        ADC #$90      
C2/2A84: 8D A9 11     STA $11A9     (Else store 90h + (action*2) in special effect)
C2/2A87: C2 20        REP #$20      (set 16-bit accumulator)
C2/2A89: BF 15 50 D8  LDA $D85015,X (Item conditions 1+2 when used)
C2/2A8D: 8D AA 11     STA $11AA
C2/2A90: BF 17 50 D8  LDA $D85017,X (Item conditions 3+4 when used)
C2/2A94: 8D AC 11     STA $11AC
C2/2A97: E2 20        SEP #$20      (Set 8-bit accumulator)
C2/2A99: BF 13 50 D8  LDA $D85013,X (Get Item Properties)
C2/2A9D: 85 FE        STA $FE
C2/2A9F: 06 FE        ASL $FE       (Does it manipulate 1/16th of actual values?)
C2/2AA1: 90 05        BCC $2AA8     (If not ^, branch)
C2/2AA3: A9 80        LDA #$80
C2/2AA5: 0C A4 11     TSB $11A4     (Set bit to take HP at fraction of spell byte 7)
C2/2AA8: 06 FE        ASL $FE
C2/2AAA: 06 FE        ASL $FE
C2/2AAC: 90 05        BCC $2AB3     (If item doesn't remove status conditions, branch)
C2/2AAE: A9 04        LDA #$04     
C2/2AB0: 0C A4 11     TSB $11A4     (Set remove status spell bit)
C2/2AB3: 06 FE        ASL $FE
C2/2AB5: 90 07        BCC $2ABE     (Branch if "restore MP" item bit unset)
C2/2AB7: A9 80        LDA #$80
C2/2AB9: 0C A3 11     TSB $11A3     (Set spell to concern MP)
C2/2ABC: 04 FE        TSB $FE       (And automatically set "restore HP" in item properties,
                                     so MP-related items always try to give MP, not take it)
C2/2ABE: 06 FE        ASL $FE
C2/2AC0: 90 05        BCC $2AC7     (Branch if "restore HP" (or restore MP) bit unset)
C2/2AC2: A9 01        LDA #$01
C2/2AC4: 0C A4 11     TSB $11A4     (Set Heal spell bit)
C2/2AC7: 06 FE        ASL $FE
C2/2AC9: 06 FE        ASL $FE
C2/2ACB: 90 05        BCC $2AD2     (Branch if Item doesn't reverse damage on undead)
C2/2ACD: A9 08        LDA #$08
C2/2ACF: 0C A2 11     TSB $11A2     (Sets Cures undead)
C2/2AD2: AD AA 11     LDA $11AA
C2/2AD5: 10 05        BPL $2ADC     (Branch if not death attack)
C2/2AD7: A9 0C        LDA #$0C
C2/2AD9: 0C A2 11     TSB $11A2     (Sets Cures undead and Hit only (dead XOR undead) targets)

C2/2ADC: A3 01        LDA $01,S
C2/2ADE: C9 AE        CMP #$AE      (Item number 174 - Inviz Edge?)
C2/2AE0: D0 07        BNE $2AE9     (branch if not)
C2/2AE2: A9 10        LDA #$10
C2/2AE4: 0C AA 11     TSB $11AA     (Set Clear effect to attack)
C2/2AE7: 80 09        BRA $2AF2
C2/2AE9: C9 AF        CMP #$AF      (Item number 175 - Shadow Edge?)
C2/2AEB: D0 05        BNE $2AF2     (branch if not)
C2/2AED: A9 04        LDA #$04
C2/2AEF: 0C AB 11     TSB $11AB     (Set Image effect to attack)

(NOTE: special Inviz and Shadow Edge checks are needed because much code
 [including that at C2/2A89 that normally loads statuses] is skipped if we're
 doing Throw or Item Magic)

C2/2AF2: BF 00 50 D8  LDA $D85000,X (Item type)
C2/2AF6: 29 07        AND #$07
C2/2AF8: D0 1C        BNE $2B16     (If item's not a Tool, branch)
C2/2AFA: A9 20        LDA #$20
C2/2AFC: 1C A2 11     TRB $11A2     (Clears ignore defense)
C2/2AFF: 1C A4 11     TRB $11A4     (Clears unblockable)
C2/2B02: BF 15 50 D8  LDA $D85015,X  
C2/2B06: 8D A8 11     STA $11A8     (Get and store hitrate)
C2/2B09: 7B           TDC 
C2/2B0A: A3 01        LDA $01,S   (get item #.  number of first tool [NoiseBlaster] is A3h)
C2/2B0C: 38           SEC 
C2/2B0D: E9 A3        SBC #$A3
C2/2B0F: 29 07        AND #$07   (subtract 163 from item # and use bottom 3 bits to get a
                                  "tool number" of 0-7)
C2/2B11: 0A           ASL        (multiply it by 2 to index table below)
C2/2B12: AA           TAX 
C2/2B13: FC 1A 2B     JSR ($2B1A,X)   (load Tool's miscellaneous effect)
C2/2B16: 68           PLA 
C2/2B17: 28           PLP 
C2/2B18: FA           PLX 
C2/2B19: 60           RTS 

C2/2B1A pointers: tools table

C2/2B1A: 2A 2B     (Noise Blaster)
C2/2B1C: 2F 2B     (Bio Blaster) (do nothing)
C2/2B1E: 2F 2B     (Flash) (do nothing)
C2/2B20: 30 2B     (Chainsaw)
C2/2B22: 53 2B     (Debilitator)
C2/2B24: 4D 2B     (Drill)
C2/2B26: 57 2B     (Air Anchor)
C2/2B28: 5D 2B     (Autocrossbow)

C2/2B2A tools: noiseblaster

C2/2B2A: A9 20        LDA #$20
C2/2B2C: 8D AB 11     STA $11AB   (Set Muddled in attack data)
C2/2B2F: 60           RTS

C2/2B30 tools: chainsaw

C2/2B30: 20 5A 4B     JSR $4B5A   (0 to 255)
C2/2B33: 29 03        AND #$03
C2/2B35: D0 16        BNE $2B4D   (75% chance)
C2/2B37: A9 08        LDA #$08
C2/2B39: 85 B6        STA $B6     (Animation)
C2/2B3B: 9C A6 11     STZ $11A6   (Battle power)
C2/2B3E: A9 80        LDA #$80
C2/2B40: 0C AA 11     TSB $11AA   (Set death status)
C2/2B43: A9 10        LDA #$10    
C2/2B45: 8D A4 11     STA $11A4   (Set stamina can block)
C2/2B48: A9 02        LDA #$02
C2/2B4A: 0C A2 11     TSB $11A2   (Set miss if death prot.)
C2/2B4D: A9 20        LDA #$20
C2/2B4F: 0C A2 11     TSB $11A2   (Set ignore defense)
C2/2B52: 60           RTS 

C2/2B53 tools: debilitator

C2/2B53: A9 AC        LDA #$AC
C2/2B55: 80 02        BRA $2B59   (Set Debilitator effect)

C2/2B57 tools: air anchor

C2/2B57: A9 AE        LDA #$AE    (Add Air Anchor effect)
C2/2B59: 8D A9 11     STA $11A9
C2/2B5C: 60           RTS 

C2/2B5D tools: autocrossbow

C2/2B5D: A9 40        LDA #$40
C2/2B5F: 0C A2 11     TSB $11A2   (Set no split damage)
C2/2B62: 60           RTS 

C2/2B63 math: A = A * 30

C2/2B63: EB           XBA
C2/2B64: A9 1E        LDA #$1E
C2/2B66: 4C 81 47     JMP $4781

C2/2B69 magic damage calculation

$11B0 = (Spell Power * 4) + (Level * Magic Power * Spell Power) / 32
(If Level of 0 is passed, $11B0 = Spell Power)

NOTE: Unlike damage modification functions, this one does NOTHING to make sure damage
doesn't exceed 65535.  That means with a spell like Ultima, a character at level 99
who has reached 140+ Magic Power via Esper bonuses and equipment will do only
triple-digit damage.

C2/2B69: AD AF 11     LDA $11AF   (Level)
C2/2B6C: 85 E8        STA $E8
C2/2B6E: C9 01        CMP #$01
C2/2B70: 7B           TDC         (Clear 16-bit A)
C2/2B71: AD A6 11     LDA $11A6   (Spell Power)
C2/2B74: C2 20        REP #$20    (Set 16-bit Accumulator)
C2/2B76: 90 02        BCC $2B7A   (If Level > 0, Spell Power *= 4)
C2/2B78: 0A           ASL 
C2/2B79: 0A           ASL 
C2/2B7A: 8D B0 11     STA $11B0   (Maximum Damage)
C2/2B7D: E2 20        SEP #$20    (Set 8-bit Accumulator)
C2/2B7F: AD AE 11     LDA $11AE   (Magic Power)
C2/2B82: EB           XBA 
C2/2B83: AD A6 11     LDA $11A6   (Spell Power)
C2/2B86: 20 81 47     JSR $4781   (Multiplication Function)
C2/2B89: 20 B7 47     JSR $47B7   (Multiplication Function 2)
C2/2B8C: A9 04        LDA #$04
C2/2B8E: C2 20        REP #$20    (Set 16-bit Accumulator)
C2/2B90: 20 D1 0D     JSR $0DD1   (Divide 24-bit Damage by 32.  [note the
                                   division operates on 4 bytes] )
C2/2B93: 18           CLC 
C2/2B94: 6D B0 11     ADC $11B0   (Maximum Damage)
C2/2B97: 8D B0 11     STA $11B0   (Maximum Damage)
C2/2B9A: E2 20        SEP #$20    (Set 8-bit Accumulator)
C2/2B9C: 60           RTS 

C2/2B9D physical damage calculation

Physical Damage Calculation:
X = Determines if monster or player

Results:

For characters:
If Gauntlet equipped, treat Battle Power as 7/4 its normal value.
Attack = Battle Power + (Vigor * 2).  Vigor * 2 is capped at 255. 
$11B0 = Battle Power + ( (Level * Level * Attack) DIV 256 ) * 3/2

For monsters:
Vigor is Random number 56 to 63
Attack = (Battle Power * 4) + Vigor
$11B0 = (Level * Level * Attack) DIV 256

C2/2B9D: AD A2 11     LDA $11A2   (Check if magic attack)
C2/2BA0: 4A           LSR 
C2/2BA1: B0 03        BCS $2BA6
C2/2BA3: 4C 69 2B     JMP $2B69   (Magical Damage Calculation)
C2/2BA6: 08           PHP 
C2/2BA7: AD AF 11     LDA $11AF   (attacker Level)
C2/2BAA: 48           PHA         (save it)
C2/2BAB: 85 E8        STA $E8
C2/2BAD: 7B           TDC 
C2/2BAE: AD A6 11     LDA $11A6   (Battle Power)
C2/2BB1: C2 20        REP #$20    (Set 16-bit Accumulator)
C2/2BB3: E0 08        CPX #$08    (If monster then Battle Power *= 4) 
C2/2BB5: 90 02        BCC $2BB9
C2/2BB7: 0A           ASL 
C2/2BB8: 0A           ASL 
C2/2BB9: 48           PHA 
C2/2BBA: A5 B2        LDA $B2
C2/2BBC: 89 00 40     BIT #$4000
C2/2BBF: D0 0C        BNE $2BCD   (If Gauntlet is not equipped, branch)
C2/2BC1: A3 01        LDA $01,S   (Battle Power *= 7/4)
C2/2BC3: 4A           LSR 
C2/2BC4: 18           CLC 
C2/2BC5: 63 01        ADC $01,S
C2/2BC7: 4A           LSR 
C2/2BC8: 18           CLC 
C2/2BC9: 63 01        ADC $01,S
C2/2BCB: 83 01        STA $01,S   
C2/2BCD: 68           PLA 
C2/2BCE: E2 20        SEP #$20    (Set 8-bit Accumulator)
C2/2BD0: 6D AE 11     ADC $11AE   (add Vigor * 2 if character, or Vigor if monster)
C2/2BD3: EB           XBA 
C2/2BD4: 69 00        ADC #$00    (add carry from the bottom byte of Attack
                                   into the top byte)
C2/2BD6: EB           XBA 
C2/2BD7: 20 B7 47     JSR $47B7   (get 16-bit "Attack" * 8-bit level, and put
                                   24-bit product in Variables $E8 thru $EA)
C2/2BDA: A5 E8        LDA $E8
C2/2BDC: 85 EA        STA $EA     (use top byte of result as temporary variable,
                                   since it's generally 0 anyway.
                                   to see why that's a bad idea, keep reading.)
C2/2BDE: 68           PLA 
C2/2BDF: 85 E8        STA $E8     (get attacker level again)
C2/2BE1: C2 20        REP #$20    (Set 16-bit Accumulator)
C2/2BE3: A5 E9        LDA $E9
C2/2BE5: EB           XBA         (A = bottom two bytes of the first multiplication
                                   result..  typically, we'll always have zero in the
                                   top byte, so we can ignore it.  but with a 255
                                   Battle Power weapon, Gauntlet, and a character at
                                   Level 99 with 128 Vigor, that product WILL need 3
                                   bytes.  failure to use that top byte in our next
                                   multiplication means we'll lose a lot of damage.
                                   BUG!)

C2/2BE6: 20 B7 47     JSR $47B7   (multiply 16-bit result of [Level * Attack] by
                                   our 8-bit level again, and put the new 24-bit
                                   product in Variables $E8 thru $EA.
                                   16-bit A will hold the new product DIV 256.)
C2/2BE9: 8D B0 11     STA $11B0   (Maximum Damage)
C2/2BEC: E0 08        CPX #$08    (If Player then multiply $11B0 by 3/2)
C2/2BEE: B0 2F        BCS $2C1F   (And add Battle Power)
C2/2BF0: AD A6 11     LDA $11A6   (Battle Power)
C2/2BF3: 29 FF 00     AND #$00FF
C2/2BF5: 0A           ASL
C2/2BF7: 6D B0 11     ADC $11B0   (Maximum Damage)
C2/2BFA: 4A           LSR 
C2/2BFB: 18           CLC 
C2/2BFC: 6D B0 11     ADC $11B0   (Maximum Damage)
C2/2BFF: 8D B0 11     STA $11B0   (Maximum Damage)
C2/2C02: BD 58 3C     LDA $3C58,X 
C2/2C05: 4A           LSR 
C2/2C06: 90 03        BCC $2C0B   (Check for offering)
C2/2C08: 4E B0 11     LSR $11B0   (Halves damage)
C2/2C0B: 89 08 00     BIT #$0008
C2/2C0E: F0 0F        BEQ $2C1F   (Check for Genji Glove)
C2/2C10: AD B0 11     LDA $11B0   (Maximum Damage)
C2/2C13: 4A           LSR 
C2/2C14: 4A           LSR 
C2/2C15: 49 FF FF     EOR #$FFFF
C2/2C18: 38           SEC
C2/2C19: 6D B0 11     ADC $11B0   (Maximum Damage)
C2/2C1B: 8D B0 11     STA $11B0   (Subtract 1/4 from Maximum Damage)
C2/2C1F: 28           PLP 
C2/2C20: 60           RTS 

C2/2C21 unknow

C2/2C21: DA           PHX
C2/2C22: AD 17 34     LDA $3417   (get Sketcher)
C2/2C25: 30 01        BMI $2C28   (branch if null)
C2/2C27: AA           TAX         (if there's a valid Sketcher, use their Level
                                   for attack)
C2/2C28: BD 18 3B     LDA $3B18,X (Level)
C2/2C2B: 8D AF 11     STA $11AF   (Level)
C2/2C2E: FA           PLX 
C2/2C2F: 60           RTS 

C2/2C30 unknow

(Coming into function: A = Enemy Number.  Y = in-battle enemy index, should be between
 8 and 18d)
(throughout this function, "main enemy" will mean the enemy referenced by the A and Y
 values that are initially passed to the function.  "loop enemy" will mean the enemy
 currently referenced by the iterator of the loop that compares the main enemy to all
 other enemies in the battle.)
C2/2C30: DA           PHX
C2/2C31: 08           PHP 
C2/2C32: C2 30        REP #$30       (16-bit accumulator and index registers)
C2/2C34: 99 F9 1F     STA $1FF9,Y
C2/2C37: 99 A8 33     STA $33A8,Y
C2/2C3A: 20 71 2D     JSR $2D71      (read enemy command script.  function explicitly
                                      preserves A and X, doesn't seem to touch Y)
C2/2C3D: 0A           ASL 
C2/2C3E: 0A           ASL 
C2/2C3F: 48           PHA
C2/2C40: AA           TAX            (enemy number * 4.  there are 4 bytes for
                                      steal+win slots) 
C2/2C41: BF 00 30 CF  LDA $CF3000,X
C2/2C45: 99 08 33     STA $3308,Y    (enemy steal slots)
C2/2C48: 68           PLA 
C2/2C49: 0A           ASL            (enemy number * 8)
C2/2C4A: 48           PHA 
C2/2C4B: DA           PHX 	       (push enemy number * 4)
C2/2C4C: 5A           PHY 
C2/2C4D: AA           TAX     
C2/2C4E: B9 F9 1F     LDA $1FF9,Y   (get enemy number)
C2/2C51: 99 80 33     STA $3380,Y   (Store it in the name structure.
                                     $3380 is responsible for the listing of enemy
                                     names in battle.  Whatever reads from that
                                     structure ensures there's no duplicates -- e.g.
                                     if there's 2 Leafers, "Leafer" is just displayed once.
                                     And if the code below didn't have bugs,
                                     2 *different* Mag Roaders would yield only one
                                     "Mag Roader" display, as it works in FF6j.)
C2/2C54: 7B           TDC 
C2/2C55: A8           TAY            (Y = 0)
C2/2C56: BF 50 C0 CF  LDA $CFC050,X  (enemy names)
C2/2C5A: 99 F8 00     STA $00F8,Y    (store name in temporary string)
C2/2C5D: E8           INX 
C2/2C5E: E8           INX 
C2/2C5F: C8           INY 
C2/2C60: C8           INY 
C2/2C61: C0 08 00     CPY #$0008   
C2/2C64: 90 F0        BCC $2C56     (loop until 8 characters of name are read)
C2/2C66: A0 12 00     LDY #$0012    (point to last enemy in battle)
C2/2C69: B9 F9 1F     LDA $1FF9,Y   (get number of enemy)
C2/2C6C: 30 28        BMI $2C96     (if 16-bit enemy number is negative, no enemy in slot,
                                     so skip it)
C2/2C6E: 5A           PHY 
C2/2C6F: 0A           ASL 
C2/2C70: 0A           ASL 
C2/2C71: 0A           ASL 
C2/2C72: AA           TAX            (enemy # * 8)
C2/2C73: 7B           TDC 
C2/2C74: A8           TAY            (Y = 0)
C2/2C75: B9 F8 00     LDA $00F8,Y     
C2/2C78: DF 50 C0 CF  CMP $CFC050,X  (compare name in temporary string to name of
                                      loop enemy)
C2/2C7C: 18           CLC 
C2/2C7D: D0 09        BNE $2C88      (if they're not equal, exit loop)
C2/2C7F: E8           INX 
C2/2C80: E8           INX 
C2/2C81: C8           INY 
C2/2C82: C8           INY 
C2/2C83: C0 08 00     CPY #$0008     
C2/2C86: 90 ED        BCC $2C75      (compare all the 1st 8 characters of the names as long
                                      as they keep matching)
C2/2C88: 7A           PLY            (Y points to in-battle index of loop enemy)
C2/2C89: 90 0B        BCC $2C96      (if we exited string comparison early, the names
                                      don't match, so branch)
C2/2C8B: A3 01        LDA $01,S
C2/2C8D: AA           TAX            (retrieve in-battle enemy index passed to function)
C2/2C8E: B9 F9 1F     LDA $1FF9,Y    (number of loop enemy)
C2/2C91: 9D 80 33     STA $3380,X    (If the strings did match, store enemy # of loop
                                      enemy in the "name structure", at the position
                                      of the main enemy.)

                                      This way, all enemies with the same name are
                                      represented by the same enemy # in $3380.  Whatever
                                      mechanism displays the $3380 structure must "detect"
                                      duplicate enemy numbers to avoid listing duplicate
                                      enemy names.

                                      Sadly, none of this works.  Enemy names were
                                      8 characters in FF6j according to Lord J, but 10
                                      characters in FF3us, and this function was unchanged.
                                      This means differing enemies with the same name
                                      (like Mag Roader) will have duplicate listings.
                                      Also, you can make an enemy name be wrongly OMITTED
                                      thru clever renaming and grouping of enemies
                                      (try giving Enemy #0 and #4 the same name --
                                      e.g. "gangster" -- and put Enemy #0 and #5 in a
                                      formation together) or really bad luck.

                                      A patch for this function has been released;
                                      see http://masterzed.cavesofnarshe.com/ )

C2/2C94: 80 07        BRA $2C9D      (we had a match, so exit the crazy loop)
C2/2C96: 88           DEY 
C2/2C97: 88           DEY 
C2/2C98: C0 08 00     CPY #$0008    
C2/2C9B: B0 CC        BCS $2C69      (loop and compare string to all enemies in battle)
C2/2C9D: 7A           PLY
C2/2C9E: FA           PLX
C2/2C9F: 68           PLA 
C2/2CA0: 0A           ASL 
C2/2CA1: 0A           ASL 
C2/2CA2: AA           TAX            (X = enemy # * 4 * 8.  Monster data block at $CF0000
                                      is 32 bytes)

C2/2CA3: BF 05 00 CF  LDA $CF0005,X (bottom = Defense, top = Magic Defense)
C2/2CA7: 99 B8 3B     STA $3BB8,Y
C2/2CAA: BF 0C 00 CF  LDA $CF000C,X (XP)
C2/2CAE: 99 84 3D     STA $3D84,Y
C2/2CB1: BF 0E 00 CF  LDA $CF000E,X (GP)
C2/2CB5: 99 98 3D     STA $3D98,Y
C2/2CB8: AD 46 3A     LDA $3A46
C2/2CBB: 30 27        BMI $2CE4     (branch if there was an enemy formation # switch, and
                                     it designates that the new enemies retain HP and Max HP
                                     from the current formation.)
C2/2CBD: BF 0A 00 CF  LDA $CF000A,X (MP)
C2/2CC1: 99 08 3C     STA $3C08,Y
C2/2CC4: 99 30 3C     STA $3C30,Y
C2/2CC7: BF 08 00 CF  LDA $CF0008,X (HP)
C2/2CCB: 99 F4 3B     STA $3BF4,Y
C2/2CCE: 99 1C 3C     STA $3C1C,Y
C2/2CD1: AD D4 3E     LDA $3ED4   (Battle formation)
C2/2CD4: C9 CF 01     CMP #$01CF  
C2/2CD7: D0 0B        BNE $2CE4   (Branch if not Doom Gaze's formation)
C2/2CD9: 8C FA 33     STY $33FA
C2/2CDC: AD BE 3E     LDA $3EBE   (Doom Gaze's HP)
C2/2CDF: F0 03        BEQ $2CE4
C2/2CE1: 99 F4 3B     STA $3BF4,Y (Set current HP to Doom Gaze's HP)
C2/2CE4: E2 21        SEP #$21    (Set 8-bit Accumulator)
C2/2CE6: B9 1D 3C     LDA $3C1D,Y (High byte of max HP)
C2/2CE9: 4A           LSR         
C2/2CEA: C9 19        CMP #$19    
C2/2CEC: 90 02        BCC $2CF0   
C2/2CEE: A9 17        LDA #$17       (Stamina = (Max HP / 512) + 16. If this number
                                      is greater than 40, then the monster's stamina is
                                      set to 40)
C2/2CF0: 69 10        ADC #$10             
C2/2CF2: 99 40 3B     STA $3B40,Y    (Stamina)
C2/2CF5: BF 01 00 CF  LDA $CF0001,X
C2/2CF9: 99 68 3B     STA $3B68,Y    (Battle Power)
C2/2CFC: BF 1A 00 CF  LDA $CF001A,X
C2/2D00: 99 A8 3C     STA $3CA8,Y    (Monster's regular weapon graphic)
C2/2D03: BF 03 00 CF  LDA $CF0003,X  (Evade)
C2/2D07: 20 61 28     JSR $2861
C2/2D0A: 99 54 3B     STA $3B54,Y    (255 - Evade * 2 + 1)
C2/2D0D: BF 04 00 CF  LDA $CF0004,X  (MBlock)
C2/2D11: 20 61 28     JSR $2861
C2/2D14: 99 55 3B     STA $3B55,Y    (255 - MBlock * 2 + 1)
C2/2D17: BF 02 00 CF  LDA $CF0002,X
C2/2D1B: 99 7C 3B     STA $3B7C,Y    (Hit Rate)
C2/2D1E: BF 10 00 CF  LDA $CF0010,X
C2/2D22: 99 18 3B     STA $3B18,Y    (Level)
C2/2D25: BF 00 00 CF  LDA $CF0000,X
C2/2D29: 99 19 3B     STA $3B19,Y    (Speed)
C2/2D2C: BF 07 00 CF  LDA $CF0007,X  (Magic Power)
C2/2D30: 20 D6 47     JSR $47D6      (* 1.5)
C2/2D33: 99 41 3B     STA $3B41,Y    (Magic Power)
C2/2D36: BF 1E 00 CF  LDA $CF001E,X  (monster status byte 4?)
C2/2D3A: 29 82        AND #$82       (only keep float and enemy runic?)
C2/2D3C: 19 4C 3E     ORA $3E4C,Y
C2/2D3F: 99 4C 3E     STA $3E4C,Y    (turn them on in Retort/Runic/etc byte)
C2/2D42: BF 13 00 CF  LDA $CF0013,X
C2/2D46: 99 80 3C     STA $3C80,Y    (Special Byte 2)
C2/2D49: 20 C1 2D     JSR $2DC1      (load enemy elemental reactions, statuses and
                                      status protection, metamorph info, special info
                                      like human/undead/etc)
C2/2D4C: BE A8 33     LDX $33A8,Y
C2/2D4F: BF C0 37 CF  LDA $CF37C0,X  (get Enemy Special Move graphic)  
C2/2D53: 99 81 3C     STA $3C81,Y    
C2/2D56: E2 10        SEP #$10
C2/2D58: 20 99 2D     JSR $2D99      (Carry will be set if the monster is present and has
                                      the "Attack First" attribute, clear otherwise)
C2/2D5B: 7B           TDC 
C2/2D5C: 6A           ROR 
C2/2D5D: 04 B1        TSB $B1        (if Carry is set, turn on Bit 7 of $B1)
C2/2D5F: 20 5A 4B     JSR $4B5A
C2/2D62: 29 07        AND #$07       (random number: 0-7)
C2/2D64: 18           CLC 
C2/2D65: 69 38        ADC #$38       (add 56)
C2/2D67: 99 2C 3B     STA $3B2C,Y    (save monster Vigor as a random number from 56 to 63)
C2/2D6A: BB           TYX 
C2/2D6B: 20 50 26     JSR $2650   (deal with Instant Death protection, and Poison elemental
                                   nullification giving immunity to Poison status)
C2/2D6E: 28           PLP 
C2/2D6F: FA           PLX 
C2/2D70: 60           RTS 

C2/2D71 read command script at start of combat

Read command script at start of combat
A = Monster number
C2/2D71: DA           PHX
C2/2D72: 48           PHA 
C2/2D73: 08           PHP 
C2/2D74: C2 20        REP #$20
C2/2D76: 0A           ASL 
C2/2D77: AA           TAX 
C2/2D78: BF 00 84 CF  LDA $CF8400,X  (Monster command script pointers)
C2/2D7C: 99 54 32     STA $3254,Y    (Index into main command script)
C2/2D7F: AA           TAX 
C2/2D80: E2 20        SEP #$20
C2/2D82: 20 43 1A     JSR $1A43      (Read command script, up through an FEh or FFh
                                      command)
C2/2D85: 1A           INC 
C2/2D86: D0 FA        BNE $2D82      (If FFh wasn't the last thing read, we're not at
                                      end of main command script, so loop and read more)
C2/2D88: BF 00 87 CF  LDA $CF8700,X  (Monster command scripts)
C2/2D8C: 1A           INC 
C2/2D8D: F0 06        BEQ $2D95      (if first byte of counterattack script is FFh, it's
                                      empty, so skip saving the index)
C2/2D8F: C2 20        REP #$20       (Set 16-bit Accumulator)
C2/2D91: 8A           TXA 
C2/2D92: 99 68 32     STA $3268,Y    (Index into counterattack script)
C2/2D95: 28           PLP 
C2/2D96: 68           PLA 
C2/2D97: FA           PLX 
C2/2D98: 60           RTS 

C2/2D99 unknow

C2/2D99: DA           PHX
C2/2D9A: BB           TYX 
C2/2D9B: 20 A0 2D     JSR $2DA0
C2/2D9E: FA           PLX 
C2/2D9F: 60           RTS 

C2/2DA0 handle "attack first" property for monsters

(Handle "Attack First" property for monster)
(Also, returns Carry clear if Attack First unset, Carry set if it's set.)
C2/2DA0: 18           CLC 
C2/2DA1: BD 80 3C     LDA $3C80,X
C2/2DA4: 89 02        BIT #$02     (is "Attack First" set in Misc/Special enemy byte?)
C2/2DA6: F0 18        BEQ $2DC0    (if not, exit)
C2/2DA8: BD A0 3A     LDA $3AA0,X
C2/2DAB: 89 01        BIT #$01
C2/2DAD: F0 11        BEQ $2DC0    (exit if enemy not present?)
C2/2DAF: 09 08        ORA #$08
C2/2DB1: 9D A0 3A     STA $3AA0,X
C2/2DB4: 9E 19 32     STZ $3219,X  (zero top byte of ATB Timer)
C2/2DB7: A9 FF        LDA #$FF
C2/2DB9: 9D B5 3A     STA $3AB5,X  (max out top byte of enemy's Wait Timer, which
                                    means they'll spend essentially no time in
                                    the monster equivalent to a ready stance.
                                    normally, monsters do this by having a 0 "Time to
                                    Wait" in $322C, but since this function is doing
                                    things earlier and $322C is still FFh, we instead
                                    fill out the timer to meet the threshold.) 
C2/2DBC: 20 66 4E     JSR $4E66    (put monster in the Wait to Attack queue)
C2/2DBF: 38           SEC 
C2/2DC0: 60           RTS 

C2/2DC1 unknow

C2/2DC1: 08           PHP
C2/2DC2: BF 1F 00 CF  LDA $CF001F,X  (Special attack)
C2/2DC6: 99 2D 32     STA $322D,Y
C2/2DC9: BF 19 00 CF  LDA $CF0019,X  (elemental weaknesses)
C2/2DCD: 19 E0 3B     ORA $3BE0,Y
C2/2DD0: 99 E0 3B     STA $3BE0,Y
C2/2DD3: BF 16 00 CF  LDA $CF0016,X  (blocked status byte 3)
C2/2DD7: 49 FF        EOR #$FF       (invert it)
C2/2DD9: 39 30 33     AND $3330,Y
C2/2DDC: 99 30 33     STA $3330,Y
C2/2DDF: A9 FF        LDA #$FF
C2/2DE1: 39 31 33     AND $3331,Y
C2/2DE4: 99 31 33     STA $3331,Y
C2/2DE7: C2 20        REP #$20       (Set 16-bit Accumulator)
C2/2DE9: BF 1B 00 CF  LDA $CF001B,X  (monster status bytes 1-2)
C2/2DED: 99 D4 3D     STA $3DD4,Y    (copy into "status to set" bytes)
C2/2DF0: BF 1D 00 CF  LDA $CF001D,X  (get monster status bytes 3-4)
C2/2DF4: 48           PHA 
C2/2DF5: 29 01 00     AND #$0001  
C2/2DF8: 4A           LSR         
C2/2DF9: 6A           ROR  	  
C2/2DFA: 03 01        ORA $01,S    (this moves Byte 3,Bit 0 into Byte 4,Bit 7 position)
                                   (it turns out "Dance" in B3,b0 is permanent float,
                                    while B4,b7 is a dispellable float)
C2/2DFC: 29 FE 84     AND #$84FE   (filter out character stats like dog and rage)
                                   (in byte 4, only Float and Life 3 are kept)		   
C2/2DFF: 99 E8 3D     STA $3DE8,Y  (put in "status to set")
C2/2E02: 68           PLA
C2/2E03: EB           XBA         (now swap enemy status bytes 3<->4 within A)
C2/2E04: 4A           LSR         
C2/2E05: 90 09        BCC $2E10   (if byte4, bit 0 (aka "Rage") had not been set, branch)
C2/2E07: B9 58 3C     LDA $3C58,Y 
C2/2E0A: 09 40 00     ORA #$0040     (Set True Knight effect?)
C2/2E0D: 99 58 3C     STA $3C58,Y
C2/2E10: BF 1C 00 CF  LDA $CF001C,X  (monster status bytes 2-3)
C2/2E14: 19 6C 3C     ORA $3C6C,Y    (this makes a copy of ^, used in procs like c2/2675)
C2/2E17: 99 6C 3C     STA $3C6C,Y
C2/2E1A: BF 14 00 CF  LDA $CF0014,X  (blocked status bytes 1-2)
C2/2E1E: 49 FF FF     EOR #$FFFF     (invert 'em)
C2/2E21: 39 1C 33     AND $331C,Y
C2/2E24: 99 1C 33     STA $331C,Y
C2/2E27: BF 17 00 CF  LDA $CF0017,X  (elements absorbed and nullified)
C2/2E2B: 19 CC 3B     ORA $3BCC,Y
C2/2E2E: 99 CC 3B     STA $3BCC,Y
C2/2E31: BF 11 00 CF  LDA $CF0011,X
C2/2E35: 99 94 3C     STA $3C94,Y    ($3C94 = Metamorph info
                                      $3C95 = Special Byte 3:
                                       Dies at 0 MP, No name, Human, Auto critical if Imp,
                                       Undead)
C2/2E38: 28           PLP 
C2/2E39: 60           RTS

C2/2E3A determine front, back, pincer or side attack

C2/2E3A: AD 6D 3A     LDA $3A6D
C2/2E3D: 4A           LSR  
C2/2E3E: 4A           LSR        (Put Back Guard effect into Carry)
C2/2E3F: AD 48 2F     LDA $2F48  (Get extra enemy formation data, byte 0, top half, inverted)
C2/2E42: 90 0C        BCC $2E50  (Branch if no Back Guard)
C2/2E44: 89 B0        BIT #$B0   (Are Side, Back, or Normal attacks allowed?)
C2/2E46: F0 02        BEQ $2E4A  (If only Pincer or nothing[??] allowed, branch)
C2/2E48: 29 B0        AND #$B0   (Otherwise, disable Pincer)
C2/2E4A: 89 D0        BIT #$D0   (Are Side, Pincer, or Normal attacks allowed?)
C2/2E4C: F0 02        BEQ $2E50  (If only Back or nothing[??] allowed, branch)
C2/2E4E: 29 D0        AND #$D0   (Otherwise, disable Back)
C2/2E50: 48           PHA 
C2/2E51: AD 76 3A     LDA $3A76  (Number of characters in party)
C2/2E54: C9 03        CMP #$03
C2/2E56: 68           PLA 
C2/2E57: B0 06        BCS $2E5F  (If 3 or more in party, branch)
C2/2E59: 89 70        BIT #$70   (Are any of Normal, Back, or Pincer allowed?)
C2/2E5B: F0 02        BEQ $2E5F  (If only Side or nothing[??] allowed, branch)
C2/2E5D: 29 70        AND #$70   (Otherwise, disable Side attack)
C2/2E5F: A2 10        LDX #$10
C2/2E61: 20 47 52     JSR $5247  (Randomly choose attack type.  If some fictional jackass
                                  masked them all, we enter an.. INFINITE LOOP!)
C2/2E64: 8E 1F 20     STX $201F  (Save encounter type:  0 = Front, 1 = Back,
                                                        2 = Pincer, 3 = Side)
C2/2E67: 60           RTS 

C2/2E68 unknow

C2/2E68: AE 1F 20     LDX $201F    (get encounter type:  0 = front, 1 = back,
                                    2 = pincer, 3 = side)
C2/2E6B: E0 00        CPX #$00
C2/2E6D: F0 05        BEQ $2E74    (if front attack, branch)
C2/2E6F: A9 01        LDA #$01
C2/2E71: 1C E4 11     TRB $11E4
C2/2E74: 8A           TXA 
C2/2E75: 0A           ASL         
C2/2E76: AA           TAX           (multiply encounter type by 2, so it acts as index
                                     into function pointers)
C2/2E77: FC 93 2E     JSR ($2E93,X) (Change rows for pincer and back, see if preemptive attack)
C2/2E7A: A2 06        LDX #$06
C2/2E7C: DA           PHX 
C2/2E7D: BD A1 3A     LDA $3AA1,X
C2/2E80: 29 20        AND #$20      (Check row)
C2/2E82: 48           PHA 
C2/2E83: 8A           TXA 
C2/2E84: 0A           ASL 
C2/2E85: 0A           ASL 
C2/2E86: 0A           ASL 
C2/2E87: 0A           ASL 
C2/2E88: AA           TAX 
C2/2E89: 68           PLA 
C2/2E8A: 9D C5 2E     STA $2EC5,X
C2/2E8D: FA           PLX 
C2/2E8E: CA           DEX 
C2/2E8F: CA           DEX 
C2/2E90: 10 EA        BPL $2E7C
C2/2E92: 60           RTS 

C2/2E93 pointers: normal, back, pincer or side attack

(Pointers to functions that do stuff based on battle formation)
C2/2E93: 9B 2E     (Normal attack)
C2/2E95: CE 2E     (Back attack)
C2/2E97: C1 2E     (Pincer attack)
C2/2E99: 9B 2E     (Side attack)

C2/2E9B preemptive attack

(Determines if a battle is a preemptive attack)
(Preemptive attack chance = 1 in 8 for normal attacks, 7 in 32 for side attacks)
(Gale Hairpin doubles chance)
C2/2E9B: A5 B1        LDA $B1
C2/2E9D: 30 21        BMI $2EC0   (Exit function if bit 7 of $B1 is set)    
C2/2E9F: AD 4B 2F     LDA $2F4B   (load formation data, byte 3)
C2/2EA2: 89 04        BIT #$04    (is "hide starting messages" set?)
C2/2EA4: D0 1A        BNE $2EC0   (branch if so)
C2/2EA6: 8A           TXA         (coming in, X is 0 or 6)
C2/2EA7: 0A           ASL 
C2/2EA8: 0A           ASL 
C2/2EA9: 09 20        ORA #$20
C2/2EAB: 85 EE        STA $EE     ($EE = $201F * 8 + #$20.  so pre-emptive
                                   rate is #$20 or #$38.)
C2/2EAD: AD 6D 3A     LDA $3A6D
C2/2EB0: 4A           LSR 
C2/2EB1: 90 02        BCC $2EB5   (Branch if no gale hairpin equipped)
C2/2EB3: 06 EE        ASL $EE     (Double chance of preemptive attack)
C2/2EB5: 20 5A 4B     JSR $4B5A   (random number 0 to 255)
C2/2EB8: C5 EE        CMP $EE     (compare it against pre-emptive rate)
C2/2EBA: B0 04        BCS $2EC0   (Branch if random number >= $EE, meaning
                                   no pre-emptive strike)
C2/2EBC: A9 40        LDA #$40
C2/2EBE: 04 B0        TSB $B0     (Set preemptive attack)
C2/2EC0: 60           RTS 

C2/2E61 pincer attack

(Sets all characters to front row for pincer attacks)
C2/2EC1: A2 06        LDX #$06
C2/2EC3: A9 DF        LDA #$DF
C2/2EC5: 20 43 0A     JSR $0A43   (Sets character X to front row, by clearing
                                   Bit 5 of $3AA1,X)
C2/2EC8: CA           DEX 
C2/2EC9: CA           DEX 
C2/2ECA: 10 F7        BPL $2EC3   (loop for all 4 characters)
C2/2ECC: 80 0E        BRA $2EDC

C2/2ECE back attacks

(Switches character's row placement for back attacks)
C2/2ECE: A2 06        LDX #$06
C2/2ED0: BD A1 3A     LDA $3AA1,X
C2/2ED3: 49 20        EOR #$20
C2/2ED5: 9D A1 3A     STA $3AA1,X (Toggle Row)
C2/2ED8: CA           DEX 
C2/2ED9: CA           DEX 
C2/2EDA: 10 F4        BPL $2ED0   (loop for all 4 characters)
C2/2EDC: A9 20        LDA #$20
C2/2EDE: 04 B1        TSB $B1
C2/2EE0: 60           RTS 

C2/2EE1 unknow

C2/2EE1: 08           PHP 
C2/2EE2: C2 10        REP #$10      (Set 16-bit X and Y)
C2/2EE4: AD 45 3F     LDA $3F45     (get enemy presence byte from monster formation data)
C2/2EE7: A2 0A 00     LDX #$000A    
C2/2EEA: 0A           ASL
C2/2EEB: 0A           ASL           (move 6 relevant bits into top of byte, as there's
                                     only 6 possible enemies)
C2/2EEC: 9E A8 3A     STZ $3AA8,X   (mark enemy as absent to start)
C2/2EEF: 0A           ASL
C2/2EF0: 3E A8 3A     ROL $3AA8,X   ($3AA8 = 1 for present enemy, 0 for absent)
C2/2EF3: CA           DEX
C2/2EF4: CA           DEX
C2/2EF5: 10 F5        BPL $2EEC     (loop for all 6 enemies)
C2/2EF7: AD 52 3F     LDA $3F52     (get boss switches byte of monster formation data)
C2/2EFA: 0A           ASL
C2/2EFB: 0A           ASL	      (move 6 relevant bits into top of byte)
C2/2EFC: 85 EE        STA $EE       
C2/2EFE: A2 05 00     LDX #$0005   
C2/2F01: A0 12 00     LDY #$0012   (Y = onscreen index of enemy, should be between
                                    8 and 18d)
C2/2F04: 7B           TDC
C2/2F05: 0E 73 3A     ASL $3A73   (prepare to set next bit for which monsters are in
                                   template/formation.  this is initialized to 0
                                   at C2/23F3.)
C2/2F08: 06 EE        ASL $EE     (get boss bit for current enemy)
C2/2F0A: 2A           ROL
C2/2F0B: EB           XBA         (save boss bit in top of A)
C2/2F0C: AD 97 3A     LDA $3A97    (colosseum related??  it's decremented elsewhere
                                    -- decremented from WHAT, i dunno -- if the enemy
                                    formation is >=574.  574 is "shadow at colosseum",
                                    and setting 575 with FF3usME plunges Terra into
                                    a Colosseum style battle with Guard.)
C2/2F0F: 0A           ASL
C2/2F10: BD 46 3F     LDA $3F46,X  (get enemy number from monster formation data)
C2/2F13: 90 05        BCC $2F1A    (if top bit of $3A97 was unset, branch)
C2/2F15: AD 06 02     LDA $0206    (some enemy number passed from somewhere else?????
                                    Bank C3 seems to use this address...  probably
                                    passed by Colosseum setup)
C2/2F18: 80 04        BRA $2F1E    (the Colosseum only supports enemies 0-255, so branch
                                    immediately to check the boss bit, since we know
                                    any enemy # > 256 is unacceptable.)
C2/2F1A: C9 FF        CMP #$FF    
C2/2F1C: D0 04        BNE $2F22    (branch if bottom byte of enemy # isn't 255.  if it
                                    is 255, it might be empty.) 
C2/2F1E: EB           XBA
C2/2F1F: D0 07        BNE $2F28    (if the boss bit is set, the enemy slot's empty, and we
                                    skip its stats.  otherwise it's Pugs, and it's valid.)
C2/2F21: EB           XBA
C2/2F22: 20 30 2C     JSR $2C30    (load enemy name and stats)
C2/2F25: EE 73 3A     INC $3A73    (which monsters are in template/formation?  turn on
                                    bit for the current enemy index.)
C2/2F28: 88           DEY
C2/2F29: 88           DEY
C2/2F2A: CA           DEX
C2/2F2B: 10 D7        BPL $2F04    (loop for all 6 enemies)
C2/2F2D: 28           PLP
C2/2F2E: 60           RTS

C2/2F2F unknow

C2/2F2F: 08           PHP
C2/2F30: C2 10        REP #$10    (Set 16-bit X & Y)
C2/2F32: 64 FC        STZ $FC
C2/2F34: 64 B8        STZ $B8
C2/2F36: AD E0 3E     LDA $3EE0
C2/2F39: D0 3A        BNE $2F75    (branch if not in final 4-tier multi-battle?
                                    completely guessing here.)
C2/2F3B: A2 00 00     LDX #$0000   (start looking at first character)
C2/2F3E: A9 FF        LDA #$FF
c2/2F40: 9D D9 3E     STA $3ED9,X
C2/2F43: DD D8 3E     CMP $3ED8,X  (Which character it is)
C2/2F46: D0 24        BNE $2F6C    (if character # was actually defined, don't use the
                                    list to determine this character)
C2/2F48: A0 00 00     LDY #$0000
C2/2F4B: B9 05 02     LDA $0205,Y  (get some character index from preferred order list
                                    set pre-battle?)
C2/2F4E: C9 FF        CMP #$FF
C2/2F50: F0 14        BEQ $2F66    (if no character in slot, skip to next one)
C2/2F52: EB           XBA 
C2/2F53: A9 FF        LDA #$FF
C2/2F55: 99 05 02     STA $0205,Y  (null out the entry from the pre-chosen list)
C2/2F58: A9 25        LDA #$25
C2/2F5A: 20 81 47     JSR $4781    (multiply by 37, size of character info block)
C2/2F5D: A8           TAY 
C2/2F5E: B9 00 16     LDA $1600,Y  (get actual character #)
C2/2F61: 9D D8 3E     STA $3ED8,X  (save Which character it is)
C2/2F64: 80 06        BRA $2F6C    (we've found our party member, so exit loop,
                                    and move onto next party slot.)
C2/2F66: C8           INY          (check next character)
C2/2F67: C0 0C 00     CPY #$000C
C2/2F6A: 90 DF        BNE $2F4B    (loop for all 12 preferred character slots)
C2/2F6C: E8           INX
C2/2F6D: E8           INX
C2/2F6E: E0 08 00     CPX #$0008
C2/2F71: 90 CB        BCC $2F3E   (loop for all 4 party members)
C2/2F73: 80 64        BRA $2FD9   (since we're in the final battle, we know we're not
                                   in the Colosseum or on the Veldt, so skip those
                                   checks.  also skip the party initialization loop
                                   at C2/2F8C.)
C2/2F75: AE D4 3E     LDX $3ED4   (Battle formation)
C2/2F78: E0 3E 02     CPX #$023E  (Shadow at Colosseum formation)
C2/2F7B: 90 0F        BCC $2F8C   (if not ^ or Colosseum formation #575, branch)
C2/2F7D: AD 08 02     LDA $0208    
C2/2F80: 8D D8 3E     STA $3ED8   (Set "Which Character this is" to our chosen
                                   combatant.)
C2/2F83: A9 01        LDA #$01
C2/2F85: 04 B8        TSB $B8
C2/2F87: CE 97 3A     DEC $3A97   (set $3A97 to FFh.  future checks will look at Bit 7
                                   to determine we're in the Colosseum.)
C2/2F8A: 80 4D        BRA $2FD9   (we're in the Colosseum using a single character
                                   to fight, so skip the party initialization loop.)
C2/2F8C: A0 0F 00     LDY #$000F
C2/2F8F: B9 50 18     LDA $1850,Y (get character roster information)
                                  (Bit 7: 1 = party leader, as set in non-overworld areas
                                   Bit 6: ??
                                   Bit 5: row, 0 = front, 1 = back
                                   Bit 3-4: position in party, 0-3
                                   Bit 0-2: which party in)
C2/2F92: 85 FE        STA $FE
C2/2F94: 29 07        AND #$07    (isolate which party character is in.  don't know
                                   why it takes 3 bits rather than 2.)
C2/2F96: CD 6D 1A     CMP $1A6D   (compare to Which Party is Active)
C2/2F99: D0 12        BNE $2FAD   (branch if not equal)
C2/2F9B: 5A           PHY 
C2/2F9C: E6 FC        INC $FC     (increment count of characters in active party)
C2/2F9E: 7B           TDC 
C2/2F9F: A5 FE        LDA $FE
C2/2FA1: 29 18        AND #$18    (isolate the position of character in party)
C2/2FA3: 4A           LSR 
C2/2FA4: 4A           LSR 
C2/2FA5: AA           TAX         (convert to a 0,2,4,6 index)
C2/2FA6: 20 DC 30     JSR $30DC
C2/2FA9: 9D D8 3E     STA $3ED8,X  (save "which character it is")
C2/2FAC: 7A           PLY 
C2/2FAD: 88           DEY 
C2/2FAE: 10 DF        BPL $2F8F
C2/2FB0: AD DF 1E     LDA $1EDF
C2/2FB3: 89 08        BIT #$08    (is Gau enlisted and not Leapt?)
C2/2FB5: D0 0C        BNE $2FC3   (branch if so)
C2/2FB7: AD 4B 3F     LDA $3F4B   (get monster index of enemy #6 in formation)
C2/2FBA: 1A           INC 
C2/2FBB: D0 06        BNE $2FC3  (branch if an enemy is in the slot.  thankfully, there's
                                  no formation with Pugs [enemy #255] in Slot #6, as this
                                  code makes no distinction between that and a nonexistent
                                  enemy.  one problem i noticed is that if you're in
                                  a Veldt battle where Gau's destined to return, the 6th
                                  Pugs will often be untargetable.)

C2/2FBD: A5 FC        LDA $FC     (# of characters in party?)
C2/2FBF: C9 04        CMP #$04
C2/2FC1: 90 05        BCC $2FC8   (branch if less than 4)
C2/2FC3: A9 01        LDA #$01
C2/2FC5: 1C E4 11     TRB $11E4   (clear Gau as being leapt and available to return on
                                   Veldt)
C2/2FC8: A9 01        LDA #$01
C2/2FCA: 2C E4 11     BIT $11E4   (set when fighting on Veldt, Gau is Leapt, and he's
                                   available to return.)
C2/2FCD: F0 0A        BEQ $2FD9   (branch if unset)
C2/2FCF: A9 0A        LDA #$0A
C2/2FD1: 8D 4A 2F     STA $2F4A   (extra enemy formation data, byte 2.  store special
                                   event.)
C2/2FD4: A9 80        LDA #$80
C2/2FD6: 0C 49 2F     TSB $2F49   (extra enemy formation data, byte 1: activate
                                   special event)
C2/2FD9: AD 49 2F     LDA $2F49
C2/2FDC: 10 6C        BPL $304A   (if no special event active, branch)
C2/2FDE: AD 4A 2F     LDA $2F4A
C2/2FE1: EB           XBA 
C2/2FE2: A9 18        LDA #$18
C2/2FE4: 20 81 47     JSR $4781     (multiply by 24 bytes for some structure)
C2/2FE7: AA           TAX 
C2/2FE8: BF 00 FD D0  LDA $D0FD00,X
C2/2FEC: 10 0C        BPL $2FFA
C2/2FEE: A0 06 00     LDY #$0006
C2/2FF1: A9           LDA #$FF
C2/2FF3: 99 D8 3E     STA $3ED8,Y   (store null in Which Character it is)
C2/2FF6: 88           DEY 
C2/2FF7: 88           DEY 
C2/2FF8: 10 F7        BPL $2FF1     (loop for all 4 characters)
C2/2FFA: A0 04 00     LDY #$0004
C2/2FFD: 5A           PHY
C2/2FFE: BF 04 FD D0  LDA $D0FD04,X (character we want to replace?)
C2/3002: C9 FF        CMP #$FF
C2/3004: F0 3B        BEQ $3041     (branch if undefined)
C2/3006: 29 3F        AND #$3F      (isolate character to replace in bottom 6 bits)
C2/3008: A0 06 00     LDY #$0006
C2/300B: D9 D8 3E     CMP $3ED8,Y   (Which character it is)
C2/300E: F0 13        BEQ $3023     (if one of characters in party matches desired
                                     character to replace, branch and exit loop)
C2/3010: 88           DEY 
C2/3011: 88           DEY 
C2/3012: 10 F7        BPL $300B     (loop through all 4 party members)
C2/3014: C8           INY 
C2/3015: C8           INY 
C2/3016: B9 D8 3E     LDA $3ED8,Y   (Which character it is)
C2/3019: 1A           INC 
C2/301A: F0 07        BEQ $3023     (if the current character is null, branch and
                                     exit loop)
C2/301C: C0 06 00     CPY #$0006
C2/301F: 90 F3        BCC $3014     (loop through all 4 characters in party)
C2/3021: 80 1E        BRA $3041     (we couldn't find the desired character to replace,
                                     nor a null slot, so skip to next entry in the
                                     battle event data.)
C2/3023: B9 18 30     LDA $3018,Y
C2/3026: 04 B8        TSB $B8
C2/3028: C2 20        REP #$20        (Set 16-bit Accumulator)
C2/302A: BF 04 FD D0  LDA $D0FD04,X
C2/302E: 99 D8 3E     STA $3ED8,Y
C2/3031: E2 20        SEP #$20        (Set 8-bit Accumulator)
C2/3033: A9 01        LDA #$01        (top byte of monster # is always 1)
C2/3035: EB           XBA 
C2/3036: BF 06 FD D0  LDA $D0FD06,X   (get bottom byte of monster # from battle event
                                       data)
C2/303A: C9 FF        CMP #$FF        (is our monster # 511, meaning it's null?)
C2/303C: F0 03        BEQ $3041       (branch if so)
C2/303E: 20 71 2D     JSR $2D71       (read command script at start of combat.
                                       A = monster num)
C2/3041: 7A           PLY 
C2/3042: E8           INX 
C2/3043: E8           INX 
C2/3044: E8           INX 
C2/3045: E8           INX 
C2/3046: E8           INX 
C2/3047: 88           DEY 
C2/3048: D0 B3        BNE $2FFD
C2/304A: A2 06 00     LDX #$0006
C2/304D: BD D8 3E     LDA $3ED8,X   (which character it is)
C2/3050: C9 FF        CMP #FF
C2/3052: F0 7F        BEQ $30D3    (If monster)
C2/3054: 0A           ASL          (check bit 7 of which character it is)
C2/3055: B0 03        BCS $305A    (if set, branch)
C2/3057: FE A0 3A     INC $3AA0,X  (mark character as onscreen?)
C2/305A: 0A           ASL          (check bit 6 of which character it is)
C2/305B: 90 08        BCC $3065    (if unset, branch)
C2/305D: 48           PHA          (save shifted "Which Character" byte)
C2/305E: BD 18 30     LDA $3018,X
C2/3061: 0C 40 3A     TSB $3A40
C2/3064: 68           PLA 
C2/3065: 4A           LSR                  
C2/3066: 4A           LSR          (original Which Character byte, except top 2 bits
                                    are zeroed)
C2/3067: 9D D8 3E     STA $3ED8,X  
C2/306A: A0 0F 00     LDY #$000F
C2/306D: 5A           PHY          (save loop variable)
C2/306E: 48           PHA          (save Which Character)
C2/306F: B9 50 18     LDA $1850,Y
C2/3072: 29 20        AND #$20     (Isolate character row.  clear if Front, set if Back.)
C2/3074: 85 FE        STA $FE
C2/3076: 20 DC 30     JSR $30DC    (get actual character #?)
C2/3079: C3 01        CMP $01,S
C2/307B: D0 51        BNE $30CE    (skip character if their "actual #" doesn't match
                                    value of Which Character byte)
C2/307D: DA           PHX          (save 0,2,4,6 index of character?)
C2/307E: 48           PHA          (save actual # of character?)
C2/307F: A5 FE        LDA $FE
C2/3081: 9D A1 3A     STA $3AA1,X  (save character row in Special Properties)
C2/3084: BD D9 3E     LDA $3ED9,X  (s/b FFh provided $3EE0 wasn't set)
C2/3087: 48           PHA          
C2/3088: A3 06        LDA $06,S    (retrieve loop variable of 0 to 0F?)
C2/308A: 9D D9 3E     STA $3ED9,X  
C2/308D: 7B           TDC 
C2/308E: 8A           TXA          (put onscreen character index in A)
C2/308F: 0A           ASL 
C2/3090: 0A           ASL 
C2/3091: 0A           ASL 
C2/3092: 0A           ASL 
C2/3093: AA           TAX 
C2/3094: 68           PLA 
C2/3095: C9 FF        CMP #$FF
C2/3097: D0 03        BNE $309C
C2/3099: B9 01 16     LDA $1601,Y
C2/309C: 9D AE 2E     STA $2EAE,X
C2/309F: 7B           TDC 
C2/30A0: 68           PLA           (retrieve actual ID of character?)
C2/30A1: 9D C6 2E     STA $2EC6,X
C2/30A4: C9 0E        CMP #$0E
C2/30A6: C2 20        REP #$20      (Set 16-bit Accumulator)
C2/30A8: 48           PHA           (save actual ID of character?)
C2/30A9: B9 02 16     LDA $1602,Y   (1st two letters of character's name)
C2/30AC: 9D AF 2E     STA $2EAF,X
C2/30AF: B9 04 16     LDA $1604,Y   (middle two letters of character's name)
C2/30B2: 9D B1 2E     STA $2EB1,X
C2/30B5: B9 06 16     LDA $1606,Y   (last two letters of character's name)  
C2/30B8: 9D B3 2E     STA $2EB3,X
C2/30BB: FA           PLX           (get actual ID of character?)
C2/30BC: B0 06        BCS $30C4     (if character # is >= 0Eh [Banon], then don't bother marking
                                     them for purposes of what can be equipped on whom)
		  
C2/30BE: 7B           TDC           (Clear Accumulator)
C2/30BF: 38           SEC           (set carry flag)
C2/30C0: 2A           ROL           (move up a bit, starting with bottom)
C2/30C1: CA           DEX 
C2/30C2: 10 FC        BPL $30C0     (move bit into position determined by actual # of character.
                                     so for Character #3, only Bit #3 is on)

(the following is still executed for Banon and up.  seemingly, jibberish [the last 2 characters of
 the character name] is stored in that character's equippable items byte.  i'm not sure
 why this is done, but the game does have a property on these characters that prevents you
 from equipping all sorts of random crap via the Item menu in battle.)

C2/30C4: FA           PLX           (get onscreen 0,2,4,6 index of character)
C2/30C5: 9D 20 3A     STA $3A20,X   (related to what characters item can be equipped on.
                                     should only be our basic 14)
C2/30C8: 98           TYA 
C2/30C9: 9D 10 30     STA $3010,X   (save offset of character info block)
C2/30CC: E2 20        SEP #$20      (Set 8-bit Accumulator)
C2/30CE: 68           PLA           (retrieve Which Character byte)
C2/30CF: 7A           PLY           (retrieve loop index)
C2/30D0: 88           DEY 
C2/30D1: 10 9A        BPL $306D     (loop for all 16 character info blocks)
C2/30D3: CA           DEX 
C2/30D4: CA           DEX 
C2/30D5: 30 03        BMI $30DA
C2/30D7: 4C 4D 30     JMP $304D     (loop for all 4 characters)
C2/30DA: 28           PLP 
C2/30DB: 60           RTS