Final Fantasy VI:ROM map/Assembly C20

From Data Crystal
Jump to: navigation, search

Contents

C2/0000 unknow

C2/0000: 4C 0C 00     JMP $000C
C2/0003: 4C 1B 11     JMP $111B
C2/0006: 4C 77 0E     JMP $0E77
C2/0009: 4C 30 47     JMP $4730

C2/000C unknow

C2/000C: 08           PHP
C2/000D: E2 30        SEP #$30
C2/000F: A9 7E        LDA #$7E
C2/0011: 48           PHA 
C2/0012: AB           PLB 
C2/0013: 20 1E 26     JSR $261E
C2/0016: 20 ED 23     JSR $23ED
C2/0019: E6 BE        INC $BE    (increment RNG table index)
C2/001B: AD 02 34     LDA $3402  (Get the number of turns due to Quick)
C2/001E: D0 03        BNE $0023  (Branch if not zero; either we are in a regular (i.e. non-Quick)
                                  turn, or else we are in the process of executing Quick turns.
                                  Only if the final Quick turn just passed will we do the next line.
                                  Either way, we still need to decrement the number of Quick turns.)
C2/0020: CE 02 34     DEC $3402  (Decrement the number of turns due to Quick)
C2/0023: A9 01        LDA #$01
C2/0025: 20 11 64     JSR $6411
C2/0028: 20 95 20     JSR $2095
C2/002B: AD 58 3A     LDA $3A58  (was anybody's main menu flagged to be redrawn right away?)
C2/002E: F0 03        BEQ $0033  (branch if not)
C2/0030: 20 CC 00     JSR $00CC  (redraw the applicable menus)
C2/0033: AD 0A 34     LDA $340A
C2/0036: C9 FF        CMP #$FF
C2/0038: F0 03        BEQ $003D
C2/003A: 4C 63 21     JMP $2163
C2/003D: A9 04        LDA #$04
C2/003F: 1C 46 3A     TRB $3A46
C2/0042: F0 05        BEQ $0049
C2/0044: 20 91 0A     JSR $0A91
C2/0047: 80 D0        BRA $0019
C2/0049: AE 07 34     LDX $3407
C2/004C: 10 11        BPL $005F
C2/004E: AE 68 3A     LDX $3A68
C2/0051: EC 69 3A     CPX $3A69
C2/0054: F0 0C        BEQ $0062
C2/0056: EE 68 3A     INC $3A68
C2/0059: BD 20 39     LDA $3920,X
C2/005C: 30 F0        BMI $004E
C2/005E: AA           TAX 
C2/005F: 4C 7B 4B     JMP $4B7B
C2/0062: AD 3A 3A     LDA $3A3A
C2/0065: 2D 2F 2F     AND $2F2F
C2/0068: F0 05        BEQ $006F
C2/006A: 1C 2F 2F     TRB $2F2F
C2/006D: 80 AA        BRA $0019
C2/006F: A9 20        LDA #$20
C2/0071: 14 B0        TRB $B0
C2/0073: F0 08        BEQ $007D
C2/0075: 20 73 5C     JSR $5C73
C2/0078: A9 06        LDA #$06
C2/007A: 20 11 64     JSR $6411
C2/007D: A9 04        LDA #$04
C2/007F: 14 B0        TRB $B0
C2/0081: 20 ED 47     JSR $47ED
C2/0084: A9 FF        LDA #$FF
C2/0086: A2 03        LDX #$03
C2/0088: 9D FC 33     STA $33FC,X
C2/008B: CA           DEX 
C2/008C: 10 FA        BPL $0088
C2/008E: A9 01        LDA #$01
C2/0090: 14 B1        TRB $B1
C2/0092: AE 64 3A     LDX $3A64  (get position of next Wait Queue slot to read)
C2/0095: EC 65 3A     CPX $3A65  (does it match position of the next available [unused]
                                  queue slot?  iow, have we read through the end of queue?)
C2/0098: F0 0C        BEQ $00A6  (if so, branch)
C2/009A: EE 64 3A     INC $3A64    (increment next Wait Queue position)
C2/009D: BD 20 37     LDA $3720,X  (see who's in line at current position)
C2/00A0: 30 F0        BMI $0092    (if it's null entry, skip it and check next one)
C2/00A2: AA           TAX 
C2/00A3: 4C 88 21     JMP $2188
C2/00A6: AE 06 34     LDX $3406
C2/00A9: 10 17        BPL $00C2
C2/00AB: AE 66 3A     LDX $3A66  (get position of next Action Queue slot to read)
C2/00AE: EC 67 3A     CPX $3A67  (does it match position of the next available [unused]
                                  queue slot?  iow, have we read through the end of queue?)
C2/00B1: D0 06        BNE $00B9  (if not, branch)
C2/00B3: 9C 95 3A     STZ $3A95
C2/00B6: 4C 19 00     JMP $0019
C2/00B9: EE 66 3A     INC $3A66    (increment next Action Queue position)
C2/00BC: BD 20 38     LDA $3820,X  (see who's in line at current position)
C2/00BF: 30 EA        BMI $00AB    (if it's null entry, which can happen from Palidor
                                    and who knows what else, skip it and check next one)
C2/00C1: AA           TAX 
C2/00C2: 4C F9 00     JMP $00F9
C2/00C5: A9 09        LDA #$09
C2/00C7: 20 11 64     JSR $6411
C2/00CA: 28           PLP 
C2/00CB: 6B           RTL 

C2/00CC redraw main menus of characters

(Will keep grayed versus white commands up-to-date.)
C2/00CC: A2 06        LDX #$06
C2/00CE: BD 18 30     LDA $3018,X
C2/00D1: 1C 58 3A     TRB $3A58    (clear flag to redraw this character's menu
                                    [note that switching between characters with
                                    X and Y will still redraw])
C2/00D4: F0 09        BEQ $00DF    (branch if it hadn't been set)
C2/00D6: 86 10        STX $10
C2/00D8: 46 10        LSR $10
C2/00DA: A9 0B        LDA #$0B
C2/00DC: 20 11 64     JSR $6411    (this must be responsible for the menu redrawing)
C2/00DF: CA           DEX 
C2/00E0: CA           DEX 
C2/00E1: 10 EB        BPL $00CE    (loop for all 4 party members)
C2/00E3: 60           RTS 

C2/00E4 unknow

C2/00E4: 0C 2C 3F     TSB $3F2C    (set "Jumping" flag for whomever is held in A)
C2/00E7: E2 20        SEP #$20     (Set 8-bit Accumulator)
C2/00E9: BD A0 3A     LDA $3AA0,X
C2/00EC: 09 08        ORA #$08
C2/00EE: 29 DF        AND #$DF
C2/00F0: 9D A0 3A     STA $3AA0,X  ($3AA0: turn on bit 3 and turn off bit 5)
C2/00F3: 9E B5 3A     STZ $3AB5,X  
C2/00F6: 4C 66 4E     JMP $4E66

C2/00F9 unknow

C2/00F9: 38           SEC
C2/00FA: 6E 06 34     ROR $3406   (set top bit of $3406)
C2/00FD: F4 18 00     PEA $0018
C2/0100: A9 12        LDA #$12
C2/0102: 85 B5        STA $B5 
C2/0104: 8D 7C 3A     STA $3A7C
C2/0107: BD CC 32     LDA $32CC,X
C2/010A: 30 77        BMI $0183
C2/010C: 0A           ASL 
C2/010D: A8           TAY 
C2/010E: B9 20 34     LDA $3420,Y
C2/0111: C9 12        CMP #$12   
C2/0113: D0 03        BNE $0118   (Branch if not Mimic)
C2/0115: 20 D9 01     JSR $01D9
C2/0118: 38           SEC 
C2/0119: 20 76 02     JSR $0276
C2/011C: C9 1F        CMP #$1F    (is the command Counterattack?)
C2/011E: D0 1E        BNE $013E   (branch if not)
C2/0120: 20 01 03     JSR $0301
C2/0123: AD 97 3A     LDA $3A97
C2/0126: D0 0C        BNE $0134   (branch if in the Colosseum)
C2/0128: BD 95 33     LDA $3395,X
C2/012B: 10 07        BPL $0134   (branch if the monster is Charmed)
C2/012D: BD E5 3E     LDA $3EE5,X
C2/0130: 89 30        BIT #$30
C2/0132: F0 05        BEQ $0139   (Branch if not Berserk or Muddled)
C2/0134: 20 34 06     JSR $0634   (Picks random command for monsters)
C2/0137: 80 C7        BRA $0100
C2/0139: 20 DC 02     JSR $02DC   (Pick command for monster)
C2/013C: 80 C2        BRA $0100
C2/013E: C9 16        CMP #$16    (is the command Jump?)
C2/0140: D0 0C        BNE $014E   (branch if not)
C2/0142: C2 20        REP #$20    (Set 16-bit Accumulator)
C2/0144: BD 18 30     LDA $3018,X
C2/0147: 1C 2C 3F     TRB $3F2C   (clear the monster's "Jumping" flag)
C2/014A: F0 98        BEQ $00E4   (if it hadn't been set, we're currently initiating a
                                   jump rather than landing from one, so go set the
                                   flag and do some other preparation.)
C2/014C: E2 20        SEP #$20
C2/014E: BD CC 32     LDA $32CC,X
C2/0151: A8           TAY 
C2/0152: B9 84 31     LDA $3184,Y
C2/0155: DD CC 32     CMP $32CC,X
C2/0158: D0 13        BNE $016D
C2/015A: A9 80        LDA #$80
C2/015C: 14 B1        TRB $B1
C2/015E: A9 FF        LDA #$FF
C2/0160: EC 04 34     CPX $3404   (Is this target under the influence of Quick?)
C2/0163: D0 08        BNE $016D   (Branch if not)
C2/0165: CE 02 34     DEC $3402   (Decrement the number of turns due to Quick)
C2/0168: D0 03        BNE $016D   (Branch if this was not the last Quick turn)
C2/016A: 8D 04 34     STA $3404   (If it was, store an #$FF (empty) in Quick's target byte)
C2/016D: EB           XBA 
C2/016E: BD A0 3A     LDA $3AA0,X
C2/0171: 89 50        BIT #$50    
C2/0173: F0 05        BEQ $017A   (branch if bits 4 and 6 both unset)
C2/0175: A9 80        LDA #$80
C2/0177: 4C AB 5B     JMP $5BAB   (set bit 7 of $3AA1,X)
C2/017A: A9 FF        LDA #$FF
C2/017C: 99 84 31     STA $3184,Y
C2/017F: EB           XBA 
C2/0180: 9D CC 32     STA $32CC,X
C2/0183: BD A0 3A     LDA $3AA0,X
C2/0186: 29 D7        AND #$D7     
C2/0188: 09 40        ORA #$40
C2/018A: 9D A0 3A     STA $3AA0,X  (turn off bits 3 and 5.  turn on bit 6.)
C2/018D: 4A           LSR 
C2/018E: 90 16        BCC $01A6
C2/0190: BD 04 32     LDA $3204,X
C2/0193: 09 04        ORA #$04
C2/0195: 9D 04 32     STA $3204,X
C2/0198: BD 05 32     LDA $3205,X
C2/019B: 09 80        ORA #$80
C2/019D: 9D 05 32     STA $3205,X
C2/01A0: 20 D3 13     JSR $13D3
C2/01A3: 20 1E 02     JSR $021E
C2/01A6: A9 A0        LDA #$A0
C2/01A8: 04 B0        TSB $B0
C2/01AA: A9 10        LDA #$10
C2/01AC: 1C 46 3A     TRB $3A46
C2/01AF: D0 06        BNE $01B7
C2/01B1: BD CC 32     LDA $32CC,X
C2/01B4: 1A           INC 
C2/01B5: D0 1E        BNE $01D5
C2/01B7: BD A0 3A     LDA $3AA0,X
C2/01BA: 89 08        BIT #$08
C2/01BC: D0 08        BNE $01C6
C2/01BE: FE 19 32     INC $3219,X
C2/01C1: D0 03        BNE $01C6
C2/01C3: DE 19 32     DEC $3219,X
C2/01C6: A9 FF        LDA #$FF
C2/01C8: 9D 2C 32     STA $322C,X
C2/01CB: 9E B5 3A     STZ $3AB5,X
C2/01CE: A9 80        LDA #$80
C2/01D0: 14 B0        TRB $B0
C2/01D2: 4C 67 02     JMP $0267
C2/01D5: 8E 06 34     STX $3406
C2/01D8: 60           RTS 

C2/01D9 mimic related

C2/01D9: AD 28 3F     LDA $3F28   (16h if last character command was Jump,12h if it's a different command)
C2/01DC: C9 16        CMP #$16
C2/01DE: D0 11        BNE $01F1   (branch if not Jump)
C2/01E0: C2 20        REP #$20
C2/01E2: AD 28 3F     LDA $3F28
C2/01E5: 99 20 34     STA $3420,Y
C2/01E8: AD 2A 3F     LDA $3F2A
C2/01EB: 99 20 35     STA $3520,Y
C2/01EE: E2 20        SEP #$20
C2/01F0: 60           RTS 

C2/01F1 unknow

C2/01F1: C2 20        REP #$20
C2/01F3: AD 20 3F     LDA $3F20
C2/01F6: 99 20 34     STA $3420,Y
C2/01F9: AD 22 3F     LDA $3F22
C2/01FC: 99 20 35     STA $3520,Y
C2/01FF: E2 20        SEP #$20
C2/0201: AD 24 3F     LDA $3F24
C2/0204: C9 12        CMP #$12
C2/0206: F0 D0        BEQ $01D8
C2/0208: C2 20        REP #$20
C2/020A: AD 24 3F     LDA $3F24
C2/020D: 8D 7A 3A     STA $3A7A
C2/0210: AD 26 3F     LDA $3F26
C2/0213: 85 B8        STA $B8
C2/0215: E2 20        SEP #$20
C2/0217: A9 40        LDA #$40
C2/0219: 04 B1        TSB $B1
C2/021B: 4C CB 4E     JMP $4ECB

C2/021E save last attack to be used by mimic command

C2/021E: DA           PHX 
C2/021F: 08           PHP 
C2/0220: E0 08        CPX #$08
C2/0222: B0 40        BCS $0264    (branch if it's a monster taking this turn)
C2/0224: AD 7C 3A     LDA $3A7C
C2/0227: C9 1E        CMP #$1E
C2/0229: B0 39        BCS $0264    (branch if not a normal character command.  iow, Roulette or a counterattack)
C2/022B: 0A           ASL 
C2/022C: AA           TAX 
C2/022D: BF 00 FE CF  LDA $CFFE00,X  (get command data)
C2/0231: 89 02        BIT #$02
C2/0233: F0 2F        BEQ $0264    (branch if this command can't be Mimicked)
C2/0235: A9 12        LDA #$12
C2/0237: 8D 28 3F     STA $3F28    (indicate to Mimic that the command is something other than Jump?)
C2/023A: AD 7C 3A     LDA $3A7C
C2/023D: C9 17        CMP #$17
C2/023F: F0 15        BEQ $0256    (branch if command is X-Magic)
C2/0241: A9 12        LDA #$12
C2/0243: 8D 24 3F     STA $3F24    (Last attack (second attack w/ Gem Box) (for use by Mimic).
C2/0246: C2 20        REP #$20
C2/0248: AD 7C 3A     LDA $3A7C
C2/024B: 8D 20 3F     STA $3F20    (Last attack (for use by Mimic))
C2/024E: AD 30 3A     LDA $3A30
C2/0251: 8D 22 3F     STA $3F22    (Last targets (for use by Mimic))
C2/0254: 80 0E        BRA $0264
C2/0256: C2 20        REP #$20
C2/0258: AD 7C 3A     LDA $3A7C
C2/025B: 8D 24 3F     STA $3F24    (Last attack (second attack w/ Gem Box) (for use by Mimic))
C2/025E: AD 30 3A     LDA $3A30
C2/0261: 8D 26 3F     STA $3F26    (Last targets (second attack w/ Gem Box) (for use by Mimic))
C2/0264: 28           PLP 
C2/0265: FA           PLX 
C2/0266: 60           RTS 

C2/0267 unknow

C2/0267: A9 0D        LDA #$0D
C2/0269: 8D 6E 2D     STA $2D6E
C2/026C: A9 FF        LDA #$FF
C2/026E: 8D 72 2D     STA $2D72
C2/0271: A9 04        LDA #$04
C2/0273: 4C 11 64     JMP $6411

C2/0276 unknow

C2/0276: 08           PHP 
C2/0277: C2 20        REP #$20    (Set 16-bit Accumulator)
C2/0279: B9 20 35     LDA $3520,Y
C2/027C: 85 B8        STA $B8
C2/027E: B9 20 34     LDA $3420,Y
C2/0281: 8D 7C 3A     STA $3A7C
C2/0284: 85 B5        STA $B5
C2/0286: 28           PLP 
C2/0287: 48           PHA 
C2/0288: 90 10        BCC $029A
C2/028A: C9 1D        CMP #$1D
C2/028C: B0 0C        BCS $029A   (Branch if command is MagiTek or a non-character command?)
C2/028E: BD 18 30     LDA $3018,X
C2/0291: 1C 4A 3A     TRB $3A4A
C2/0294: F0 04        BEQ $029A
C2/0296: 64 B8        STZ $B8
C2/0298: 64 B9        STZ $B9
C2/029A: B9 20 36     LDA $3620,Y
C2/029D: 8D 4C 3A     STA $3A4C    (save actual MP cost to caster)
C2/02A0: BD E4 3E     LDA $3EE4,X
C2/02A3: 89 20        BIT #$20    (Check for Imp Status)
C2/02A5: F0 33        BEQ $02DA   (If not imp)
C2/02A7: A5 B5        LDA $B5     (get command)
C2/02A9: C9 1E        CMP #$1E
C2/02AB: B0 2D        BCS $02DA   (branch if not character command)
C2/02AD: DA           PHX 
C2/02AE: 0A           ASL 
C2/02AF: AA           TAX 
C2/02B0: BF 00 FE CF  LDA $CFFE00,X  (get command data)
C2/02B4: FA           PLX 
C2/02B5: 89 04        BIT #$04
C2/02B7: D0 21        BNE $02DA   (branch if command is supported while Imped)
C2/02B9: 9C 4C 3A     STZ $3A4C   (zero actual MP cost to caster)
C2/02BC: DA           PHX 
C2/02BD: 7B           TDC         (clear 16-bit A)
C2/02BE: E0 08        CPX #$08    (set Carry if monster attacker)
C2/02C0: 2A           ROL         
C2/02C1: AA           TAX         (move Carry into X)
C2/02C2: B5 B8        LDA $B8,X   (get targets from $B8 or $B9)
C2/02C4: 3D 40 3A     AND $3A40,X (characters acting as enemies)
C2/02C7: 95 B8        STA $B8,X   (remove all targets who weren't members of opposition)
C2/02C9: C2 20        REP #$20
C2/02CB: 9C 7C 3A     STZ $3A7C
C2/02CE: 64 B5        STZ $B5     (zero out command, making it Fight?)
C2/02D0: A5 B8        LDA $B8     (get all targets of attack)
C2/02D2: 20 2A 52     JSR $522A   (pick one at random)
C2/02D5: 85 B8        STA $B8
C2/02D7: E2 20        SEP #$20
C2/02D9: FA           PLX 
C2/02DA: 68           PLA 
C2/02DB: 60           RTS 

C2/02DC unknow

C2/02DC: C2 20        REP #$20
C2/02DE: 9C 98 3A     STZ $3A98
C2/02E1: BD 54 32     LDA $3254,X
C2/02E4: 85 F0        STA $F0
C2/02E6: BD 0C 3D     LDA $3D0C,X
C2/02E9: 85 F2        STA $F2
C2/02EB: BD 40 32     LDA $3240,X
C2/02EE: 85 F4        STA $F4
C2/02F0: 18           CLC 
C2/02F1: 20 2F 1A     JSR $1A2F
C2/02F4: A5 F2        LDA $F2
C2/02F6: 9D 0C 3D     STA $3D0C,X
C2/02F9: E2 20        SEP #$20
C2/02FB: A5 F5        LDA $F5
C2/02FD: 9D 40 32     STA $3240,X
C2/0300: 60           RTS 

C2/0301 unknow

C2/0301: BD CC 32     LDA $32CC,X
C2/0304: 30 15        BMI $031B
C2/0306: 5A           PHY 
C2/0307: A8           TAY 
C2/0308: B9 84 31     LDA $3184,Y
C2/030B: DD CC 32     CMP $32CC,X
C2/030E: D0 02        BNE $0312
C2/0310: A9 FF        LDA #$FF
C2/0312: 9D CC 32     STA $32CC,X
C2/0315: A9 FF        LDA #$FF
C2/0317: 99 84 31     STA $3184,Y
C2/031A: 7A           PLY 
C2/031B: 60           RTS 

C2/031C unknow

C2/031C: 64 B8        STZ $B8
C2/031E: 64 B9        STZ $B9
C2/0320: FE 2C 32     INC $322C,X
C2/0323: F0 03        BEQ $0328
C2/0325: DE 2C 32     DEC $322C,X  (if Time to Wait is FFh, set it 0)
C2/0328: 20 41 0A     JSR $0A41
C2/032B: BD 4C 3E     LDA $3E4C,X
C2/032E: 29 FA        AND #$FA
C2/0330: 9D 4C 3E     STA $3E4C,X  (Clear Retort and Runic)
C2/0333: E0 08        CPX #$08
C2/0335: 90 0D        BCC $0344    (branch if character)
C2/0337: BD CC 32     LDA $32CC,X
C2/033A: 10 1B        BPL $0357
C2/033C: A9 1F        LDA #$1F
C2/033E: 8D 7A 3A     STA $3A7A
C2/0341: 4C CB 4E     JMP $4ECB

C2/0344 unknow

C2/0344: BD 18 30     LDA $3018,X
C2/0347: 1C 4A 3A     TRB $3A4A
C2/034A: BD 55 32     LDA $3255,X
C2/034D: 30 03        BMI $0352
C2/034F: 4C DC 02     JMP $02DC

C2/0352 unknow

C2/0352: BD CC 32     LDA $32CC,X
C2/0355: 30 24        BMI $037B
C2/0357: 48           PHA 
C2/0358: 0A           ASL 
C2/0359: A8           TAY 
C2/035A: C2 20        REP #$20
C2/035C: B9 20 35     LDA $3520,Y
C2/035F: 85 B8        STA $B8
C2/0361: B9 20 34     LDA $3420,Y
C2/0364: 20 E4 03     JSR $03E4
C2/0367: A5 B8        LDA $B8
C2/0369: 99 20 35     STA $3520,Y
C2/036C: E2 20        SEP #$20
C2/036E: 68           PLA 
C2/036F: A8           TAY 
C2/0370: D9 84 31     CMP $3184,Y
C2/0373: F0 05        BEQ $037A
C2/0375: B9 84 31     LDA $3184,Y
C2/0378: 80 DD        BRA $0357
C2/037A: 60           RTS 

C2/037B unknow

C2/037B: BD F8 3E     LDA $3EF8,X
C2/037E: 4A           LSR 
C2/037F: B0 56        BCS $03D7   (Branch if Dance status)
C2/0381: BD F9 3E     LDA $3EF9,X
C2/0384: 4A           LSR 
C2/0385: B0 47        BCS $03CE   (Branch if Rage status)
C2/0387: BD E4 3E     LDA $3EE4,X
C2/038A: 89 08        BIT #$08    
C2/038C: D0 38        BNE $03C6   (Branch if M-Tek Status)
C2/038E: 20 20 04     JSR $0420
C2/0391: C9 17        CMP #$17
C2/0393: D0 1B        BNE $03B0   (Branch if not X-Magic)
C2/0395: 48           PHA 
C2/0396: EB           XBA 
C2/0397: 48           PHA 
C2/0398: 48           PHA 
C2/0399: 9B           TXY 
C2/039A: 20 1A 05     JSR $051A   (Pick another spell)
C2/039D: 83 01        STA $01,S
C2/039F: 68           PLA 
C2/03A0: EB           XBA 
C2/03A1: A9 02        LDA #$02
C2/03A3: 20 E4 03     JSR $03E4
C2/03A6: 20 CB 4E     JSR $4ECB
C2/03A9: 64 B8        STZ $B8
C2/03AB: 64 B9        STZ $B9
C2/03AD: 68           PLA 
C2/03AE: EB           XBA 
C2/03AF: 68           PLA 
C2/03B0: 20 B9 03     JSR $03B9
C2/03B3: 20 E4 03     JSR $03E4
C2/03B6: 4C CB 4E     JMP $4ECB

C2/03B9 swap roulette to enemy roulette

C2/03B9: 08           PHP
C2/03BA: C2 20        REP #$20
C2/03BC: C9 0C 8C     CMP #$8C0C  (is the command Lore and the attack Roulette?)
C2/03BF: D0 03        BNE $03C4   (branch if not)
C2/03C1: A9 1E 8C     LDA #$8C1E  (set command to Enemy Roulette, keep attack as Roulette)
C2/03C4: 28           PLP
C2/03C5: 60           RTS

C2/03C6 unknow

C2/03C6: 20 84 05     JSR $0584
C2/03C9: EB           XBA 
C2/03CA: A9 1D        LDA #$1D
C2/03CC: 80 10        BRA $03DE
C2/03CE: 9B           TXY
C2/03CF: 20 D1 05     JSR $05D1  (Picks a Rage [when Muddled/Berserked/etc], and picks the Rage move)
C2/03D2: EB           XBA 
C2/03D3: A9 10        LDA #$10
C2/03D5: 80 07        BRA $03DE
C2/03D7: 9B           TXY
C2/03D8: 20 9C 05     JSR $059C
C2/03DB: EB           XBA 
C2/03DC: A9 13        LDA #$13
C2/03DE: 20 E4 03     JSR $03E4
C2/03E1: 4C CB 4E     JMP $4ECB

C2/03E4 unknow

C2/03E4: 08           PHP
C2/03E5: E2 30        SEP #$30       (Set 8-bit A,X, & Y)
C2/03E7: 8D 7A 3A     STA $3A7A
C2/03EA: EB           XBA 
C2/03EB: 8D 7B 3A     STA $3A7B
C2/03EE: EB           XBA 
C2/03EF: C9 1E        CMP #$1E
C2/03F1: B0 2B        BCS $041E      (branch if command is 1Eh or above.. i.e. it's enemy Roulette or a counterattack)
C2/03F3: 48           PHA 
C2/03F4: DA           PHX 
C2/03F5: AA           TAX 
C2/03F6: BF 7B 06 C2  LDA $C2067B,X  (get command's "time to wait")
C2/03FA: FA           PLX 
C2/03FB: 18           CLC 
C2/03FC: 7D 2C 32     ADC $322C,X    (add it to character's existing "time to wait")
C2/03FF: B0 03        BCS $0404
C2/0401: 1A           INC 
C2/0402: D0 02        BNE $0406
C2/0404: A9 FF        LDA #$FF
C2/0406: 3A           DEC            (if sum overflowed or equalled FFh, set it to FEh)
C2/0407: 9D 2C 32     STA $322C,X    (update time to wait)
C2/040A: 68           PLA 
C2/040B: 20 D3 26     JSR $26D3
C2/040E: A9 04        LDA #$04
C2/0410: 14 BA        TRB $BA       (Clear "Don't retarget if target invalid")
C2/0412: C2 20        REP #$20
C2/0414: A5 B8        LDA $B8
C2/0416: D0 06        BNE $041E     (branch if there are already targets)
C2/0418: 9C 4E 3A     STZ $3A4E
C2/041B: 20 7E 58     JSR $587E     (targeting function)
C2/041E: 28           PLP 
C2/041F: 60           RTS 

C2/0420 pick action if berserked, zombied, muddled, charmed or in the colosseum

C2/0420: 8A           TXA
C2/0421: EB           XBA 
C2/0422: A9 06        LDA #$06
C2/0424: 20 81 47     JSR $4781    (X * 6)
C2/0427: A8           TAY 
C2/0428: 64 FE        STZ $FE      (save Fight as Command 5)
C2/042A: 64 FF        STZ $FF      
C2/042C: B9 2E 20     LDA $202E,Y  (get Command 1)
C2/042F: 85 F6        STA $F6
C2/0431: B9 31 20     LDA $2031,Y  (get Command 2)
C2/0434: 85 F8        STA $F8
C2/0436: B9 34 20     LDA $2034,Y  (get Command 3)
C2/0439: 85 FA        STA $FA
C2/043B: B9 37 20     LDA $2037,Y  (get Command 4)
C2/043E: 85 FC        STA $FC
C2/0440: A9 05        LDA #$05     (indicate 5 valid commands to choose from)
C2/0442: 85 F5        STA $F5
C2/0444: BD E5 3E     LDA $3EE5,X  (Status byte 2)
C2/0447: 0A           ASL 
C2/0448: 0A           ASL 
C2/0449: 85 F4        STA $F4      (Bit 7 = Muddled, Bit 6 = Berserk, etc)
C2/044B: 0A           ASL 
C2/044C: 10 04        BPL $0452    (If no Berserk status)
C2/044E: 64 F4        STZ $F4      (Clear $F4, then skip Charm and Colosseum checks if Berserked)
C2/0450: 80 0C        BRA $045E    
C2/0452: BD 95 33     LDA $3395,X  (Which target Charmed you)
C2/0455: 49 80        EOR #$80     (FFh indicates no Charmer, so Bit 7 will now be set if there IS a Charmer)
C2/0457: 04 F4        TSB $F4
C2/0459: AD 97 3A     LDA $3A97    (Top bit indicates Colosseum battle?)
C2/045C: 04 F4        TSB $F4
(Note that Berserk status will override Muddle/Charm/Colosseum for purposes of
 determining whether we choose from the C2/04D0 or the C2/04D4 command list.
 In contrast, Zombie will not; Charm/Colosseum/Muddle override it.)
C2/045E: 9B           TXY          (Y now points to the attacker who is taking this turn)
C2/045F: DA           PHX 
C2/0460: A2 06        LDX #$06       (start checking 4th command slot)
C2/0462: DA           PHX            (save slot position)
C2/0463: B5 F6        LDA $F6,X
C2/0465: 48           PHA            (save command)
C2/0466: 30 1A        BMI $0482      (branch if slot empty)
C2/0468: 18           CLC            (clear Carry)
C2/0469: 20 17 52     JSR $5217      (X = A DIV 8, A = 2 ^ (A MOD 8) )
C2/046C: 3F D0 04 C2  AND $C204D0,X  (is command allowed when Muddled/Charmed/Colosseum?)
C2/0470: F0 10        BEQ $0482      (branch if not)
C2/0472: A5 F4        LDA $F4
C2/0474: 30 12        BMI $0488      (Branch if Muddled/Charmed/Colosseum but not Berserked)
C2/0476: A3 01        LDA $01,S      (get command)
C2/0478: 18           CLC 
C2/0479: 20 17 52     JSR $5217      (X = A DIV 8, A = 2 ^ (A MOD 8) )
C2/047C: 3F D4 04 C2  AND $C204D4,X  (is command allowed when Berserked/Zombied?)
C2/0480: D0 06        BNE $0488      (branch if so)
C2/0482: A9 FF        LDA #$FF 
C2/0484: 83 01        STA $01,S      (replace command on stack with Empty entry)
C2/0486: C6 F5        DEC $F5        (decrement number of valid commands)
C2/0488: 7B           TDC            (clear 16-bit A)
C2/0489: A3 01        LDA $01,S      (get current command)

(Loop below sees if our current command is one that requires special code to
 work with Muddle/Charm/Colosseum/Berserk/Zombie.  If it is, a special function
 is called for the command.)

C2/048B: A2 08        LDX #$08
C2/048D: DF D8 04 C2  CMP $C204D8,X  (does our current command match one from table?)
C2/0491: D0 06        BNE $0499      (if not, compare it to a second command in this loop iteration)
C2/0493: FC E2 04     JSR ($04E2,X)  (if it does, call the special code used by that command)
C2/0496: EB           XBA            (put attack/spell # in top of A)
C2/0497: 80 10        BRA $04A9      (exit loop, as we found our command)
C2/0499: DF D9 04 C2  CMP $C204D9,X  (does our current command match one from table?)
C2/049D: D0 06        BNE $04A5      (if not, our current command didn't match either
                                      compared one.  so move to new pair of commands
                                      in table, and repeat loop)
C2/049F: FC EC 04     JSR ($04EC,X)  (if it did match, call the special code used
                                      by that command)
C2/04A2: EB           XBA            (put attack/spell # in top of A)
C2/04A3: 80 04        BRA $04A9      (exit loop, as we found our command)
C2/04A5: CA           DEX 
C2/04A6: CA           DEX 
C2/04A7: 10 E4        BPL $048D     (Loop to compare current command to all 10 commands
                                     that utilize special code.
                                     If this loop doesn't exit before X becomes negative,
                                     that means our current command has no special function,
                                     and the Attack # in the top half of A will be zero.)
C2/04A9: 68           PLA           (get command # from stack)
C2/04AA: FA           PLX           (get command slot from stack)
C2/04AB: 95 F6        STA $F6,X     (save command # in current command slot)
C2/04AD: EB           XBA 
C2/04AE: 95 F7        STA $F7,X     (save attack/spell # corresponding to that attack)
C2/04B0: CA           DEX 
C2/04B1: CA           DEX 
C2/04B2: 10 AE        BPL $0462     (loop for first 4 command slots)

(Fight has been put in the 5th command slot.  Any valid commands, with their
 accompanying attack/spell numbers, have been established for slots 1 thru 4.
 Now we shall randomly pick from those commands.  Each slot should have equal
 probability of being chosen.)

C2/04B4: A5 F5        LDA $F5     (# of valid command slots)
C2/04B6: 20 65 4B     JSR $4B65   (RNG: 0 to A - 1 .  we're randomly picking a command)
C2/04B9: A8           TAY         
C2/04BA: A2 08        LDX #$08    (start pointing to Command slot 5)
C2/04BC: B5 F6        LDA $F6,X
C2/04BE: 30 03        BMI $04C3   (if that command slot is Empty, move to next one)
C2/04C0: 88           DEY         (only decrement when on a valid command slot)
C2/04C1: 30 07        BMI $04CA   (If Y is negative, we've found our Nth valid command
                                   [starting with the last valid command and counting
                                   backward], where N is the number returned from the
                                   RNG plus 1.
                                   This is what we wanted, so branch.)

C2/04C3: CA           DEX 
C2/04C4: CA           DEX 
C2/04C5: 10 F5        BPL $04BC   (loop for all 5 command slots)
C2/04C7: 7B           TDC         (clear 16-bit A)
C2/04C8: 80 04        BRA $04CE   (clean up stack and exit function.  A is zero,
                                   indicating Fight, which must be a fallback in case
                                   all 5 Command slots somehow came up useless.  not
                                   sure how that'd happen, as Slot #5 should always
                                   hold Fight anyway...)

C2/04CA: EB           XBA 
C2/04CB: B5 F7        LDA $F7,X
C2/04CD: EB           XBA         (bottom of A = command # from $F6,X
                                   top of A = attack/spell # from $F7,X)
C2/04CE: FA           PLX 
C2/04CF: 60           RTS 

C2/04D0 data - commands allowed in colosseum, muddled or charmed

C2/04D0: ED  (Fight, Magic, Morph, Steal, Capture, SwdTech)
C2/04D1: 3E  (Tools, Blitz, Runic, Lore, Sketch)
C2/04D2: DD  (Rage, Mimic, Dance, Row, Jump, X-Magic)
C2/04D3: 2D  (GP Rain, Health, Shock, MagiTek)

C2/04D4 data - commands allowed when berserked or zombied

C2/04D4: 41  (Fight, Capture)
C2/04D5: 00  (none)
C2/04D6: 41  (Rage, Jump)
C2/04D7: 20  (MagiTek)

C2/04D8 data - commands with special functions when acts automatically

C2/04D8: 02   (Magic)
C2/04D9: 17   (X-Magic)
C2/04DA: 07   (SwdTech)
C2/04DB: 0A   (Blitz)
C2/04DC: 10   (Rage)
C2/04DD: 13   (Dance)
C2/04DE: 0C   (Lore)
C2/04DF: 03   (Morph)
C2/04E0: 1D   (MagiTek)
C2/04E1: 09   (Tools)

C2/04E2 unknow - code pointers

C2/04E2: 1A 05     (Magic)
C2/04E4: 60 05     (SwdTech)
C2/04E6: D1 05     (Rage)
C2/04E8: F6 04     (Lore)
C2/04EA: 84 05     (MagiTek)
C2/04EC: 1A 05     (X-Magic)
C2/04EE: 75 05     (Blitz)
C2/04F0: 9C 05     (Dance)
C2/04F2: 57 05     (Morph)
C2/04F4: 8D 05     (Tools)

C2/04F6 lore command - auto setup

C2/04F6: B9 E5 3E     LDA $3EE5,Y (Status Byte 2)
C2/04F9: 89 08        BIT #$08
C2/04FB: D0 52        BNE $054F   (If Mute)
C2/04FD: AD 87 3A     LDA $3A87   (Number of Lores possessed?)
C2/0500: F0 4D        BEQ $054F   (if there's zero, don't use Lore command)
C2/0502: 48           PHA 
C2/0503: C2 21        REP #$21
C2/0505: B9 2C 30     LDA $302C,Y (starting address of Magic menu?)
C2/0508: 69 D8 00     ADC #$00D8  (add 54 spells * 4 to get to next menu(?), which is Lore?)
C2/050B: 85 EE        STA $EE
C2/050D: E2 20        SEP #$20    (Set 8-bit Accumulator)
C2/050F: 68           PLA 
C2/0510: EB           XBA         (put # of Lores possessed in top of A)
C2/0511: A9 60        LDA #$60    (there are 24 Lores, and each menu slot must occupy
                                   4 bytes, so set loop limit to 96)
C2/0513: 20 34 05     JSR $0534   (randomly pick a valid Lore menu slot)
C2/0516: 18           CLC
C2/0517: 69 8B        ADC #$8B    (first Lore is #139, Condemned)
C2/0519: 60           RTS 

C2/051A magic and x-magic command - auto setup

C2/051A: B9 E5 3E     LDA $3EE5,Y (Status Byte 2)
C2/051D: 89 08        BIT #$08
C2/051F: D0 2E        BNE $054F   (If Mute)
C2/0521: B9 F8 3C     LDA $3CF8,Y (Number of spells possessed by this character?)
C2/0524: F0 29        BEQ $054F   (if there's zero, don't use Magic/X-Magic command)
C2/0526: 48           PHA 
C2/0527: C2 20        REP #$20    (Set 16-bit Accumulator)
C2/0529: B9 2C 30     LDA $302C,Y (starting address of Magic menu?)
C2/052C: 85 EE        STA $EE
C2/052E: E2 20        SEP #$20    (Set 8-bit Accumulator)
C2/0530: 68           PLA 
C2/0531: EB           XBA         (put # of spells possessed in top of A)
C2/0532: A9 D8        LDA #$D8    (there are 54 spells, and each menu slot must occupy
                                   4 bytes, so set loop limit to 216)
C2/0534: DA           PHX 
C2/0535: 5A           PHY 
C2/0536: A8           TAY 
C2/0537: EB           XBA         (retrieve number of spells/Lores possessed)
C2/0538: 20 65 4B     JSR $4B65   (RNG: 0 to A - 1 . we're randomly picking a
                                   spell/lore)
C2/053B: AA           TAX
C2/053C: B1 EE        LDA ($EE),Y (what's in this Magic/Lore menu slot?)
C2/053E: C9 FF        CMP #$FF    (is it null?)
C2/0540: F0 03        BEQ $0545   (if so, skip to next slot)
C2/0542: CA           DEX         
C2/0543: 30 07        BMI $054C   (If X becomes negative, that means we've found the
                                   Nth valid slot [starting with the last valid slot
                                   and counting backward], where N is the X returned
                                   from our RNG plus 1.
                                   This is what we wanted, so branch.)
C2/0545: 88           DEY 
C2/0546: 88           DEY 
C2/0547: 88           DEY 
C2/0548: 88           DEY 
C2/0549: D0 F1        BNE $053C   (loop and check next slot)
C2/054B: 7B           TDC         (if we didn't get any matches, just use Fire
                                   [or Condemned for Lore, since 139 gets added])
C2/054C: 7A           PLY 
C2/054D: FA           PLX 
C2/054E: 60           RTS 

C2/054F randomly chosen command failed

C2/054F: C6 F5        DEC $F5     (decrement # of valid command slots)
C2/0551: A9 FF        LDA #$FF
C2/0553: 83 03        STA $03,S   (store Empty in current command slot, indicating
                                   that it cannot be chosen)
C2/0555: 7B           TDC         (clear 16-bit A.  note that only the bottom 8-bits,
                                   which indicate the attack/spell #, matter.. 
                                   the command # is loaded by the stack retrieval at
                                   C2/04A9, and will obviously be FFh in this case.)
C2/0556: 60           RTS 

C2/0557 morph command - check availability

C2/0557: A9 0F        LDA #$0F
C2/0559: CD F6 1C     CMP $1CF6   (Morph supply)
C2/055C: 7B           TDC         (clear 16-bit A)
C2/055D: B0 F0        BCS $054F   (if Morph supply isn't at least 16, don't allow Morph command)
C2/055F: 60           RTS 

C2/0560 sword tech command - auto setup

C2/0560: B9 A4 3B     LDA $3BA4,Y (Special properties for right-hand weapon slot)
C2/0563: 19 A5 3B     ORA $3BA5,Y ( for left-hand)
C2/0566: 89 02        BIT #$02    (is Swdtech allowed by either hand?)
C2/0568: F0 E5        BEQ $054F   (if not, don't use Swdtech as command)
C2/056A: AD 20 20     LDA $2020   (index of highest known Swdtech?)
C2/056D: 1A           INC         (# of known Swdtechs)
C2/056E: 20 65 4B     JSR $4B65   (Pick a known Swdtech)
C2/0571: 18           CLC 
C2/0572: 69 55        ADC #$55    (first Swdtech is #85, Dispatch)
C2/0574: 60           RTS 

C2/0575 blitz command - auto setup

C2/0575: 7B           TDC
C2/0576: AD 28 1D     LDA $1D28   (Known Blitzes)
C2/0579: 20 2A 52     JSR $522A   (Pick a random bit that is set)
C2/057C: 20 F0 51     JSR $51F0   (Get which bit is picked)
C2/057F: 8A           TXA 
C2/0580: 18           CLC
C2/0581: 69 5D        ADC #$5D    (first Blitz is #93, Pummel)
C2/0583: 60           RTS 

C2/0584 magitek command - auto setup

C2/0584: A9 03        LDA #$03
C2/0586: 20 65 4B     JSR $4B65   (0 to 2 -- only pick between first 3 MagiTek moves,
                                   since anybody besides Terra can only use
                                   Fire Beam + Bolt Beam + Ice Beam + Heal Force,
                                   but there's Bio Blast in between those last two.

                                   just picking from the first three simplifies code,
                                   although decent planning would have had Heal Force
                                   before Bio Blast..  or add a few instructions here
                                   and include Bio Blast anyway.)
C2/0589: 18           CLC 
C2/058A: 69 83        ADC #$83    (first MagiTek move is #131, Fire Beam)
C2/058C: 60           RTS 

C2/058d tools command - auto setup

C2/058D: 7B           TDC
C2/058E: AD 9B 3A     LDA $3A9B   (Which tools are owned)
C2/0591: 20 2A 52     JSR $522A   (Pick a random tool that is owned)
C2/0594: 20 F0 51     JSR $51F0   (Get which bit is set, thus returning a 0-7 Tool index)
C2/0597: 8A           TXA         
C2/0598: 18           CLC 
C2/0599: 69 A3        ADC #$A3    (item number of first tool, NoiseBlaster, is 163)
C2/059B: 60           RTS 

C2/059C dance command - auto setup

C2/059C: DA           PHX
C2/059D: B9 E1 32     LDA $32E1,Y (get the dance number?)
C2/05A0: C9 FF        CMP #$FF    (is it null?)
C2/05A2: D0 0E        BNE $05B2   (if it's valid, a Dance has already been chosen,
                                   so just proceed to choose a step)
C2/05A4: 7B           TDC         (clear 16-bit A)
C2/05A5: AD 4C 1D     LDA $1D4C   (bitfield of known Dances?)
C2/05A8: 20 2A 52     JSR $522A   (Pick a random bit that is set)
C2/05AB: 20 F0 51     JSR $51F0   (Get which bit is picked)
C2/05AE: 8A           TXA 
C2/05AF: 99 E1 32     STA $32E1,Y (save our Dance #)
C2/05B2: 0A           ASL 
C2/05B3: 0A           ASL         (* 4)
C2/05B4: 85 EE        STA $EE     (Each Dance has 4 steps, and occupies 4 bytes
                                   in the Dance Step --> Attack Number table
                                   at $CFFE80)
C2/05B6: 20 5A 4B     JSR $4B5A   (RNG: 0 to 255)
C2/05B9: A2 02        LDX #$02
C2/05BB: DF CE 05 C2  CMP $C205CE,X  (see data below for chances of each step)
C2/05BF: B0 02        BCS $05C3    
C2/05C1: E6 EE        INC $EE        (move to next step for this Dance)
C2/05C3: CA           DEX 
C2/05C4: 10 F5        BPL $05BB      (loop until we reach step determined by random #)
C2/05C6: A6 EE        LDX $EE        (= (Dance * 4) + step)
C2/05C8: BF 80 FE CF  LDA $CFFE80,X  (get attack # for the Dance step used)
C2/05CC: FA           PLX 
C2/05CD: 60           RTS 

C2/05CE data - chances for each dance step

(Data - for chances of each dance step)
(Probabilities: Dance Step 0 = 7/16, Step 1 = 6/16, Step 2 = 2/16, Step 3 = 1/16)
C2/05CE: 10 30 90  

C2/05D1 rage command - auto setup

C2/05D1: DA           PHX
C2/05D2: 08           PHP 
C2/05D3: 7B           TDC 
C2/05D4: 99 A9 33     STA $33A9,Y
C2/05D7: B9 A8 33     LDA $33A8,Y   (which monster it is)
C2/05DA: C9 FF        CMP #$FF
C2/05DC: D0 22        BNE $0600     (branch if a non-null monster was passed)
C2/05DE: 1A           INC 
C2/05DF: 99 A8 33     STA $33A8,Y   (store enemy #0, Guard)
C2/05E2: AD 9A 3A     LDA $3A9A     (# of rages possessed)
C2/05E5: 20 65 4B     JSR $4B65   
C2/05E8: 1A           INC           (random #: 1 to $3A9A)
C2/05E9: 85 EE        STA $EE
C2/05EB: A2 00        LDX #$00
C2/05ED: BD 7E 25     LDA $257E,X   (copy of Rages menu?  menu is filled in C2/580C routine,
                                     and #$257E constant is copied to $002181)
C2/05F0: C9 FF        CMP #$FF
C2/05F2: F0 0C        BEQ $0600     (branch if that menu slot was null, which means
                                     enemy #0 should be defaulted to)
C2/05F4: C6 EE        DEC $EE       (decrement our random index)
C2/05F6: F0 05        BEQ $05FD     (if it's zero, branch, and use the menu item last read)
C2/05F8: E8           INX 
C2/05F9: D0 F2        BNE $05ED     (loop again to check next menu entry)
C2/05FB: 80 03        BRA $0600     (if we've looped a full 256 times and somehow there's
                                     been no match with the random index, branch and just
                                     use enemy #0)

(i'm not sure what the purpose of the above loop is..  it selects Enemy #0
 if any menu slots up to and including the randomly chosen one hold FFh.  maybe it's a check
 to see if the list got "broken," as a normally generated one should never have any nulls
 in the middle.)

C2/05FD: 99 A8 33     STA $33A8,Y   (store enemy number)
C2/0600: 20 53 4B     JSR $4B53     (0 or 1)
C2/0603: C2 30        REP #$30
C2/0605: 2A           ROL 
C2/0606: AA           TAX 
C2/0607: E2 20        SEP #$20      (Set 8-bit Accumulator)
C2/0609: BF 00 46 CF  LDA $CF4600,X (Rage)
C2/060D: 28           PLP 
C2/060E: FA           PLX 
C2/060F: 60           RTS 

C2/0610 load monster properties for rage

C2/0610: 08           PHP
C2/0611: B9 A8 33     LDA $33A8,Y    (Which monster it is)
C2/0614: AA           TAX
C2/0615: EB           XBA
C2/0616: BF C0 37 CF  LDA $CF37C0,X  (get enemy Special move graphic)
C2/061A: 99 81 3C     STA $3C81,Y
C2/061D: A9 20        LDA #$20
C2/061F: 20 81 47     JSR $4781      (get monster # * 32 to access the monster
                                      data block)
C2/0622: C2 10        REP #$10
C2/0624: AA           TAX
C2/0625: BF 1A 00 CF  LDA $CF001A,X  (monster's regular weapon graphic)
C2/0629: 99 A8 3C     STA $3CA8,Y
C2/062C: 99 A9 3C     STA $3CA9,Y
C2/062F: 20 C1 2D     JSR $2DC1      (load monster's special attack, elemental properties,
                                      statuses, status immunities, special properties like
                                      Human/Undead/Dies at MP=0 , etc)
C2/0632: 28           PLP
C2/0633: 60           RTS

C2/0634 monster commands - auto setup

Picks command for Muddled/Charmed/Berserk/Colosseum monsters
C2/0634: DA           PHX
C2/0635: C2 30        REP #$30    (Set 16-bit A,X & Y)
C2/0637: BD F9 1F     LDA $1FF9,X (Which monster it is)
C2/063A: 0A           ASL 
C2/063B: 0A           ASL 
C2/063C: AA           TAX           (multiply monster # by 4 to index its
                                     Control/Muddled/Charm/Colosseum attack table)
C2/063D: BF 00 3D CF  LDA $CF3D00,X (Muddled commands)
C2/0641: 85 F0        STA $F0
C2/0643: BF 02 3D CF  LDA $CF3D02,X (Muddled commands)
C2/0647: 85 F2        STA $F2
C2/0649: E2 30        SEP #$30    (Set 8-bit A,X, & Y)
C2/064B: 64 EE        STZ $EE
C2/064D: 20 5A 4B     JSR $4B5A   (random: 0 to 255)
C2/0650: 29 03        AND #$03    (0 to 3 - point to a random attack slot)
C2/0652: AA           TAX 
C2/0653: B5 F0        LDA $F0,X
C2/0655: C9 FF        CMP #$FF
C2/0657: D0 0B        BNE $0664   (branch if valid attack in slot)
C2/0659: CA           DEX 
C2/065A: 10 F7        BPL $0653   (loop through remainder of attack slots)
C2/065C: E6 EE        INC $EE     (if we couldn't find any valid attacks,
                                   increment counter)
C2/065E: F0 04        BEQ $0664   (give up if we've incremented it 256 times?
                                   i can't see why more than 1 time would be
                                   necessary..  if we give up, it appears
                                   FFh is retained as the attack #, which
                                   should make the monster do nothing..)
                                  (it would've been far faster to change C2/064B
                                   to "LDA #$FF / STA $EE" and this BEQ to a BNE.)

C2/0660: A2 03        LDX #$03    (if randomly chosen attack slot and all the
                                   ones below it were Empty, go do the loop again,
                                   this time starting with the highest
                                   numbered slot.  this way, we'll check EVERY
                                   slot before throwing in the towel)

C2/0662: 80 EF        BRA $0653
C2/0664: FA           PLX 
C2/0665: 48           PHA 
C2/0666: BD E5 3E     LDA $3EE5,X
C2/0669: 89 10        BIT #$10
C2/066B: F0 04        BEQ $0671   (Branch if not Berserk)
C2/066D: A9 EE        LDA #$EE
C2/066F: 83 01        STA $01,S   (Set attack to Battle)
C2/0671: 68           PLA 
C2/0672: 20 BF 1D     JSR $1DBF   (choose a command based on attack #)
C2/0675: 20 E4 03     JSR $03E4
C2/0678: 4C CB 4E     JMP $4ECB

C2/067B data - time to wait for commands

(Data - Time to wait after entering a command until character actually
 performs it (iow, how long they spend in their ready stance).  This
 value * 256 is compared to their $3AB4 counter.  I'm really not sure
 how this applies to enemies.)
C2/067B: 10   (Fight)
C2/067C: 10   (Item)
C2/067D: 20   (Magic)
C2/067E: 00   (Morph)
C2/067F: 00   (Revert)
C2/0680: 10   (Steal)
C2/0681: 10   (Capture)
C2/0682: 10   (SwdTech)
C2/0683: 10   (Throw)
C2/0684: 10   (Tools)
C2/0685: 10   (Blitz)
C2/0686: 10   (Runic)
C2/0687: 20   (Lore)
C2/0688: 10   (Sketch)
C2/0689: 10   (Control)
C2/068A: 10   (Slot)
C2/068B: 10   (Rage)
C2/068C: 10   (Leap)
C2/068D: 10   (Mimic)
C2/068E: 10   (Dance)
C2/068F: 10   (Row)
C2/0690: 10   (Def.)
C2/0691: E0   (Jump)
C2/0692: 20   (X-Magic)
C2/0693: 10   (GP Rain)
C2/0694: 10   (Summon)
C2/0695: 20   (Health)
C2/0696: 20   (Shock)
C2/0697: 10   (Possess)
C2/0698: 10   (MagiTek)
C2/0699: 00
C2/069A: 00           

C2/069B unknow

C2/069B: A2 12        LDX #$12 
C2/069D: BD A0 3A     LDA $3AA0,X 
C2/06A0: 4A           LSR 
C2/06A1: 90 5D        BCC $0700
C2/06A3: C2 20        REP #$20
C2/06A5: BD 18 30     LDA $3018,X
C2/06A8: 2C 4E 2F     BIT $2F4E
C2/06AB: E2 20        SEP #$20
C2/06AD: D0 51        BNE $0700
C2/06AF: 20 AD 07     JSR $07AD
C2/06B2: BD E4 3E     LDA $3EE4,X
C2/06B5: 89 82        BIT #$82    (Check for Dead or Zombie Status)
C2/06B7: F0 06        BEQ $06BF   (branch if none set)
C2/06B9: 9E F4 3B     STZ $3BF4,X (Set HP to 0)
C2/06BC: 9E F5 3B     STZ $3BF5,X
C2/06BF: BD E4 3E     LDA $3EE4,X
C2/06C2: 89 C2        BIT #$C2    (Check for Dead, Zombie, or Petrify status)
C2/06C4: F0 09        BEQ $06CF   (branch if none set)
C2/06C6: BD 19 30     LDA $3019,X
C2/06C9: 0C 3A 3A     TSB $3A3A
C2/06CC: 20 C8 07     JSR $07C8
C2/06CF: BD E4 3E     LDA $3EE4,X
C2/06D2: 10 2C        BPL $0700   (Branch if alive)
C2/06D4: E0 08        CPX #$08
C2/06D6: B0 0C        BCS $06E4   (branch if monster)
C2/06D8: BD D8 3E     LDA $3ED8,X (Which character)
C2/06DB: C9 0E        CMP #$0E
C2/06DD: D0 05        BNE $06E4   (Branch if not Banon)
C2/06DF: A9 06        LDA #$06
C2/06E1: 8D 6E 3A     STA $3A6E   (Banon fell... "End of combat" method #6)
C2/06E4: 20 10 07     JSR $0710    
C2/06E7: BD E4 3E     LDA $3EE4,X
C2/06EA: 89 02        BIT #$02    (Check for Zombie Status)
C2/06EC: F0 03        BEQ $06F1
C2/06EE: 20 28 07     JSR $0728
C2/06F1: BD E4 3E     LDA $3EE4,X
C2/06F4: 10 0A        BPL $0700   (Branch if alive)
C2/06F6: BD F9 3E     LDA $3EF9,X
C2/06F9: 89 04        BIT #$04
C2/06FB: F0 03        BEQ $0700   (branch if no Life 3 status)
C2/06FD: 20 99 07     JSR $0799   (prepare Life 3 revival)
C2/0700: CA           DEX 
C2/0701: CA           DEX 
C2/0702: 10 99        BPL $069D
C2/0704: A2 12        LDX #$12
C2/0706: 20 39 07     JSR $0739   (clean up Control)
C2/0709: CA           DEX 
C2/070A: CA           DEX 
C2/070B: 10 F9        BPL $0706   (loop for every entity onscreen)
C2/070D: 4C 26 5D     JMP $5D26

C2/0710 unknow

C2/0710: C2 20        REP #$20
C2/0712: BD 18 30     LDA $3018,X
C2/0715: 2C 2C 3F     BIT $3F2C   (are they in the middle of a Jump?)
C2/0718: E2 20        SEP #$20
C2/071A: F0 0B        BEQ $0727   (Exit function if not)
C2/071C: 20 28 07     JSR $0728   (clear Wound for now, so they don't actually croak
                                   in mid-air)
C2/071F: BD 05 32     LDA $3205,X
C2/0722: 29 FB        AND #$FB
C2/0724: 9D 05 32     STA $3205,X (Set Air Anchor effect)
C2/0727: 60           RTS 

C2/0728 unknow

C2/0728: BD E4 3E     LDA $3EE4,X
C2/072B: 29 7F        AND #$7F    (Clear death status)
C2/072D: 9D E4 3E     STA $3EE4,X
C2/0730: BD 04 32     LDA $3204,X
C2/0733: 29 BF        AND #$BF    (clear bit 6)
C2/0735: 9D 04 32     STA $3204,X
C2/0738: 60           RTS 

C2/0739 check and remove control effects

(Remove Control's influence from this entity and its Controller/Controllee if
 Control was flagged to be deactivated due to:
  - C2/07AD found certain statuses on entity [doesn't matter whether
    it's the Controller or it's the Controllee])
  - this entity is a Controllee and C2/0C2D detected them sustaining physical
    damage [healing or 0 damage will count, but a non-damaging attack -- i.e.
    one with no damage numerals -- will not] )

C2/0739: BD B9 32     LDA $32B9,X   (who's Controlling this entity?)
C2/073C: C9 FF        CMP #$FF
C2/073E: F0 08        BEQ $0748     (branch if nobody controls them)
C2/0740: 10 06        BPL $0748     (branch if somebody controls them, and Control
                                     wasn't flagged to be deactivated)
C2/0742: 29 7F        AND #$7F
C2/0744: A8           TAY           (put Controller in Y  [Controllee is in X])
C2/0745: 20 5B 07     JSR $075B     (clear Control info for the Controller and
                                     Controllee [this entity])
C2/0748: BD B8 32     LDA $32B8,X   (now see who this entity Controls)
C2/074B: C9 FF        CMP #$FF
C2/074D: F0 0B        BEQ $075A     (branch if they control nobody)
C2/074F: 10 09        BPL $075A     (branch if they control somebody, and Control
                                     wasn't flagged to be deactivated)
C2/0751: 29 7F        AND #$7F
C2/0753: DA           PHX 
C2/0754: 9B           TXY           (put Controller in Y)
C2/0755: AA           TAX           (put Controllee in X)
C2/0756: 20 5B 07     JSR $075B     (clear Control info for the Controller [this
                                     entity] and Controllee)
C2/0759: FA           PLX 
C2/075A: 60           RTS 

C2/075B clear control data

(Clear Control-related data for a Controller, addressed by Y, and
 a Controllee, addressed by X)
C2/075B: B9 4D 3E     LDA $3E4D,Y
C2/075E: 29 FE        AND #$FE
C2/0760: 99 4D 3E     STA $3E4D,Y
C2/0763: B9 F9 3E     LDA $3EF9,Y
C2/0766: 29 EF        AND #$EF
C2/0768: 99 F9 3E     STA $3EF9,Y  (clear "Chant" status from Controller)
C2/076B: A9 FF        LDA #$FF
C2/076D: 9D B9 32     STA $32B9,X  (set to nobody controlling Controllee)
C2/0770: 99 B8 32     STA $32B8,Y  (set to Controller controlling nobody)
C2/0773: BD 19 30     LDA $3019,X
C2/0776: 1C 54 2F     TRB $2F54
C2/0779: DA           PHX 
C2/077A: 20 83 07     JSR $0783
C2/077D: BB           TYX 
C2/077E: 20 83 07     JSR $0783
C2/0781: FA           PLX 
C2/0782: 60           RTS 

C2/0783 unknow

C2/0783: A9 40        LDA #$40
C2/0785: 20 AB 5B     JSR $5BAB    (set bit 6 of $3AA1,X)
C2/0788: BD 04 32     LDA $3204,X
C2/078B: 09 40        ORA #$40
C2/078D: 9D 04 32     STA $3204,X  (set bit 6)
C2/0790: A9 7F        LDA #$7F
C2/0792: 3D A0 3A     AND $3AA0,X
C2/0795: 9D A0 3A     STA $3AA0,X
C2/0798: 60           RTS 

C2/0799 prepare life 3 revival

C2/0799: 29 FB        AND #$FB
C2/079B: 9D F9 3E     STA $3EF9,X   (clear Life 3 status)
C2/079E: BD 19 30     LDA $3019,X
C2/07A1: 1C 2F 2F     TRB $2F2F
C2/07A4: A9 30        LDA #$30
C2/07A6: 85 B8        STA $B8
C2/07A8: A9 26        LDA #$26      (command #$26)
C2/07AA: 4C 91 4E     JMP $4E91     (queue it?)

C2/07AD unknow

C2/07AD: F4 C2 B0     PEA $B0C2   (Sleep, Muddled, Berserk, Death, Petrify, Zombie)
C2/07B0: F4 11 03     PEA $0311   (Rage, Freeze, Dance, Stop)
C2/07B3: 9B           TXY 
C2/07B4: 20 64 58     JSR $5864
C2/07B7: B0 0E        BCS $07C7   (Exit function if none of those statuses set)
C2/07B9: 1E B8 32     ASL $32B8,X
C2/07BC: 38           SEC 
C2/07BD: 7E B8 32     ROR $32B8,X (flag "Who you control" link to be deactivated)
C2/07C0: 1E B9 32     ASL $32B9,X 
C2/07C3: 38           SEC 
C2/07C4: 7E B9 32     ROR $32B9,X (flag "Who controls you" link to be deactivated)
C2/07C7: 60           RTS 

C2/07C8 unknow

C2/07C8: EC F9 33     CPX $33F9
C2/07CB: D0 28        BNE $07F5    (branch if you're not being Zingered)
C2/07CD: DA           PHX 
C2/07CE: AE F8 33     LDX $33F8    (who's doing the Zingering)
C2/07D1: BD 19 30     LDA $3019,X
C2/07D4: 85 B9        STA $B9
C2/07D6: A9 04        LDA #$04
C2/07D8: 85 B8        STA $B8
C2/07DA: A2 00        LDX #$00
C2/07DC: A9 24        LDA #$24
C2/07DE: 20 91 4E     JSR $4E91
C2/07E1: A9 02        LDA #$02
C2/07E3: 85 B8        STA $B8
C2/07E5: A2 08        LDX #$08
C2/07E7: A9 24        LDA #$24
C2/07E9: 20 91 4E     JSR $4E91
C2/07EC: A9 FF        LDA #$FF
C2/07EE: 8D F8 33     STA $33F8    (nobody's Zingering)
C2/07F1: 8D F9 33     STA $33F9    (nobody's being Zingered)
C2/07F4: FA           PLX 
C2/07F5: BD 6C 33     LDA $336C,X
C2/07F8: 30 04        BMI $07FE    (branch if you have no Love Token slave)
C2/07FA: A8           TAY 
C2/07FB: 20 2D 08     JSR $082D    (Clear Love Token links between you and slave)
C2/07FE: BD 6D 33     LDA $336D,X
C2/0801: 30 07        BMI $080A    (branch if you're nobody's Love Token slave)
C2/0803: DA           PHX 
C2/0804: 9B           TXY 
C2/0805: AA           TAX 
C2/0806: 20 2D 08     JSR $082D    (Clear Love Token links between you and master)
C2/0809: FA           PLX 
C2/080A: BD 94 33     LDA $3394,X
C2/080D: 30 04        BMI $0813    (branch if you're not Charming anybody)
C2/080F: A8           TAY 
C2/0810: 20 36 08     JSR $0836    (Clear Charm links between you and your Charmee)
C2/0813: BD 95 33     LDA $3395,X
C2/0816: 30 07        BMI $081F    (branch if you're not Charmed by anybody)
C2/0818: DA           PHX 
C2/0819: 9B           TXY 
C2/081A: AA           TAX 
C2/081B: 20 36 08     JSR $0836    (Clear Charm links between you and Charmer)
C2/081E: FA           PLX 
C2/081F: EC 04 34     CPX $3404   (Compare to Quick's target byte)
C2/0822: D0 08        BNE $082C   (Exit If this actor does not get extra turn due to Quick)
C2/0824: A9 FF        LDA #$FF
C2/0826: 8D 04 34     STA $3404   (Store #$FF (empty) to Quick's target byte)
C2/0829: 8D 02 34     STA $3402   (Store #$FF (for none) to the number of turns due to Quick)
C2/082C: 60           RTS 

C2/082D clear love token effect

C2/082D: A9 FF        LDA #$FF
C2/082F: 9D 6C 33     STA $336C,X
C2/0832: 99 6D 33     STA $336D,Y
C2/0835: 60           RTS 

C2/0836 clear charm effect

C2/0836: A9 FF        LDA #$FF
C2/0838: 9D 94 33     STA $3394,X
C2/083B: 99 95 33     STA $3395,Y
C2/083E: 60           RTS 

C2/083F update battle variables

(Update a variety of things when the battle starts, when the enemy formation
 is switched, and at the end of each turn [after the turn's animation plays out])
C2/083F: A2 12        LDX #$12
C2/0841: BD A0 3A     LDA $3AA0,X
C2/0844: 4A           LSR 
C2/0845: 90 77        BCC $08BE
C2/0847: 1E E0 32     ASL $32E0,X
C2/084A: 5E E0 32     LSR $32E0,X (clear Bit 7 of $32E0.  this prevents C2/4C5B
                                   from triggering a counterattack for a once-attacked
                                   entity turn after turn, while still preserving the
                                   attacker in Bits 0-6.)
C2/084D: BD E4 3E     LDA $3EE4,X
C2/0850: 30 07        BMI $0859   (Branch if dead)
C2/0852: BD A1 3A     LDA $3AA1,X
C2/0855: 89 40        BIT #$40
C2/0857: F0 03        BEQ $085C   (If bit 5 of $3AA1 is not set)
C2/0859: 20 77 09     JSR $0977
C2/085C: BD 04 32     LDA $3204,X
C2/085F: F0 4A        BEQ $08AB
C2/0861: 4A           LSR 
C2/0862: 90 03        BCC $0867
C2/0864: 20 4A 0B     JSR $0B4A   (If bit 0 of $3204,X is set)
C2/0867: 1E 04 32     ASL $3204,X
C2/086A: 90 03        BCC $086F   (Branch if bit 7 of $3204,X is not set.
                                   It is set for an entity when their Imp status is
                                   toggled, the attack/spell costs them MP to cast, or
                                   the attack itself affects their MP because they're a
                                   target [or the caster, if it's a draining attack])
C2/086C: 20 63 57     JSR $5763   (Update availability of entries on Esper, Magic,
                                   and Lore menus)
C2/086F: 1E 04 32     ASL $3204,X
C2/0872: 90 08        BCC $087C
C2/0874: 20 0F 0A     JSR $0A0F   (If bit 6 of $3204,X is set)
C2/0877: A9 80        LDA #$80
C2/0879: 20 AB 5B     JSR $5BAB   (set bit 7 of $3AA1,X)
C2/087C: 1E 04 32     ASL $3204,X
C2/087F: 90 03        BCC $0884   (Branch if bit 5 of $3204,X is not set.
                                   It is set for an entity upon Condemned status
                                   being set.)
C2/0881: 20 B4 09     JSR $09B4   (Assign a starting value to Condemned counter)
C2/0884: 1E 04 32     ASL $3204,X
C2/0887: 90 03        BCC $088C   (Branch if bit 4 of $3204,X is not set.
                                   It is set for an entity when Condemned expires or
                                   is otherwise cleared.)
C2/0889: 20 CE 09     JSR $09CE   (Zero the Condemned counter)
C2/088C: 1E 04 32     ASL $3204,X
C2/088F: 90 07        BCC $0898   (Branch if bit 3 of $3204,X is not set.
                                   It is set for an entity when Mute or Imp status
                                   is toggled.)
C2/0891: E0 08        CPX #$08
C2/0893: B0 03        BCS $0898   (Branch if not a character)
C2/0895: 20 7D 52     JSR $527D   (Update availability of commands on character's
                                   main menu)
C2/0898: 1E 04 32     ASL $3204,X
C2/089B: 90 03        BCC $08A0   (Branch if bit 2 of $3204,X is not set.
                                   It is set for an entity when Haste or Slow is toggled,
                                   and a couple other cases I'm not sure of.)
C2/089D: 20 D2 09     JSR $09D2   (Recalculate the amount by which to increase the ATB
                                   gauge.  Affects various other timers, too)
C2/08A0: 1E 04 32     ASL $3204,X
C2/08A3: 90 03        BCC $08A8   (Branch if bit 1 of $3204,X is not set.
                                   It is set for an entity when Morph status is toggled)
C2/08A5: 20 A8 0A     JSR $0AA8   (switch command on main menu from Morph to Revert
                                   [or vice versa], and adjust Morph-related variables
                                   like timers)
C2/08A8: 1E 04 32     ASL $3204,X
C2/08AB: 20 1F 09     JSR $091F
C2/08AE: 20 C6 08     JSR $08C6
C2/08B1: BD A0 3A     LDA $3AA0,X
C2/08B4: 89 50        BIT #$50
C2/08B6: F0 03        BEQ $08BB
C2/08B8: 20 41 0A     JSR $0A41
C2/08BB: 20 4A 0A     JSR $0A4A   (Prepare equipment spell activations on low HP)
C2/08BE: CA           DEX 
C2/08BF: CA           DEX 
C2/08C0: 30 03        BMI $08C5
C2/08C2: 4C 41 08     JMP $0841   (loop for all 10 entities)
C2/08C5: 60           RTS 

C2/08C6 unknow

C2/08C6: A9 50        LDA #$50
C2/08C8: 20 B4 11     JSR $11B4
C2/08CB: AD 04 34     LDA $3404
C2/08CE: 30 05        BMI $08D5
C2/08D0: EC 04 34     CPX $3404
C2/08D3: D0 F0        BNE $08C5
C2/08D5: BD E4 3E     LDA $3EE4,X
C2/08D8: 89 C0        BIT #$C0
C2/08DA: D0 E9        BNE $08C5   (Exit if dead or Petrify)
C2/08DC: BD F8 3E     LDA $3EF8,X
C2/08DF: 89 10        BIT #$10
C2/08E1: D0 E2        BNE $08C5   (Exit if stop)
C2/08E3: A9 EF        LDA #$EF
C2/08E5: 20 92 07     JSR $0792
C2/08E8: BD B9 32     LDA $32B9,X
C2/08EB: 10 D8        BPL $08C5   (Exit if you are controlled)
C2/08ED: BD E5 3E     LDA $3EE5,X
C2/08F0: 30 D3        BMI $08C5   (Exit if asleep)
C2/08F2: BD F9 3E     LDA $3EF9,X
C2/08F5: 89 02        BIT #$02
C2/08F7: D0 CC        BNE $08C5   (Exit if life 3)
C2/08F9: BD 59 33     LDA $3359,X
C2/08FC: 10 C7        BPL $08C5   (Exit if seized)
C2/08FE: A9 BF        LDA #$BF
C2/0900: 20 92 07     JSR $0792
C2/0903: BD A1 3A     LDA $3AA1,X
C2/0906: 10 BD        BPL $08C5   (Exit if bit 7 of $3AA1 is not set)
C2/0908: 29 7F        AND #$7F    (Clear bit 7)
C2/090A: 9D A1 3A     STA $3AA1,X
C2/090D: BD CC 32     LDA $32CC,X
C2/0910: 1A           INC 
C2/0911: F0 B2        BEQ $08C5   (Exit if $32CC is #$FF)
C2/0913: BD A1 3A     LDA $3AA1,X
C2/0916: 4A           LSR 
C2/0917: 90 03        BCC $091C   (Branch if bit 0 of $3AA1 is not set)
C2/0919: 4C 77 4E     JMP $4E77
C2/091C: 4C 66 4E     JMP $4E66

C2/091F unknow

C2/091F: E0 08        CPX #$08
C2/0921: B0 A2        BCS $08C5   (exit if monster)
C2/0923: BD D8 3E     LDA $3ED8,X (Which character it is)
C2/0926: C9 0D        CMP #$0D
C2/0928: F0 9B        BEQ $08C5   (Exit if Umaro)
C2/092A: BD 55 32     LDA $3255,X
C2/092D: 10 96        BPL $08C5
C2/092F: AD 97 3A     LDA $3A97
C2/0932: D0 91        BNE $08C5   (exit if in the Colosseum)
C2/0934: A9 02        LDA #$02
C2/0936: 85 EE        STA $EE
C2/0938: EC 04 34     CPX $3404
C2/093B: D0 04        BNE $0941
C2/093D: A9 88        LDA #$88
C2/093F: 04 EE        TSB $EE
C2/0941: A5 EE        LDA $EE
C2/0943: 20 B4 11     JSR $11B4
C2/0946: BD 18 30     LDA $3018,X
C2/0949: 2C 4C 2F     BIT $2F4C
C2/094C: D0 38        BNE $0986
C2/094E: BD 59 33     LDA $3359,X
C2/0951: 3D 95 33     AND $3395,X
C2/0954: 10 30        BPL $0986   (branch if Seized or Charmed)
C2/0956: F4 C2 B0     PEA $B0C2   (Sleep, Muddled, Berserk, Death, Petrify, Zombie)
C2/0959: F4 01 21     PEA $2101   (Dance, Hide, Rage)
C2/095C: 9B           TXY 
C2/095D: 20 64 58     JSR $5864
C2/0960: 90 24        BCC $0986   (Branch if any set)
C2/0962: BD A0 3A     LDA $3AA0,X
C2/0965: 10 66        BPL $09CD
C2/0967: BD CC 32     LDA $32CC,X
C2/096A: 10 61        BPL $09CD
C2/096C: BD A0 3A     LDA $3AA0,X
C2/096F: 09 08        ORA #$08
C2/0971: 9D A0 3A     STA $3AA0,X   (turn on bit 3)
C2/0974: 4C EF 11     JMP $11EF

C2/0977 unknow

C2/0977: C2 20        REP #$20
C2/0979: A9 D3        LDA #$D3
C2/097B: BF 20 92 07  LDA $079220,X
C2/097F: E2 20        SEP #$20
C2/0981: A9 01        LDA #$01
C2/0983: 9D 19 32     STA $3219,X
C2/0986: A9 F9        LDA #$F9
C2/0988: EB           XBA 
C2/0989: BD F9 3E     LDA $3EF9,X
C2/098C: 89 20        BIT #$20
C2/098E: D0 13        BNE $09A3   (Branch if Hide status)
C2/0990: BD 18 30     LDA $3018,X
C2/0993: 2C 4C 2F     BIT $2F4C
C2/0996: D0 0B        BNE $09A3
C2/0998: BD A0 3A     LDA $3AA0,X
C2/099B: 10 06        BPL $09A3   (Branch if bit 7 of $3AA0 is not set)
C2/099D: A9 79        LDA #$79
C2/099F: EB           XBA 
C2/09A0: 20 66 4E     JSR $4E66
C2/09A3: EB           XBA 
C2/09A4: 20 92 07     JSR $0792
C2/09A7: E0 08        CPX #$08
C2/09A9: B0 22        BCS $09CD   (Exit function)
C2/09AB: 8A           TXA 
C2/09AC: 4A           LSR 
C2/09AD: 85 10        STA $10
C2/09AF: A9 03        LDA #$03
C2/09B1: 4C 11 64     JMP $6411

C2/09B4 assign value to condemned counter

C2/09B4: AD AF 11     LDA $11AF   (Level)
C2/09B7: 20 65 4B     JSR $4B65   (random: 0 to Level - 1)
C2/09BA: 18           CLC 
C2/09BB: 6D AF 11     ADC $11AF   (Add to level)
C2/09BE: 85 EE        STA $EE
C2/09C0: 38           SEC 
C2/09C1: A9 3C        LDA #$3C
C2/09C3: E5 EE        SBC $EE     (Subtract from 60)
C2/09C5: B0 01        BCS $09C8
C2/09C7: 7B           TDC         (Set to 0 if less than 0)
C2/09C8: 69 14        ADC #$14    (Add 21.  if it was less than 0, add 20 instead,
                                   giving it a starting value of 20.)
C2/09CA: 9D 05 3B     STA $3B05,X (set Condemned counter)
                                  (note that this counter is "one off" from the
                                   actual numerals you'll see onscreen:
                                      00 value = numerals disabled
                                      01 value = numerals at "00"
                                      02 value = numerals at "01"
                                      03 value = numerals at "02" , etc.)
C2/09CD: 60           RTS 

C2/09CE null condemned counter

C2/09CE: 9E 05 3B     STZ $3B05,X  (Condemned counter = 0)
C2/09D1: 60           RTS 

C2/09D2 battle timer counter function

Battle Time Counter function
(Recalculate the amount by which to increase the ATB gauge.  
 This will also affect the speed of the "wait timer" [which determines how long a
 character is in their ready stance], the Condemned counter, invisible timers
 for auto-expiring statuses, and the frequency of damage/healing from statuses
 like Regen and Poison.)
C2/09D2: 08           PHP
C2/09D3: A0 20        LDY #$20      (ATB multiplier = 32 if slowed)
C2/09D5: BD F8 3E     LDA $3EF8,X
C2/09D8: 89 04        BIT #$04
C2/09DA: D0 08        BNE $09E4     (Branch if Slow)
C2/09DC: A0 40        LDY #$40      (ATB multiplier = 64 normally)
C2/09DE: 89 08        BIT #$08
C2/09E0: F0 02        BEQ $09E4     (Branch if not Haste)
C2/09E2: A0 54        LDY #$54      (ATB multiplier = 84 if hasted)
C2/09E4: 98           TYA 
C2/09E5: 9D DD 3A     STA $3ADD,X   (save the ATB multiplier)
C2/09E8: 98           TYA           (this instruction seems frivolous)
C2/09E9: 48           PHA 
C2/09EA: 18           CLC 
C2/09EB: 4A           LSR 
C2/09EC: 63 01        ADC $01,S
C2/09EE: 83 01        STA $01,S     (ATB multiplier *= 1.5)
C2/09F0: BD 19 3B     LDA $3B19,X   (Speed)
C2/09F3: 69 14        ADC #$14        
C2/09F5: EB           XBA           (Speed + 20 in top byte of Accumulator)
C2/09F6: E0 08        CPX #$08    
C2/09F8: 90 06        BCC $0A00     (branch if not an enemy)
C2/09FA: AD 90 3A     LDA $3A90     (= 255 - (Battle Speed setting * 24) )
                                    (remember that what you see on the Config menu is
                                     Battle Speed + 1)
C2/09FD: 20 81 47     JSR $4781     (A = (speed + 20) * $3A90 )
C2/0A00: 68           PLA           (bottom byte of A is now Slow/Normal/Haste Constant)
C2/0A01: 20 81 47     JSR $4781     (Let C be the Slow/Normal/Haste constant, equal to
                                     48, 96, or 126, respectively.
                                     for characters:
                                      A = (Speed + 20) * C
                                     for enemies:
                                      A = ( ((Speed + 20) * $3A90) DIV 256) * C  )
C2/0A04: C2 20        REP #$20
C2/0A06: 4A           LSR 
C2/0A07: 4A           LSR 
C2/0A08: 4A           LSR 
C2/0A09: 4A           LSR           (A = A / 16)
C2/0A0A: 9D C8 3A     STA $3AC8,X   (Save as amount by which to increase ATB timer.)
C2/0A0D: 28           PLP 
C2/0A0E: 60           RTS 

C2/0A0F unknow

C2/0A0F: 20 01 03     JSR $0301
C2/0A12: BD CC 32     LDA $32CC,X
C2/0A15: 10 F8        BPL $0A0F
C2/0A17: AC 64 3A     LDY $3A64
C2/0A1A: 8A           TXA 
C2/0A1B: D9 20 37     CMP $3720,Y
C2/0A1E: D0 05        BNE $0A25
C2/0A20: A9 FF        LDA #$FF
C2/0A22: 99 20 37     STA $3720,Y
C2/0A25: C8           INY 
C2/0A26: CC 65 3A     CPY $3A65
C2/0A29: 90 EF        BCC $0A1A
C2/0A2B: BD 19 32     LDA $3219,X
C2/0A2E: D0 08        BNE $0A38
C2/0A30: DE 19 32     DEC $3219,X
C2/0A33: A9 D3        LDA #$D3
C2/0A35: 20 92 07     JSR $0792
C2/0A38: E0 08        CPX #$08
C2/0A3A: B0 0D        BCS $0A49
C2/0A3C: A9 2C        LDA #$2C
C2/0A3E: 4C 91 4E     JMP $4E91

C2/0A41 unknow

C2/0A41: A9 FD        LDA #$FD
C2/0A43: 3D A1 3A     AND $3AA1,X
C2/0A46: 9D A1 3A     STA $3AA1,X
C2/0A49: 60           RTS 

C2/0A4A prepare equipment spell activations on low HP

C2/0A4A: BD A0 3A     LDA $3AA0,X
C2/0A4D: 89 10        BIT #$10
C2/0A4F: D0 3F        BNE $0A90    (Exit function)
C2/0A51: A9 02        LDA #$02
C2/0A53: 3C E5 3E     BIT $3EE5,X
C2/0A56: F0 38        BEQ $0A90    (Branch if not Near Fatal)
C2/0A58: 3C 05 32     BIT $3205,X  (is bit 1 set?)
C2/0A5B: F0 33        BEQ $0A90    (exit if not, meaning we've already activated
                                    a spell on low HP this battle)
C2/0A5D: 5D 05 32     EOR $3205,X
C2/0A60: 9D 05 32     STA $3205,X  (turn off bit 1)
                                   (TRB $3205,X could've replaced two instructions)
C2/0A63: BD 59 3C     LDA $3C59,X
C2/0A66: 4A           LSR 
C2/0A67: 90 0B        BCC $0A74   (Branch if not Shell when low HP)
C2/0A69: 48           PHA 
C2/0A6A: A9 25        LDA #$25
C2/0A6C: 85 B8        STA $B8     (Shell spell ID)
C2/0A6E: A9 26        LDA #$26
C2/0A70: 20 91 4E     JSR $4E91
C2/0A73: 68           PLA 
C2/0A74: 4A           LSR 
C2/0A75: 90 0B        BCC $0A82   (branch if not Safe when low HP)
C2/0A77: 48           PHA 
C2/0A78: A9 1C        LDA #$1C
C2/0A7A: 85 B8        STA $B8     (Safe spell ID)
C2/0A7C: A9 26        LDA #$26
C2/0A7E: 20 91 4E     JSR $4E91
C2/0A81: 68           PLA 
C2/0A82: 4A           LSR 
C2/0A83: 90 0B        BCC $0A90   (branch if not Reflect when low HP [no item
                                   in game has this feature, but it's possible])
C2/0A85: 48           PHA 
C2/0A86: A9 24        LDA #$24
C2/0A88: 85 B8        STA $B8     (Rflect spell ID)
C2/0A8A: A9 26        LDA #$26
C2/0A8C: 20 91 4E     JSR $4E91
C2/0A8F: 68           PLA 
C2/0A90: 60           RTS 

C2/0A91 unknow

C2/0A91: A2 06        LDX #$06
C2/0A93: BD 18 30     LDA $3018,X
C2/0A96: 2C 74 3A     BIT $3A74
C2/0A99: F0 08        BEQ $0AA3
C2/0A9B: 2C 2C 3F     BIT $3F2C
C2/0A9E: D0 03        BNE $0AA3
C2/0AA0: 20 0F 0A     JSR $0A0F
C2/0AA3: CA           DEX 
C2/0AA4: CA           DEX 
C2/0AA5: 10 EC        BPL $0A93
C2/0AA7: 60           RTS 

C2/0AA8 unknow

C2/0AA8: A5 B1        LDA $B1
C2/0AAA: 4A           LSR 
C2/0AAB: B0 0A        BCS $0AB7
C2/0AAD: BD 19 32     LDA $3219,X
C2/0AB0: D0 05        BNE $0AB7
C2/0AB2: A9 88        LDA #$88
C2/0AB4: 20 B4 11     JSR $11B4
C2/0AB7: DA           PHX 
C2/0AB8: BD F9 3E     LDA $3EF9,X
C2/0ABB: 49 08        EOR #$08    (Toggle Morph status)
C2/0ABD: 4A           LSR 
C2/0ABE: 4A           LSR 
C2/0ABF: 4A           LSR 
C2/0AC0: 4A           LSR 
C2/0AC1: 08           PHP         (save Carry flag, which is opposite of
                                   "currently Morphed")
C2/0AC2: 7B           TDC 
C2/0AC3: 69 03        ADC #$03
C2/0AC5: 85 EE        STA $EE      ($EE = 3 or 4, depending on carry flag)
C2/0AC7: 8A           TXA 
C2/0AC8: EB           XBA 
C2/0AC9: A9 06        LDA #$06
C2/0ACB: 20 81 47     JSR $4781
C2/0ACE: AA           TAX 
C2/0ACF: A0 04        LDY #$04
C2/0AD1: BD 2E 20     LDA $202E,X  (get contents of menu slot)
C2/0AD4: C5 EE        CMP $EE
C2/0AD6: D0 05        BNE $0ADD    (if Morphed and menu item isn't Morph(3), branch  -OR-
                                    if not Morphed and menu item isn't Revert(4), branch)
C2/0AD8: 49 07        EOR #$07   
C2/0ADA: 9D 2E 20     STA $202E,X  (toggle menu item between Morph(3) and Revert(4) )
C2/0ADD: E8           INX 
C2/0ADE: E8           INX 
C2/0ADF: E8           INX 
C2/0AE0: 88           DEY 
C2/0AE1: D0 EE        BNE $0AD1    (loop for all 4 menu items)
C2/0AE3: 28           PLP 
C2/0AE4: FA           PLX 
C2/0AE5: 90 1A        BCC $0B01    (Branch if currently Morphed)
C2/0AE7: 08           PHP 
C2/0AE8: 20 36 0B     JSR $0B36    (Establish new value for Morph supply based on its
                                    previous value and the current Morph timer)
C2/0AEB: A9 FF        LDA #$FF
C2/0AED: 8D E2 3E     STA $3EE2    (Store null as Morphed character)
C2/0AF0: 9E 04 3B     STZ $3B04,X  (Set the Morph gauge for this entity to 0)
C2/0AF3: E0 08        CPX #$08     (Compare target number to 8)
C2/0AF5: B0 03        BCS $0AFA    (Branch if it's greater (not a character))
C2/0AF7: 20 7D 52     JSR $527D    (Update availability of commands on character's
                                    main menu - grey out or enable)
C2/0AFA: C2 20        REP #$20
C2/0AFC: 9C 30 3F     STZ $3F30    (morph timer = 0)
C2/0AFF: 28           PLP 
C2/0B00: 60           RTS 

C2/0B01 unknow

C2/0B01: DA           PHX
C2/0B02: 08           PHP 
C2/0B03: AD E2 3E     LDA $3EE2   (Which target is Morphed)
C2/0B06: 10 2B        BPL $0B33   (Exit function if someone is already Morphed)
C2/0B08: AD BB 3E     LDA $3EBB
C2/0B0B: 4A           LSR 
C2/0B0C: 4A           LSR 
C2/0B0D: 6A           ROR 
C2/0B0E: B0 23        BCS $0B33   (Exit function if bit 2 of $3EBB is set..
                                   Set for just Phunbaba battle #4 [i.e. Terra's
                                   second Phunbaba encounter])
C2/0B10: 0A           ASL         (Put Bit 1 into Carry)
C2/0B11: 8E E2 3E     STX $3EE2
C2/0B14: 7B           TDC 
C2/0B15: C2 20        REP #$20    (Set 16-bit Accumulator)
C2/0B17: 3A           DEC 
C2/0B18: 8D 30 3F     STA $3F30   (Morph timer = 65535)
C2/0B1B: AE F6 1C     LDX $1CF6   (Morph supply)
C2/0B1E: 20 92 47     JSR $4792   (65535 / Morph supply)
C2/0B21: 90 01        BCC $0B24   (Branch if bit 1 of $3EBB not set.
                                   This bit is set in Terra's 2nd Phunbaba battle
                                   [i.e. Phunbaba #4], and lasts afterward.  So
                                   little Terra gains some resolve here? ^__^)
C2/0B23: 4A           LSR 
C2/0B24: 4A           LSR 
C2/0B25: 4A           LSR 
C2/0B26: 4A           LSR         (A = (65535 / Morph supply) / 8  [pre-Phunbaba]
                                   A = (65535 / Morph supply) / 16  [post-Phunbaba] )
C2/0B27: C9 00 08     CMP #$0800  
C2/0B2A: 90 03        BCC $0B2F
C2/0B2C: A9 FF 07     LDA #$07FF  (this will cap amount to decrement morph time
                                   counter at 2048)
C2/0B2F: 1A           INC
C2/0B30: 8D 32 3F     STA $3F32   (Amount to decrement morph time counter)
C2/0B33: 28           PLP 
C2/0B34: FA           PLX 
C2/0B35: 60           RTS 

C2/0B36 update or set value for morph supply

(Establish new value for Morph supply based on its previous value and
 the current Morph timer)
C2/0B36: AD E2 3E     LDA $3EE2   (Which target is Morphed)
C2/0B39: 30 0E        BMI $0B49   (Exit if no one is Morphed)
C2/0B3B: AD F6 1C     LDA $1CF6
C2/0B3E: EB           XBA
C2/0B3F: AD 31 3F     LDA $3F31
C2/0B42: 20 81 47     JSR $4781   (16-bit A = morph supply * (morph timer DIV 256) )
C2/0B45: EB           XBA 
C2/0B46: 8D F6 1C     STA $1CF6   (morph supply =
                                   (morph supply * (morph timer DIV 256)) DIV 256  )
C2/0B49: 60           RTS 

C2/0B4A unknow

C2/0B4A: C2 20        REP #$20    (Set 16-bit Accumulator)
C2/0B4C: BD 18 30     LDA $3018,X
C2/0B4F: 0C 2C 3F     TSB $3F2C   (flag entity as Jumping)
C2/0B52: E2 20        SEP #$20    (Set 8-bit Accumulator)
C2/0B54: BD A0 3A     LDA $3AA0,X
C2/0B57: 29 9B        AND #$9B
C2/0B59: 09 08        ORA #$08
C2/0B5B: 9D A0 3A     STA $3AA0,X
C2/0B5E: AC 66 3A     LDY $3A66    (get current action queue position?)
C2/0B61: 8A           TXA 
C2/0B62: D9 20 38     CMP $3820,Y  (does queue entry match our current entity?)
C2/0B65: D0 05        BNE $0B6C    (if not, branch and move to next entry)
C2/0B67: A9 FF        LDA #$FF     
C2/0B69: 99 20 38     STA $3820,Y  (if there was a match, null out this queue entry)
C2/0B6C: C8           INY          (move to next entry)
C2/0B6D: CC 67 3A     CPY $3A67
C2/0B70: 90 EF        BCC $0B61    (keep looping until position matches next available
                                    queue slot -- i.e., we've checked through the end of
                                    the queue)
C2/0B72: BD 05 32     LDA $3205,X
C2/0B75: 29 7F        AND #$7F
C2/0B77: 9D 05 32     STA $3205,X
C2/0B7A: 9E B5 3A     STZ $3AB5,X
C2/0B7D: A9 E0        LDA #$E0
C2/0B7F: 9D 2C 32     STA $322C,X  (save delay between inputting command and performing it.
                                    iow, how long you spend in the "ready stance."  E0h
                                    is the same delay as the Jump command, and its ready
                                    stance constitutes the character being airborne.)
C2/0B82: 60           RTS 

C2/0B83 damage modification

Modify Damage, Heal Undead, and Elemental modification
C2/0B83: 08           PHP
C2/0B84: E2 20        SEP #$20
C2/0B86: AD A6 11     LDA $11A6   (Battle Power)
C2/0B89: D0 03        BNE $0B8E   (Branch if not 0)
C2/0B8B: 4C 2B 0C     JMP $0C2B   (Exit function if 0)
C2/0B8E: AD A4 11     LDA $11A4   (Special Byte 2)
C2/0B91: 30 05        BMI $0B98   (Branch if power = factor of HP)
C2/0B93: 20 9E 0C     JSR $0C9E   (Damage modification)
C2/0B96: 80 03        BRA $0B9B
C2/0B98: 20 87 0D     JSR $0D87   (Figure HP based damage)
C2/0B9B: 64 F2        STZ $F2
C2/0B9D: B9 E4 3E     LDA $3EE4,Y (Status byte 1 of target)
C2/0BA0: 0A           ASL 
C2/0BA1: 30 57        BMI $0BFA   (Branch if target is Petrify, damage = 0)

C2/0BA3: AD A4 11     LDA $11A4
C2/0BA6: 85 F2        STA $F2     (Store special byte 2 in $F2.  what we're looking
                                   at is Bit 1, the Heal flag.)
C2/0BA8: AD A2 11     LDA $11A2
C2/0BAB: 89 08        BIT #$08
C2/0BAD: F0 24        BEQ $0BD3   (Branch if not Invert Damage on Undead)
C2/0BAF: B9 95 3C     LDA $3C95,Y
C2/0BB2: 10 0B        BPL $0BBF   (Branch if not undead)
C2/0BB4: AD AA 11     LDA $11AA
C2/0BB7: 89 82        BIT #$82    (Check if dead or zombie attack)
C2/0BB9: D0 70        BNE $0C2B   (Exit if ^)
C2/0BBB: 64 F2        STZ $F2     (Clear heal flag)
C2/0BBD: 80 07        BRA $0BC6
C2/0BBF: B9 E4 3E     LDA $3EE4,Y
C2/0BC2: 89 02        BIT #$02    (Check for Zombie status)
C2/0BC4: F0 0D        BEQ $0BD3   (Branch if not zombie)
C2/0BC6: AD A4 11     LDA $11A4
C2/0BC9: 89 02        BIT #$02
C2/0BCB: F0 06        BEQ $0BD3   (Branch if not redirection)
C2/0BCD: A5 F2        LDA $F2
C2/0BCF: 49 01        EOR #$01
C2/0BD1: 85 F2        STA $F2     (Toggle heal flag)

C2/0BD3: AD A1 11     LDA $11A1
C2/0BD6: F0 46        BEQ $0C1E   (Branch if non-elemental)
C2/0BD8: AD C8 3E     LDA $3EC8   (Forcefield nullified elements)
C2/0BDB: 49 FF        EOR #$FF
C2/0BDD: 2D A1 11     AND $11A1
C2/0BE0: F0 18        BEQ $0BFA   (Set damage to 0 if element nullified)
C2/0BE2: B9 CC 3B     LDA $3BCC,Y (Absorbed elements)
C2/0BE5: 2C A1 11     BIT $11A1
C2/0BE8: F0 08        BEQ $0BF2   (branch if none are used in attack)
C2/0BEA: A5 F2        LDA $F2
C2/0BEC: 49 01        EOR #$01
C2/0BEE: 85 F2        STA $F2     (toggle healing flag)
C2/0BF0: 80 2C        BRA $0C1E
C2/0BF2: B9 CD 3B     LDA $3BCD,Y (Nullified elements)
C2/0BF5: 2C A1 11     BIT $11A1
C2/0BF8: F0 06        BEQ $0C00   (branch if none are used in attack)
C2/0BFA: 64 F0        STZ $F0
C2/0BFC: 64 F1        STZ $F1     (Set damage to 0)
C2/0BFE: 80 1E        BRA $0C1E
C2/0C00: B9 E1 3B     LDA $3BE1,Y (Elements cut in half)
C2/0C03: 2C A1 11     BIT $11A1
C2/0C06: F0 06        BEQ $0C0E   (branch if none are used in attack)
C2/0C08: 46 F1        LSR $F1
C2/0C0A: 66 F0        ROR $F0     (Cut damage in half)
C2/0C0C: 80 10        BRA $0C1E
C2/0C0E: B9 E0 3B     LDA $3BE0,Y (Weak elements)
C2/0C11: 2C A1 11     BIT $11A1
C2/0C14: F0 08        BEQ $0C1E   (branch if none are used in attack)
C2/0C16: A5 F1        LDA $F1
C2/0C18: 30 04        BMI $0C1E   (Don't double damage if over 32768)
C2/0C1A: 06 F0        ASL $F0
C2/0C1C: 26 F1        ROL $F1     (Double damage)
C2/0C1E: AD A9 11     LDA $11A9   (get attack special effect)
C2/0C21: C9 04        CMP #$04
C2/0C23: D0 03        BNE $0C28   (Branch if not Atma Weapon)
C2/0C25: 20 39 0E     JSR $0E39   (Atma Weapon damage modification)
C2/0C28: 20 2D 0C     JSR $0C2D
C2/0C2B: 28           PLP 
C2/0C2C: 60           RTS 

C2/0C2D unknow

C2/0C2D: AD A2 11     LDA $11A2
C2/0C30: 4A           LSR 
C2/0C31: 90 2A        BCC $0C5D   (Branch if not physical damage)
C2/0C33: AD 82 3A     LDA $3A82
C2/0C36: 2D 83 3A     AND $3A83
C2/0C39: 10 22        BPL $0C5D   (Branch if blocked by Golem or dog)
C2/0C3B: BD E4 3E     LDA $3EE4,X
C2/0C3E: 89 02        BIT #$02    (Check for Zombie Status on attacker)
C2/0C40: F0 03        BEQ $0C45   (Branch if no zombie)
C2/0C42: 20 21 0E     JSR $0E21   (Poison / Dark status for zombies)
C2/0C45: AD AB 11     LDA $11AB   (Status set by attack 2)
C2/0C48: 49 A0        EOR #$A0    (Sleep & Muddled)
C2/0C4A: 29 A0        AND #$A0
C2/0C4C: 39 E5 3E     AND $3EE5,Y (Status byte 2)
C2/0C4F: 19 FD 3D     ORA $3DFD,Y
C2/0C52: 99 FD 3D     STA $3DFD,Y (mark Sleep & Muddled to be cleared from target,
                                   provided it already has the statuses, and
                                   the attack itself isn't trying to inflict or remove
                                   them)
C2/0C55: B9 B9 32     LDA $32B9,Y
C2/0C58: 09 80        ORA #$80
C2/0C5A: 99 B9 32     STA $32B9,Y (Flag target to be released from Control at end of
                                   turn)
C2/0C5D: AD A4 11     LDA $11A4
C2/0C60: 89 02        BIT #$02
C2/0C62: F0 11        BEQ $0C75   (Branch if not redirection)
C2/0C64: 20 ED 0D     JSR $0DED   (Cap damage/healing based on max HP/MP of drainer,
                                   and remaining HP/MP of drainee)
C2/0C67: DA           PHX         (save attacker index)
C2/0C68: 5A           PHY         (save target index)
C2/0C69: 5A           PHY 
C2/0C6A: 9B           TXY         (put old attacker index into target index)
C2/0C6B: FA           PLX         (put old target index into attacker index)
C2/0C6C: 20 2F 36     JSR $362F   (save target as attacker's attacker in a counterattack
                                   variable [provided attacker doesn't yet have another
                                   attacker].  reciprocity and all, man.
                                   however, the Carry Flag state passed to this function
                                   seems to be quite arbitrary, particularly if this
                                   is a physical attack [usually being set, but sometimes
                                   not if attacker is a Zombie].  it'll never be set for
                                   magical attacks, which seems suspect as well.)
C2/0C6F: 38           SEC         (enforce 9999 cap for redirection for attacker)
C2/0C70: 20 76 0C     JSR $0C76   
C2/0C73: 7A           PLY         (restore target index)
C2/0C74: FA           PLX         (restore attacker index)
C2/0C75: 18           CLC         (now enforce 9999 cap for target)
C2/0C76: 5A           PHY 
C2/0C77: 08           PHP 
C2/0C78: 2A           ROL 
C2/0C79: 45 F2        EOR $F2     (get Carry XOR attack's heal bit)
C2/0C7B: 4A           LSR 
C2/0C7C: 90 04        BCC $0C82   (branch if:
                                    - we're checking attacker and attack "reverse" drains
                                      [e.g. because target is undead or absorbs element]
                                    - we're checking target and attack damages [includes
                                      draining])
C2/0C7E: 98           TYA 
C2/0C7F: 69 13        ADC #$13
C2/0C81: A8           TAY         (point to Healing instead of Damage)
C2/0C82: C2 20        REP #$20
C2/0C84: B9 D0 33     LDA $33D0,Y (Damage Taken / Healing Done)
C2/0C87: 1A           INC 
C2/0C88: F0 01        BEQ $0C8B   (if no [i.e. FFFFh] damage, treat as zero)
C2/0C8A: 3A           DEC         (otherwise, keep as-is)
C2/0C8B: 18           CLC 
C2/0C8C: 65 F0        ADC $F0     (add Damage/Healing so far to $F0, which is the lowest of:
                                    - attack damage
                                    - HP of target [or attacker if reverse drain] )
                                    - Max HP - HP of attacker [or target if reverse drain] )
C2/0C8E: B0 05        BCS $0C95   (if total Damage/Healing to this target overflowed,
                                   branch and set it to 9999)
C2/0C90: C9 10 27     CMP #$2710  (If over 9999)
C2/0C93: 90 03        BCC $0C98
C2/0C95: A9 0F 27     LDA #$270F  (Truncate Damage to 9999)
C2/0C98: 99 D0 33     STA $33D0,Y (Damage Taken / Healing Done)
C2/0C9A: 28           PLP
C2/0C9C: 7A           PLY 
C2/0C9D: 60           RTS 

C2/0C9E damage modification

Damage modification (Randomness, Row, Self Damage, and more)
C2/0C9E: 08           PHP
C2/0C9F: C2 20        REP #$20
C2/0CA1: AD B0 11     LDA $11B0   (Maximum Damage)
C2/0CA4: 85 F0        STA $F0
C2/0CA6: E2 20        SEP #$20    (Set 8-bit Accumulator)
C2/0CA8: AD 14 34     LDA $3414
C2/0CAB: D0 03        BNE $0CB0
C2/0CAD: 4C 3B 0D     JMP $0D3B   (Exit if $3414 = 0)
C2/0CB0: 20 5A 4B     JSR $4B5A   (Random number 0 to 255)
C2/0CB3: 09 E0        ORA #$E0    (Set bits 7,6,5; bits 0,1,2,3,4 are random)
C2/0CB5: 85 E8        STA $E8     (Random number [224..255])
C2/0CB7: 20 3D 0D     JSR $0D3D   (Damage randomness)
C2/0CBA: 18           CLC 
C2/0CBB: AD A3 11     LDA $11A3
C2/0CBE: 30 04        BMI $0CC4   (Branch if Concern MP)
C2/0CC0: AD A2 11     LDA $11A2
C2/0CC3: 4A           LSR 
C2/0CC4: AD A2 11     LDA $11A2
C2/0CC7: 89 20        BIT #$20
C2/0CC9: D0 57        BNE $0D22   (Branch if ignores defense)
C2/0CCB: 08           PHP 
C2/0CCC: B9 B9 3B     LDA $3BB9,Y (Magic Defense)
C2/0CCF: 90 03        BCC $0CD4   (Branch if concern MP or Magical damage)
C2/0CD1: B9 B8 3B     LDA $3BB8,Y (Defense)
C2/0CD4: 1A           INC 
C2/0CD5: F0 10        BEQ $0CE7   (If = 255)
C2/0CD7: EB           XBA 
C2/0CD8: AD 82 3A     LDA $3A82
C2/0CDB: 2D 83 3A     AND $3A83
C2/0CDE: 30 03        BMI $0CE3   (If Blocked by Golem or Dog, defense = 192)
C2/0CE0: A9 C1        LDA #$C1
C2/0CE2: EB           XBA 
C2/0CE3: EB           XBA 
C2/0CE4: 3A           DEC 
C2/0CE5: 49 FF        EOR #$FF
C2/0CE7: 85 E8        STA $E8     (= 255 - Defense)
C2/0CE9: 20 3D 0D     JSR $0D3D   (Multiply damage by (255 - Defense) / 256 ,
                                   then add 1)
C2/0CEC: A3 01        LDA $01,S
C2/0CEE: 4A           LSR 
C2/0CEF: B9 F8 3E     LDA $3EF8,Y (Status byte 3)
C2/0CF2: B0 01        BCS $0CF5   (Branch if physical attack)
C2/0CF4: 0A           ASL 
C2/0CF5: 0A           ASL 
C2/0CF6: 10 07        BPL $0CFF   (Branch if no safe / shell)
C2/0CF8: A9 AA        LDA #$AA
C2/0CFA: 85 E8        STA $E8
C2/0CFC: 20 3D 0D     JSR $0D3D   (Multiply damage by 170 / 256 , then add 1)
C2/0CFF: 28           PLP 
C2/0D00: 90 15        BCC $0D17   (Skip row check if magical attack)
C2/0D02: B9 A1 3A     LDA $3AA1,Y
C2/0D05: 89 02        BIT #$02
C2/0D07: F0 04        BEQ $0D0D   (Branch if not defending)
C2/0D09: 46 F1        LSR $F1
C2/0D0B: 66 F0        ROR $F0     (Cut damage in half)
C2/0D0D: 89 20        BIT #$20    (Check row)
C2/0D0F: F0 11        BEQ $0D22   (Branch if target in front row)
C2/0D11: 46 F1        LSR $F1
C2/0D13: 66 F0        ROR $F0     (Cut damage in half)
C2/0D15: 80 0B        BRA $0D22   (Skip morph if physical attack)
C2/0D17: B9 F9 3E     LDA $3EF9,Y
C2/0D1A: 89 08        BIT #$08
C2/0D1C: F0 04        BEQ $0D22   (Branch if not morph)
C2/0D1E: 46 F1        LSR $F1
C2/0D20: 66 F0        ROR $F0     (Cut damage in half)
C2/0D22: C2 20        REP #$20    (Set 16-bit Accumulator)
C2/0D24: AD A4 11     LDA $11A4
C2/0D27: 4A           LSR 
C2/0D28: B0 0A        BCS $0D34   (Branch if heal, heal skips self damage theory)
C2/0D2A: C0 08        CPY #$08
C2/0D2C: B0 06        BCS $0D34   (Branch if target is a monster)
C2/0D2E: E0 08        CPX #$08
C2/0D30: B0 02        BCS $0D34   (Branch if attacker is monster)
C2/0D32: 46 F0        LSR $F0     (Cut damage in half if party attacks party)
C2/0D34: A5 F0        LDA $F0     
C2/0D36: 20 0B 37     JSR $370B   (Increment damage using $BC)
C2/0D39: 85 F0        STA $F0
C2/0D3B: 28           PLP 
C2/0D3C: 60           RTS 

C2/0D3D damage function

Multiplies damage by $E8 / 256 and adds 1
(Used by damage randomness etc.)

C2/0D3D: 08           PHP
C2/0D3E: C2 20        REP #$20    (Set 16-bit Accumulator)
C2/0D40: A5 F0        LDA $F0     (Load damage)
C2/0D42: 20 B7 47     JSR $47B7   (Multiply by randomness byte)
C2/0D45: 1A           INC         (Add 1 to damage)
C2/0D46: 85 F0        STA $F0
C2/0D48: 28           PLP 
C2/0D49: 60           RTS 

C2/0D4A atlas armlet and earring function

C2/0D4A: 08           PHP
C2/0D4B: AD A4 11     LDA $11A4   (Special Byte 2)
C2/0D4E: 4A           LSR         
C2/0D4F: B0 34        BCS $0D85   (Exits function if attack heals)
C2/0D51: AD A3 11     LDA $11A3   
C2/0D54: 30 04        BMI $0D5A   (Branch if concern MP) 
C2/0D56: AD A2 11     LDA $11A2   (Special Byte 1)
C2/0D59: 4A           LSR         (Check for physical / magic)
C2/0D5A: C2 20        REP #$20    (Set 16-bit Accumulator)
C2/0D5C: AD B0 11     LDA $11B0   (Max Damage)
C2/0D5F: 85 EE        STA $EE     (Stores damage at $EE)
C2/0D61: BD 44 3C     LDA $3C44,X (Relic effects)
C2/0D64: E2 20        SEP #$20    (Set 8-bit Accumulator)
C2/0D66: B0 06        BCS $0D6E   (Branch if physical damage unless concerns mp)
C2/0D68: 89 02        BIT #$02
C2/0D6A: D0 09        BNE $0D75   (Branch double earrings - add 50% damage)
C2/0D6C: EB           XBA 
C2/0D6D: 4A           LSR 
C2/0D6E: 4A           LSR 
C2/0D6F: 90 14        BCC $0D85   (Exits function if not Atlas Armlet / Earring)
C2/0D71: 46 EF        LSR $EF     (Halves damage)
C2/0D73: 66 EE        ROR $EE     
C2/0D75: C2 20        REP #$20    (Set 16-bit Accumulator)
C2/0D77: A5 EE        LDA $EE
C2/0D79: 4A           LSR         (Halves damage)
C2/0D7A: 18           CLC 
C2/0D7B: 6D B0 11     ADC $11B0   (Adds to damage)
C2/0D7E: 90 02        BCC $0D82   
C2/0D80: 7B           TDC         
C2/0D81: 3A           DEC         
C2/0D82: 8D B0 11     STA $11B0   (Stores result back in damage)
C2/0D85: 28           PLP 
C2/0D86: 60           RTS 

C2/0D87 calculate damage for HP based attacks

Backup XYP
C2/0D87 DA             PHX
C2/0D88 5A             PHY
C2/0D89 08             PHP
Save damage taken
C2/0D8A C2 20          REP #$20        set 16-bit A
C2/0D8C B9 D0 33       LDA $33D0,Y     damage taken
C2/0D8F 1A             INC
C2/0D90 F0 01          BEQ $0D93       If damage is #$FFFF, set it to #$0000
C2/0D92 3A             DEC             restore A (DEC nulls INC)
C2/0D93 85 EE          STA $EE         $EE = damage taken
Set MP based damage if it concerns MP
C2/0D95 E2 20          SEP #$20        set 8-bit A
C2/0D97 20 DD 0D       JSR $0DDD       use MP if concerns MP
Load spell power
C2/0D9A AD A6 11       LDA $11A6       spell power
C2/0D9D 85 E8          STA $E8
Check to use actual HP or max HP
C2/0D9F A5 B5          LDA $B5         actual command
C2/0DA1 C9 01          CMP #$01        Item command
C2/0DA3 F0 06          BEQ $0DAB       use max HP if item
C2/0DA5 AD A2 11       LDA $11A2
C2/0DA8 4A             LSR
C2/0DA9 4A             LSR
C2/0DAA 4A             LSR             check dead xor undead flag
C2/0DAB C2 20          REP #$20        set 16-bit A
C2/0DAD B0 0B          BCS $0DBA       use max HP if dead or undead
Cap actual HP if HP - damage < 0
C2/0DAF 38             SEC             
C2/0DB0 B9 F4 3B       LDA $3BF4,Y     actual HP
C2/0DB3 E5 EE          SBC $EE         subtract damage taken
C2/0DB5 B0 06          BCS $0DBD
C2/0DB7 7B             TDC             damage is zero
C2/0DB8 80 03          BRA $0DBD       
Calculate real damage
C2/0DBA B9 1C 3C       LDA $3C1C,Y     max HP
C2/0DBD 20 CB 0D       JSR $0DCB       A = (spell power * A / 16)
C2/0DC0 48             PHA
C2/0DC1 68             PLA
C2/0DC2 D0 01          BNE $0DC5       if damage isn't null
C2/0DC4 1A             INC             cap damage to 1 if damage is zero
C2/0DC5 85 F0          STA $F0
Restore PYX and exit
C2/0DC7 28             PLP 
C2/0DC8 7A             PLY 
C2/0DC9 FA             PLX 
C2/0DCA 60             RTS

C2/0DCB math: spell power * HP / 16

C2/0DCB: 20 B7 47     JSR $47B7
C2/0DCE: A9 03 00     LDA #$0003
C2/0DD1: DA           PHX
C2/0DD2: AA           TAX 
C2/0DD3: A5 E8        LDA $E8     (Spell Power * HP)
C2/0DD5: 46 EA        LSR $EA     (Cut in half)
C2/0DD7: 6A           ROR 
C2/0DD8: CA           DEX 
C2/0DD9: 10 FA        BPL $0DD5   (Do 4 times)
C2/0DDB: FA           PLX 
C2/0DDC: 60           RTS 

C2/0DDD make damage effects MP instead of HP

C2/0DDD: AD A3 11     LDA $11A3
C2/0DE0: 10 0A        BPL $0DEC   (Branch if not Concern MP)
C2/0DE2: 98           TYA 
C2/0DE3: 18           CLC 
C2/0DE4: 69 14        ADC #$14
C2/0DE6: A8           TAY 
C2/0DE7: 8A           TXA 
C2/0DE8: 18           CLC 
C2/0DE9: 69 14        ADC #$14
C2/0DEB: AA           TAX 
C2/0DEC: 60           RTS 

C2/0DED unknow

Set $F0 to lowest of ($F0, HP/MP of target, Max HP/MP - HP/MP of attacker)
If bit 0 of $F2 is set, switch attacker and target
If bit 7 of $B2 is not set, compare only $F0 and HP of target

C2/0DED: DA           PHX
C2/0DEE: 5A           PHY 
C2/0DEF: 08           PHP 
C2/0DF0: 20 DD 0D     JSR $0DDD   (Set to use MP if concern MP)
C2/0DF3: AD 14 34     LDA $3414
C2/0DF6: 10 25        BPL $0E1D   (Exit if bit 7 $3414 is 0)
C2/0DF8: C2 20        REP #$20
C2/0DFA: A5 F2        LDA $F2
C2/0DFC: 4A           LSR 
C2/0DFD: 90 03        BCC $0E02   (branch if not healing target)
C2/0DFF: DA           PHX 
C2/0E00: BB           TYX 
C2/0E01: 7A           PLY         (Switch target and attacker)
C2/0E02: B9 F4 3B     LDA $3BF4,Y (HP of target)
C2/0E05: C5 F0        CMP $F0
C2/0E07: B0 02        BCS $0E0B   (If HP >= $F0)
C2/0E09: 85 F0        STA $F0
C2/0E0B: A5 B1        LDA $B1
C2/0E0D: 10 0E        BPL $0E1D   (Branch if top bit of $B2 is clear; it's
                                   cleared by the Drain while Seized used by
                                   Tentacles)
C2/0E0F: 9B           TXY         (Make attacker the target)
C2/0E10: 38           SEC 
C2/0E11: B9 1C 3C     LDA $3C1C,Y (Max HP of target)
C2/0E14: F9 F4 3B     SBC $3BF4,Y (HP of target)
C2/0E17: C5 F0        CMP $F0
C2/0E19: B0 02        BCS $0E1D   (If >= $F0)
C2/0E1B: 85 F0        STA $F0
C2/0E1D: 28           PLP 
C2/0E1E: 7A           PLY 
C2/0E1F: FA           PLX 
C2/0E20: 60           RTS 

C2/0E21 zombie chances to inflict dark or poison

Called if Zombie
1 in 16 chance inflict Dark    -OR-
1 in 16 chance inflict Poison

C2/0E21: 20 5A 4B     JSR $4B5A   (Random number 0 to 255)
C2/0E24: C9 10        CMP #$10
C2/0E26: B0 04        BCS $0E2C   
C2/0E28: A9 04        LDA #$04    (will mark Poison status to be set)
C2/0E2A: 80 06        BRA $0E32
C2/0E2C: C9 20        CMP #$20    
C2/0E2E: B0 F0        BCS $0E20   (Exit function)
C2/0E30: A9 01        LDA #$01    (will mark Dark status to be set)
C2/0E32: 19 D4 3D     ORA $3DD4,Y (Status to set byte 1)
C2/0E35: 99 D4 3D     STA $3DD4,Y 
C2/0E38: 60           RTS 

C2/0E39 atma weapon damage

C2/0E39: 08           PHP
C2/0E3A: DA           PHX 
C2/0E3B: 5A           PHY 
C2/0E3C: 9B           TXY 
C2/0E3D: B9 F5 3B     LDA $3BF5,Y (HP / 256)
C2/0E40: 1A           INC 
C2/0E41: EB           XBA 
C2/0E42: B9 18 3B     LDA $3B18,Y (Level)
C2/0E45: 20 81 47     JSR $4781   (Level * ((HP / 256) + 1))
C2/0E48: BE 1D 3C     LDX $3C1D,Y (Max HP / 256)
C2/0E4B: E8           INX 
C2/0E4C: 20 92 47     JSR $4792   ((Level * ((HP / 256) + 1)) / ((Max HP / 256) + 1))
C2/0E4F: 85 E8        STA $E8
C2/0E51: C2 20        REP #$20
C2/0E53: A5 F0        LDA $F0     (load damage so far)
C2/0E55: 20 B7 47     JSR $47B7   (24-bit $E8 = $E8 * damage)
C2/0E58: A9 05 00     LDA #$0005
C2/0E5B: 20 D1 0D     JSR $0DD1   (Divide 24-bit Damage in $E8 by 64. [note that
                                   calculation operates on 4 bytes])
C2/0E5E: 1A           INC         (+1)
C2/0E5F: 85 F0        STA $F0     (save final damage)
                                  (note that we're assuming damage fit into 16 bits,
                                   which should be true provided Level wasn't hacked
                                   past 99.)
C2/0E61: C9 F5 01     CMP #$01F5  (501)
C2/0E64: 90 0D        BCC $0E73   (branch if < 501)
C2/0E66: A2 5B        LDX #$5B    (put index for alternate, bigger weapon
                                   graphic, into X)
C2/0E68: C9 E9 03     CMP #$03E9  (1001)
C2/0E6B: 90 01        BCC $0E6E   (branch if < 1001)
C2/0E6D: E8           INX         (make graphic bigger yet)
C2/0E6E: 86 B7        STX $B7     (save graphic index)
C2/0E70: 20 BB 35     JSR $35BB   (Change Atma Weapon length)
C2/0E73: 7A           PLY 
C2/0E74: FA           PLX 
C2/0E75: 28           PLP 
C2/0E76: 60           RTS 

C2/0E77 JSL: equipment check function

C2/0E77: DA           PHX
C2/0E78: 5A           PHY 
C2/0E79: 8B           PHB 
C2/0E7A: 08           PHP 
C2/0E7B: E2 30        SEP #$30    (Set 8-bit Accumulator, X and Y)
C2/0E7D: 48           PHA 
C2/0E7E: 29 0F        AND #$0F
C2/0E80: A9 7E        LDA #$7E
C2/0E82: 48           PHA 
C2/0E83: AB           PLB         (set Data Bank register to 7E)
C2/0E84: 68           PLA 
C2/0E85: A2 3E        LDX #$3E
C2/0E87: 9E A0 11     STZ $11A0,X
C2/0E8A: CA           DEX 
C2/0E8B: 10 FA        BPL $0E87    (zero out our temporary item bytes)
C2/0E8D: 1A           INC 
C2/0E8E: EB           XBA 
C2/0E8F: A9 25        LDA #$25     (37 bytes of info per character, see Tashibana's
                                    ff6zst.txt for details.  this block is documented as
                                    starting at $1600, but the INC above means X is boosted
                                    by 37 -- perhaps to avoid a negative X later -- so the
                                    base addy is 15DB)
C2/0E91: 20 81 47     JSR $4781
C2/0E94: C2 10        REP #$10       (Set 16-bit X and Y)
C2/0E96: AA           TAX 
C2/0E97: BD DB 15     LDA $15DB,X    (get sprite, which doubles as character index??)
C2/0E9A: EB           XBA 
C2/0E9B: A9 16        LDA #$16       (22 startup bytes per character)
C2/0E9D: 20 81 47     JSR $4781
C2/0EA0: DA           PHX 
C2/0EA1: AA           TAX            (X indexes character startup block)
C2/0EA2: BF AA 7C ED  LDA $ED7CAA,X  (get character Battle Power)
C2/0EA6: 8D AC 11     STA $11AC      
C2/0EA9: 8D AD 11     STA $11AD      (store it in both hands)
C2/0EAC: C2 20        REP #$20       (Set 16-bit Accumulator)
C2/0EAE: BF AB 7C ED  LDA $ED7CAB,X  (character Defense and Magic Defense)
C2/0EB2: 8D BA 11     STA $11BA
C2/0EB5: BF AD 7C ED  LDA $ED7CAD,X  (character Evade and MBlock)
C2/0EB9: E2 20        SEP #$20       (Set 8-bit Accumulator)
C2/0EBB: 8D A8 11     STA $11A8      (save Evade here)
C2/0EBE: EB           XBA 
C2/0EBF: 8D AA 11     STA $11AA      (save MBlock here)
C2/0EC2: BF B5 7C ED  LDA $ED7CB5,X  (character start level info)
C2/0EC6: 29 03        AND #$03
C2/0EC8: 49 03        EOR #$03
C2/0ECA: 1A           INC 
C2/0ECB: 1A           INC 
C2/0ECC: 8D DC 11     STA $11DC      (invert and add 2.  this gives you
                                      5 - (bottom two bits of Level byte) ,
                                      the amount to add to the character's
                                      "Run Success" variable.)
C2/0ECF: FA           PLX           (X indexes into character info block again)
C2/0ED0: A0 06 00     LDY #$0006    (point to Vigor item in character info)
C2/0ED3: BD F5 15     LDA $15F5,X
C2/0ED6: 99 A0 11     STA $11A0,Y   ($11A6 = Vigor, 11A4 = Speed, 11A2 = Stamina,
                                     11A0 = Mag Pwr)
C2/0ED9: E8           INX 
C2/0EDA: 88           DEY 
C2/0EDB: 88           DEY 
C2/0EDC: 10 F5        BPL $0ED3    (loop 4 times)
C2/0EDE: BD EB 15     LDA $15EB,X  (get character Status 1)
C2/0EE1: 85 FE        STA $FE      (save it, it'll be used for tests with Imp equip)
C2/0EE3: A0 05 00     LDY #$0005   (point to last relic slot?)
C2/0EE6: BD FB 15     LDA $15FB,X  
C2/0EE8: 99 C6 11     STA $11C6,Y  (save the item #)
C2/0EEC: 20 9A 0F     JSR $0F9A    (load item data for a slot)
C2/0EEF: CA           DEX 
C2/0EF0: 88           DEY 
C2/0EF1: 10 F3        BPL $0EE6    (loop for all 6 equipment+relic slots)
C2/0EF3: BD ED 15     LDA $15ED,X  (get top byte of Maximum MP)
C2/0EF6: 29 3F        AND #$3F     (zero out top 2 bits, so MP can't exceed 16383)
C2/0EF8: 85 FF        STA $FF      (store top byte of Max MP.
                                    Note: X would be -2 here had the extra 37 not been
                                    added earlier.  i don't think indexed addressing modes
                                    are signed or allow "wrapping", so that was a good
                                    precaution)

C2/0EFA: A9 40        LDA #$40     (first boost we will check is MP + 50%, then lower %)
C2/0EFC: 20 7D 0F     JSR $0F7D    (jump off to handle % MP boosts from equipment)
C2/0EFF: 05 FF        ORA $FF
C2/0F01: 9D ED 15     STA $15ED,X  (store boost in highest 2 bits of MP)
C2/0F04: BD E9 15     LDA $15E9,X  (get top byte of Maximum HP)
C2/0F07: 29 3F        AND #$3F     (zero out top 2 bits, so HP can't exceed 16383)
C2/0F09: 85 FF        STA $FF      (store top byte of Max HP)
C2/0F0B: A9 08        LDA #$08     
C2/0F0D: 20 7D 0F     JSR $0F7D    (go check HP + 50% boost, then lower %)
C2/0F10: 05 FF        ORA $FF
C2/0F12: 9D E9 15     STA $15E9,X  (store boost in highest 2 bits of HP)
C2/0F15: A2 0A 00     LDX #$000A
C2/0F18: BD A1 11     LDA $11A1,X  (did MBlock/Evade/Vigor/Speed/Stamina/MagPwr
                                    exceed 255 with equipment boosts?)
C2/0F1B: F0 09        BEQ $0F26    (if not, look at the next stat)
C2/0F1D: 0A           ASL          (if the topmost bit of the stat is set, it's negative
                                    thanks to horrid equipment.  so bring it up to Zero)
C2/0F1E: 7B           TDC 
C2/0F1F: B0 02        BCS $0F23    (if the topmost bit wasn't set, the stat is just big)
C2/0F21: A9 FF        LDA #$FF     (..  in which case we bring it down to 255)
C2/0F23: 9D A0 11     STA $11A0,X
C2/0F26: CA           DEX 
C2/0F27: CA           DEX 
C2/0F28: 10 EE        BPL $0F18    (loop for all aforementioned stats)
C2/0F2A: AE CE 11     LDX $11CE    (call a function pointer depending on what
                                    is in each hand)
C2/0F2D: FC 47 0F     JSR ($0F47,X)
C2/0F30: AD D7 11     LDA $11D7   
C2/0F33: 10 0D        BPL $0F42   (if Boost Vigor bit isn't set, exit function)
C2/0F35: C2 20        REP #$20    (Set 16-bit Accumulator)
C2/0F37: AD A6 11     LDA $11A6
C2/0F3A: 4A           LSR 
C2/0F3B: 18           CLC 
C2/0F3C: 6D A6 11     ADC $11A6
C2/0F3F: 8D A6 11     STA $11A6   (if Boost Vigor was set, add 50% to Vigor)
C2/0F42: 28           PLP 
C2/0F43: AB           PLB 
C2/0F44: 7A           PLY 
C2/0F45: FA           PLX 
C2/0F46: 6B           RTL 

C2/0F47 pointers: related to weapon and shield equipment

C2/0F47: 67 0F (Do nothing) (shouldn't be called, as i can't get shields in both hands)
C2/0F49: 61 0F (2nd hand is occupied by weapon, 1st hand holds nonweapon)
               (so 2nd hand will strike.  i.e. it retains some Battle Power)
C2/0F4B: 68 0F (1st hand is occupied by weapon, 2nd hand holds nonweapon)
               (so 1st hand will strike)

C2/0F4D: 6F 0F (1st and 2nd hand are both occupied by weapon)

C2/0F4F: 61 0F (2nd hand is empty, 1st hand holds nonweapon)
               (so 2nd hand will strike)
C2/0F51: 67 0F (Do nothing)  (filler.. shouldn't be called, contradictory 2nd hand)
C2/0F53: 6B 0F (2nd hand is empty, 1st is occupied by weapon)
               (so 1st hand will strike, Gauntlet-ized if applicable)
C2/0F55: 67 0F (Do nothing)  (filler.. shouldn't be called, contradictory 2nd hand)
C2/0F57: 68 0F (1st hand is empty, 2nd hand holds nonweapon)
               (so 1st hand will strike)
C2/0F59: 64 0F (1st hand is empty, 2nd hand occupied by weapon)
               (so 2nd hand will strike, Gauntlet-ized if applicable)
C2/0F5B: 67 0F (Do nothing)  (filler.. shouldn't be called, contradictory 1st hand)
C2/0F5D: 67 0F (Do nothing)  (filler.. shouldn't be called, contradictory 1st hand)
C2/0F5F: 68 0F (1st and 2nd hand both empty)
               (so might as well strike with 1st hand)
(view C2/10B2 to see how the bits for each hand were set)

C2/0F61 unknow

C2/0F61: 20 74 0F     JSR $0F74  
C2/0F64: 9C AC 11     STZ $11AC   (clear Battle Power for 1st hand)
C2/0F67: 60           RTS 

C2/0F68 unknow

C2/0F68: 20 74 0F     JSR $0F74
C2/0F6B: 9C AD 11     STZ $11AD   (clear Battle Power for 2nd hand)
C2/0F6E: 60           RTS 

C2/0F6F related to genji glove effect

(NOTE: C2/0F6F is only called if you have weapons in both hands, which means that's
 the ONLY situation where the Genji Glove effect is cleared.  So you'll do full damage
 with each strike if you have two weapons, but have it reduced by 1/4 if you have zero
 or one weapon.  This is widely acknowledged as ass-backwards; common sense tells you that 
 1 weapon should hardly be more cumbersome than 2...  Nor should a magic glove make
 gripping one a tall feat.

 I suspect Square was thrown by their own byte $11CF, as "set effect to be cleared"
 sounds like an oxymoron.  They were probably trying to *enable* the genji effect below
 (after all, TSB usually _does_ _enable_ things).  At least that's what my forthcoming
 patch will assume... ^__^ )

C2/0F6F: A9 10        LDA #$10    (Genji Glove Effect)
C2/0F71: 0C CF 11     TSB $11CF   (Sets Genji Glove effect to be cleared)
C2/0F74: A9 40        LDA #$40
C2/0F76: 1C DA 11     TRB $11DA   (turn off Gauntlet effect for 1st hand)
C2/0F79: 1C DB 11     TRB $11DB   (turn off Gauntlet effect for 2nd hand)
C2/0F7C: 60           RTS 

C2/0F7D unknow

(11D5 = 
01: Raise Attack Damage         10: Raise HP by 12.5%
02: Raise Magic Damage          20: Raise MP by 25%
04: Raise HP by 25%             40: Raise MP by 50%
08: Raise HP by 50%             80: Raise MP by 12.5% .  from yousei's doc)

C2/0F7D: 2C D5 11     BIT $11D5  
C2/0F80: F0 03        BEQ $0F85  
C2/0F82: A9 80        LDA #$80   (if bit is set, store 50% boost)
C2/0F84: 60           RTS 
C2/0F85: 4A           LSR
C2/0F86: 2C D5 11     BIT $11D5
C2/0F89: F0 03        BEQ $0F8E
C2/0F8B: A9 40        LDA #$40   (if bit is set, store 25% boost)
C2/0F8D: 60           RTS 
C2/0F8E: 0A           ASL
C2/0F8F: 0A           ASL 
C2/0F90: 2C D5 11     BIT $11D5
C2/0F93: F0 03        BEQ $0F98
C2/0F95: A9 C0        LDA #$C0   (if bit is set, store 12.5% boost)
C2/0F97: 60           RTS 
C2/0F98: 7B           TDC        (if none of the bits were set, store 0% boost)
C2/0F99: 60           RTS 

C2/0F9A load item data into memory

C2/0F9A: DA           PHX
C2/0F9B: 5A           PHY      (Y = equip/relic slot, 0 to 5?)
C2/0F9C: EB           XBA 
C2/0F9D: A9 1E        LDA #$1E
C2/0F9F: 20 81 47     JSR $4781       (multiply index by size of item data block)
C2/0FA2: AA           TAX         
C2/0FA3: BF 05 50 D8  LDA $D85005,X   (field effects)
C2/0FA7: 0C DF 11     TSB $11DF
C2/0FAA: C2 20        REP #$20        (Set 16-bit accumulator)
C2/0FAC: BF 06 50 D8  LDA $D85006,X
C2/0FB0: 0C D2 11     TSB $11D2       (status bytes 1 and 2 protection)
C2/0FB3: BF 08 50 D8  LDA $D85008,X
C2/0FB7: 0C D4 11     TSB $11D4       (11D4 = equipment status byte 3,
                                       11D5 = raise attack damage, raise magic damage,
                                       and HP and MP % boosts)
C2/0FBA: BF 0A 50 D8  LDA $D8500A,X   

(battle effects 1 and "status effects 2".  latter is nothing to do with status ailments. 
11D6:
01: Increase Preemptive Atk chance  10: Sketch -> Control
02: Prevent Back/Pincer attacks     20: Slot -> GP Rain
    (this won't work for battles
     where back/pincer are forced)
04: Fight -> Jump                   40: Steal -> Capture
08: Magic -> X-Magic                80: Jump continuously

11D7:
01: Increase Steal Rate         10: 100% Hit Rate
02: --                          20: Halve MP Consumption
04: Increase Sketch Rate        40: Reduce MP Consumption to 1
08: Increase Control Rate       80: Raise Vigor               .  yousei's doc)

C2/0FBE: 0C D6 11     TSB $11D6
C2/0FC1: BF 0C 50 D8  LDA $D8500C,X  (battle effects 2 and 3)
C2/0FC5: 0C D8 11     TSB $11D8

(11D8:
01: Fight -> X-Fight                    10: Can equip a weapon in each hand
02: Randomly Counter Attacks            20: Wearer can equip heavy armor
04: Increases chance of evading attack  40: Wearer protects those with low HP
08: Attack with two hands               80:

11D9:
01: Casts Shell when HP is low          10: Doubles Gold received
02: Casts Safe when HP is low           20:
04: Casts Rflect when HP is low         40:
08: Doubles Experience received         80: Makes body cold

C2/0FC8: BF 10 50 D8  LDA $D85010,X   (Vigor+ / Speed+ / Stamina+ / MagPwr+ , by ascending address)
C2/0FCC: A0 06 00     LDY #$0006
C2/0FCF: 48           PHA
C2/0FD0: 29 0F 00     AND #$000F      (isolate bottom nibble)
C2/0FD3: 89 08 00     BIT #$0008      (if top bit of stat boost is set, adjustment will be negative)
C2/0FD6: F0 04        BEQ $0FDC       (if not, branch)
C2/0FD8: 49 F7 FF     EOR #$FFF7      (create a signed 16-bit negative value)
C2/0FDB: 1A           INC             
C2/0FDC: 18           CLC 
C2/0FDD: 79 A0 11     ADC $11A0,Y
C2/0FE0: 99 A0 11     STA $11A0,Y     (make adjustment to stat, ranging from -7 to +7)
                                      ($11A6 = Vigor, 11A4 = Speed, 11A2 = Stamina, 11A0 = Mag Pwr)
C2/0FE3: 68           PLA 
C2/0FE4: 4A           LSR 
C2/0FE5: 4A           LSR 
C2/0FE6: 4A           LSR 
C2/0FE7: 4A           LSR             (get next highest nibble)
C2/0FE8: 88           DEY 
C2/0FE9: 88           DEY 
C2/0FEA: 10 E3        BPL $0FCF       (loop for all 4 stats)
C2/0FEC: BF 1A 50 D8  LDA $D8501A,X   (Evade/MBlock byte)
C2/0FF0: DA           PHX 
C2/0FF1: 48           PHA 
C2/0FF2: 29 0F 00     AND #$000F      (isolate evade)
C2/0FF5: 0A           ASL
C2/0FF6: AA           TAX             (evade nibble * 2, turn into pointer)
C2/0FF7: BF 05 11 C2  LDA $C21105,X   (get actual evade boost/reduction of item)
C2/0FFB: 18           CLC 
C2/0FFC: 6D A8 11     ADC $11A8
C2/0FFF: 8D A8 11     STA $11A8       (add it to other evade boosts)
C2/1002: 68           PLA 
C2/1003: 29 F0 00     AND #$00F0      (isolate mblock)
C2/1006: 4A           LSR
C2/1007: 4A           LSR 
C2/1008: 4A           LSR 
C2/1009: AA           TAX             (mblock nibble * 2, turn into pointer) 
C2/100A: BF 05 11 C2  LDA $C21105,X   (get actual mblock boost/reduction of item)
C2/100E: 18           CLC 
C2/100F: 6D AA 11     ADC $11AA
C2/1012: 8D AA 11     STA $11AA       (add it to other mblock boosts)
C2/1015: FA           PLX 
C2/1016: E2 20        SEP #$20        (Set 8-bit Accumulator)
C2/1018: BF 14 50 D8  LDA $D85014,X   (get weapon battle power / armor defense power)
C2/101C: EB           XBA 
C2/101D: BF 02 50 D8  LDA $D85002,X   (get top byte of equippable chars?)
C2/1021: 0A           ASL 
C2/1022: 0A           ASL             (carry = Specs active when Imp?)
C2/1023: A5 FE        LDA $FE         (Character Status Byte 1)
C2/1025: B0 02        BCS $1029       (branch if imp-activated)
C2/1027: 49 20        EOR #$20        (flip Imp status)
C2/1029: 89 20        BIT #$20        (character has Imp status?)
C2/102B: D0 03        BNE $1030       
C2/102D: A9 01        LDA #$01        (if you're an Imp and specs aren't Imp-activated,
                                       defense/battle power = 1.  or if you're not an Imp
                                       and the specs are Imp-activated, battle/defense
                                       power = 1)
C2/102F: EB           XBA 
C2/1030: EB           XBA             (if imp-activation and imp status match, put the
                                       original Battle/Defense Power back in bottom of A)

(note that Item #255 has a Battle Power of 10, so bare hands will actually be
 stronger than Imp Halberd on a non-Imp)

C2/1031: 85 FD        STA $FD        
C2/1033: BF 00 50 D8  LDA $D85000,X  (item type)
C2/1037: 29 07        AND #$07       (isolate classification)
C2/1039: 3A           DEC 
C2/103A: F0 76        BEQ $10B2      (if it's a weapon, branch)
C2/103C: BF 19 50 D8  LDA $D85019,X
C2/1040: 0C BC 11     TSB $11BC      (equipment status byte 2)
C2/1043: BF 0F 50 D8  LDA $D8500F,X  (50% resist elements)
C2/1047: EB           XBA 
C2/1048: BF 18 50 D8  LDA $D85018,X  (weak to elements)
C2/104C: C2 20        REP #$20       (Set 16-bit Accumulator)
C2/104E: 0C B8 11     TSB $11B8      (bottom = weak elements, top = 50% resist elements)
C2/1051: BF 16 50 D8  LDA $D85016,X
C2/1055: 0C B6 11     TSB $11B6      (bottom = absorbed elements, top = nullified elements)
C2/1058: E2 20        SEP #$20       (Set 8-bit Accumulator)
C2/105A: 18           CLC 
C2/105B: A5 FD        LDA $FD        (get equipment Defense Power)
C2/105D: 6D BA 11     ADC $11BA      (add it into Defense so far)
C2/1060: 90 02        BCC $1064
C2/1062: A9 FF        LDA #$FF
C2/1064: 8D BA 11     STA $11BA      (if defense exceeds 255, make it 255)
C2/1067: 18           CLC 
C2/1068: BF 15 50 D8  LDA $D85015,X  (get equipment Magic Defense)
C2/106C: 6D BB 11     ADC $11BB      (add it into MagDef so far)
C2/106F: 90 02        BCC $1073
C2/1071: A9 FF        LDA #$FF
C2/1073: 8D BB 11     STA $11BB      (if magic defense exceeds 255, make it 255)
C2/1076: 7A           PLY 
C2/1077: A9 02        LDA #$02
C2/1079: 1C D5 11     TRB $11D5  (clear "raise magic damage" bit in Item Bonuses --
                                  raise fight, raise magic, HP + %, MP + %)
C2/107C: F0 08        BEQ $1086  
C2/107E: 0C D7 11     TSB $11D7  (if Earring effect is set in current equipment slot, set
                                  it in Item Special 2:
                                  boost steal, single Earring, boost sketch, boost control,
                                  sniper sight, gold hairpin, economizer, vigor + 50%)
C2/1081: F0 03        BEQ $1086
C2/1083: 0C D5 11     TSB $11D5  (if Earring effect had also been set by other equipment
                                  slots, set it again in item bonuses, where it will actually
                                  represent _double_ Earring, even though the initial data
                                  byte would have it set even for a lone Earring)

                                 (if all this crazy bit swapping seems convuluted, keep in
                                  mind that $11D5 isn't RELOADED for each equipment slot;
                                  it's ADDED to via the TSB at C2/0FB7.  thus, we must clear
                                  the Earring bit in $11D5 for each of the 6 equip slots if
                                  we wish to see whether the CURRENT slot gives us the
                                  Earring effect.)

C2/1086: 7B           TDC 
C2/1087: BF 1B 50 D8  LDA $D8501B,X  (item byte 1B, special action)
C2/108B: 99 BE 11     STA $11BE,Y
C2/108E: 89 0C        BIT #$0C    (shield animation for blocked physical/magic attacks
                                   or weapon parry?)
C2/1090: F0 1E        BEQ $10B0   (if none of above, branch)
C2/1092: 48           PHA         (save old Byte 1B)       
C2/1093: 29 03        AND #$03    (isolate bottom 2 bits.  for a given item:
                                   bit 0 = big weapon parry anim.
                                   bit 1 = "any" shield block, all except cursed shld.
                                   both = zephyr cape.  neither = small weapon parry

                                   bit 2 = physical block: shield, weapon parry, or zephyr cape)
                                   bit 3 = magical shield block.  shields only?  )

C2/1095: AA           TAX         (put Acc in X.  Following loop gives us 2^X)
C2/1096: 7B           TDC         (clear Acc)
C2/1097: 38           SEC         (set carry flag)
C2/1098: 2A           ROL         (rotate carry into lowest bit of Acc)
C2/1099: CA           DEX         (decrement X, which was 0-3)
C2/109A: 10 FC        BPL $1098   (loop if X>=0)
C2/109C: EB           XBA 
C2/109D: 68           PLA         (retrieve item byte 1B)    
C2/109E: 89 04        BIT #$04   
C2/10A0: F0 05        BEQ $10A7   (branch if physical block animation not set)
C2/10A2: EB           XBA 
C2/10A3: 0C D0 11     TSB $11D0   (if one of above was set, store our 2^X value)
C2/10A6: EB           XBA 
C2/10A7: 89 08        BIT #$08   
C2/10A9: F0 05        BEQ $10B0   (if no magic attack block for shield, branch)
C2/10AB: EB           XBA 
C2/10AC: 0C D1 11     TSB $11D1   (if there was, store our 2^X value)
C2/10AF: EB           XBA 
C2/10B0: FA           PLX 
C2/10B1: 60           RTS