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: 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 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 C2/002E: F0 03 BEQ $0033 C2/0030: 20 CC 00 JSR $00CC 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 C2/0095: EC 65 3A CPX $3A65 C2/0098: F0 0C BEQ $00A6 C2/009A: EE 64 3A INC $3A64 C2/009D: BD 20 37 LDA $3720,X C2/00A0: 30 F0 BMI $0092 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 current action queue position?) C2/00AE: EC 67 3A CPX $3A67 (does it match position of the next available [unused] queue slot? iow, have we reached 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 current action queue position) C2/00BC: BD 20 38 LDA $3820,X (see who's in line there) 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: A2 06 LDX #$06 C2/00CE: BD 18 30 LDA $3018,X C2/00D1: 1C 58 3A TRB $3A58 C2/00D4: F0 09 BEQ $00DF 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 C2/00DF: CA DEX C2/00E0: CA DEX C2/00E1: 10 EB BPL $00CE C2/00E3: 60 RTS 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: 38 SEC C2/00FA: 6E 06 34 ROR $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 C2/011E: D0 1E BNE $013E 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 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 Mimic 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: 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 (Save this command's info in Mimic variables so Gogo will be able to Mimic it if he/she tries.) 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, if it's enemy Roulette or a counterattack) C2/022B: 0A ASL C2/022C: AA TAX C2/022D: BF 00 FE CF LDA $CFFE00,X C2/0231: 89 02 BIT #$02 C2/0233: F0 2F BEQ $0264 (branch if this command can't be Mimicked. such commands are Morph, Revert, Control, Leap, Row, Defense, Jump, and Possess. But Jump can be mimicked!, you say. true, but unlike other commands, which become mimicable after they're executed, this one becomes fair game after the character enters their ready stance [i.e. when they leap]. that way, Gogo doesn't have to wait til a Jumper lands to copy them. this special case is handled in C2/2188, so we don't want Jump among the Mimicable commands in $CFFE00) 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. it seems the first strike of a Gem Box sequence has Magic in the command ID, and the second has 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). in other words, default to indicating there was no 2nd Gem Box attack.) 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: 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: 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 not 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 (Bit 2 set for Fight, Item, Magic, Revert, Mimic, Row, Def., Jump, X-Magic, Health, Shock) (0F, 07, 07, 00, 04, 0B, 0B, 03 03, 03, 03, 03, 03, 03, 01, 03 0B, 00, 05, 03, 04, 04, 05, 07 03, 03, 06, 06, 01, 0A, 00, 00 ) C2/02B4: FA PLX C2/02B5: 89 04 BIT #$04 C2/02B7: D0 21 BNE $02DA (branch if Bit 2 set) 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. i believe $3A41 will always be zero) 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: 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: 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: 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 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 bit retort and runic) C2/0333: E0 08 CPX #$08 C2/0335: 90 0D BCC $0344 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: 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: 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: BD F8 3E LDA $3EF8,X C2/037E: 4A LSR C2/037F: B0 56 BCS $03D7 (Branch if Dance) C2/0381: BD F9 3E LDA $3EF9,X C2/0384: 4A LSR C2/0385: B0 47 BCS $03CE (Branch if Rage) 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: 08 PHP C2/03BA: C2 20 REP #$20 C2/03BC: C9 0C 8C CMP #$8C0C C2/03BF: D0 03 BNE $03C4 C2/03C1: A9 1E 8C LDA #$8C1E C2/03C4: 28 PLP C2/03C5: 60 RTS 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: 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. otherwise, keep it.) 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 C2/0418: 9C 4E 3A STZ $3A4E C2/041B: 20 7E 58 JSR $587E C2/041E: 28 PLP C2/041F: 60 RTS (Pick action to take 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.. this number may drop.) 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. will be used by the $04E2 and $04EC functions, since X gets overwritten.) 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) (NOTE: Like the code above with $C204D0 and $C204D4, this next section makes use of pairs of tables. However, UNLIKE that code, this doesn't seem to treat one table differently than the other. I believe the pairs of tables are just to allow two commands to be compared per loop iteration, halving the number of iterations and speeding things up a little. Were you only to compare one command per iteration -- simply using offsets $C204D8,X and ($04E2,X) -- this loop would occupy less space.. hmmm...) (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 (Data - commands allowed when Muddled/Charmed/Colosseum brawling) 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) (in other words: Item, Revert, Throw, Control, Slot, Leap, Def., Summon, and Possess are excluded) (Data - commands allowed when Berserked/Zombied) C2/04D4: 41 (Fight, Capture) C2/04D5: 00 (none) C2/04D6: 41 (Rage, Jump) C2/04D7: 20 (MagiTek) (Commands that need special functions when character 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) (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) (Lore) 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 (Magic and X-Magic) 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 (Randomly chosen command failed, for whatever reason) 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 (Morph) 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 (SwdTech) 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 (Blitz) 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 (MagiTek) 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..) C2/0589: 18 CLC C2/058A: 69 83 ADC #$83 (first MagiTek move is #131, Fire Beam) C2/058C: 60 RTS (Tools) 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 (Picks dance, and dance move) 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 (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 (Picks a Rage [when Muddled/Berserked/etc], and picks the Rage move) 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 (Load monster Battle and Special graphics, its special attack, and elemental/status/special properties) 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 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 (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 (If attack does not equal nothing) 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..) 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 command to Fight) 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 (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: 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 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 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 C2/06D8: BD D8 3E LDA $3ED8,X (Which character attacker is) 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 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: 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: 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 (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 (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: A9 40 LDA #$40 C2/0785: 20 AB 5B JSR $5BAB 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: 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 C2/07AA: 4C 91 4E JMP $4E91 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: EC F9 33 CPX $33F9 C2/07CB: D0 28 BNE $07F5 C2/07CD: DA PHX C2/07CE: AE F8 33 LDX $33F8 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 C2/07F1: 8D F9 33 STA $33F9 C2/07F4: FA PLX C2/07F5: BD 6C 33 LDA $336C,X C2/07F8: 30 04 BMI $07FE C2/07FA: A8 TAY C2/07FB: 20 2D 08 JSR $082D (Clear Love Token) C2/07FE: BD 6D 33 LDA $336D,X C2/0801: 30 07 BMI $080A C2/0803: DA PHX C2/0804: 9B TXY C2/0805: AA TAX C2/0806: 20 2D 08 JSR $082D (Clear Love Token) C2/0809: FA PLX C2/080A: BD 94 33 LDA $3394,X C2/080D: 30 04 BMI $0813 C2/080F: A8 TAY C2/0810: 20 36 08 JSR $0836 (Clear Charm) C2/0813: BD 95 33 LDA $3395,X C2/0816: 30 07 BMI $081F (Branch if charmed) C2/0818: DA PHX C2/0819: 9B TXY C2/081A: AA TAX C2/081B: 20 36 08 JSR $0836 (Clear Charm) 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 Clear Love Token effects 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 Clear Charm effects 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 (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 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 "" 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 C2/08BE: CA DEX C2/08BF: CA DEX C2/08C0: 30 03 BMI $08C5 C2/08C2: 4C 41 08 JMP $0841 C2/08C5: 60 RTS 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: E0 08 CPX #$08 C2/0921: B0 A2 BCS $08C5 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 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 (If not 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: 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 (Assign a starting 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) C2/09CD: 60 RTS (Zero Condemned counter) C2/09CE: 9E 05 3B STZ $3B05,X (Condemned counter = 0) C2/09D1: 60 RTS 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 (A = 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 C2/0A0A: 9D C8 3A STA $3AC8,X (A = A / 16. amount to increase ATB timer by?) C2/0A0D: 28 PLP C2/0A0E: 60 RTS 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: 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: 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 (branch 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) 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: 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: 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: 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 (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: C2 20 REP #$20 (Set 16-bit Accumulator) C2/0B4C: BD 18 30 LDA $3018,X C2/0B4F: 0C 2C 3F TSB $3F2C 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 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) C2/0BA8: AD A2 11 LDA $11A2 C2/0BAB: 89 08 BIT #$08 C2/0BAD: F0 24 BEQ $0BD3 (Branch if not heal undead) C2/0BAF: B9 95 3C LDA $3C95,Y C2/0BB2: 10 0B BPL $0BBF (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 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 status) 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 C2/0BEA: A5 F2 LDA $F2 C2/0BEC: 49 01 EOR #$01 C2/0BEE: 85 F2 STA $F2 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 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 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 C2/0C16: A5 F1 LDA $F1 C2/0C18: 30 04 BMI $0C1E (Don't double if over 32768) C2/0C1A: 06 F0 ASL $F0 C2/0C1C: 26 F1 ROL $F1 (Double damage) C2/0C1E: AD A9 11 LDA $11A9 C2/0C21: C9 04 CMP #$04 C2/0C23: D0 03 BNE $0C28 (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: 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 / Zombie 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 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 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 redirection 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 drains) 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 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 C2/0CE9: 20 3D 0D JSR $0D3D (Multiply damage by 255 - Defense / 256) 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) (roughly 2/3) 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 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 Atlas Armlet / 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 Figure damage if based on HP C2/0D87: DA PHX C2/0D88: 5A PHY C2/0D89: 08 PHP C2/0D8A: C2 20 REP #$20 (Set 16-bit Accumulator) C2/0D8C: B9 D0 33 LDA $33D0,Y (Damage Taken) C2/0D8F: 1A INC C2/0D90: F0 01 BEQ $0D93 (If damage taken is none set to 0) C2/0D92: 3A DEC C2/0D93: 85 EE STA $EE C2/0D95: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/0D97: 20 DD 0D JSR $0DDD (Use MP if concerns MP) C2/0D9A: AD A6 11 LDA $11A6 (Spell Power) C2/0D9D: 85 E8 STA $E8 C2/0D9F: A5 B5 LDA $B5 C2/0DA1: C9 01 CMP #$01 C2/0DA3: F0 06 BEQ $0DAB (if command = item, then always use Max HP) C2/0DA5: AD A2 11 LDA $11A2 C2/0DA8: 4A LSR C2/0DA9: 4A LSR C2/0DAA: 4A LSR C2/0DAB: C2 20 REP #$20 (Set 16-bit Accumulator) C2/0DAD: B0 0B BCS $0DBA (If hit only the (dead XOR undead), then use Max HP) C2/0DAF: 38 SEC (Else use current HP) C2/0DB0: B9 F4 3B LDA $3BF4,Y (HP) C2/0DB3: E5 EE SBC $EE (Subtract damage taken) C2/0DB5: B0 06 BCS $0DBD C2/0DB7: 7B TDC C2/0DB8: 80 03 BRA $0DBD C2/0DBA: B9 1C 3C LDA $3C1C,Y (Max HP) C2/0DBD: 20 CB 0D JSR $0DCB C2/0DC0: 48 PHA C2/0DC1: 68 PLA C2/0DC2: D0 01 BNE $0DC5 C2/0DC4: 1A INC C2/0DC5: 85 F0 STA $F0 C2/0DC7: 28 PLP C2/0DC8: 7A PLY C2/0DC9: FA PLX C2/0DCA: 60 RTS 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 Make damage affect MP if concerns MP 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 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 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 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 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 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 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) / ((Max HP / 256) + 1)) C2/0E4F: 85 E8 STA $E8 C2/0E51: C2 20 REP #$20 C2/0E53: A5 F0 LDA $F0 C2/0E55: 20 B7 47 JSR $47B7 ($E8 * damage) C2/0E58: A9 05 00 LDA #$0005 C2/0E5B: 20 D1 0D JSR $0DD1 (Final Damage / 64 ?? - was 32) C2/0E5E: 1A INC (+1) C2/0E5F: 85 F0 STA $F0 C2/0E61: C9 F5 01 CMP #$01F5 (501) C2/0E64: 90 0D BCC $0E73 C2/0E66: A2 5B LDX #$5B C2/0E68: C9 E9 03 CMP #$03E9 (1001) C2/0E6B: 90 01 BCC $0E6E C2/0E6D: E8 INX C2/0E6E: 86 B7 STX $B7 C2/0E70: 20 BB 35 JSR $35BB C2/0E73: 7A PLY C2/0E74: FA PLX C2/0E75: 28 PLP C2/0E76: 60 RTS Equipment Check Function (Called from other bank) 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. wtf?) (gives you 5 - (bottom two bits of Level byte) ) 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 (Code Pointers) 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: 20 74 0F JSR $0F74 C2/0F64: 9C AC 11 STZ $11AC (clear Battle Power for 1st hand) C2/0F67: 60 RTS C2/0F68: 20 74 0F JSR $0F74 C2/0F6B: 9C AD 11 STZ $11AD (clear Battle Power for 2nd hand) C2/0F6E: 60 RTS (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 (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 Loads 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 C2/1047: EB XBA C2/1048: BF 18 50 D8 LDA $D85018,X 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 C2/10B2: 7B TDC C2/10B3: 1A INC C2/10B4: A8 TAY (Y = 1) C2/10B5: 1A INC (Accumulator = 2) C2/10B6: 85 FF STA $FF C2/10B8: A3 01 LDA $01,S (equipment/relic slot - 0 to 5?) C2/10BA: C9 02 CMP #$02 C2/10BC: B0 B8 BCS $1076 (if it's not slot 0 or 1, one of the arms, return to caller) C2/10BE: 3A DEC C2/10BF: F0 03 BEQ $10C4 (if it was slot 1, branch) C2/10C1: 88 DEY (point to slot 0) C2/10C2: 06 FF ASL $FF ($FF = 4) C2/10C4: B9 C6 11 LDA $11C6,Y (get item # from the slot) C2/10C7: 1A INC C2/10C8: D0 04 BNE $10CE (if the item is not Empty #255, branch) C2/10CA: 06 FF ASL $FF C2/10CC: 06 FF ASL $FF C2/10CE: A5 FF LDA $FF ($FF = 2 if this is 2nd hand and it's occupied by weapon, 4 if this is 1st hand and it's occupied by weapon, 8 if this is 2nd hand and it's empty, 16 if this is 1st hand and it's empty. And $FF is never set if the hand holds a nonweapon) C2/10D0: 0C CE 11 TSB $11CE (turn on the current $FF bit in $11CE, which will hold info about both hands) C2/10D3: BF 16 50 D8 LDA $D85016,X C2/10D7: 99 B2 11 STA $11B2,Y C2/10DA: BF 0F 50 D8 LDA $D8500F,X (elemental properties) C2/10DE: 99 B0 11 STA $11B0,Y C2/10E1: A5 FD LDA $FD (get equipment Battle Power) C2/10E3: 79 AC 11 ADC $11AC,Y (add it to Battle Power so far) C2/10E6: 90 02 BCC $10EA C2/10E8: A9 FF LDA #$FF C2/10EA: 99 AC 11 STA $11AC,Y (if the Battle Power exceeded 255, make it 255) C2/10ED: BF 15 50 D8 LDA $D85015,X (hit rate) C2/10F1: 99 AE 11 STA $11AE,Y C2/10F4: BF 12 50 D8 LDA $D85012,X (random weapon spellcast) C2/10F8: 99 B4 11 STA $11B4,Y C2/10FB: BF 13 50 D8 LDA $D85013,X (weapon properties) C2/10FF: 99 DA 11 STA $11DA,Y (11DA= 01: 10: -- 02: SwdTech 20: Same damage from back row 04: -- 40: 2-Hand 08: -- 80: Runic) C2/1102: 4C 76 10 JMP $1076 (Data - Evade and Mblock Boosts/Reductions) C2/1105: 00 00 (0) C2/1107: 0A 00 (+10) C2/1109: 14 00 (+20) C2/110B: 1E 00 (+30) C2/110D: 28 00 (+40) C2/110F: 32 00 (+50) C2/1111: F6 FF (-10) C2/1113: EC FF (-20) C2/1115: E2 FF (-30) C2/1117: D8 FF (-40) C2/1119: CE FF (-50) C2/111B: 08 PHP C2/111C: E2 30 SEP #$30 (Set 8-bit A, X, & Y) C2/111E: 20 1F 4D JSR $4D1F C2/1121: AD 41 2F LDA $2F41 C2/1124: 2D 8F 3A AND $3A8F C2/1127: D0 62 BNE $118B (Exit function if set to wait battle and in a menu) C2/1129: AD 6C 3A LDA $3A6C (get backup frame counter?) C2/112C: A2 02 LDX #$02 C2/112E: C5 0E CMP $0E (compare to current frame counter?) C2/1130: F0 5E BEQ $1190 (Exit function if $3A6C = $000E. Doing this check twice serves to exit if the function was already called the current frame [which i don't think ever happens] or if it was called last frame.) C2/1132: 1A INC C2/1133: CA DEX C2/1134: D0 F8 BNE $112E (Check and exit if $3A6C + 1 = $000E) C2/1136: EE 3E 3A INC $3A3E (Increment battle time counter) C2/1139: D0 03 BNE $113E C2/113B: EE 3F 3A INC $3A3F (Increment battle time counter) C2/113E: 20 83 5A JSR $5A83 C2/1141: A2 12 LDX #$12 C2/1143: EC E2 3E CPX $3EE2 (Is this target Morphed?) C2/1146: D0 03 BNE $114B (Branch if not) C2/1148: 20 11 12 JSR $1211 (Do morph timer decrement) C2/114B: BD A0 3A LDA $3AA0,X C2/114E: 4A LSR C2/114F: 90 33 BCC $1184 (If bit 0 of $3AA0,X was clear, branch to next target) C2/1151: EC F8 33 CPX $33F8 (Has this target used Zinger?) C2/1154: F0 2E BEQ $1184 (If it has, branch to next target) C2/1156: 89 3A BIT #$3A C2/1158: D0 2A BNE $1184 (If none of bits 5, 4, 3, or 1 are set in [orig.] $3AA0,X.. branch to next target) C2/115A: 89 04 BIT #$04 C2/115C: F0 1E BEQ $117C (If bit 2 isn't set in [original] $3AA0,X... branch to load this target's ATB) C2/115E: AD 45 2F LDA $2F45 (Characters trying to run) C2/1161: F0 16 BEQ $1179 (If no one is trying to run, branch to Advance Wait Timer function) C2/1163: BD E4 3E LDA $3EE4,X C2/1166: 89 02 BIT #$02 (Check for Zombie Status) C2/1168: D0 0F BNE $1179 (If zombie, branch to Advance Wait Timer function) C2/116A: BD 18 30 LDA $3018,X C2/116D: F0 0A BEQ $1179 (If monster, branch to Advance Wait Timer function) C2/116F: 2C 2C 3F BIT $3F2C C2/1172: D0 05 BNE $1179 (If jumping, branch to Advance Wait Timer function) C2/1174: 2C 40 3A BIT $3A40 C2/1177: F0 03 BEQ $117C (If character acting as an enemy, skip Advance Wait Timer function) C2/1179: 20 93 11 JSR $1193 (Advance Wait Timer function) C2/117C: BD 19 32 LDA $3219,X (Load top byte of this target's ATB counter) C2/117F: F0 03 BEQ $1184 (If it's 0, branch to next target) C2/1181: 20 BB 11 JSR $11BB C2/1184: CA DEX C2/1185: CA DEX C2/1186: 10 BB BPL $1143 (Loop if targets remaining) C2/1188: 20 54 5C JSR $5C54 C2/118B: A5 0E LDA $0E C2/118D: 8D 6C 3A STA $3A6C (copy current frame counter to backup frame counter?) C2/1190: 7B TDC C2/1191: 28 PLP C2/1192: 6B RTL (Advance Wait Timer. this is what controls how long a character spends in his or her "ready stance" before executing a move.) C2/1193: C2 20 REP #$20 (16-bit accumulator) C2/1195: BD C8 3A LDA $3AC8,X (amount to increase ATB timer by??) C2/1198: 4A LSR (div by 2) C2/1199: 18 CLC C2/119A: 7D B4 3A ADC $3AB4,X C2/119D: 9D B4 3A STA $3AB4,X (add to Wait Timer) C2/11A0: E2 20 SEP #$20 (8-bit accumulator) C2/11A2: B0 06 BCS $11AA (if that timer overflowed, branch) C2/11A4: EB XBA (get top byte of the timer) C2/11A5: DD 2C 32 CMP $322C,X (compare to time to wait after inputting a command) C2/11A8: 90 10 BCC $11BA (if it's less, we're not ready yet) C2/11AA: A9 FF LDA #$FF C2/11AC: 9D 2C 32 STA $322C,X C2/11AF: 20 77 4E JSR $4E77 C2/11B2: A9 20 LDA #$20 C2/11B4: 1D A0 3A ORA $3AA0,X C2/11B7: 9D A0 3A STA $3AA0,X (set bit 5) C2/11BA: 60 RTS C2/11BB: C2 21 REP #$21 C2/11BD: BD 18 32 LDA $3218,X (current ATB timer count??) C2/11C0: 7D C8 3A ADC $3AC8,X (amount to increase timer by??) C2/11C3: 9D 18 32 STA $3218,X C2/11C6: E2 20 SEP #$20 C2/11C8: 90 F0 BCC $11BA (if timer didn't pass 0, exit) C2/11CA: E0 08 CPX #$08 C2/11CC: B0 03 BCS $11D1 (branch if a monster) C2/11CE: 20 E2 5B JSR $5BE2 C2/11D1: 9E 19 32 STZ $3219,X C2/11D4: 9E B5 3A STZ $3AB5,X C2/11D7: A9 FF LDA #$FF C2/11D9: 9D 2C 32 STA $322C,X C2/11DC: A9 08 LDA #$08 C2/11DE: 3C A0 3A BIT $3AA0,X C2/11E1: D0 07 BNE $11EA C2/11E3: 20 B4 11 JSR $11B4 C2/11E6: 89 02 BIT #$02 C2/11E8: F0 24 BEQ $120E C2/11EA: A9 80 LDA #$80 C2/11EC: 20 B4 11 JSR $11B4 C2/11EF: E0 08 CPX #$08 C2/11F1: B0 1B BCS $120E C2/11F3: BD 05 32 LDA $3205,X C2/11F6: 10 C2 BPL $11BA (Exit function) C2/11F8: A5 B1 LDA $B1 C2/11FA: 30 BE BMI $11BA (Exit function) C2/11FC: A9 04 LDA #$04 C2/11FE: 20 B4 11 JSR $11B4 C2/1201: BD 4D 3E LDA $3E4D,X C2/1204: 4A LSR C2/1205: 8A TXA C2/1206: 6A ROR C2/1207: 85 10 STA $10 C2/1209: A9 02 LDA #$02 C2/120B: 4C 11 64 JMP $6411 C2/120E: 4C 66 4E JMP $4E66 (Decrease Morph timer. If it's run out, zero related Morph variables, and queue the Revert command.) C2/1211: C2 20 REP #$20 (Set 16-bit Accumulator) C2/1213: 38 SEC C2/1214: AD 30 3F LDA $3F30 (Load the morph timer) C2/1217: ED 32 3F SBC $3F32 (Subtract morph decrement amount) C2/121A: 8D 30 3F STA $3F30 (Save the new morph timer) C2/121D: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/121F: B0 13 BCS $1234 (Branch if it's greater than zero) C2/1221: 9C 31 3F STZ $3F31 (zero top byte of Morph timer. i assume we're neglecting to zero $3F30 just to avoid adding a "REP" instruction.) C2/1224: 20 36 0B JSR $0B36 (adjust Morph supply [in this case, zero it] to match our new Morph timer) C2/1227: A9 FF LDA #$FF C2/1229: 8D E2 3E STA $3EE2 (Store #$FF to Morphed targets byte [no longer have a Morphed target]) C2/122C: A9 04 LDA #$04 C2/122E: 8D 7A 3A STA $3A7A (Store Revert as command) C2/1231: 20 B2 4E JSR $4EB2 (queue it?) C2/1234: AD 31 3F LDA $3F31 (Load the remaining amount of morph time DIV 256, if any) C2/1237: 9D 04 3B STA $3B04,X (Store it to the character's Morph gauge?) (Why do we bother zeroing all these timers and variables here when the forthcoming Revert can handle it? Presumably to avoid gauge screwiness and a bunch of pointless calls to this function should Terra's Morph timer run down in the middle of an attack animation..) C2/123A: 60 RTS True Knight and Love Token C2/123B: DA PHX C2/123C: 08 PHP C2/123D: A5 B2 LDA $B2 C2/123F: 89 02 00 BIT #$0002 (Is "No critical and Ignore True Knight" set?) C2/1242: D0 61 BNE $12A5 (Exit if so) C2/1244: A5 B8 LDA $B8 (intended target(s). to my knowledge, there's only one intended target set if we call this function..) C2/1246: F0 5D BEQ $12A5 (Exit if none) C2/1248: A0 FF LDY #$FF C2/124A: 84 F4 STY $F4 (default to no bodyguards.) C2/124C: 20 F9 51 JSR $51F9 (Y = index of our highest intended target. 0, 2, 4, or 6 for characters. 8, 10, 12, 14, 16, or 18 for monsters.) C2/124F: 84 F8 STY $F8 (save target index) C2/1251: 64 F2 STZ $F2 (Highest Bodyguard HP So Far = 0. this makes the first eligible bodyguard we check get accepted. later ones may replace him/her if they have more HP.) C2/1253: DA PHX C2/1254: BE 6C 33 LDX $336C,Y (Love Token - which target takes damage for you) C2/1257: 30 06 BMI $125F (Branch if none do) C2/1259: 20 C0 12 JSR $12C0 (consider this target as a bodyguard) C2/125C: 20 A8 12 JSR $12A8 (if it was valid, make it intercept the attack) C2/125F: FA PLX C2/1260: B9 E4 3E LDA $3EE4,Y C2/1263: 89 00 02 BIT #$0200 C2/1266: F0 3D BEQ $12A5 (Branch if target not Near Fatal) C2/1268: 89 10 00 BIT #$0010 C2/126B: D0 38 BNE $12A5 (Branch if Clear) C2/126D: B9 58 33 LDA $3358,Y C2/1270: 10 33 BPL $12A5 (Branch if target is seized) C2/1272: A9 0F 00 LDA #$000F (Load all characters as potential bodyguards) C2/1275: C0 08 CPY #$08 C2/1277: 90 03 BCC $127C (Branch if target is character) C2/1279: A9 00 3F LDA #$3F00 (Load all monsters as potential bodyguards instead) C2/127C: 85 F0 B9 STA $F0 (Save potential bodyguards) C2/127E: B9 18 30 LDA $3018,X C2/1281: 1D 18 30 ORA $3018,X (??) C2/1284: 14 F0 TRB $F0 (Clear attacker from potential bodyguards) C2/1286: A2 12 LDX #$12 C2/1288: BD 58 3C LDA $3C58,X C2/128B: 89 40 00 BIT #$0040 C2/128E: F0 0A BEQ $129A (Branch if no True Knight effect) C2/1290: BD 18 30 LDA $3018,X C2/1293: 24 F0 BIT $F0 C2/1295: F0 03 BEQ $129A (Branch if this candidate isn't on the same team as the target) C2/1297: 20 C0 12 JSR $12C0 (consider them as candidate bodyguard. if they're valid and their HP is >= past valid candidates, they become the new frontrunner.) C2/129A: CA DEX C2/129B: CA DEX C2/129C: 10 EA BPL $1288 (Do for all characters and monsters) C2/129E: A5 F2 LDA $F2 C2/12A0: F0 03 BEQ $12A5 (Exit if no bodyguard found [or if the selfless soul has 0 HP, which shouldn't be possible outside of bugs].) C2/12A2: 20 A8 12 JSR $12A8 (make chosen bodyguard -- provided there was one -- intercept attack. if somebody's already been slated to intercept it [i.e. due to Love Token], the True Knight will sensibly defer to them.) C2/12A5: 28 PLP C2/12A6: FA PLX C2/12A7: 60 RTS (Make chosen bodyguard intercept attack, provided one hasn't been marked to do so already.) C2/12A8: A6 F4 LDX $F4 C2/12AA: 30 13 BMI $12BF (exit if no bodyguard found) C2/12AC: C4 F8 CPY $F8 C2/12AE: D0 0F BNE $12BF (exit if $F8 no longer points to the original target, which means we've already assigned a bodyguard with this function.) C2/12B0: 86 F8 STX $F8 (save bodyguard's index) C2/12B2: 84 A8 STY $A8 (save intended target's index) C2/12B4: 46 A8 LSR $A8 (.. but for the latter, use 0,1,2,etc rather than 0,2,4,etc) C2/12B6: 08 PHP C2/12B7: C2 20 REP #$20 (set 16-bit A) C2/12B9: BD 18 30 LDA $3018,X C2/12BC: 85 B8 STA $B8 (save bodyguard as the new target of attack) C2/12BE: 28 PLP C2/12BF: 60 RTS (Consider candidate bodyguard) C2/12C0: 08 PHP C2/12C1: C2 20 REP #$20 (Set 16-bit Accumulator) C2/12C3: BD A0 3A LDA $3AA0,X C2/12C6: 4A LSR C2/12C7: 90 2A BCC $12F3 (Exit function) C2/12C9: BD B8 32 LDA $32B8,X (Which target you control) C2/12CC: 10 25 BPL $12F3 (Exit if control a target)? C2/12CE: BD 58 33 LDA $3358,X (Which target you have seized) C2/12D1: 10 20 BPL $12F3 (Exit if you have a target seized)? C2/12D3: BD E4 3E LDA $3EE4,X C2/12D6: 89 D2 A0 BIT #$A0D2 (Death, Petrify, Clear, Zombie, Sleep, Muddled) C2/12D9: D0 18 BNE $12F3 (Exit if any set) C2/12DB: BD F8 3E LDA $3EF8,X C2/12DE: 89 10 32 BIT #$3210 (Stop, Freeze, Spell, Hide) C2/12E1: D0 10 BNE $12F3 (Exit if any set) C2/12E3: BD 18 30 LDA $3018,X C2/12E6: 04 A6 TSB $A6 (make this potential guard jump in front of the target?) C2/12E8: BD F4 3B LDA $3BF4,X (HP of this potential bodyguard) C2/12EB: C5 F2 CMP $F2 C2/12ED: 90 04 BCC $12F3 (branch if it's not >= the highest HP of the other bodyguards considered so far for this attack.) C2/12EF: 85 F2 STA $F2 (if it is, save this entity's HP as the highest HP so far.) C2/12F1: 86 F4 STX $F4 (and this entity becomes the new bodyguard.) C2/12F3: 28 PLP C2/12F4: 60 RTS C2/12F5: DA PHX C2/12F6: 08 PHP C2/12F7: A2 02 LDX #$02 C2/12F9: AD A2 11 LDA $11A2 C2/12FC: 30 02 BMI $1300 (Branch if concerns MP) C2/12FE: A2 00 LDX #$00 C2/1300: FC 1F 13 JSR ($131F,X) (Deal damage) C2/1303: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/1305: 90 15 BCC $131C (Branch if target not dead from this damage) C2/1307: A3 02 LDA $02,S C2/1309: AA TAX C2/130A: 86 EE STX $EE C2/130C: 20 2F 36 JSR $362F C2/130F: C4 EE CPY $EE C2/1311: F0 09 BEQ $131C C2/1313: 99 7C 32 STA $327C,Y C2/1316: B9 18 30 LDA $3018,Y C2/1319: 1C 19 34 TRB $3419 C2/131C: 28 PLP C2/131D: FA PLX C2/131E: 60 RTS Code pointers C2/131F: 23 13 (HP damage) C2/1321: 50 13 (MP damage) Deal HP Damage/Healing C2/1323: 20 A7 13 JSR $13A7 C2/1326: F0 13 BEQ $133B (Exit function if 0 damage [damage = healing]) C2/1328: 90 13 BCC $133D (If Damage > Healing, deal HP damage) C2/132A: 18 CLC (Otherwise, deal HP healing) C2/132B: 79 F4 3B ADC $3BF4,Y (Add to HP) C2/132E: B0 05 BCS $1335 C2/1330: D9 1C 3C CMP $3C1C,Y C2/1333: 90 03 BCC $1338 C2/1335: B9 1C 3C LDA $3C1C,Y (If over Max HP set to Max HP) C2/1338: 99 F4 3B STA $3BF4,Y C2/133B: 18 CLC C2/133C: 60 RTS C2/133D: 49 FF FF EOR #$FFFF C2/1340: 85 EE STA $EE (65535 - [Healing - Damage]. This gives us the Net Damage minus 1, and that 1 is cancelled out by the SBC below, which is done with Carry clear.) C2/1342: B9 F4 3B LDA $3BF4,Y C2/1345: E5 EE SBC $EE (Subtract damage from HP) C2/1347: 99 F4 3B STA $3BF4,Y C2/134A: F0 44 BEQ $1390 (If 0 HP) C2/134C: B0 EE BCS $133C (Exit If > 0 HP) C2/134E: 80 40 BRA $1390 (If < 0 HP) Deal MP Damage/Healing C2/1350: 20 A7 13 JSR $13A7 C2/1353: F0 E6 BEQ $133B (Exit function if 0 damage [damage = healing]) C2/1355: 90 14 BCC $136B (If Damage > Healing, deal MP damage) C2/1357: 18 CLC (Otherwise, deal MP healing) C2/1358: 79 08 3C ADC $3C08,Y (Add A to MP) C2/135B: B0 05 BCS $1362 C2/135D: D9 30 3C CMP $3C30,Y C2/1360: 90 03 BCC $1365 C2/1362: B9 30 3C LDA $3C30,Y (If over Max MP set to Max MP) C2/1365: 99 08 3C STA $3C08,Y C2/1368: 18 CLC C2/1369: 80 1F BRA $138A C2/136B: 49 FF FF EOR #$FFFF C2/136E: 85 EE STA $EE (65535 - [Healing - Damage]. This gives us the Net Damage minus 1, and that 1 is cancelled out by the SBC below, which is done with Carry clear.) C2/1370: B9 08 3C LDA $3C08,Y C2/1373: E5 EE SBC $EE C2/1375: 99 08 3C STA $3C08,Y (Subtract from MP) C2/1378: F0 02 BEQ $137C (If MP = 0) C2/137A: B0 0E BCS $138A (If MP > 0) C2/137C: 7B TDC (If it's less than 0,) C2/137D: 99 08 3C STA $3C08,Y (Store 0 in MP) C2/1380: B9 95 3C LDA $3C95,Y C2/1383: 4A LSR C2/1384: 90 03 BCC $1389 (Branch If not die at 0 MP) C2/1386: 20 90 13 JSR $1390 (Call lethal damage function if dies at 0 MP) C2/1389: 38 SEC C2/138A: A9 80 00 LDA #$0080 C2/138D: 4C 4C 46 JMP $464C If character/monster takes lethal damage C2/1390: 38 SEC C2/1391: 7B TDC (Clear accumulator) C2/1392: AA TAX C2/1393: 8E 89 3A STX $3A89 (turn off random weapon spellcast) C2/1396: 99 F4 3B STA $3BF4,Y (Set HP to 0) C2/1399: B9 E4 3E LDA $3EE4,Y C2/139C: 89 02 00 BIT #$0002 C2/139F: D0 9B BNE $133C (Exit function if Zombie) C2/13A1: A9 80 00 LDA #$0080 C2/13A4: 4C 32 0E JMP $0E32 (Sets $3DD4 for death status) Returns Damage Healed - Damage Taken C2/13A7: B9 D0 33 LDA $33D0,Y (Damage Taken) C2/13AA: 1A INC C2/13AB: F0 0F BEQ $13BC (If no damage, branch and save damage as 0) C2/13AD: B9 18 30 LDA $3018,Y C2/13B0: 2C 3C 3A BIT $3A3C C2/13B3: F0 04 BEQ $13B9 (Branch if not invincible) C2/13B5: 7B TDC C2/13B6: 99 D0 33 STA $33D0,Y (Set damage to 0) C2/13B9: B9 D0 33 LDA $33D0,Y C2/13BC: 85 EE STA $EE C2/13BE: AD 81 3A LDA $3A81 C2/13C1: 2D 82 3A AND $3A82 C2/13C4: 30 02 BMI $13C8 (Branch if no Golem or dog block) C2/13C6: 64 EE STZ $EE (Set damage to 0) C2/13C8: B9 E4 33 LDA $33E4,Y (Damage Healed) C2/13CB: 1A INC C2/13CC: F0 01 BEQ $13CF (If no healing, branch and treat healing as 0) C2/13CE: 3A DEC (get healing amount again) C2/13CF: 38 SEC C2/13D0: E5 EE SBC $EE (Subtract damage) C2/13D2: 60 RTS Character/Monster Takes One Turn C2/13D3: DA PHX C2/13D4: 08 PHP C2/13D5: 20 39 26 JSR $2639 C2/13D8: A9 10 LDA #$10 C2/13DA: 04 B0 TSB $B0 C2/13DC: A9 06 LDA #$06 C2/13DE: 85 B4 STA $B4 C2/13E0: 64 BD STZ $BD C2/13E2: 9C 89 3A STZ $3A89 C2/13E5: 9C C9 3E STZ $3EC9 C2/13E8: 9C 8E 3A STZ $3A8E C2/13EB: 9B TXY C2/13EC: A9 FF LDA #$FF C2/13EE: 85 B2 STA $B2 C2/13F0: 85 B3 STA $B3 C2/13F2: A2 0F LDX #$0F C2/13F4: 9D 10 34 STA $3410,X C2/13F7: CA DEX C2/13F8: 10 FA BPL $13F4 C2/13FA: A5 B5 LDA $B5 (Load command) C2/13FC: 0A ASL C2/13FD: AA TAX C2/13FE: FC C7 19 JSR ($19C7,X) C2/1401: A9 FF LDA #$FF C2/1403: 8D 17 34 STA $3417 (indicate null Sketcher/Sketchee) C2/1406: 20 9B 62 JSR $629B (Copy $3A28-$3A2B variables into ($76) buffer) C2/1409: 20 9B 06 JSR $069B C2/140C: 20 5B 4C JSR $4C5B C2/140F: 20 29 14 JSR $1429 C2/1412: A9 04 LDA #$04 C2/1414: 20 11 64 JSR $6411 (Shows action?) C2/1417: 20 B9 4A JSR $4AB9 C2/141A: 20 7A 14 JSR $147A C2/141D: 20 3F 08 JSR $083F C2/1420: 20 4F 14 JSR $144F C2/1423: 20 C7 62 JSR $62C7 (Add Stolen or Metamorphed item to inventory. Also, add back an item used via Equipment Magic if the item isn't destroyed upon use [no equipment in the game works that way, but it's fully possible].) C2/1426: 28 PLP C2/1427: FA PLX C2/1428: 60 RTS C2/1429: A2 0A LDX #$0A C2/142B: BD 21 30 LDA $3021,X C2/142E: 2C 3A 3A BIT $3A3A C2/1431: F0 17 BEQ $144A C2/1433: EB XBA C2/1434: BD 01 3F LDA $3F01,X C2/1437: 89 20 BIT #$20 C2/1439: D0 0B BNE $1446 C2/143B: BD 54 3E LDA $3E54,X C2/143E: 30 06 BMI $1446 C2/1440: BD D5 32 LDA $32D5,X C2/1443: 1A INC C2/1444: D0 04 BNE $144A C2/1446: EB XBA C2/1447: 1C 2F 2F TRB $2F2F C2/144A: CA DEX C2/144B: CA DEX C2/144C: 10 DD BPL $142B C2/144E: 60 RTS C2/144F: 08 PHP C2/1450: C2 20 REP #$20 C2/1452: A2 12 LDX #$12 C2/1454: BD 18 30 LDA $3018,X C2/1457: 1C 4C 2F TRB $2F4C C2/145A: F0 18 BEQ $1474 C2/145C: E2 20 SEP #$20 C2/145E: EB XBA C2/145F: 1C 2F 2F TRB $2F2F C2/1462: A9 FE LDA #$FE C2/1464: 20 92 07 JSR $0792 C2/1467: BD F9 3E LDA $3EF9,X C2/146A: 09 20 ORA #$20 C2/146C: 9D F9 3E STA $3EF9,X (Set Hide status) C2/146F: 20 C8 07 JSR $07C8 C2/1472: C2 20 REP #$20 C2/1474: CA DEX C2/1475: CA DEX C2/1476: 10 DC BPL $1454 C2/1478: 28 PLP C2/1479: 60 RTS C2/147A: 08 PHP C2/147B: C2 20 REP #$20 (Set 16-bit Accumulator) C2/147D: A2 12 LDX #$12 C2/147F: BD 18 30 LDA $3018,X C2/1482: 1C 4E 2F TRB $2F4E C2/1485: F0 20 BEQ $14A7 C2/1487: E2 20 SEP #$20 C2/1489: EB XBA C2/148A: 0C 2F 2F TSB $2F2F (set enemy in bitfield of remaining enemies?) C2/148D: A9 01 LDA #$01 C2/148F: 20 B4 11 JSR $11B4 (set Bit 0 of $3AA0,X .. which indicates that enemy is present?) C2/1492: BD E4 3E LDA $3EE4,X C2/1495: 29 1D AND #$1D C2/1497: 9D E4 3E STA $3EE4,X (Clear Zombie, Imp, Petrify, Death) C2/149A: BD F9 3E LDA $3EF9,X C2/149D: 29 DF AND #$DF C2/149F: 9D F9 3E STA $3EF9,X (Clear Hide) C2/14A2: 20 A0 2D JSR $2DA0 C2/14A5: C2 20 REP #$20 C2/14A7: CA DEX C2/14A8: CA DEX C2/14A9: 10 D4 BPL $147F (Loop for all 10 targets) C2/14AB: 28 PLP C2/14AC: 60 RTS Check if hitting target(s) in back C2/14AD: AD A2 11 LDA $11A2 C2/14B0: 4A LSR C2/14B1: 90 5E BCC $1511 (Exit function if magical damage) C2/14B3: E0 08 CPX #$08 C2/14B5: B0 2E BCS $14E5 (Branch if monster attacker) C2/14B7: AD 1F 20 LDA $201F (get encounter type: 0 = front, 1 = back, 2 = pincer, 3 = side) C2/14BA: C9 03 CMP #$03 C2/14BC: D0 53 BNE $1511 (Exit function if not Side attack) C2/14BE: BD 18 30 LDA $3018,X (Holds $01 for character 1, $02 for character 2, $04 for character 3, $08 for character 4) C2/14C1: 2D 50 2F AND $2F50 (bitfield of which way all the characters face) C2/14C4: 85 EE STA $EE (will be default of 0 if character attacker faces left, nonzero if they face right) C2/14C6: A0 0A LDY #$0A C2/14C8: A5 EE LDA $EE C2/14CA: EB XBA (save attacking character's direction variable) C2/14CB: B9 21 30 LDA $3021,Y (Holds $01 for monster 1, $02 for monster 2, $04 for monster 3, etc. Note we'd normally access this as $3019; $3021 is an adjustment for the loop iterator.) C2/14CE: 2C 51 2F BIT $2F51 (bitfield of which way all the monsters face) C2/14D1: F0 05 BEQ $14D8 (branch if this monster faces left) C2/14D3: EB XBA C2/14D4: 5D 18 30 EOR $3018,X (A = reverse of attacking character's direction) C2/14D7: EB XBA C2/14D8: EB XBA C2/14D9: D0 04 BNE $14DF (branch if the character and monster are facing each other) C2/14DB: EB XBA (get $3021,Y) C2/14DC: 0C 55 3A TSB $3A55 (so we'll turn on this monster's bit if the attacking character is facing their back) C2/14DF: 88 DEY C2/14E0: 88 DEY C2/14E1: 10 E5 BPL $14C8 (loop for all 6 monsters) C2/14E3: 80 2C BRA $1511 (Exit Function) C2/14E5: AD 1F 20 LDA $201F (get encounter type: 0 = front, 1 = back, 2 = pincer, 3 = side) C2/14E8: C9 02 CMP #$02 C2/14EA: D0 25 BNE $1511 (exit function if not Pincer attack) C2/14EC: BD 19 30 LDA $3019,X (Holds $01 for monster 1, $02 for monster 2, $04 for monster 3, etc.) C2/14EF: 2D 51 2F AND $2F51 (bitfield of which way all the monsters face) C2/14F2: 85 EE STA $EE (will be 0 if monster attacker faces left, nonzero default if they face right) C2/14F4: A0 06 LDY #$06 C2/14F6: A5 EE LDA $EE C2/14F8: EB XBA (save attacking monster's direction variable) C2/14F9: B9 18 30 LDA $3018,Y (Holds $01 for character 1, $02 for character 2, $04 for character 3, $08 for character 4) C2/14FC: 2C 50 2F BIT $2F50 (bitfield of which way all the characters face) C2/14FF: F0 05 BEQ $1506 (branch if this character faces left) C2/1501: EB XBA C2/1502: 5D 19 30 EOR $3019,X (A = reverse of attacking monster's direction) C2/1505: EB XBA C2/1506: EB XBA C2/1507: D0 04 BNE $150D (branch if the monster and character are facing each other) C2/1509: EB XBA (get $3018,Y) C2/150A: 0C 54 3A TSB $3A54 (so we'll turn on this character's bit if the attacking monster is facing their back) C2/150D: 88 DEY C2/150E: 88 DEY C2/150F: 10 E5 BPL $14F6 (loop for all 4 characters) C2/1511: 60 RTS Set $BD to 2 if A is between $1D and $24 (inclusive) Increment damage if weapon is spear C2/1512: C9 1D CMP #$1D C2/1514: 90 08 BCC $151E (Exit) C2/1516: C9 25 CMP #$25 C2/1518: B0 04 BCS $151E (Exit) C2/151A: A9 02 LDA #$02 C2/151C: 85 BD STA $BD C2/151E: 60 RTS Sketch C2/151F: BB TYX C2/1520: 20 8A 29 JSR $298A (Clear special effect, magic power, etc.) C2/1523: A9 FF LDA #$FF C2/1525: 85 B7 STA $B7 C2/1527: A9 AA LDA #$AA C2/1529: 8D A9 11 STA $11A9 (Store sketch in special effect) C2/152C: 20 7B 31 JSR $317B C2/152F: AC 17 34 LDY $3417 (get the Sketchee) C2/1532: 30 EA BMI $151E (Exit if it's null) C2/1534: 8E 17 34 STX $3417 (save the attacker as the SketcheR) C2/1537: B9 81 3C LDA $3C81,Y (get target [enemy] Special attack graphic) C2/153A: 9D 81 3C STA $3C81,X (copy to attacker) C2/153D: B9 2D 32 LDA $322D,Y (get target Special attack) C2/1540: 9D 2D 32 STA $322D,X (copy to attacker) C2/1543: 9C 15 34 STZ $3415 C2/1546: AD 00 34 LDA $3400 C2/1549: 85 B6 STA $B6 (copy "spell # of second attack" into normal spell variable) C2/154B: A9 FF LDA #$FF C2/154D: 8D 00 34 STA $3400 (clear "spell # of second attack") C2/1550: A9 01 LDA #$01 C2/1552: 04 B2 TSB $B2 C2/1554: A5 B6 LDA $B6 C2/1556: 20 BF 1D JSR $1DBF (choose a command based on spell #) C2/1559: 85 B5 STA $B5 C2/155B: 0A ASL C2/155C: AA TAX C2/155D: 7C C7 19 JMP ($19C7,X) Rage C2/1560: B9 A8 33 LDA $33A8,Y (get monster #) C2/1563: 1A INC C2/1564: D0 13 BNE $1579 (branch if it's already defined) C2/1566: AE 93 3A LDX $3A93 (if it's undefined [like with Mimic], get the index of another Rager, so we can copy their monster #) C2/1569: E0 14 CPX #$14 C2/156B: 90 02 BCC $156F (if the Rager index corresponds to a character [0, 2, 4, 6] or an enemy [8, 10, 12, 14, 16, 18], consider it valid and branch.) C2/156D: A2 00 LDX #$00 (if not, default to looking at character #1) C2/156F: BD A8 33 LDA $33A8,X (get that other Rager's monster) C2/1572: 99 A8 33 STA $33A8,Y (save it as our current Rager's monster) C2/1575: 7B TDC C2/1576: 99 A9 33 STA $33A9,Y C2/1579: 8C 93 3A STY $3A93 (save the index of our current Rager) C2/157C: B9 F9 3E LDA $3EF9,Y C2/157F: 09 01 ORA #$01 C2/1581: 99 F9 3E STA $3EF9,Y (Set Rage status) C2/1584: 20 10 06 JSR $0610 (Load monster Battle and Special graphics, its special attack, elemental properties, status immunities, startup statuses [to be set later], and special properties) C2/1587: BB TYX C2/1588: 20 50 26 JSR $2650 (deal with Instant Death protection, and Poison elemental nullification giving immunity to Poison status) C2/158B: 20 54 15 JSR $1554 (Commands code. note that the attack's "Update Status" function will also be used to give the monster's statuses to the Rager.) C2/158E: 4C 75 26 JMP $2675 (make some monster statuses permanent by setting immunity to them. also handle immunity to "mutually exclusive" statuses.) Steal C2/1591: BB TYX C2/1592: 20 8A 29 JSR $298A (Clear special effect, magic power, etc.) C2/1595: A9 A4 LDA #$A4 C2/1597: 8D A9 11 STA $11A9 (Store steal in special effect) C2/159A: 4C 7B 31 JMP $317B Blitz C2/159D: A5 B6 LDA $B6 C2/159F: 10 0F BPL $15B0 (branch if the spell # indicates a Blitz) C2/15A1: A9 01 LDA #$01 C2/15A3: 14 B3 TRB $B3 (this will clear targets for a failed Blitz input) C2/15A5: A9 43 LDA #$43 C2/15A7: 8D 01 34 STA $3401 (Set to display Text $43 - "Incorrect Blitz input!") C2/15AA: A9 5D LDA #$5D C2/15AC: 85 B6 STA $B6 (store Pummel's spell number) C2/15AE: 80 05 BRA $15B5 C2/15B0: A9 08 LDA #$08 C2/15B2: 8D 12 34 STA $3412 (will display a Blitz name atop screen) C2/15B5: A5 B6 LDA $B6 C2/15B7: 48 PHA C2/15B8: 38 SEC C2/15B9: E9 5D SBC #$5D (subtract Pummel's spell index from our spell #) C2/15BB: 85 B6 STA $B6 (save our 0 thru 7 "Blitz index", likely used for animation) C2/15BD: 68 PLA (but use our original spell # for loading spell data) C2/15BE: BB TYX C2/15BF: 20 C1 19 JSR $19C1 C2/15C2: 20 51 29 JSR $2951 C2/15C5: 4C 7B 31 JMP $317B Desperation attack C2/15C8: C0 08 CPY #$08 C2/15CA: B0 44 BCS $1610 (No DA if monster) C2/15CC: AD 3F 3A LDA $3A3F C2/15CF: C9 03 CMP #$03 C2/15D1: 90 3D BCC $1610 (No DA if time counter is 767 or less) C2/15D3: B9 E5 3E LDA $3EE5,Y C2/15D6: 89 02 BIT #$02 C2/15D8: F0 36 BEQ $1610 (No DA If not Near Fatal) C2/15DA: 89 24 BIT #$24 C2/15DC: D0 32 BNE $1610 (No DA If Muddled or Image) C2/15DE: B9 E4 3E LDA $3EE4,Y C2/15E1: 89 12 BIT #$12 C2/15E3: D0 2B BNE $1610 (No DA If Clear or Zombie) C2/15E5: A5 B9 LDA $B9 C2/15E7: F0 27 BEQ $1610 (No DA if $B9 = 0) C2/15E9: 20 5A 4B JSR $4B5A (Random number 0 to 255) C2/15EC: 29 0F AND #$0F (0 to 15) C2/15EE: D0 20 BNE $1610 (1 in 16 chance for DA) C2/15F0: B9 18 30 LDA $3018,Y C2/15F3: 0C 2F 3F TSB $3F2F C2/15F6: D0 18 BNE $1610 (No DA if this character already used it this combat) C2/15F8: B9 D8 3E LDA $3ED8,Y (Which character it is) C2/15FB: C9 0C CMP #$0C C2/15FD: F0 05 BEQ $1604 (branch if Gogo) C2/15FF: C9 0B CMP #$0B C2/1601: B0 0D BCS $1610 (branch if Character 11 or above: Gau, Umaro, or special character. none of these characters have DAs) C2/1603: 1A INC C2/1604: 3A DEC (if it was Gogo, we decrement the DA by 1 to account for Gau -- who's before Gogo -- not having one) C2/1605: 09 F0 ORA #$F0 C2/1607: 85 B6 STA $B6 (add F0h to modified character #, then save as attack #) C2/1609: A9 10 LDA #$10 C2/160B: 14 B0 TRB $B0 C2/160D: 4C 14 17 JMP $1714 C2/1610: C0 08 CPY #$08 C2/1612: B0 07 BCS $161B (If monster) C2/1614: B9 D8 3E LDA $3ED8,Y (Which character it is) C2/1617: C9 0D CMP #$0D C2/1619: F0 20 BEQ $163B C2/161B: BB TYX C2/161C: BD 58 3C LDA $3C58,X C2/161F: 4A LSR C2/1620: A9 01 LDA #$01 C2/1622: 90 02 BCC $1626 (branch if no offering) C2/1624: A9 07 LDA #$07 C2/1626: 8D 70 3A STA $3A70 (# of attacks) C2/1629: 20 4D 5A JSR $5A4D (Remove dead and hidden targets) C2/162C: 20 65 38 JSR $3865 C2/162F: A9 02 LDA #$02 C2/1631: 14 B2 TRB $B2 (clear no critical & ignore true knight) C2/1633: A5 B5 LDA $B5 C2/1635: 8D 13 34 STA $3413 C2/1638: 4C 7B 31 JMP $317B Determine which type of attack Umaro uses C2/163B: 64 FE STZ $FE (start off allowing neither Storm nor Throw attack) C2/163D: A9 C6 LDA #$C6 C2/163F: D9 D0 3C CMP $3CD0,Y C2/1642: F0 05 BEQ $1649 (Branch if Rage Ring equipped in relic slot 1) C2/1644: D9 D1 3C CMP $3CD1,Y (Check Slot 2) C2/1647: D0 0D BNE $1656 (Branch if Rage Ring not equipped) C2/1649: 7B TDC C2/164A: B9 18 30 LDA $3018,Y C2/164D: 4D 74 3A EOR $3A74 C2/1650: F0 04 BEQ $1656 (Branch if Umaro is the only character alive) C2/1652: A9 04 LDA #$04 C2/1654: 04 FE TSB $FE (allow for Throw character attack) C2/1656: A9 C5 LDA #$C5 C2/1658: D9 D0 3C CMP $3CD0,Y C2/165B: F0 05 BEQ $1662 (Branch if Blizzard Orb equipped in relic slot 1) C2/165D: D9 D1 3C CMP $3CD1,Y (Check Slot 2) C2/1660: D0 04 BNE $1666 (Branch if Blizzard Orb not equipped) C2/1662: A9 08 LDA #$08 C2/1664: 04 FE TSB $FE (allow for Storm attack) C2/1666: A5 FE LDA $FE C2/1668: AA TAX (form a pointer based on availability of Storm and/or Throw. it will pick 1 of Umaro's 4 probability sets, each of which holds the chances for his 4 attacks) C2/1669: 09 30 ORA #$30 (always allow Normal attack and Charge) C2/166B: 0A ASL C2/166C: 0A ASL C2/166D: 20 47 52 JSR $5247 (Pick attack type to use. Will return 0 for Throw character, 1 for Storm, 2 for Charge, 3 for Normal attack) C2/1670: 8A TXA C2/1671: 0A ASL C2/1672: AA TAX C2/1673: 7C 76 16 JMP ($1676,X) Code pointers C2/1676: 92 16 (Throw character) C2/1678: 0D 17 (Storm) C2/167A: 7E 16 (Charge) C2/167C: 1B 16 (Normal attack) Umaro's Charge attack C2/167E: BB TYX C2/167F: 20 C7 17 JSR $17C7 (attack Battle Power = sum of battle power of Umaro's hands. initialize various other stuff) C2/1682: A9 20 LDA #$20 C2/1684: 0C A2 11 TSB $11A2 (Set ignore defense) C2/1687: A9 02 LDA #$02 C2/1689: 14 B2 TRB $B2 (Clear no critical and ignore True Knight) C2/168B: A9 23 LDA #$23 C2/168D: 85 B5 STA $B5 (Set command to #$23) C2/168F: 4C 7B 31 JMP $317B Umaro's Throw character attack C2/1692: BB TYX C2/1693: 20 C7 17 JSR $17C7 (attack Battle Power = sum of battle power of Umaro's hands. initialize various other stuff) C2/1696: BD 18 30 LDA $3018,X C2/1699: 4D 74 3A EOR $3A74 (Remove Umaro from possible characters to throw) C2/169C: A2 06 LDX #$06 (Start pointing at 4th character slot) C2/169E: 3C 18 30 BIT $3018,X (Check each character) C2/16A1: F0 1C BEQ $16BF (Branch to check next character if this one is not present, or if we've already decided on a character due to them having Muddled or Sleep.) C2/16A3: EB XBA C2/16A4: BD F9 3E LDA $3EF9,X C2/16A7: 89 20 BIT #$20 C2/16A9: F0 07 BEQ $16B2 (Branch if not Hide) C2/16AB: EB XBA C2/16AC: 5D 18 30 EOR $3018,X (Remove this character from list of characters to throw) C2/16AF: EB XBA C2/16B0: 80 0C BRA $16BE (Check next character) C2/16B2: BD E5 3E LDA $3EE5,X C2/16B5: 89 A0 BIT #$A0 C2/16B7: F0 05 BEQ $16BE (Branch if no Muddled or Sleep) C2/16B9: EB XBA C2/16BA: BD 18 30 LDA $3018,X (Set to automatically throw this character) C2/16BD: EB XBA C2/16BE: EB XBA C2/16BF: CA DEX C2/16C0: CA DEX C2/16C1: 10 DB BPL $169E (loop for all 4 characters) C2/16C3: 48 PHA C2/16C4: 7B TDC C2/16C5: 68 PLA (clear top half of A) C2/16C6: F0 B6 BEQ $167E (Do Umaro's charge attack if no characters can be thrown) C2/16C8: 20 2A 52 JSR $522A (Pick a random character to throw) C2/16CB: 20 F9 51 JSR $51F9 (Set Y to character thrown) C2/16CE: BB TYX (put throwee in X, so they'll essentially be treated as the "attacker" from here on out) C2/16CF: BD D8 3E LDA $3ED8,X (Which character is thrown) C2/16D2: C9 0A CMP #$0A C2/16D4: D0 04 BNE $16DA (Branch if not Mog) C2/16D6: A9 02 LDA #$02 C2/16D8: 14 B3 TRB $B3 (Set always critical.. too bad we don't clear "Ignore damage increment on Ignore Defense", meaning this does nothing. :'( similarly, the normal 1-in-32 critical will be for nought. i'm not sure what stops the game from flashing the screen, though..) C2/16DA: BD 68 3B LDA $3B68,X C2/16DD: 7D 69 3B ADC $3B69,X (add Battle power of thrown character's left hand to their right hand) C2/16E0: 90 02 BCC $16E4 C2/16E2: A9 FE LDA #$FE (if that overflowed, treat throwee's overall Battle Power as 255 [Carry is set]) C2/16E4: 6D A6 11 ADC $11A6 (Add to battle power of attack) C2/16E7: 90 02 BCC $16EB C2/16E9: A9 FF LDA #$FF (if that overflowed, set overall Battle Power to 255) C2/16EB: 8D A6 11 STA $11A6 (Store in new battle power for attack) C2/16EE: A9 24 LDA #$24 C2/16F0: 85 B5 STA $B5 (Set command to #$24) C2/16F2: A9 20 LDA #$20 C2/16F4: 0C A2 11 TSB $11A2 (Set ignore defense) C2/16F7: A9 02 LDA #$02 C2/16F9: 14 B2 TRB $B2 (Clear no critical and ignore True Knight) C2/16FB: A9 01 LDA #$01 C2/16FD: 04 BA TSB $BA (Exclude Attacker [i.e. the throwee] from Targets) C2/16FF: BD E5 3E LDA $3EE5,X C2/1702: 29 A0 AND #$A0 C2/1704: 1D FD 3D ORA $3DFD,X C2/1707: 9D FD 3D STA $3DFD,X (Set to clear Sleep and Muddled on thrown character, provided the character already possesses them) C2/170A: 4C 7B 31 JMP $317B Storm C2/170D: 9C 15 34 STZ $3415 (will force to randomly retarget) C2/1710: A9 54 LDA #$54 (Storm) C2/1712: 85 B6 STA $B6 (Set spell/animation) C2/1714: A9 02 LDA #$02 (Magic) C2/1716: 85 B5 STA $B5 (Set command) C2/1718: 80 45 BRA $175F Shock C2/171A: A9 82 LDA #$82 C2/171C: 80 02 BRA $1720 Health C2/171E: A9 2E LDA #$2E C2/1720: 85 B6 STA $B6 C2/1722: A9 05 LDA #$05 C2/1724: 80 3F BRA $1765 Slot C2/1726: A9 10 LDA #$10 C2/1728: 14 B0 TRB $B0 C2/172A: A5 B6 LDA $B6 C2/172C: C9 94 CMP #$94 C2/172E: D0 04 BNE $1734 (branch if not L.5 Doom [i.e. one of the Joker Dooms]) C2/1730: A9 07 LDA #$07 C2/1732: 80 31 BRA $1765 C2/1734: C9 51 CMP #$51 C2/1736: 90 2B BCC $1763 (branch if spell # is below Fire Skean. iow, branch if Slot's summoning an Esper.) C2/1738: C9 FE CMP #$FE C2/173A: D0 05 BNE $1741 (Branch if not Lagomorph) C2/173C: A9 07 LDA #$07 C2/173E: 8D 01 34 STA $3401 (Set to display text 7) C2/1741: C0 08 CPY #$08 C2/1743: B0 1A BCS $175F (Branch if attacker is monster) C2/1745: B9 D8 3E LDA $3ED8,Y C2/1748: C9 00 CMP #$00 C2/174A: D0 13 BNE $175F (Branch if not Terra) C2/174C: A9 02 LDA #$02 C2/174E: 1C BC 3E TRB $3EBC (Clear bit for that classic Terra/Locke/Edgar "M..M..Magic" skit, as it only happens once.) (Keep in mind the game will also clear this when exiting Figaro Cave to the South Figaro plains.) C2/1751: F0 0C BEQ $175F (If it wasn't set, skip the special spellcast and the ensuing convo) C2/1753: A2 06 LDX #$06 (Attack) C2/1755: A9 23 LDA #$23 (Command) C2/1757: 20 91 4E JSR $4E91 C2/175A: A9 20 LDA #$20 C2/175C: 0C A4 11 TSB $11A4 (Set can't be dodged) C2/175F: A9 00 LDA #$00 (Lore / Enemy attack / Magitek commands jump here) C2/1761: 80 02 BRA $1765 C2/1763: A9 02 LDA #$02 C2/1765: 8D 12 34 STA $3412 C2/1768: BB TYX C2/1769: A5 B6 LDA $B6 C2/176B: 20 C1 19 JSR $19C1 C2/176E: 20 51 29 JSR $2951 C2/1771: A5 B5 LDA $B5 C2/1773: C9 0F CMP #$0F C2/1775: D0 03 BNE $177A C2/1777: 9C A5 11 STZ $11A5 (Set MP cost to 0) C2/177A: 4C 7B 31 JMP $317B Dance C2/177D: B9 F8 3E LDA $3EF8,Y C2/1780: 09 01 ORA #$01 C2/1782: 99 F8 3E STA $3EF8,Y (Set Dance status) C2/1785: A9 FF LDA #$FF C2/1787: 85 B7 STA $B7 C2/1789: B9 E1 32 LDA $32E1,Y (Which dance is selected) C2/178C: 10 06 BPL $1794 C2/178E: AD 6F 3A LDA $3A6F C2/1791: 99 E1 32 STA $32E1,Y C2/1794: AE E2 11 LDX $11E2 C2/1797: DF 5B 8E ED CMP $ED8E5B,X (Check if background is same as dance) C2/179B: F0 A4 BEQ $1741 (Branch if it is) C2/179D: 20 53 4B JSR $4B53 C2/17A0: 90 0D BCC $17AF (50% chance of branch) C2/17A2: AA TAX C2/17A3: BF AB F9 D1 LDA $D1F9AB,X C2/17A7: 85 B7 STA $B7 C2/17A9: 8D E2 11 STA $11E2 (Change background to dance background) C2/17AC: 4C 41 17 JMP $1741 Stumble when trying to dance C2/17AF: B9 F8 3E LDA $3EF8,Y C2/17B2: 29 FE AND #$FE C2/17B4: 99 F8 3E STA $3EF8,Y (Clear Dance) C2/17B7: BB TYX C2/17B8: A9 06 LDA #$06 C2/17BA: 8D 01 34 STA $3401 (Set to display stumble message) C2/17BD: A9 20 LDA #$20 C2/17BF: 85 B5 STA $B5 C2/17C1: 20 8D 29 JSR $298D C2/17C4: 4C 67 31 JMP $3167 C2/17C7: 20 8A 29 JSR $298A (Clear special effect, magic power, etc.) C2/17CA: 18 CLC C2/17CB: BD 68 3B LDA $3B68,X (Battle Power for 1st hand) C2/17CE: 7D 69 3B ADC $3B69,X (add Battle Power for 2nd hand) C2/17D1: 90 02 BCC $17D5 C2/17D3: A9 FF LDA #$FF (if sum overflowed, treated combined Battle Power as 255) C2/17D5: 8D A6 11 STA $11A6 (Battle Power or Spell Power) C2/17D8: BD 18 3B LDA $3B18,X (Level) C2/17DB: 8D AF 11 STA $11AF (Level) C2/17DE: BD 2C 3B LDA $3B2C,X C2/17E1: 8D AE 11 STA $11AE (Vigor * 2 or Magic Power) C2/17E4: 60 RTS Possess C2/17E5: BB TYX C2/17E6: 20 C1 19 JSR $19C1 C2/17E9: A9 20 LDA #$20 C2/17EB: 0C A4 11 TSB $11A4 (Set can't be dodged) C2/17EE: A9 A0 LDA #$A0 C2/17F0: 8D A9 11 STA $11A9 (Stores Possess in special effect) C2/17F3: 4C 7B 31 JMP $317B Jump C2/17F6: BB TYX C2/17F7: 20 C1 19 JSR $19C1 (load command data) C2/17FA: BD 69 3B LDA $3B69,X (Battle Power - left hand) C2/17FD: F0 09 BEQ $1808 (if no battle power, call subfunction with carry unset to indicate right hand) C2/17FF: 38 SEC (set carry to indicate left hand) C2/1800: BD 68 3B LDA $3B68,X (Battle Power - right hand) C2/1803: F0 03 BEQ $1808 (if no bat pwr, call subfunction with carry set) C2/1805: 20 53 4B JSR $4B53 (0 or 1 RNG - if both hands have weapon, carry flag will select hand used) C2/1808: 20 9F 29 JSR $299F (Load weapon data into attack data. Plus Sniper Sight, Offering and more) C2/180B: A9 20 LDA #$20 C2/180D: 8D A4 11 STA $11A4 (Set can't be dodged only) C2/1810: 04 B3 TSB $B3 (Set ignore attacker row) C2/1812: E6 BD INC $BD (Increment damage. since $BD is zeroed right before this in function C2/13D3, it should be 1 now.) C2/1814: BD A8 3C LDA $3CA8,X (Weapon in right hand) C2/1817: 20 12 15 JSR $1512 (Set $BD to 2 if spear) C2/181A: BD A9 3C LDA $3CA9,X (Weapon in left hand) C2/181D: 20 12 15 JSR $1512 (Set $BD to 2 if spear) C2/1820: BD 44 3C LDA $3C44,X C2/1823: 10 17 BPL $183C (Branch if not jump continously [Dragon Horn]) C2/1825: CE 8E 3A DEC $3A8E (make a variable FFh to indicate the attack is a continuous jump) C2/1828: 20 5A 4B JSR $4B5A (0 to 255) C2/182B: EE 70 3A INC $3A70 (Add 1 attack) C2/182E: C9 40 CMP #$40 C2/1830: B0 0A BCS $183C (75% chance branch) C2/1832: EE 70 3A INC $3A70 (Add 1 attack) C2/1835: C9 10 CMP #$10 C2/1837: B0 03 BCS $183C (25% chance branch - so there's a 1/16 overall chance of 4 attacks) C2/1839: EE 70 3A INC $3A70 (Add 1 attack) C2/183C: BD F9 3E LDA $3EF9,X C2/183F: 29 DF AND #$DF C2/1841: 9D F9 3E STA $3EF9,X (Clear Hide status) C2/1844: 4C 7B 31 JMP $317B Swdtech C2/1847: BB TYX C2/1848: A5 B6 LDA $B6 (Battle animation) C2/184A: 48 PHA C2/184B: 38 SEC C2/184C: E9 55 SBC #$55 C2/184E: 85 B6 STA $B6 (save unique index of SwdTech. 0 = Dispatch, 1 = Retort, etc.) C2/1850: 68 PLA C2/1851: 20 C1 19 JSR $19C1 C2/1854: 20 51 29 JSR $2951 C2/1857: A5 B6 LDA $B6 C2/1859: C9 01 CMP #$01 C2/185B: D0 20 BNE $187D (branch if not Retort) C2/185D: BD 4C 3E LDA $3E4C,X C2/1860: 49 01 EOR #$01 C2/1862: 9D 4C 3E STA $3E4C,X (Toggle Retort condition) C2/1865: 4A LSR C2/1866: 90 11 BCC $1879 (branch if we're doing the actual retaliation as supposed to the preparation) C2/1868: 66 B6 ROR $B6 ($B6 is now 80h) C2/186A: 9C A6 11 STZ $11A6 (Sets power to 0) C2/186D: A9 20 LDA #$20 C2/186F: 0C A4 11 TSB $11A4 (Set can't be dodged) C2/1872: A9 01 LDA #$01 C2/1874: 1C A2 11 TRB $11A2 (Sets to magical damage) C2/1877: 80 09 BRA $1882 C2/1879: A9 10 LDA #$10 C2/187B: 14 B0 TRB $B0 C2/187D: A9 04 LDA #$04 C2/187F: 8D 12 34 STA $3412 C2/1882: 4C 7B 31 JMP $317B Tools C2/1885: A5 B6 LDA $B6 C2/1887: E9 A2 SBC #$A2 (carry was clear, so subtract 163) C2/1889: 85 B6 STA $B6 (save unique Tool index. 0 = NoiseBlaster, 1 = Bio Blaster, etc.) C2/188B: 80 11 BRA $189E Throw C2/188D: A9 02 LDA #$02 C2/188F: 85 BD STA $BD (Increment damage by 100%) C2/1891: A9 10 LDA #$10 C2/1893: 14 B3 TRB $B3 (Clear ignore increment on ignore defense) C2/1895: 80 07 BRA $189E Item C2/1897: 9C 14 34 STZ $3414 (Set ignore damage modification) C2/189A: A9 80 LDA #$80 C2/189C: 14 B3 TRB $B3 (Set Ignore Clear) C2/189E: BB TYX C2/189F: A9 01 LDA #$01 C2/18A1: 8D 12 34 STA $3412 C2/18A4: AD 7D 3A LDA $3A7D C2/18A7: 20 C1 19 JSR $19C1 C2/18AA: A9 10 LDA #$10 C2/18AC: 14 B1 TRB $B1 (clear "don't deplete from Item inventory" flag) C2/18AE: D0 05 BNE $18B5 (branch if it was set) C2/18B0: A9 FF LDA #$FF C2/18B2: 9D F4 32 STA $32F4,X (null item index to add to inventory. this means the item will stay deducted from your inventory.) C2/18B5: BD 18 30 LDA $3018,X C2/18B8: 0C 8C 3A TSB $3A8C C2/18BB: A5 B5 LDA $B5 (Command #) C2/18BD: 90 24 BCC $18E3 (Carry is set (by the $19C1 call) for: - Skeans/Tools that don't use a spell - normal Item usage which means it isn't set for: - Equipment Magic or Skeans/Tools that do use a spell ) C2/18BF: C9 02 CMP #$02 (Carry will be set if Command >=2, which means it'll be set for Throw and Tools, but not plain Item -- or apparently Item Magic, which also uses Command 1) C2/18C1: AD 11 34 LDA $3411 C2/18C4: 20 37 2A JSR $2A37 C2/18C7: AD AA 11 LDA $11AA C2/18CA: 89 C2 BIT #$C2 (Check if Dead, Petrify or Zombie attack) C2/18CC: D0 12 BNE $18E0 (if so, branch) C2/18CE: C2 20 REP #$20 (Set 16-bit Accumulator) C2/18D0: AD 74 3A LDA $3A74 C2/18D3: 0D 42 3A ORA $3A42 C2/18D6: 25 B8 AND $B8 C2/18D8: 85 B8 STA $B8 C2/18DA: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/18DC: A9 04 LDA #$04 C2/18DE: 14 B3 TRB $B3 C2/18E0: 4C 7B 31 JMP $317B C2/18E3: C9 01 CMP #$01 (is command Item?) C2/18E5: D0 07 BNE $18EE C2/18E7: E6 B5 INC $B5 (if so, bump it up to Magic, as we've reached this point thanks to Equipment Magic) C2/18E9: AD 10 34 LDA $3410 C2/18EC: 85 B6 STA $B6 C2/18EE: 64 BD STZ $BD C2/18F0: 20 51 29 JSR $2951 C2/18F3: A9 02 LDA #$02 C2/18F5: 0C A3 11 TSB $11A3 (Set Not reflectable) C2/18F8: A9 20 LDA #$20 C2/18FA: 0C A4 11 TSB $11A4 (Set unblockable) C2/18FD: A9 08 LDA #$08 C2/18FF: 14 BA TRB $BA (Clear "can target dead/hidden targets") C2/1901: 9C A5 11 STZ $11A5 (Set MP cost to 0) C2/1904: 4C 7B 31 JMP $317B GP Rain C2/1907: BB TYX C2/1908: 20 8A 29 JSR $298A (Clear special effect, magic power, etc.) C2/190B: EE A6 11 INC $11A6 (Set spell power to 1) C2/190E: A9 60 LDA #$60 C2/1910: 0C A2 11 TSB $11A2 (Set ignore defense, no split damage) C2/1913: 9C 14 34 STZ $3414 (Skip damage modification) C2/1916: E0 08 CPX #$08 C2/1918: 90 05 BCC $191F C2/191A: A9 05 LDA #$05 C2/191C: 8D 12 34 STA $3412 C2/191F: A9 A2 LDA #$A2 C2/1921: 8D A9 11 STA $11A9 (Store GP Rain in special effect) C2/1924: 4C 7B 31 JMP $317B (Revert) C2/1927: B9 F9 3E LDA $3EF9,Y C2/192A: 89 08 BIT #$08 C2/192C: D0 09 BNE $1937 (Branch if Morphed) C2/192E: 98 TYA C2/192F: 4A LSR C2/1930: EB XBA C2/1931: A9 0E LDA #$0E C2/1933: 4C BF 62 JMP $62BF (Morph) C2/1936: 38 SEC C2/1937: 08 PHP C2/1938: BB TYX C2/1939: 20 8A 29 JSR $298A (Clear special effect, magic power, etc.) C2/193C: 28 PLP C2/193D: A9 08 LDA #$08 C2/193F: 8D AD 11 STA $11AD (mark attack to affect Morph status) C2/1942: 90 01 BCC $1945 C2/1944: 7B TDC C2/1945: 4A LSR C2/1946: 0C A4 11 TSB $11A4 (if Carry was clear, turn on Lift Status property. otherwise, the attack will just default to setting the status.) C2/1949: 4C 67 31 JMP $3167 Row C2/194C: BB TYX C2/194D: BD A1 3A LDA $3AA1,X C2/1950: 49 20 EOR #$20 C2/1952: 9D A1 3A STA $3AA1,X (Toggle Row) C2/1955: 20 8A 29 JSR $298A (Clear special effect, magic power, etc.) C2/1958: 4C 67 31 JMP $3167 (Set attacker as target. Also set some other properties before continuing with Combat Action Function.) Runic C2/195B: BB TYX C2/195C: BD 4C 3E LDA $3E4C,X C2/195F: 09 04 ORA #$04 C2/1961: 9D 4C 3E STA $3E4C,X (Set runic) C2/1964: 20 8A 29 JSR $298A (Clear special effect, magic power, etc.) C2/1967: 4C 67 31 JMP $3167 C2/196A: BB TYX C2/196B: A9 02 LDA #$02 C2/196D: 20 AB 5B JSR $5BAB C2/1970: 20 8A 29 JSR $298A (Clear special effect, magic power, etc.) C2/1973: 4C 67 31 JMP $3167 Control C2/1976: B9 F9 3E LDA $3EF9,Y C2/1979: 89 10 BIT #$10 C2/197B: F0 0A BEQ $1987 (If no spell status) C2/197D: 20 2E 19 JSR $192E C2/1980: B9 B8 32 LDA $32B8,Y C2/1983: A8 TAY C2/1984: 4C 54 15 JMP $1554 (Commands code) C2/1987: BB TYX C2/1988: 20 8A 29 JSR $298A (Clear special effect, magic power, etc.) C2/198B: A9 A6 LDA #$A6 C2/198D: 8D A9 11 STA $11A9 (Store control in special effect) C2/1990: A9 01 LDA #$01 C2/1992: 1C A2 11 TRB $11A2 (Sets to magical damage) C2/1995: A9 20 LDA #$20 C2/1997: 0C A4 11 TSB $11A4 (Sets unblockable) C2/199A: 4C 7B 31 JMP $317B Leap C2/199D: BB TYX C2/199E: 20 8A 29 JSR $298A (Clear special effect, magic power, etc.) C2/19A1: A9 A8 LDA #$A8 C2/19A3: 8D A9 11 STA $11A9 (Store Leap in special effect) C2/19A6: A9 01 LDA #$01 C2/19A8: 1C A2 11 TRB $11A2 (Sets to magical damage) C2/19AB: A9 40 LDA #$40 C2/19AD: 85 BB STA $BB (Sets to Cursor start on enemy only) C2/19AF: 4C 7B 31 JMP $317B C2/19B2: A9 0C LDA #$0C C2/19B4: 85 B5 STA $B5 (Sets command to Lore) C2/19B6: 20 5F 17 JSR $175F C2/19B9: A9 21 LDA #$21 C2/19BB: EB XBA C2/19BC: A9 06 LDA #$06 C2/19BE: 4C BF 62 JMP $62BF C2/19C1: EB XBA C2/19C2: A5 B5 LDA $B5 C2/19C4: 4C D3 26 JMP $26D3 Code pointers for commands C2/19C7: C8 15 (Fight) C2/19C9: 97 18 (Item) C2/19CB: 41 17 (Magic) C2/19CD: 36 19 (Morph) C2/19CF: 27 19 (Revert) C2/19D1: 91 15 (Steal) (05) C2/19D3: 10 16 (Capture) C2/19D5: 47 18 (Swdtech) C2/19D7: 8D 18 (Throw) C2/19D9: 85 18 (Tools) C2/19DB: 9D 15 (Blitz) (0A) C2/19DD: 5B 19 (Runic) C2/19DF: 5F 17 (Lore) C2/19E1: 1F 15 (Sketch) C2/19E3: 76 19 (Control) C2/19E5: 26 17 (Slot) C2/19E7: 60 15 (Rage) (10) C2/19E9: 9D 19 (Leap) C2/19EB: 1E 15 (Mimic) C2/19ED: 7D 17 (Dance) C2/19EF: 4C 19 (Row) C2/19F1: 6A 19 (Def.) (15) C2/19F3: F6 17 (Jump) C2/19F5: 41 17 (X-Magic) C2/19F7: 07 19 (GP Rain) C2/19F9: 63 17 (Summon) C2/19FB: 1E 17 (Health) (1A) C2/19FD: 1A 17 (Shock) C2/19FF: E5 17 (Possess) C2/1A01: 5F 17 (Magitek) Code pointers for special commands C2/1A03: B2 19 (1E) C2/1A05: 1E 15 (1F) (Jumps to RTS) C2/1A07: 72 50 (20) (#$F2 Command script) C2/1A09: D1 50 (21) (#$F3 Command script) C2/1A0B: 0B 50 (22) (Poison, Regen, and Seizure/Phantasm Damage) C2/1A0D: 57 4F (23) (#$F7 Command script) C2/1A0F: 97 4F (24) (#$F5 Command script) C2/1A11: CD 50 (25) C2/1A13: 5F 4F (26) (Doom cast when Condemned countdown reaches 0; Safe, Shell, or Reflect* cast when character enters Near Fatal (* no items actually do this, but it's supported); or revival due to Life 3. C2/1A15: DD 50 (27) C1/1A17: 1E 15 (28) (Jumps to RTS) C2/1A19: 61 51 (29) (Remove Stop, Reflect, Freeze, or Sleep when time is up) C2/1A1B: DE 20 (2A) (Run) C2/1A1D: 2D 64 (2B) (#$FA Command script) C2/1A1F: A8 51 (2C) C2/1A21: B2 51 (2D) (Drain from being seized) C2/1A23: FA 1D (2E) (#$F8 Command script) C2/1A25: 1A 1E (2F) (#$F9 Command script) C2/1A27: 5E 1E (30) (#$FB Command script) C2/1A29: 1E 15 (31) (Jumps to RTS) C2/1A2B: 1E 15 (32) (Jumps to RTS) C2/1A2D: 1E 15 (33) (Jumps to RTS) C2/1A2F: DA PHX C2/1A30: 08 PHP C2/1A31: A5 B8 LDA $B8 C2/1A33: 85 FC STA $FC C2/1A35: 85 FE STA $FE C2/1A37: E2 20 SEP #$20 C2/1A39: 64 F5 STZ $F5 C2/1A3B: 86 F6 STX $F6 C2/1A3D: 20 AF 1A JSR $1AAF C2/1A40: 28 PLP C2/1A41: FA PLX C2/1A42: 60 RTS Read command script? C2/1A43: 7B TDC C2/1A44: BF 00 87 CF LDA $CF8700,X C2/1A48: E8 INX C2/1A49: C9 FE CMP #$FE C2/1A4B: B0 F5 BCS $1A42 (Exit if #$FE or #$FF - Done with commands) C2/1A4D: E9 EF SBC #$EF C2/1A4F: 90 F3 BCC $1A44 (Branch if not control command) C2/1A51: DA PHX C2/1A52: AA TAX C2/1A53: BF AF 1D C2 LDA $C21DAF,X (# of bytes following control command) C2/1A57: FA PLX C2/1A58: CA DEX C2/1A59: E8 INX C2/1A5A: 3A DEC C2/1A5B: D0 FC BNE $1A59 C2/1A5D: 80 E5 BRA $1A44 Read 4 bytes from command script C2/1A5F: 08 PHP C2/1A60: C2 20 REP #$20 C2/1A62: A6 F0 LDX $F0 C2/1A64: BF 02 87 CF LDA $CF8702,X C2/1A68: 8D 2E 3A STA $3A2E C2/1A6B: BF 00 87 CF LDA $CF8700,X (Command scripts) C2/1A6F: 8D 2C 3A STA $3A2C C2/1A72: 28 PLP C2/1A73: 60 RTS Command Script #$FD C2/1A74: C2 20 REP #$20 (Set 16-bit Accumulator) C2/1A76: A5 F0 LDA $F0 C2/1A78: 85 F2 STA $F2 C2/1A7A: 60 RTS Command Script #$FE and #$FF C2/1A7B: A9 FF LDA #$FF C2/1A7D: 85 F5 STA $F5 C2/1A7F: 60 RTS C2/1A80: A9 03 LDA #$03 C2/1A82: 20 65 4B JSR $4B65 (0 to 2) C2/1A85: AA TAX C2/1A86: BD 2D 3A LDA $3A2D,X (Byte 1 to 3 of 4 byte command) C2/1A89: C9 FE CMP #$FE C2/1A8B: D0 B5 BNE $1A42 (Exit) C2/1A8D: 68 PLA C2/1A8E: 68 PLA C2/1A8F: 80 23 BRA $1AB4 Command Script #$FC C2/1A91: AD 2D 3A LDA $3A2D (Byte 1 of command) C2/1A94: 0A ASL C2/1A95: AA TAX C2/1A96: FC 55 1D JSR ($1D55,X) C2/1A99: B0 19 BCS $1AB4 C2/1A9B: C2 30 REP #$30 (Set 16-bit A,X, & Y) C2/1A9D: A5 FE LDA $FE C2/1A9F: 85 FC STA $FC C2/1AA1: E2 20 SEP #$20 (Set 8-bit A) C2/1AA3: A6 F0 LDX $F0 C2/1AA5: 20 43 1A JSR $1A43 C2/1AA8: 1A INC C2/1AA9: F0 D0 BEQ $1A7B C2/1AAB: 86 F0 STX $F0 C2/1AAD: E6 F5 INC $F5 C2/1AAF: AD 98 3A LDA $3A98 C2/1AB2: 85 F8 STA $F8 C2/1AB4: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/1AB6: C2 10 REP #$10 (Set 16-bit X, & Y) C2/1AB8: 20 5F 1A JSR $1A5F (Read 4 bytes from command script) C2/1ABB: C9 FC CMP #$FC C2/1ABD: B0 11 BCS $1AD0 (Branch if FD or FE) C2/1ABF: A5 F5 LDA $F5 C2/1AC1: C5 F4 CMP $F4 C2/1AC3: D0 0B BNE $1AD0 C2/1AC5: A9 FF LDA #$FF C2/1AC7: 85 F4 STA $F4 C2/1AC9: A6 F2 LDX $F2 C2/1ACB: 86 F0 STX $F0 C2/1ACD: 20 5F 1A JSR $1A5F (Read 4 bytes from command script) C2/1AD0: 7B TDC C2/1AD1: 38 SEC C2/1AD2: 9B TXY C2/1AD3: AD 2C 3A LDA $3A2C (Command to execute) C2/1AD6: E9 F0 SBC #$F0 C2/1AD8: B0 02 BCS $1ADC (Branch if control command) C2/1ADA: A9 0F LDA #$0F C2/1ADC: AA TAX C2/1ADD: BF AF 1D C2 LDA $C21DAF,X (# of bytes following command) C2/1AE1: AA TAX C2/1AE2: C8 INY C2/1AE3: CA DEX C2/1AE4: D0 FC BNE $1AE2 C2/1AE6: 84 F0 STY $F0 C2/1AE8: E2 10 SEP #$10 (Set 8-bit X, & Y) C2/1AEA: A5 F8 LDA $F8 C2/1AEC: F0 07 BEQ $1AF5 C2/1AEE: AD 2C 3A LDA $3A2C (Command to execute) C2/1AF1: C9 FC CMP #$FC C2/1AF3: 90 A6 BCC $1A9B C2/1AF5: A4 F6 LDY $F6 C2/1AF7: AD 2C 3A LDA $3A2C (Command to execute) C2/1AFA: C9 F0 CMP #$F0 C2/1AFC: 90 27 BCC $1B25 (Branch if not control command) C2/1AFE: 29 0F AND #$0F C2/1B00: 0A ASL C2/1B01: AA TAX C2/1B02: 7C 8F 1D JMP ($1D8F,X) Command Script #$F6 C2/1B05: A9 01 LDA #$01 C2/1B07: EB XBA C2/1B08: AD 2D 3A LDA $3A2D (Item or Throw) C2/1B0B: F0 03 BEQ $1B10 (Branch if item) C2/1B0D: A9 08 LDA #$08 C2/1B0F: EB XBA C2/1B10: AD 2E 3A LDA $3A2E (Item to use or throw) C2/1B13: 8D 2D 3A STA $3A2D C2/1B16: 20 80 1A JSR $1A80 C2/1B19: EB XBA C2/1B1A: 80 0C BRA $1B28 Command Script #$F4 C2/1B1C: 7B TDC C2/1B1D: 20 80 1A JSR $1A80 C2/1B20: 80 06 BRA $1B28 Command Script #$F0 C2/1B22: 20 80 1A JSR $1A80 (Pick which command to use) C2/1B25: 20 BF 1D JSR $1DBF C2/1B28: BB TYX C2/1B29: C2 20 REP #$20 C2/1B2B: 48 PHA C2/1B2C: A5 FC LDA $FC C2/1B2E: 85 B8 STA $B8 C2/1B30: BD E4 3E LDA $3EE4,X C2/1B33: 89 00 20 BIT #$2000 C2/1B36: F0 02 BEQ $1B3A (If not Muddled) C2/1B38: 64 B8 STZ $B8 C2/1B3A: 68 PLA C2/1B3B: 20 B9 03 JSR $03B9 C2/1B3E: 20 E4 03 JSR $03E4 C2/1B41: 20 AD 4E JSR $4EAD C2/1B44: 4C B4 1A JMP $1AB4 Command Script #$F1 C2/1B47: AD 2D 3A LDA $3A2D (Script byte 1) C2/1B4A: 18 CLC C2/1B4B: 20 25 1F JSR $1F25 C2/1B4E: C2 20 REP #$20 C2/1B50: A5 B8 LDA $B8 C2/1B52: 85 FC STA $FC C2/1B54: 4C B4 1A JMP $1AB4 Command Script #$F5 C2/1B57: AD 2F 3A LDA $3A2F C2/1B5A: D0 06 BNE $1B62 (branch if command already has targets) C2/1B5C: B9 19 30 LDA $3019,Y C2/1B5F: 8D 2F 3A STA $3A2F (if it doesn't, save the monster who issued command as the target) C2/1B62: A9 24 LDA #$24 C2/1B64: 80 12 BRA $1B78 Command Script #$F3 C2/1B66: A9 21 LDA #$21 C2/1B68: 80 0E BRA $1B78 Command Script #$FB C2/1B6A: A9 30 LDA #$30 C2/1B6C: 80 0A BRA $1B78 Command Script #$F2 C2/1B6E: A9 20 LDA #$20 C2/1B70: 80 06 BRA $1B78 Command Script #$F8 C2/1B72: A9 2E LDA #$2E C2/1B74: 80 02 BRA $1B78 Command Script #$F9 C2/1B76: A9 2F LDA #$2F C2/1B78: EB XBA C2/1B79: AD 2D 3A LDA $3A2D C2/1B7C: EB XBA C2/1B7D: C2 20 REP #$20 (Set 16-bit Accumulator) C2/1B7F: 8D 7A 3A STA $3A7A C2/1B82: AD 2E 3A LDA $3A2E C2/1B85: 85 B8 STA $B8 C2/1B87: BB TYX C2/1B88: 20 AD 4E JSR $4EAD C2/1B8B: 4C B4 1A JMP $1AB4 Command Script #$F7 C2/1B8E: BB TYX C2/1B8F: A9 23 LDA #$23 C2/1B91: 8D 7A 3A STA $3A7A C2/1B94: AD 2D 3A LDA $3A2D C2/1B97: 8D 7B 3A STA $3A7B C2/1B9A: 20 AD 4E JSR $4EAD C2/1B9D: 4C B4 1A JMP $1AB4 Command Script #$FA C2/1BA0: BB TYX C2/1BA1: AD 2D 3A LDA $3A2D C2/1BA4: EB XBA C2/1BA5: A9 2B LDA #$2B C2/1BA7: C2 20 REP #$20 C2/1BA9: 8D 7A 3A STA $3A7A C2/1BAC: AD 2E 3A LDA $3A2E C2/1BAF: 85 B8 STA $B8 C2/1BB1: 20 AD 4E JSR $4EAD C2/1BB4: 4C B4 1A JMP $1AB4 Command 06 for FC C2/1BB7: 20 34 1D JSR $1D34 (Set who to check for using command 17) C2/1BBA: 90 0B BCC $1BC7 (Exit if no counter for command 17) C2/1BBC: 7B TDC C2/1BBD: AD 2F 3A LDA $3A2F C2/1BC0: EB XBA C2/1BC1: C2 20 REP #$20 C2/1BC3: 4A LSR C2/1BC4: D9 F4 3B CMP $3BF4,Y (Compare HP vs. second byte * 128) C2/1BC7: 60 RTS Command 07 for FC C2/1BC8: 20 34 1D JSR $1D34 (Do command 17 for FC) C2/1BCB: 90 09 BCC $1BD6 (Exit if no counter for command 17) C2/1BCD: 7B TDC C2/1BCE: AD 2F 3A LDA $3A2F (Second byte for FC) C2/1BD1: C2 20 REP #$20 C2/1BD3: D9 08 3C CMP $3C08,Y (Compare MP vs. second byte) C2/1BD6: 60 RTS Command 08 for FC C2/1BD7: 20 34 1D JSR $1D34 (Do command 17 for FC) C2/1BDA: 90 49 BCC $1C25 (Exit if no counter for command 17) C2/1BDC: AD 2F 3A LDA $3A2F (Second byte for FC) C2/1BDF: C9 10 CMP #$10 C2/1BE1: 90 0B BCC $1BEE (Branch if less than 10) C2/1BE3: C2 20 REP #$20 C2/1BE5: AD 74 3A LDA $3A74 C2/1BE8: 25 FC AND $FC C2/1BEA: 85 FC STA $FC C2/1BEC: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/1BEE: A9 10 LDA #$10 C2/1BF0: 1C 2F 3A TRB $3A2F (Second byte for FC) C2/1BF3: C2 20 REP #$20 (Set 16-bit Accumulator) C2/1BF5: D0 05 BNE $1BFC (If FC over 10) C2/1BF7: A9 E4 3E LDA #$3EE4 C2/1BFA: 80 03 BRA $1BFF C2/1BFC: A9 F8 3E LDA #$3EF8 C2/1BFF: 85 FA STA $FA C2/1C01: AE 2F 3A LDX $3A2F (Second byte for FC) C2/1C04: 20 2D 1D JSR $1D2D (Set bit #X in A) C2/1C07: 85 EE STA $EE C2/1C09: A0 12 LDY #$12 C2/1C0B: B1 FA LDA ($FA),Y C2/1C0D: 24 EE BIT $EE C2/1C0F: D0 05 BNE $1C16 C2/1C11: B9 18 30 LDA $3018,Y C2/1C14: 14 FC TRB $FC C2/1C16: 88 DEY C2/1C17: 88 DEY C2/1C18: 10 F1 BPL $1C0B C2/1C1A: 18 CLC C2/1C1B: A5 FC LDA $FC C2/1C1D: F0 06 BEQ $1C25 C2/1C1F: 20 2A 52 JSR $522A C2/1C22: 85 FC STA $FC C2/1C24: 38 SEC C2/1C25: 60 RTS Command 09 for FC C2/1C26: 20 D7 1B JSR $1BD7 (Do command 08 for FC) C2/1C29: 4C 26 1D JMP $1D26 Command 1A for FC C2/1C2C: 20 34 1D JSR $1D34 (Do command 17 for FC) C2/1C2F: 90 09 BCC $1C3A C2/1C31: B9 E0 3B LDA $3BE0,Y C2/1C34: 2C 2F 3A BIT $3A2F C2/1C37: D0 01 BNE $1C3A C2/1C39: 18 CLC C2/1C3A: 60 RTS Command 03 for FC - Counter Item usage C2/1C3B: 98 TYA C2/1C3C: 69 13 ADC #$13 C2/1C3E: A8 TAY C2/1C3F: C8 INY (Command 02 for FC - counter Spell usage - jumps here) C2/1C40: BB TYX (Command 01 for FC - counter a command - jumps here) C2/1C41: BC 90 32 LDY $3290,X C2/1C44: 30 0D BMI $1C53 C2/1C46: BD 48 3D LDA $3D48,X C2/1C49: CD 2E 3A CMP $3A2E C2/1C4C: F0 07 BEQ $1C55 C2/1C4E: CD 2F 3A CMP $3A2F C2/1C51: F0 02 BEQ $1C55 C2/1C53: 18 CLC C2/1C54: 60 RTS C2/1C55: C2 20 REP #$20 C2/1C57: B9 18 30 LDA $3018,Y C2/1C5A: 85 FC STA $FC C2/1C5C: 38 SEC C2/1C5D: 60 RTS Command 04 for FC C2/1C5E: 98 TYA C2/1C5F: 69 15 ADC #$15 C2/1C61: AA TAX C2/1C62: BC 90 32 LDY $3290,X (get attacker index. [or in the case of reflection, the reflector.] accessed as $32A5 in C2/35E3, from what i can tell.) C2/1C65: 30 08 BMI $1C6F C2/1C67: BD 48 3D LDA $3D48,X (get attack's element(s). accessed as $3D5D elsewhere, from what i can tell.) C2/1C6A: 2C 2E 3A BIT $3A2E (compare to script element(s) [1st byte for FC]) C2/1C6D: D0 E6 BNE $1C55 (branch if any matches) C2/1C6F: 60 RTS Command 05 for FC C2/1C70: BB TYX C2/1C71: BC 7C 32 LDY $327C,X C2/1C74: 30 08 BMI $1C7E C2/1C76: C2 20 REP #$20 C2/1C78: B9 18 30 LDA $3018,Y C2/1C7B: 85 FC STA $FC C2/1C7D: 38 SEC C2/1C7E: 60 RTS Command 16 for FC C2/1C7F: C2 20 REP #$20 C2/1C81: AD 44 3A LDA $3A44 C2/1C84: 80 05 BRA $1C8B Command 0B for FC C2/1C86: C2 20 REP #$20 C2/1C88: B9 C0 3D LDA $3DC0,Y C2/1C8B: 4A LSR C2/1C8C: CD 2E 3A CMP $3A2E C2/1C8F: 60 RTS Command 0D for FC C2/1C90: AE 2E 3A LDX $3A2E (First byte for FC) C2/1C93: 20 45 1E JSR $1E45 ($EE = variable #X) C2/1C96: A5 EE LDA $EE C2/1C98: CD 2F 3A CMP $3A2F C2/1C9B: 60 RTS Command 0C for FC C2/1C9C: 20 90 1C JSR $1C90 (Do command 0D for FC) C2/1C9F: 4C 26 1D JMP $1D26 Command 14 for FC C2/1CA2: AE 2F 3A LDX $3A2F (Second byte for FC) C2/1CA5: 20 2D 1D JSR $1D2D (Set bit #X in A) C2/1CA8: AE 2E 3A LDX $3A2E (First byte for FC) C2/1CAB: 20 45 1E JSR $1E45 ($EE = variable #X) C2/1CAE: 24 EE BIT $EE C2/1CB0: F0 01 BEQ $1CB3 C2/1CB2: 38 SEC C2/1CB3: 60 RTS Command 15 for FC C2/1CB4: 20 A2 1C JSR $1CA2 (Do command 14 for FC) C2/1CB7: 4C 26 1D JMP $1D26 Command 0F for FC C2/1CBA: 20 34 1D JSR $1D34 (Do command 17 for FC) C2/1CBD: 90 06 BCC $1CC5 C2/1CBF: B9 18 3B LDA $3B18,Y (Level) C2/1CC2: CD 2F 3A CMP $3A2F C2/1CC5: 60 RTS Command 0E for FC C2/1CC6: 20 BA 1C JSR $1CBA (Do command 0F for FC) C2/1CC9: 4C 26 1D JMP $1D26 Command 10 for FC C2/1CCC: A9 01 LDA #$01 C2/1CCE: CD CA 3E CMP $3ECA (Only counter if one type of monster active) C2/1CD1: 60 RTS Command 19 for FC C2/1CD2: B9 19 30 LDA $3019,Y C2/1CD5: 2C 2E 3A BIT $3A2E C2/1CD8: F0 01 BEQ $1CDB C2/1CDA: 38 SEC C2/1CDB: 60 RTS Command 11 for FC C2/1CDC: 20 EE 1D JSR $1DEE C2/1CDF: AD 75 3A LDA $3A75 C2/1CE2: 80 0B BRA $1CEF Command 12 for FC C2/1CE4: 64 F8 STZ $F8 C2/1CE6: 20 EE 1D JSR $1DEE C2/1CE9: AD 73 3A LDA $3A73 C2/1CEC: 4D 75 3A EOR $3A75 C2/1CEF: 2D 2E 3A AND $3A2E C2/1CF2: CD 2E 3A CMP $3A2E C2/1CF5: 18 CLC C2/1CF6: D0 01 BNE $1CF9 C2/1CF8: 38 SEC C2/1CF9: 60 RTS Command 13 for FC C2/1CFA: AD 2E 3A LDA $3A2E (First byte for FC) C2/1CFD: D0 07 BNE $1D06 C2/1CFF: AD 76 3A LDA $3A76 C2/1D02: CD 2F 3A CMP $3A2F (Second byte for FC) C2/1D05: 60 RTS C2/1D06: AD 2F 3A LDA $3A2F (Second byte for FC) C2/1D09: CD 77 3A CMP $3A77 C2/1D0C: 60 RTS Command 18 for FC C2/1D0D: AD DF 1E LDA $1EDF C2/1D10: 89 08 BIT #$08 C2/1D12: D0 01 BNE $1D15 C2/1D14: 38 SEC C2/1D15: 60 RTS Command 1B for FC C2/1D16: C2 20 REP #$20 C2/1D18: AD 2E 3A LDA $3A2E (First byte for FC) C2/1D1B: CD E0 11 CMP $11E0 (Battle formation) C2/1D1E: F0 01 BEQ $1D21 C2/1D20: 18 CLC C2/1D21: 60 RTS Command 1C for FC C2/1D22: 64 F8 STZ $F8 C2/1D24: 38 SEC C2/1D25: 60 RTS C2/1D26: E2 20 SEP #$20 C2/1D28: 2A ROL C2/1D29: 49 01 EOR #$01 C2/1D2B: 4A LSR C2/1D2C: 60 RTS C2/1D2D: 7B TDC C2/1D2E: 38 SEC C2/1D2F: 2A ROL C2/1D30: CA DEX C2/1D31: 10 FC BPL $1D2F C2/1D33: 60 RTS Command 17 for FC C2/1D34: AD 2E 3A LDA $3A2E (Load first byte for FC) C2/1D37: 48 PHA C2/1D38: 38 SEC C2/1D39: 20 25 1F JSR $1F25 (Set target using first byte as parameter) C2/1D3C: 90 0B BCC $1D49 (If invalid or no targets) C2/1D3E: C2 20 REP #$20 (Set 16-bit Accumulator) C2/1D40: A5 B8 LDA $B8 C2/1D42: 85 FC STA $FC C2/1D44: 20 F9 51 JSR $51F9 (Y = highest targest number * 2) C2/1D47: E2 21 SEP #$21 C2/1D49: 68 PLA C2/1D4A: 08 PHP C2/1D4B: C9 36 CMP #$36 C2/1D4D: D0 04 BNE $1D53 (Branch if not targeting self) C2/1D4F: 64 FC STZ $FC (Clear targets) C2/1D51: 64 FC STZ $FC (Clear targets) C2/1D53: 28 PLP C2/1D54: 60 RTS Code pointers for command #$FC C2/1D55: 2C 1D (00) (Nothing) C2/1D57: 40 1C (01) (Command counter) C2/1D59: 3F 1C (02) (Spell counter) C2/1D5B: 3B 1C (03) (Item counter) C2/1D5D: 5E 1C (04) (Elemental counter) C2/1D5F: 70 1C (05) C2/1D61: B7 1B (06) (HP low counter) C2/1D63: C8 1B (07) (MP low counter) C2/1D65: D7 1B (08) C2/1D67: 26 1C (09) C2/1D69: 2C 1D (0A) (Nothing) C2/1D6B: 86 1C (0B) C2/1D6D: 9C 1C (0C) C2/1D6F: 90 1C (0D) C2/1D71: C6 1C (0E) C2/1D73: BA 1C (0F) C2/1D75: CC 1C (10) C2/1D77: DC 1C (11) C2/1D79: E4 1C (12) (Final attack) C2/1D7A: FA 1C (13) C2/1D7D: A2 1C (14) C2/1D7F: B4 1C (15) C2/1D81: 7F 1C (16) C2/1D83: 34 1D (17) C2/1D85: 0D 1D (18) C2/1D87: D2 1C (19) C2/1D89: 2C 1C (1A) C2/1D8B: 16 1D (1B) C2/1D8D: 22 1D (1C) Code pointers for control commands (monster scripts) C2/1D8F: 22 1B (F0) C2/1D91: 47 1B (F1) C2/1D93: 6E 1B (F2) C2/1D95: 66 1B (F3) C2/1D97: 1C 1B (F4) C2/1D99: 57 1B (F5) C2/1D9B: 05 1B (F6) C2/1D9D: 8E 1B (F7) C2/1D9F: 72 1B (F8) C2/1DA1: 76 1B (F9) C2/1DA3: A0 1B (FA) C2/1DA5: 6A 1B (FB) C2/1DA7: 91 1A (FC) C2/1DA9: 74 1A (FD) C2/1DAB: 7B 1A (FE) C2/1DAD: 7B 1A (FF) # of bytes for control command C2/1DAF: 04 (F0) C2/1DB0: 02 (F1) C2/1DB1: 04 (F2) C2/1DB2: 03 (F3) C2/1DB3: 04 (F4) C2/1DB4: 04 (F5) C2/1DB5: 04 (F6) C2/1DB6: 02 (F7) C2/1DB7: 03 (F8) C2/1DB8: 04 (F9) C2/1DB9: 04 (FA) C2/1DBA: 03 (FB) C2/1DBB: 04 (FC) C2/1DBC: 01 (FD) C2/1DBD: 01 (FE) C2/1DBE: 01 (FF) Figure what type of attack it is (spell, esper, blitz, etc.) C2/1DBF: DA PHX C2/1DC0: 48 PHA C2/1DC1: EB XBA C2/1DC2: 68 PLA (Spell # is now in bottom of A and top of A) C2/1DC3: A2 0A LDX #$0A C2/1DC5: DF D8 1D C2 CMP $C21DD8,X (pick an attack category?) C2/1DC9: 90 06 BCC $1DD1 (if attack is in a lower category, try the next one) C2/1DCB: BF E3 1D C2 LDA $C21DE3,X (choose a command) C2/1DCF: 80 05 BRA $1DD6 C2/1DD1: CA DEX C2/1DD2: 10 F1 BPL $1DC5 C2/1DD4: A9 02 LDA #$02 (if spell matched nothing in loop, it was between 0 and 35h, making it Magic command) C2/1DD6: FA PLX C2/1DD7: 60 RTS (Data - used to delimit which spell #s are which command) C2/1DD8: 36 (Esper) C2/1DD9: 51 (Skean) C2/1DDA: 55 (Swdtech) C2/1DDB: 5D (Blitz) C2/1DDC: 65 (Dance Move) C2/1DDD: 7D (Slot Move, or Tools??) C2/1DDE: 82 (Shock) C2/1DDF: 83 (Magitek) C2/1DE0: 8B (Enemy Attack / Lore) C2/1DE1: EE (Battle, Special) C2/1DE2: F0 (Desperation Attack, Interceptor) (Data - the command #) C2/1DE3: 19 (Summon) C2/1DE4: 02 (Magic) C2/1DE5: 07 (Swdtech) C2/1DE6: 0A (Blitz) C2/1DE7: 02 (Magic) C2/1DE8: 09 (Tools) C2/1DE9: 1B (Shock) C2/1DEA: 1D (Magitek) C2/1DEB: 0C (Lore) C2/1DEC: 00 (Fight) C2/1DED: 02 (Magic) C2/1DEE: AD 2E 3A LDA $3A2E C2/1DF1: D0 06 BNE $1DF9 C2/1DF3: B9 19 30 LDA $3019,Y C2/1DF6: 8D 2E 3A STA $3A2E C2/1DF9: 60 RTS Variable Manipulation C2/1DFA: A6 B6 LDX $B6 C2/1DFC: 20 45 1E JSR $1E45 C2/1DFF: A9 80 LDA #$80 C2/1E01: 14 B8 TRB $B8 (Clear bit 7 of byte 1) C2/1E03: D0 05 BNE $1E0A (If bit 7 of byte 1 is set) C2/1E05: 4A LSR C2/1E06: 14 B8 TRB $B8 (Clear bit 6 of byte 1) C2/1E08: 64 EE STZ $EE C2/1E0A: A5 B8 LDA $B8 C2/1E0C: 89 40 BIT #$40 C2/1E0E: F0 03 BEQ $1E13 (If bit 6 of byte 1 is clear) C2/1E10: 49 BF EOR #$BF (Toggle all but bit 6) C2/1E12: 1A INC C2/1E13: 65 EE ADC $EE C2/1E15: 85 EE STA $EE C2/1E17: 4C 38 1E JMP $1E38 Code for command #$2F (used by #$F9 monster script command) C2/1E1A: A6 B9 LDX $B9 (Byte 3) C2/1E1C: 20 57 1E JSR $1E57 (Set only bit #X in A) C2/1E1F: A6 B8 LDX $B8 (Byte 2) C2/1E21: 20 45 1E JSR $1E45 (Load variable X into $EE) C2/1E24: C6 B6 DEC $B6 (Byte 1) C2/1E26: 10 04 BPL $1E2C C2/1E28: 45 EE EOR $EE C2/1E2A: 80 0C BRA $1E38 C2/1E2C: C6 B6 DEC $B6 C2/1E2E: 10 04 BPL $1E34 C2/1E30: 05 EE ORA $EE C2/1E32: 80 04 BRA $1E38 C2/1E34: 49 FF EOR #$FF C2/1E36: 25 EE AND $EE C2/1E38: E0 24 CPX #$24 C2/1E3A: B0 05 BCS $1E41 C2/1E3C: 9D B0 3E STA $3EB0,X C2/1E3F: 80 03 BRA $1E44 C2/1E41: 99 AC 3D STA $3DAC,Y C2/1E44: 60 RTS Load variable X into A C2/1E45: 48 PHA C2/1E46: E0 24 CPX #$24 C2/1E48: B0 05 BCS $1E4F C2/1E4A: BD B0 3E LDA $3EB0,X C2/1E4D: 80 03 BRA $1E52 C2/1E4F: B9 AC 3D LDA $3DAC,Y C2/1E52: 85 EE STA $EE C2/1E54: 68 PLA C2/1E55: 18 CLC C2/1E56: 60 RTS Sets bit #X in A C2/1E57: 7B TDC C2/1E58: 38 SEC C2/1E59: 2A ROL C2/1E5A: CA DEX C2/1E5B: 10 FC BPL $1E59 C2/1E5D: 60 RTS Monster command script comamnd #$FB C2/1E5E: A5 B6 LDA $B6 C2/1E60: 0A ASL C2/1E61: AA TAX C2/1E62: A5 B8 LDA $B8 C2/1E64: 7C 09 1F JMP ($1F09,X) Operation 0 for #$FB Clears monster time counter C2/1E67: 7B TDC C2/1E68: 99 C0 3D STA $3DC0,Y C2/1E6B: 99 C1 3D STA $3DC1,Y C2/1E6E: 60 RTS Operation 9 for #$FB C2/1E6F: A9 0A LDA #$0A C2/1E71: 80 02 BRA $1E75 C2/1E73: A9 08 LDA #$08 (Operation 2 jumps here) C2/1E75: 8D 6E 3A STA $3A6E C2/1E78: 60 RTS Operation 1 for #$FB C2/1E79: 08 PHP C2/1E7A: 38 SEC C2/1E7B: 20 25 1F JSR $1F25 C2/1E7E: C2 20 REP #$20 C2/1E80: A5 B8 LDA $B8 C2/1E82: 0C 3C 3A TSB $3A3C C2/1E85: 28 PLP C2/1E86: 60 RTS Operation 5 for #$FB C2/1E87: 08 PHP C2/1E88: 38 SEC C2/1E89: 20 25 1F JSR $1F25 C2/1E8C: C2 20 REP #$20 C2/1E8E: A5 B8 LDA $B8 C2/1E90: 1C 3C 3A TRB $3A3C C2/1E93: 28 PLP C2/1E94: 60 RTS Operation 6 for #$FB C2/1E95: 38 SEC C2/1E96: 20 25 1F JSR $1F25 C2/1E99: A5 B9 LDA $B9 C2/1E9B: 0C 46 2F TSB $2F46 C2/1E9E: 60 RTS Operation 7 for #$FB C2/1E9F: 38 SEC C2/1EA0: 20 25 1F JSR $1F25 C2/1EA3: A5 B9 LDA $B9 C2/1EA5: 1C 46 2F TRB $2F46 C2/1EA8: 60 RTS Operation 3 for #$FB C2/1EA9: A9 08 LDA #$08 C2/1EAB: 0C DF 1E TSB $1EDF C2/1EAE: B9 D9 3E LDA $3ED9,Y C2/1EB1: AA TAX C2/1EB2: BD 50 18 LDA $1850,X C2/1EB5: 09 40 ORA #$40 C2/1EB7: 29 E0 AND #$E0 C2/1EB9: 0D 6D 1A ORA $1A6D C2/1EBC: 85 EE STA $EE C2/1EBE: 98 TYA C2/1EBF: 0A ASL C2/1EC0: 0A ASL C2/1EC1: 05 EE ORA $EE C2/1EC3: 9D 50 18 STA $1850,X C2/1EC6: 60 RTS Operation 4 for #$FB C2/1EC7: 9C 44 3A STZ $3A44 C2/1ECA: 9C 45 3A STZ $3A45 C2/1ECD: 60 RTS Operation 8 for #$FB C2/1ECE: 38 SEC C2/1ECF: 20 25 1F JSR $1F25 C2/1ED2: 90 05 BCC $1ED9 C2/1ED4: A9 FF LDA #$FF C2/1ED6: 99 C9 3A STA $3AC9,Y C2/1ED9: 60 RTS Operation C for #$FB C2/1EDA: 20 EB 1E JSR $1EEB C2/1EDD: A9 04 LDA #$04 C2/1EDF: 0C A4 11 TSB $11A4 C2/1EE2: 4C 67 31 JMP $3167 Operation B for #$FB C2/1EE5: 20 EB 1E JSR $1EEB C2/1EE8: 4C 67 31 JMP $3167 C2/1EEB: 20 8A 29 JSR $298A (Clear special effect, magic power, etc.) C2/1EEE: 18 CLC C2/1EEF: A5 B8 LDA $B8 C2/1EF1: 20 17 52 JSR $5217 C2/1EF4: 1D AA 11 ORA $11AA,X C2/1EF7: 9D AA 11 STA $11AA,X C2/1EFA: BB TYX C2/1EFB: A9 12 LDA #$12 C2/1EFD: 85 B5 STA $B5 (Store Mimic in command)? C2/1EFF: 60 RTS Operation D for #$FB C2/1F00: B9 F9 3E LDA $3EF9,Y C2/1F03: 09 20 ORA #$20 C2/1F05: 99 F9 3E STA $3EF9,Y (Set Hide status) C2/1F08: 60 RTS Code pointers for command #$FB C2/1F09: 67 1E (00) C2/1F0B: 79 1E (01) C2/1F0D: 73 1E (02) C2/1F0F: A9 1E (03) C2/1F11: C7 1E (04) C2/1F13: 87 1E (05) C2/1F15: 95 1E (06) C2/1F17: 9F 1E (07) C2/1F19: CE 1E (08) C2/1F1B: 6F 1E (09) C2/1F1D: 08 1F (0A) (jumps to RTS) C2/1F1F: E5 1E (0B) C2/1F21: DA 1E (0C) C2/1F23: 00 1F (0D) C2/1F25: DA PHX C2/1F26: 5A PHY C2/1F27: 48 PHA C2/1F28: 64 B8 STZ $B8 C2/1F2A: A2 06 LDX #$06 C2/1F2C: BD D8 3E LDA $3ED8,X (Which character it is) C2/1F2F: 30 05 BMI $1F36 (Branch if not present) C2/1F31: BD 18 30 LDA $3018,X C2/1F34: 04 B8 TSB $B8 (Set character as target) C2/1F36: CA DEX C2/1F37: CA DEX C2/1F38: 10 F2 BPL $1F2C C2/1F3A: 64 B9 STZ $B9 (Set no monsters as target) C2/1F3C: A2 0A LDX #$0A C2/1F3E: BD 02 20 LDA $2002,X C2/1F41: 30 05 BMI $1F48 C2/1F43: BD 21 30 LDA $3021,X C2/1F46: 04 B9 TSB $B9 (Set monster as target) C2/1F48: CA DEX C2/1F49: CA DEX C2/1F4A: 10 F2 BPL $1F3E C2/1F4C: B0 06 BCS $1F54 C2/1F4E: 20 4D 5A JSR $5A4D (Remove dead and hidden targets) C2/1F51: 20 17 59 JSR $5917 C2/1F54: 68 PLA C2/1F55: C9 30 CMP #$30 C2/1F57: B0 14 BCS $1F6D C2/1F59: A2 06 LDX #$06 C2/1F5B: DD D8 3E CMP $3ED8,X (Which character it is) C2/1F5E: D0 07 BNE $1F67 C2/1F60: BD 18 30 LDA $3018,X C2/1F63: 85 B8 STA $B8 C2/1F65: 80 3A BRA $1FA1 C2/1F67: CA DEX C2/1F68: CA DEX C2/1F69: 10 F0 BPL $1F5B C2/1F6B: 80 32 BRA $1F9F C2/1F6D: C9 36 CMP #$36 C2/1F6F: B0 10 BCS $1F81 C2/1F71: E9 2F SBC #$2F C2/1F73: 0A ASL C2/1F74: AA TAX C2/1F75: BD 02 20 LDA $2002,X C2/1F78: 30 25 BMI $1F9F C2/1F7A: BD 21 30 LDA $3021,X C2/1F7D: 85 B9 STA $B9 C2/1F7F: 80 27 BRA $1FA8 C2/1F81: E9 36 SBC #$36 C2/1F83: 0A ASL C2/1F84: AA TAX C2/1F85: 7C 65 20 JMP ($2065,X) C2/1F88: 64 B9 STZ $B9 C2/1F8A: C2 20 REP #$20 C2/1F8C: A5 B8 LDA $B8 C2/1F8E: 20 2A 52 JSR $522A (Pick a bit that is set) C2/1F91: 85 B8 STA $B8 C2/1F93: C2 20 REP #$20 (46 jumps here) C2/1F95: A5 B8 LDA $B8 C2/1F97: E2 21 SEP #$21 C2/1F99: D0 01 BNE $1F9C C2/1F9B: 18 CLC C2/1F9C: 7A PLY C2/1F9D: FA PLX C2/1F9E: 60 RTS (47) C2/1F9F: 64 B8 STZ $B8 C2/1FA1: 64 B9 STZ $B9 (43 jumps here) C2/1FA3: 80 EE BRA $1F93 (37) C2/1FA5: 20 2D 20 JSR $202D C2/1FA8: 64 B8 STZ $B8 (38 jumps here) C2/1FAA: 80 E7 BRA $1F93 (39) C2/1FAC: 20 2D 20 JSR $202D C2/1FAF: 64 B8 STZ $B8 (3A jumps here) C2/1FB1: 80 D7 BRA $1F8A (3B) C2/1FB3: 20 37 20 JSR $2037 C2/1FB6: 80 E9 BRA $1FA1 (3C) C2/1FB8: 20 37 20 JSR $2037 C2/1FBB: 80 CB BRA $1F88 (3D) C2/1FBD: 20 37 20 JSR $2037 C2/1FC0: 80 E6 BRA $1FA8 (3E) C2/1FC2: 20 37 20 JSR $2037 C2/1FC5: 80 E8 BRA $1FAF (3F) C2/1FC7: 20 4E 20 JSR $204E C2/1FCA: 80 D5 BRA $1FA1 (40) C2/1FCC: 20 4E 20 JSR $204E C2/1FCF: 80 B7 BRA $1F88 (41) C2/1FD1: 20 4E 20 JSR $204E C2/1FD4: 80 D2 BRA $1FA8 (42) C2/1FD6: 20 4E 20 JSR $204E C2/1FD9: 80 D4 BRA $1FAF (4C) C2/1FDB: 20 2D 20 JSR $202D (Remove self as target) C2/1FDE: 20 53 4B JSR $4B53 (0 or 1) C2/1FE1: 90 A7 BCC $1F8A C2/1FE3: 80 AE BRA $1F93 (4D) C2/1FE5: BE F5 32 LDX $32F5,Y C2/1FE8: 30 B5 BMI $1F9F (No targets) C2/1FEA: A9 FF LDA #$FF C2/1FEC: 99 F5 32 STA $32F5,Y C2/1FEF: C2 20 REP #$20 C2/1FF1: BD 18 30 LDA $3018,X C2/1FF4: 85 B8 STA $B8 C2/1FF6: 20 4D 5A JSR $5A4D (Remove dead and hidden targets) C2/1FF9: 80 98 BRA $1F93 (45) C2/1FFB: 64 B8 STZ $B8 C2/1FFD: 64 B9 STZ $B9 C2/1FFF: B9 E0 32 LDA $32E0,Y C2/2002: C9 0A CMP #$0A C2/2004: B0 8D BCS $1F93 C2/2006: 0A ASL C2/2007: AA TAX C2/2008: C2 20 REP #$20 C2/200A: BD 18 30 LDA $3018,X C2/200D: 85 B8 STA $B8 C2/200F: 80 82 BRA $1F93 (48) (49) (4A) (4B) C2/2011: 8A TXA C2/2012: 38 SEC C2/2013: E9 24 SBC #$24 C2/2015: AA TAX C2/2016: BD A0 3A LDA $3AA0,X C2/2019: 4A LSR C2/201A: 90 83 BCC $1F9F C2/201C: BD 18 30 LDA $3018,X C2/201F: 85 B8 STA $B8 C2/2021: 80 A7 BRA $1FCA (36) C2/2023: C2 20 REP #$20 C2/2025: B9 18 30 LDA $3018,Y C2/2028: 85 B8 STA $B8 C2/202A: 4C 93 1F JMP $1F93 Remove self as target C2/202D: 08 PHP C2/202E: C2 20 REP #$20 C2/2030: B9 18 30 LDA $3018,Y C2/2033: 14 B8 TRB $B8 C2/2035: 28 PLP C2/2036: 60 RTS Sets targets to all dead monsters and characters C2/2037: 08 PHP (Set 16-bit Accumulator) C2/2038: C2 20 REP #$20 C2/203A: 64 B8 STZ $B8 C2/203C: A2 12 LDX #$12 C2/203E: BD E3 3E LDA $3EE3,X C2/2041: 10 05 BPL $2048 (Branch if not dead) C2/2043: BD 18 30 LDA $3018,X C2/2046: 04 B8 TSB $B8 C2/2048: CA DEX C2/2049: CA DEX C2/204A: 10 F2 BPL $203E C2/204C: 28 PLP C2/204D: 60 RTS Sets all monsters and characters with Reflect status as targets C2/204E: 08 PHP C2/204F: C2 20 REP #$20 (Set 16-bit Accumulator) C2/2051: 64 B8 STZ $B8 C2/2053: A2 12 LDX #$12 C2/2055: BD F7 3E LDA $3EF7,X C2/2058: 10 05 BPL $205F (Branch if not Reflect status) C2/205A: BD 18 30 LDA $3018,X C2/205D: 04 B8 TSB $B8 C2/205F: CA DEX C2/2060: CA DEX C2/2061: 10 F2 BPL $2055 C2/2063: 28 PLP C2/2064: 60 RTS Code pointers for command F1 targets C2/2065: 23 20 (36) C2/2067: A5 1F (37) C2/2069: A8 1F (38) C2/206B: AC 1F (39) C2/206D: AF 1F (3A) C2/206F: B3 1F (3B) C2/2071: B8 1F (3C) C2/2073: BD 1F (3D) C2/2075: C2 1F (3E) C2/2077: C7 1F (3F) C2/2079: CC 1F (40) C2/207B: D1 1F (41) C2/207D: D6 1F (42) C2/207F: A1 1F (43) C2/2081: 88 1F (44) C2/2083: FB 1F (45) C2/2085: 93 1F (46) C2/2087: 9F 1F (47) C2/2089: 11 20 (48) C2/208B: 11 20 (49) C2/208D: 11 20 (4A) C2/208F: 11 20 (4B) C2/2091: DB 1F (4C) C2/2093: E5 1F (4D) C2/2095: A2 03 LDX $#03 C2/2097: BD 2F 30 LDA $2F30,X C2/209A: F0 3E BEQ $20DA C2/209C: 9E 30 2F STZ $2F30,X C2/209F: DA PHX C2/20A0: 5A PHY C2/20A1: 8A TXA C2/20A2: 85 EE STA $EE C2/20A4: 0A ASL C2/20A5: 85 EF STA $EF C2/20A7: 0A ASL C2/20A8: 65 EE ADC $EE C2/20AA: AA TAX C2/20AB: BD 86 2B LDA $2B86,X C2/20AE: EB XBA C2/20AF: BD 9A 2B LDA $2B9A,X C2/20B2: A6 EF LDX $EF C2/20B4: C2 10 REP #$10 (Set 16-bit X and Y) C2/20B6: BC 10 30 LDY $3010,X (get offset to character info block) C2/20B9: 99 20 16 STA $1620,Y C2/20BC: EB XBA C2/20BD: 99 1F 16 STA $161F,Y C2/20C0: BD E4 3E LDA $3EE4,X C2/20C3: 99 14 16 STA $1614,Y C2/20C6: E2 10 SEP #$10 (Set 8-bit X and Y) C2/20C8: BD D9 3E LDA $3ED9,X C2/20CB: 22 77 0E C2 JSR $C20E77 C2/20CF: 20 6D 28 JSR $286D C2/20D2: 20 7D 52 JSR $527D C2/20D5: 20 75 26 JSR $2675 C2/20D8: 7A PLY C2/20D9: FA PLX C2/20DA: CA DEX C2/20DB: 10 BA BPL $2097 (loop for all 4 onscreen characters) C2/20DD: 60 RTS Command #$2A C2/20DE: AD 45 2F LDA $2F45 C2/20E1: F0 7F BEQ $2162 C2/20E3: C2 20 REP #$20 C2/20E5: A9 02 LDA #$02 C2/20E7: 09 8D ORA #$8D C2/20E9: 28 PLP C2/20EA: 3A DEC C2/20EB: E2 20 SEP #$20 C2/20ED: A5 B1 LDA $B1 C2/20EF: 89 02 BIT #$02 C2/20F1: D0 6C BNE $215F C2/20F3: AD 38 3A LDA $3A38 C2/20F6: F0 6A BEQ $2162 C2/20F8: 85 B8 STA $B8 C2/20FA: 9C 38 3A STZ $3A38 C2/20FD: 20 00 64 JSR $6400 (Zero $A0 through $AF) C2/2100: A2 06 LDX #$06 C2/2102: BD 18 30 LDA $3018,X C2/2105: 14 B8 TRB $B8 C2/2107: F0 3B BEQ $2144 C2/2109: EB XBA C2/210A: BD 19 32 LDA $3219,X C2/210D: D0 35 BNE $2144 C2/210F: BD A0 3A LDA $3AA0,X C2/2112: 89 50 BIT #$50 C2/2114: D0 2E BNE $2144 C2/2116: 4A LSR C2/2117: 90 2B BCC $2144 C2/2119: BD E4 3E LDA $3EE4,X C2/211C: 89 02 BIT #$02 (Check for Zombie status) C2/211E: D0 24 BNE $2144 C2/2120: BD F9 3E LDA $3EF9,X C2/2123: 89 20 BIT #$20 C2/2125: D0 1D BNE $2144 (Branch if hide status) C2/2127: EB XBA C2/2128: 04 B8 TSB $B8 C2/212A: 0C 39 3A TSB $3A39 C2/212D: 0C 4C 2F TSB $2F4C C2/2130: BD A1 3A LDA $3AA1,X C2/2133: 09 40 ORA #$40 C2/2135: 9D A1 3A STA $3AA1,X (Set bit 6 of $3AA1) C2/2138: BD 04 32 LDA $3204,X C2/213B: 09 40 ORA #$40 (set bit 6) C2/213D: 9D 04 32 STA $3204,X C2/2140: 20 C8 07 JSR $07C8 C2/2143: 9B TXY C2/2144: CA DEX C2/2145: CA DEX C2/2146: 10 BA BPL $2102 C2/2148: A5 B8 LDA $B8 C2/214A: F0 16 BEQ $2162 C2/214C: 64 B9 STZ $B9 C2/214E: BB TYX C2/214F: 20 C2 57 JSR $57C2 C2/2152: 20 DB 63 JSR $63DB (Copy $An variables to ($78) buffer) C2/2155: C2 20 REP #$20 (set 16-bit Accumulator) C2/2157: A9 06 22 LDA #$2206 C2/215A: 8D 28 3A STA $3A28 C2/215D: E2 20 SEP #$20 (set 8-bit Accumulator) C2/215F: 20 9E 62 JSR $629E C2/2162: 60 RTS C2/2163: F4 18 00 PEA $0018 C2/2166: 48 PHA C2/2167: 0A ASL C2/2168: A8 TAY C2/2169: 18 CLC C2/216A: 20 76 02 JSR $0276 C2/216D: 68 PLA C2/216E: A8 TAY C2/216F: B9 84 31 LDA $3184,Y C2/2172: CD 0A 34 CMP $340A C2/2175: D0 02 BNE $2179 C2/2177: A9 FF LDA #$FF C2/2179: 8D 0A 34 STA $340A C2/217C: A9 FF LDA #$FF C2/217E: 99 84 31 STA $3184,Y C2/2181: A9 01 LDA #$01 C2/2183: 04 B1 TSB $B1 C2/2185: 4C D3 13 JMP $13D3 C2/2188: A9 80 LDA #$80 C2/218A: 20 AB 5B JSR $5BAB C2/218D: BD A0 3A LDA $3AA0,X C2/2190: 89 50 BIT #$50 C2/2192: D0 76 BNE $220A C2/2194: BD A1 3A LDA $3AA1,X C2/2197: 29 7F AND #$7F (Clear bit 7) C2/2199: 09 01 ORA #$01 (Set bit 0) C2/219B: 9D A1 3A STA $3AA1,X C2/219E: 20 1C 03 JSR $031C C2/21A1: BD CC 32 LDA $32CC,X C2/21A4: 30 64 BMI $220A C2/21A6: 0A ASL C2/21A7: A8 TAY C2/21A8: B9 20 34 LDA $3420,Y C2/21AB: C9 1E CMP #$1E C2/21AD: B0 5B BCS $220A C2/21AF: 8D 6F 2D STA $2D6F C2/21B2: C9 16 CMP #$16 C2/21B4: F0 06 BEQ $21BC C2/21B6: E0 08 CPX #$08 C2/21B8: 90 2C BCC $21E6 C2/21BA: 80 4E BRA $220A C2/21BC: BD 05 32 LDA $3205,X C2/21BF: 10 49 BPL $220A C2/21C1: C2 20 REP #$20 C2/21C3: E0 08 CPX #$08 C2/21C5: B0 0C BCS $21D3 C2/21C7: A9 16 00 LDA #$0016 C2/21CA: 8D 28 3F STA $3F28 C2/21CD: B9 20 35 LDA $3520,X C2/21D0: 8D 2A 3F STA $3F2A C2/21D3: BD 18 30 LDA $3018,X C2/21D6: 0C 2C 3F TSB $3F2C C2/21D9: E2 20 SEP #$20 C2/21DB: BD F9 3E LDA $3EF9,X C2/21DE: 09 20 ORA #$20 C2/21E0: 9D F9 3E STA $3EF9,X (Set Hide Status) C2/21E3: 20 26 5D JSR $5D26 C2/21E6: 20 39 26 JSR $2639 C2/21E9: 20 00 64 JSR $6400 (Zero $A0 through $AF) C2/21EC: C2 20 REP #$20 C2/21EE: B9 20 35 LDA $3520,Y C2/21F1: 85 B8 STA $B8 C2/21F3: E2 20 SEP #$20 C2/21F5: A9 0C LDA #$0C C2/21F7: 8D 6E 2D STA $2D6E C2/21FA: A9 FF LDA #$FF C2/21FC: 8D 72 2D STA $2D72 C2/21FF: 20 C2 57 JSR $57C2 C2/2202: 20 DB 63 JSR $63DB (Copy $An variables to ($78) buffer) C2/2205: A9 04 LDA #$04 C2/2207: 20 11 64 JSR $6411 C2/220A: 4C 19 00 JMP $0019 Determine if attack hits C2/220D: 48 PHA C2/220E: DA PHX C2/220F: 18 CLC C2/2210: 08 PHP C2/2211: E2 20 SEP #$20 C2/2213: 64 FE STZ $FE C2/2215: A5 B3 LDA $B3 C2/2217: 10 1C BPL $2235 (Skip Clear check if bit 7 of $B3 not set) C2/2219: B9 E4 3E LDA $3EE4,Y C2/221C: 89 10 BIT #$10 (Check for Clear status) C2/221E: F0 15 BEQ $2235 (Branch if not vanished) C2/2220: AD A4 11 LDA $11A4 C2/2223: 0A ASL C2/2224: 30 07 BMI $222D (Branch if L.X spell) C2/2226: AD A2 11 LDA $11A2 C2/2229: 4A LSR C2/222A: 4C B3 22 JMP $22B3 (If physical attack then miss, otherwise hit) C2/222D: B9 FC 3D LDA $3DFC,Y C2/2230: 09 10 ORA #$10 C2/2232: 99 FC 3D STA $3DFC,Y (mark Clear status to be cleared. that way, it'll still be removed even if the attack misses and C2/4406, which is what normally removes Clear, is skipped.) C2/2235: AD A3 11 LDA $11A3 C2/2238: 89 02 BIT #$02 (Check for not reflectable) C2/223A: D0 0F BNE $224B (Branch if ^) C2/223C: B9 F8 3E LDA $3EF8,Y C2/223F: 10 0A BPL $224B (Branch if target does not have Reflect) C2/2241: C2 20 REP #$20 (set 16-bit accumulator) C2/2243: B9 18 30 LDA $3018,Y C2/2246: 04 A6 TSB $A6 (turn on target in "reflected off of" byte?) C2/2248: 4C E5 22 JMP $22E5 (Always miss if target has Reflect) C2/224B: AD A2 11 LDA $11A2 C2/224E: 89 02 BIT #$02 (Check for spell miss if death prot.) C2/2250: F0 07 BEQ $2259 (Branch if not ^) C2/2252: B9 A1 3A LDA $3AA1,Y C2/2255: 89 04 BIT #$04 C2/2257: D0 5C BNE $22B5 (Always miss if Prot. from death) C2/2259: AD A2 11 LDA $11A2 C2/225C: 89 04 BIT #$04 (Check for hit only (dead XOR undead) targets) C2/225E: F0 08 BEQ $2268 C2/2260: B9 E4 3E LDA $3EE4,Y C2/2263: 59 95 3C EOR $3C95,Y (death status XOR undead attribute) C2/2266: 10 4D BPL $22B5 (If neither or both of above set, then miss) C2/2268: A5 B5 LDA $B5 C2/226A: C9 00 CMP #$00 C2/226C: F0 04 BEQ $2272 (Branch if command is Fight) C2/226E: C9 06 CMP #$06 C2/2270: D0 2F BNE $22A1 (Branch if command not Capture) C2/2272: AD A9 11 LDA $11A9 C2/2275: D0 2A BNE $22A1 (Branch if has special effect) C2/2277: AD C9 3E LDA $3EC9 C2/227A: C9 01 CMP #$01 C2/227C: D0 23 BNE $22A1 (branch if # of targets isn't 1) C2/227E: C0 08 CPY #$08 C2/2280: B0 1F BCS $22A1 (Branch if target is monster) C2/2282: B9 F9 3E LDA $3EF9,Y C2/2285: 0A ASL C2/2286: 10 0B BPL $2293 (Branch if not dog block) C2/2288: 20 53 4B JSR $4B53 (0 or 1) C2/228B: 90 06 BCC $2293 (50% chance) C2/228D: A9 40 LDA #$40 C2/228F: 85 FE STA $FE (set dog block animation flag) C2/2291: 80 22 BRA $22B5 (Miss) C2/2293: AD 36 3A LDA $3A36 C2/2296: 0D 37 3A ORA $3A37 C2/2299: F0 06 BEQ $22A1 (Branch if no Golem) C2/229B: A9 20 LDA #$20 C2/229D: 85 FE STA $FE (set golem block animation flag) C2/229F: 80 14 BRA $22B5 (Miss) C2/22A1: AD A4 11 LDA $11A4 C2/22A4: 89 20 BIT #$20 (Check for can't be dodged) C2/22A6: D0 40 BNE $22E8 (Always hit if can't be dodged) C2/22A8: 89 40 BIT #$40 C2/22AA: D0 40 BNE $22EC (Check if hit for L? Spells) C2/22AC: 89 10 BIT #$10 C2/22AE: F0 4B BEQ $22FB (Check if hit if Stamina not involved?) C2/22B0: 20 9C 23 JSR $239C (Check if hit if Stamina involved?) C2/22B3: 90 33 BCC $22E8 (branch if hits) C2/22B5: B9 E4 3E LDA $3EE4,Y C2/22B8: 89 1A BIT #$1A (Check target for Clear, M-Tek, or Zombie) C2/22BA: D0 15 BNE $22D1 (Always miss if ^) C2/22BC: C0 08 CPY #$08 (Check if target is monster) C2/22BE: B0 11 BCS $22D1 (Always miss if ^) C2/22C0: 20 BF 23 JSR $23BF (Determine miss animation) C2/22C3: C9 06 CMP #$06 C2/22C5: 90 0A BCC $22D1 (Always miss) C2/22C7: A2 03 LDX #$03 C2/22C9: 9E AA 11 STZ $11AA,X (Clear all status setting effects of attack) C2/22CC: CA DEX C2/22CD: 10 FA BPL $22C9 C2/22CF: 80 17 BRA $22E8 (Always hit) C2/22D1: A9 02 LDA #$02 C2/22D3: 04 B2 TSB $B2 (Set no critical and ignore True Knight) C2/22D5: 9C 89 3A STZ $3A89 (turn off random weapon spellcast) C2/22D8: AD 1C 34 LDA $341C C2/22DB: F0 08 BEQ $22E5 C2/22DD: C2 20 REP #$20 C2/22DF: B9 18 30 LDA $3018,Y C2/22E2: 0C 5A 3A TSB $3A5A (Set target as missed) C2/22E5: 28 PLP C2/22E6: 38 SEC (Makes attack miss) C2/22E7: 08 PHP C2/22E8: 28 PLP C2/22E9: FA PLX C2/22EA: 68 PLA C2/22EB: 60 RTS Determines if attack hits for L? spells C2/22EC: AE A8 11 LDX $11A8 (Hit Rate) C2/22EF: 7B TDC C2/22F0: B9 18 3B LDA $3B18,Y (Level) C2/22F3: 20 92 47 JSR $4792 (Division) C2/22F6: 8A TXA C2/22F7: D0 D8 BNE $22D1 (Always miss) C2/22F9: 80 ED BRA $22E8 (Always Hit) Determines if attack hits C2/22FB: F4 40 80 PEA $8040 (Sleep, Petrify) C2/22FE: F4 10 02 PEA $0210 (Freeze, Stop) C2/2301: 20 64 58 JSR $5864 C2/2304: 90 E2 BCC $22E8 (Always hit if any set) C2/2306: C2 20 REP #$20 C2/2308: B9 18 30 LDA $3018,Y C2/230B: 2C 54 3A BIT $3A54 C2/230E: E2 20 SEP #$20 C2/2310: D0 D6 BNE $22E8 (Always hit) C2/2312: AD A8 11 LDA $11A8 (Hit Rate) C2/2315: C9 FF CMP #$FF C2/2317: F0 CF BEQ $22E8 (Automatically hit if Hit Rate is 255) C2/2319: 85 EE STA $EE C2/231B: AD A2 11 LDA $11A2 C2/231E: 4A LSR C2/231F: 90 1E BCC $233F (If Magic attack then skip this next code) C2/2321: B9 4C 3E LDA $3E4C,Y C2/2324: 4A LSR (Check for retort) C2/2325: B0 C1 BCS $22E8 (Always hits) C2/2327: B9 E5 3E LDA $3EE5,Y (Check for image status) C2/232A: 89 04 BIT #$04 -------------------------------------------------- (Original Code) C2/232C: F0 11 BEQ $233F (Branch if not Image status) C2/232E: 20 5A 4B JSR $4B5A C2/2331: C9 40 CMP #$40 (1 in 4 chance clear Image status) C2/2333: B0 9C BCS $22D1 (Always misses) C2/2335: B9 FD 3D LDA $3DFD,Y C2/2338: 09 04 ORA #$04 C2/233A: 99 FD 3D STA $3DFD,Y (Clear Image status) C2/233D: 80 92 BRA $22D1 (Always misses) C2/233F: B9 54 3B LDA $3B54,Y (255 - Evade * 2 + 1) C2/2342: B0 03 BCS $2347 C2/2344: B9 55 3B LDA $3B55,Y (255 - MBlock * 2 + 1) C2/2347: 48 PHA C2/2348: 90 3E BCC $2388 (Evade Patch Applied) C2/232C: F0 17 BEQ $2345 (Branch if not Image status) C2/232E: 20 5A 4B JSR $4B5A C2/2331: C9 40 CMP #$40 (1 in 4 chance clear Image status) C2/2333: B0 9C BCS $22D1 (Always misses) C2/2335: B9 FD 3D LDA $3DFD,Y C2/2338: 09 04 ORA #$04 C2/233A: 99 FD 3D STA $3DFD,Y (Clear Image status) C2/233D: 80 92 BRA $22D1 (Always misses) C2/233F: B9 55 3B LDA $3B55,Y (255 - MBlock * 2 + 1) C2/2342: 48 PHA C2/2343: 80 43 BRA $2388 C2/2345: B9 54 3B LDA $3B54,Y (255 - Evade * 2 + 1) C2/2348: 48 PHA C2/2349: EA NOP ------------------------------------------------- C2/234A: BD E4 3E LDA $3EE4,X C2/234D: 4A LSR C2/234E: 90 02 BCC $2352 (Branch if not blinded [Dark status]) C2/2350: 46 EE LSR $EE (Cut hit rate in half) C2/2352: B9 58 3C LDA $3C58,Y C2/2355: 89 04 BIT #$04 C2/2357: F0 02 BEQ $235B (Branch if no beads) C2/2359: 46 EE LSR $EE (Cut hit rate in half) C2/235B: F4 03 20 PEA $2003 (Muddled, Dark, Zombie) C2/235E: F4 04 04 PEA $0404 (Life 3, Slow) C2/2361: 20 64 58 JSR $5864 C2/2364: B0 0C BCS $2372 (Branch if none set) C2/2366: A5 EE LDA $EE C2/2368: 4A LSR C2/2369: 4A LSR C2/236A: 65 EE ADC $EE (Adds 1/4 to hit rate) C2/236C: 90 02 BCC $2370 C2/236E: A9 FF LDA #$FF C2/2370: 85 EE STA $EE C2/2372: F4 04 42 PEA $4204 (Seizure, Near Fatal, Poison) C2/2375: F4 08 00 PEA $0008 (Haste) C2/2378: 20 64 58 JSR $5864 C2/237B: B0 0B BCS $2388 (Branch if none set) C2/237D: A5 EE LDA $EE C2/237F: 46 EE LSR $EE C2/2381: 46 EE LSR $EE C2/2383: 38 SEC C2/2384: E5 EE SBC $EE (Subtracts 1/4 from hit rate) C2/2386: 85 EE STA $EE C2/2388: 68 PLA C2/2389: EB XBA C2/238A: A5 EE LDA $EE (Hit Rate) C2/238C: 20 81 47 JSR $4781 (Multiply Evade/Mblock * Hit Rate) C2/238F: EB XBA C2/2390: 85 EE STA $EE (High byte of Evade/Mblock * Hit Rate) C2/2392: A9 64 LDA #$64 C2/2394: 20 65 4B JSR $4B65 (Random number 0 to 99) C2/2397: C5 EE CMP $EE C2/2399: 4C B3 22 JMP $22B3 Check if hit if Stamina involved C2/239C: B9 55 3B LDA $3B55,Y (MBlock) C2/239F: EB XBA C2/23A0: AD A8 11 LDA $11A8 (Hit Rate) C2/23A3: 20 81 47 JSR $4781 (Multiplication Function) C2/23A6: EB XBA C2/23A7: 85 EE STA $EE (High byte of Mblock * Hit Rate) C2/23A9: A9 64 LDA #$64 C2/23AB: 20 65 4B JSR $4B65 (Random Number 0 to 99) C2/23AE: C5 EE CMP $EE C2/23B0: B0 0C BCS $23BE (Attack misses, so exit) C2/23B2: 20 5A 4B JSR $4B5A (Random Number 0 to 255) C2/23B5: 29 7F AND #$7F (0 to 127) C2/23B7: 85 EE STA $EE C2/23B9: B9 40 3B LDA $3B40,Y (Stamina) C2/23BC: C5 EE CMP $EE C2/23BE: 60 RTS Dog/Golem/Equipment miss check C2/23BF: 5A PHY C2/23C0: AD A2 11 LDA $11A2 C2/23C3: 4A LSR C2/23C4: B0 01 BCS $23C7 (Branch if physical attack) C2/23C6: C8 INY (if it was magical, read from 3CE5,old_Y instead) C2/23C7: 7B TDC C2/23C8: B9 E4 3C LDA $3CE4,Y (shield/weapon miss animations) C2/23CB: 05 FE ORA $FE (miss due to Interceptor/Golem) C2/23CD: F0 1C BEQ $23EB (Exit function if none of above) C2/23CF: 20 2A 52 JSR $522A (Pick a random bit that is set) C2/23D2: 89 40 BIT #$40 C2/23D4: F0 03 BEQ $23D9 (Branch if no dog protection) C2/23D6: 8C 83 3A STY $3A83 (save character target in "Dog blocked" byte) C2/23D9: 89 20 BIT #$20 C2/23DB: F0 03 BEQ $23E0 (Branch if no Golem protection) C2/23DD: 8C 82 3A STY $3A82 (save character target in "Golem blocked" byte) C2/23E0: 20 F0 51 JSR $51F0 (X = position of highest [and only] bit that is set) C2/23E3: 98 TYA C2/23E4: 4A LSR C2/23E5: A8 TAY (Y = Y DIV 2, so it won't matter if Y was incremented above. it now holds a 0-3 character #) C2/23E6: 8A TXA C2/23E7: 1A INC C2/23E8: 99 AA 00 STA $00AA,Y (save the dodge animation type for this character?) C2/23EB: 7A PLY C2/23EC: 60 RTS C2/23ED: 08 PHP C2/23EE: C2 30 REP #$30 (Set 16-bit A, X, & Y) C2/23F0: A2 58 02 LDX #$0258 C2/23F3: 9E 20 3A STZ $3A20,X C2/23F6: 9E 7A 3C STZ $3C7A,X C2/23F9: CA DEX C2/23FA: CA DEX C2/23FB: 10 F6 BPL $23F3 C2/23FD: 7B TDC C2/23FE: 3A DEC C2/23FF: A2 0E 0A LDX #$0A0E C2/2402: 9D 00 20 STA $2000,X C2/2405: 9D 10 2A STA $2A10,X C2/2408: CA DEX C2/2409: CA DEX C2/240A: 10 F6 BPL $2402 C2/240C: 9C 44 2F STZ $2F44 C2/240F: 9C 4C 2F STZ $2F4C C2/2412: 9C 4E 2F STZ $2F4E C2/2415: 9C 53 2F STZ $2F53 C2/2418: 64 B0 STZ $B0 C2/241A: 64 B2 STZ $B2 C2/241C: A2 02 26 LDX #$2602 C2/241F: A0 18 30 LDY #$3018 C2/2422: A9 1B 00 LDA #$001B C2/2424: 54 7E C2 MVN #$C2,7E C2/2427: AD 11 E0 LDA $11E0 C2/242B: C9 D7 01 CMP #$01D7 (Check for Short Arm, Long arm, Face formation) C2/242E: E2 30 SEP #$30 (Set 8-bit A, X & Y) C2/2430: D0 03 BNE $2435 C2/2432: 9C E0 3E STZ $3EE0 C2/2435: A2 13 LDX #$13 C2/2437: BD C9 1D LDA $1DC9,X C2/243A: 9D B4 3E STA $3EB4,X C2/243D: CA DEX C2/243E: 10 F7 BPL $2437 C2/2440: AD 1E 02 LDA $021E C2/2443: 0A ASL C2/2444: 0A ASL C2/2445: 85 BE STA $BE C2/2447: 20 E8 30 JSR $30E8 (Loads battle formation data) C2/244A: 20 2F 2F JSR $2F2F C2/244D: A9 80 LDA #$80 C2/244F: 1C BB 3E TRB $3EBB C2/2452: A9 91 LDA #$91 C2/2454: 1C BC 3E TRB $3EBC C2/2457: A2 12 LDX #$12 C2/2459: 20 5A 4B JSR $4B5A (0 to 255) C2/245C: 9D F0 3A STA $3AF0,X (Store random number at $3AF0,X) C2/245F: A9 BC LDA #$BC C2/2461: EC E2 3E CPX $3EE2 C2/2464: D0 02 BNE $2468 C2/2466: 09 02 ORA #$02 C2/2468: 9D 04 32 STA $3204,X C2/246B: CA DEX C2/246C: CA DEX C2/246D: 10 EA BPL $2459 C2/246F: 20 44 25 JSR $2544 C2/2472: AD 4D 1D LDA $1D4D (Battle Speed variable from user Configuration. Note that its actual value ranges from 0 to 5, but the menu choices the player sees are 1 thru 6.) C2/2475: 30 03 BMI $247A C2/2477: 9C 2E 2F STZ $2F2E C2/247A: 89 08 BIT #$08 C2/247C: F0 03 BEQ $2481 C2/247E: EE 8F 3A INC $3A8F C2/2481: 29 07 AND #$07 (bottom 3 bits of Battle Speed) C2/2483: 0A ASL C2/2484: 0A ASL C2/2485: 0A ASL C2/2486: 85 EE STA $EE (Battle Speed * 8) C2/2488: 0A ASL ('' * 16) C2/2489: 65 EE ADC $EE (Battle Speed * 24) C2/248B: 49 FF EOR #$FF C2/248D: 8D 90 3A STA $3A90 (= 255 - (Battle Speed * 24) . variable is a multiplier which is used for slowing down enemies in the Battle Time Counter Function at C2/09D2. as you can see here and from experience, a Battle Speed of zero will leave enemies the fastest) C2/2490: AD 4E 1D LDA $1D4E C2/2493: 10 03 BPL $2498 C2/2495: 9C 21 20 STZ $2021 C2/2498: 9C 41 2F STZ $2F41 C2/249B: 20 6E 54 JSR $546E C2/249E: 20 0C 58 JSR $580C C2/24A1: 20 E1 2E JSR $2EE1 C2/24A4: 20 91 43 JSR $4391 (Status effects?) C2/24A7: 20 9B 06 JSR $069B C2/24AA: A9 14 LDA #$14 C2/24AC: 8D AF 11 STA $11AF C2/24AF: 20 3F 08 JSR $083F C2/24B2: 20 B9 4A JSR $4AB9 C2/24B5: 20 3A 2E JSR $2E3A C2/24B8: 20 C9 26 JSR $26C9 C2/24BB: 20 68 2E JSR $2E68 C2/24BE: 20 75 25 JSR $2575 C2/24C1: A2 00 LDX #$00 C2/24C3: AD 4B 2F LDA $2F4B C2/24C6: 89 04 BIT #$04 C2/24C8: D0 20 BNE $24EA C2/24CA: AD 1F 20 LDA $201F (get encounter type? 0 = front, 1 = back, 2 = pincer, 3 = side) C2/24CD: C9 01 CMP #$01 C2/24CF: D0 04 BNE $24D5 (branch if not back) C2/24D1: A2 23 LDX #$23 C2/24D3: 80 15 BRA $24EA C2/24D5: C9 02 CMP #$02 C2/24D7: D0 04 BNE $24DD C2/24D9: A2 25 LDX #$25 C2/24DB: 80 0D BRA $24EA C2/24DD: C9 03 CMP #$03 C2/24DF: D0 02 BNE $24E3 C2/24E1: A2 24 LDX #$24 C2/24E3: A5 B0 LDA $B0 C2/24E5: 0A ASL C2/24E6: 10 02 BPL $24EA C2/24E8: A2 22 LDX #$22 C2/24EA: 9B TXY C2/24EB: F0 05 BEQ $24F2 C2/24ED: A9 25 LDA #$25 C2/24EF: 20 91 4E JSR $4E91 C2/24F2: 20 73 5C JSR $5C73 C2/24F5: 20 54 5C JSR $5C54 C2/24F8: 64 B8 STZ $B8 C2/24FA: 64 B9 STZ $B9 C2/24FC: A2 06 LDX #$06 C2/24FE: BD 18 30 LDA $3018,X C2/2501: 2C 2C 3F BIT $3F2C C2/2504: F0 16 BEQ $251C C2/2506: BD A0 3A LDA $3AA0,X C2/2509: 09 28 ORA #$28 C2/250B: 9D A0 3A STA $3AA0,X C2/250E: 9E 19 32 STZ $3219,X C2/2511: 20 77 4E JSR $4E77 C2/2514: A9 16 LDA #$16 C2/2516: 8D 7A 3A STA $3A7A C2/2519: 20 CB 4E JSR $4ECB C2/251C: CA DEX C2/251D: CA DEX C2/251E: 10 DE BPL $24FE C2/2520: AD E1 3E LDA $3EE1 C2/2523: 1A INC C2/2524: F0 19 BEQ $253F C2/2526: 3A DEC C2/2527: 8D 6F 2D STA $2D6F C2/252A: A9 12 LDA #$12 C2/252C: 8D 6E 2D STA $2D6E C2/252F: AD 75 3A LDA $3A75 C2/2532: 8D 71 2D STA $2D71 C2/2535: A9 FF LDA #$FF C2/2537: 8D 70 2D STA $2D70 C2/253A: 8D 72 2D STA $2D72 C2/253D: A9 04 LDA #$04 C2/253F: 20 11 64 JSR $6411 C2/2542: 28 PLP C2/2543: 60 RTS C2/2544: 20 51 55 JSR $5551 C2/2547: A2 06 LDX #$06 C2/2549: BD D8 3E LDA $3ED8,X (Which character it is) C2/254C: 30 22 BMI $2570 (Branch if monster?) C2/254E: C9 10 CMP #$10 C2/2550: B0 05 BCS $2557 C2/2552: A8 TAY C2/2553: 8A TXA C2/2554: 99 00 30 STA $3000,Y C2/2557: BD 18 30 LDA $3018,X C2/255A: 0C 8D 3A TSB $3A8D C2/255D: BD D9 3E LDA $3ED9,X C2/2560: 22 77 0E C2 JSR $C20E77 C2/2564: 20 6D 28 JSR $286D C2/2567: 20 A8 27 JSR $27A8 C2/256A: 20 8D 56 JSR $568D C2/256D: 20 2C 53 JSR $532C C2/2570: CA DEX C2/2571: CA DEX C2/2572: 10 D5 BPL $2549 C2/2574: 60 RTS C2/2575: 08 PHP C2/2576: 64 F3 STZ $F3 C2/2578: A0 12 LDY #$12 C2/257A: B9 A0 3A LDA $3AA0,Y C2/257D: 4A LSR C2/257E: B0 07 BCS $2587 C2/2580: 18 CLC C2/2581: A9 10 LDA #$10 C2/2583: 65 F3 ADC $F3 C2/2585: 85 F3 STA $F3 C2/2587: 88 DEY C2/2588: 88 DEY C2/2589: 10 EF BPL $257A C2/258B: C2 20 REP #$20 (Set 16-bit accumulator) C2/258D: A9 FF 03 LDA #$03FF C2/2590: 85 F0 STA $F0 C2/2592: A0 12 LDY #$12 C2/2594: A5 F0 LDA $F0 C2/2596: 20 2A 52 JSR $522A C2/2599: 14 F0 TRB $F0 C2/259B: 20 F0 51 JSR $51F0 C2/259E: E2 20 SEP #$20 (Set 8-bit accumulator) C2/25A0: 8A TXA C2/25A1: 0A ASL C2/25A2: 0A ASL C2/25A3: 0A ASL C2/25A4: 85 F2 STA $F2 C2/25A6: B9 19 32 LDA $3219,Y C2/25A9: 1A INC C2/25AA: D0 4E BNE $25FA C2/25AC: AD E1 3E LDA $3EE1 C2/25AF: 1A INC C2/25B0: D0 48 BNE $25FA C2/25B2: AE 1F 20 LDX $201F (get encounter type? 0 = front, 1 = back, 2 = pincer, 3 = side) C2/25B5: B9 18 30 LDA $3018,Y C2/25B8: 2C 40 3A BIT $3A40 C2/25BB: D0 14 BNE $25D1 C2/25BD: C0 08 CPY #$08 C2/25BF: B0 10 BCS $25D1 C2/25C1: A5 B0 LDA $B0 C2/25C3: 0A ASL C2/25C4: 30 34 BMI $25FA C2/25C6: CA DEX (decrement encounter type) C2/25C7: 30 15 BMI $25DE (if front, branch) C2/25C9: CA DEX C2/25CA: CA DEX C2/25CB: F0 2D BEQ $25FA (if pincer, branch) C2/25CD: A5 F2 LDA $F2 C2/25CF: 80 22 BRA $25F3 C2/25D1: A5 B0 LDA $B0 C2/25D3: 0A ASL C2/25D4: 30 04 BMI $25DA C2/25D6: E0 03 CPX #$03 C2/25D8: D0 04 BNE $25DE C2/25DA: A9 01 LDA #$01 C2/25DC: 80 15 BRA $25F3 C2/25DE: B9 19 3B LDA $3B19,Y C2/25E1: 20 65 4B JSR $4B65 C2/25E4: 79 19 3B ADC $3B19,Y C2/25E7: B0 08 BCS $25F1 C2/25E9: 65 F2 ADC $F2 C2/25EB: B0 04 BCS $25F1 C2/25ED: 65 F3 ADC $F3 C2/25EF: 90 02 BCC $25F3 C2/25F1: A9 FF LDA #$FF C2/25F3: 1A INC C2/25F4: D0 01 BNE $25F7 C2/25F6: 3A DEC C2/25F7: 99 19 32 STA $3219,Y C2/25FA: C2 20 REP #$20 C2/25FC: 88 DEY C2/25FD: 88 DEY C2/25FE: 10 94 BPL $2594 C2/2600: 28 PLP C2/2601: 60 RTS Data to load into $3018 and $3019 C2/2602: 01 00 C2/2604: 02 00 C2/2606: 04 00 C2/2608: 08 00 C2/260A: 00 01 C2/260C: 00 02 C2/260E: 00 04 C2/2610: 00 08 C2/2612: 00 10 C2/2614: 00 20 Data C2/2616: 8E C2/2617: 20 C2/2618: CA C2/2619: 21 C2/261A: 06 C2/261B: 23 C2/261C: 42 C2/261D: 24 C2/261E: 7B TDC C2/261F: A2 5F LDX #$5F C2/2621: 9D E4 3E STA $3EE4,X C2/2624: CA DEX C2/2625: 10 FA BPL $2621 C2/2627: 3A DEC C2/2628: A2 0F LDX #$0F C2/262A: 9D D4 3E STA $3ED4,X C2/262D: CA DEX C2/262E: 10 FA BPL $262A C2/2630: A9 12 LDA #$12 C2/2632: 8D 28 3F STA $3F28 C2/2635: 8D 24 3F STA $3F24 C2/2638: 60 RTS C2/2639: 08 PHP C2/263A: 9C 72 3A STZ $3A72 C2/263D: 9C 70 3A STZ $3A70 C2/2640: C2 20 REP #$20 C2/2642: 9C 32 3A STZ $3A32 C2/2645: 9C 34 3A STZ $3A34 C2/2648: 9C 30 3A STZ $3A30 C2/264B: 9C 4E 3A STZ $3A4E C2/264E: 28 PLP C2/264F: 60 RTS (Turn Death immunity into Instant Death protection by moving it into another byte; otherwise you'd be bloody immortal. If the Poison elemental is nullified, make immune to Poison status.) C2/2650: BD A1 3A LDA $3AA1,X C2/2653: 29 FB AND #$FB (Clear protection from "instant death") C2/2655: EB XBA C2/2656: BD 1C 33 LDA $331C,X (Blocked status byte 1) C2/2659: 30 06 BMI $2661 (Branch if not block death) C2/265B: 09 80 ORA #$80 (Clear block death) C2/265D: EB XBA C2/265E: 09 04 ORA #$04 (Set protection from "instant death") C2/2660: EB XBA C2/2661: EB XBA C2/2662: 9D A1 3A STA $3AA1,X C2/2665: BD CD 3B LDA $3BCD,X (Nullified elements) C2/2668: 89 08 BIT #$08 C2/266A: F0 04 BEQ $2670 (Branch if not nullify poison) C2/266C: EB XBA C2/266D: 29 FB AND #$FB (Set block poison status if) C2/266F: EB XBA C2/2670: EB XBA C2/2671: 9D 1C 33 STA $331C,X C2/2674: 60 RTS (Make some monster or equipment statuses permanent by setting immunity to them: Mute, Berserk, Muddled, Seizure, Regen, Slow, Haste, Shell, Safe, Reflect, Float * * If Float is only marked in Monster status byte 4, it won't be permanent [not to worry; no actual monsters do this]. Then if you're immune to one status in a "mutually exclusive" pair, make immune to the other. The pairs are Slow/Haste and Seizure/Regen.) C2/2675: BD 31 33 LDA $3331,X C2/2678: EB XBA (put blocked status byte 4 in top of A) C2/2679: BD 6D 3C LDA $3C6D,X (monster/equip status byte 3) C2/267C: 4A LSR C2/267D: 90 04 BCC $2683 (if perm-float (aka dance) wasn't set, branch) C2/267F: EB XBA C2/2680: 29 7F AND #$7F C2/2682: EB XBA (if it^ was, then block float. thus the permanence) C2/2683: AD BB 3E LDA $3EBB C2/2686: 89 04 BIT #$04 C2/2688: F0 04 BEQ $268E (branch if we're not in Phunbaba battle #4 [iow, Terra's second Phunbaba meeting]) C2/268A: EB XBA C2/268B: 29 F7 AND #$F7 (if we are, give immunity to Morph to make it permanent) C2/268D: EB XBA C2/268E: EB XBA C2/268F: 9D 31 33 STA $3331,X (update blocked status #4) C2/2692: BD 30 33 LDA $3330,X C2/2695: EB XBA C2/2696: BD 1D 33 LDA $331D,X (A.top=blocked status byte 3, A.btm=blocked status #2) C2/2699: C2 20 REP #$20 C2/269B: 85 EE STA $EE C2/269D: BD 6C 3C LDA $3C6C,X (monster/equip status bytes 2-3) C2/26A0: 29 78 EE AND #$EE78 (Dance, Stop, Sleep, Condemned, Near Fatal, Image will all be 0) C2/26A3: 49 FF FF EOR #$FFFF (now they'll all be 1) C2/26A6: 25 EE AND $EE (SO Blocked Statuses = what you were blocking before, plus whatever the enemy/equip has. with the exception of the above.. which will only be blocked if they were before) C2/26A8: 89 00 02 BIT #$0200 C2/26AB: F0 05 BEQ $26B2 (if Regen blocked, branch) C2/26AD: 89 40 00 BIT #$0040 C2/26B0: D0 03 BNE $26B5 (if Seizure isn't blocked, branch) C2/26B2: 29 BF FD AND #$FDBF (SO if either Regen or Seizure is blocked, block both. should explain Regen failing on Ribbon) C2/26B5: E2 20 SEP #$20 C2/26B7: 9D 1D 33 STA $331D,X (update blocked status byte #2. we'll update byte #3 below.) C2/26BA: EB XBA (now examine #3) C2/26BB: 89 04 BIT #$04 C2/26BD: F0 04 BEQ $26C3 (if Slow blocked, branch) C2/26BF: 89 08 BIT #$08 C2/26C1: D0 02 BNE $26C5 (if Haste isn't blocked, branch) C2/26C3: 29 F3 AND #$F3 (SO if either Slow or Haste is blocked, block 'em both. should explain Slow failing on RunningShoes) C2/26C5: 9D D0 33 STA $3330,X (update blocked status byte #3) C2/26C8: 60 RTS C2/26C9: A2 12 LDX #$12 (start from 6th enemy) C2/26CB: 20 75 26 JSR $2675 C2/26CE: CA DEX C2/26CF: CA DEX C2/26D0: 10 F9 BPL $26CB (and do function 2675 for everybody in the battle) C2/26D2: 60 RTS When called: A Low = $B5 A High = $B6 (or in some cases like Tools, $B6 appears to hold just the 0-7 Tool index rather than the item #. some of the Item code indirectly puts $3A7D in top of A, and i believe that holds the full item number.) C2/26D3: DA PHX C2/26D4: 5A PHY C2/26D5: 48 PHA C2/26D6: 64 BA STZ $BA C2/26D8: A2 40 LDX #$40 C2/26DA: 86 BB STX $BB C2/26DC: A2 00 LDX #$00 C2/26DE: C9 1E CMP #$1E C2/26E0: B0 1F BCS $2701 (branch if command >= 1Eh?) C2/26E2: AA TAX C2/26E3: BF 8A 27 C2 LDA $C2278A,X (get miscellaneous Command properties byte) C2/26E7: 48 PHA C2/26E8: 29 E1 AND #$E1 (isolate Abort on Characters, Randomize Target, beat on corpses if no valid targets left, and Exclude Attacker From Targets properties) C2/26EA: 85 BA STA $BA C2/26EC: A3 01 LDA $01,S C2/26EE: 29 18 AND #$18 (now check what will become Can Target Dead/Hidden Entities and Don't Retarget if Target Invalid) C2/26F0: 4A LSR C2/26F1: 04 BA TSB $BA C2/26F3: 8A TXA C2/26F4: 0A ASL C2/26F5: AA TAX (multiply command number by 2) C2/26F6: BF 01 FE CF LDA $CFFE01,X C2/26FA: 85 BB STA $BB (get the command's targeting from some table) C2/26FC: 68 PLA C2/26FD: 29 06 AND #$06 (two second lowest bits from C2/278A determine what function to call next) C2/26FF: AA TAX C2/2700: EB XBA (now get spell # or miscellaneous index.. ex- it might indicate the item Number) C2/2701: FC 82 27 JSR ($2782,X) C2/2704: 68 PLA C2/2705: 7A PLY C2/2706: FA PLX C2/2707: 60 RTS C2/2708: A2 04 LDX #$04 C2/270A: DF 78 27 C2 CMP $C22778,X (is the tool or skean one that uses a spell?) C2/270E: D0 06 BNE $2716 (if not, branch) C2/2710: FF 7D 27 C2 SBC $C2277D,X (if yes, subtract constant to determine its spell number) C2/2714: 80 37 BRA $274D (see, certain Tools and Skeans just load spells to do their work) (Bio Blaster will use spell 7D, Bio Blast Flash will use spell 7E, Flash Fire Skean will use spell 51h, Fire Skean Water Edge will use spell 52, Water Edge Bolt Edge will use spell 53, Bolt Edge ) C2/2716: CA DEX C2/2717: 10 F1 BPL $270A (loop 5 times, provided we didn't jump out of the loop) C2/2719: 38 SEC (set Carry.. for check at C2/18BD ??) C2/271A: 8D 11 34 STA $3411 C2/271D: 20 63 2B JSR $2B63 (Multiply A by 30) C2/2720: C2 10 REP #$10 (Set 16-bit X and Y) C2/2722: AA TAX C2/2723: BF 0E 50 D8 LDA $D8500E,X (Targeting byte) C2/2727: 85 BB STA $BB C2/2729: BF 15 50 D8 LDA $D85015,X (Condition 1 when Item used) C2/272D: 89 C2 BIT #$C2 C2/272F: D0 04 BNE $2735 (Branch if Death, Zombie, or Petrify set) C2/2731: A9 08 LDA #$08 C2/2733: 14 BA TRB $BA (Clear Can Target Dead/Hidden Entities) C2/2735: BF 12 50 D8 LDA $D85012,X (equipment spell byte. Bits 0-5: spell # Bit 6: cast randomly after weapon strike [handled elsewhere, shouldn't apply here] Bit 7: 1 = remove from inventory upon usage, 0 = nope) C2/2739: E2 10 SEP #$10 (Set 8-bit X and Y) C2/273B: 60 RTS C2/273C: C9 E6 CMP #$E6 (Carry is set if item # >= 230, Sprint Shoes? i.e. it's Item type. Carry won't be set for Equipment Magic) C2/273E: 20 1A 27 JSR $271A C2/2741: B0 C4 BCS $2707 (if it's a plain ol' Item, always deduct from inventory, and don't attempt to save the [meaningless] spell # or load spell data) C2/2743: 30 06 BMI $274B (branch if equipment gets used up when used for Item Magic. i'm not aware of any equipment this *doesn't* happen with, though the game supports it.) C2/2745: EB XBA C2/2746: A9 10 LDA #$10 C2/2748: 04 B1 TSB $B1 (set "don't deplete from Item inventory" flag) C2/274A: EB XBA C2/274B: 29 3F AND #$3F (isolate spell # cast by weapon?) C2/274D: 8D 10 34 STA $3410 C2/2750: 80 02 BRA $2754 (load spell data for equipment magic) C2/2752: A9 EE LDA #$EE (select Spell EEh - Battle) C2/2754: 20 66 29 JSR $2966 (go load spell data) C2/2757: A5 BB LDA $BB (targeting byte as read from $CFFE01 table?) C2/2759: 1A INC C2/275A: D0 05 BNE $2761 (branch if it wasn't FF.. if it was, it's null, so we use the spell byte instead) C2/275C: AD A0 11 LDA $11A0 (spell aiming byte) C2/275F: 85 BB STA $BB C2/2761: AD A2 11 LDA $11A2 C2/2764: 48 PHA C2/2765: 29 04 AND #$04 (Isolate bit 2. This spell bit is used for two properties: Bit 2 of $11A2 will be "Hit only (dead XOR undead) targets", and Bit 3 of $BA will be "Can Target Dead/Hidden entities".) C2/2767: 0A ASL C2/2768: 04 BA TSB $BA (Sets Can Target Dead/Hidden entities) C2/276A: A3 01 LDA $01,S (get $11A2 again) C2/276C: 29 10 AND #$10 (Randomize target) C2/276E: 0A ASL C2/276F: 0A ASL C2/2770: 04 BA TSB $BA (Sets randomize target) C2/2772: 68 PLA (get $11A2 again) C2/2773: 29 80 AND #$80 (Abort on characters) C2/2775: 04 BA TSB $BA (Sets abort on characters) C2/2777: 60 RTS (Data - item numbers of Tools and Skeans that use spells to do a good chunk of their work) C2/2778: A4 (Bio Blaster) C2/2779: A5 (Flash) C2/277A: AB (Fire Skean) C2/277B: AC (Water Edge) C2/277C: AD (Bolt Edge) (Data - constants we subtract from the above item #s to get the numbers of the spells they rely on) C2/277D: 27 C2/277E: 27 C2/277F: 5A C2/2780: 5A C2/2781: 5A Code Pointers (indexed by bits 1 and 2 of data values below) C2/2782: 52 27 (Fight, Morph, Revert, Steal, Capture, Runic, Sketch, Control, Leap, Mimic, Row, Def, Jump, GP Rain, Possess) C2/2784: 3C 27 (Item) C2/2786: 4D 27 (Magic, SwdTech, Blitz, Lore, Slot, Rage, Dance, X-Magic, Summon, Health, Shock, MagiTek) C2/2788: 08 27 (Throw, Tools) (Data - indexed by command # 0 thru 1Dh?) C2/278A: 20 (Fight) C2/278B: 1A (Item) C2/278C: 04 (Magic) C2/278D: 18 (Morph) C2/278E: 18 (Revert) C2/278F: 00 (Steal) C2/2790: 20 (Capture) C2/2791: 24 (SwdTech) C2/2792: 06 (Throw) C2/2793: 06 (Tools) C2/2794: 04 (Blitz) C2/2795: 18 (Runic) C2/2796: 04 (Lore) C2/2797: 80 (Sketch) C2/2798: 80 (Control) C2/2799: 04 (Slot) C2/279A: 04 (Rage) C2/279B: 80 (Leap) C2/279C: 18 (Mimic) C2/279D: 04 (Dance) C2/279E: 18 (Row) C2/279F: 18 (Def) C2/27A0: 21 (Jump) C2/27A1: 04 (X-Magic) C2/27A2: 01 (GP Rain) C2/27A3: 04 (Summon) C2/27A4: 04 (Health) C2/27A5: 04 (Shock) C2/27A6: 81 (Possess) C2/27A7: 04 (MagiTek) C2/27A8: 08 PHP C2/27A9: C2 30 REP #$30 (Set 16-bit Accumulator & Index Registers) C2/27AB: BC 10 30 LDY $3010,X (get offset to character info block) C2/27AE: B9 09 16 LDA $1609,Y (get current HP) C2/27B1: 9D F4 3B STA $3BF4,X (HP) C2/27B4: B9 0D 16 LDA $160D,Y (get current MP) C2/27B7: 9D 08 3C STA $3C08,X (MP) C2/27BA: B9 0B 16 LDA $160B,Y (get maximum HP) C2/27BD: 20 3C 28 JSR $283C (get max HP after equipment/relic boosts) C2/27C0: C9 10 27 CMP #$2710 C2/27C3: 90 03 BCC $27C8 C2/27C5: A9 0F 27 LDA #$270F (if it was >= 10000, make it 9999) C2/27C8: 9D 1C 3C STA $3C1C,X (Max HP) C2/27CB: B9 0F 16 LDA $160F,Y (get maximum MP) C2/27CE: 20 3C 28 JSR $283C (get max MP after equipment/relic boosts) C2/27D1: C9 E8 03 CMP #$03E8 C2/27D4: 90 03 BCC $27D9 C2/27D6: A9 E7 03 LDA #$03E7 (if it was >= 1000, make it 999) C2/27D9: 9D 30 3C STA $3C30,X (Max MP) C2/27DC: BD 18 30 LDA $3018,X C2/27DF: 24 B8 BIT $B8 C2/27E1: F0 15 BEQ $27F8 C2/27E3: BD 1C 3C LDA $3C1C,X (Max HP) C2/27E6: 9D F4 3B STA $3BF4,X (HP) C2/27E9: BD 30 3C LDA $3C30,X (Max MP) C2/27EC: 9D 08 3C STA $3C08,X (MP) C2/27EF: B9 14 16 LDA $1614,Y (outside battle statuses 1-2? from tashibana doc) (^ statuses correspond to in-battle statuses 1+4) C2/27F2: 29 2D FF AND #$FF2D C2/27F5: 99 14 16 STA $1614,Y (remove Clear, Petrify, death, zombie.. Colosseum related?) C2/27F8: BD 6C 3C LDA $3C6C,X (monster/equip status bytes 2-3) C2/27FB: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/27FD: 9D D5 3D STA $3DD5,X (Status to set byte 2) C2/2800: 4A LSR C2/2801: 90 08 BCC $280B (branch if Condemned not marked to be set) C2/2803: BD 04 32 LDA $3204,X C2/2806: 29 EF AND #$EF C2/2808: 9D 04 32 STA $3204,X (^ if it is going to be set, then turn off Bit 4) C2/280B: B9 14 16 LDA $1614,Y C2/280E: 9D D4 3D STA $3DD4,X (Status to set byte 1) C2/2811: 89 08 BIT #$08 C2/2813: F0 0A BEQ $281F (If not set M-Tek) C2/2815: A9 1D LDA #$1D C2/2817: 8D 20 3F STA $3F20 (save MagiTek as default last command for Mimic) C2/281A: A9 83 LDA #$83 C2/281C: 8D 21 3F STA $3F21 (save Fire Beam as default last attack for Mimic) (if Gogo uses Mimic before any other character acts in a battle, he'll normally use Fight. all i can figure is that this code is here to make him use Fire Beam instead should anybody be found to be wearing MagiTek armor -- in the normal game, we can assume that if anybody's in armor, everybody [including Gogo] is in it.) C2/281F: B9 15 16 LDA $1615,Y (outside battle status 2? corresponds to in-battle status byte 4) C2/2822: 29 C0 AND #$C0 (only keep Dog Block and Float) C2/2824: EB XBA (get monster/equip status byte 3) C2/2825: 4A LSR (shift out the lowest bit - Dance) C2/2826: 90 04 BCC $282C (branch if Dance aka Permanent Float isn't set) C2/2828: EB XBA C2/2829: 09 80 ORA #$80 (turn on Float in status byte 4) C2/282B: EB XBA C2/282C: 0A ASL (shift monster/equip status byte 3 back up, zeroing the lowest bit) C2/282D: 9D E8 3D STA $3DE8,X (Status to set byte 3) C2/2830: EB XBA C2/2831: 9D E9 3D STA $3DE9,X (Status to set byte 4) C2/2834: B9 08 16 LDA $1608,Y C2/2837: 9D 18 3B STA $3B18,X (Level) C2/283A: 28 PLP C2/283B: 60 RTS (Apply percentage boost to HP or MP. Bit 14 set = 25% boost, Bit 15 set = 50% boost, Both of those bits set = 12.5% boost) C2/283C: DA PHX C2/283D: 0A ASL C2/283E: 2A ROL C2/283F: 85 EE STA $EE C2/2841: 2A ROL C2/2842: 2A ROL (Bit 15 is now in Bit 2, and Bit 14 is in Bit 1) C2/2843: 29 06 00 AND #$0006 (isolate Bits 1 and 2) C2/2846: AA TAX (and use them as function pointer) C2/2847: A5 EE LDA $EE C2/2849: 4A LSR C2/284A: 4A LSR C2/284B: 85 EE STA $EE (all that crazy shifting was equivalent to $EE = A AND 16383. gotta love Square =] ) C2/284D: 7C 59 28 JMP ($2859,X) (Boost A by some fraction, if any) C2/2850: 7B TDC (enter here for A = 0 + $EE) C2/2851: 4A LSR (enter here for A = (A * 1/8) + $EE) C2/2852: 4A LSR (enter here for A = (A * 1/4) + $EE) C2/2853: 4A LSR (enter here for A = (A * 1/2) + $EE) C2/2854: 18 CLC C2/2855: 65 EE ADC $EE C2/2857: FA PLX C2/2858: 60 RTS Code Pointers C2/2859: 50 28 (A = A) (technically, A = $EE, but it's the same deal.) C2/285B: 52 28 (A = A + (A * 1/4) ) C2/285D: 53 28 (A = A + (A * 1/2) ) C2/285F: 51 28 (A = A + (A * 1/8) ) (A = 255 - (A * 2) + 1 If A was >= 128 to start with, then A = 1. If A was 0 to start with, then A ends up as 255.) C2/2861: 0A ASL C2/2862: 90 02 BCC $2866 C2/2864: A9 FF LDA #$FF C2/2866: 49 FF EOR #$FF C2/2868: 1A INC C2/2869: D0 01 BNE $286C C2/286B: 3A DEC C2/286C: 60 RTS (Initialize in-battle character properties from equipment properties. A lot of the equipment bytes in this function were explained in C2/0E77, C2/0F9A, and C2/10B2, so consult those functions. Terii's Offsets List at http://www.rpglegion.com/ff6/hack/offset2.txt is another great resource.) C2/286D: 0B PHD C2/286E: F4 00 11 PEA $1100 (Set direct page register 11 $1100) C2/2871: 2B PLD C2/2872: A5 C9 LDA $C9 ($11C9) C2/2874: C9 9F CMP #$9F (Moogle Suit in character's Armor slot?) C2/2876: D0 0B BNE $2883 (if not, branch) C2/2878: 8A TXA C2/2879: 0A ASL C2/287A: 0A ASL C2/287B: 0A ASL C2/287C: 0A ASL C2/287D: A8 TAY C2/287E: A9 0A LDA #$0A C2/2880: 99 AE 2E STA $2EAE,Y (Use Mog's sprite?) C2/2883: 8A TXA C2/2884: 4A LSR C2/2885: A8 TAY C2/2886: A5 D8 LDA $D8 ($11D8) C2/2888: 29 10 AND #$10 C2/288A: 99 6E 2E STA $2E6E,Y (store Genji Glove effect. this variable is used in Bank C1, apparently to check for Genji Glove's presence when handling mid-battle equipment changes via the Item menu.) C2/288D: 18 CLC C2/288E: A5 A6 LDA $A6 ($11A6) C2/2890: 65 A6 ADC $A6 ($11A6) (add Vigor to itself) C2/2892: 90 02 BCC $2896 (branch if it's under 256) C2/2894: A9 FF LDA #$FF (else make it 255) C2/2896: 9D 2C 3B STA $3B2C,X (store Vigor * 2) C2/2899: A5 A4 LDA $A4 ($11A4) (Speed) C2/289B: 9D 2D 3B STA $3B2D,X C2/289E: 9D 19 3B STA $3B19,X C2/28A1: A5 A2 LDA $A2 ($11A2) (Stamina) C2/28A3: 9D 40 3B STA $3B40,X C2/28A6: A5 A0 LDA $A0 ($11A0) (Magic Power) C2/28A8: 9D 41 3B STA $3B41,X C2/28AB: A5 A8 LDA $A8 ($11A8) C2/28AD: 20 61 28 JSR $2861 C2/28B0: 9D 54 3B STA $3B54,X ( 255 - (Evade * 2) + 1 , capped at low of 1 and high of 255 ) C2/28B3: A5 AA LDA $AA ($11AA) C2/28B5: 20 61 28 JSR $2861 C2/28B8: 9D 55 3B STA $3B55,X ( 255 - (MBlock * 2) + 1 , capped at low of 1 and high of 255 ) C2/28BB: A5 CF LDA $CF ($11CF) C2/28BD: 14 D8 TRB $D8 ($11D8) (clear Genji Glove effect from "Battle Effects 2" if its bit was ON in $11CF [i.e. if both hands hold a weapon. yes, this reeks of a bug. likely, they instead wanted the GG effect cleared only when one or zero hands held a weapon.) C2/28BF: A5 BC LDA $BC ($11BC) C2/28C1: 9D 6C 3C STA $3C6C,X (Equipment status byte 2) C2/28C4: A5 D4 LDA $D4 ($11D4) C2/28C6: 9D 6D 3C STA $3C6D,X (Equipment status byte 3) C2/28C9: A5 DC LDA $DC ($11DC) C2/28CB: 9D 71 3D STA $3D71,X (Amount to add to character's "Run Success" variable. has range of 2 thru 5. higher means that, on average, they can run away quicker from battle) C2/28CE: A5 D9 LDA $D9 ($11D9) C2/28D0: 29 80 AND #$80 (undead bit from relic ring) C2/28D2: 09 10 ORA #$10 (always set Human for party members) C2/28D4: 9D 95 3C STA $3C95,X (save in "Special Byte 3") C2/28D7: A5 D5 LDA $D5 ($11D5) C2/28D9: 0A ASL (A = 0, raise attack dmg, double earring, hp+25%, hp+50, hp+12.5, mp+25, mp+50) (carry = mp+12.5) C2/28DA: EB XBA C2/28DB: A5 D6 LDA $D6 ($11D6) C2/28DD: 0C 6D 3A TSB $3A6D (combine with existing "Battle Effects 1" properties) C2/28E0: 0A ASL (carry = jump continously) C2/28E1: A5 D7 LDA $D7 ($11D7) C2/28E3: EB XBA C2/28E4: 6A ROR (Top half A [will be $3C45] = $11D7 = boost steal, single Earring, boost sketch, boost control, sniper sight, gold hairpin, economizer, vigor + 50% Bottom half [will be $3C44] = raise attack dmg, double Earring, hp+25%, hp+50%, hp+12.5%, mp+25%, mp+50%, jump continuously. The HP/MP bonuses were already read from $11D5 earlier, so they're essentially junk in $3C44. All that's read are Bits 0, 1, and 7.) C2/28E5: C2 20 REP #$20 (Set 16-bit Accumulator) C2/28E7: 9D 44 3C STA $3C44,X C2/28EA: A5 AC LDA $AC ($11AC) C2/28EC: 9D 68 3B STA $3B68,X ($3B68 = battle power for 1st hand, $3B69 = bat pwr for 2nd hand) C2/28EF: A5 AE LDA $AE ($11AE) C2/28F1: 9D 7C 3B STA $3B7C,X (hit rate) C2/28F4: A5 B4 LDA $B4 ($11B4) C2/28F6: 9D 34 3D STA $3D34,X (random weapon spellcast, for both hands) C2/28F9: A5 B0 LDA $B0 ($11B0) C2/28FB: 9D 90 3B STA $3B90,X (elemental properties of weapon) C2/28FE: A5 D8 LDA $D8 ($11D8) C2/2900: 89 08 00 BIT #$0008 (is Gauntlet bit set?) C2/2903: D0 05 BNE $290A C2/2905: A9 40 40 LDA #$4040 (if it's not, turn off 2-hand effect for both hands) C2/2908: 14 DA TRB $DA ($11DA) C2/290A: A5 DA LDA $DA ($11DA) C2/290C: 9D A4 3B STA $3BA4,X (save "Weapon effects") C2/290F: A5 BA LDA $BA ($11BA) C2/2911: 9D B8 3B STA $3BB8,X (bottom = Defense, top = Magic Defense) C2/2914: A9 FF FF LDA #$FFFF C2/2917: 9D 1C 33 STA $331C,X (Status Immunity Bytes 1 and 2: character is vulnerable to everything -- i.e. immune to nothing) C2/291A: 45 D2 EOR $D2 ($11D2) (equipment immunities) C2/291C: 9D 1C 33 STA $331C,X (for Immunity Bytes 1-2, character is now vulnerable to whatever the equipment doesn't block) C2/291F: A5 B6 LDA $B6 ($11B6) C2/2921: 9D CC 3B STA $3BCC,X (bottom = absorbed elements, top = nullified elements) C2/2924: A5 B8 LDA $B8 ($11B8) C2/2926: 9D E0 3B STA $3BE0,X (bottom = weak elements, top = 50% resist elements) C2/2929: A5 BE LDA $BE ($11BE) C2/292B: 9D BC 3C STA $3CBC,X (bottom = special action for right hand, top = special action for left hand) C2/292E: A5 C6 LDA $C6 ($11C6) (item # of equipment in both hands) C2/2930: 9D A8 3C STA $3CA8,X C2/2933: A5 CA LDA $CA ($11CA) (item # of equipment in both relic slots) C2/2935: 9D D0 3C STA $3CD0,X C2/2938: A5 D0 LDA $D0 ($11D0) C2/293A: 9D E4 3C STA $3CE4,X (deals with weapon and shield animation for blocking magical and physical attacks) C2/293D: A5 D8 LDA $D8 ($11D8) C2/293F: 9D 58 3C STA $3C58,X (save "Battle Effects 2") C2/2942: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/2944: 1E 21 3A ASL $3A21,X (Bit X is set, where X is the actual character # of this onscreen character. corresponding bits are set in Items to see if they're equippable. shift out the top bit, as that corresponds to "heavy" merit awardable equipment and will be set below) C2/2947: 0A ASL C2/2948: 0A ASL C2/2949: 0A ASL (rotate "wearer can equip heavy armor" bit from Battle Effects 2 into carry bit) C2/294A: 7E 21 3A ROR $3A21,X (now put it in "character # for purposes of equipping" byte) C2/294D: 2B PLD C2/294E: 4C 50 26 JMP $2650 (deal with Instant Death protection, and Poison elemental nullification giving immunity to Poison status) C2/2951: AD A2 11 LDA $11A2 C2/2954: 4A LSR C2/2955: BD 41 3B LDA $3B41,X (magic power * 1.5) C2/2958: 90 03 BCC $295D (Branch if not physical attack) C2/295A: BD 2C 3B LDA $3B2C,X (vigor * 2) C2/295D: 8D AE 11 STA $11AE C2/2960: 9C 89 3A STZ $3A89 (turn off random weapon spellcast) C2/2963: 4C 21 2C JMP $2C21 (Load spell data) C2/2966: DA PHX C2/2967: 08 PHP C2/2968: EB XBA C2/2969: A9 0E LDA #$0E C2/296B: 20 81 47 JSR $4781 (length of spell data * spell #) C2/296E: C2 31 REP #$31 (Set 16-bit A, X, Y. Clear carry flag) C2/2970: 69 C0 6A ADC #$6AC0 (spells start at 46CC0 ROM offset, or C4/6AC0) C2/2973: AA TAX C2/2974: A0 A0 11 LDY #$11A0 C2/2977: A9 0D 00 LDA #$000D C2/297A: 54 7E C4 MVN #$C4,7E (copy 14 spell bytes into RAM) C2/297D: E2 20 SEP #$20 C2/297F: 0E A9 11 ASL $11A9 (multiply special effect by 2) C2/2982: 90 03 BCC $2987 C2/2984: 9C A9 11 STZ $11A9 (if it exceeded 255, make it 0) C2/2987: 28 PLP C2/2988: FA PLX C2/2989: 60 RTS Clears special effect, sets unblockable, sets level, vigor to 0 C2/298A: AD 7C 3A LDA $3A7C C2/298D: 20 D3 26 JSR $26D3 C2/2990: A9 20 LDA #$20 C2/2992: 0C A4 11 TSB $11A4 (Set Unblockable) C2/2995: 9C A9 11 STZ $11A9 (Clear special effects) C2/2998: 9C AF 11 STZ $11AF (Set Level to 0) C2/299B: 9C AE 11 STZ $11AE (Set Vigor / M. Power to 0) C2/299E: 60 RTS (Load weapon data into attack data. Also handles Offering, Sniper Sight, etc) C2/299F: 08 PHP C2/29A0: BD 2C 3B LDA $3B2C,X C2/29A3: 8D AE 11 STA $11AE (Vigor * 2 / Magic Power) C2/29A6: 20 21 2C JSR $2C21 C2/29A9: BD 45 3C LDA $3C45,X C2/29AC: 89 10 BIT #$10 C2/29AE: F0 05 BEQ $29B5 (If no Sniper Sight) C2/29B0: A9 20 LDA #$20 C2/29B2: 0C A4 11 TSB $11A4 (Sets Can't be Dodged) C2/29B5: A5 B6 LDA $B6 C2/29B7: C9 EF CMP #$EF C2/29B9: D0 0C BNE $29C7 (Branch if not Special -- was "battle") C2/29BB: BD E4 3E LDA $3EE4,X C2/29BE: 89 20 BIT #$20 (Check for Imp status) C2/29C0: D0 05 BNE $29C7 (if an Imp, branch) C2/29C2: A9 06 LDA #$06 C2/29C4: 8D 12 34 STA $3412 C2/29C7: 28 PLP C2/29C8: DA PHX C2/29C9: 66 B6 ROR $B6 (if carry was set going into function, this is an odd-numbered attack of sequence, related to $3A70.. top bit of $B6 will be used in animation: Clear = right hand, Set = left hand) C2/29CB: 10 01 BPL $29CE (if Carry wasn't set, branch and use right hand) C2/29CD: E8 INX (if it was, point to left weapon hand) C2/29CE: BD 68 3B LDA $3B68,X C2/29D1: 8D A6 11 STA $11A6 (Battle Power) C2/29D4: A9 62 LDA #$62 C2/29D6: 04 B3 TSB $B3 (turn off Always Critical and Gauntlet. Turn on ignore attacker row) C2/29D8: BD A4 3B LDA $3BA4,X C2/29DB: 29 60 AND #$60 (isolate "Same damage from back row" and "2-hand" properties) C2/29DD: 49 20 EOR #$20 (flip "Same damage from back row" to get "Damage affected by attacker row") C2/29DF: 14 B3 TRB $B3 (Bit 6 = 0 for Gauntlet [2-hand] and Bit 5 = 0 for "Damage affected by attacker row") C2/29E1: BD 90 3B LDA $3B90,X C2/29E4: 8D A1 11 STA $11A1 (Element) C2/29E7: BD 7C 3B LDA $3B7C,X C2/29EA: 8D A8 11 STA $11A8 (Hit Rate) C2/29ED: BD 34 3D LDA $3D34,X C2/29F0: 8D 89 3A STA $3A89 (random weapon spellcast) C2/29F3: BD BC 3C LDA $3CBC,X C2/29F6: 29 F0 AND #$F0 C2/29F8: 4A LSR C2/29F9: 4A LSR C2/29FA: 4A LSR C2/29FB: 8D A9 11 STA $11A9 (Special effect) C2/29FE: BD A8 3C LDA $3CA8,X (Get equipment in current hand) C2/2A01: 1A INC C2/2A02: 85 B7 STA $B7 C2/2A04: FA PLX C2/2A05: BD 58 3C LDA $3C58,X (Check for offering) C2/2A08: 4A LSR C2/2A09: 90 10 BCC $2A1B (Branch if no Offering) C2/2A0B: A9 20 LDA #$20 C2/2A0D: 0C A4 11 TSB $11A4 (Set Can't be dodged) C2/2A10: A9 40 LDA #$40 C2/2A12: 04 BA TSB $BA (Sets randomize target) C2/2A14: A9 02 LDA #$02 C2/2A16: 04 B2 TSB $B2 (Set no critical and ignore True Knight) C2/2A18: 9C 89 3A STZ $3A89 (Turn off random spellcast) C2/2A1B: AD A6 11 LDA $11A6 C2/2A1E: F0 16 BEQ $2A36 (Exit if 0 Battle Power) C2/2A20: E0 08 CPX #$08 C2/2A22: 90 12 BCC $2A36 (Exit if character) C2/2A24: A9 20 LDA #$20 C2/2A26: 3C E4 3E BIT $3EE4,X C2/2A29: F0 0B BEQ $2A36 (Exit if not Imp) C2/2A2B: 0A ASL C2/2A2C: 3C 95 3C BIT $3C95,X (Check for auto critical if Imp) C2/2A2F: D0 05 BNE $2A36 (If set then exit) C2/2A31: A9 01 LDA #$01 C2/2A33: 8D A6 11 STA $11A6 (Set Battle Power to 1) C2/2A36: 60 RTS (Item usage setup. Used for Items, Skeans, Tools?) (A = Item number. Carry flag = Command >= 2? It's set for Magic or Throw or Tools, but not plain Item) C2/2A37: DA PHX C2/2A38: 08 PHP C2/2A39: 48 PHA C2/2A3A: DA PHX C2/2A3B: A2 0F LDX #$0F C2/2A3D: 9E A0 11 STZ $11A0,X (zero out all spell data -related bytes) C2/2A40: CA DEX C2/2A41: 10 FA BPL $2A3D C2/2A43: FA PLX C2/2A44: A9 21 LDA #$21 C2/2A46: 8D A2 11 STA $11A2 (Set to ignore defense, physical attack) C2/2A49: A9 22 LDA #$22 C2/2A4B: 8D A3 11 STA $11A3 (Set attack to retarget if target dead, not reflectable) C2/2A4E: A9 20 LDA #$20 C2/2A50: 8D A4 11 STA $11A4 (Set to unblockable) C2/2A53: 90 09 BCC $2A5E (branch if not Skean or Item Magic?) C2/2A55: BD 2C 3B LDA $3B2C,X C2/2A58: 8D AE 11 STA $11AE (Vigor * 2 or Magic Power) C2/2A5B: 20 21 2C JSR $2C21 C2/2A5E: A3 01 LDA $01,S C2/2A60: 20 63 2B JSR $2B63 (Multiply A by 30) C2/2A63: C2 10 REP #$10 (Set 16-bit X and Y) C2/2A65: AA TAX C2/2A66: BF 14 50 D8 LDA $D85014,X (Item "HP/MP affected", aka power) C2/2A6A: 8D A6 11 STA $11A6 C2/2A6D: BF 0F 50 D8 LDA $D8500F,X (Item's element) C2/2A71: 8D A1 11 STA $11A1 C2/2A74: B0 66 BCS $2ADC (branch if Skean or Item Magic?) C2/2A76: A9 01 LDA #$01 C2/2A78: 1C A2 11 TRB $11A2 (Sets to magical attack) C2/2A7B: BF 1B 50 D8 LDA $D8501B,X (item special action) C2/2A7F: 0A ASL C2/2A80: B0 05 BCS $2A87 (Branch if top bit set, i.e. no action, usually FFh) C2/2A82: 69 90 ADC #$90 C2/2A84: 8D A9 11 STA $11A9 (Else store 90h + (action*2) in special effect) C2/2A87: C2 20 REP #$20 (set 16-bit accumulator) C2/2A89: BF 15 50 D8 LDA $D85015,X (Item conditions 1+2 when used) C2/2A8D: 8D AA 11 STA $11AA C2/2A90: BF 17 50 D8 LDA $D85017,X (Item conditions 3+4 when used) C2/2A94: 8D AC 11 STA $11AC C2/2A97: E2 20 SEP #$20 (Set 8-bit accumulator) C2/2A99: BF 13 50 D8 LDA $D85013,X (Get Item Properties) C2/2A9D: 85 FE STA $FE C2/2A9F: 06 FE ASL $FE (Does it manipulate 1/16th of actual values?) C2/2AA1: 90 05 BCC $2AA8 (If not ^, branch) C2/2AA3: A9 80 LDA #$80 C2/2AA5: 0C A4 11 TSB $11A4 (Set bit to take HP at fraction of spell byte 7) C2/2AA8: 06 FE ASL $FE C2/2AAA: 06 FE ASL $FE C2/2AAC: 90 05 BCC $2AB3 (If item doesn't remove status conditions, branch) C2/2AAE: A9 04 LDA #$04 C2/2AB0: 0C A4 11 TSB $11A4 (Set remove status spell bit) C2/2AB3: 06 FE ASL $FE C2/2AB5: 90 07 BCC $2ABE (Branch if "restore MP" item bit unset) C2/2AB7: A9 80 LDA #$80 C2/2AB9: 0C A3 11 TSB $11A3 (Set spell to concern MP) C2/2ABC: 04 FE TSB $FE (And automatically set "restore HP" in item properties, so MP-related items always try to give MP, not take it) C2/2ABE: 06 FE ASL $FE C2/2AC0: 90 05 BCC $2AC7 (Branch if "restore HP" (or restore MP) bit unset) C2/2AC2: A9 01 LDA #$01 C2/2AC4: 0C A4 11 TSB $11A4 (Set Heal spell bit) C2/2AC7: 06 FE ASL $FE C2/2AC9: 06 FE ASL $FE C2/2ACB: 90 05 BCC $2AD2 (Branch if Item doesn't reverse damage on undead) C2/2ACD: A9 08 LDA #$08 C2/2ACF: 0C A2 11 TSB $11A2 (Sets Cures undead) C2/2AD2: AD AA 11 LDA $11AA C2/2AD5: 10 05 BPL $2ADC (Branch if not death attack) C2/2AD7: A9 0C LDA #$0C C2/2AD9: 0C A2 11 TSB $11A2 (Sets Cures undead and Hit only (dead XOR undead) targets) C2/2ADC: A3 01 LDA $01,S C2/2ADE: C9 AE CMP #$AE (Item number 174 - Inviz Edge?) C2/2AE0: D0 07 BNE $2AE9 (branch if not) C2/2AE2: A9 10 LDA #$10 C2/2AE4: 0C AA 11 TSB $11AA (Set Clear effect to attack) C2/2AE7: 80 09 BRA $2AF2 C2/2AE9: C9 AF CMP #$AF (Item number 175 - Shadow Edge?) C2/2AEB: D0 05 BNE $2AF2 (branch if not) C2/2AED: A9 04 LDA #$04 C2/2AEF: 0C AB 11 TSB $11AB (Set Image effect to attack) (NOTE: special Inviz and Shadow Edge checks are needed because much code [including that at C2/2A89 that normally loads statuses] is skipped if we're doing Throw or Item Magic) C2/2AF2: BF 00 50 D8 LDA $D85000,X (Item type) C2/2AF6: 29 07 AND #$07 C2/2AF8: D0 1C BNE $2B16 (If item's not a Tool, branch) C2/2AFA: A9 20 LDA #$20 C2/2AFC: 1C A2 11 TRB $11A2 (Clears ignore defense) C2/2AFF: 1C A4 11 TRB $11A4 (Clears unblockable) C2/2B02: BF 15 50 D8 LDA $D85015,X C2/2B06: 8D A8 11 STA $11A8 (Get and store hitrate) C2/2B09: 7B TDC C2/2B0A: A3 01 LDA $01,S (get item #. number of first tool [NoiseBlaster] is A3h) C2/2B0C: 38 SEC C2/2B0D: E9 A3 SBC #$A3 C2/2B0F: 29 07 AND #$07 (subtract 163 from item # and use bottom 3 bits to get a "tool number" of 0-7) C2/2B11: 0A ASL (multiply it by 2 to index table below) C2/2B12: AA TAX C2/2B13: FC 1A 2B JSR ($2B1A,X) (load Tool's miscellaneous effect) C2/2B16: 68 PLA C2/2B17: 28 PLP C2/2B18: FA PLX C2/2B19: 60 RTS Code pointers C2/2B1A: 2A 2B (Noise Blaster) C2/2B1C: 2F 2B (Bio Blaster) (do nothing) C2/2B1E: 2F 2B (Flash) (do nothing) C2/2B20: 30 2B (Chainsaw) C2/2B22: 53 2B (Debilitator) C2/2B24: 4D 2B (Drill) C2/2B26: 57 2B (Air Anchor) C2/2B28: 5D 2B (Autocrossbow) Noiseblaster effect C2/2B2A: A9 20 LDA #$20 C2/2B2C: 8D AB 11 STA $11AB (Set Muddled in attack data) C2/2B2F: 60 RTS Chainsaw effect C2/2B30: 20 5A 4B JSR $4B5A (0 to 255) C2/2B33: 29 03 AND #$03 C2/2B35: D0 16 BNE $2B4D (75% chance) C2/2B37: A9 08 LDA #$08 C2/2B39: 85 B6 STA $B6 (Animation) C2/2B3B: 9C A6 11 STZ $11A6 (Battle power) C2/2B3E: A9 80 LDA #$80 C2/2B40: 0C AA 11 TSB $11AA (Set death status) C2/2B43: A9 10 LDA #$10 C2/2B45: 8D A4 11 STA $11A4 (Set stamina can block) C2/2B48: A9 02 LDA #$02 C2/2B4A: 0C A2 11 TSB $11A2 (Set miss if death prot.) C2/2B4D: A9 20 LDA #$20 C2/2B4F: 0C A2 11 TSB $11A2 (Set ignore defense) C2/2B52: 60 RTS Debilitator Effect C2/2B53: A9 AC LDA #$AC C2/2B55: 80 02 BRA $2B59 (Set Debilitator effect) Air Anchor effect C2/2B57: A9 AE LDA #$AE (Add Air Anchor effect) C2/2B59: 8D A9 11 STA $11A9 C2/2B5C: 60 RTS Autocrossbow effect C2/2B5D: A9 40 LDA #$40 C2/2B5F: 0C A2 11 TSB $11A2 (Set no split damage) C2/2B62: 60 RTS Multiplies A by 30 C2/2B63: EB XBA C2/2B64: A9 1E LDA #$1E C2/2B66: 4C 81 47 JMP $4781 Magic Damage Calculation: Results: $11B0 = (Spell Power * 4) + (Level * Magic Power * Spell Power) / 32 (If Level of 0 is passed, $11B0 = Spell Power) NOTE: Unlike damage modification functions, this one does NOTHING to make sure damage doesn't exceed 65535. That means with a spell like Ultima, a character at level 99 who has reached 140+ Magic Power via Esper bonuses and equipment will do only triple-digit damage. C2/2B69: AD AF 11 LDA $11AF (Level) C2/2B6C: 85 E8 STA $E8 C2/2B6E: C9 01 CMP #$01 C2/2B70: 7B TDC (Clear 16-bit A) C2/2B71: AD A6 11 LDA $11A6 (Spell Power) C2/2B74: C2 20 REP #$20 (Set 16-bit Accumulator) C2/2B76: 90 02 BCC $2B7A (If Level > 0, Spell Power *= 4) C2/2B78: 0A ASL C2/2B79: 0A ASL C2/2B7A: 8D B0 11 STA $11B0 (Maximum Damage) C2/2B7D: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/2B7F: AD AE 11 LDA $11AE (Magic Power) C2/2B82: EB XBA C2/2B83: AD A6 11 LDA $11A6 (Spell Power) C2/2B86: 20 81 47 JSR $4781 (Multiplication Function) C2/2B89: 20 B7 47 JSR $47B7 (Multiplication Function 2) C2/2B8C: A9 04 LDA #$04 C2/2B8E: C2 20 REP #$20 (Set 16-bit Accumulator) C2/2B90: 20 D1 0D JSR $0DD1 (Divide 24-bit Damage by 32. [note the division operates on 4 bytes] ) C2/2B93: 18 CLC C2/2B94: 6D B0 11 ADC $11B0 (Maximum Damage) C2/2B97: 8D B0 11 STA $11B0 (Maximum Damage) C2/2B9A: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/2B9C: 60 RTS Physical Damage Calculation: X = Determines if monster or player Results: For characters: If Gauntlet equipped, treat Battle Power as 7/4 its normal value. Attack = Battle Power + (Vigor * 2). Vigor * 2 is capped at 255. $11B0 = Battle Power + ( (Level * Level * Attack) DIV 256 ) * 3/2 For monsters: Vigor is Random number 56 to 63 Attack = (Battle Power * 4) + Vigor $11B0 = (Level * Level * Attack) DIV 256 C2/2B9D: AD A2 11 LDA $11A2 (Check if magic attack) C2/2BA0: 4A LSR C2/2BA1: B0 03 BCS $2BA6 C2/2BA3: 4C 69 2B JMP $2B69 (Magical Damage Calculation) C2/2BA6: 08 PHP C2/2BA7: AD AF 11 LDA $11AF (attacker Level) C2/2BAA: 48 PHA (save it) C2/2BAB: 85 E8 STA $E8 C2/2BAD: 7B TDC C2/2BAE: AD A6 11 LDA $11A6 (Battle Power) C2/2BB1: C2 20 REP #$20 (Set 16-bit Accumulator) C2/2BB3: E0 08 CPX #$08 (If monster then Battle Power *= 4) C2/2BB5: 90 02 BCC $2BB9 C2/2BB7: 0A ASL C2/2BB8: 0A ASL C2/2BB9: 48 PHA C2/2BBA: A5 B2 LDA $B2 C2/2BBC: 89 00 40 BIT #$4000 C2/2BBF: D0 0C BNE $2BCD (If Gauntlet is not equipped, branch) C2/2BC1: A3 01 LDA $01,S (Battle Power *= 7/4) C2/2BC3: 4A LSR C2/2BC4: 18 CLC C2/2BC5: 63 01 ADC $01,S C2/2BC7: 4A LSR C2/2BC8: 18 CLC C2/2BC9: 63 01 ADC $01,S C2/2BCB: 83 01 STA $01,S C2/2BCD: 68 PLA C2/2BCE: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/2BD0: 6D AE 11 ADC $11AE (add Vigor * 2 if character, or Vigor if monster) C2/2BD3: EB XBA C2/2BD4: 69 00 ADC #$00 (add carry from the bottom byte of Attack into the top byte) C2/2BD6: EB XBA C2/2BD7: 20 B7 47 JSR $47B7 (get 16-bit "Attack" * 8-bit level, and put 24-bit product in Variables $E8 thru $EA) C2/2BDA: A5 E8 LDA $E8 C2/2BDC: 85 EA STA $EA (use top byte of result as temporary variable, since it's generally 0 anyway. to see why that's a bad idea, keep reading.) C2/2BDE: 68 PLA C2/2BDF: 85 E8 STA $E8 (get attacker level again) C2/2BE1: C2 20 REP #$20 (Set 16-bit Accumulator) C2/2BE3: A5 E9 LDA $E9 C2/2BE5: EB XBA (A = bottom two bytes of the first multiplication result.. typically, we'll always have zero in the top byte, so we can ignore it. but with a 255 Battle Power weapon, Gauntlet, and a character at Level 99 with 128 Vigor, that product WILL need 3 bytes. failure to use that top byte in our next multiplication means we'll lose a lot of damage. BUG!) C2/2BE6: 20 B7 47 JSR $47B7 (multiply 16-bit result of [Level * Attack] by our 8-bit level again, and put the new 24-bit product in Variables $E8 thru $EA. 16-bit A will hold the new product DIV 256.) C2/2BE9: 8D B0 11 STA $11B0 (Maximum Damage) C2/2BEC: E0 08 CPX #$08 (If Player then multiply $11B0 by 3/2) C2/2BEE: B0 2F BCS $2C1F (And add Battle Power) C2/2BF0: AD A6 11 LDA $11A6 (Battle Power) C2/2BF3: 29 FF 00 AND #$00FF C2/2BF5: 0A ASL C2/2BF7: 6D B0 11 ADC $11B0 (Maximum Damage) C2/2BFA: 4A LSR C2/2BFB: 18 CLC C2/2BFC: 6D B0 11 ADC $11B0 (Maximum Damage) C2/2BFF: 8D B0 11 STA $11B0 (Maximum Damage) C2/2C02: BD 58 3C LDA $3C58,X C2/2C05: 4A LSR C2/2C06: 90 03 BCC $2C0B (Check for offering) C2/2C08: 4E B0 11 LSR $11B0 (Halves damage) C2/2C0B: 89 08 00 BIT #$0008 C2/2C0E: F0 0F BEQ $2C1F (Check for Genji Glove) C2/2C10: AD B0 11 LDA $11B0 (Maximum Damage) C2/2C13: 4A LSR C2/2C14: 4A LSR C2/2C15: 49 FF FF EOR #$FFFF C2/2C18: 38 SEC C2/2C19: 6D B0 11 ADC $11B0 (Maximum Damage) C2/2C1B: 8D B0 11 STA $11B0 (Subtract 1/4 from Maximum Damage) C2/2C1F: 28 PLP C2/2C20: 60 RTS C2/2C21: DA PHX C2/2C22: AD 17 34 LDA $3417 (get Sketcher) C2/2C25: 30 01 BMI $2C28 (branch if null) C2/2C27: AA TAX (if there's a valid Sketcher, use their Level for attack) C2/2C28: BD 18 3B LDA $3B18,X (Level) C2/2C2B: 8D AF 11 STA $11AF (Level) C2/2C2E: FA PLX C2/2C2F: 60 RTS (Coming into function: A = Enemy Number. Y = in-battle enemy index, should be between 8 and 18d) (throughout this function, "main enemy" will mean the enemy referenced by the A and Y values that are initially passed to the function. "loop enemy" will mean the enemy currently referenced by the iterator of the loop that compares the main enemy to all other enemies in the battle.) C2/2C30: DA PHX C2/2C31: 08 PHP C2/2C32: C2 30 REP #$30 (16-bit accumulator and index registers) C2/2C34: 99 F9 1F STA $1FF9,Y C2/2C37: 99 A8 33 STA $33A8,Y C2/2C3A: 20 71 2D JSR $2D71 (read enemy command script. function explicitly preserves A and X, doesn't seem to touch Y) C2/2C3D: 0A ASL C2/2C3E: 0A ASL C2/2C3F: 48 PHA C2/2C40: AA TAX (enemy number * 4. there are 4 bytes for steal+win slots) C2/2C41: BF 00 30 CF LDA $CF3000,X C2/2C45: 99 08 33 STA $3308,Y (enemy steal slots) C2/2C48: 68 PLA C2/2C49: 0A ASL (enemy number * 8) C2/2C4A: 48 PHA C2/2C4B: DA PHX (push enemy number * 4) C2/2C4C: 5A PHY C2/2C4D: AA TAX C2/2C4E: B9 F9 1F LDA $1FF9,Y (get enemy number) C2/2C51: 99 80 33 STA $3380,Y (Store it in the name structure. $3380 is responsible for the listing of enemy names in battle. Whatever reads from that structure ensures there's no duplicates -- e.g. if there's 2 Leafers, "Leafer" is just displayed once. And if the code below didn't have bugs, 2 *different* Mag Roaders would yield only one "Mag Roader" display, as it works in FF6j.) C2/2C54: 7B TDC C2/2C55: A8 TAY (Y = 0) C2/2C56: BF 50 C0 CF LDA $CFC050,X (enemy names) C2/2C5A: 99 F8 00 STA $00F8,Y (store name in temporary string) C2/2C5D: E8 INX C2/2C5E: E8 INX C2/2C5F: C8 INY C2/2C60: C8 INY C2/2C61: C0 08 00 CPY #$0008 C2/2C64: 90 F0 BCC $2C56 (loop until 8 characters of name are read) C2/2C66: A0 12 00 LDY #$0012 (point to last enemy in battle) C2/2C69: B9 F9 1F LDA $1FF9,Y (get number of enemy) C2/2C6C: 30 28 BMI $2C96 (if 16-bit enemy number is negative, no enemy in slot, so skip it) C2/2C6E: 5A PHY C2/2C6F: 0A ASL C2/2C70: 0A ASL C2/2C71: 0A ASL C2/2C72: AA TAX (enemy # * 8) C2/2C73: 7B TDC C2/2C74: A8 TAY (Y = 0) C2/2C75: B9 F8 00 LDA $00F8,Y C2/2C78: DF 50 C0 CF CMP $CFC050,X (compare name in temporary string to name of loop enemy) C2/2C7C: 18 CLC C2/2C7D: D0 09 BNE $2C88 (if they're not equal, exit loop) C2/2C7F: E8 INX C2/2C80: E8 INX C2/2C81: C8 INY C2/2C82: C8 INY C2/2C83: C0 08 00 CPY #$0008 C2/2C86: 90 ED BCC $2C75 (compare all the 1st 8 characters of the names as long as they keep matching) C2/2C88: 7A PLY (Y points to in-battle index of loop enemy) C2/2C89: 90 0B BCC $2C96 (if we exited string comparison early, the names don't match, so branch) C2/2C8B: A3 01 LDA $01,S C2/2C8D: AA TAX (retrieve in-battle enemy index passed to function) C2/2C8E: B9 F9 1F LDA $1FF9,Y (number of loop enemy) C2/2C91: 9D 80 33 STA $3380,X (If the strings did match, store enemy # of loop enemy in the "name structure", at the position of the main enemy.) This way, all enemies with the same name are represented by the same enemy # in $3380. Whatever mechanism displays the $3380 structure must "detect" duplicate enemy numbers to avoid listing duplicate enemy names. Sadly, none of this works. Enemy names were 8 characters in FF6j according to Lord J, but 10 characters in FF3us, and this function was unchanged. This means differing enemies with the same name (like Mag Roader) will have duplicate listings. Also, you can make an enemy name be wrongly OMITTED thru clever renaming and grouping of enemies (try giving Enemy #0 and #4 the same name -- e.g. "gangster" -- and put Enemy #0 and #5 in a formation together) or really bad luck. A patch for this function has been released; see http://masterzed.cavesofnarshe.com/ ) C2/2C94: 80 07 BRA $2C9D (we had a match, so exit the crazy loop) C2/2C96: 88 DEY C2/2C97: 88 DEY C2/2C98: C0 08 00 CPY #$0008 C2/2C9B: B0 CC BCS $2C69 (loop and compare string to all enemies in battle) C2/2C9D: 7A PLY C2/2C9E: FA PLX C2/2C9F: 68 PLA C2/2CA0: 0A ASL C2/2CA1: 0A ASL C2/2CA2: AA TAX (X = enemy # * 4 * 8. Monster data block at $CF0000 is 32 bytes) C2/2CA3: BF 05 00 CF LDA $CF0005,X (bottom = Defense, top = Magic Defense) C2/2CA7: 99 B8 3B STA $3BB8,Y C2/2CAA: BF 0C 00 CF LDA $CF000C,X (XP) C2/2CAE: 99 84 3D STA $3D84,Y C2/2CB1: BF 0E 00 CF LDA $CF000E,X (GP) C2/2CB5: 99 98 3D STA $3D98,Y C2/2CB8: AD 46 3A LDA $3A46 C2/2CBB: 30 27 BMI $2CE4 (branch if there was an enemy formation # switch, and it designates that the new enemies retain HP and Max HP from the current formation.) C2/2CBD: BF 0A 00 CF LDA $CF000A,X (MP) C2/2CC1: 99 08 3C STA $3C08,Y C2/2CC4: 99 30 3C STA $3C30,Y C2/2CC7: BF 08 00 CF LDA $CF0008,X (HP) C2/2CCB: 99 F4 3B STA $3BF4,Y C2/2CCE: 99 1C 3C STA $3C1C,Y C2/2CD1: AD D4 3E LDA $3ED4 (Battle formation) C2/2CD4: C9 CF 01 CMP #$01CF C2/2CD7: D0 0B BNE $2CE4 (Branch if not Doom Gaze's formation) C2/2CD9: 8C FA 33 STY $33FA C2/2CDC: AD BE 3E LDA $3EBE (Doom Gaze's HP) C2/2CDF: F0 03 BEQ $2CE4 C2/2CE1: 99 F4 3B STA $3BF4,Y (Set current HP to Doom Gaze's HP) C2/2CE4: E2 21 SEP #$21 (Set 8-bit Accumulator) C2/2CE6: B9 1D 3C LDA $3C1D,Y (High byte of max HP) C2/2CE9: 4A LSR C2/2CEA: C9 19 CMP #$19 C2/2CEC: 90 02 BCC $2CF0 C2/2CEE: A9 17 LDA #$17 (Stamina = (Max HP / 512) + 16. If this number is greater than 40, then the monster's stamina is set to 40) C2/2CF0: 69 10 ADC #$10 C2/2CF2: 99 40 3B STA $3B40,Y (Stamina) C2/2CF5: BF 01 00 CF LDA $CF0001,X C2/2CF9: 99 68 3B STA $3B68,Y (Battle Power) C2/2CFC: BF 1A 00 CF LDA $CF001A,X C2/2D00: 99 A8 3C STA $3CA8,Y (Monster's regular weapon graphic) C2/2D03: BF 03 00 CF LDA $CF0003,X (Evade) C2/2D07: 20 61 28 JSR $2861 C2/2D0A: 99 54 3B STA $3B54,Y (255 - Evade * 2 + 1) C2/2D0D: BF 04 00 CF LDA $CF0004,X (MBlock) C2/2D11: 20 61 28 JSR $2861 C2/2D14: 99 55 3B STA $3B55,Y (255 - MBlock * 2 + 1) C2/2D17: BF 02 00 CF LDA $CF0002,X C2/2D1B: 99 7C 3B STA $3B7C,Y (Hit Rate) C2/2D1E: BF 10 00 CF LDA $CF0010,X C2/2D22: 99 18 3B STA $3B18,Y (Level) C2/2D25: BF 00 00 CF LDA $CF0000,X C2/2D29: 99 19 3B STA $3B19,Y (Speed) C2/2D2C: BF 07 00 CF LDA $CF0007,X (Magic Power) C2/2D30: 20 D6 47 JSR $47D6 (* 1.5) C2/2D33: 99 41 3B STA $3B41,Y (Magic Power) C2/2D36: BF 1E 00 CF LDA $CF001E,X (monster status byte 4?) C2/2D3A: 29 82 AND #$82 (only keep float and enemy runic?) C2/2D3C: 19 4C 3E ORA $3E4C,Y C2/2D3F: 99 4C 3E STA $3E4C,Y (turn them on in Retort/Runic/etc byte) C2/2D42: BF 13 00 CF LDA $CF0013,X C2/2D46: 99 80 3C STA $3C80,Y (Special Byte 2) C2/2D49: 20 C1 2D JSR $2DC1 (load enemy elemental reactions, statuses and status protection, metamorph info, special info like human/undead/etc) C2/2D4C: BE A8 33 LDX $33A8,Y C2/2D4F: BF C0 37 CF LDA $CF37C0,X (get Enemy Special Move graphic) C2/2D53: 99 81 3C STA $3C81,Y C2/2D56: E2 10 SEP #$10 C2/2D58: 20 99 2D JSR $2D99 C2/2D5B: 7B TDC C2/2D5C: 6A ROR C2/2D5D: 04 B1 TSB $B1 C2/2D5F: 20 5A 4B JSR $4B5A C2/2D62: 29 07 AND #$07 (random number: 0-7) C2/2D64: 18 CLC C2/2D65: 69 38 ADC #$38 (add 56) C2/2D67: 99 2C 3B STA $3B2C,Y (save monster Vigor as a random number from 56 to 63) C2/2D6A: BB TYX C2/2D6B: 20 50 26 JSR $2650 (deal with Instant Death protection, and Poison elemental nullification giving immunity to Poison status) C2/2D6E: 28 PLP C2/2D6F: FA PLX C2/2D70: 60 RTS Read command script at start of combat A = Monster number C2/2D71: DA PHX C2/2D72: 48 PHA C2/2D73: 08 PHP C2/2D74: C2 20 REP #$20 C2/2D76: 0A ASL C2/2D77: AA TAX C2/2D78: BF 00 84 CF LDA $CF8400,X (Monster command script pointers) C2/2D7C: 99 54 32 STA $3254,Y (Index into command script) C2/2D7F: AA TAX C2/2D80: E2 20 SEP #$20 C2/2D82: 20 43 1A JSR $1A43 C2/2D85: 1A INC C2/2D86: D0 FA BNE $2D82 (If Not end of command script) C2/2D88: BF 00 87 CF LDA $CF8700,X (Monster command scripts) C2/2D8C: 1A INC C2/2D8D: F0 06 BEQ $2D95 C2/2D8F: C2 20 REP #$20 (Set 16-bit Accumulator) C2/2D91: 8A TXA C2/2D92: 99 68 32 STA $3268,Y (Index into command script for counter) C2/2D95: 28 PLP C2/2D96: 68 PLA C2/2D97: FA PLX C2/2D98: 60 RTS C2/2D99: DA PHX C2/2D9A: BB TYX C2/2D9B: 20 A0 2D JSR $2DA0 C2/2D9E: FA PLX C2/2D9F: 60 RTS C2/2DA0: 18 CLC C2/2DA1: BD 80 3C LDA $3C80,X C2/2DA4: 89 02 BIT #$02 (is "Attack First" set in Misc/Special enemy byte?) C2/2DA6: F0 18 BEQ $2DC0 (if not, exit) C2/2DA8: BD A0 3A LDA $3AA0,X C2/2DAB: 89 01 BIT #$01 C2/2DAD: F0 11 BEQ $2DC0 (exit if enemy not present?) C2/2DAF: 09 08 ORA #$08 C2/2DB1: 9D A0 3A STA $3AA0,X C2/2DB4: 9E 19 32 STZ $3219,X C2/2DB7: A9 FF LDA #$FF C2/2DB9: 9D B5 3A STA $3AB5,X C2/2DBC: 20 66 4E JSR $4E66 C2/2DBF: 38 SEC C2/2DC0: 60 RTS C2/2DC1: 08 PHP C2/2DC2: BF 1F 00 CF LDA $CF001F,X (Special attack) C2/2DC6: 99 2D 32 STA $322D,Y C2/2DC9: BF 19 00 CF LDA $CF0019,X (elemental weaknesses) C2/2DCD: 19 E0 3B ORA $3BE0,Y C2/2DD0: 99 E0 3B STA $3BE0,Y C2/2DD3: BF 16 00 CF LDA $CF0016,X (blocked status byte 3) C2/2DD7: 49 FF EOR #$FF (invert it) C2/2DD9: 39 30 33 AND $3330,Y C2/2DDC: 99 30 33 STA $3330,Y C2/2DDF: A9 FF LDA #$FF C2/2DE1: 39 31 33 AND $3331,Y C2/2DE4: 99 31 33 STA $3331,Y C2/2DE7: C2 20 REP #$20 (Set 16-bit Accumulator) C2/2DE9: BF 1B 00 CF LDA $CF001B,X (monster status bytes 1-2) C2/2DED: 99 D4 3D STA $3DD4,Y (copy into "status to set" bytes) C2/2DF0: BF 1D 00 CF LDA $CF001D,X (get monster status bytes 3-4) C2/2DF4: 48 PHA C2/2DF5: 29 01 00 AND #$0001 C2/2DF8: 4A LSR C2/2DF9: 6A ROR C2/2DFA: 03 01 ORA $01,S (this moves Byte 3,Bit 0 into Byte 4,Bit 7 position) (it turns out "Dance" in B3,b0 is permanent float, while B4,b7 is a dispellable float) C2/2DFC: 29 FE 84 AND #$84FE (filter out character stats like dog and rage) (in byte 4, only Float and Life 3 are kept) C2/2DFF: 99 E8 3D STA $3DE8,Y (put in "status to set") C2/2E02: 68 PLA C2/2E03: EB XBA (now swap enemy status bytes 3<->4 within A) C2/2E04: 4A LSR C2/2E05: 90 09 BCC $2E10 (if byte4, bit 0 (aka "Rage") had not been set, branch) C2/2E07: B9 58 3C LDA $3C58,Y C2/2E0A: 09 40 00 ORA #$0040 (Set True Knight effect?) C2/2E0D: 99 58 3C STA $3C58,Y C2/2E10: BF 1C 00 CF LDA $CF001C,X (monster status bytes 2-3) C2/2E14: 19 6C 3C ORA $3C6C,Y (this makes a copy of ^, used in procs like c2/2675) C2/2E17: 99 6C 3C STA $3C6C,Y C2/2E1A: BF 14 00 CF LDA $CF0014,X (blocked status bytes 1-2) C2/2E1E: 49 FF FF EOR #$FFFF (invert 'em) C2/2E21: 39 1C 33 AND $331C,Y C2/2E24: 99 1C 33 STA $331C,Y C2/2E27: BF 17 00 CF LDA $CF0017,X (elements absorbed and nullified) C2/2E2B: 19 CC 3B ORA $3BCC,Y C2/2E2E: 99 CC 3B STA $3BCC,Y C2/2E31: BF 11 00 CF LDA $CF0011,X C2/2E35: 99 94 3C STA $3C94,Y ($3C94 = Metamorph info $3C95 = Special Byte 3: Dies at 0 MP, No name, Human, Auto critical if Imp, Undead) C2/2E38: 28 PLP C2/2E39: 60 RTS (Determine if front, back, pincer, or side attack) C2/2E3A: AD 6D 3A LDA $3A6D C2/2E3D: 4A LSR C2/2E3E: 4A LSR (Put Back Guard effect into Carry) C2/2E3F: AD 48 2F LDA $2F48 (Get extra enemy formation data, byte 0, top half, inverted) C2/2E42: 90 0C BCC $2E50 (Branch if no Back Guard) C2/2E44: 89 B0 BIT #$B0 (Are Side, Back, or Normal attacks allowed?) C2/2E46: F0 02 BEQ $2E4A (If only Pincer or nothing[??] allowed, branch) C2/2E48: 29 B0 AND #$B0 (Otherwise, disable Pincer) C2/2E4A: 89 D0 BIT #$D0 (Are Side, Pincer, or Normal attacks allowed?) C2/2E4C: F0 02 BEQ $2E50 (If only Back or nothing[??] allowed, branch) C2/2E4E: 29 D0 AND #$D0 (Otherwise, disable Back) C2/2E50: 48 PHA C2/2E51: AD 76 3A LDA $3A76 (# characters in party) C2/2E54: C9 03 CMP #$03 C2/2E56: 68 PLA C2/2E57: B0 06 BCS $2E5F (If 3 or more in party, branch) C2/2E59: 89 70 BIT #$70 (Are any of Normal, Back, or Pincer allowed?) C2/2E5B: F0 02 BEQ $2E5F (If only Side or nothing[??] allowed, branch) C2/2E5D: 29 70 AND #$70 (Otherwise, disable Side attack) C2/2E5F: A2 10 LDX #$10 C2/2E61: 20 47 52 JSR $5247 (Randomly choose attack type. If some fictional jackass masked them all, we enter an.. INFINITE LOOP!) C2/2E64: 8E 1F 20 STX $201F (Save encounter type: 0 = Front, 1 = Back, 2 = Pincer, 3 = Side) C2/2E67: 60 RTS C2/2E68: AE 1F 20 LDX $201F (get encounter type? 0 = front, 1 = back, 2 = pincer, 3 = side) C2/2E6B: E0 00 CPX #$00 C2/2E6D: F0 05 BEQ $2E74 (if front attack, branch) C2/2E6F: A9 01 LDA #$01 C2/2E71: 1C E4 11 TRB $11E4 C2/2E74: 8A TXA C2/2E75: 0A ASL C2/2E76: AA TAX (multiply encounter type by 2, so it acts as index into function pointers) C2/2E77: FC 93 2E JSR ($2E93,X) C2/2E7A: A2 06 LDX #$06 C2/2E7C: DA PHX C2/2E7D: BD A1 3A LDA $3AA1,X C2/2E80: 29 20 AND #$20 C2/2E82: 48 PHA C2/2E83: 8A TXA C2/2E84: 0A ASL C2/2E85: 0A ASL C2/2E86: 0A ASL C2/2E87: 0A ASL C2/2E88: AA TAX C2/2E89: 68 PLA C2/2E8A: 9D C5 2E STA $2EC5,X C2/2E8D: FA PLX C2/2E8E: CA DEX C2/2E8F: CA DEX C2/2E90: 10 EA BPL $2E7C C2/2E92: 60 RTS (Pointers to functions that do ??? based on battle formation -- front, back, pincer, side) C2/2E93: 9B 2E C2/2E95: CE 2E C2/2E97: C1 2E C2/2E99: 9B 2E (??? for front attack and side attack) C2/2E9B: A5 B1 LDA $B1 C2/2E9D: 30 21 BMI $2EC0 C2/2E9F: AD 4B 2F LDA $2F4B C2/2EA2: 89 04 BIT #$04 C2/2EA4: D0 1A BNE $2EC0 C2/2EA6: 8A TXA C2/2EA7: 0A ASL C2/2EA8: 0A ASL C2/2EA9: 09 20 ORA #$20 C2/2EAB: 85 EE STA $EE C2/2EAD: AD 6D 3A LDA $3A6D C2/2EB0: 4A LSR C2/2EB1: 90 02 BCC $2EB5 C2/2EB3: 06 EE ASL $EE C2/2EB5: 20 5A 4B JSR $4B5A C2/2EB8: C5 EE CMP $EE C2/2EBA: B0 04 BCS $2EC0 C2/2EBC: A9 40 LDA #$40 C2/2EBE: 04 B0 TSB $B0 C2/2EC0: 60 RTS (Pincer attack) C2/2EC1: A2 06 LDX #$06 C2/2EC3: A9 DF LDA #$DF C2/2EC5: 20 43 0A JSR $0A43 (Clear Bit 5 of $3AA1, which forces front row) C2/2EC8: CA DEX C2/2EC9: CA DEX C2/2ECA: 10 F7 BPL $2EC3 (loop for all 4 characters) C2/2ECC: 80 0E BRA $2EDC (Back attack) C2/2ECE: A2 06 LDX #$06 C2/2ED0: BD A1 3A LDA $3AA1,X C2/2ED3: 49 20 EOR #$20 C2/2ED5: 9D A1 3A STA $3AA1,X (Toggle Row) C2/2ED8: CA DEX C2/2ED9: CA DEX C2/2EDA: 10 F4 BPL $2ED0 (loop for all 4 characters) C2/2EDC: A9 20 LDA #$20 C2/2EDE: 04 B1 TSB $B1 C2/2EE0: 60 RTS C2/2EE1: 08 PHP C2/2EE2: C2 10 REP #$10 (Set 16-bit X and Y) C2/2EE4: AD 45 3F LDA $3F45 (get enemy presence byte from monster formation data) C2/2EE7: A2 0A 00 LDX #$000A C2/2EEA: 0A ASL C2/2EEB: 0A ASL (move 6 relevant bits into top of byte, as there's only 6 possible enemies) C2/2EEC: 9E A8 3A STZ $3AA8,X (mark enemy as absent to start) C2/2EEF: 0A ASL C2/2EF0: 3E A8 3A ROL $3AA8,X ($3AA8 = 1 for present enemy, 0 for absent) C2/2EF3: CA DEX C2/2EF4: CA DEX C2/2EF5: 10 F5 BPL $2EEC (loop for all 6 enemies) C2/2EF7: AD 52 3F LDA $3F52 (get boss switches byte of monster formation data) C2/2EFA: 0A ASL C2/2EFB: 0A ASL (move 6 relevant bits into top of byte) C2/2EFC: 85 EE STA $EE C2/2EFE: A2 05 00 LDX #$0005 C2/2F01: A0 12 00 LDY #$0012 (Y = onscreen index of enemy, should be between 8 and 18d) C2/2F04: 7B TDC C2/2F05: 0E 73 3A ASL $3A73 (prepare to set next bit for which monsters are in template. i can't find where this is initialized to 0) C2/2F08: 06 EE ASL $EE (get boss bit for current enemy) C2/2F0A: 2A ROL C2/2F0B: EB XBA (save boss bit in top of A) C2/2F0C: AD 97 3A LDA $3A97 (colosseum related?? it's decremented elsewhere -- decremented from WHAT, i dunno -- if the enemy formation is >=574. 574 is "shadow at colosseum", and setting 575 with FF3usME plunges Terra into a Colosseum style battle with Guard) C2/2F0F: 0A ASL C2/2F10: BD 46 3F LDA $3F46,X (get enemy number from monster formation data) C2/2F13: 90 05 BCC $2F1A (if top bit of $3A97 was unset, branch) C2/2F15: AD 06 02 LDA $0206 (some enemy number passed from somewhere else????? Bank C3 seems to use this address... probably passed by Colosseum setup) C2/2F18: 80 04 BRA $2F1E (the Colosseum only supports enemies 0-255, so branch immediately to check the boss bit, since we know any enemy # > 256 is unacceptable.) C2/2F1A: C9 FF CMP #$FF C2/2F1C: D0 04 BNE $2F22 (branch if bottom byte of enemy # isn't 255. if it is 255, it might be empty) C2/2F1E: EB XBA C2/2F1F: D0 07 BNE $2F28 (if the boss bit is set, the enemy slot's empty, and we skip its stats. otherwise it's Pugs, and it's valid) C2/2F21: EB XBA C2/2F22: 20 30 2C JSR $2C30 (load enemy name and stats) C2/2F25: EE 73 3A INC $3A73 (which monsters are in template? turn on bit for the current enemy index) C2/2F28: 88 DEY C2/2F29: 88 DEY C2/2F2A: CA DEX C2/2F2B: 10 D7 BPL $2F04 (loop for all 6 enemies) C2/2F2D: 28 PLP C2/2F2E: 60 RTS C2/2F2F: 08 PHP C2/2F30: C2 10 REP #$10 (Set 16-bit X & Y) C2/2F32: 64 FC STZ $FC C2/2F34: 64 B8 STZ $B8 C2/2F36: AD E0 3E LDA $3EE0 C2/2F39: D0 3A BNE $2F75 C2/2F3B: A2 00 00 LDX #$0000 (start looking at first character) C2/2F3E: A9 FF LDA #$FF c2/2F40: 9D D9 3E STA $3ED9,X C2/2F43: DD D8 3E CMP $3ED8,X (Which character it is) C2/2F46: D0 24 BNE $2F6C (if character # was actually defined, don't use the Colosseum variables to determine this character) C2/2F48: A0 00 00 LDY #$0000 C2/2F4B: B9 05 02 LDA $0205,Y (get some character index from Colosseum variables?) C2/2F4E: C9 FF CMP #$FF C2/2F50: F0 14 BEQ $2F66 (if no character in slot, skip to next one) C2/2F52: EB XBA C2/2F53: A9 FF LDA #$FF C2/2F55: 99 05 02 STA $0205,Y (null out the Colosseum variable) C2/2F58: A9 25 LDA #$25 C2/2F5A: 20 81 47 JSR $4781 (multiply by 37, size of character info block) C2/2F5D: A8 TAY C2/2F5E: B9 00 16 LDA $1600,Y (get actual character #?) C2/2F61: 9D D8 3E STA $3ED8,X (save Which character it is) C2/2F64: 80 06 BRA $2F6C (we've found our contender, so exit loop) C2/2F66: C8 INY (check next character) C2/2F67: C0 0C 00 CPY #$000C C2/2F6A: 90 DF BNE $2F4B (loop for first 13 character slots) C2/2F6C: E8 INX C2/2F6D: E8 INX C2/2F6E: E0 08 00 CPX #$0008 C2/2F71: 90 CB BCC $2F3E (loop for all 4 characters) C2/2F73: 80 64 BRA $2FD9 C2/2F75: AE D4 3E LDX $3ED4 (Battle formation) C2/2F78: E0 3E 02 CPX #$023E (Shadow at Colosseum formation) C2/2F7B: 90 0F BCC $2F8C (if not ^ or Colosseum formation #575, branch) C2/2F7D: AD 08 02 LDA $0208 C2/2F80: 8D D8 3E STA $3ED8 (Set to Shadow) C2/2F83: A9 01 LDA #$01 C2/2F85: 04 B8 TSB $B8 C2/2F87: CE 97 3A DEC $3A97 C2/2F8A: 80 4D BRA $2FD9 C2/2F8C: A0 0F 00 LDY #$000F C2/2F8F: B9 50 18 LDA $1850,Y C2/2F92: 85 FE STA $FE C2/2F94: 29 07 AND #$07 C2/2F96: CD 6D 1A CMP $1A6D C2/2F99: D0 12 BNE $2FAD C2/2F9B: 5A PHY C2/2F9C: E6 FC INC $FC C2/2F9E: 7B TDC C2/2F9F: A5 FE LDA $FE C2/2FA1: 29 18 AND #$18 C2/2FA3: 4A LSR C2/2FA4: 4A LSR C2/2FA5: AA TAX C2/2FA6: 20 DC 30 JSR $30DC C2/2FA9: 9D D8 3E STA $3ED8,X (save "which character it is") C2/2FAC: 7A PLY C2/2FAD: 88 DEY C2/2FAE: 10 DF BPL $2F8F C2/2FB0: AD DF 1E LDA $1EDF C2/2FB3: 89 08 BIT #$08 (this bit is clear if Gau has leapt, and set when he rejoins?) C2/2FB5: D0 0C BNE $2FC3 (branch if Gau didn't leap) C2/2FB7: AD 4B 3F LDA $3F4B (get monster index of enemy #6 in formation) C2/2FBA: 1A INC C2/2FBB: D0 06 BNE $2FC3 (branch if an enemy is in the slot. thankfully, there's no formation with Pugs [enemy #255] in Slot #6, as this code makes no distinction between that and a nonexistent enemy. one problem i noticed is that if you're in a Veldt battle where Gau's destined to return, the 6th Pugs will often be untargetable.) C2/2FBD: A5 FC LDA $FC C2/2FBF: C9 04 CMP #$04 C2/2FC1: 90 05 BCC $2FC8 C2/2FC3: A9 01 LDA #$01 C2/2FC5: 1C E4 11 TRB $11E4 C2/2FC8: A9 01 LDA #$01 C2/2FCA: 2C E4 11 BIT $11E4 C2/2FCD: F0 0A BEQ $2FD9 C2/2FCF: A9 0A LDA #$0A C2/2FD1: 8D 4A 2F STA $2F4A (extra enemy formation data, bytes 2 and 3.) C2/2FD4: A9 80 LDA #$80 C2/2FD6: 0C 49 2F TSB $2F49 (extra enemy formation data: activate special event) C2/2FD9: AD 49 2F LDA $2F49 C2/2FDC: 10 6C BPL $304A (if no special event active, branch) C2/2FDE: AD 4A 2F LDA $2F4A C2/2FE1: EB XBA C2/2FE2: A9 18 LDA #$18 C2/2FE4: 20 81 47 JSR $4781 (multiply by 24 bytes for some structure) C2/2FE7: AA TAX C2/2FE8: BF 00 FD D0 LDA $D0FD00,X C2/2FEC: 10 0C BPL $2FFA C2/2FEE: A0 06 00 LDY #$0006 C2/2FF1: A9 LDA #$FF (store null character?) C2/2FF3: 99 D8 3E STA $3ED8,Y (which character it is) C2/2FF6: 88 DEY C2/2FF7: 88 DEY C2/2FF8: 10 F7 BPL $2FF1 (loop for all 4 characters) C2/2FFA: A0 04 00 LDY #$0004 C2/2FFD: 5A PHY C2/2FFE: BF 04 FD D0 LDA $D0FD04,X C2/3002: C9 FF CMP #$FF C2/3004: F0 3B BEQ $3041 C2/3006: 29 3F AND #$3F C2/3008: A0 06 00 LDY #$0006 C2/300B: D9 D8 3E CMP $3ED8,Y (Which character it is) C2/300E: F0 13 BEQ $3023 C2/3010: 88 DEY C2/3011: 88 DEY C2/3012: 10 F7 BPL $300B C2/3014: C8 INY C2/3015: C8 INY C2/3016: B9 D8 3E LDA $3ED8,Y (Which character it is) C2/3019: 1A INC C2/301A: F0 07 BEQ $3023 C2/301C: C0 06 CPY #$0006 C2/301F: 90 F3 BCC ??? C2/3021: 80 1E BRA ??? C2/3023: B9 18 30 LDA $3018,Y C2/3026: 04 B8 TSB $B8 C2/3028: C2 20 REP #$20 (Set 16-bit Accumulator) C2/302A: BF 04 FD D0 LDA $D0FD04,X C2/302E: 99 D8 3E STA $3ED8,Y C2/3031: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/3033: A9 01 LDA #$01 C2/3035: EB XBA C2/3036: BF 06 FD D0 LDA $D0FD06,X C2/303A: C9 FF CMP #$FF C2/303C: F0 03 BEQ $3041 C2/303E: 20 71 2D JSR $2D71 (read command script at start of combat. A = monster num) C2/3041: 7A PLY C2/3042: E8 INX C2/3043: E8 INX C2/3044: E8 INX C2/3045: E8 INX C2/3046: E8 INX C2/3047: 88 DEY C2/3048: D0 B3 BNE $2FFD C2/304A: A2 06 00 LDX #$0006 C2/304D: BD D8 3E LDA $3ED8,X (which character it is) C2/3050: C9 FF CMP #FF C2/3052: F0 7F BEQ $30D3 (If monster) C2/3054: 0A ASL (check bit 7 of which character it is) C2/3055: B0 03 BCS $305A (if set, branch) C2/3057: FE A0 3A INC $3AA0,X (mark character as onscreen?) C2/305A: 0A ASL (check bit 6 of which character it is) C2/305B: 90 08 BCC $3065 (if unset, branch) C2/305D: 48 PHA (save shifted "Which Character" byte) C2/305E: BD 18 30 LDA $3018,X C2/3061: 0C 40 3A TSB $3A40 C2/3064: 68 PLA C2/3065: 4A LSR C2/3066: 4A LSR (original Which Character byte, except top 2 bits are zeroed) C2/3067: 9D D8 3E STA $3ED8,X C2/306A: A0 0F 00 LDY #$000F C2/306D: 5A PHY (save loop variable) C2/306E: 48 PHA (save Which Character) C2/306F: B9 50 18 LDA $1850,Y C2/3072: 29 20 AND #$20 (Isolate character row?) C2/3074: 85 FE STA $FE C2/3076: 20 DC 30 JSR $30DC (get actual character #?) C2/3079: C3 01 CMP $01,S C2/307B: D0 51 BNE $30CE (skip character if their "actual #" doesn't match value of Which Character byte) C2/307D: DA PHX (save 0,2,4,6 index of character?) C2/307E: 48 PHA (save actual # of character?) C2/307F: A5 FE LDA $FE C2/3081: 9D A1 3A STA $3AA1,X (save character row in Special Properties) C2/3084: BD D9 3E LDA $3ED9,X (s/b FFh provided $3EE0 wasn't set) C2/3087: 48 PHA C2/3088: A3 06 LDA $06,S (retrieve loop variable of 0 to 0F?) C2/308A: 9D D9 3E STA $3ED9,X C2/308D: 7B TDC C2/308E: 8A TXA (put onscreen character index in A) C2/308F: 0A ASL C2/3090: 0A ASL C2/3091: 0A ASL C2/3092: 0A ASL C2/3093: AA TAX C2/3094: 68 PLA C2/3095: C9 FF CMP #$FF C2/3097: D0 03 BNE $309C C2/3099: B9 01 16 LDA $1601,Y C2/309C: 9D AE 2E STA $2EAE,X C2/309F: 7B TDC C2/30A0: 68 PLA (retrieve actual ID of character?) C2/30A1: 9D C6 2E STA $2EC6,X C2/30A4: C9 0E CMP #$0E C2/30A6: C2 20 REP #$20 (Set 16-bit Accumulator) C2/30A8: 48 PHA (save actual ID of character?) C2/30A9: B9 02 16 LDA $1602,Y (1st two letters of character's name) C2/30AC: 9D AF 2E STA $2EAF,X C2/30AF: B9 04 16 LDA $1604,Y (middle two letters of character's name) C2/30B2: 9D B1 2E STA $2EB1,X C2/30B5: B9 06 16 LDA $1606,Y (last two letters of character's name) C2/30B8: 9D B3 2E STA $2EB3,X C2/30BB: FA PLX (get actual ID of character?) C2/30BC: B0 06 BCS $30C4 (if character # is >= 0Eh [Banon], then don't bother marking them for purposes of what can be equipped on whom) C2/30BE: 7B TDC (Clear Accumulator) C2/30BF: 38 SEC (set carry flag) C2/30C0: 2A ROL (move up a bit, starting with bottom) C2/30C1: CA DEX C2/30C2: 10 FC BPL $30C0 (move bit into position determined by actual # of character. so for Character #3, only Bit #3 is on) (the following is still executed for Banon and up. seemingly, jibberish [the last 2 characters of the character name] is stored in that character's equippable items byte. i'm not sure why this is done, but the game does have a property on these characters that prevents you from equipping all sorts of random crap via the Item menu in battle.) C2/30C4: FA PLX (get onscreen 0,2,4,6 index of character) C2/30C5: 9D 20 3A STA $3A20,X (related to what characters item can be equipped on. should only be our basic 14) C2/30C8: 98 TYA C2/30C9: 9D 10 30 STA $3010,X (save offset of character info block) C2/30CC: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/30CE: 68 PLA (retrieve Which Character byte) C2/30CF: 7A PLY (retrieve loop index) C2/30D0: 88 DEY C2/30D1: 10 9A BPL $306D (loop for all 16 character info blocks) C2/30D3: CA DEX C2/30D4: CA DEX C2/30D5: 30 03 BMI $30DA C2/30D7: 4C 4D 30 JMP $304D (loop for all 4 characters) C2/30DA: 28 PLP C2/30DB: 60 RTS C2/30DC: 98 TYA C2/30DD: EB XBA C2/30DE: A9 25 LDA #$25 (multiple by 37 bytes, size of character block) C2/30E0: 20 81 47 JSR $4781 C2/30E3: A8 TAY C2/30E4: B9 00 16 LDA $1600,Y (sprite? actual # of character?) C2/30E7: 60 RTS Loads battle formation data C2/30E8: 08 PHP C2/30E9: C2 30 REP #$30 (Set 16-bit A, X, & Y) C2/30EB: AD B9 3E LDA $3EB9 C2/30EE: 85 EE STA $EE C2/30F0: A2 1C 00 LDX #$001C C2/30F3: A5 EE LDA $EE C2/30F5: 10 10 BPL $3107 C2/30F7: BF 80 37 CF LDA $CF3780,X C2/30FB: CD E0 11 CMP $11E0 C2/30FE: D0 07 BNE $3107 (If Battle formation is not 1C4 (SrBehemoth)) C2/3100: BF 82 37 CF LDA $CF3782,X C2/3104: 8D E0 11 STA $11E0 (Change Battle formation to 1A8 (SrBehemoth undead)) C2/3107: 06 EE ASL $EE C2/3109: CA DEX C2/310A: CA DEX C2/310B: CA DEX C2/310C: CA DEX C2/310D: 10 E4 BPL $30F3 C2/310F: A9 00 80 LDA #$8000 C2/3112: 1C E0 11 TRB $11E0 (Clear highest bit of battle formation) C2/3115: F0 10 BEQ $3127 (Branch if not rand w/ next 3) C2/3117: E2 30 SEP #$30 C2/3119: 7B TDC C2/311A: 20 5A 4B JSR $4B5A (0 to 255) C2/311D: 29 03 AND #$03 (0 to 3) C2/311F: C2 31 REP #$31 (set 16-bit A, X and Y. clear Carry) C2/3121: 6D E0 11 ADC $11E0 C2/3124: 8D E0 11 STA $11E0 (Add 0 to 3 to battle formation) C2/3127: AD D4 3E LDA $3ED4 C2/312A: 0A ASL C2/312B: AD E0 11 LDA $11E0 (Battle formation) C2/312E: 90 03 BCC $3133 (If highest bit of Battle formation not set) C2/3130: 8D D4 3E STA $3ED4 C2/3133: 0A ASL C2/3134: 0A ASL C2/3135: AA TAX C2/3136: BF 02 59 CF LDA $CF5902,X (bytes 2-3 of extra enemy formation data) C2/313A: 8D 4A 2F STA $2F4A C2/313D: BF 00 59 CF LDA $CF5900,X (bytes 0-1 of extra enemy formation data) C2/3141: 49 F0 00 EOR #$00F0 (invert the top nibble of byte 0, which contains the attack formations masked -- Front, Back, Pincer, Side) C2/3143: 8D 48 2F STA $2F48 C2/3147: AD E0 11 LDA $11E0 C2/314A: 0A ASL C2/314B: 0A ASL C2/314C: 0A ASL C2/314D: 0A ASL C2/314E: 38 SEC C2/314F: ED E0 11 SBC $11E0 (A = Monster formation * 15) C2/3152: AA TAX C2/3153: 7B TDC C2/3154: A8 TAY C2/3155: BF 00 62 CF LDA $CF6200,X (Load Battle formation data) C2/3159: 99 44 3F STA $3F44,Y C2/315C: E8 INX C2/315D: E8 INX C2/315E: C8 INY C2/315F: C8 INY C2/3160: C0 10 00 CPY #$0010 C2/3163: 90 F0 BCC $3155 C2/3165: 28 PLP C2/3166: 60 RTS C2/3167: A9 80 LDA #$80 C2/3169: 14 B3 TRB $B3 (Set Ignore Clear) C2/316B: A9 0C LDA #$0C C2/316D: 04 BA TSB $BA (Sets Can target dead/hidden entities, and Don't retarget if target invalid) C2/316F: 9C 1B 34 STZ $341B C2/3172: C2 20 REP #$20 C2/3174: BD 18 30 LDA $3018,X C2/3177: 85 B8 STA $B8 (Sets attacker as target) C2/3179: E2 20 SEP #$20 Character Executes One Hit (Loops for Multiple-Strike Attack) C2/317B: DA PHX C2/317C: A5 BD LDA $BD C2/317E: 85 BC STA $BC (Damage increment) C2/3180: A9 FF LDA #$FF C2/3182: 8D 82 3A STA $3A82 (Null Golem block) C2/3185: 8D 83 3A STA $3A83 (Null Dog block) C2/3188: AD 00 34 LDA $3400 (Spell # for a second attack. Used by the Magicite item, weapons with normal addition magic [Flame Sabre, Pearl Lance, etc], and Tempest. Sketch also sets $3400, but the variable is swapped into $B6 by the Sketch command (C2/151F) rather than by this routine. Thus, $3400 will always be null at this point for Sketch.) C2/318B: 1A INC C2/318C: D0 25 BNE $31B3 (Branch if there is a spell [i.e. the spell # is not FFh]) C2/318E: AD 13 34 LDA $3413 (If Fight or Capture command, holds command number. [Note that Rage's Battle and Special also qualify as "Fight".] That way, if a spell is cast by a weapon for one strike (which will overwrite the command # and attack data), we'll be able to continue with the Fight/Capture command and use the weapon as normal on the next strike. If command isn't Fight or Capture, this holds FFh. ) C2/3191: 30 20 BMI $31B3 (branch if negative) C2/3193: 85 B5 STA $B5 (Restore command #) C2/3195: 20 D3 26 JSR $26D3 (Load command data and data of "Battle" spell) C2/3198: AD 70 3A LDA $3A70 (# of extra attacks - set by Quadra Slam, Dragon Horn, Offering, etc) C2/319B: 1A INC (add one. even number will check right hand, odd number the left. so in a Genji Glove+Offering sequence, for instance, we'd have: 8 = Right, 7 = Left, 6 = Right, 5 = Left, 4 = Right, 3 = Left, 2 = Right, then 1 = Left) C2/319C: 4A LSR (put bottommost bit of # attacks in carry flag) C2/319D: 20 9F 29 JSR $299F (Load weapon data into attack data. Plus Sniper Sight, Offering and more) C2/31A0: AD A6 11 LDA $11A6 C2/31A3: D0 03 BNE $31A8 C2/31A5: 4C 75 32 JMP $3275 (branch if zero battle power, which can result from a hand without a weapon, among other things. Fight/Capture set the strike quantity to 2 -- or 8 if you have Offering -- regardless of whether you have Genji Glove. thus, when there's only 1 attack hand, this branch is what skips all the even or odd strikes corresponding to the other hand.) C2/31A8: A5 B5 LDA $B5 C2/31AA: C9 06 CMP #$06 C2/31AC: D0 05 BNE $31B3 (branch if command isn't Capture) C2/31AE: A9 A4 LDA #$A4 (Causes attack to also steal) C2/31B0: 8D A9 11 STA $11A9 (save special effect) C2/31B3: 20 EB 37 JSR $37EB (Set up weapon addition magic, Tempest's Wind Slash, and Espers summoned by the Magicite item) C2/31B6: A9 20 LDA #$20 C2/31B8: 14 B2 TRB $B2 (Bit 5 is set to begin a turn) C2/31BA: F0 05 BEQ $31C1 (branch if it was already clear -- in other words, if we're on the second strike or later of this turn.) C2/31BC: 2C A3 11 BIT $11A3 C2/31BF: D0 04 BNE $31C5 (Branch if Retarget if target invalid/dead) C2/31C1: A9 04 LDA #$04 C2/31C3: 04 BA TSB $BA (NOTE: in $BA, the bit now means *Don't* retarget if target dead/invalid) (To recap the above: if we're on the 1st strike, "Don't Retarget if no valid targets" will depend on the attack stats. If we're on a later strike, it always gets set. This explains why Genji Glove's [sans Offering] second strike will always smack the initial target, even if the first one killed it. However, most multi-strike attacks -- Offering, Dragon Horn, and Quadra Slam/Slice -- set "Randomize Target", which makes you retarget anyway.) C2/31C5: A5 B8 LDA $B8 C2/31C7: 05 B9 ORA $B9 C2/31C9: D0 08 BNE $31D3 (branch if at least one target exists) C2/31CB: A9 04 LDA #$04 C2/31CD: 24 B3 BIT $B3 C2/31CF: F0 02 BEQ $31D3 C2/31D1: 14 BA TRB $BA (clear "Don't retarget if target invalid".. iow, retarget if target invalid) C2/31D3: AD 15 34 LDA $3415 (will be zero for: the attack performed via Sketch, Umaro's Blizzard, Runic, Tempest's Wind Slash, and Espers summoned with the Magicite item) C2/31D6: 30 04 BMI $31DC (otherwise, it's FFh, so branch.) C2/31D8: A9 40 LDA #$40 C2/31DA: 04 BA TSB $BA (Set randomize targets) C2/31DC: A5 B3 LDA $B3 C2/31DE: 4A LSR C2/31DF: B0 08 BCS $31E9 (branch if Bit 0 of $B3 set. to my knowledge, it's only UNset by a failed Blitz input.) C2/31E1: A9 04 LDA #$04 C2/31E3: 04 BA TSB $BA (set Don't retarget if target invalid) C2/31E5: 64 B8 STZ $B8 C2/31E7: 64 B9 STZ $B9 (clear targets) C2/31E9: 20 66 36 JSR $3666 C2/31EC: AD 17 34 LDA $3417 C2/31EF: 30 01 BMI $31F2 (branch if Sketcher is null) C2/31F1: AA TAX (use Sketcher as attacker) C2/31F2: AD 7C 3A LDA $3A7C C2/31F5: C9 1E CMP #$1E C2/31F7: D0 08 BNE $3201 C2/31F9: 64 B8 STZ $B8 C2/31FB: 64 B9 STZ $B9 (clear targets) C2/31FD: A9 04 LDA #$04 C2/31FF: 85 BA STA $BA (Don't retarget if target invalid) C2/3201: AD A5 11 LDA $11A5 C2/3204: F0 1F BEQ $3225 (If 0 MP cost) C2/3206: BD E5 3E LDA $3EE5,X C2/3209: 89 08 BIT #$08 C2/320B: D0 0E BNE $321B (Branch if Mute) C2/320D: BD E4 3E LDA $3EE4,X C2/3210: 89 20 BIT #$20 (Check for Imp status) C2/3212: F0 11 BEQ $3225 (Branch if not ^) C2/3214: AD 10 34 LDA $3410 C2/3217: C9 23 CMP #$23 C2/3219: F0 0A BEQ $3225 (Branch if spell is Imp?) C2/321B: 8A TXA C2/321C: 4A LSR C2/321D: EB XBA C2/321E: A9 0E LDA #$0E C2/3220: 20 BF 62 JSR $62BF C2/3223: 80 50 BRA $3275 C2/3225: 20 2B 35 JSR $352B (Runic function) C2/3228: 20 38 38 JSR $3838 (Check Air Anchor action death) C2/322B: 20 9D 2B JSR $2B9D (Damage Calculation) C2/322E: 20 4A 0D JSR $0D4A (Atlas Armlet / Earring) C2/3231: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3233: 20 92 32 JSR $3292 C2/3236: AD A2 11 LDA $11A2 C2/3239: 4A LSR C2/323A: B0 07 BCS $3243 (Branch if physical attack) C2/323C: A5 A6 LDA $A6 (Reflected spell or Launcher/Super Ball special effect?) C2/323E: F0 03 BEQ $3243 (branch if not) C2/3240: 20 83 34 JSR $3483 (Super Ball, Launcher, and Reflected spells function) C2/3243: AD 30 3A LDA $3A30 C2/3246: 85 B8 STA $B8 C2/3248: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/324A: 20 91 43 JSR $4391 (update statuses for everybody onscreen) C2/324D: 20 3E 36 JSR $363E (handle random addition magic for weapons, in preparation for next strike) C2/3250: AD 01 34 LDA $3401 C2/3253: C9 FF CMP #$FF C2/3255: F0 0B BEQ $3262 C2/3257: EB XBA C2/3258: A9 02 LDA #$02 C2/325A: 20 BF 62 JSR $62BF C2/325D: A9 FF LDA #$FF C2/325F: 8D 01 34 STA $3401 C2/3262: AD A7 11 LDA $11A7 C2/3265: 89 02 BIT #$02 C2/3267: F0 0C BEQ $3275 (if there's no text if spell hits, branch) C2/3269: E0 08 CPX #$08 C2/326B: 90 08 BCC $3275 (if attacker isn't monster, branch) C2/326D: A5 B6 LDA $B6 C2/326F: EB XBA C2/3270: A9 02 LDA #$02 C2/3272: 20 BF 62 JSR $62BF C2/3275: A9 FF LDA #$FF C2/3277: 8D 14 34 STA $3414 C2/327A: 8D 15 34 STA $3415 C2/327D: 8D 1C 34 STA $341C C2/3280: AD 83 3A LDA $3A83 (get Dog block) C2/3283: 30 03 BMI $3288 (if it's disabled, branch) C2/3285: 8D 16 34 STA $3416 C2/3288: FA PLX C2/3289: CE 70 3A DEC $3A70 (# more attacks set by Offering, Quadra Slam, Dragon Horn, etc) C2/328C: 30 03 BMI $3291 (if it's negative, there's no more, so exit) C2/328E: F4 7A 31 PEA $317A (if there are more, repeat this $317B function) C2/3291: 60 RTS C2/3292: 9C 5A 3A STZ $3A5A C2/3295: 9C 54 3A STZ $3A54 C2/3298: 20 00 64 JSR $6400 (Zero $A0 through $AF) C2/329B: 20 7E 58 JSR $587E C2/329E: DA PHX C2/329F: A5 B8 LDA $B8 C2/32A1: 20 0E 52 JSR $520E (Number of bits set in A) C2/32A4: 8E C9 3E STX $3EC9 (# of targets) C2/32A7: FA PLX C2/32A8: 20 3B 12 JSR $123B (True Knight and Love Token) C2/32AB: 20 C2 57 JSR $57C2 C2/32AE: 20 65 38 JSR $3865 C2/32B1: AD 4C 3A LDA $3A4C (actual MP cost to caster) C2/32B4: F0 36 BEQ $32EC (if there is none, skip these affordability checks) C2/32B6: 38 SEC (set Carry for upcoming subtraction) C2/32B7: BD 08 3C LDA $3C08,X (attacker MP) C2/32BA: ED 4C 3A SBC $3A4C (MP cost to attacker) C2/32BD: 9C 4C 3A STZ $3A4C (clear MP cost) C2/32C0: B0 1E BCS $32E0 C2/32C2: E0 08 CPX #$08 C2/32C4: 90 04 BCC $32CA C2/32C6: A0 12 LDY #$12 C2/32C8: 84 B5 STY $B5 C2/32CA: 20 AD 35 JSR $35AD C2/32CD: 64 A2 STZ $A2 C2/32CF: 64 A4 STZ $A4 C2/32D1: A9 02 00 LDA #$0002 C2/32D4: 1C A7 11 TRB $11A7 (clear Text if Hits bit) C2/32D7: A9 02 28 LDA #$2802 C2/32DA: 20 9B 62 JSR $629B (Copy $3A28-$3A2B variables into ($76) buffer) C2/32DD: 4C DB 63 JMP $63DB (Copy $An variables to ($78) buffer) C2/32E0: 9D 08 3C STA $3C08,X (attacker MP = attacker MP - spell MP cost) C2/32E3: A9 80 00 LDA #$0080 C2/32E6: 1D 04 32 ORA $3204,X C2/32E9: 9D 04 32 STA $3204,X C2/32EC: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/32EE: AD 12 34 LDA $3412 C2/32F1: C9 06 CMP #$06 C2/32F3: D0 5A BNE $334F C2/32F5: DA PHX C2/32F6: A9 02 LDA #$02 C2/32F8: 04 B2 TSB $B2 (Set no critical & ignore True Knight) C2/32FA: 4A LSR C2/32FB: 04 A0 TSB $A0 C2/32FD: BD 81 3C LDA $3C81,X C2/3300: 85 B7 STA $B7 C2/3302: BD 2D 32 LDA $322D,X (get monster's special attack) C2/3305: 48 PHA C2/3306: 0A ASL (is bit 6, "Do no damage," set?) C2/3307: 10 08 BPL $3311 (if it isn't, branch) C2/3309: 9C A6 11 STZ $11A6 (clear Battle Power) C2/330C: A9 01 LDA #$01 C2/330E: 0C A7 11 TSB $11A7 (set to "Miss if No Status Set or Clear") C2/3311: 90 05 BCC $3318 (branch if Bit 7 wasn't set) C2/3313: A9 20 LDA #$20 C2/3315: 0C A4 11 TSB $11A4 (set Can't be Dodged) C2/3318: 68 PLA C2/3319: 29 3F AND #$3F (get bottom 6 bits of monster's special attack) C2/331B: C9 30 CMP #$30 C2/331D: 90 1A BCC $3339 (branch if value < 30h, "Absorb HP") C2/331F: C9 32 CMP #$32 C2/3321: B0 0F BCS $3332 (branch if value > 31h, "Absorb MP") C2/3323: 4A LSR (get bottom bit) C2/3324: A9 02 LDA #$02 C2/3326: 0C A4 11 TSB $11A4 (turn on Redirection bit of spell) C2/3329: 90 23 BCC $334E (branch if bottom bit of attack byte was 0) C2/332B: A9 80 LDA #$80 C2/332D: 0C A3 11 TSB $11A3 (Set to Concern MP) C2/3330: 80 1C BRA $334E C2/3332: A9 04 LDA #$04 (s/b reached if bottom 6 bits of attack byte >= 32h. so real examples are 32h, "Remove Reflect", and Skull Dragon's 3Fh, which had "???" for description) C2/3334: 0C A4 11 TSB $11A4 (turn on "Lift status" spell bit) C2/3337: A9 17 LDA #$17 (act is if just "Reflect" is in attack byte, so there'll be no attack power) C2/3339: C9 20 CMP #$20 C2/333B: 90 08 BCC $3345 (if value < 20h, there is no Attack Level boost, but there is a status to alter) C2/333D: E9 20 SBC #$20 C2/333F: 65 BC ADC $BC C2/3341: 85 BC STA $BC (add attack level btwn 0 and Fh, plus the carry flag [which is always 1 here], to Damage Incrementer) C2/3343: 80 09 BRA $334E (don't mess with statuses) C2/3345: 20 17 52 JSR $5217 (transform the attack byte value 0 to 1F into a spell status bit to set in $11AA, $11AB, $11AC, or $11AD) C2/3348: 1D AA 11 ORA $11AA,X C2/334B: 9D AA 11 STA $11AA,X C2/334E: FA PLX C2/334F: A9 40 LDA #$40 C2/3351: 04 B2 TSB $B2 (Clear little Runic sword animation?) C2/3353: D0 0F BNE $3364 (If it wasn't set to begin with, branch over this animation code.) C2/3355: A9 25 LDA #$25 C2/3357: EB XBA C2/3358: A9 06 LDA #$06 C2/335A: 20 BF 62 JSR $62BF C2/335D: 20 DB 63 JSR $63DB (Copy $An variables to ($78) buffer) C2/3360: A9 10 LDA #$10 C2/3362: 14 A0 TRB $A0 C2/3364: A9 08 LDA #$08 C2/3366: 3C F9 3E BIT $3EF9,X C2/3369: F0 04 BEQ $336F (Branch if not morph) C2/336B: E6 BC INC $BC C2/336D: E6 BC INC $BC (Double damage if morphed) C2/336F: AD A2 11 LDA $11A2 C2/3372: 4A LSR C2/3373: 90 09 BCC $337E (Branch if magic damage) C2/3375: A9 10 LDA #$10 C2/3377: 3C E5 3E BIT $3EE5,X C2/337A: F0 02 BEQ $337E (Branch if not berserk) C2/337C: E6 BC INC $BC (Add 50% damage if berserk and physical attack) C2/337E: AD A2 11 LDA $11A2 C2/3381: 89 40 BIT #$40 C2/3383: D0 0D BNE $3392 (Branch if no split damage) C2/3385: AD C9 3E LDA $3EC9 C2/3388: C9 02 CMP #$02 C2/338A: 90 06 BCC $3392 (Branch if only one target) C2/338C: 4E B1 11 LSR $11B1 C2/338F: 6E B0 11 ROR $11B0 (Cut damage in half) C2/3392: A9 20 LDA #$20 C2/3394: 24 B3 BIT $B3 C2/3396: D0 0B BNE $33A3 (If ignore attacker row) C2/3398: 3C A1 3A BIT $3AA1,X C2/339B: F0 06 BEQ $33A3 (If Back Row) C2/339D: 4E B1 11 LSR $11B1 C2/33A0: 6E B0 11 ROR $11B0 (Cut damage in half) C2/33A3: 20 AD 14 JSR $14AD C2/33A6: 20 7D 3E JSR $3E7D (Special effect code from 42E1, once per strike) C2/33A9: C2 20 REP #$20 (Set 16-bit Accumulator) C2/33AB: AC 05 34 LDY $3405 (# of hits left from Super Ball/Launcher) C2/33AE: 30 01 BMI $33B1 (If there aren't any, those special effects aren't being used, so jump to the normal Combat function. If there are, we skip the Combat function, as C2/3483 more or less takes its place) C2/33B0: 60 RTS Combat function C2/33B1: A0 12 LDY #$12 C2/33B3: B9 18 30 LDA $3018,Y C2/33B6: 24 A4 BIT $A4 C2/33B8: F0 07 BEQ $33C1 (Skip if spell doesn't target that target) C2/33BA: 20 0D 22 JSR $220D (Hit or miss function) C2/33BD: 90 02 BCC $33C1 C2/33BF: 14 A4 TRB $A4 (Makes attack miss target) C2/33C1: 88 DEY C2/33C2: 88 DEY C2/33C3: 10 EE BPL $33B3 (Do for all 10 possible targets) C2/33C5: E2 20 SEP #$20 (Set 8-bit accumulator) C2/33C7: AD 1C 34 LDA $341C C2/33CA: 30 0A BMI $33D6 C2/33CC: A5 A4 LDA $A4 C2/33CE: 05 A5 ORA $A5 C2/33D0: D0 04 BNE $33D6 (Branch if at least one target hit) C2/33D2: A9 12 LDA #$12 C2/33D4: 85 B5 STA $B5 C2/33D6: AD 1D 34 LDA $341D C2/33D9: 30 0A BMI $33E5 C2/33DB: A5 A2 LDA $A2 C2/33DD: 05 A3 ORA $A3 C2/33DF: D0 04 BNE $33E5 (Branch if at least one target targetted)? C2/33E1: A9 12 LDA #$12 C2/33E3: 85 B5 STA $B5 C2/33E5: A9 40 LDA #$40 C2/33E7: 3C 95 3C BIT $3C95,X C2/33EA: F0 06 BEQ $33F2 (Branch if not auto critical when Imp) C2/33EC: 4A LSR C2/33ED: 3C E4 3E BIT $3EE4,X C2/33F0: D0 1A BNE $340C (If Attacker is imp do auto critical) C2/33F2: A9 02 LDA #$02 C2/33F4: 24 B3 BIT $B3 C2/33F6: F0 14 BEQ $340C (Automatic critical if bit 1 of $B3 not set) C2/33F8: 24 B2 BIT $B2 C2/33FA: D0 18 BNE $3414 (No critical if bit 1 of $B2 set) C2/33FC: 24 BA BIT $BA C2/33FE: F0 14 BEQ $3414 (No critical if not attacking opposition) C2/3400: 20 5A 4B JSR $4B5A (Random Number 0 to 255) C2/3403: C9 08 CMP #$08 (1 in 32 chance) C2/3405: B0 0D BCS $3414 C2/3407: AD C9 3E LDA $3EC9 C2/340A: F0 08 BEQ $3414 (No critical if no targets) C2/340C: E6 BC INC $BC (Critical hit x2 damage) C2/340E: E6 BC INC $BC C2/3410: A9 20 LDA #$20 (Set to flash screen?) C2/3412: 04 A0 TSB $A0 C2/3414: 20 AD 35 JSR $35AD C2/3417: C2 20 REP #$20 C2/3419: AD B0 11 LDA $11B0 (Maximum Damage) C2/341C: 20 0B 37 JSR $370B (Increment damage function) C2/341F: 8D B0 11 STA $11B0 (Maximum Damage) C2/3422: E2 20 SEP #$20 C2/3424: AD A3 11 LDA $11A3 C2/3427: 0A ASL C2/3428: 10 04 BPL $342E (Branch if not Caster dies) C2/342A: 9B TXY C2/342B: 20 52 38 JSR $3852 (Kill caster) C2/342E: BC B9 32 LDY $32B9,X (who's Controlling this entity?) C2/3431: 30 09 BMI $343C (branch if nobody is) C2/3433: DA PHX C2/3434: BB TYX (X points to controller) C2/3435: BC B8 32 LDY $32B8,X (Y = whom the controller is controlling [in other words, the entity we previously had in X]) C2/3438: 20 2F 37 JSR $372F (regenerate the Control menu. it will account for the MP cost of a spell cast this turn, but unfortunately, the call is too early to account for actual MP damage/healing/ draining done by the spell, so the menu will lag a turn behind in that respect.) C2/343B: FA PLX (restore X pointing to original entity) C2/343C: C2 20 REP #$20 C2/343E: A0 12 LDY #$12 C2/3440: B9 18 30 LDA $3018,Y C2/3443: 14 A4 TRB $A4 (Make spell miss target) C2/3445: F0 25 BEQ $346C (Skip if not target of spell) C2/3447: 2C 54 3A BIT $3A54 C2/344A: F0 02 BEQ $344E C2/344C: E6 BC INC $BC (Increment damage) C2/344E: 20 E3 35 JSR $35E3 C2/3451: CC F8 33 CPY $33F8 C2/3454: F0 16 BEQ $346C C2/3456: 9C 48 3A STZ $3A48 C2/3459: 20 06 44 JSR $4406 (determine status to be set/removed when attack hits; miss if attack doesn't change target status) C2/345C: 20 7E 38 JSR $387E (Special effect code for target) C2/345F: AD 48 3A LDA $3A48 C2/3462: D0 08 BNE $346C (If $3A48 is not 0) C2/3464: B9 18 30 LDA $3018,Y C2/3467: 04 A4 TSB $A4 (Make attack hit target) C2/3469: 20 83 0B JSR $0B83 (Modify Damage, Heal Undead, and Elemental modification) C2/346C: 88 DEY C2/346D: 88 DEY C2/346E: 10 D0 BPL $3440 C2/3470: 20 EF 62 JSR $62EF C2/3473: 20 D6 36 JSR $36D6 (Learn lore) C2/3476: A5 A4 LDA $A4 C2/3478: D0 06 BNE $3480 (Branch if 1 or more targets) C2/347A: A9 02 00 LDA #$0002 C2/347D: 1C A7 11 TRB $11A7 (Clear text if hit if no targets hit) C2/3480: 4C DB 63 JMP $63DB (Copy $An variables to ($78) buffer) (Super Ball / Launcher / Reflected off targets function. Seems to be a specialized counterpart of the "Combat Function" at C2/33B1. For Super Ball / Launcher, it replaces that function. For Reflect, this is called shortly after that function.) C2/3483: DA PHX C2/3484: 48 PHA C2/3485: 20 00 64 JSR $6400 (Zero $A0 through $AF) C2/3488: 9C 5A 3A STZ $3A5A (Set no targets as missed) C2/348B: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/348D: A9 22 LDA #$22 C2/348F: 0C A3 11 TSB $11A3 (Set Retarget on dead, not reflectable) C2/3492: A9 40 LDA #$40 C2/3494: 85 BB STA $BB (Set to cursor start on enemy. Note we're NOT doing any spread-aim here, as the game hits at most one target for each target reflected off. Likewise, each Launcher firing or Super Ball bounce will only hit 1 target.) C2/3496: A9 50 LDA #$50 C2/3498: 04 BA TSB $BA (Sets randomize target & Reflected) C2/349A: A5 B6 LDA $B6 C2/349C: 8D 2A 3A STA $3A2A (Stores final damage) C2/349F: AE 05 34 LDX $3405 (# more times to attack, for Super Ball or Launcher) C2/34A2: 30 08 BMI $34AC (branch if negative, which should only happen if this function was reached due to Reflection) C2/34A4: A9 10 LDA #$10 C2/34A6: 14 BA TRB $BA (Clear Reflected property) C2/34A8: A9 15 LDA #$15 C2/34AA: 80 02 BRA $34AE C2/34AC: A9 09 LDA #$09 C2/34AE: 20 9B 62 JSR $629B (Copy $3A28-$3A2B variables into ($76) buffer) C2/34B1: A9 FF LDA #$FF C2/34B3: A0 09 LDY #$09 C2/34B5: 99 A0 00 STA $00A0,Y ($A0 thru $A9 = #$FF) C2/34B8: 88 DEY C2/34B9: 10 FA BPL $34B5 (loop 10 times. as this little loop suggests, you can't go setting the Launcher/Super Ball effect to have more than 10 "hits." that means that $3405 can have a maximum of 9, for those of you planning your own special effect) C2/34BB: C2 20 REP #$20 (Set 16-bit Accumulator) C2/34BD: 4E B0 11 LSR $11B0 (Half damage) C2/34C0: A0 12 LDY #$12 C2/34C2: B9 18 30 LDA $3018,Y C2/34C5: 23 01 AND $01,S (is the target among those being "reflected off" by Reflect/Super Ball/Launcher ?) C2/34C7: F0 46 BEQ $350F (if not, skip it) C2/34C9: BB TYX (save loop variable) C2/34CA: 20 7E 58 JSR $587E (get new targets.. since the targeting at C2/3494 was set to "cursor start on enemy" and X holds the "reflected off" target going into the call, we're essentially performing a reflection here) C2/34CD: A5 B8 LDA $B8 (new targets after reflection) C2/34CF: F0 3E BEQ $350F (if there's none, skip our current loop target) C2/34D1: 5A PHY C2/34D2: 20 F9 51 JSR $51F9 (Y = [Number of highest target after reflection] * 2) C2/34D5: DA PHX C2/34D6: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/34D8: 8A TXA C2/34D9: 4A LSR C2/34DA: AA TAX ( [onscreen target # of reflected off target] / 2. so characters are now 0-3, and enemies are 4-9) C2/34DB: AD 05 34 LDA $3405 (# more times to attack, for Super Ball or Launcher) C2/34DE: 30 04 BMI $34E4 (branch if negative, which should only happen if this function was reached due to Reflection) C2/34E0: CE 05 34 DEC $3405 (decrement it) C2/34E3: AA TAX (replace reflected off target # with our iterator for Super Ball/Launcher?) C2/34E4: 98 TYA C2/34E5: 4A LSR (A = bit # of highest target after reflection) C2/34E6: 95 A0 STA $A0,X (Reflect: $A0,reflected_off_target = new_target Super Ball/Launcher: $A0,hit_iterator = new_target ) C2/34E8: C2 20 REP #$20 (Set 16-bit Accumulator) C2/34EA: FA PLX C2/34EB: 20 0D 22 JSR $220D (Determine if attack hits) C2/34EE: B0 19 BCS $3509 (branch if it misses) C2/34F0: 9C 48 3A STZ $3A48 C2/34F3: 20 E3 35 JSR $35E3 C2/34F6: 20 06 44 JSR $4406 (determine status to be set/removed when attack hits; miss if attack doesn't change target status) C2/34F9: 20 7E 38 JSR $387E (special effect code for target) C2/34FC: AD 48 3A LDA $3A48 (does attack miss due to status unchange [immunity] ?) C2/34FF: D0 08 BNE $3509 (if so, branch) C2/3501: BD 18 30 LDA $3018,X C2/3504: 04 AE TSB $AE (Set this Reflector as AN originator of the attack graphically? Since $AE will get overwritten later in the case of Super Ball / Launcher, this setting only applies to Reflection) C2/3506: 20 83 0B JSR $0B83 (Modify Damage, Heal Undead, and Elemental modification) C2/3509: 7A PLY C2/350A: AE 05 34 LDX $3405 (# more times to attack, for Super Ball or Launcher) C2/350D: 10 B3 BPL $34C2 (If it's positive, go again. This means that for Super Ball/Launcher, if "reflecting off" a certain initial target produces at least one valid final target, *all* our final targets will be determined by that initial one. Also note that "reflecting off" multiple initial targets for Super Ball / Launcher -- which the game never does -- would produce rather meaningless results. $3405 would equal FFh after the first such target, but the main loop would still get repeated by C2/3511. Shouldn't glitch anything, though. ) C2/350F: 88 DEY C2/3510: 88 DEY C2/3511: 10 AF BPL $34C2 (loop for everybody on screen) (Uh oh..! If there were no targets found to reflect onto above, we can reach this point with $3405 not being FFh. As a result, the branch at C2/33AE will keep skipping the normal "Combat function" at C2/33B1.. bugging up the current battle. This will continue until another Launcher/Super Ball is attempted when there are actually target(s) to hit. C2/3483 will then loop through those targets, bringing $3405 to a "safe" FFh in the process.) C2/3513: 68 PLA C2/3514: FA PLX C2/3515: A9 10 00 LDA #$0010 C2/3518: 24 BA BIT $BA (was there Reflection?) C2/351A: D0 09 BNE $3525 (branch if so) C2/351C: BD 18 30 LDA $3018,X C2/351F: 85 AE STA $AE (Set the missile launcher or the Super Ball thrower as THE originator of attack graphically?) C2/3521: 64 AA STZ $AA C2/3523: 64 AC STZ $AC C2/3525: 20 EF 62 JSR $62EF (Related to display of damage and healing numbers and "Miss" messages) C2/3528: 4C DB 63 JMP $63DB (Copy $An variables to ($78) buffer) Runic Function C2/352B: AD A3 11 LDA $11A3 C2/352E: 89 08 BIT #$08 (Check for enable runic) C2/3530: F0 7A BEQ $35AC (Exits function if not ^) C2/3532: 64 EE STZ $EE C2/3534: 64 EF STZ $EF C2/3536: A0 12 LDY #$12 C2/3538: B9 A0 3A LDA $3AA0,Y C2/353B: 4A LSR C2/353C: 90 20 BCC $355E C2/353E: B9 4C 3E LDA $3E4C,Y C2/3541: 89 06 BIT #$06 C2/3543: F0 19 BEQ $355E (Branch if not runic or enemy runic) C2/3545: 29 FB AND #$FB C2/3547: 99 4C 3E STA $3E4C,Y (clear runic) C2/354A: F4 C0 80 PEA $80C0 (Sleep, Death, Petrify) C2/354D: F4 10 22 PEA $2210 (Freeze, Hide, Stop) C2/3550: 20 64 58 JSR $5864 C2/3553: 90 09 BCC $355E (Branch if any set) C2/3555: C2 20 REP #$20 C2/3557: B9 18 30 LDA $3018,Y C2/355A: 04 EE TSB $EE C2/355C: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/355E: 88 DEY C2/355F: 88 DEY C2/3560: 10 D6 BPL $3538 C2/3562: A5 EE LDA $EE C2/3564: 05 EF ORA $EF C2/3566: F0 44 BEQ $35AC (Exits function) C2/3568: DA PHX C2/3569: 20 65 38 JSR $3865 C2/356C: 9C 15 34 STZ $3415 C2/356F: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3571: A5 EE LDA $EE C2/3573: 85 B8 STA $B8 C2/3575: 20 0E 52 JSR $520E (x = # of bits set in $EE) C2/3578: 9C AA 11 STZ $11AA (Make attack set no statuses) C2/357B: 9C AC 11 STZ $11AC C2/357E: A9 82 21 LDA #$2182 C2/3581: 8D A3 11 STA $11A3 (Set concern MP, not reflectable, Unblockable, Heal) C2/3584: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/3586: A9 60 LDA #$60 C2/3588: 8D A2 11 STA $11A2 (Set ignore defense, no split damage) C2/358B: 7B TDC C2/358C: AD A5 11 LDA $11A5 (MP cost of spell?) C2/358F: 20 92 47 JSR $4792 C2/3592: 8D A6 11 STA $11A6 (Battle Power?) C2/3595: 20 5E 38 JSR $385E (Sets level, magic power to 0) C2/3598: 9C 14 34 STZ $3414 (Skip damage modification) C2/359B: A9 40 LDA #$40 C2/359D: 14 B2 TRB $B2 (Flag little Runic sword animation?) C2/359F: A9 04 LDA #$04 C2/35A1: 85 BA STA $BA (Don't retarget if target invalid) C2/35A3: A9 03 LDA #$03 C2/35A5: 1C A7 11 TRB $11A7 (Clear special byte 3) C2/35A8: 9C A9 11 STZ $11A9 (Set attack to no special effect) C2/35AB: FA PLX C2/35AC: 60 RTS C2/35AD: DA PHX C2/35AE: AE 72 3A LDX $3A72 C2/35B1: 8E 71 3A STX $3A71 C2/35B4: FA PLX C2/35B5: 20 D4 35 JSR $35D4 C2/35B8: 4C 9E 62 JMP $629E Change Atma Weapon length C2/35BB: 20 D4 35 JSR $35D4 C2/35BE: DA PHX C2/35BF: 08 PHP C2/35C0: AE 72 3A LDX $3A72 C2/35C3: DA PHX C2/35C4: AE 71 3A LDX $3A71 C2/35C7: 8E 72 3A STX $3A72 C2/35CA: 20 9E 62 JSR $629E C2/35CD: FA PLX C2/35CE: 8E 72 3A STX $3A72 C2/35D1: 28 PLP C2/35D2: FA PLX C2/35D3: 60 RTS C2/35D4: 08 PHP C2/35D5: C2 20 REP #$20 (Set 16-bit Accumulator) C2/35D7: A5 B4 LDA $B4 C2/35D9: 8D 28 3A STA $3A28 C2/35DC: A5 B6 LDA $B6 C2/35DE: 8D 2A 3A STA $3A2A C2/35E1: 28 PLP C2/35E2: 60 RTS C2/35E3: 08 PHP C2/35E4: E2 30 SEP #$30 C2/35E6: 20 1B 36 JSR $361B C2/35E9: 8A TXA C2/35EA: 99 90 32 STA $3290,Y (save attacker [or reflector if reflection involved] #) C2/35ED: AD 7C 3A LDA $3A7C C2/35F0: 99 48 3D STA $3D48,Y C2/35F3: AD 10 34 LDA $3410 C2/35F6: C9 FF CMP #$FF C2/35F8: F0 07 BEQ $3601 C2/35FA: 99 49 3D STA $3D49,Y C2/35FD: 8A TXA C2/35FE: 99 91 32 STA $3291,Y C2/3601: AD 11 34 LDA $3411 C2/3604: C9 FF CMP #$FF C2/3606: F0 07 BEQ $360F (branch if there's no Item # [or a Skean/Tool that doesn't use a spell] defined for attack.) C2/3608: 99 5C 3D STA $3D5C,Y (save item #) C2/360B: 8A TXA C2/360C: 99 A4 32 STA $32A4,Y (save attacker [or reflector if reflection involved] #) C2/360F: AD A1 11 LDA $11A1 C2/3612: 99 5D 3D STA $3D5D,Y (save attack's element/s) C2/3615: 8A TXA C2/3616: 99 A5 32 STA $32A5,Y (save attacker [or reflector if reflection involved] #) C2/3619: 28 PLP C2/361A: 60 RTS C2/361B: 08 PHP C2/361C: E2 21 SEP #$21 (Set 8-bit Accumulator, and set Carry) C2/361E: B9 E0 32 LDA $32E0,Y C2/3621: 10 05 BPL $3628 (branch if this target doesn't yet have an attacker [which can be a reflector, if reflection is involved]) C2/3623: 20 53 4B JSR $4B53 C2/3626: 90 05 BCC $362D (50% chance this attacker overwrites current one) C2/3628: 8A TXA C2/3629: 6A ROR ( [onscreen index of attacker] / 2. so characters are now 0-3, and enemies are 4-9) C2/362A: 99 E0 32 STA $32E0,Y (save index in bottom 7 bits, and turn on top bit) C2/362D: 28 PLP C2/362E: 60 RTS C2/362F: 48 PHA C2/3630: 08 PHP C2/3631: B9 E0 32 LDA $32E0,Y C2/3634: 30 05 BMI $363B (branch if this target already has an attacker for this turn) C2/3636: 8A TXA C2/3637: 6A ROR ( [onscreen index of attacker] / 2. so characters are now 0-3, and enemies are 4-9) C2/3638: 99 E0 32 STA $32E0,Y C2/363B: 28 PLP C2/363C: 68 PLA C2/363D: 60 RTS (Weapon "addition magic") C2/363E: A5 B5 LDA $B5 C2/3640: C9 16 CMP #$16 (is Command Jump?) C2/3642: D0 05 BNE $3649 (if not, branch) C2/3644: AD 70 3A LDA $3A70 (are there more attacks to do from Offering / Quadra Slam / Dragon Horn / etc?) C2/3647: D0 1C BNE $3665 (if so, exit function) C2/3649: AD 89 3A LDA $3A89 C2/364C: 89 40 BIT #$40 (is "cast randomly with fight" bit set in the weapon spellcast byte?) C2/364E: F0 15 BEQ $3665 (if not, Exit function) C2/3650: EB XBA C2/3651: 20 5A 4B JSR $4B5A (random #, 0 to 255) C2/3654: C9 40 CMP #$40 C2/3656: B0 0D BCS $3665 (if that # is 64 or greater, exit function. iow, exit 3/4 of time.) C2/3658: EB XBA C2/3659: 29 3F AND #$3F (isolate spell # of weapon in bottom 6 bits) C2/365B: 8D 00 34 STA $3400 (save it) C2/365E: A9 10 LDA #$10 C2/3660: 14 B2 TRB $B2 (this bit distinguishes traditional "addition magic" spellcasts from Tempest's Wind Slash in a few ways in C2/37EB.) one is that it'll cause the targeting byte to be set to only "Cursor start on enemy" for the followup spell. maybe the goal is to prevent the spell from targeting multiple enemies..? but i'm not sure when the spellcast would even try to target anything other than the target whacked by the weapon, unless the spell randomizes targets, which no normal "addition magic" does.) C2/3662: EE 70 3A INC $3A70 (increment # of attacks remaining. since the calling code will soon decrement this, the addition magic should be cast with the same # of attacks remaining as the weapon strike preceding it was) C2/3665: 60 RTS C2/3666: A9 01 LDA #$01 C2/3668: 14 B2 TRB $B2 C2/366A: F0 F9 BEQ $3665 C2/366C: AD 12 34 LDA $3412 C2/366F: 30 F4 BMI $3665 C2/3671: DA PHX C2/3672: 9B TXY C2/3673: 8D 29 3A STA $3A29 C2/3676: 0A ASL C2/3677: AA TAX C2/3678: A9 01 LDA #$01 C2/367A: 8D 28 3A STA $3A28 C2/367D: FC C4 36 JSR ($36C4,X) C2/3680: 8D 2A 3A STA $3A2A C2/3683: FA PLX C2/3684: 4C 9E 62 JMP $629E C2/3687: A5 B6 LDA $B6 C2/3689: 60 RTS C2/368A: AD 7D 3A LDA $3A7D C2/368D: 60 RTS C2/368E: 38 SEC C2/368F: A5 B6 LDA $B6 C2/3691: E9 36 SBC #$36 C2/3693: 60 RTS C2/3694: A5 B5 LDA $B5 C2/3696: 60 RTS C2/3697: A9 11 LDA #$11 C2/3699: 8D 28 3A STA $3A28 C2/369C: B9 A8 33 LDA $33A8,Y C2/369F: 8D 29 3A STA $3A29 C2/36A2: B9 A9 33 LDA $33A9,Y C2/36A5: 60 RTS (Joker Dooms) C2/36A6: A9 02 LDA #$02 C2/36A8: 0C 46 3A TSB $3A46 (set flag to let attack target normally untargetable entities -- Jumpers, seized characters, etc.) C2/36AB: 1C A2 11 TRB $11A2 (Clear miss if death protected) C2/36AE: A9 20 LDA #$20 C2/36B0: 0C A4 11 TSB $11A4 (Sets unblockable) C2/36B3: A9 00 LDA #$00 C2/36B5: 8D 29 3A STA $3A29 C2/36B8: A9 55 LDA #$55 (Joker Doom) C2/36BA: 60 RTS C2/36BB: A9 00 LDA #$00 C2/36BD: 8D 29 3A STA $3A29 C2/36C0: AD 7D 3A LDA $3A7D C2/36C3: 60 RTS Pointers to code C2/36C4: 87 36 C2/36C6: 8A 36 C2/36C8: 8E 36 C2/36CA: 65 36 C2/36CC: 87 36 C2/36CE: 94 36 C2/36D0: 97 36 (enemy Special) C2/36D2: A6 36 (Slot - Joker Dooms) C2/36D4: BB 36 (Blitz) Learn lore if casted C2/36D6: DA PHX C2/36D7: 08 PHP C2/36D8: E2 20 SEP #$20 C2/36DA: AD A3 11 LDA $11A3 C2/36DD: 89 04 BIT #$04 C2/36DF: F0 27 BEQ $3708 (Branch if not learn when casted) C2/36E1: AC 07 30 LDY $3007 C2/36E4: 30 22 BMI $3708 (Exit if Strago not in party) C2/36E6: F4 C3 B0 PEA $B0C3 (Death, Petrify, Zombie, Dark, Sleep, Muddled, Berserk) C2/36E9: F4 10 23 PEA $2310 (Stop, Hide, Rage, Freeze) C2/36EC: 20 64 58 JSR $5864 C2/36EF: 90 17 BCC $3708 (Exit function if any set) C2/36F1: A5 B6 LDA $B6 C2/36F3: E9 8B SBC #$8B C2/36F5: 18 CLC C2/36F6: 20 17 52 JSR $5217 C2/36F9: E0 03 CPX #$03 C2/36FB: B0 0B BCS $3708 C2/36FD: 3C 29 1D BIT $1D29,X (Known lores) C2/3700: D0 06 BNE $3708 C2/3702: 1D 84 3A ORA $3A84,X (Lores to learn) C2/3705: 9D 84 3A STA $3A84,X C2/3708: 28 PLP C2/3709: FA PLX C2/370A: 60 RTS Damage increment function Damage = damage * (1 + (.5 * $BC)) C2/370B: 5A PHY C2/370C: A4 BC LDY $BC C2/370E: F0 1D BEQ $372D (Exit if $BC = 0) C2/3710: 48 PHA C2/3711: A5 B2 LDA $B2 C2/3713: 0A ASL C2/3714: 2D A1 11 AND $11A1 C2/3717: 0A ASL C2/3718: 0A ASL C2/3719: 0A ASL C2/371A: 68 PLA C2/371B: B0 10 BCS $372D (Exit function if Ignores defense and bit 4 of $B3 is set) C2/371D: 85 EE STA $EE C2/371F: 46 EE LSR $EE C2/3721: 18 CLC C2/3722: 65 EE ADC $EE (Add 50% damage) C2/3724: 90 02 BCC $3728 C2/3726: 7B TDC C2/3727: 3A DEC (Set damage to 65535) C2/3728: 88 DEY C2/3729: D0 F6 BNE $3721 (Do this $BC times) C2/372B: 84 BC STY $BC (Store 0 in $BC) C2/372D: 7A PLY C2/372E: 60 RTS (Relm's Control menu) C2/372F: DA PHX C2/3730: 5A PHY C2/3731: 08 PHP C2/3732: C2 31 REP #$31 (set 16-bit A, X and Y. clear Carry) C2/3734: BF 4A 54 C2 LDA $C2544A,X (address of controlling character's menu?) C2/3738: 69 30 00 ADC #$0030 C2/373B: 8F 81 21 00 STA $002181 C2/373F: BB TYX C2/3740: BD 08 3C LDA $3C08,X (MP of monster?) C2/3743: 1A INC C2/3744: 85 EE STA $EE (add 1, as it'll make future comparisons easier) C2/3746: BD F9 1F LDA $1FF9,X (Monster Type) C2/3749: 0A ASL C2/374A: 0A ASL C2/374B: AA TAX (X = monster number * 4) C2/374C: E2 20 SEP #$20 (set 8-bit accumulator) C2/374E: 7B TDC (clear A) C2/374F: 8F 83 21 00 STA $002183 C2/3753: A0 04 00 LDY #$0004 C2/3756: 7B TDC C2/3757: 48 PHA C2/3758: BF 00 3D CF LDA $CF3D00,X (get Relm's Control command) C2/375C: 8F 80 21 00 STA $002180 (store it in a menu) C2/3760: C9 FF CMP #$FF C2/3762: F0 1C BEQ $3780 (branch if the command [aka the spell #] was null) C2/3764: EB XBA C2/3765: A9 0E LDA #$0E (there are 14d bytes per spell in magic data) C2/3767: 20 81 47 JSR $4781 (spell number * 14) C2/376A: DA PHX C2/376B: AA TAX C2/376C: BF C5 6A C4 LDA $C46AC5,X (get MP cost) C2/3770: EB XBA C2/3771: BF C0 6A C4 LDA $C46AC0,X (get targeting byte) C2/3775: FA PLX (restore X = monster num * 4) C2/3776: 83 01 STA $01,S (replace zero value on stack from C2/3757 with targeting byte?) C2/3778: 18 CLC (clear carry) C2/3779: A5 EF LDA $EF (retrieve (MP of monster + 1) / 256 ?) C2/377B: D0 03 BNE $3780 (if it's nonzero, branch. spell MP costs are only 1 byte, so we don't have to worry whether it's castable) C2/377D: EB XBA (get MP cost of spell) C2/377E: C5 EE CMP $EE (carry will be clear if the Cost of spell is less than (monster MP + 1), or if the foe has >= 255 MP) (IOW, if the spell is affordable.) C2/3780: 6A ROR (rotate carry into top bit of A. doubt the other bits matter, given the XBA above is only done sometimes..) C2/3781: 8F 80 21 00 STA $002180 C2/3785: 68 PLA (get the targeting byte, or zero if the menu entry was null) C2/3786: 8F 80 21 00 STA $002180 C2/378A: E8 INX C2/378B: 88 DEY C2/378C: D0 C8 BNE $3756 (loop 4 times, once for each Control command) C2/378E: 28 PLP C2/378F: 7A PLY C2/3790: FA PLX C2/3791: 60 RTS Sketch/Control chance C2/3792: DA PHX C2/3793: B9 18 3B LDA $3B18,Y (Target's Level) C2/3796: 90 07 BCC $379F (if sketch/control chance isn't boosted by equip, branch) C2/3798: EB XBA C2/3799: A9 AA LDA #$AA C2/379B: 20 81 47 JSR $4781 (Multiply target level by #$AA) C2/379E: EB XBA (Multiply target level by 170 / 256) (roughly 2 / 3) C2/379F: 48 PHA (save target level (or target level * 170/256)) C2/37A0: 7B TDC C2/37A1: BD 18 3B LDA $3B18,X (Attacker's Level) C2/37A4: EB XBA (* 256) C2/37A5: FA PLX (restore target level (or target level * 170/256)) C2/37A6: 20 92 47 JSR $4792 (A / X) C2/37A9: 48 PHA C2/37AA: 18 CLC C2/37AB: EB XBA C2/37AC: D0 05 BNE $37B3 (Automatically hit if result of division is >= 256) C2/37AE: 20 5A 4B JSR $4B5A (random 0 to 255) C2/37B1: C3 01 CMP $01,S C2/37B3: 68 PLA C2/37B4: FA PLX C2/37B5: 60 RTS Reduce gold for GP Rain or Enemy Steal Gold = Gold - A (no lower than 0) For GP Rain: A = Level * 30 (Gold if gold < level * 30) For Enemy Steal: High A = Enemy level, low A = 20 (14 hex) (Enemy level * 256 + 20) (Gold if gold < (Enemy level * 256) + 20) C2/37B6: 48 PHA C2/37B7: 38 SEC C2/37B8: AD 60 18 LDA $1860 (party's gold, bottom 16 bits) C2/37BB: 85 EE STA $EE C2/37BD: E3 01 SBC $01,S C2/37BF: 8D 60 18 STA $1860 (subtract A from gold) C2/37C2: E2 20 SEP #$20 (8-bit mem/acc) C2/37C4: AD 62 18 LDA $1862 (party's gold, top 8 bits) C2/37C7: E9 00 SBC #$00 C2/37C9: 8D 62 18 STA $1862 (now continue subtraction with borrow) C2/37CC: C2 20 REP #$20 (16-bit mem/acc) C2/37CE: B0 0A BCS $37DA (branch if party's gold was >= amount thrown or stolen) C2/37D0: A5 EE LDA $EE C2/37D2: 83 01 STA $01,S (otherwise, lower amount thrown/stolen to what the party's gold was) C2/37D4: 9C 60 18 STZ $1860 C2/37D7: 9C 61 18 STZ $1861 (zero the party's gold, all 3 bytes) C2/37DA: 68 PLA C2/37DB: 60 RTS Pick a random Esper (not Odin or Raiden) C2/37DC: A9 19 LDA #$19 C2/37DE: 20 65 4B JSR $4B65 (0 to $18) C2/37E1: C9 0B CMP #$0B C2/37E3: 90 02 BCC $37E7 (Branch if A < $0B) C2/37E5: 1A INC (Add 2 if over $0B) C2/37E6: 1A INC C2/37E7: 18 CLC C2/37E8: 69 36 ADC #$36 C2/37EA: 60 RTS (Set up weapon addition magic, Tempest's Wind Slash, and Espers summoned by the Magicite item) C2/37EB: AD 00 34 LDA $3400 C2/37EE: C9 FF CMP #$FF C2/37F0: F0 45 BEQ $3837 (Exit if $3400 = #$FF) C2/37F2: 85 B6 STA $B6 (Set spell #) C2/37F4: 20 BF 1D JSR $1DBF (Get command based on attack/spell number. A bottom = Command #, A top = Attack #) C2/37F7: 85 B5 STA $B5 (Set command to that type) C2/37F9: 20 D3 26 JSR $26D3 (load command and spell data) C2/37FC: 20 51 29 JSR $2951 (Load Magic Power / Vigor and Level) C2/37FF: 9C A5 11 STZ $11A5 (Set MP cost to 0) C2/3802: A9 FF LDA #$FF C2/3804: 8D 00 34 STA $3400 (null out the "spell # for a second attack", as we've already processed it.) C2/3807: A9 02 LDA #$02 C2/3809: 04 B2 TSB $B2 (Set no critical & ignore True Knight) C2/380B: A9 10 LDA #$10 C2/380D: 24 B2 BIT $B2 C2/380F: F0 03 BEQ $3814 (branch if it's weapon addition magic, which won't let the followup spell hit anybody but the initial weapon victim. why the hell doesn't this just branch directly to $3816?) C2/3811: 9C 15 34 STZ $3415 C2/3814: D0 17 BNE $382D (and why the hell isn't this an unconditional BRA? i'm tempted to make a Readability patch just combining these two trivial changes..) (To be clear: Traditional weapon "addition magic" will start its journey at C2/3816. As far as I know, anything else will take the C2/382D path. That includes Espers summoned by the Magicite item and Tempest's Wind Slash [which is technically addition magic, but a special case].) C2/3816: A9 0C LDA #$0C C2/3818: 1C A3 11 TRB $11A3 (Clear learn if cast, clear enable Runic) C2/381B: 04 BA TSB $BA (Set Don't retarget if target invalid, and Can target dead/hidden targets) C2/381D: A9 40 LDA #$40 C2/381F: 85 BB STA $BB (Set only to cursor start on enemy [and clear any multi-targeting ability]). C2/3821: A9 10 LDA #$10 C2/3823: 2C A4 11 BIT $11A4 C2/3826: F0 05 BEQ $382D (Branch if Stamina can't block) C2/3828: 9C 1C 34 STZ $341C (this makes a weapon spell -- like Soul Sabre's Doom -- have its animation skipped entirely when missing rather than show a "Miss" message) C2/382B: 80 05 BRA $3832 C2/382D: A9 20 LDA #$20 C2/382F: 0C A4 11 TSB $11A4 (Set Unblockable) C2/3832: A9 02 LDA #$02 C2/3834: 0C A3 11 TSB $11A3 (Set Not Reflectable) C2/3837: 60 RTS Set attacker to die if under Air Anchor effect C2/3838: BD 05 32 LDA $3205,X C2/383B: 89 04 BIT #$04 C2/383D: D0 0A BNE $3849 (Exit function if under Air Anchor effect) C2/383F: 09 04 ORA #$04 C2/3841: 9D 05 32 STA $3205,X (Clear Air Anchor effect) C2/3844: A9 40 LDA #$40 C2/3846: 0C A3 11 TSB $11A3 (Set caster dies) C2/3849: 60 RTS C2/384A: BD E9 3D LDA $3DE9,X C2/384D: 09 20 ORA #$20 C2/384F: 9D E9 3D STA $3DE9,X (Mark Hide status to be set) C2/3852: 20 2F 36 JSR $362F C2/3855: A9 80 LDA #$80 C2/3857: 1D D4 3D ORA $3DD4,X C2/385A: 9D D4 3D STA $3DD4,X (Mark Death status to be set) C2/385D: 60 RTS Sets level, and magic power for attack to 0 C2/385E: 9C AF 11 STZ $11AF C2/3861: 9C AE 11 STZ $11AE C2/3864: 60 RTS C2/3865: 08 PHP C2/3866: C2 20 REP #$20 C2/3868: AD 14 34 LDA $3414 C2/386B: 30 07 BMI $3874 C2/386D: AD 30 3A LDA $3A30 C2/3870: 85 B8 STA $B8 C2/3872: 80 08 BRA $387C C2/3874: A5 B8 LDA $B8 C2/3876: 8D 30 3A STA $3A30 C2/3879: 0C 4E 3A TSB $3A4E C2/387C: 28 PLP C2/387D: 60 RTS Calls special effect code C2/387E: DA PHX C2/387F: 5A PHY C2/3880: 08 PHP C2/3881: E2 30 SEP #$30 C2/3883: AE A9 11 LDX $11A9 C2/3886: FC CD 3D JSR ($3DCD,X) C2/3889: 28 PLP C2/388A: 7A PLY C2/388B: FA PLX C2/388C: 60 RTS Kill effect ( Slice/Scimitar special effect starts here ) C2/388D: 38 SEC C2/388E: A9 EE LDA #$EE C2/3890: EB XBA (Call from Kill with "X" effect enters here, with A = #$7E) C2/3891: B9 A1 3A LDA $3AA1,Y C2/3894: 89 04 BIT #$04 C2/3896: D0 F4 BNE $388C (Exit function if prot. from death) C2/3898: B0 05 BCS $389F (Skip code to make auto hit undead) C2/389A: B9 95 3C LDA $3C95,Y C2/389D: 30 0C BMI $38AB (If Undead auto hit 100% of time) C2/389F: 20 5A 4B JSR $4B5A (Random number 0 to 255) C2/38A2: C9 40 CMP #$40 C2/38A4: B0 E6 BCS $388C (Exit 75% chance) C2/38A6: 20 B2 23 JSR $23B2 (Check if Stamina blocks) C2/38A9: B0 E1 BCS $388C (Exit if it does) C2/38AB: AD 70 3A LDA $3A70 (number of strikes remaining from Offering / Dragon Horn / etc) C2/38AE: F0 06 BEQ $38B6 (if this is final strike, branch) C2/38B0: A5 B5 LDA $B5 C2/38B2: C9 16 CMP #$16 C2/38B4: F0 D6 BEQ $388C (Exit if Command = Jump) C2/38B6: B9 18 30 LDA $3018,Y C2/38B9: 04 A4 TSB $A4 (Related to animation? This special effect function is different in that it jumps to C2/63DB instead of immediately returning. When it does return, the caller sets $A4 in an identical fashion, so I can't think of any reason to do it here outside of animation.) C2/38BB: 1C 4E 3A TRB $3A4E (Remove this [character] target from a "backup targets byte", which stops Offering/ Genji Glove/etc from beating on their corpse..) C2/38BE: B9 19 30 LDA $3019,Y C2/38C1: 04 A5 TSB $A5 (see note at C2/38B9.) C2/38C3: 1C 4F 3A TRB $3A4F (Remove this [monster] target from a "backup targets byte". see C2/38BB note for elaboration.) C2/38C6: A9 10 LDA #$10 C2/38C8: 04 A0 TSB $A0 C2/38CA: A9 80 LDA #$80 C2/38CC: 20 32 0E JSR $0E32 (Set Death in Status to Set) C2/38CF: 9C 1D 34 STZ $341D (this will make C2/33B1 null the animation for each strike in the remainder of this turn where no targets are found. this is part of the "corpse beating" prevention described above. without this instruction, the character will wave their hand around like an idiot.) C2/38D2: 9C A6 11 STZ $11A6 (set Battle Power to 0) C2/38D5: A9 02 LDA #$02 C2/38D7: 85 B5 STA $B5 C2/38D9: EB XBA C2/38DA: 85 B6 STA $B6 C2/38DC: C9 EE CMP #$EE C2/38DE: D0 0C BNE $38EC (Kill with 'X' branches) C2/38E0: C0 08 CPY #$08 (Check for monster or character) C2/38E2: 90 08 BCC $38EC (branch if character target) C2/38E4: B9 E9 3D LDA $3DE9,Y C2/38E7: 09 20 ORA #$20 C2/38E9: 99 E9 3D STA $3DE9,Y (Set Hide in Status to Set) C2/38EC: 20 AD 35 JSR $35AD C2/38EF: 4C DB 63 JMP $63DB (Copy $An variables to ($78) buffer) Special Effect 4 x2 Damage vs. Humans C2/38F2: B9 95 3C LDA $3C95,Y C2/38F5: 89 10 BIT #$10 C2/38F7: F0 04 BEQ $38FD (Exit if target not human) C2/38F9: E6 BC INC $BC C2/38FB: E6 BC INC $BC (Double damage dealt) C2/38FD: 60 RTS Sniper/Hawk Eye effect C2/38FE: 20 53 4B JSR $4B53 (0 or 1) C2/3901: 90 FA BCC $38FD (50% chance exit) C2/3903: E6 BC INC $BC (Add 1 to damage incrementor) C2/3905: B9 F9 3E LDA $3EF9,Y C2/3908: 10 F3 BPL $38FD (Exit if not target not Floating) C2/390A: A5 B5 LDA $B5 C2/390C: C9 00 CMP #$00 C2/390E: D0 ED BNE $38FD (Exit if command not Fight?) C2/3910: E6 BC INC $BC C2/3912: E6 BC INC $BC C2/3914: E6 BC INC $BC (Add another 3 to damage incrementor) C2/3916: A9 08 LDA #$08 C2/3918: 85 B5 STA $B5 (Store Throw for *purposes of animation*) C2/391A: A5 B7 LDA $B7 C2/391C: 3A DEC C2/391D: 85 B6 STA $B6 C2/391F: 4C BB 35 JMP $35BB Stone C2/3922: A3 05 LDA $05,S C2/3924: AA TAX C2/3925: BD 18 3B LDA $3B18,X (Attacker's level) C2/3928: D9 18 3B CMP $3B18,Y (Target's Level) C2/392B: D0 06 BNE $3933 (If not same level, exit) C2/392D: A9 0D LDA #$0D (Add 13 to damage incrementer) C2/392F: 65 BC ADC $BC C2/3931: 85 BC STA $BC C2/3933: 60 RTS Palidor C2/3934: A9 01 LDA #$01 C2/3936: 20 4C 46 JSR $464C C2/3939: B9 CC 32 LDA $32CC,Y C2/393C: 48 PHA C2/393D: 20 54 4E JSR $4E54 C2/3940: 99 CC 32 STA $32CC,Y C2/3943: A8 TAY C2/3944: 0A ASL C2/3945: AA TAX C2/3946: 68 PLA C2/3947: C9 FF CMP #$FF C2/3949: F0 03 BEQ $394E C2/394B: 99 84 31 STA $3184,Y C2/394E: 7B TDC C2/394F: 9D 20 36 STA $3620,X C2/3952: C2 20 REP #$20 C2/3954: 9D 20 35 STA $3520,X C2/3957: A9 16 00 LDA #$0016 C2/395A: 9D 20 34 STA $3420,X C2/395D: 60 RTS Special effect $39 - Engulf C2/395E: B9 18 30 LDA $3018,Y C2/3961: 0C 8A 3A TSB $3A8A (Set character as engulfed) C2/3964: 80 06 BRA $396C (Branch to remove from combat code) Bababreath from 3DCD C2/3966: B9 18 30 LDA $3018,Y C2/3969: 0C 88 3A TSB $3A88 C2/396C: C2 20 REP #$20 (Special effect $27 & $38 jump here) (Escape, Sneeze) C2/396E: B9 18 30 LDA $3018,Y C2/3971: 0C 4C 2F TSB $2F4C C2/3974: 0C 39 3A TSB $3A39 C2/3977: 60 RTS Dischord C2/3978: BB TYX C2/3979: FE 18 3B INC $3B18,X (Level) C2/397C: 5E 18 3B LSR $3B18,X (Half level rounded up) C2/397F: 60 RTS R. Polarity C2/3980: B9 A1 3A LDA $3AA1,Y (Target's Row) C2/3983: 49 20 EOR #$20 C2/3985: 99 A1 3A STA $3AA1,Y (Switch) C2/3988: 60 RTS Wall Change C2/3989: 7B TDC C2/398A: A9 FF LDA #$FF C2/398C: 20 2A 52 JSR $522A (Pick a random bit) C2/398F: 99 E0 3B STA $3BE0,Y (Set your weakness to A) C2/3992: 49 FF EOR #$FF C2/3994: 99 CD 3B STA $3BCD,Y (Nullify all other elements) C2/3997: 20 2A 52 JSR $522A (Pick a random bit, not the one picked for weakness) C2/399A: 99 CC 3B STA $3BCC,Y (Absorb that element) C2/399D: 60 RTS Steal function C2/399E: A3 05 LDA $05,S (Attacker) C2/39A0: AA TAX C2/39A1: A9 01 LDA #$01 C2/39A3: 8D 01 34 STA $3401 (=1) (Sets message to "Doesn't have anything!") C2/39A6: E0 08 CPX #$08 (Check if attacker is monster) C2/39A8: B0 5F BCS $3A09 (Branch if monster) C2/39AA: C2 20 REP #$20 (Set 16-bit accumulator) C2/39AC: B9 08 33 LDA $3308,Y (Target's stolen items) C2/39AF: 1A INC C2/39B0: E2 21 SEP #$21 (Set 8-bit Accumulator AND Carry Flag) C2/39B2: F0 4D BEQ $3A01 (Fail to steal if no items) C2/39B4: EE 01 34 INC $3401 (now = 2) (Sets message to "Couldn't steal!!") C2/39B7: BD 18 3B LDA $3B18,X (Attacker's Level) C2/39BA: 69 32 ADC #$32 (adding 51, since Carry Flag was set) C2/39BC: B0 1A BCS $39D8 (Automatically steal if level >= 205) C2/39BE: F9 18 3B SBC $3B18,Y (Subtract Target's Level, along with an extra 1 because Carry Flag is unset at this point. Don't worry; this cancels out with the extra 1 from C2/39BA.) (StealValue = [attacker level + 51] - [target lvl + 1] = Attacker level + 50 - Target level ) C2/39C1: 90 3E BCC $3A01 (Fail to steal if StealValue < 0) C2/39C3: 30 13 BMI $39D8 (Automatically steal if StealValue >= 128) C2/39C5: 85 EE STA $EE (save StealValue) C2/39C7: BD 45 3C LDA $3C45,X C2/39CA: 4A LSR C2/39CB: 90 02 BCC $39CF (If no sneak ring) C2/39CD: 06 EE ASL $EE (Double value) C2/39CF: A9 64 LDA #$64 C2/39D1: 20 65 4B JSR $4B65 (Random: 0 to 99) C2/39D4: C5 EE CMP $EE C2/39D6: B0 29 BCS $3A01 (Fail to steal if the random number >= StealValue) C2/39D8: 5A PHY C2/39D9: 20 5A 4B JSR $4B5A (Random: 0 to 255) C2/39DC: C9 20 CMP #$20 C2/39DE: 90 01 BCC $39E1 (branch 1/8 of the time, so Rare steal slot will be checked) C2/39E0: C8 INY (Check the 2nd [Common] slot 7/8 of the time) C2/39E1: B9 08 33 LDA $3308,Y (Target's stolen item) C2/39E4: 7A PLY C2/39E5: C9 FF CMP #$FF (If no item) C2/39E7: F0 18 BEQ $3A01 (Fail to steal) C2/39E9: 8D 35 2F STA $2F35 (Item stolen, for message purposes) C2/39EC: 9D F4 32 STA $32F4,X (Store in "Acquired item") C2/39EF: BD 18 30 LDA $3018,X C2/39F2: 0C 8C 3A TSB $3A8C C2/39F5: A9 FF LDA #$FF C2/39F7: 99 08 33 STA $3308,Y (Set to no item to steal) C2/39FA: 99 09 33 STA $3309,Y (in both slots) C2/39FD: EE 01 34 INC $3401 (now = 3) (Sets message to "Stole #whatever ") C2/3A00: 60 RTS If no items to steal C2/3A01: E2 20 SEP #$20 C2/3A03: A9 00 LDA #$00 C2/3A05: 99 48 3D STA $3D48,Y C2/3A08: 60 RTS (Steal for monsters) C2/3A09: 9C 3A 2F STZ $2F3A C2/3A0C: EE 01 34 INC $3401 (Sets message to "Couldn't steal!!") C2/3A0F: 20 5A 4B JSR $4B5A C2/3A12: C9 C0 CMP #$C0 C2/3A14: B0 EB BCS $3A01 (fail to steal 1/4 of the time) C2/3A16: CE 01 34 DEC $3401 (Sets message to "Doesn't have anything!") C2/3A19: BD 18 3B LDA $3B18,X (enemy level) C2/3A1C: EB XBA C2/3A1D: A9 14 LDA #$14 (enemy will swipe: level * 256 + 20 gold) C2/3A1F: C2 20 REP #$20 (set 16-bit A) C2/3A21: 20 B6 37 JSR $37B6 (subtract swiped gold from party's inventory) C2/3A24: F0 DB BEQ $3A01 (branch if character had zero gold before the steal) C2/3A26: 8D 38 2F STA $2F38 (save gold swiped for message output) C2/3A29: 18 CLC C2/3A2A: 7D 98 3D ADC $3D98,X (add amount stolen to gold possessed by enemy) C2/3A2D: 90 02 BCC $3A31 (branch if no overflow) C2/3A2F: 7B TDC C2/3A30: 3A DEC (if sum overflowed, set enemy's gold to 65535) C2/3A31: 9D 98 3D STA $3D98,X (update enemy's gold) C2/3A34: E2 20 SEP #$20 (set 8-bit A) C2/3A36: A9 3F LDA #$3F C2/3A38: 8D 01 34 STA $3401 (Set message to "# GP was stolen!!") C2/3A3B: 60 RTS Metamorph C2/3A3C: C0 08 CPY #$08 (Checks if target is monster) C2/3A3E: 90 4A BCC $3A8A (branch if not) C2/3A40: B9 94 3C LDA $3C94,Y (Metamorph info: Morph chance in bits 5-7, and Morph pack in bits 0-4) C2/3A43: 48 PHA C2/3A44: 29 1F AND #$1F (isolate pack #) C2/3A46: 20 53 4B JSR $4B53 (Random number 0 or 1) C2/3A49: 2A ROL C2/3A4A: 20 53 4B JSR $4B53 (Random number 0 or 1) C2/3A4D: 2A ROL C2/3A4E: AA TAX (now we have the Morph pack # in bits 2-6, and a random 0-3 index into that pack in bits 0-1) C2/3A4F: BF 40 7F C4 LDA $C47F40,X (get the item we're attempting to Morph the enemy into) C2/3A53: 8D 35 2F STA $2F35 (save it for message purposes) C2/3A56: A9 02 LDA #$02 C2/3A58: 8D 28 3A STA $3A28 C2/3A5B: A9 1D LDA #$1D C2/3A5D: 8D 29 3A STA $3A29 C2/3A60: 20 BE 35 JSR $35BE C2/3A63: 20 AD 35 JSR $35AD C2/3A66: 68 PLA C2/3A67: 4A LSR C2/3A68: 4A LSR C2/3A69: 4A LSR C2/3A6A: 4A LSR C2/3A6B: 4A LSR (isolate 0-7 Morph Chance index) C2/3A6C: AA TAX (copy it to X) C2/3A6D: 20 5A 4B JSR $4B5A (Random number 0 to 255) C2/3A70: DF C5 3D C2 CMP $C23DC5,X (compare to actual Morph Chance) C2/3A74: B0 14 BCS $3A8A (if less, branch and fail to Morph) C2/3A76: A3 05 LDA $05,S C2/3A78: AA TAX C2/3A79: AD 35 2F LDA $2F35 (get ID of Metamorphed item) C2/3A7C: 9D F4 32 STA $32F4,X (save it in this character's "Item to add to inventory" variable) C2/3A7F: BD 18 30 LDA $3018,X C2/3A82: 0C 8C 3A TSB $3A8C (flag this character to have their inventory variable checked when the turn ends) C2/3A85: A9 80 LDA #$80 C2/3A87: 4C 32 0E JMP $0E32 (Mark death status to be set) C2/3A8A: 4C 1B 3B JMP $3B1B (flag Miss message) Special Efect $56 Debilitator C2/3A8D: 7B TDC C2/3A8E: B9 E0 3B LDA $3BE0,Y (Elements weak against) C2/3A91: 0D C8 3E ORA $3EC8 (Elements nullified by ForceField) C2/3A94: 49 FF EOR #$FF C2/3A96: F0 F2 BEQ $3A8A (Miss if weak to all) C2/3A98: 20 2A 52 JSR $522A (Randomly pick an element not weak to that hasn't been nullified by ForceField) C2/3A9B: 48 PHA C2/3A9C: 20 F0 51 JSR $51F0 C2/3A9F: 8A TXA C2/3AA0: 18 CLC C2/3AA1: 69 0B ADC #$0B C2/3AA3: 8D 01 34 STA $3401 (Set to display that element as text) C2/3AA6: A3 01 LDA $01,S C2/3AA8: 19 E0 3B ORA $3BE0,Y C2/3AAB: 99 E0 3B STA $3BE0,Y (Make weak vs. that element) C2/3AAE: 68 PLA C2/3AAF: 49 FF EOR #$FF C2/3AB1: 48 PHA C2/3AB2: 39 E1 3B AND $3BE1,Y C2/3AB5: 99 E1 3B STA $3BE1,Y (Make not resist that element) C2/3AB8: A3 01 LDA $01,S C2/3ABA: EB XBA C2/3ABB: 68 PLA C2/3ABC: C2 20 REP #$20 (Set 16-bit accumulator) C2/3ABE: 39 CC 3B AND $3BCC,Y C2/3AC1: 99 CC 3B STA $3BCC,Y (Make not absorb or nullify that element) C2/3AC4: 60 RTS Special effect $53 Control C2/3AC5: C0 08 CPY #$08 C2/3AC7: 90 4D BCC $3B16 (Miss w/text if target is character) C2/3AC9: B9 80 3C LDA $3C80,Y C2/3ACC: 30 48 BMI $3B16 (Miss w/text if Can't Control bit set) C2/3ACE: F4 D2 B0 PEA $B0D2 (Death, Petrify, Clear, Zombie, Sleep, Muddled, Berserk) C2/3AD1: F4 00 29 PEA $2900 (Rage, Morph, Hide) C2/3AD4: 20 64 58 JSR $5864 C2/3AD7: 90 3D BCC $3B16 (Miss w/text if any set on target) C2/3AD9: B9 B9 32 LDA $32B9,Y C2/3ADC: 10 38 BPL $3B16 (If already controlled then miss w/text) C2/3ADE: A3 05 LDA $05,S C2/3AE0: AA TAX C2/3AE1: BD 45 3C LDA $3C45,X C2/3AE4: 4A LSR C2/3AE5: 4A LSR C2/3AE6: 4A LSR C2/3AE7: 4A LSR C2/3AE8: 20 92 37 JSR $3792 (Sketch Chance - pass bit 3 of $3C45 as carry) C2/3AEB: B0 2E BCS $3B1B (Miss w/o text) C2/3AED: 98 TYA C2/3AEE: 9D B8 32 STA $32B8,X C2/3AF1: 8A TXA C2/3AF2: 99 B9 32 STA $32B9,Y C2/3AF5: B9 19 30 LDA $3019,Y C2/3AF8: 0C 54 2F TSB $2F54 C2/3AFB: BD 4D 3E LDA $3E4D,X C2/3AFE: 09 01 ORA #$01 C2/3B00: 9D 4D 3E STA $3E4D,X C2/3B03: BD F9 3E LDA $3EF9,X C2/3B06: 09 10 ORA #$10 C2/3B08: 9D F9 3E STA $3EF9,X (Set spell status to attacker) C2/3B0B: B9 A1 3A LDA $3AA1,Y C2/3B0E: 09 40 ORA #$40 C2/3B10: 99 A1 3A STA $3AA1,Y (Set controlled bit to target) C2/3B13: 4C 2F 37 JMP $372F (generate the Control menu) C2/3B16: A9 04 LDA #$04 C2/3B18: 8D 01 34 STA $3401 (Set to display text #4) C2/3B1B: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3B1D: B9 18 30 LDA $3018,Y (Represents the target) C2/3B20: 8D 48 3A STA $3A48 (Indicate a Miss, due to the attack not changing any statuses or due to checks in its special effect) C2/3B23: 0C 5A 3A TSB $3A5A (Set target as missed) C2/3B26: 14 A4 TRB $A4 (Miss target) C2/3B28: 60 RTS Sketch C2/3B29: C0 08 CPY #$08 C2/3B2B: 90 EE BCC $3B1B (Miss if aimed at party) C2/3B2D: B9 80 3C LDA $3C80,Y C2/3B30: 89 20 BIT #$20 C2/3B32: D0 30 BNE $3B64 (Branch if can't sketch) C2/3B34: A3 05 LDA $05,S C2/3B36: AA TAX C2/3B37: BD 45 3C LDA $3C45,X C2/3B3A: 4A LSR C2/3B3B: 4A LSR C2/3B3C: 4A LSR C2/3B3D: 20 92 37 JSR $3792 (Sketch chance - pass bit 2 of $3C45 as carry) C2/3B40: B0 D9 BCS $3B1B (If sketch missed) C2/3B42: 8C 17 34 STY $3417 (save Target as Sketchee) C2/3B45: 98 TYA C2/3B46: E9 07 SBC #$07 C2/3B48: 4A LSR C2/3B49: 85 B7 STA $B7 C2/3B4B: 20 BB 35 JSR $35BB C2/3B4E: 20 5A 4B JSR $4B5A (0 to 255) C2/3B51: C9 40 CMP #$40 (75% chance for second sketch attack) C2/3B53: C2 30 REP #$30 (Set 16-bit Accumulator and Index registers) C2/3B55: B9 F9 1F LDA $1FF9,Y C2/3B58: 2A ROL C2/3B59: AA TAX C2/3B5A: BF 00 43 CF LDA $CF4300,X C2/3B5E: E2 30 SEP #$30 (Set 8-bit A,X & Y) C2/3B60: 8D 00 34 STA $3400 (Set attack to sketched attack) C2/3B63: 60 RTS C2/3B64: A9 1F LDA #$1F C2/3B66: 8D 01 34 STA $3401 (Store can't sketch message) C2/3B69: 80 B0 BRA $3B1B (Make attack miss) Special Effect $25 (Quake) C2/3B6B: B9 F9 3E LDA $3EF9,Y C2/3B6E: 30 AB BMI $3B1B (If Float status set, miss) C2/3B70: 60 RTS Leap C2/3B71: AD 49 2F LDA $2F49 C2/3B74: 89 08 BIT #$08 C2/3B76: D0 18 BNE $3B90 (Miss w/text) C2/3B78: AD 76 3A LDA $3A76 C2/3B7B: C9 02 CMP #$02 C2/3B7D: 90 11 BCC $3B90 (Miss w/text) C2/3B7F: A3 05 LDA $05,S C2/3B81: AA TAX C2/3B82: BD E9 3D LDA $3DE9,X C2/3B85: 09 20 ORA #$20 C2/3B87: 9D E9 3D STA $3DE9,X (Mark Hide status to be set in attacker) C2/3B8A: A9 04 LDA #$04 C2/3B8C: 8D 6E 3A STA $3A6E C2/3B8F: 60 RTS C2/3B90: A9 05 LDA #$05 C2/3B92: 8D 01 34 STA $3401 (Set to display text #5) C2/3B95: 4C 1B 3B JMP $3B1B (Miss target) Special Effect $50 (Possess) C2/3B98: A3 05 LDA $05,S C2/3B9A: AA TAX C2/3B9B: BD 18 30 LDA $3018,X C2/3B9E: 0C 4C 2F TSB $2F4C C2/3BA1: 0C 88 3A TSB $3A88 C2/3BA4: 20 4A 38 JSR $384A C2/3BA7: DA PHX C2/3BA8: BB TYX C2/3BA9: 20 4A 38 JSR $384A C2/3BAC: 7A PLY C2/3BAD: 4C 1B 36 JMP $361B Mind Blast C2/3BB0: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3BB2: 20 FF 44 JSR $44FF (Clear Status to Set and Status to Clear bytes) C2/3BB5: B9 18 30 LDA $3018,Y C2/3BB8: A2 06 LDX #$06 C2/3BBA: 3C 5C 3A BIT $3A5C,X (is this target in list of "Mind Blast victims"?) C2/3BBD: F0 07 BEQ $3BC6 (branch if not) C2/3BBF: 48 PHA C2/3BC0: DA PHX C2/3BC1: 20 D0 3B JSR $3BD0 (Randomly mark a status to be set) C2/3BC4: FA PLX C2/3BC5: 68 PLA C2/3BC6: CA DEX C2/3BC7: CA DEX C2/3BC8: 10 F0 BPL $3BBA (Do for all 4 list entries. an entity who's listed N times can get N statuses from this spell.) C2/3BCA: 60 RTS Evil Toot C2/3BCB: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3BCD: 20 FF 44 JSR $44FF (Clear Status to Set and Status to Clear bytes) C2/3BD0: AD AA 11 LDA $11AA C2/3BD3: 20 0E 52 JSR $520E (Pick a random bit) C2/3BD6: 86 EE STX $EE C2/3BD8: AD AC 11 LDA $11AC C2/3BDB: 20 0E 52 JSR $520E (Pick a random bit) C2/3BDE: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/3BE0: 8A TXA C2/3BE1: 18 CLC C2/3BE2: 65 EE ADC $EE C2/3BE4: 20 65 4B JSR $4B65 (0 to A - 1) C2/3BE7: C5 EE CMP $EE C2/3BE9: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3BEB: 08 PHP C2/3BEC: AD AA 11 LDA $11AA C2/3BEF: 90 03 BCC $3BF4 C2/3BF1: AD AC 11 LDA $11AC C2/3BF4: 20 2A 52 JSR $522A C2/3BF7: 28 PLP C2/3BF8: B0 03 BCS $3BFD C2/3BFA: 4C 32 0E JMP $0E32 (Set status picked bytes 1 or 2) C2/3BFD: 19 E8 3D ORA $3DE8,Y (Set status picked bytes 3 or 4) C2/3C00: 99 E8 3D STA $3DE8,Y C2/3C03: 60 RTS Rippler Effect C2/3C04: A3 05 LDA $05,S C2/3C06: AA TAX C2/3C07: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3C09: BD E4 3E LDA $3EE4,X (status bytes 1-2, caster) C2/3C0C: 39 E4 3E AND $3EE4,Y (status bytes 1-2, target) C2/3C0F: 49 FF FF EOR #$FFFF C2/3C12: 85 EE STA $EE (save the statuses that aren't shared among caster and target. iow, turn on any bits that aren't set in both) C2/3C14: BD E4 3E LDA $3EE4,X C2/3C17: 25 EE AND $EE (get statuses exclusive to caster) C2/3C19: 99 D4 3D STA $3DD4,Y (target status to set = statuses that were only set in caster) C2/3C1C: 9D FC 3D STA $3DFC,X (caster status to clear = statuses that were only set in caster) C2/3C1F: B9 E4 3E LDA $3EE4,Y C2/3C22: 25 EE AND $EE (get statuses exclusive to target) C2/3C24: 9D D4 3D STA $3DD4,X (caster status to set = statuses that were only set in target) C2/3C27: 99 FC 3D STA $3DFC,Y (target status to clear = statuses that were only set in target) C2/3C2A: BD F8 3E LDA $3EF8,X (status bytes 3-4, caster) C2/3C2D: 39 F8 3E AND $3EF8,Y (status bytes 3-4, target) C2/3C30: 49 FF FF EOR #$FFFF C2/3C33: 85 EE STA $EE (save the statuses that aren't shared among caster and target. iow, turn on any bits that aren't set in both) C2/3C35: BD F8 3E LDA $3EF8,X C2/3C38: 25 EE AND $EE (get statuses exclusive to caster) C2/3C3A: 99 E8 3D STA $3DE8,Y (target status to set = statuses that were only set in caster) C2/3C3D: 9D 10 3E STA $3E10,X (caster status to clear = statuses that were only set in caster) C2/3C40: B9 F8 3E LDA $3EF8,Y C2/3C43: 25 EE AND $EE (get statuses exclusive to target) C2/3C45: 9D E8 3D STA $3DE8,X (caster status to set = statuses that were only set in target) C2/3C48: 99 10 3E STA $3E10,Y (target status to clear = statuses that were only set in target) C2/3C4B: 60 RTS Exploder effect from 3DCD C2/3C4C: A3 05 LDA $05,S C2/3C4E: AA TAX C2/3C4F: 86 EE STX $EE C2/3C51: C4 EE CPY $EE C2/3C53: D0 05 BNE $3C5A C2/3C55: BD 18 30 LDA $3018,X C2/3C58: 14 A4 TRB $A4 C2/3C5A: 60 RTS Scan effect C2/3C5B: B9 80 3C LDA $3C80,Y C2/3C5E: 89 10 BIT #$10 C2/3C60: D0 06 BNE $3C68 (Branch if can't scan) C2/3C62: BB TYX C2/3C63: A9 27 LDA #$27 C2/3C65: 4C 91 4E JMP $4E91 C2/3C68: A9 2C LDA #$2C C2/3C6A: 8D 01 34 STA $3401 (Store "Can't Scan" message) C2/3C6D: 60 RTS Suplex code from $3DCD C2/3C6E: B9 80 3C LDA $3C80,Y C2/3C71: 89 04 BIT #$04 (Is Can't Suplex set in Misc/Special enemy byte?) C2/3C73: F0 E5 BEQ $3C5A (If not, exit function) C2/3C75: 4C 1B 3B JMP $3B1B (Makes miss) Special Effect $57 - Air Anchor C2/3C78: B9 A1 3A LDA $3AA1,Y C2/3C7B: 89 04 BIT #$04 C2/3C7D: D0 F6 BNE $3C75 (Miss if death prot.) C2/3C7F: A9 13 LDA #$13 C2/3C81: 8D 01 34 STA $3401 (Display text $13 - "Move, and you're dust!") C2/3C84: B9 05 32 LDA $3205,Y C2/3C87: 29 FB AND #$FB C2/3C89: 99 05 32 STA $3205,Y (Set Air Anchor effect) C2/3C8C: 9C 1A 34 STZ $341A (Special Effect $23 -- X-Zone, Odin, etc -- jumps here) C2/3C8F: 60 RTS L? Pearl from 3DCD C2/3C90: 60 RTS Charm C2/3C91: A3 05 LDA $05,S C2/3C93: AA TAX C2/3C94: BD 94 33 LDA $3394,X C2/3C97: 10 DC BPL $3C75 (Miss if attacker already charmed a target) C2/3C99: 98 TYA C2/3C9A: 9D 94 33 STA $3394,X (Attacker data: save which target they charmed) C2/3C9D: 8A TXA C2/3C9E: 99 95 33 STA $3395,Y (Target data: save who has charmed them) C2/3CA1: 60 RTS (Tapir) C2/3CA2: B9 E5 3E LDA $3EE5,Y C2/3CA5: 10 CE BPL $3C75 (Miss if target is not asleep) C2/3CA7: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3CA9: B9 1C 3C LDA $3C1C,Y C2/3CAC: 99 F4 3B STA $3BF4,Y (Set HP to max HP) C2/3CAF: C2 20 REP #$20 (Pep Up and Elixir/Megalixir branch here) C2/3CB1: B9 30 3C LDA $3C30,Y C2/3CB4: 99 08 3C STA $3C08,Y (Set MP to max MP) C2/3CB7: 60 RTS Pep Up C2/3CB8: A3 05 LDA $05,S C2/3CBA: AA TAX C2/3CBB: 20 4A 38 JSR $384A (Mark death and hide to be set) C2/3CBE: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3CC0: BD 18 30 LDA $3018,X C2/3CC3: 0C 4C 2F TSB $2F4C C2/3CC6: 9E F4 3B STZ $3BF4,X (Set caster HP to 0) C2/3CC9: 9E 08 3C STZ $3C08,X (Set caster MP to 0) C2/3CCC: 80 E1 BRA $3CAF (Set target's MP to max MP) Special Effect $2E - Seize C2/3CCE: A3 05 LDA $05,S C2/3CD0: AA TAX C2/3CD1: BD 58 33 LDA $3358,X C2/3CD4: 10 9F BPL $3C75 (Jumps to $3B1B - Miss) C2/3CD6: C0 08 CPY #$08 C2/3CD8: B0 9B BCS $3C75 (If target is not character - Miss) C2/3CDA: 98 TYA C2/3CDB: 9D 58 33 STA $3358,X C2/3CDE: 8A TXA C2/3CDF: 99 59 33 STA $3359,Y C2/3CE2: BD AC 3D LDA $3DAC,X C2/3CE5: 09 80 ORA #$80 C2/3CE7: 9D AC 3D STA $3DAC,X C2/3CEA: B9 18 30 LDA $3018,Y C2/3CED: 1C 03 34 TRB $3403 C2/3CF0: B9 A0 3A LDA $3AA0,Y C2/3CF3: 29 7F AND #$7F (Clear bit 7) C2/3CF5: 99 A0 3A STA $3AA0,Y C2/3CF8: A9 40 LDA #$40 C2/3CFA: 4C 4C 46 JMP $464C Discard C2/3CFD: A3 05 LDA $05,S C2/3CFF: AA TAX C2/3D00: BD AC 3D LDA $3DAC,X C2/3D03: 29 7F AND #$7F C2/3D05: 9D AC 3D STA $3DAC,X C2/3D08: A9 FF LDA #$FF C2/3D0A: 9D 58 33 STA $3358,X C2/3D0D: 99 59 33 STA $3359,Y C2/3D10: B9 18 30 LDA $3018,Y C2/3D13: 0C 03 34 TSB $3403 C2/3D16: 60 RTS (Special effect $4C - Elixir and Megalixir. In Item data, this appears as Special effect $04) C2/3D17: A9 80 LDA #$80 C2/3D19: 20 4C 46 JSR $464C (Sets bit 7 in $3204,Y) C2/3D1C: 80 91 BRA $3CAF (Set MP to Max MP) Overcast C2/3D1E: B9 4D 3E LDA $3E4D,Y C2/3D21: 09 02 ORA #$02 C2/3D23: 99 4D 3E STA $3E4D,Y (Turn on Overcast bit, which will be checked by function C2/450D to give a dying target Zombie instead) C2/3D26: 60 RTS Zinger C2/3D27: A3 05 LDA $05,S C2/3D29: AA TAX C2/3D2A: 8E F8 33 STX $33F8 C2/3D2D: 8C F9 33 STY $33F9 C2/3D30: BD 19 30 LDA $3019,X C2/3D33: 0C 4D 2F TSB $2F4D C2/3D36: 60 RTS Love Token C2/3D37: A3 05 LDA $05,S C2/3D39: AA TAX C2/3D3A: 98 TYA C2/3D3B: 9D 6C 33 STA $336C,X (Attacker data: save which target takes damage for them) C2/3D3E: 8A TXA C2/3D3F: 99 6D 33 STA $336D,Y (Target data: save who they're taking damage for) C2/3D42: 60 RTS Kill with 'X' effect (Auto hit undead, Restores undead) C2/3D43: 18 CLC C2/3D44: A9 7E LDA #$7E C2/3D46: 20 90 38 JSR $3890 C2/3D49: B9 95 3C LDA $3C95,Y (Doom effect jumps here) C2/3D4C: 10 14 BPL $3D62 (Exit function if not undead) C2/3D4E: C0 08 CPY #$08 C2/3D50: B0 11 BCS $3D63 (If not character) C2/3D52: B9 D4 3D LDA $3DD4,Y C2/3D55: 29 7F AND #$7F C2/3D57: 99 D4 3D STA $3DD4,Y (Remove Death from Status to Set) C2/3D5A: C2 20 REP #$20 C2/3D5C: B9 1C 3C LDA $3C1C,Y C2/3D5F: 99 F4 3B STA $3BF4,Y (Fully heal HP) C2/3D62: 60 RTS C2/3D63: 7B TDC C2/3D64: B9 E9 3D LDA $3DE9,Y C2/3D67: 09 20 ORA #$20 C2/3D69: 99 E9 3D STA $3DE9,Y (Add hide to target) C2/3D6C: B9 19 30 LDA $3019,Y C2/3D6F: EB XBA C2/3D70: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3D72: 85 B8 STA $B8 C2/3D74: A2 0A LDX #$0A C2/3D76: A9 24 00 LDA #$0024 C2/3D79: 4C 91 4E JMP $4E91 Phantasm C2/3D7C: B9 4D 3E LDA $3E4D,Y C2/3D7F: 09 40 ORA #$40 C2/3D81: 99 4D 3E STA $3E4D,Y (give Seizure-like quasi status to target) C2/3D84: 60 RTS Stunner (Only a Hit Rate / 256 chance it will actually try to inflict statuses on the target) C2/3D85: 20 5A 4B JSR $4B5A (0 to 255) C2/3D88: CD A8 11 CMP $11A8 C2/3D8B: 90 1A BCC $3DA7 (If less than hit rate then exit) C2/3D8D: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3D8F: AD AA 11 LDA $11AA (Spell's Status to Set bytes 1+2) C2/3D92: 49 FF FF EOR #$FFFF C2/3D95: 39 D4 3D AND $3DD4,Y (Subtract it from target's Status to Set bytes 1+2) C2/3D98: 99 D4 3D STA $3DD4,Y C2/3D9B: AD AC 11 LDA $11AC (Spell's Status to Set bytes 3+4) C2/3D9E: 49 FF FF EOR #$FFFF C2/3DA1: 39 E8 3D AND $3DE8,Y (Subtract it from target's Status to Set bytes 3+4) C2/3DA4: 99 E8 3D STA $3DE8,Y C2/3DA7: 60 RTS Targeting C2/3DA8: A3 05 LDA $05,S C2/3DAA: AA TAX C2/3DAB: 98 TYA C2/3DAC: 9D F5 32 STA $32F5,X (Stores target) C2/3DAF: 60 RTS Fallen One C2/3DB0: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3DB2: 7B TDC (Clear Accumulator) C2/3DB3: 1A INC C2/3DB4: 99 F4 3B STA $3BF4,Y (Store 1 in HP) C2/3DB7: 60 RTS Special effect $4A - Super Ball C2/3DB8: 20 5A 4B JSR $4B5A (Random Number 0 to 255) C2/3DBB: 29 07 AND #$07 (Random Number 0 to 7) C2/3DBD: 1A INC (1 to 8) C2/3DBE: 8D B1 11 STA $11B1 (Set damage to 256 to 2048 in steps of 256) C2/3DC1: 9C B0 11 STZ $11B0 C2/3DC4: 60 RTS Morph Chance C2/3DC5: FF C2/3DC6: C0 C2/3DC7: 80 C2/3DC8: 40 C2/3DC9: 20 C2/3DCA: 10 C2/3DCB: 08 C2/3DCC: 00 Table for special effects code pointers 1 C2/3DCD: 8C 38 C2/3DCF: 8C 38 C2/3DD1: 8C 38 C2/3DD3: 43 3D ($03) C2/3DD5: F2 38 ($04) C2/3DD7: 8C 38 C2/3DD9: 8C 38 C2/3DDB: 8C 38 C2/3DDD: FE 38 ($08) C2/3DDF: 8C 38 C2/3DE1: 8C 38 C2/3DE3: 8C 38 C2/3DE5: 8C 38 C2/3DE7: 8D 38 ($0D) C2/3DE9: 8C 38 C2/3DEB: 8C 38 C2/3DED: 5B 3C ($10) C2/3DED: 8C 38 C2/3DF1: 3C 3A ($12) C2/3DF3: 34 39 ($13) C2/3DF5: 8C 38 C2/3DF7: 8C 38 C2/3DF9: 8C 38 C2/3DFB: A2 3C ($17) C2/3DFD: 8C 38 C2/3DFF: 4C 3C ($19) C2/3E01: 8C 38 C2/3E03: 8C 38 C2/3E05: 90 3C ($1C) C2/3E08: 8C 38 C2/3E09: 8C 38 C2/3E0B: 78 39 ($1F) C2/3E0D: B8 3C ($20) C2/3E0F: 04 3C ($21) C2/3E11: 22 39 ($22) C2/3E13: 8C 3C ($23) C2/3E15: 8C 38 C2/3E17: 6B 3B ($25) C2/3E19: 89 39 ($26) C2/3E1B: 6C 39 ($27) C2/3E1D: B0 3B ($28) C2/3E1F: 8C 38 C2/3E21: 8C 38 C2/3E23: 80 39 ($2B) C2/3E25: 8C 38 C2/3E27: 37 3D ($2D) C2/3E29: CE 3C ($2E) C2/3E2B: A8 3D ($2F) C2/3E2D: 6E 3C ($30) C2/3E2F: 8C 38 C2/3E31: 8C 38 C2/3E33: 66 39 ($33) C2/3E35: 91 3C ($34) C2/3E37: 49 3D ($35) C2/3E39: 8C 38 C2/3E3B: 1E 3D ($37) C2/3E3D: 6C 39 ($38) C2/3E3F: 5E 39 ($39) C2/3E41: 27 3D ($3A) C2/3E43: CB 3B ($3B) C2/3E45: 8C 38 C2/3E47: 8C 38 C2/3E49: 7C 3D ($3E) C2/3E4B: 85 3D ($3F) C2/3E4D: B0 3D ($40) C2/3E4F: 8C 38 C2/3E51: 8C 38 C2/3E53: 8C 38 C2/3E55: FD 3C ($44) C2/3E57: 8C 38 C2/3E59: 8C 38 C2/3E5B: 8C 38 C2/3E5D: 8C 38 C2/3E5F: 8C 38 C2/3E61: B8 3D ($4A) C2/3E63: 6C 39 ($4B) C2/3E65: 17 3D ($4C) C2/3E67: 8C 38 C2/3E69: 8C 38 C2/3E6B: 8C 38 C2/3E6D: 98 3B ($50) C2/3E6F: 8C 38 C2/3E71: 9E 39 ($52) C2/3E73: C5 3A ($53) C2/3E75: 71 3B ($54) C2/3E77: 29 3B ($55) C2/3E79: 8D 3A ($56) C2/3E7B: 78 3C ($57) C2/3E7D: DA PHX C2/3E7E: 08 PHP C2/3E7F: E2 30 SEP #$30 C2/3E81: 9B TXY C2/3E82: AE A9 11 LDX $11A9 C2/3E85: FC E1 42 JSR ($42E1,X) (Calls special effect code) C2/3E88: 28 PLP C2/3E89: FA PLX C2/3E8A: 60 RTS Random Steal Effect (Special Effect 1 - ThiefKnife) C2/3E8B: 20 53 4B JSR $4B53 (50% chance to steal) C2/3E8E: B0 0F BCS $3E9F C2/3E90: A9 A4 LDA #$A4 (Add steal effect to attack) C2/3E92: 8D A9 11 STA $11A9 C2/3E95: A5 B5 LDA $B5 C2/3E97: C9 00 CMP #$00 C2/3E99: D0 04 BNE $3E9F (Exit if $B5 is not 0) C2/3E9B: A9 06 LDA #$06 C2/3E9D: 85 B5 STA $B5 (Set $B5 to $06) C2/3E9F: 60 RTS Step Mine C2/3EA0: 9C 14 34 STZ $3414 (Set to ignore damage modifiers) C2/3EA3: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3EA5: 7B TDC C2/3EA6: 3A DEC C2/3EA7: 8D B0 11 STA $11B0 (Store 65535 in maximum damage) C2/3EAA: AD 67 18 LDA $1867 (Steps High 2 Bytes) C2/3EAD: AE A6 11 LDX $11A6 (Spell Power) C2/3EB0: 20 92 47 JSR $4792 (Division function Steps / Spell Power) C2/3EB3: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/3EB5: EB XBA C2/3EB6: D0 11 BNE $3EC9 (If the top byte of quotient is nonzero, we know the final result will exceed 2 bytes, so leave it at 65535 and branch) C2/3EB8: 8A TXA C2/3EB9: EB XBA C2/3EBA: 8D B1 11 STA $11B1 (Store in Maximum Damage high byte) C2/3EBD: AD 66 18 LDA $1866 (Steps Low Byte) C2/3EC0: AE A6 11 LDX $11A6 (Spell Power) C2/3EC3: 20 92 47 JSR $4792 (Division function) C2/3EC6: 8D B0 11 STA $11B0 (Store in Maximum Damage low byte) C2/3EC9: 60 RTS (Ogre Nix - Weapon randomly breaks. Also uses MP for criticals) C2/3ECA: A5 B1 LDA $B1 C2/3ECC: 4A LSR C2/3ECD: B0 53 BCS $3F22 (Jump to code for attack with MP if bit 0 of $B1 is set) C2/3ECF: B9 A0 3A LDA $3AA0,Y C2/3ED2: 89 04 BIT #$04 C2/3ED4: D0 4C BNE $3F22 (Jump to code for attack with MP if bit 3 of $3AA0,Y is set) C2/3ED6: B9 F5 3B LDA $3BF5,Y (Load high byte of HP) C2/3ED9: EB XBA C2/3EDA: B9 F4 3B LDA $3BF4,Y (Load low byte of HP) C2/3EDD: A2 0A LDX #$0A C2/3EDF: 20 92 47 JSR $4792 (HP / 10. X = remainder, or the ones digit) C2/3EE2: E8 INX C2/3EE3: 8A TXA C2/3EE4: 20 65 4B JSR $4B65 (Random number 0 to last digit of HP) C2/3EE7: 3A DEC C2/3EE8: 10 38 BPL $3F22 (If number was not 0, branch) C2/3EEA: 98 TYA C2/3EEB: 4A LSR C2/3EEC: AA TAX (X = target [0, 1, 2, 3, etc]) C2/3EED: FE 30 2F INC $2F30,X (flag character's properties to be recalculated from his/her equipment at end of turn.) C2/3EF0: EB XBA C2/3EF1: A9 05 LDA #$05 C2/3EF3: 20 81 47 JSR $4781 (Multiplication function) C2/3EF6: 85 EE STA $EE (save target # * 5) C2/3EF8: BB TYX C2/3EF9: AD 70 3A LDA $3A70 (# of strikes remaining in attack. with Fight/Capture, this value is always odd when the right hand is striking, and even when the left is. unfortunately, that's not the case with Jump -- the hand used has nothing to do with the strike # (in fact, it's random when Genji Glove is worn) -- resulting in a bug where Ogre Nix fails to break when it should [as C2/3F0B will check the wrong hand].) C2/3EFC: 4A LSR (Carry = 1 for right hand, 0 for left) C2/3EFD: B0 07 BCS $3F06 (branch if right hand is attacking) C2/3EFF: E8 INX (point to left hand equipment slot) C2/3F00: A5 EE LDA $EE C2/3F02: 69 14 ADC #$14 C2/3F04: 85 EE STA $EE (point to the character's left hand in their menu data?) C2/3F06: 9E 68 3B STZ $3B68,X (zero this hand's Battle Power) C2/3F09: A6 EE LDX $EE C2/3F0B: BD 86 2B LDA $2B86,X (get item in this hand) C2/3F0E: C9 17 CMP #$17 C2/3F10: D0 10 BNE $3F22 (Branch if it's not Ogre Nix) C2/3F12: A9 FF LDA #$FF C2/3F14: 9D 86 2B STA $2B86,X (null this hand slot in the character's menu data) C2/3F17: 9D 87 2B STA $2B87,X C2/3F1A: 9E 89 2B STZ $2B89,X C2/3F1D: A9 44 LDA #$44 C2/3F1F: 8D 01 34 STA $3401 (Display weapon broke text) C2/3F22: A9 0C LDA #$0C (Special Effect 7 - Use MP for criticals - jumps here. Featured in weapons such as Rune Edge and Illumina.) C2/3F24: 85 EE STA $EE C2/3F26: A5 B2 LDA $B2 C2/3F28: 89 02 BIT #$02 C2/3F2A: D0 23 BNE $3F4F (Exit function if "No Critical and Ignore True Knight" is set) C2/3F2C: AD C9 3E LDA $3EC9 C2/3F2F: F0 1E BEQ $3F4F (Exit function if no targets) C2/3F31: 7B TDC (Clear 16-bit A) C2/3F32: 20 5A 4B JSR $4B5A (0 to 255) C2/3F35: 29 07 AND #$07 (0 to 7) C2/3F37: 18 CLC C2/3F38: 65 EE ADC $EE (Add to $EE [#$0C]) C2/3F3A: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3F3C: 85 EE STA $EE C2/3F3E: B9 08 3C LDA $3C08,Y (MP) C2/3F41: C5 EE CMP $EE C2/3F43: 90 0A BCC $3F4F (Exit function if weapon would drain more MP than the wielder currently has) C2/3F45: E5 EE SBC $EE C2/3F47: 99 08 3C STA $3C08,Y (MP - $EE) C2/3F4A: A9 00 02 LDA #$0200 C2/3F4D: 14 B2 TRB $B2 (Set always critical) C2/3F4F: 60 RTS (Special Effect $0F - Use MP for criticals. No weapons use this, afaik.) C2/3F50: A9 1C LDA #$1C C2/3F52: 80 D0 BRA $3F24 Pearl Wind C2/3F54: A9 60 LDA #$60 C2/3F56: 0C A2 11 TSB $11A2 (Sets no split damage, and ignore defense) C2/3F59: 9C 14 34 STZ $3414 (Set to not modify damage) C2/3F5C: C2 20 REP #$20 C2/3F5E: B9 F4 3B LDA $3BF4,Y (HP) C2/3F61: 8D B0 11 STA $11B0 (Maximum Damage = HP) C2/3F64: 60 RTS Golem C2/3F65: C2 20 REP #$20 C2/3F67: B9 F4 3B LDA $3BF4,Y (HP) C2/3F6A: 8D 36 3A STA $3A36 (HP that Golem will absorb) C2/3F6D: 60 RTS Special Effect 6 - Soul Sabre C2/3F6E: A9 80 LDA #$80 C2/3F70: 0C A3 11 TSB $11A3 (Sets attack to Concern MP) C2/3F73: A9 08 LDA #$08 (Special Effect 5 - Drainer jumps here) C2/3F75: 0C A2 11 TSB $11A2 (Sets attack to heal undead) C2/3F78: A9 02 LDA #$02 C2/3F7A: 0C A4 11 TSB $11A4 (Sets attack to redirection) C2/3F7D: 60 RTS Recover HP - Heal Rod C2/3F7E: A9 20 LDA #$20 C2/3F80: 0C A2 11 TSB $11A2 (Sets attack to ignore defense) C2/3F83: A9 01 LDA #$01 C2/3F85: 0C A4 11 TSB $11A4 (Sets attack to heal) C2/3F88: 60 RTS Valiant Knife C2/3F89: A9 20 LDA #$20 C2/3F8B: 0C A2 11 TSB $11A2 (Sets attack to ignore defense) C2/3F8E: C2 20 REP #$20 C2/3F90: 38 SEC C2/3F91: B9 1C 3C LDA $3C1C,Y (Max HP) C2/3F94: F9 F4 3B SBC $3BF4,Y (HP) C2/3F97: 18 CLC C2/3F98: 6D B0 11 ADC $11B0 (Add Max HP - Current HP to damage) C2/3F9B: 8D B0 11 STA $11B0 C2/3F9E: 60 RTS (Wind Slash - Tempest) C2/3F9F: 20 5A 4B JSR $4B5A (Random Number Function: 0 to 255) C2/3FA2: C9 80 CMP #$80 C2/3FA4: B0 10 BCS $3FB6 (50% chance exit function) C2/3FA6: 9C A6 11 STZ $11A6 (Clear Battle Power) C2/3FA9: A9 65 LDA #$65 (Wind Slash spell number) C2/3FAB: 80 03 BRA $3FB0 (Magicite) C2/3FAD: 20 DC 37 JSR $37DC (Picks random Esper, not Odin or Raiden) C2/3FB0: 8D 00 34 STA $3400 (Save the spell number) C2/3FB3: EE 70 3A INC $3A70 (Increment the number of attacks remaining) C2/3FB6: 60 RTS Special effect $51 GP Rain C2/3FB7: B9 18 3B LDA $3B18,Y (Attacker's Level) C2/3FBA: EB XBA C2/3FBB: A9 1E LDA #$1E C2/3FBD: 20 81 47 JSR $4781 (attack will cost: Attacker's Level * 30) C2/3FC0: C2 20 REP #$20 (Set 16-bit accumulator) C2/3FC2: C0 08 CPY #$08 (Check if target is monster) C2/3FC4: B0 0D BCS $3FD3 (Branch if target is monster) C2/3FC6: 20 B6 37 JSR $37B6 (deduct thrown gold from party's inventory) C2/3FC9: D0 1E BNE $3FE9 (branch if there was actually some GP to throw) C2/3FCB: 64 A4 STZ $A4 (Makes attack target nothing) C2/3FCD: A2 08 LDX #$08 C2/3FCF: 8E 01 34 STX $3401 (Set to display text 8 - "No money!!") C2/3FD2: 60 RTS C2/3FD3: 85 EE STA $EE (Level * 30) C2/3FD5: B9 98 3D LDA $3D98,Y (Gold monster gives) C2/3FD8: F0 F1 BEQ $3FCB (Miss all w/text if = 0) C2/3FDA: E5 EE SBC $EE C2/3FDC: B0 06 BCS $3FE4 (If gold > Level * 30) C2/3FDE: B9 98 3D LDA $3D98,Y C2/3FE1: 85 EE STA $EE (Set $EE to Gold) C2/3FE3: 7B TDC C2/3FE4: 99 98 3D STA $3D98,Y (Set Gold to 0 or Gold - Level * 30) C2/3FE7: A5 EE LDA $EE C2/3FE9: A2 02 LDX #$02 C2/3FEB: 86 E8 STX $E8 C2/3FED: 20 B7 47 JSR $47B7 (A = $EE / 128) C2/3FF0: A5 E8 LDA $E8 ($EE * 2) C2/3FF2: AE C9 3E LDX $3EC9 (Number of targets) C2/3FF5: 20 92 47 JSR $4792 (A / number of targets) C2/3FF8: 8D B0 11 STA $11B0 (Sets maximum damage) C2/3FFB: 60 RTS Exploder effect from 42E1 C2/3FFC: BB TYX C2/3FFD: 64 BC STZ $BC C2/3FFF: A9 10 LDA #$10 C2/4001: 04 B0 TSB $B0 C2/4003: 9C 14 34 STZ $3414 (Set to not modify damage) C2/4006: C2 20 REP #$20 C2/4008: A5 A4 LDA $A4 C2/400A: 48 PHA C2/400B: BD 18 30 LDA $3018,X C2/400E: 85 B8 STA $B8 C2/4010: 20 C2 57 JSR $57C2 C2/4013: 20 DB 63 JSR $63DB (Copy $An variables to ($78) buffer) C2/4016: A3 01 LDA $01,S C2/4018: 85 B8 STA $B8 C2/401A: 20 C2 57 JSR $57C2 C2/401D: 68 PLA C2/401E: 1D 18 30 ORA $3018,X C2/4021: 85 A4 STA $A4 C2/4023: BD F4 3B LDA $3BF4,X C2/4026: 8D B0 11 STA $11B0 (Sets damage to HP) C2/4029: 4C AD 35 JMP $35AD Special effect $4A (Super Ball) C2/402C: A9 7D LDA #$7D C2/402E: 85 B6 STA $B6 (Set Animation) C2/4030: 20 5A 4B JSR $4B5A (0 to 255) C2/4033: 29 03 AND #$03 (0 to 3) C2/4035: 80 02 BRA $4039 C2/4037: A9 07 LDA #$07 (Special Effect $2C, Launcher, jumps here) C2/4039: 8D 05 34 STA $3405 (# of hits to do. this is a zero-based counter, so a value of 0 means 1 hit.) C2/403C: C2 20 REP #$20 (Set 16-bit Accumulator) C2/403E: B9 18 30 LDA $3018,Y C2/4041: 85 A6 STA $A6 (mark attacker as "reflected off of", which will later trigger function C2/3483 and cause him/her to be treated as the missile launcher or ball thrower.) C2/4043: 60 RTS Special Effect 2 (Atma Weapon) C2/4044: A9 20 LDA #$20 C2/4046: 0C A2 11 TSB $11A2 (Set attack to ignore defense) C2/4049: A9 02 LDA #$02 C2/404B: 04 B2 TSB $B2 (Set no critical & ignore True Knight) C2/404D: 60 RTS Warp effect C2/404E: A5 B1 LDA $B1 C2/4050: 89 04 BIT #$04 C2/4052: D0 06 BNE $405A C2/4054: A9 02 LDA #$02 C2/4056: 8D 6E 3A STA $3A6E C2/4059: 60 RTS C2/405A: A9 0A LDA #$0A C2/405C: 8D 01 34 STA $3401 (Display can't run text) C2/405F: 80 3B BRA $409C (Miss all targets) Bababreath from 42E1 C2/4061: 64 EE STZ $EE C2/4063: A2 06 LDX #$06 C2/4065: BD A0 3A LDA $3AA0,X C2/4068: 4A LSR C2/4069: 90 11 BCC $407C C2/406B: BD E4 3E LDA $3EE4,X (Status byte 1) C2/406E: 89 C2 BIT #$C2 (Check for Dead, Zombie, or Petrify) C2/4070: F0 0A BEQ $407C (Branch if none set) C2/4072: BD 18 30 LDA $3018,X C2/4075: 2C 2C 3F BIT $3F2C C2/4078: D0 02 BNE $407C (branch if airborne from jump?) C2/407A: 85 EE STA $EE C2/407C: CA DEX C2/407D: CA DEX C2/407E: 10 E5 BPL $4065 (Loop through all 4 characters) C2/4080: A5 EE LDA $EE C2/4082: D0 09 BNE $408D (if any character is Dead/Zombied/Petrified and not airborne, use it as target instead. if there're multiple such characters, use the one who's closest to the start of the party lineup.) C2/4084: AD 76 3A LDA $3A76 C2/4087: C9 02 CMP #$02 C2/4089: B0 2F BCS $40BA (Exit function if 2+ characters alive, retaining the initial target) C2/408B: 80 0F BRA $409C (Miss all targets, because we don't want to blow away the only living character.) C2/408D: 85 B8 STA $B8 (save the Dead/Zombied/Petrified character as sole target) C2/408F: 64 B9 STZ $B9 (clear any monster targets) C2/4091: BB TYX C2/4092: 4C C2 57 JMP $57C2 Special effect $50 - Possess 106/256 chance to miss C2/4095: 20 5A 4B JSR $4B5A (Random Number Function 0 to 255) C2/4098: C9 96 CMP #$96 C2/409A: 90 1E BCC $40BA (Exit function if A < #$96) C2/409C: 64 A4 STZ $A4 (Make target nothing) C2/409E: 64 A5 STZ $A5 C2/40A0: 60 RTS L? Pearl from 42E1 C2/40A1: AD 62 18 LDA $1862 C2/40A4: EB XBA C2/40A5: AD 61 18 LDA $1861 C2/40A8: A2 0A LDX #$0A C2/40AA: 20 92 47 JSR $4792 (Divides gold by 10) C2/40AD: 8A TXA C2/40AE: EB XBA C2/40AF: AD 60 18 LDA $1860 C2/40B2: A2 0A LDX #$0A C2/40B4: 20 92 47 JSR $4792 C2/40B7: 8E A8 11 STX $11A8 (Hit rate / level multiplier for LX spells) C2/40BA: 60 RTS Escape C2/40BB: C0 08 CPY #$08 C2/40BD: B0 FB BCS $40BA (Exit if character) C2/40BF: A9 22 LDA #$22 C2/40C1: 85 B5 STA $B5 C2/40C3: A9 10 LDA #$10 C2/40C5: 04 A0 TSB $A0 C2/40C7: 60 RTS Special effect $4B C2/40C8: A9 04 LDA #$04 C2/40CA: 24 B1 BIT $B1 C2/40CC: F0 EC BEQ $40BA (Exit) C2/40CE: 20 9C 40 JSR $409C (Set to no targets) C2/40D1: 9C A9 11 STZ $11A9 (Clear special effect) C2/40D4: A9 09 LDA #$09 C2/40D6: 8D 01 34 STA $3401 (Display text #9) C2/40D9: 60 RTS Forcefield C2/40DA: 7B TDC (Clear Accumulator) C2/40DB: A9 FF LDA #$FF C2/40DD: 4D C8 3E EOR $3EC8 C2/40E0: F0 BA BEQ $409C (Miss if all elements nullified) C2/40E2: 20 2A 52 JSR $522A (Randomly pick a set bit) C2/40E5: 0C C8 3E TSB $3EC8 (Set that bit in $3EC8) C2/40E8: 20 F0 51 JSR $51F0 C2/40EB: 8A TXA C2/40EC: 18 CLC C2/40ED: 69 37 ADC #$37 C2/40EF: 80 E5 BRA $40D6 Quadra Slam, Quadra Slice, etc. 4 Random attacks C2/40F1: A9 03 LDA #$03 C2/40F3: 8D 70 3A STA $3A70 (# of attacks) C2/40F6: A9 40 LDA #$40 C2/40F8: 04 BA TSB $BA (Sets randomize target) C2/40FA: 9C A9 11 STZ $11A9 (Clears special effect) C2/40FD: 60 RTS Blow Fish C2/40FE: A9 60 LDA #$60 C2/4100: 0C A2 11 TSB $11A2 (Set Ignore defense, and no split damage) C2/4103: 9C 14 34 STZ $3414 (Set to not modify damage) C2/4106: C2 20 REP #$20 (Set 16-bit Accumulator) C2/4108: A9 E8 03 LDA #$03E8 C2/410B: 8D B0 11 STA $11B0 (Set damage to 1000) C2/410E: 60 RTS Flare Star C2/410F: 9C 14 34 STZ $3414 (Set to not modify damage) C2/4112: C2 20 REP #$20 (Set 16-bit Accumulator) C2/4114: A5 A2 LDA $A2 C2/4116: 20 2A 52 JSR $522A (A = a random bit set in $A2) C2/4119: 20 F9 51 JSR $51F9 (Y = [Number of highest target set in A] * 2) C2/411C: A5 A2 LDA $A2 C2/411E: 20 0E 52 JSR $520E (X = number of bits set in A) C2/4121: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/4123: B9 18 3B LDA $3B18,Y (Level) C2/4126: EB XBA C2/4127: AD A6 11 LDA $11A6 (Spell Power) C2/412A: 20 81 47 JSR $4781 (Spell Power * Level) C2/412D: 20 92 47 JSR $4792 (Divide by X) C2/4130: C2 20 REP #$20 (Set 16-bit Accumulator) C2/4132: 8D B0 11 STA $11B0 (Store in maximum damage) C2/4135: 60 RTS (Special effect $4C - Elixir and Megalixir. In Item data, this appears as Special effect $04) C2/4136: A9 80 LDA #$80 C2/4138: 1C A3 11 TRB $11A3 (Clears concern MP) C2/413B: 60 RTS (Special effect $28 - Mind Blast) C2/413C: C2 20 REP #$20 (Set 16-bit Accumulator) C2/413E: A0 06 LDY #$06 C2/4140: A5 A4 LDA $A4 C2/4142: 20 2A 52 JSR $522A (Randomly pick an entity from among the targets) C2/4145: 99 5C 3A STA $3A5C,Y (add them to "Mind Blast victims" list. the other Mind blast special effect will later try to give an ailment to each entry in the list. and yes, there can be duplicates.) C2/4148: 88 DEY C2/4149: 88 DEY C2/414A: 10 F4 BPL $4140 (Do four times) C2/414C: 60 RTS (Miss random targets Special Effect $29 - N. Cross Each target will have a 50% chance of being untargeted.) C2/414D: 20 5A 4B JSR $4B5A (0 to 255) C2/4150: 14 A4 TRB $A4 C2/4152: 20 5A 4B JSR $4B5A (0 to 255) C2/4155: 14 A5 TRB $A5 C2/4157: 60 RTS (Dice Effect) C2/4158: 9C 14 34 STZ $3414 (Set to not modify damage) C2/415B: A9 20 LDA #$20 C2/415D: 0C A4 11 TSB $11A4 (Makes unblockable) C2/4160: A9 0F LDA #$0F C2/4162: 85 B6 STA $B6 (Third die defaults to null to start with) C2/4164: 7B TDC C2/4165: 20 5A 4B JSR $4B5A (Random Number Function 0 to 255) C2/4168: 48 PHA C2/4169: 29 0F AND #$0F (0 to 15) C2/416B: A2 06 LDX #$06 (will divide bottom nibble of random number by 6) C2/416D: 20 92 47 JSR $4792 (Division A/X. X will hold A MOD X) C2/4170: 86 B7 STX $B7 (First die roll, 0 to 5 -- 3/16 chance of 0 thru 3 each, 2/16 chance of 4 thru 5 each) C2/4172: E8 INX C2/4173: 86 EE STX $EE (Save first die roll, 1 to 6) C2/4175: 68 PLA (Retrieve our 0-255 random number) C2/4176: A2 60 LDX #$60 (will divide top nibble of random number by 6) C2/4178: 20 92 47 JSR $4792 (Division A/X) C2/417B: 8A TXA (get MOD of division) C2/417C: 29 F0 AND #$F0 (0 to 5) C2/417E: 05 B7 ORA $B7 C2/4180: 85 B7 STA $B7 ($B7: bottom nibble = 1st die roll 0 thru 5, top nibble = 2nd die roll 0 thru 5) C2/4182: 4A LSR C2/4183: 4A LSR C2/4184: 4A LSR C2/4185: 4A LSR C2/4186: 1A INC (2nd die roll, converted to a 1 thru 6 value) C2/4187: EB XBA (1 to 6) C2/4188: A5 EE LDA $EE (Get first die roll, 1 to 6) C2/418A: 20 81 47 JSR $4781 (Multiply) C2/418D: 85 EE STA $EE ($EE = 1st roll * 2nd roll, where each roll is 1 thru 6) C2/418F: AD A8 11 LDA $11A8 (# of dice) C2/4192: C9 03 CMP #$03 C2/4194: 90 15 BCC $41AB (Branch if less than 3 dice, i.e. there's 2) C2/4196: 7B TDC (Clear Accumulator) C2/4197: AD 1E 02 LDA $021E (our 1-60 frame counter? because 6 divides evenly into 60, the third die has the same odds for all sides; it is NOT slanted against you like the first two dice.) C2/419A: A2 06 LDX #$06 C2/419C: 20 92 47 JSR $4792 (Division A/X) C2/419F: 8A TXA (new random number MOD 6) C2/41A0: 85 B6 STA $B6 (save third die roll) C2/41A2: 1A INC C2/41A3: EB XBA (3rd die roll, converted to a 1 thru 6 value) C2/41A4: A5 EE LDA $EE C2/41A6: 20 81 47 JSR $4781 ( (1st roll * 2nd roll) * 3rd roll) C2/41A9: 85 EE STA $EE ($EE = 1st roll * 2nd roll * 3rd roll, where each roll is 1 thru 6) C2/41AB: A2 00 LDX #$00 C2/41AD: A5 B6 LDA $B6 (holds third die roll [0 to 5] if 3 dice, or F if only 2 dice) C2/41AF: 0A ASL C2/41B0: 0A ASL C2/41B1: 0A ASL C2/41B2: 0A ASL C2/41B3: 05 B6 ORA $B6 (A: if 2 dice, A = FF. if 3 dice, A top nibble = 3rd die roll, and A bottom nibble = 3rd die roll) C2/41B5: C5 B7 CMP $B7 (does 3rd die roll match both 1st and 2nd? obviously, it can NEVER if A = FF) C2/41B7: D0 02 BNE $41BB (if no match, branch) C2/41B9: A6 B6 LDX $B6 (X = 0 if there's not 3 matching dice. if there are, we've got a bonus coming, so let X be the 0 thru 5 roll value) C2/41BB: A5 EE LDA $EE (depending on # of dice, retrieve either: 1st roll * 2nd roll OR 1st roll * 2nd roll * 3rd roll) C2/41BD: EB XBA C2/41BE: AD AF 11 LDA $11AF (Level) C2/41C1: 0A ASL C2/41C2: 20 81 47 JSR $4781 ( (1st roll * 2nd roll * 3rd roll) * (Level * 2) ) C2/41C5: C2 20 REP #$20 (set 16 bit-Accumulator) C2/41C7: 85 EE STA $EE (overall damage = 2 Dice: 1st roll * 2nd roll * Level * 2, 3 Dice: 1st roll * 2nd roll * 3rd roll * Level * 2) C2/41C9: 18 CLC C2/41CA: 8D B0 11 STA $11B0 (save damage) C2/41CD: A5 EE LDA $EE C2/41CF: 6D B0 11 ADC $11B0 (Add [Level * 1st roll * 2nd roll * 3rd roll * 2] or [Level * 1st roll * 2nd roll * 2] to damage) C2/41D2: 90 02 BCC $41D6 (branch if it didn't overflow) C2/41D4: 7B TDC C2/41D5: 3A DEC (set running damage to 65535) C2/41D6: CA DEX C2/41D7: 10 F0 BPL $41C9 (Add the damage to itself X times, where X is the value as commented at C2/41B9. This loop serves to multiply 3 matching dice by the roll value once more. if X is 0 (i.e. no 3 matching dice, or 3 matching dice with a value of 1), the added damage is never saved. only the initial, unmultiplied damage is saved. which makes sense, because multiplying by 1 shouldn't boost the damage, and we shouldn't get a bonus without 3 matching dice. after this loop, the damage will be: Roll * Roll * Roll * Level * 2 * Roll if there are 3 matching dice. ) C2/41D9: E2 20 SEP #$20 (8-bit Accumulator) C2/41DB: A5 B5 LDA $B5 C2/41DD: C9 00 CMP #$00 C2/41DF: D0 02 BNE $41E3 (Branch if command not Fight) C2/41E1: A9 26 LDA #$26 C2/41E3: 85 B5 STA $B5 (Store a dice toss animation?) C2/41E5: 60 RTS Revenge C2/41E6: 9C 14 34 STZ $3414 (Set to not modify damage) C2/41E9: C2 20 REP #$20 (Set 16-bit Accumulator) C2/41EB: 38 SEC C2/41EC: B9 1C 3C LDA $3C1C,Y (Max HP) C2/41EF: F9 F4 3B SBC $3BF4,Y (HP) C2/41F2: 8D B0 11 STA $11B0 (Damage = Max HP - HP) C2/41F5: 60 RTS Palidor from $42E1 Makes not jump if you have Petrify, Sleep, Stop, Hide, or Freeze status C2/41F6: A9 10 LDA #$10 C2/41F8: 0C 46 3A TSB $3A46 C2/41FB: C2 20 REP #$20 C2/41FD: A2 12 LDX #$12 C2/41FF: BD E4 3E LDA $3EE4,X C2/4202: 89 40 80 BIT #$8040 (Check for Petrify or Sleep) C2/4205: D0 08 BNE $420F C2/4207: BD F8 3E LDA $3EF8,X C2/420A: 89 10 22 BIT #$2210 (Check for Stop, Hide, or Freeze) C2/420D: F0 07 BEQ $4216 C2/420F: BD 18 30 LDA $3018,X C2/4212: 14 A2 TRB $A2 (Remove from being a target) C2/4214: 14 A4 TRB $A4 C2/4216: CA DEX C2/4217: CA DEX C2/4218: 10 E5 BPL $41FF C2/421A: 60 RTS Empowerer C2/421B: AD A3 11 LDA $11A3 C2/421E: 49 80 EOR #$80 (Toggle Concern MP) C2/4220: 8D A3 11 STA $11A3 C2/4223: 10 05 BPL $422A (Branch if not Concern MP -- this means we're currently on the first "strike", which affects HP) C2/4225: A9 12 LDA #$12 C2/4227: 85 B5 STA $B5 (save Nothing [Mimic] as command animation. this means the spell animation won't be repeated for the MP-draining phase of Empowerer.) C2/4229: 60 RTS C2/422A: EE 70 3A INC $3A70 (make the attack, including this special effect, get repeated) C2/422D: 4E A6 11 LSR $11A6 C2/4230: 4E A6 11 LSR $11A6 (Cut Spell Power to 1/4 for 2nd "strike", which will affect MP) C2/4233: 60 RTS Spiraler C2/4234: BB TYX C2/4235: BD 18 30 LDA $3018,X C2/4238: 14 A2 TRB $A2 C2/423A: 14 A4 TRB $A4 (Miss yourself) C2/423C: 0C 4C 2F TSB $2F4C C2/423F: 20 4A 38 JSR $384A (Mark death and hide to be set) C2/4242: C2 20 REP #$20 (Set 16-bit Accumulator) C2/4244: 9E F4 3B STZ $3BF4,X (Zeroes HP of attacker) C2/4247: 9E 08 3C STZ $3C08,X (Zeroes MP of attacker) C2/424A: 60 RTS Discard C2/424B: 20 9C 40 JSR $409C (Miss all targets?) C2/424E: A9 20 LDA #$20 C2/4250: 0C A4 11 TSB $11A4 (Set Can't be dodged) C2/4253: BE 58 33 LDX $3358,Y C2/4256: 30 F2 BMI $424A (Exit if bit 7 of $3358,Y is set) C2/4258: BD 18 30 LDA $3018,X C2/425B: 85 B8 STA $B8 C2/425D: 64 B9 STZ $B9 C2/425F: BB TYX C2/4260: 4C C2 57 JMP $57C2 Mantra C2/4263: A9 60 LDA #$60 C2/4265: 0C A2 11 TSB $11A2 (Set no split damage, & ignore defense) C2/4268: 9C 14 34 STZ $3414 (Set to not modify damage) C2/426B: C2 20 REP #$20 (Set 16-bit Accumulator) C2/426D: B9 18 30 LDA $3018,Y C2/4270: 14 A4 TRB $A4 (Make miss yourself) C2/4272: AE C9 3E LDX $3EC9 (Number of targets) C2/4275: CA DEX C2/4276: B9 F4 3B LDA $3BF4,Y C2/4279: 20 92 47 JSR $4792 (HP / (Number of targets - 1) ) C2/427C: 8D B0 11 STA $11B0 (Set damage) C2/427F: 60 RTS Special Effect $42 Cuts damage to 1/4 C2/4280: C2 20 REP #$20 (Set 16-bit Accumulator) C2/4282: 4E B0 11 LSR $11B0 (Halves damage) C2/4285: C2 20 REP #$20 (Special effect $41 jumps here) C2/4287: 4E B0 11 LSR $11B0 (Halves damage) C2/428A: 60 RTS Suplex code from 42E1 (Picks a random target) C2/428B: A9 10 LDA #$10 C2/428D: 04 B0 TSB $B0 C2/428F: C2 20 REP #$20 (Set 16-bit Accumulator) C2/4291: A5 A2 LDA $A2 C2/4293: 85 EE STA $EE (Copy targets to temporary variable) C2/4295: A2 0A LDX #$0A C2/4297: BD 88 3C LDA $3C88,X (Monster data - Special Byte 2) C2/429A: 89 04 00 BIT #$0004 C2/429D: F0 05 BEQ $42A4 (Check next target if this one can be Suplexed) C2/429F: BD 20 30 LDA $3020,X C2/42A2: 14 EE TRB $EE (Clear this monster from potential targets) C2/42A4: CA DEX C2/42A5: CA DEX C2/42A6: 10 EF BPL $4297 (Loop for all 6 monster targets) C2/42A8: A5 EE LDA $EE C2/42AA: D0 02 BNE $42AE (Branch if some targets left in temporary variable, which means we'll actually be attacking something that can be Suplexed!) C2/42AC: A5 A2 LDA $A2 (original Targets) C2/42AE: 20 2A 52 JSR $522A (Randomly pick a bit) C2/42B1: 85 B8 STA $B8 (save our one target) C2/42B3: BB TYX C2/42B4: 4C C2 57 JMP $57C2 Reflect??? C2/42B7: C2 20 REP #$20 C2/42B9: A2 12 LDX #$12 C2/42BB: BD F7 3E LDA $3EF7,X C2/42BE: 30 05 BMI $42C5 (Branch if reflect status) C2/42C0: BD 18 30 LDA $3018,X C2/42C3: 14 A4 TRB $A4 (Make miss target) C2/42C5: CA DEX C2/42C6: CA DEX C2/42C7: 10 F2 BPL $42BB C2/42C9: 60 RTS Quick C2/42CA: AD 02 34 LDA $3402 C2/42CD: 10 09 BPL $42D8 (If already under influence of Quick) C2/42CF: 8C 04 34 STY $3404 C2/42D2: A9 02 LDA #$02 C2/42D4: 8D 02 34 STA $3402 C2/42D7: 60 RTS C2/42D8: C2 20 REP #$20 (Set 16-bit Accumulator) C2/42DA: B9 18 30 LDA $3018,Y C2/42DD: 0C 5A 3A TSB $3A5A (Set target as missed) C2/42E0: 60 RTS Table for special effects code pointers 2 C2/42E1: 8A 3E C2/42E3: 8B 3E C2/42E5: 44 40 ($02) C2/42E7: 8A 3E C2/42E9: 8A 3E C2/42EB: 73 3F ($05) C2/42ED: 6E 3F ($06) C2/42EF: 22 3F ($07) C2/42F1: 8A 3E C2/42F3: 58 41 ($09) C2/42F5: 89 3F ($0A) C2/42F7: 9F 3F ($0B) C2/42F9: 7E 3F ($0C) C2/42FB: 8A 3E C2/42FD: CA 3E ($0E) C2/42FF: 50 3F ($0F) C2/4301: 8A 3E C2/4303: 65 3F ($11) C2/4305: 8A 3E C2/4307: F6 41 ($13) C2/4309: 8A 3E C2/430B: 63 42 ($15) C2/430D: 34 42 ($16) C2/430F: 8A 3E C2/4311: 4E 40 ($18) C2/4313: FC 3F ($19) C2/4315: FE 40 ($1A) C2/4317: 54 3F ($1B) C2/4319: B7 42 ($1C) C2/431B: A1 40 ($1D) C2/431D: A0 3E ($1E) C2/431F: 8A 3E C2/4321: 8A 3E C2/4323: 8A 3E C2/4325: 8A 3E C2/4327: 8A 3E C2/4329: 8A 3E C2/432B: 8A 3E C2/432D: 8A 3E C2/432F: BB 40 ($27) C2/4331: 3C 41 ($28) C2/4333: 4D 41 ($29) C2/4335: 0F 41 ($2A) C2/4337: 8A 3E C2/4339: 37 40 ($2C) C2/433B: 8A 3E C2/433D: 8A 3E C2/433F: 8A 3E C2/4341: 8B 42 ($30) C2/4343: DA 40 ($31) C2/4345: F1 40 ($32) C2/4347: 61 40 ($33) C2/4349: 8A 3E C2/434B: 8A 3E C2/434D: 1B 42 ($36) C2/434F: 8A 3E C2/4351: 8A 3E C2/4353: 8A 3E C2/4354: 8A 3E C2/4357: 8A 3E C2/4359: 8A 3E C2/435B: E6 41 ($3D) C2/435D: 8A 3E C2/435F: 8A 3E C2/4361: 8A 3E C2/4363: 85 42 ($41) C2/4365: 80 42 ($42) C2/4367: CA 42 ($43) C2/4369: 4B 42 ($44) C2/436B: 8A 3E C2/436D: 8A 3E C2/436F: 8A 3E C2/4371: 8A 3E C2/4373: AD 3F ($49) C2/4375: 2C 40 ($4A) C2/4377: C8 40 ($4B) C2/4379: 36 41 ($4C) C2/437B: 4E 40 ($4D) C2/437D: 8A 3E C2/437F: 8A 3E C2/4381: 95 40 ($50) C2/4383: B7 3F ($51) C2/4385: 8A 3E C2/4387: 8A 3E C2/4389: 8A 3E C2/438B: 8A 3E C2/438D: 8A 3E C2/438F: 8A 3E Set new status for attack C2/4391: DA PHX C2/4392: 08 PHP C2/4393: C2 20 REP #$20 (Set 16-bit Accumulator) C2/4395: A0 12 LDY #$12 C2/4397: B9 A0 3A LDA $3AA0,Y C2/439A: 4A LSR C2/439B: 90 62 BCC $43FF (Skip this character if bit 0 of $3AA0,Y is not set) C2/439D: 20 0D 45 JSR $450D (Get new status) C2/43A0: A5 FC LDA $FC C2/43A2: F0 0F BEQ $43B3 (If no status to add) C2/43A4: 85 F0 STA $F0 C2/43A6: A2 1E LDX #$1E C2/43A8: 06 F0 ASL $F0 C2/43AA: 90 03 BCC $43AF (Skip if status not to be set) C2/43AC: FC B0 46 JSR ($46B0,X) (Call for each status to be set) C2/43AF: CA DEX C2/43B0: CA DEX C2/43B1: 10 F5 BPL $43A8 (Loop through all status in byte 1 & 2) C2/43B3: A5 FE LDA $FE C2/43B5: F0 0F BEQ $43C6 C2/43B7: 85 F0 STA $F0 C2/43B9: A2 1E LDX #$1E C2/43BB: 06 F0 ASL $F0 C2/43BD: 90 03 BCC $43C2 C2/43BF: FC D0 46 JSR ($46D0,X) (Call for each status to be set byte 3 & 4) C2/43C2: CA DEX C2/43C3: CA DEX C2/43C4: 10 F5 BPL $43BB (Note: the subtraction of blocked statuses from "status to clear" below takes place later than the removal of blocked statuses from "status to set." i think this is because the special case set status functions called in $46B0 AND 46D0 can mark additional statuses to be cleared. so Square performed the block checks after these calls to make sure we don't clear any statuses we're immune to) C2/43C6: A5 F4 LDA $F4 (status to clear bytes 1-2) C2/43C8: 39 1C 33 AND $331C,Y (blocked status bytes 1-2) C2/43CB: 85 F4 STA $F4 (remove blocked from statuses to clear) C2/43CD: F0 0F BEQ $43DE C2/43CF: 85 F0 STA $F0 C2/43D1: A2 1E LDX #$1E C2/43D3: 06 F0 ASL $F0 C2/43D5: 90 03 BCC $43DA C2/43D7: FC F0 46 JSR ($46F0,X) (Call for each status to be clear byte 1 & 2) C2/43DA: CA DEX C2/43DB: CA DEX C2/43DC: 10 F5 BPL $43D3 C2/43DE: A5 F6 LDA $F6 (status to clear bytes 3-4) C2/43E0: 39 30 33 AND $3330,Y (blocked status bytes 3-4) C2/43E3: 85 F6 STA $F6 (don't try to clear blocked statuses) C2/43E5: F0 0F BEQ $43F6 C2/43E7: 85 F0 STA $F0 C2/43E9: A2 1E LDX #$1E C2/43EB: 06 F0 ASL $F0 C2/43ED: 90 03 BCC $43F2 C2/43EF: FC 10 47 JSR ($4710,X) (Call for each status to be clear byte 3 & 4) C2/43F2: CA DEX C2/43F3: CA DEX C2/43F4: 10 F5 BPL $43EB C2/43F6: 20 7F 44 JSR $447F (Get new status) C2/43F9: 20 85 45 JSR $4585 (Store in 3EE4 & 3EF8) C2/43FC: 20 FF 44 JSR $44FF (Clear set and clear status bytes) C2/43FF: 88 DEY C2/4400: 88 DEY C2/4401: 10 94 BPL $4397 (loop for all 10 targets on screen) C2/4403: 28 PLP C2/4404: FA PLX C2/4405: 60 RTS (Determine statuses that will be set/removed when attack hits; miss if attack doesn't change target's status) C2/4406: 08 PHP C2/4407: C2 20 REP #$20 C2/4409: B9 E4 3E LDA $3EE4,Y (get current status bytes 1-2) C2/440C: 85 F8 STA $F8 C2/440E: B9 F8 3E LDA $3EF8,Y (get current status bytes 3-4) C2/4411: 85 FA STA $FA C2/4413: 20 90 44 JSR $4490 (Initialize intermediate "status to set" bytes in $F4 - $F7 and "status to clear" bytes in $FC - $FF. Mark Clear / Freeze to be removed if necessary.) C2/4416: E2 20 SEP #$20 C2/4418: A5 B3 LDA $B3 C2/441A: 30 04 BMI $4420 (if not Ignore Clear) C2/441C: A9 10 LDA #$10 C2/441E: 14 F4 TRB $F4 (remove Vanish from Status to Clear) C2/4420: B9 95 3C LDA $3C95,Y C2/4423: 10 18 BPL $443D (Branch if not undead) C2/4425: A9 08 LDA #$08 C2/4427: 2C A2 11 BIT $11A2 C2/442A: F0 11 BEQ $443D (Branch if attack doesn't reverse damage on undead) C2/442C: 4A LSR C2/442D: 2C A4 11 BIT $11A4 C2/4430: F0 0B BEQ $443D (Branch if not lift status) C2/4432: AD AA 11 LDA $11AA C2/4435: 89 82 BIT #$82 C2/4437: F0 04 BEQ $443D (Branch if attack doesn't involve Death or Zombie) C2/4439: A9 80 LDA #$80 C2/443B: 04 FC TSB $FC (mark Death in Status to set) C2/443D: C2 20 REP #$20 C2/443F: A5 FC LDA $FC C2/4441: 20 32 0E JSR $0E32 (update Status to set Bytes 1-2) C2/4444: A5 FE LDA $FE C2/4446: 19 E8 3D ORA $3DE8,Y C2/4449: 99 E8 3D STA $3DE8,Y (update Status to set Bytes 3-4) C2/444C: A5 F4 LDA $F4 C2/444E: 19 FC 3D ORA $3DFC,Y C2/4451: 99 FC 3D STA $3DFC,Y (update Status to clear Bytes 1-2) C2/4454: A5 F6 LDA $F6 C2/4456: 19 10 3E ORA $3E10,Y C2/4459: 99 10 3E STA $3E10,Y (update Status to clear Bytes 3-4) C2/445C: AD A7 11 LDA $11A7 C2/445F: 4A LSR C2/4460: 90 1B BCC $447D (if "spell misses if protected from ailments" bit is unset, exit function) C2/4462: A5 FC LDA $FC C2/4464: 05 F4 ORA $F4 C2/4466: 39 1C 33 AND $331C,Y (are there any statuses we're trying to set or clear that aren't blocked?) (bytes 1-2) C2/4469: D0 12 BNE $447D (if there are, exit function) C2/446B: A5 FE LDA $FE C2/446D: 05 F6 ORA $F6 C2/446F: 39 30 33 AND $3330,Y (are there any statuses we're trying to set or clear that aren't blocked?) (bytes 3-4) C2/4472: D0 09 BNE $447D (if there are, exit function) C2/4474: B9 18 30 LDA $3018,Y C2/4477: 8D 48 3A STA $3A48 C2/447A: 0C 5A 3A TSB $3A5A (Spell misses if prot. from ailments) C2/447D: 28 PLP C2/447E: 60 RTS Get status after attack C2/447F: A5 F8 LDA $F8 (status) C2/4481: 04 FC TSB $FC (Status to set) C2/4483: A5 F4 LDA $F4 (Status to clear) C2/4485: 14 FC TRB $FC (Status to set) C2/4487: A5 FA LDA $FA (Status byte 3 & 4) C2/4489: 04 FE TSB $FE (Status to set byte 3 & 4) C2/448B: A5 F6 LDA $F6 (Status to clear byte 3 & 4) C2/448D: 14 FE TRB $FE (Status to set byte 3 & 4) C2/448F: 60 RTS (Initialize intermediate "status to set" bytes in $F4 - $F7 and "status to clear" bytes in $FC - $FF. Mark Clear / Freeze to be removed if necessary.) C2/4490: DA PHX C2/4491: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/4493: AD A4 11 LDA $11A4 (Special Byte 2) C2/4496: 29 0C AND #$0C C2/4498: 4A LSR C2/4499: AA TAX (X = 0 if set status, 2 = lift status, 4 = toggle status) C2/449A: C2 20 REP #$20 C2/449C: 64 FC STZ $FC (Clear status to clear and set bytes) C2/449E: 64 FE STZ $FE C2/44A0: 64 F4 STZ $F4 C2/44A2: 64 F6 STZ $F6 C2/44A4: FC D1 44 JSR ($44D1,X) C2/44A7: AD A2 11 LDA $11A2 C2/44AA: 4A LSR C2/44AB: B0 0E BCS $44BB (branch if physical attack) C2/44AD: A9 10 00 LDA #$10 C2/44B0: 24 F8 BIT $F8 C2/44B2: F0 07 BEQ $44BB (branch if target not vanished) C2/44B4: 2C AA 11 BIT $11AA C2/44B7: D0 02 BNE $44BB (branch if attack causes Clear) C2/44B9: 04 F4 TSB $F4 (mark Clear status to be cleared) C2/44BB: AD A1 11 LDA $11A1 C2/44BE: 4A LSR C2/44BF: 90 0E BCC $44CF (Exit if not element Fire) C2/44C1: A9 00 02 LDA #$0200 C2/44C4: 24 FA BIT $FA C2/44C6: F0 07 BEQ $44CF (Exit if target not Frozen) C2/44C8: 2C AC 11 BIT $11AC C2/44CB: D0 02 BNE $44CF (Exit if attack setting Freeze) C2/44CD: 04 F6 TSB $F6 (mark Freeze status to be cleared) C2/44CF: FA PLX C2/44D0: 60 RTS Code Pointers C2/44D1: D7 44 C2/44D3: EA 44 C2/44D5: F9 44 (Spell wants to set status) C2/44D7: AD AA 11 LDA $11AA (get status bytes 1-2 from spell) C2/44DA: 85 FC STA $FC (store in status to set) C2/44DC: A5 F8 LDA $F8 (get current status 1-2) C2/44DE: 14 FC TRB $FC (don't try to set anything you already have) C2/44E0: AD AC 11 LDA $11AC (get status bytes 3-4 from spell) C2/44E3: 85 FE STA $FE (store in status to set) C2/44E5: A5 FA LDA $FA (get current status 3-4) C2/44E7: 14 FE TRB $FE (don't try to set anything you already have) C2/44E9: 60 RTS (Spell wants to clear status) C2/44EA: AD AA 11 LDA $11AA (get status bytes 1-2 from spell) C2/44ED: 25 F8 AND $F8 (current status 1-2) C2/44EF: 85 F4 STA $F4 (only try to clear statuses you do have) C2/44F1: AD AC 11 LDA $11AC (get status bytes 3-4 from spell) C2/44F4: 25 FA AND $FA (current status 3-4) C2/44F6: 85 F6 STA $F6 (only try to clear statuses you do have) C2/44F8: 60 RTS (Spell wants to toggle status) C2/44F9: 20 D7 44 JSR $44D7 (mark spell statuses you don't already have to be set) C2/44FC: 4C EA 44 JMP $44EA (and mark the ones you do already have to be cleared) Clear status to set and status to clear bytes C2/44FF: 7B TDC C2/4500: 99 D4 3D STA $3DD4,Y C2/4503: 99 E8 3D STA $3DE8,Y C2/4506: 99 FC 3D STA $3DFC,Y C2/4509: 99 10 3E STA $3E10,Y C2/450C: 60 RTS (Put Status to be Set / Clear into $F? Quasi New Status in $3E60 & $3E74) C2/450D: B9 FC 3D LDA $3DFC,Y C2/4510: 85 F4 STA $F4 (Status to Clear bytes 1-2) C2/4512: B9 10 3E LDA $3E10,Y C2/4515: 85 F6 STA $F6 (Status to Clear bytes 3-4) C2/4517: B9 D4 3D LDA $3DD4,Y C2/451A: 39 1C 33 AND $331C,Y C2/451D: 85 FC STA $FC (Status to Set bytes 1-2, excluding blocked statuses) C2/451F: B9 E8 3D LDA $3DE8,Y C2/4522: 39 30 33 AND $3330,Y C2/4525: 85 FE STA $FE (Status to Set bytes 3-4, excluding blocked statuses) C2/4527: B9 E4 3E LDA $3EE4,Y (Load Status of targets, bytes 1-2) C2/452A: 85 F8 STA $F8 C2/452C: 29 40 00 AND #$0040 (If target already had Petrify, set it in Status to Set) C2/452F: 04 FC TSB $FC (Note: I think the above is done in preparation for the special case functions at $46B0 and 46D0. These are called when a status is inflicted, and cause side effects like clearing other statuses [provided you're not immune to them], and messing with assorted variables. A classic example is Slow booting out Haste, and vice versa.) The above code means that just as Muddled/Mute/Clear/Dark/etc are cleared/prevented when Petrify status is first _acquired_, they will also be cleared/prevented as long as Petrify is POSSESSED.) C2/4531: B9 F8 3E LDA $3EF8,Y (Status bytes 3 & 4) C2/4534: 85 FA STA $FA (This chunk will: If Current HP > 1/8 Max HP and Near Fatal status is currently set, mark Near Fatal status to be cleared. If Current HP <= 1/8 Max HP and Near Fatal status isn't currently set, mark Near Fatal status to be set. ) ++++++ C2/4536: B9 1C 3C LDA $3C1C,Y (Max HP) C2/4539: 4A LSR C2/453A: 4A LSR C2/453B: 4A LSR (Divide by 8) C2/453C: D9 F4 3B CMP $3BF4,Y (Current HP) C2/453F: A9 00 02 LDA #$0200 C2/4542: 24 F8 BIT $F8 C2/4544: D0 04 BNE $454A (Branch if Near Fatal status possessed) C2/4546: 90 06 BCC $454E (Branch if Current HP > Max HP / 8) C2/4548: 04 FC TSB $FC (Mark Near Fatal in Status to Set) C2/454A: B0 02 BCS $454E (Branch if Current HP <= Max HP / 8) C2/454C: 04 F4 TSB $F4 (Mark Near Fatal in Status to Clear) ++++++ C2/454E: A5 FB LDA $FB C2/4550: 10 14 BPL $4566 (If no Wound in Status to Set) C2/4552: B9 4D 3E LDA $3E4D,Y C2/4555: 29 02 00 AND #$0002 (Bit set by Overcast) C2/4558: F0 0C BEQ $4566 (Branch if not set) C2/455A: 05 FC ORA $FC (Put Zombie in Status to Set) C2/455C: 29 7F FF AND #$FF7F (Clear Wound from Status to Set) C2/455F: 85 FC STA $FC C2/4561: A9 00 01 LDA #$0100 C2/4564: 04 F4 TSB $F4 (Set Condemned in Status to Clear) C2/4566: B9 DF 32 LDA $32DF,Y C2/4569: 10 19 BPL $4584 (Exit function if attack doesn't target them?) C2/456B: A5 FC LDA $FC C2/456D: 48 PHA C2/456E: A5 FE LDA $FE C2/4570: 48 PHA C2/4571: 20 7F 44 JSR $447F (Get new status) C2/4574: A5 FC LDA $FC C2/4576: 99 60 3E STA $3E60,Y C2/4579: A5 FE LDA $FE C2/457B: 99 74 3E STA $3E74,Y C2/457E: 68 PLA C2/457F: 85 FE STA $FE C2/4581: 68 PLA C2/4582: 85 FC STA $FC C2/4584: 60 RTS (Store new status in character/monster status bytes. Clear some statuses if target has Zombie.) C2/4585: A5 FC LDA $FC C2/4587: 89 02 00 BIT #$0200 C2/458A: F0 03 BEQ $458F (Branch if not Zombie) C2/458C: 29 FA 4D AND #$4DFA (Clear Dark and Poison) (Clear Near Fatal, Berserk, Muddled, Sleep) C2/458F: 99 E4 3E STA $3EE4,Y (Store new status in Bytes 1 and 2) C2/4592: A5 FE LDA $FE C2/4594: 99 F8 3E STA $3EF8,Y (Store new status in Bytes 3 and 4) C2/4597: 60 RTS C2/4598: 48 PHA C2/4599: A5 F8 LDA $F8 C2/459B: 05 FC ORA $FC C2/459D: 23 01 AND $01,S C2/459F: 04 F4 TSB $F4 (if a status is possessed or it's set in Status to Set, and it's set in value passed to function, turn it on in Set to Clear) C2/45A1: 68 PLA C2/45A2: 60 RTS (Zombie - set) C2/45A3: A9 80 00 LDA #$0080 C2/45A6: 20 98 45 JSR $4598 (if Death is possessed or set by the spell, mark it to be cleared) C2/45A9: 20 A9 46 JSR $46A9 (mark character as having died?) C2/45AA: A9 80 LDA #$46 C2/45AC: 80 13 BRA $45C1 (Zombie - clear) C2/45AE: 20 9C 46 JSR $469C C2/45B1: 80 0E BRA $45C1 (Muddle - set) C2/45B3: B9 18 30 LDA $3018,Y C2/45B6: 0C 53 2F TSB $2F53 C2/45B9: 80 06 BRA $45C1 (Muddle - clear) C2/45BB: B9 18 30 LDA $3018,Y C2/45BE: 1C 53 2F TRB $2F53 C2/45C1: DA PHX C2/45C2: BE 18 30 LDX $3018,Y C2/45C5: 8A TXA C2/45C6: 0C 4A 3A TSB $3A4A C2/45C9: FA PLX C2/45CA: 60 RTS C2/45CB: DA PHX C2/45CC: BE 19 30 LDX $3019,Y C2/45CF: 8A TXA C2/45D0: 0C 44 2F TSB $2F44 C2/45D3: FA PLX C2/45D4: 60 RTS C2/45D5: DA PHX C2/45D6: BE 19 30 LDX $3019,Y C2/45D9: 8A TXA C2/45DA: 1C 44 2F TRB $2F44 C2/45DD: FA PLX C2/45DE: 60 RTS (Imp - set or clear) C2/45DF: A9 88 00 LDA #$0088 C2/45E2: 20 4C 46 JSR $464C C2/45E5: C0 08 CPY #$08 (Rage - clear enters here) C2/45E7: B0 08 BCS $45F1 (Exit function if monster) C2/45E9: DA PHX C2/45EA: 98 TYA C2/45EB: 4A LSR C2/45EC: AA TAX C2/45ED: FE 30 2F INC $2F30,X C2/45F0: FA PLX C2/45F1: 60 RTS C2/45F2: 20 9C 46 JSR $469C C2/45F5: A9 00 40 LDA #$4000 C2/45F8: 20 56 46 JSR $4656 C2/45FB: A9 40 00 LDA #$0040 C2/45FE: 80 4C BRA $464C (Death - set) C2/4600: A9 40 01 LDA #$0140 C2/4603: 20 98 45 JSR $4598 (if Petrify or Condemned are possessed or set by the spell, mark them to be cleared) C2/4606: A9 80 00 LDA #$0080 C2/4609: 14 F4 TRB $F4 (remove Death from statuses to be cleared) (Petrify - set) C2/460B: 20 A9 46 JSR $46A9 (Mark as having died) C2/460E: A9 15 FE LDA #$FE15 C2/4611: 20 98 45 JSR $4598 (if Dark, Poison, Clear, Near Fatal, Image, Mute, Berserk, Muddled, Seizure, or Sleep are possessed by the target or set by the spell, mark them to be cleared) C2/4614: A5 LDA $FA C2/4616: 05 FE ORA $FE C2/4618: 29 FF 9B AND #$9BFF (if Dance, Regen, Slow, Haste, Stop, Shell, Safe, Reflect, Rage, Freeze, Morph, Spell Chant, or Float are possessed by the target or set by the spell, mark them to be cleared) C2/461B: 04 F6 TSB $F6 C2/461D: B9 4C 3E LDA $3E4C,Y C2/4620: 29 FF BF AND #$BFFF C2/4623: 99 4C 3E STA $3E4C,Y C2/4626: B9 A0 3A LDA $3AA0,Y C2/4629: 29 7F FF AND #$FF7F C2/462C: 99 A0 3A STA $3AA0,Y C2/462F: A9 40 00 LDA #$0040 C2/4632: 80 18 BRA $464C (Sleep - set) C2/4634: 08 PHP C2/4635: E2 20 SEP #$20 (Set 8-bit A) C2/4637: A9 12 LDA #$12 C2/4639: 99 F9 3C STA $3CF9,Y (Time until Sleep wears off) C2/463C: 28 PLP C2/463D: 80 E7 BRA $4626 (Condemned - set) C2/463F: A9 20 00 LDA #$0020 C2/4642: 80 08 BRA $464C C2/4644: A9 10 00 LDA #$0010 (Condemned - clear enters here) C2/4647: 80 03 BRA $464C C2/4649: A9 08 00 LDA #$0008 (Mute - set or clear enter here) C2/464C: 19 04 32 ORA $3204,Y C2/464F: 99 04 32 STA $3204,Y C2/4652: 60 RTS (Sleep - clear) C2/4653: A9 00 40 LDA #$4000 C2/4656: 19 A0 3A ORA $3AA0,Y C2/4659: 99 A0 3A STA $3AA0,Y C2/465C: 60 RTS (Seizure - set) C2/465D: A9 02 00 LDA #$0002 C2/4660: 04 F6 TSB $F6 (mark Regen to be cleared) C2/4662: 60 RTS (Regen - set) C2/4663: A9 00 40 LDA #$4000 C2/4666: 04 F4 TSB $F4 (mark Seizure to be cleared) C2/4668: 60 RTS (Slow - set) C2/4669: A9 08 00 LDA #$0008 C2/466C: 80 03 BRA $4671 (mark Haste to be cleared) (Haste - set) C2/466E: A9 04 00 LDA #$0004 (mark Slow to be cleared) C2/4671: 04 F6 TSB $F6 C2/4673: A9 04 00 LDA #$0004 (Haste - clear and Slow - clear enter here) C2/4676: 80 D4 BRA $464C (was BRA ???) (Morph - set or clear) C2/4678: A9 02 00 LDA #$0002 C2/467B: 80 CF BRA $464C (Stop - set) C2/467D: 08 PHP C2/467E: E2 20 SEP #$20 (Set 8-bit A) C2/4680: A9 12 LDA #$12 C2/4682: 99 F1 3A STA $3AF1,Y (Time until Stop wears off) C2/4685: 28 PLP C2/4686: 60 RTS (Reflect - set) C2/4687: 08 PHP C2/4688: E2 20 SEP #$20 (Set 8-bit A) C2/468A: A9 1A LDA #$1A C2/468C: 99 0C 3F STA $3F0C,Y (Time until Reflect wears off, though permanency can prevent its removal) C2/468F: 28 PLP C2/4690: 60 RTS (Freeze - set) C2/4691: 08 PHP C2/4692: E2 20 SEP #$20 (Set 8-bit A) C2/4694: A9 22 LDA #$22 C2/4696: 99 0D 3F STA $3F0D,Y (Time until Freeze wears off) C2/4699: 28 PLP C2/469A: 60 RTS (Do nothing: Dark, Poison, M-Tek, Near Fatal, Image, Berserk, Dance, Shell, Safe, Rage [set only], Life 3, Spell, Hide, Dog Block, Float) C2/469B: 60 RTS C2/469C: DA PHX C2/469D: BE 19 30 LDX $3019,Y C2/46A0: 8A TXA C2/46A1: 0C 2F 2F TSB $2F2F C2/46A4: 1C 3A 3A TRB $3A3A C2/46A7: FA PLX C2/46A8: 60 RTS C2/46A9: B9 18 30 LDA $3018,Y C2/46AC: 0C 56 3A TSB $3A56 (Mark this character as having died) C2/46AF: 60 RTS Not actual code - data (table of pointers to code, for changing status) Set status pointers ("side effects" to perform upon setting of a status): C2/46B0: 9B 46 (Dark) (Jumps to RTS) C2/46B2: A3 45 (Zombie) C2/46B4: 9B 46 (Poison) (Jumps to RTS) C2/46B6: 9B 46 (M-Tek) (Jumps to RTS) C2/46B8: CB 45 (Clear) C2/46BA: DF 45 (Imp) C2/46BC: 0B 46 (Petrify) C2/46BE: 00 46 (Death) C2/46C0: 3F 46 (Condemned) C2/46C2: 9B 46 (Near Fatal) (Jumps to RTS) C2/46C4: 9B 46 (Image) (Jumps to RTS) C2/46C6: 49 46 (Mute) C2/46C8: 9B 46 (Berserk) (Jumps to RTS) C2/46CA: B3 45 (Muddle) C2/46CC: 5D 46 (Seizure) C2/46CE: 34 46 (Sleep) C2/46D0: 9B 46 (Dance) (Jumps to RTS) C2/46D2: 63 46 (Regen) C2/46D4: 69 46 (Slow) C2/46D6: 6E 46 (Haste) C2/46D8: 7D 46 (Stop) C2/46DA: 9B 46 (Shell) (Jumps to RTS) C2/46DC: 9B 46 (Safe) (Jumps to RTS) C2/46DE: 87 46 (Reflect) C2/46E0: 9B 46 (Rage) (Jumps to RTS) C2/46E2: 91 46 (Freeze) C2/46E4: 9B 46 (Life 3) (Jumps to RTS) C2/46E6: 78 46 (Morph) C2/46E8: 9B 46 (Spell) (Jumps to RTS) C2/46EA: 9B 46 (Hide) (Jumps to RTS) C2/46EC: 9B 46 (Dog Block) (Jumps to RTS) C2/46EE: 9B 46 (Float) (Jumps to RTS) Clear status pointers ("side effects" to perform upon clearing of a status): C2/46F0: 9B 46 (Dark) (Jumps to RTS) C2/46F2: AE 45 (Zombie) C2/46F4: 9B 46 (Poison) (Jumps to RTS) C2/46F6: 9B 46 (M-Tek) (Jumps to RTS) C2/46F8: D5 45 (Clear) C2/46FA: DF 45 (Imp) C2/46FC: F2 45 (Petrify) C2/46FE: F2 45 (Death) C2/4700: 44 46 (Condemned) C2/4702: 9B 46 (Near Fatal) (Jumps to RTS) C2/4704: 9B 46 (Image) (Jumps to RTS) C2/4706: 49 46 (Mute) C2/4708: 9B 46 (Berserk) (Jumps to RTS) C2/470A: BB 45 (Muddle) C2/470C: 9B 46 (Seizure) (Jumps to RTS) C2/470E: 53 46 (Sleep) C2/4710: 9B 46 (Dance) (Jumps to RTS) C2/4712: 9B 46 (Regen) (Jumps to RTS) C2/4714: 73 46 (Slow) C2/4716: 73 46 (Haste) C2/4718: 9B 46 (Stop) (Jumps to RTS) C2/471A: 9B 46 (Shell) (Jumps to RTS) C2/471C: 9B 46 (Safe) (Jumps to RTS) C2/471E: 9B 46 (Reflect) (Jumps to RTS) C2/4720: E5 45 (Rage) C2/4722: 9B 46 (Freeze) (Jumps to RTS) C2/4724: 9B 46 (Life 3) (Jumps to RTS) C2/4726: 78 46 (Morph) C2/4728: 9B 46 (Spell) (Jumps to RTS) C2/472A: 9B 46 (Hide) (Jumps to RTS) C2/472C: 9B 46 (Dog Block) (Jumps to RTS) C2/472E: 9B 46 (Float) (Jumps to RTS) ??? Function (Called from other bank) C2/4730: DA PHX C2/4731: 5A PHY C2/4732: 8B PHB C2/4733: 08 PHP C2/4734: E2 30 SEP #$30 C2/4736: 48 PHA C2/4737: A9 7E LDA #$7E C2/4739: 48 PHA C2/473A: AB PLB C2/473B: 68 PLA C2/473C: 18 CLC C2/473D: FC 4B 47 JSR ($474B,X) C2/4740: 20 90 44 JSR $4490 (Initialize intermediate "status to set" bytes in $F4 - $F7 and "status to clear" bytes in $FC - $FF. Mark Clear / Freeze to be removed if necessary.) C2/4743: 20 7F 44 JSR $447F (get new status) C2/4746: 28 PLP C2/4747: AB PLB C2/4748: 7A PLY C2/4749: FA PLX C2/474A: 6B RTL Pointers C2/474B: 4F 47 C2/474D: 78 47 C2/474F: 20 66 29 JSR $2966 C2/4752: AD A4 11 LDA $11A4 C2/4755: 10 1E BPL $4775 (Branch if damage based on HP) C2/4757: AD A6 11 LDA $11A6 (Spell Power) C2/475A: 85 E8 STA $E8 C2/475C: C2 30 REP #$30 C2/475E: AD B2 11 LDA $11B2 C2/4761: 20 3C 28 JSR $283C C2/4764: C9 10 27 CMP #$2710 (10,000) C2/4767: 90 03 BCC $476C C2/4769: A9 0F 27 LDA #$270F (9999) C2/476C: E2 10 SEP #$10 C2/476E: 20 CB 0D JSR $0DCB C2/4771: 8D B0 11 STA $11B0 (Damage) C2/4774: 60 RTS C2/4775: 4C 69 2B JMP $2B69 C2/4778: 20 37 2A JSR $2A37 C2/477B: A9 01 LDA #$01 C2/477D: 0C A2 11 TSB $11A2 (Sets physical attack) C2/4780: 60 RTS Multiplication Function Multiplies low bit of A * high bit of A. Stores result in 16-bit A. C2/4781: 08 PHP C2/4782: C2 20 REP #$20 C2/4784: 8F 02 42 00 STA $004202 C2/4788: EA NOP C2/4789: EA NOP C2/478A: EA NOP C2/478B: EA NOP C2/478C: AF 16 42 00 LDA $004216 C2/4790: 28 PLP C2/4791: 60 RTS Division Function Divides 16-bit A / 8-bit X Stores answer in 16-bit A. Stores remainder in 8-bit X C2/4792: 5A PHY C2/4793: 08 PHP C2/4794: C2 20 REP #$20 C2/4796: 8F 04 42 00 STA $004204 C2/479A: E2 30 SEP #$30 C2/479C: 8A TXA C2/479D: 8F 06 42 00 STA $004206 C2/47A1: EA NOP C2/47A2: EA NOP C2/47A3: EA NOP C2/47A4: EA NOP C2/47A5: EA NOP C2/47A6: EA NOP C2/47A7: EA NOP C2/47A8: EA NOP C2/47A9: AF 16 42 00 LDA $004216 C2/47AD: AA TAX C2/47AE: C2 20 REP #$20 C2/47B0: AF 14 42 00 LDA $004214 C2/47B4: 28 PLP C2/47B5: 7A PLY C2/47B6: 60 RTS Multiplication Function 2 Results: 16-bit A = (8-bit $E8 * 16-bit A) / 256 24-bit $E8 = 3 byte (8-bit $E8 * 16-bit A) 16-bit $EC = 8-bit $E8 * high byte of A C2/47B7: 08 PHP C2/47B8: E2 20 SEP #$20 C2/47BA: 64 EA STZ $EA C2/47BC: 85 E9 STA $E9 C2/47BE: A5 E8 LDA $E8 C2/47C0: 20 81 47 JSR $4781 C2/47C3: C2 21 REP #$21 C2/47C5: 85 EC STA $EC C2/47C7: A5 E8 LDA $E8 C2/47C9: 20 81 47 JSR $4781 C2/47CC: 85 E8 STA $E8 C2/47CE: A5 EC LDA $EC C2/47D0: 65 E9 ADC $E9 C2/47D2: 85 E9 STA $E9 C2/47D4: 28 PLP C2/47D5: 60 RTS Multiplies A (1 byte) by * 1.5 C2/47D6: 48 PHA C2/47D7: 4A LSR C2/47D8: 18 CLC C2/47D9: 63 01 ADC $01,S C2/47DB: 90 02 BCC $47DF C2/47DD: A9 FF LDA #$FF C2/47DF: 83 01 STA $01,S C2/47E1: 68 PLA C2/47E2: 60 RTS C2/47E3: DA PHX C2/47E4: BD D9 3E LDA $3ED9,X C2/47E7: AA TAX C2/47E8: 9E 50 18 STZ $1850,X C2/47EB: FA PLX C2/47EC: 60 RTS C2/47ED: AD E0 3E LDA $3EE0 C2/47F0: F0 09 BEQ $47FB C2/47F2: AD 6E 3A LDA $3A6E (Method used to end combat?) C2/47F5: F0 04 BEQ $47FB (Branch if no special end?) C2/47F7: AA TAX C2/47F8: 7C F5 48 JMP ($48F5,X) C2/47FB: AD D1 1D LDA $1DD1 ($1DD1 = $3EB8) C2/47FE: 29 20 AND #$20 C2/4800: F0 05 BEQ $4807 C2/4802: 0C BC 3E TSB $3EBC C2/4805: 80 19 BRA $4820 C2/4807: AD 95 3A LDA $3A95 C2/480A: D0 E0 BNE $47EC (Exit if $3A95 != 0) C2/480C: AD 74 3A LDA $3A74 C2/480F: D0 22 BNE $4833 C2/4811: AD 8A 3A LDA $3A8A C2/4814: F0 0C BEQ $4822 (If no characters engulfed) C2/4816: CD 8D 3A CMP $3A8D C2/4819: D0 07 BNE $4822 C2/481B: A9 80 LDA #$80 C2/481D: 0C BC 3E TSB $3EBC C2/4820: 80 7F BRA $48A1 C2/4822: AD 39 3A LDA $3A39 C2/4825: D0 70 BNE $4897 (If 1 or more characters escaped) C2/4827: AD 97 3A LDA $3A97 C2/482A: D0 02 BNE $482E C2/482C: A9 29 LDA #$29 C2/482E: 20 CA 5F JSR $5FCA C2/4831: 80 5C BRA $488F C2/4833: AD 77 3A LDA $3A77 (Number of monsters left in combat) C2/4836: D0 B4 BNE $47EC (Exit if 1 or more monsters still alive) C2/4838: AD E0 3E LDA $3EE0 C2/483B: D0 03 BNE $4840 C2/483D: 20 76 4A JSR $4A76 C2/4840: AE 0B 30 LDX $300B (Which character is Gau) C2/4843: 30 1C BMI $4861 (If Gau not in party) C2/4845: A9 01 LDA #$01 C2/4847: 1C E4 11 TRB $11E4 C2/484A: F0 15 BEQ $4861 C2/484C: 20 5A 4B JSR $4B5A (0 to 255) C2/484F: C9 A0 CMP #$A0 C2/4851: B0 0E BCS $4861 (3 in 8 chance branch) C2/4853: AD BD 3E LDA $3EBD C2/4856: 89 02 BIT #$02 (maybe this bit is set after you've enlisted Gau the first time?) C2/4858: D0 74 BNE $48CE (branch if it is) C2/485A: AD 76 3A LDA $3A76 (Number of characters in party) C2/485D: C9 02 CMP #$02 C2/485F: B0 6D BCS $48CE (Branch if 2 or more characters in party -- this ensures that Sabin and Cyan are both *alive* to see the original Gau hijinx) C2/4861: AE 03 30 LDX $3003 (Which character is Shadow) C2/4864: 30 26 BMI $488C (Branch if Shadow not in party) C2/4866: 20 5A 4B JSR $4B5A (0 to 255) C2/4869: C9 10 CMP #$10 C2/486B: B0 1F BCS $488C (15 in 16 chance branch) C2/486D: AD 1F 20 LDA $201F (get encounter type? 0 = front, 1 = back, 2 = pincer, 3 = side) C2/4870: D0 1A BNE $488C (if not a front attack, branch) C2/4872: AD 76 3A LDA $3A76 (Number of characters in party) C2/4875: C9 02 CMP #$02 C2/4877: 90 13 BCC $488C (Branch if less than 2 characters in party) C2/4879: BD E4 3E LDA $3EE4,X C2/487C: 89 C2 BIT #$C2 (Check for Dead, Zombie, or Petrify) C2/487E: D0 0C BNE $488C (Branch if any set on Shadow) C2/4880: A9 08 LDA #$08 C2/4882: 2C BD 3E BIT $3EBD C2/4885: D0 05 BNE $488C C2/4887: 2C DE 1E BIT $1EDE (Which characters are in party) C2/488A: D0 1A BNE $48A6 (Branch if Shadow in party) C2/488C: 20 57 5D JSR $5D57 C2/488F: 20 36 49 JSR $4936 C2/4892: 68 PLA C2/4893: 68 PLA C2/4894: 4C C5 00 JMP $00C5 (Warp) C2/4897: A9 FF LDA #$FF C2/4899: 8D 05 02 STA $0205 C2/489C: A9 10 LDA #$10 C2/489E: 0C BC 3E TSB $3EBC ( FB 02-Usual monster script way to end a battle enters here) C2/48A1: 20 03 49 JSR $4903 C2/48A4: 80 E9 BRA $488F (Shadow randomly leaves after battle) C2/48A6: 1C DE 1E TRB $1EDE (Remove Shadow from party) C2/48A9: 20 E3 47 JSR $47E3 C2/48AC: C2 10 REP #$10 C2/48AE: BC 10 30 LDY $3010,X (get offset to character info block) C2/48B1: A9 FF LDA #$FF C2/48B3: 99 1E 16 STA $161E,Y (clear his equipped Esper) C2/48B6: E2 10 SEP #$10 C2/48B8: A9 FE LDA #$FE C2/48BA: 20 92 07 JSR $0792 C2/48BD: A9 02 LDA #$02 C2/48BF: 0C 49 2F TSB $2F49 C2/48C2: A2 0B LDX #$0B C2/48C4: 68 PLA C2/48C5: 68 PLA C2/48C6: A9 23 LDA #$23 C2/48C8: 20 91 4E JSR $4E91 C2/48CB: 4C 19 00 JMP $0019 (Gau arrives after Veldt battle) C2/48CE: BD 18 30 LDA $3018,X C2/48D1: 0C 4E 2F TSB $2F4E C2/48D4: 0C 40 3A TSB $3A40 (mark Gau as a "character acting as enemy" target) C2/48D7: A9 04 LDA #$04 C2/48D9: 0C 46 3A TSB $3A46 C2/48DC: A2 1B LDX #$1B C2/48DE: 80 E4 BRA $48C4 (Gau leapt) C2/48E0: AE 0B 30 LDX $300B C2/48E3: 20 E3 47 JSR $47E3 C2/48E6: A9 08 LDA #$08 C2/48E8: 1C DF 1E TRB $1EDF ( FB 09-Used by returning Gau when he joins the party enters here) C2/48EB: 20 07 4A JSR $4A07 C2/48EE: 80 9F BRA $488F (Banon fell) C2/48F0: A9 36 LDA #$36 C2/48F2: 20 CA 5F JSR $5FCA C2/48F5: 80 98 BRA $488F Pointers for Special Combat Endings Code pointers C2/48F7: 97 48 (02-Warp) C2/48F9: E0 48 (04-Gau leapt) C2/48FB: F0 48 (06-Banon fell) C2/48FD: A1 48 (08-FB 02-Usual monster script way to end a battle) C2/48FF: EB 48 (0A-FB 09-Used by returning Gau when he joins the party) C2/4901: 22 4A (0C-Annihilation perhaps?) C2/4903: 20 36 0B JSR $0B36 (Establish new value for Morph supply based on its previous value and the current Morph timer) C2/4906: A2 06 LDX #$06 C2/4908: 9E 04 3B STZ $3B04,X (Zero this entity's Morph gauge) C2/490B: 8A TXA C2/490C: 4A LSR C2/490D: 85 10 STA $10 C2/490F: A9 03 LDA #$03 C2/4911: 20 11 64 JSR $6411 C2/4914: CA DEX C2/4915: CA DEX C2/4916: 10 F0 BPL $4908 C2/4918: A9 80 LDA #$80 C2/491A: 04 B1 TSB $B1 C2/491C: A2 20 LDX #$20 C2/491E: A9 01 LDA #$01 C2/4920: 20 11 64 JSR $6411 C2/4923: CA DEX C2/4924: D0 F8 BNE $491E C2/4926: A9 0F LDA #$0F C2/4928: 0C 8C 3A TSB $3A8C (mark all characters to have their applicable items added to inventory. in particular, this will handle an item they tried to use (the game depletes it on issuing the command), but were killed before before they could actually execute the command and use it.) C2/492B: 20 C7 62 JSR $62C7 (add items [back] to inventory) C2/492E: A9 0A LDA #$0A C2/4930: 20 11 64 JSR $6411 C2/4933: 4C 95 20 JMP $2095 C2/4936: A2 06 LDX #$06 C2/4938: BD D8 3E LDA $3ED8,X (get which character this is) C2/493B: 30 3E BMI $497B (if it's undefined, skip it) C2/493D: C9 10 CMP #$10 C2/493F: F0 04 BEQ $4945 (branch if it's 1st ghost) C2/4941: C9 11 CMP #$11 C2/4943: D0 07 BNE $494C (branch if it's not 2nd ghost) C2/4945: BD E4 3E LDA $3EE4,X (Check for Dead, Zombie, or Petrify) C2/4948: 89 C2 BIT #$C2 C2/494A: D0 08 BNE $4954 (branch if one or more ^) C2/494C: BD 18 30 LDA $3018,X C2/494F: 2C 88 3A BIT $3A88 C2/4952: F0 03 BEQ $4957 C2/4954: 20 E3 47 JSR $47E3 C2/4957: BD F9 3E LDA $3EF9,X (in-battle status byte 4) C2/495A: 29 C0 AND #$C0 (only keep Dog Block and Float after battle) C2/495C: EB XBA C2/495D: BD E4 3E LDA $3EE4,X (in-battle status byte 1) C2/4960: C2 30 REP #$30 (Set 16-bit Accumulator, 16-bit X and Y) C2/4962: BC 10 30 LDY $3010,X (get offset to character info block) C2/4965: 99 14 16 STA $1614,Y (save in-battle status bytes 1 and 4 to our two out-of-battle status bytes) C2/4968: BD F4 3B LDA $3BF4,X C2/496B: 99 09 16 STA $1609,Y (save current HP in out-of-battle stat) C2/496E: BD 30 3C LDA $3C30,X C2/4971: F0 06 BEQ $4979 (Branch if max MP is zero) C2/4973: BD 08 3C LDA $3C08,X C2/4976: 99 0D 16 STA $160D,Y (otherwise, save current MP in out-of-battle stat) C2/4979: E2 30 SEP #$30 C2/497B: CA DEX C2/497C: CA DEX C2/497D: 10 B9 BPL $4938 (loop for all 4 party members) C2/497F: C2 10 REP #$10 C2/4981: A2 FF 00 LDX #$00FF C2/4984: A0 FB 04 LDY #$04FB C2/4987: B9 86 26 LDA $2686,Y C2/498A: 9D 69 18 STA $1869,X C2/498D: 1A INC C2/498E: F0 03 BEQ $4993 C2/4990: B9 89 26 LDA $2689,Y C2/4993: 9D 69 19 STA $1969,X C2/4996: 88 DEY C2/4997: 88 DEY C2/4998: 88 DEY C2/4999: 88 DEY C2/499A: 88 DEY C2/499B: CA DEX C2/499C: 10 E9 BPL $4987 C2/499E: AD 97 3A LDA $3A97 C2/49A1: F0 21 BEQ $49C4 (branch if not Colosseum brawl?) C2/49A3: AD 05 02 LDA $0205 (item wagered) C2/49A6: C9 FF CMP #$FF C2/49A8: F0 1A BEQ $49C4 (branch if null) C2/49AA: A2 FF 00 LDX #$00FF C2/49AD: DD 69 18 CMP $1869,X (is item wagered in this slot?) C2/49B0: D0 0F BNE $49C1 (branch if not) C2/49B2: DE 69 19 DEC $1969,X (if it was, decrement the item's count as a Colosseum fee) C2/49B5: F0 02 BEQ $49B9 (if there's none of the item left, empty out its slot) C2/49B7: 10 08 BPL $49C1 (if there's a nonzero and positive quantity of the item, don't empty out its slot) C2/49B9: A9 FF LDA #$FF C2/49BB: 9D 69 18 STA $1869,X (store Empty item) C2/49BE: 9E 69 19 STZ $1969,X (with a quantity of 0) C2/49C1: CA DEX (move to next lowest item slot) C2/49C2: 10 E9 BPL $49AD (loop for all 256 item slots) C2/49C4: E2 10 SEP #$10 C2/49C6: AE FA 33 LDX $33FA C2/49C9: 30 0A BMI $49D5 (If Doom Gaze not in battle) C2/49CB: C2 20 REP #$20 (Set 16-bit Accumulator) C2/49CD: BD F4 3B LDA $3BF4,X (Monster's HP) C2/49D0: 8D BE 3E STA $3EBE (Set Doom Gaze's HP to monsters's HP) C2/49D3: E2 20 SEP #$20 (Set 8-bit A) C2/49D5: A2 13 LDX #$13 C2/49D7: BD B4 3E LDA $3EB4,X (copy in-battle event bytes) C2/49DA: 9D C9 1D STA $1DC9,X ( back into normal out-of-battle event bytes) C2/49DD: CA DEX C2/49DE: 10 F7 BPL $49D7 (loop 14 times) C2/49E0: AD 4B 2F LDA $2F4B C2/49E3: 89 02 BIT #$02 C2/49E5: D0 1F BNE $4A06 (exit if this formation has "Don't appear on Veldt" property) C2/49E7: A2 0A LDX #$0A C2/49E9: BD 02 20 LDA $2002,X (Get MSB of monster #) C2/49EC: D0 14 BNE $4A02 (If they're a boss, don't mark formation as found, but check next monster) C2/49EE: AD D5 3E LDA $3ED5 C2/49F1: 4A LSR (Get bit 9 of formation #) C2/49F2: D0 12 BNE $4A06 (If set^, formation # over 511. skip it) C2/49F4: AD D4 3E LDA $3ED4 (Get battle formation) C2/49F7: 20 17 52 JSR $5217 (X=formation DIV 8, A=2^(formation MOD 8) ) C2/49FA: 1D DD 1D ORA $1DDD,X C2/49FD: 9D DD 1D STA $1DDD,X (Update structure of encountered groups for Veldt) C2/4A00: 80 04 BRA $4A06 (Once Veldt structure is updated once, we can exit) C2/4A02: CA DEX C2/4A03: CA DEX C2/4A04: 10 E3 BPL $49E9 (Move to next enemy and loop) C2/4A06: 60 RTS (Add rages learned in battle) C2/4A07: A2 0A LDX #$0A C2/4A09: BD 02 20 LDA $2002,X C2/4A0C: D0 0F BNE $4A1D (Branch if monster # > 256) C2/4A0E: DA PHX C2/4A0F: 18 CLC C2/4A10: BD 01 20 LDA $2001,X (Low byte of monster #) C2/4A13: 20 17 52 JSR $5217 (X=monster # DIV 8, A=2^(monster # MOD 8)) C2/4A16: 1D 2C 1D ORA $1D2C,X C2/4A19: 9D 2C 1D STA $1D2C,X (Add rage to list of known ones) C2/4A1C: FA PLX C2/4A1D: CA DEX C2/4A1E: CA DEX C2/4A1F: 10 E8 BPL $4A09 (Check for all monsters) C2/4A21: 60 RTS C2/4A22: 20 67 02 JSR $0267 C2/4A25: 20 03 49 JSR $4903 C2/4A28: 20 36 49 JSR $4936 C2/4A2B: A2 12 LDX #$12 C2/4A2D: E0 08 CPX #$08 C2/4A2F: B0 34 BCS $4A65 (branch if monster) C2/4A31: BD A0 3A LDA $3AA0,X C2/4A34: 4A LSR C2/4A35: 90 1D BCC $4A54 C2/4A37: BD E4 3E LDA $3EE4,X C2/4A3A: 89 C2 BIT #$C2 (Check for Dead, Zombie, or Petrify) C2/4A3C: D0 16 BNE $4A54 (branch if some possessed) C2/4A3E: BD 05 32 LDA $3205,X C2/4A41: 89 04 BIT #$04 C2/4A43: F0 0F BEQ $4A54 C2/4A45: C2 20 REP #$20 (set 16-bit A) C2/4A47: BD F8 3E LDA $3EF8,X (status bytes 3 and 4) C2/4A4A: 29 FE EE AND #$EEFE C2/4A4D: 9D F8 3E STA $3EF8,X (clear Dance, Rage, and Spell Chant statuses) C2/4A50: E2 20 SEP #$20 (set 8-bit A) C2/4A52: 80 14 BRA $4A68 C2/4A54: A9 FF LDA #$FF C2/4A56: 9D D8 3E STA $3ED8,X (indicate null for "which character this is") C2/4A59: BD 18 30 LDA $3018,X C2/4A5C: 1C 2C 3F TRB $3F2C (clear entity from jumpers) C2/4A5F: 1C 2E 3F TRB $3F2E C2/4A62: 1C 2F 3F TRB $3F2F C2/4A65: 20 9E 4A JSR $4A9E (Clear all statuses) C2/4A68: CA DEX C2/4A69: CA DEX C2/4A6A: 10 C1 BPL $4A2D (loop for all onscreen entities) C2/4A6C: A9 0C LDA #$0C C2/4A6E: 20 11 64 JSR $6411 C2/4A71: 68 PLA C2/4A72: 68 PLA C2/4A73: 4C 16 00 JMP $0016 C2/4A76: C2 20 REP #$20 C2/4A78: A2 04 LDX #$04 C2/4A7A: BF AB 4A C2 LDA $C24AAB,X C2/4A7E: CD E0 11 CMP $11E0 (Battle formation) C2/4A81: D0 14 BNE $4A97 C2/4A83: BF AD 4A C2 LDA $C24AAD,X C2/4A87: 8D E0 11 STA $11E0 (Battle formation) C2/4A8A: E2 20 SEP #$20 C2/4A8C: BF B3 4A C2 LDA $C24AB3,X C2/4A90: 8D E1 3E STA $3EE1 C2/4A93: 68 PLA C2/4A94: 68 PLA C2/4A95: 80 8B BRA $4A22 C2/4A97: CA DEX C2/4A98: CA DEX C2/4A99: 10 DF BPL $4A7A C2/4A9B: E2 20 SEP #$20 C2/4A9D: 60 RTS Clears all statuses C2/4A9E: 9E E4 3E STZ $3EE4,X (Clear Status Byte 1) C2/4AA1: 9E E5 3E STZ $3EE5,X (Clear Status Byte 2) C2/4AA4: 9E F8 3E STZ $3EF8,X (Clear Status Byte 3) C2/4AA7: 9E F9 3E STZ $3EF9,X (Clear Status Byte 4) C2/4AAA: 60 RTS Data for changing formations in last battle C2/4AAB: D7 01 (Short Arm, Long Arm, Face) C2/4AAD: 00 02 (Hit, Tiger, Tools) C2/4AAF: 01 02 (Girl, Sleep) C2/4AB1: 02 02 (Final Kefka) C2/4AB3: 90 90 C2/4AB5: 90 90 C2/4AB7: 8F 8F C2/4AB9: C2 20 REP #$20 (Set 16-bit Accumulator) C2/4ABB: AD 4C 2F LDA $2F4C C2/4ABE: 49 FF FF EOR #$FFFF C2/4AC1: 2D 4E 2F AND $2F4E C2/4AC4: 8D 4E 2F STA $2F4E C2/4AC7: 8D 78 3A STA $3A78 C2/4ACA: 9C 74 3A STZ $3A74 C2/4ACD: 9C 42 3A STZ $3A42 C2/4AD0: E2 20 SEP #$20 C2/4AD2: A2 06 LDX #$06 C2/4AD4: BD A0 3A LDA $3AA0,X C2/4AD7: 4A LSR C2/4AD8: BD 18 30 LDA $3018,X C2/4ADB: 2C 4C 2F BIT $2F4C C2/4ADE: D0 22 BNE $4B02 C2/4AE0: 2C 4E 2F BIT $2F4E C2/4AE3: D0 0E BNE $4AF3 C2/4AE5: 90 1B BCC $4B02 C2/4AE7: 0C 78 3A TSB $3A78 C2/4AEA: EB XBA C2/4AEB: BD E4 3E LDA $3EE4,X C2/4AEE: 89 C2 BIT #$C2 (zombie, Petrify or death status?) C2/4AF0: D0 10 BNE $4B02 (if so, branch) C2/4AF2: EB XBA C2/4AF3: 2D 08 34 AND $3408 C2/4AF6: 0C 74 3A TSB $3A74 C2/4AF9: 2D 40 3A AND $3A40 C2/4AFC: 0C 42 3A TSB $3A42 C2/4AFF: 1C 74 3A TRB $3A74 C2/4B02: CA DEX C2/4B03: CA DEX C2/4B04: 10 CE BPL $4AD4 C2/4B06: A2 0A LDX #$0A C2/4B08: BD A8 3A LDA $3AA8,X C2/4B0B: 4A LSR C2/4B0C: BD 21 30 LDA $3021,X C2/4B0F: 2C 4D 2F BIT $2F4D C2/4B12: D0 1E BNE $4B32 C2/4B14: 2C 4F 2F BIT $2F4F C2/4B17: D0 13 BNE $4B2C C2/4B19: 90 17 BCC $4B32 C2/4B1B: 0C 79 3A TSB $3A79 C2/4B1E: 2C 3A 3A BIT $3A3A C2/4B21: D0 0F BNE $4B32 C2/4B23: EB XBA C2/4B24: BD EC 3E LDA $3EEC,X C2/4B27: 89 C2 BIT #$C2 C2/4B29: D0 07 BNE $4B32 C2/4B2B: EB XBA C2/4B2C: 2D 09 34 AND $3409 C2/4B2F: 0C 75 3A TSB $3A75 C2/4B32: CA DEX C2/4B33: CA DEX C2/4B34: 10 D2 BPL $4B08 C2/4B36: DA PHX C2/4B37: 08 PHP C2/4B38: AD 74 3A LDA $3A74 C2/4B3B: 20 0E 52 JSR $520E C2/4B3E: 8E 76 3A STX $3A76 (Set to number of bits set in $3A74) C2/4B41: AD 75 3A LDA $3A75 C2/4B44: EB XBA C2/4B45: AD 42 3A LDA $3A42 C2/4B48: C2 20 REP #$20 (Set 16-bit Accumulator) C2/4B4A: 20 0E 52 JSR $520E C2/4B4D: 8E 77 3A STX $3A77 (Set to number of bits set in $3A42 & $3A75) C2/4B50: 28 PLP C2/4B51: FA PLX C2/4B52: 60 RTS Random Number Generator 1 (0 or 1, carry clear or set) C2/4B53: 48 PHA C2/4B54: 20 5A 4B JSR $4B5A C2/4B57: 4A LSR C2/4B58: 68 PLA C2/4B59: 60 RTS Random Number Generator 2 (0 to 255) C2/4B5A: DA PHX C2/4B5B: E6 BE INC $BE C2/4B5D: A6 BE LDX $BE C2/4B5F: BF 00 FD C0 LDA $C0FD00,X C2/4B63: FA PLX C2/4B64: 60 RTS Random Number Generator 3 (0 to accumulator - 1) C2/4B65: DA PHX C2/4B66: 08 PHP C2/4B67: E2 30 SEP #$30 (Set 8-bit A, X, Y) C2/4B69: EB XBA C2/4B6A: 48 PHA (save top half of A) C2/4B6B: E6 BE INC $BE C2/4B6D: A6 BE LDX $BE C2/4B6F: BF 00 FD C0 LDA $C0FD00,X C2/4B73: 20 81 47 JSR $4781 (16-bit A = (input 8-bit A) * (Random Number Table value) ) C2/4B76: 68 PLA (restore top half of A) C2/4B77: EB XBA (now bottom half of A = (input 8-bit A * Random Table value) / 256) C2/4B78: 28 PLP C2/4B79: FA PLX C2/4B7A: 60 RTS C2/4B7B: 38 SEC C2/4B7C: 6E 07 34 ROR $3407 C2/4B7F: A9 01 LDA #$01 C2/4B81: 04 B1 TSB $B1 C2/4B83: F4 18 00 PEA $0018 C2/4B86: BD CD 32 LDA $32CD,X C2/4B89: 30 68 BMI $4BF3 C2/4B8B: 0A ASL C2/4B8C: A8 TAY C2/4B8D: 20 76 02 JSR $0276 C2/4B90: C9 1F CMP #$1F C2/4B92: D0 08 BNE $4B9C C2/4B94: 20 54 4C JSR $4C54 C2/4B97: 20 F4 4B JSR $4BF4 C2/4B9A: 80 EA BRA $4B86 C2/4B9C: BD CD 32 LDA $32CD,X C2/4B9F: A8 TAY C2/4BA0: B9 84 31 LDA $3184,Y C2/4BA3: DD CD 32 CMP $32CD,X C2/4BA6: D0 02 BNE $4BAA C2/4BA8: A9 FF LDA #$FF C2/4BAA: 9D CD 32 STA $32CD,X C2/4BAD: A9 FF LDA #$FF C2/4BAF: 99 84 31 STA $3184,Y C2/4BB2: A5 B5 LDA $B5 C2/4BB4: C9 1E CMP #$1E C2/4BB6: B0 1D BCS $4BD5 C2/4BB8: E0 08 CPX #$08 C2/4BBA: B0 19 BCS $4BD5 C2/4BBC: BD 18 30 LDA $3018,X C2/4BBF: 2C 39 3A BIT $3A39 C2/4BC2: D0 1F BNE $4BE3 C2/4BC4: 2C 40 3A BIT $3A40 C2/4BC7: D0 0C BNE $4BD5 C2/4BC9: AD 77 3A LDA $3A77 C2/4BCC: F0 15 BEQ $4BE3 C2/4BCE: BD A0 3A LDA $3AA0,X C2/4BD1: 89 50 BIT #$50 C2/4BD3: D0 0E BNE $4BE3 C2/4BD5: BD 04 32 LDA $3204,X C2/4BD8: 09 04 ORA #$04 C2/4BDA: 9D 04 32 STA $3204,X C2/4BDD: 20 D3 13 JSR $13D3 C2/4BE0: 20 1E 02 JSR $021E C2/4BE3: BD CD 32 LDA $32CD,X C2/4BE6: 1A INC C2/4BE7: D0 07 BNE $4BF0 C2/4BE9: A5 B0 LDA $B0 C2/4BEB: 30 06 BMI $4BF3 C2/4BED: 4C 67 02 JMP $0267 C2/4BF0: 8E 07 34 STX $3407 C2/4BF3: 60 RTS C2/4BF4: 08 PHP C2/4BF5: C2 20 REP #$20 (Set 16-bit accumulator) C2/4BF7: 9C 98 3A STZ $3A98 C2/4BFA: BD 18 30 LDA $3018,X C2/4BFD: 1C FC 33 TRB $33FC C2/4C00: F0 50 BEQ $4C52 C2/4C02: 1C 56 3A TRB $3A56 C2/4C05: D0 21 BNE $4C28 C2/4C07: AD 03 34 LDA $3403 C2/4C0A: 30 05 BMI $4C11 C2/4C0C: EC 04 34 CPX $3404 C2/4C0F: D0 1F BNE $4C30 C2/4C11: BD 60 3E LDA $3E60,X (Quasi Status after attack, bytes 1-2) C2/4C14: 89 00 B0 BIT #$B000 C2/4C17: D0 17 BNE $4C30 (if Sleep, Muddled or Berserk is set, branch) C2/4C19: BD 74 3E LDA $3E74,X (Quasi Status after attack, bytes 3-4) C2/4C1C: 89 10 02 BIT #$0210 C2/4C1F: D0 0F BNE $4C30 (if freeze or stop is set, branch) C2/4C21: BD 94 33 LDA $3394,X C2/4C24: 10 0A BPL $4C30 C2/4C26: 80 0B BRA $4C33 C2/4C28: BD 18 30 LDA $3018,X C2/4C2B: 0C FE 33 TSB $33FE C2/4C2E: F0 E1 BEQ $4C11 C2/4C30: CE 98 3A DEC $3A98 C2/4C33: BD 68 32 LDA $3268,X C2/4C36: 85 F0 STA $F0 C2/4C38: BD 20 3D LDA $3D20,X C2/4C3B: 85 F2 STA $F2 C2/4C3D: BD 41 32 LDA $3241,X C2/4C40: 85 F4 STA $F4 C2/4C42: 18 CLC C2/4C43: 20 2F 1A JSR $1A2F C2/4C46: A5 F2 LDA $F2 C2/4C48: 9D 20 3D STA $3D20,X C2/4C4B: E2 20 SEP #$20 C2/4C4D: A5 F5 LDA $F5 C2/4C4F: 9D 41 32 STA $3241,X C2/4C52: 28 PLP C2/4C53: 60 RTS C2/4C54: DA PHX C2/4C55: E8 INX C2/4C56: 20 01 03 JSR $0301 C2/4C59: FA PLX C2/4C5A: 60 RTS Counter attacks (retort, interceptor, black belt) C2/4C5B: A2 12 LDX #$12 C2/4C5D: BD A0 3A LDA $3AA0,X C2/4C60: 4A LSR C2/4C61: 90 5B BCC $4CBE C2/4C63: AD 1A 34 LDA $341A C2/4C66: F0 56 BEQ $4CBE C2/4C68: 64 B8 STZ $B8 C2/4C6A: 64 B9 STZ $B9 C2/4C6C: BD E0 32 LDA $32E0,X (Top bit = 1 if target of this attack? Bottom seven bits = index of entity who last attacked them?) C2/4C6F: 10 15 BPL $4C86 (Branch if this attack does not target them) C2/4C71: 0A ASL C2/4C72: 85 EE STA $EE (multiply attacker index by 2 so we can access their data) C2/4C74: E4 EE CPX $EE C2/4C76: F0 0E BEQ $4C86 (Branch if targeting yourself) C2/4C78: A8 TAY (Y = attacker index) C2/4C79: C2 20 REP #$20 (Set 16-bit accumulator) C2/4C7B: B9 18 30 LDA $3018,Y C2/4C7E: 85 B8 STA $B8 (Put attacker in $B8) C2/4C80: BD 18 30 LDA $3018,X C2/4C83: 1C FE 33 TRB $33FE C2/4C86: C2 20 REP #$20 C2/4C88: BD 18 30 LDA $3018,X C2/4C8B: 2C 56 3A BIT $3A56 C2/4C8E: E2 20 SEP #$20 C2/4C90: D0 0B BNE $4C9D (Branch if died already this combat) C2/4C92: A5 B1 LDA $B1 C2/4C94: 4A LSR C2/4C95: B0 27 BCS $4CBE (No counter) C2/4C97: A5 B8 LDA $B8 C2/4C99: 05 B9 ORA $B9 C2/4C9B: F0 21 BEQ $4CBE (No counter if not target of attack) C2/4C9D: BD 69 32 LDA $3269,X C2/4CA0: 30 0F BMI $4CB1 C2/4CA2: BD CD 32 LDA $32CD,X C2/4CA5: 10 0A BPL $4CB1 C2/4CA7: A9 1F LDA #$1F C2/4CA9: 8D 7A 3A STA $3A7A C2/4CAC: 20 B2 4E JSR $4EB2 C2/4CAF: 80 0D BRA $4CBE C2/4CB1: E0 08 CPX #$08 C2/4CB3: B0 09 BCS $4CBE (Branch if monster) C2/4CB5: AD A2 11 LDA $11A2 C2/4CB8: 4A LSR C2/4CB9: 90 03 BCC $4CBE (Branch if magical attack) C2/4CBB: 20 C3 4C JSR $4CC3 (Do retort counter) C2/4CBE: CA DEX C2/4CBF: CA DEX C2/4CC0: 10 9B BPL $4C5D (Check for each character and monster) C2/4CC2: 60 RTS Retort C2/4CC3: BD 4C 3E LDA $3E4C,X C2/4CC6: 4A LSR C2/4CC7: 90 0D BCC $4CD6 (Branch if no retort, check dog block) C2/4CC9: A9 07 LDA #$07 C2/4CCB: 8D 7A 3A STA $3A7A (Store Swdtech in command) C2/4CCE: A9 56 LDA #$56 C2/4CD0: 8D 7B 3A STA $3A7B (Store Retort in attack) C2/4CD3: 4C B2 4E JMP $4EB2 Dog Block C2/4CD6: A5 B9 LDA $B9 C2/4CD8: F0 E8 BEQ $4CC2 (Exit function if attacked by party) C2/4CDA: EC 16 34 CPX $3416 C2/4CDD: D0 15 BNE $4CF4 (Branch to Black Belt) C2/4CDF: 20 5A 4B JSR $4B5A (0 to 255) C2/4CE2: 4A LSR C2/4CE3: 90 0F BCC $4CF4 (50% chance branch to Black Belt) C2/4CE5: 4A LSR C2/4CE6: 7B TDC C2/4CE7: 69 FC ADC #$FC C2/4CE9: 8D 7B 3A STA $3A7B (Store Wild Fang or Take Down in attack) C2/4CEC: A9 02 LDA #$02 C2/4CEE: 8D 7A 3A STA $3A7A C2/4CF1: 4C B2 4E JMP $4EB2 Black Belt Counter C2/4CF4: BD 18 30 LDA $3018,X C2/4CF7: 2C 19 34 BIT $3419 C2/4CFA: D0 C6 BNE $4CC2 (Exit if set) C2/4CFC: BD 58 3C LDA $3C58,X C2/4CFF: 89 02 BIT #$02 (Check for Black Belt) C2/4D01: F0 BF BEQ $4CC2 (Exit if no Black Belt) C2/4D03: 20 5A 4B JSR $4B5A (0 to 255) C2/4D06: C9 C0 CMP #$C0 C2/4D08: B0 B8 BCS $4CC2 (25% chance of exit) C2/4D0A: 9B TXY C2/4D0B: F4 CA A0 PEA $A0CA (Death, Petrify, M-Tek, Zombie, Sleep, Muddled) C2/4D0E: F4 11 32 PEA $3211 (Stop, Dance, Freeze, Spell, Hide) C2/4D11: 20 64 58 JSR $5864 C2/4D14: 90 AC BCC $4CC2 (Exit if any set) C2/4D16: 9C 7A 3A STZ $3A7A C2/4D19: 9C 7B 3A STZ $3A7B C2/4D1C: 4C B2 4E JMP $4EB2 C2/4D1F: AC 6A 3A LDY $3A6A C2/4D22: B9 AE 2B LDA $2BAE,Y C2/4D25: 30 45 BMI $4D6C (Exit function) C2/4D27: 0A ASL C2/4D28: AA TAX C2/4D29: 20 66 4E JSR $4E66 C2/4D2C: A9 7B LDA #$7B C2/4D2E: 20 92 07 JSR $0792 C2/4D31: A9 FF LDA #$FF C2/4D33: 99 AE 2B STA $2BAE,Y C2/4D36: 98 TYA C2/4D37: 69 08 ADC #$08 C2/4D39: 29 18 AND #$18 C2/4D3B: 8D 6A 3A STA $3A6A C2/4D3E: 20 6D 4D JSR $4D6D C2/4D41: B9 B0 2B LDA $2BB0,Y C2/4D44: EB XBA C2/4D45: B9 AF 2B LDA $2BAF,Y C2/4D48: 20 89 4D JSR $4D89 C2/4D4B: 20 77 4D JSR $4D77 C2/4D4E: 20 CB 4E JSR $4ECB C2/4D51: B9 AF 2B LDA $2BAF,Y C2/4D54: C9 17 CMP #$17 C2/4D56: D0 C7 BNE $4D1F C2/4D58: C8 INY C2/4D59: C8 INY C2/4D5A: C8 INY C2/4D5B: 20 6D 4D JSR $4D6D C2/4D5E: B9 B0 2B LDA $2BB0,Y C2/4D61: EB XBA C2/4D62: A9 17 LDA #$17 C2/4D64: 20 77 4D JSR $4D77 C2/4D67: 20 CB 4E JSR $4ECB C2/4D6A: 80 B3 BRA $4D1F C2/4D6C: 60 RTS C2/4D6D: 08 PHP C2/4D6E: C2 20 REP #$20 C2/4D70: B9 B1 2B LDA $2BB1,Y C2/4D73: 85 B8 STA $B8 C2/4D75: 28 PLP C2/4D76: 60 RTS Clears target if attacker is Zombied or Muddled C2/4D77: 08 PHP C2/4D78: C2 20 REP #$20 (set 16-bit accumulator) C2/4D7A: 8D 7A 3A STA $3A7A C2/4D7D: BD E4 3E LDA $3EE4,X C2/4D80: 89 02 20 BIT #$2002 C2/4D83: F0 02 BEQ $4D87 (branch if not Zombie or Muddle) C2/4D85: 64 B8 STZ $B8 (clear targets) C2/4D87: 28 PLP C2/4D88: 60 RTS C2/4D89: DA PHX C2/4D8A: 5A PHY C2/4D8B: 9B TXY C2/4D8C: C9 17 CMP #$17 C2/4D8E: D0 02 BNE $4D92 (Branch if not X-Magic) C2/4D90: A9 02 LDA #$02 (Set command to Magic) C2/4D92: C9 19 CMP #$19 C2/4D94: D0 11 BNE $4DA7 (Branch if not Summon) C2/4D96: 48 PHA C2/4D97: EB XBA C2/4D98: C9 FF CMP #$FF (Check if no Esper equipped) C2/4D9A: D0 03 BNE $4D9F C2/4D9C: B9 44 33 LDA $3344,Y C2/4D9F: EB XBA C2/4DA0: B9 18 30 LDA $3018,Y C2/4DA3: 0C 2E 3F TSB $3F2E C2/4DA6: 68 PLA C2/4DA7: C9 01 CMP #$01 C2/4DA9: F0 04 BEQ $4DAF (Branch if Item) C2/4DAB: C9 08 CMP #$08 C2/4DAD: D0 05 BNE $4DB4 (Branch if not Throw) C2/4DAF: EB XBA C2/4DB0: 99 F4 32 STA $32F4,Y (store as item to add back to inventory. this can happen with: 1) Equipment Magic that doesn't destroy the item [no items have this, but the game supports it] 2) the item user's turn never happens. perhaps the character who acted before them won the battle.) C2/4DB3: EB XBA C2/4DB4: C9 0F CMP #$0F C2/4DB6: D0 23 BNE $4DDB (Branch if not Slot) C2/4DB8: 48 PHA (save command #) C2/4DB9: EB XBA (get our Slot index) C2/4DBA: AA TAX C2/4DBB: BF 4A 4E C2 LDA $C24E4A,X (get spell # used by this Slot combo) C2/4DBF: E0 02 CPX #$02 C2/4DC1: B0 0F BCS $4DD2 (branch if it's Bahamut or higher -- i.e. neither form of Joker Doom) C2/4DC3: 48 PHA (save spell #) C2/4DC4: BF 52 4E C2 LDA $C24E52,X (get Joker Doom targeting) C2/4DC8: 95 B8 STA $B8,X (if X is 0 [7-7-Bar], mark all party members in $B8 if X is 1 [7-7-7], mark all enemies in $B9) C2/4DCA: A5 B8 LDA $B8 C2/4DCC: 4D 40 3A EOR $3A40 C2/4DCF: 85 B8 STA $B8 (toggle whether characters acting as enemies are targeted. e.g. Shadow in Colosseum or Gau returning from Veldt leap) C2/4DD1: 68 PLA (restore spell #) C2/4DD2: C9 FF CMP #$FF C2/4DD4: D0 03 BNE $4DD9 (branch if not Bar-Bar-Bar) C2/4DD6: 20 DC 37 JSR $37DC (Pick random esper) C2/4DD9: EB XBA C2/4DDA: 68 PLA (restore command #) C2/4DDB: C9 13 CMP #$13 C2/4DDD: D0 0D BNE $4DEC (Branch if not Dance) C2/4DDF: 48 PHA C2/4DE0: EB XBA C2/4DE1: 99 E1 32 STA $32E1,Y C2/4DE4: 8D 6F 3A STA $3A6F C2/4DE7: 20 9C 05 JSR $059C (Pick dance and dance move) C2/4DEA: EB XBA C2/4DEB: 68 PLA C2/4DEC: C9 10 CMP #$10 C2/4DEE: D0 0A BNE $4DFA (Branch if not Rage) C2/4DF0: 48 PHA C2/4DF1: EB XBA C2/4DF2: 99 A8 33 STA $33A8,Y (Which rage is being used) C2/4DF5: 20 D1 05 JSR $05D1 (Picks a Rage [when Muddled/Berserked/etc], and picks the Rage move) C2/4DF8: EB XBA C2/4DF9: 68 PLA C2/4DFA: C9 0A CMP #$0A C2/4DFC: D0 15 BNE $4E13 (Branch if not Blitz) C2/4DFE: 48 PHA C2/4DFF: EB XBA C2/4E00: 48 PHA C2/4E01: 30 0D BMI $4E10 (If no blitz selected) C2/4E03: AA TAX C2/4E04: 20 57 1E JSR $1E57 C2/4E07: 2C 28 1D BIT $1D28 C2/4E0A: D0 04 BNE $4E10 (Branch if selected blitz is known) C2/4E0C: A9 FF LDA #$FF C2/4E0E: 83 01 STA $01,S (replace spell/attack # with null) C2/4E10: 68 PLA C2/4E11: EB XBA C2/4E12: 68 PLA C2/4E13: A2 04 LDX #$04 C2/4E15: DF 3C 4E C2 CMP $C24E3C,X (does our command match one that needs its spell # calculated?) C2/4E19: D0 0B BNE $4E26 (branch if not) C2/4E1B: EB XBA C2/4E1C: 18 CLC C2/4E1D: 7F 41 4E C2 ADC $C24E41,X (add the first spell # for this command to our current index. ex - for Pummel, Blitz #0, we'd end up with 55h.) C2/4E21: 90 02 BCC $4E25 (branch if the spell # didn't overflow) C2/4E23: A9 EE LDA #$EE (load Battle as spell #) C2/4E25: EB XBA (put spell # in top of A, and look at command # again) C2/4E26: CA DEX C2/4E27: 10 EC BPL $4E15 (loop for all 5 commands) C2/4E29: 48 PHA C2/4E2A: 18 CLC (clear Carry) C2/4E2B: 20 17 52 JSR $5217 (X = A DIV 8, A = 2 ^ (A MOD 8) ) C2/4E2E: 3F 46 4E C2 AND $C24E46,X (compare to bitfield of commands that need to retarget) C2/4E32: F0 04 BEQ $4E38 (Branch if command doesn't need to retarget) C2/4E34: 64 B8 STZ $B8 C2/4E36: 64 B9 STZ $B9 (clear targets) C2/4E38: 68 PLA C2/4E39: 7A PLY C2/4E3A: FA PLX C2/4E3B: 60 RTS (Data - commands that need their spell # calculated) C2/4E3C: 19 (Summon) C2/4E3D: 0C (Lore) C2/4E3E: 1D (Magitek) C2/4E3F: 0A (Blitz) C2/4E40: 07 (Swdtech) (Data - first spell # for each of above commands) C2/4E41: 36 (Espers) C2/4E42: 8B (Lores) C2/4E43: 83 (Magitek commands) C2/4E44: 5D (Blitzes) C2/4E45: 55 (Swdtech) (Data - commands that need to retarget. 8 commands per byte.) C2/4E46: 80 (Swdtech) C2/4E47: 04 (Blitz) C2/4E48: 0B (Rage, Leap, Dance) C2/4E49: 00 (Nothing) (Data - spell numbers for Slot attacks) C2/4E4A: 94 (L.5 Doom -- used by Joker Doom) C2/4E4B: 94 (L.5 Doom -- used by Joker Doom) C2/4E4C: 43 (Bahamut) C2/4E4D: FF (Nothing -- used by Triple Bar?) C2/4E4E: 80 (H-Bomb) C2/4E4F: 7F (Chocobop) C2/4E50: 81 (7-Flush) C2/4E51: FE (Lagomorph) (Data - Joker Doom targeting) C2/4E52: 0F (7-7-bar => your whole party) C2/4E53: 3F (7-7-7 => whole enemy party) C2/4E54: DA PHX C2/4E55: A2 7F LDX #$7F C2/4E57: BD 84 31 LDA $3184,X C2/4E5A: 30 04 BMI $4E60 C2/4E5C: CA DEX C2/4E5D: 10 F8 BPL $4E57 C2/4E5F: E8 INX C2/4E60: 8A TXA C2/4E61: 9D 84 31 STA $3184,X C2/4E64: FA PLX C2/4E65: 60 RTS C2/4E66: 8A TXA C2/4E67: DA PHX C2/4E68: AE 65 3A LDX $3A65 C2/4E6B: 9D 20 37 STA $3720,X C2/4E6E: FA PLX C2/4E6F: EE 65 3A INC $3A65 C2/4E72: A9 FE LDA #$FE C2/4E74: 4C 43 0A JMP $0A43 (Add character/monster to queue of who will act next. One place this is called is when someone's "wait timer" after inputting a command elapses and they can leave their ready stance to attack.) C2/4E77: 8A TXA C2/4E78: DA PHX C2/4E79: AE 67 3A LDX $3A67 (get next available queue slot) C2/4E7C: 9D 20 38 STA $3820,X (store current entity in that slot) C2/4E7F: FA PLX C2/4E80: EE 67 3A INC $3A67 (point to next queue slot after this one. this is circular: if we've gone past slot #255, we'll restart on #0. that shouldn't be a problem unless 256+ fighters get queued up at once somehow.) C2/4E83: 60 RTS C2/4E84: 8A TXA C2/4E85: DA PHX C2/4E86: AE 69 3A LDX $3A69 C2/4E89: 9D 20 39 STA $3920,X C2/4E8C: FA PLX C2/4E8D: EE 69 3A INC $3A69 C2/4E90: 60 RTS C2/4E91: 5A PHY C2/4E92: 08 PHP C2/4E93: E2 20 SEP #$20 C2/4E95: 8D 7A 3A STA $3A7A (Set command) C2/4E98: 8E 7B 3A STX $3A7B (Set attack) C2/4E9B: 20 54 4E JSR $4E54 C2/4E9E: 48 PHA C2/4E9F: AD 0A 34 LDA $340A C2/4EA2: C9 FF CMP #$FF C2/4EA4: D0 39 BNE $4EDF C2/4EA6: A3 01 LDA $01,S C2/4EA8: 8D 0A 34 STA $340A C2/4EAB: 80 32 BRA $4EDF C2/4EAD: A5 B1 LDA $B1 C2/4EAF: 4A LSR C2/4EB0: 90 19 BCC $4ECB C2/4EB2: 5A PHY C2/4EB3: 08 PHP C2/4EB4: E2 20 SEP #$20 C2/4EB6: 20 54 4E JSR $4E54 C2/4EB9: 48 PHA C2/4EBA: BD CD 32 LDA $32CD,X C2/4EBD: C9 FF CMP #$FF C2/4EBF: D0 1E BNE $4EDF C2/4EC1: 20 84 4E JSR $4E84 C2/4EC4: A3 01 LDA $01,S C2/4EC6: 9D CD 32 STA $32CD,X C2/4EC9: 80 14 BRA $4EDF C2/4ECB: 5A PHY C2/4ECC: 08 PHP C2/4ECD: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/4ECF: 20 54 4E JSR $4E54 C2/4ED2: 48 PHA C2/4ED3: BD CC 32 LDA $32CC,X C2/4ED6: C9 FF CMP #$FF C2/4ED8: D0 05 BNE $4EDF C2/4EDA: A3 01 LDA $01,S C2/4EDC: 9D CC 32 STA $32CC,X C2/4EDF: A8 TAY C2/4EE0: D9 84 31 CMP $3184,Y C2/4EE3: F0 07 BEQ $4EEC C2/4EE5: B9 84 31 LDA $3184,Y C2/4EE8: 30 02 BMI $4EEC C2/4EEA: 80 F3 BRA $4EDF C2/4EEC: 68 PLA C2/4EED: 99 84 31 STA $3184,Y C2/4EF0: 0A ASL C2/4EF1: A8 TAY C2/4EF2: 20 08 4F JSR $4F08 (Determine MP cost of a spell/attack) C2/4EF5: 99 20 36 STA $3620,Y (save MP cost) C2/4EF8: C2 20 REP #$20 (Set 16-bit Accumulator) C2/4EFA: AD 7A 3A LDA $3A7A C2/4EFD: 99 20 34 STA $3420,Y (save command #) C2/4F00: A5 B8 LDA $B8 C2/4F02: 99 20 35 STA $3520,Y C2/4F05: 28 PLP C2/4F06: 7A PLY C2/4F07: 60 RTS (Determine MP cost of a spell/attack) C2/4F08: DA PHX C2/4F09: 08 PHP C2/4F0A: 7B TDC (16-bit A = 0. this means the returned spell cost will default to zero.) C2/4F0B: A9 40 LDA #$40 C2/4F0D: 14 B1 TRB $B1 C2/4F0F: D0 42 BNE $4F53 C2/4F11: AD 7A 3A LDA $3A7A (get command #) C2/4F14: C9 19 CMP #$19 C2/4F16: F0 0C BEQ $4F24 (branch if it's Summon) C2/4F18: C9 0C CMP #$0C C2/4F1A: F0 08 BEQ $4F24 (branch if it's Lore) C2/4F1C: C9 02 CMP #$02 C2/4F1E: F0 04 BEQ $4F24 (branch if it's Magic) C2/4F20: C9 17 CMP #$17 C2/4F22: D0 2F BNE $4F53 (branch if it's not X-Magic) C2/4F24: C2 10 REP #$10 (Set 16-bit X and Y) C2/4F26: AD 7B 3A LDA $3A7B (get attack #) C2/4F29: E0 08 00 CPX #$0008 C2/4F2C: B0 19 BCS $4F47 (branch if it's a monster attacker. they don't have menus containing MP data, nor relics that can alter MP costs.) C2/4F2E: DA PHX C2/4F2F: AA TAX C2/4F30: BD 84 30 LDA $3084,X (get this spell's index relative to start of Magic menu? i believe the Lore menu follows the Magic menu in memory.) C2/4F33: FA PLX C2/4F34: C9 FF CMP #$FF C2/4F36: F0 1B BEQ $4F53 (if it's somehow not in the menu, branch?) C2/4F38: C2 20 REP #$20 (Set 16-bit Accumulator) C2/4F3A: 0A ASL C2/4F3B: 0A ASL (multiply offset by 4, as each spell menu entry has 4 bytes: Spell index number, Unknown [related to spell availability], Spell aiming, MP cost) C2/4F3C: 7D 2C 30 ADC $302C,X (add starting address of character's Magic menu?) C2/4F3F: AA TAX C2/4F40: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/4F42: BD 03 00 LDA $0003,X (get MP cost from character's menu data. it usually matches the spell data, but Gold Hairpin, Economizer, and Step Mine's special formula can make it vary.) C2/4F45: 80 0D BRA $4F54 (clean up stack and exit) C2/4F47: EB XBA C2/4F48: A9 0E LDA #$0E C2/4F4A: 20 81 47 JSR $4781 (attack # * 14) C2/4F4D: AA TAX C2/4F4E: BF C5 6A C4 LDA $C46AC5,X (read MP cost from spell data) C2/4F52: EB XBA C2/4F53: EB XBA C2/4F54: 28 PLP C2/4F55: FA PLX C2/4F56: 60 RTS Monster command script command #$F7 C2/4F57: A5 B6 LDA $B6 C2/4F59: EB XBA C2/4F5A: A9 0F LDA #$0F C2/4F5C: 4C BF 62 JMP $62BF Command #$26 - Doom cast when Condemned countdown reaches 0; Safe, Shell, or Reflect* cast when character enters Near Fatal (* no items actually do this, but it's supported); or revival due to Life 3. C2/4F5F: A5 B8 LDA $B8 (get spell ID?) C2/4F61: A6 B6 LDX $B6 (get target?) C2/4F63: 85 B6 STA $B6 (save spell ID) C2/4F65: C9 0D CMP #$0D C2/4F67: D0 0F BNE $4F78 (branch if we're not casting Doom) C2/4F69: BD 04 32 LDA $3204,X C2/4F6C: 09 10 ORA #$10 C2/4F6E: 9D 04 32 STA $3204,X C2/4F71: AD 77 3A LDA $3A77 C2/4F74: F0 69 BEQ $4FDF (Exit function if no monsters are alive) C2/4F76: A9 0D LDA #$0D (Set spell to Doom again. it's easier than PHA/PLA) C2/4F78: EB XBA C2/4F79: A9 02 LDA #$02 C2/4F7B: 85 B5 STA $B5 (Set command to Magic) C2/4F7D: 20 D3 26 JSR $26D3 (Load command and spell data) C2/4F80: 20 51 29 JSR $2951 C2/4F83: A9 10 LDA #$10 C2/4F85: 14 B0 TRB $B0 C2/4F87: A9 02 LDA #$02 C2/4F89: 8D A3 11 STA $11A3 (Set attack to only not reflectable) C2/4F8C: A9 20 LDA #$20 C2/4F8E: 0C A4 11 TSB $11A4 (Set can't be dodged) C2/4F91: 9C A5 11 STZ $11A5 (Set to 0 MP cost) C2/4F94: 4C 67 31 JMP $3167 Monster command script command #$F5 C2/4F97: 9C 2A 3A STZ $3A2A (Set to zero damage) C2/4F9A: 9C 2B 3A STZ $3A2B C2/4F9D: AD 73 3A LDA $3A73 C2/4FA0: 49 FF EOR #$FF C2/4FA2: 14 B9 TRB $B9 (Clear monsters that aren't in template) C2/4FA4: A5 B8 LDA $B8 C2/4FA6: 0A ASL C2/4FA7: AA TAX C2/4FA8: A0 12 LDY #$12 C2/4FAA: B9 19 30 LDA $3019,Y C2/4FAD: 24 B9 BIT $B9 C2/4FAF: F0 03 BEQ $4FB4 (branch if enemy isn't affected by the F5 command) C2/4FB1: FC E4 51 JSR ($51E4,X) C2/4FB4: 88 DEY C2/4FB5: 88 DEY C2/4FB6: C0 08 CPY #$08 C2/4FB8: B0 F0 BCS $4FAA (loop for all 6 monsters) C2/4FBA: A5 B6 LDA $B6 C2/4FBC: EB XBA C2/4FBD: A9 13 LDA #$13 C2/4FBF: 4C BF 62 JMP $62BF C2/4FC2: 48 PHA C2/4FC3: A9 FF LDA #$FF C2/4FC5: 8D 95 3A STA $3A95 C2/4FC8: 68 PLA C2/4FC9: 80 03 BRA $4FCE C2/4FCB: 0C 4D 2F TSB $2F4D C2/4FCE: 1C 09 34 TRB $3409 C2/4FD1: 1C 2F 2F TRB $2F2F C2/4FD4: 0C 2A 3A TSB $3A2A C2/4FD7: B9 F9 3E LDA $3EF9,Y C2/4FDA: 09 20 ORA #$20 C2/4FDC: 99 F9 3E STA $3EF9,Y (Set Hide status) C2/4FDF: 60 RTS C2/4FE0: 48 PHA C2/4FE1: C2 20 REP #$20 C2/4FE3: B9 1C 3C LDA $3C1C,Y (Max HP) C2/4FE6: 99 F4 3B STA $3BF4,Y (Current HP) C2/4FE9: E2 20 SEP #$20 C2/4FEB: 68 PLA C2/4FEC: 1C 3A 3A TRB $3A3A C2/4FEF: 0C 2F 2F TSB $2F2F C2/4FF2: 0C 2B 3A TSB $3A2B C2/4FF5: 0C 4F 2F TSB $2F4F C2/4FF8: 0C 09 34 TSB $3409 C2/4FFB: 9C 95 3A STZ $3A95 C2/4FFE: 60 RTS C2/4FFF: 20 CE 4F JSR $4FCE C2/5002: B9 E4 3E LDA $3EE4,Y C2/5005: 09 80 ORA #$80 C2/5007: 99 E4 3E STA $3EE4,Y (Set Death status) C2/500A: 60 RTS Regen and Poison C2/500B: AD 77 3A LDA $3A77 C2/500E: F0 CF BEQ $4FDF (Exit if $3A77 = 0) C2/5010: B9 A1 3A LDA $3AA1,Y C2/5013: 29 EF AND #$EF C2/5015: 99 A1 3A STA $3AA1,Y (clear bit 4 of $3AA1,Y. because we're servicing this damage/healing request, we can allow C2/5A83 to queue up another one for this entity as needed.) C2/5018: B9 A0 3A LDA $3AA0,Y C2/501B: 89 10 BIT #$10 C2/501D: D0 C0 BNE $4FDF (Exit if bit 4 of $3AA0,Y set) C2/501F: 20 8A 29 JSR $298A C2/5022: A9 90 LDA #$90 C2/5024: 14 B3 TRB $B3 (Set Ignore Clear, and allow for damage increment even with Ignore Defense) C2/5026: A9 12 LDA #$12 C2/5028: 85 B5 STA $B5 (Set command to Mimic) C2/502A: A9 68 LDA #$68 C2/502C: 8D A2 11 STA $11A2 (Sets to only ignore defense, no split damage, reverse damage/healing on undead) C2/502F: 4E A4 11 LSR $11A4 C2/5032: A5 B6 LDA $B6 C2/5034: 4A LSR C2/5035: 4A LSR C2/5036: 2E A4 11 ROL $11A4 (Set to heal for regen; damage for poison & seizure/phantasm) C2/5039: 4A LSR C2/503A: 90 15 BCC $5051 (Branch if not poison) C2/503C: B9 24 3E LDA $3E24,Y (Amount to increment damage) C2/503F: 85 BD STA $BD C2/5041: 1A INC C2/5042: 1A INC C2/5043: C9 0F CMP #$0F C2/5045: 90 02 BCC $5049 (If under 15) C2/5047: A9 0E LDA #$0E (Set to 14) C2/5049: 99 24 3E STA $3E24,Y C2/504C: A9 08 LDA #$08 C2/504E: 8D A1 11 STA $11A1 (Set element to poison) C2/5051: B9 40 3B LDA $3B40,Y (Stamina) (Figure damage) C2/5054: 85 E8 STA $E8 C2/5056: C2 20 REP #$20 C2/5058: B9 1C 3C LDA $3C1C,Y (Max HP) C2/505B: 20 B7 47 JSR $47B7 (Max HP * Stamina / 256) C2/505E: 4A LSR C2/505F: 4A LSR C2/5060: C9 FE CMP #$00FE C2/5063: E2 20 SEP #$20 C2/5065: 90 02 BCC $5069 (If under 254) C2/5067: A9 FC LDA #$FC (set to 253) C2/5069: 69 02 ADC #$02 C2/506B: 8D A6 11 STA $11A6 (Store damage in battle power) C2/506E: BB TYX C2/506F: 4C 67 31 JMP $3167 Monster command script command #$F2 ($B8 and bottom 7 bits of $B9 = new formation to change to) C2/5072: A5 B8 LDA $B8 (Byte 2) C2/5074: 8D E0 11 STA $11E0 (Monster formation, byte 1) C2/5077: 0E 47 3A ASL $3A47 C2/507A: A5 B9 LDA $B9 (Byte 3. top bit: 0 = monsters get Max HP. 1 = retain HP and Max HP from current formation.) C2/507C: 49 80 EOR #$80 C2/507E: 0A ASL C2/507F: 6E 47 3A ROR $3A47 C2/5082: 4A LSR C2/5083: 8D E1 11 STA $11E1 (Monster formation, byte 2) C2/5086: 20 E8 30 JSR $30E8 C2/5089: C2 20 REP #$20 (Set 16-bit Accumulator) C2/508B: A2 0A LDX #$0A C2/508D: 9E A8 3A STZ $3AA8,X (clear enemy presence flag) C2/5090: 9E 54 3E STZ $3E54,X C2/5093: 7B TDC C2/5094: 3A DEC C2/5095: 9D 01 20 STA $2001,X (save FFFFh [null] as enemy #) C2/5098: A9 BC FF LDA #$FFBC C2/509A: 9D 0C 32 STA $320C,X (aka $3204,X) C2/509E: CA DEX C2/509F: CA DEX C2/50A0: 10 EB BPL $508D (loop for all 6 enemies) C2/50A2: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/50A4: 20 E1 2E JSR $2EE1 C2/50A7: 20 91 43 JSR $4391 C2/50AA: 20 9B 06 JSR $069B C2/50AD: 20 3F 08 JSR $083F C2/50B0: 20 B9 4A JSR $4AB9 C2/50B3: 20 C9 26 JSR $26C9 C2/50B6: 20 3A 2E JSR $2E3A C2/50B9: AD 75 3A LDA $3A75 C2/50BC: 8D 2B 3A STA $3A2B C2/50BF: AD 1E 20 LDA $201E C2/50C2: 8D 2A 3A STA $3A2A C2/50C5: A5 B6 LDA $B6 C2/50C7: EB XBA C2/50C8: A9 12 LDA #$12 C2/50CA: 4C BF 62 JMP $62BF Command #$25 C2/50CD: A9 02 LDA #$02 C2/50CF: 80 02 BRA $50D3 C2/50D1: A9 10 LDA #$10 (Command #$21 - F3 Command script enters here) C2/50D3: EB XBA C2/50D4: A5 B6 LDA $B6 C2/50D6: EB XBA C2/50D7: 9C 2A 3A STZ $3A2A (Sets final damage to 0) C2/50DA: 4C BF 62 JMP $62BF (Command #$27 - Display Scan info ?) C2/50DD: A6 B6 LDX $B6 C2/50DF: A9 FF LDA #$FF C2/50E1: 8D 72 2D STA $2D72 C2/50E4: A9 02 LDA #$02 C2/50E6: 8D 6E 2D STA $2D6E C2/50E9: 9C 36 2F STZ $2F36 C2/50EC: 9C 37 2F STZ $2F37 C2/50EF: 9C 3A 2F STZ $2F3A C2/50F2: BD 18 3B LDA $3B18,X (Level) C2/50F5: 8D 35 2F STA $2F35 C2/50F8: A9 34 LDA #$34 C2/50FA: 8D 6F 2D STA $2D6F C2/50FD: A9 04 LDA #$04 C2/50FF: 20 11 64 JSR $6411 C2/5102: C2 20 REP #$20 C2/5104: BD F4 3B LDA $3BF4,X (Current HP) C2/5107: 8D 35 2F STA $2F35 C2/510A: BD 1C 3C LDA $3C1C,X (Max HP) C2/510D: 8D 38 2F STA $2F38 C2/5110: E2 20 SEP #$20 C2/5112: A9 30 LDA #$30 C2/5114: 8D 6F 2D STA $2D6F C2/5117: A9 04 LDA #$04 C2/5119: 20 11 64 JSR $6411 C2/511C: C2 20 REP #$20 C2/511E: BD 08 3C LDA $3C08,X (Current MP) C2/5121: 8D 35 2F STA $2F35 C2/5124: BD 30 3C LDA $3C30,X (Max MP) C2/5127: 8D 38 2F STA $2F38 C2/512A: E2 20 SEP #$20 C2/512C: F0 0A BEQ $5138 C2/512E: A9 31 LDA #$31 C2/5130: 8D 6F 2D STA $2D6F C2/5133: A9 04 LDA #$04 C2/5135: 20 11 64 JSR $6411 C2/5138: A9 15 LDA #$15 C2/513A: 8D 6F 2D STA $2D6F C2/513D: BD E0 3B LDA $3BE0,X C2/5140: 85 EE STA $EE (Weak elements) C2/5142: BD E1 3B LDA $3BE1,X C2/5145: 1D CC 3B ORA $3BCC,X C2/5148: 1D CD 3B ORA $3BCD,X C2/514B: 14 EE TRB $EE (subtract Absorbed, Nullified, and Resisted elements, because those supercede weaknesses) C2/514D: A9 01 LDA #$01 C2/514F: 24 EE BIT $EE C2/5151: F0 07 BEQ $515A (branch if not weak to current element) C2/5153: 48 PHA C2/5154: A9 04 LDA #$04 C2/5156: 20 11 64 JSR $6411 C2/5159: 68 PLA C2/515A: EE 6F 2D INC $2D6F (point to next element name) C2/515D: 0A ASL (look at next elemental bit) C2/515E: 90 EF BCC $514F (loop 8 times, as there's 8 elements) C2/5160: 60 RTS Remove Stop, Reflect, Freeze, or Sleep when time is up C2/5161: AE 7D 3A LDX $3A7D C2/5164: 20 8A 29 JSR $298A (Clear special effect, magic power, etc.) C2/5167: A9 12 LDA #$12 C2/5169: 85 B5 STA $B5 (Set command to Mimic) C2/516B: A9 10 LDA #$10 C2/516D: 14 B0 TRB $B0 C2/516F: 46 B8 LSR $B8 C2/5171: 90 05 BCC $5178 (Branch if bit 0 of $B8 is 0) C2/5173: A9 10 LDA #$10 C2/5175: 0C AC 11 TSB $11AC (Attack clears Stop) C2/5178: 46 B8 LSR $B8 C2/517A: 90 05 BCC $5181 (Branch if bit 1 of $B8 is 0) C2/517C: A9 80 LDA #$80 C2/517E: 0C AC 11 TSB $11AC (Attack clears Reflect) C2/5181: 46 B8 LSR $B8 C2/5183: 90 05 BCC $518A (Branch if bit 2 of $B8 is 0) C2/5185: A9 02 LDA #$02 C2/5187: 0C AD 11 TSB $11AD (Attack clears Freeze) C2/518A: 46 B8 LSR $B8 C2/518C: 90 12 BCC $51A0 (Branch if bit 3 of $B8 is 0) C2/518E: A9 80 LDA #$80 C2/5190: 3D E5 3E AND $3EE5,X C2/5193: F0 0B BEQ $51A0 (Branch if not sleeping) C2/5195: 0C AB 11 TSB $11AB (Attack clears Sleep) C2/5198: A9 02 LDA #$02 C2/519A: 85 B5 STA $B5 (Set command to Magic) C2/519C: A9 78 LDA #$78 C2/519E: 85 B6 STA $B6 (Set spell to Tapir. Note this does *not* use the spell _data_ of the Tapir from Mog's dance, so it won't have the same effect) C2/51A0: A9 04 LDA #$04 C2/51A2: 0C A4 11 TSB $11A4 (Set to lift statuses) C2/51A5: 4C 67 31 JMP $3167 Command #$2C (??? function) C2/51A8: AD 7D 3A LDA $3A7D C2/51AB: 4A LSR C2/51AC: EB XBA C2/51AD: A9 0E LDA #$0E C2/51AF: 4C BF 62 JMP $62BF Command #$2D (Drain from being seized) C2/51B2: B9 A1 3A LDA $3AA1,Y C2/51B5: 29 EF AND #$EF C2/51B7: 99 A1 3A STA $3AA1,Y (Clear bit 4 of $3AA1,Y) C2/51BA: BB TYX C2/51BB: 20 8A 29 JSR $298A (Clear special effect, magic power, etc.) C2/51BE: 9C AE 11 STZ $11AE (Set Magic Power to 0) C2/51C1: A9 10 LDA #$10 C2/51C3: 8D AF 11 STA $11AF (Set Level to 16) C2/51C6: 8D A6 11 STA $11A6 (Set Spell Power to 16) C2/51C9: A9 28 LDA #$28 C2/51CB: 8D A2 11 STA $11A2 (Sets to only ignore defense, heal undead) C2/51CE: A9 02 LDA #$02 C2/51D0: 8D A3 11 STA $11A3 (Sets to Not reflectable only) C2/51D3: 0C A4 11 TSB $11A4 (Sets Redirection) C2/51D6: 0C 46 3A TSB $3A46 (set flag to let this attack target a Seized entity, who is normally untargetable) C2/51D9: A9 80 LDA #$80 C2/51DB: 14 B2 TRB $B2 (Indicate a special type of drainage. Normal drain is capped at the lowest of: drainee's Current HP/MP and drainer's Max - Current HP/MP. This one will ignore the latter, meaning it's effectively just a damage attack if the drainer's [or undead target's] HP/MP is full.) C2/51DD: A9 12 LDA #$12 C2/51DF: 85 B5 STA $B5 (Sets command to Mimic) C2/51E1: 4C 7B 31 JMP $317B Code pointers for command #$F5 C2/51E4: E0 4F C2/51E6: CB 4F C2/51E8: EC 4F C2/51EA: CE 4F C2/51EC: C2 4F C2/51EE: FF 4F X = Highest bit in A that is 1 (bit 0 = 0, 1 = 1, etc.) C2/51F0: A2 00 LDX #$00 C2/51F2: 4A LSR C2/51F3: F0 03 BEQ $51F8 (Exit if all bits are 0) C2/51F5: E8 INX C2/51F6: 80 FA BRA $51F2 C2/51F8: 60 RTS Y = (Number of highest target set in A) * 2 (0, 2, 4, or 6 for characters. 8, 10, 12, 14, 16, or 18 for monsters.) (Remember that $3018 : Holds $01 for character 1, $02 for character 2, $04 for character 3, $08 for character 4 $3019 : Holds $01 for monster 1, $02 for monster 2, etc. ) C2/51F9: DA PHX C2/51FA: 08 PHP C2/51FB: C2 20 REP #$20 (Set 16-bit Accumulator) C2/51FD: E2 10 SEP #$10 (Set 8-bit Index Registers) C2/51FF: A2 12 LDX #$12 C2/5201: 3C 18 30 BIT $3018,X C2/5204: D0 04 BNE $520A (Exit loop if bit set) C2/5206: CA DEX C2/5207: CA DEX C2/5208: 10 F7 BPL $5201 (loop through all 10 targets if necessary) C2/520A: 9B TXY C2/520B: 28 PLP C2/520C: FA PLX C2/520D: 60 RTS Sets X to number of bits set in A C2/520E: A2 00 LDX #$00 C2/5210: 4A LSR C2/5211: 90 01 BCC $5214 C2/5213: E8 INX C2/5214: D0 FA BNE $5210 C2/5216: 60 RTS X = A / 8 (including carry, so A is effectively 9 bits) A = 1 if (A % 8) = 0, 2 if (A % 8) = 1, 4 if (A % 8) = 2, 8 if (A % 8) = 3, 16 if (A % 8) = 4, etc. Carry flag = cleared C2/5217: 5A PHY C2/5218: 48 PHA C2/5219: 6A ROR C2/521A: 4A LSR C2/521B: 4A LSR C2/521C: AA TAX C2/521D: 68 PLA C2/521E: 29 07 AND #$07 C2/5220: A8 TAY C2/5221: A9 00 LDA #$00 C2/5223: 38 SEC C2/5224: 2A ROL C2/5225: 88 DEY C2/5226: 10 FC BPL $5224 C2/5228: 7A PLY C2/5229: 60 RTS Randomly picks a bit set in A C2/522A: 5A PHY C2/522B: 08 PHP C2/522C: C2 20 REP #$20 (Set 16-bit Accumulator) C2/522E: 85 EE STA $EE C2/5230: 20 0E 52 JSR $520E (X = number of bits set in A) C2/5233: 8A TXA C2/5234: F0 0E BEQ $5244 (Exit if no bits set) C2/5236: 20 65 4B JSR $4B65 (0 to A - 1) C2/5239: AA TAX C2/523A: 38 SEC C2/523B: 7B TDC C2/523C: 2A ROL C2/523D: 24 EE BIT $EE C2/523F: F0 FB BEQ $523C C2/5241: CA DEX C2/5242: 10 F8 BPL $523C C2/5244: 28 PLP C2/5245: 7A PLY C2/5246: 60 RTS C2/5247: 5A PHY C2/5248: EB XBA C2/5249: A9 00 LDA #$00 C2/524B: A0 03 LDY #$03 C2/524D: EB XBA C2/524E: 0A ASL C2/524F: EB XBA C2/5250: 90 04 BCC $5256 C2/5252: 7F 69 52 C2 ADC $C25269,X C2/5256: 99 FC 00 STA $00FC,Y C2/5259: E8 INX C2/525A: 88 DEY C2/525B: 10 F0 BPL $524D C2/525D: 20 65 4B JSR $4B65 C2/5260: A2 04 LDX #$04 C2/5262: CA DEX C2/5263: D5 FC CMP $FC,X C2/5265: B0 FB BCS $5262 C2/5267: 7A PLY C2/5268: 60 RTS (Data) C2/5269: 9E 5F FF STZ $FF5F,X C2/526C: FF 5E 3F FF SBC $FF3F5E,X C2/5270: 5F 5E 3F 5F EOR $5F3F5E,X C2/5274: FF 3E 3F 3F SBC $3F3F3E,X C2/5278: 3F 1E 07 07 AND $07071E,X C2/527C: CF (Gray out or enable character commands based on various criteria, such as: whether current equipment supports them, whether the character is inflicted with Imp or Mute, and whether they've accumulated enough Magic Points to Morph. This function also enables Offering to change the aiming of Fight and Capture.) C2/527D: DA PHX C2/527E: 08 PHP C2/527F: C2 30 REP #$30 (Set 16-bit A, X and Y) C2/5281: 9B TXY C2/5282: BF 4A 54 C2 LDA $C2544A,X (Get address of character's menu) C2/5286: AA TAX C2/5287: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/5289: B9 18 30 LDA $3018,Y C2/528C: 0C 58 3A TSB $3A58 C2/528F: B9 E4 3E LDA $3EE4,Y C2/5292: 29 20 AND #$20 C2/5294: 85 EF STA $EF (if Imp status possessed, turn on Bit 5 of $EF. if not, the variable is set to 0.) C2/5296: B9 A4 3B LDA $3BA4,Y (weapon properties, right hand) C2/5299: 19 A5 3B ORA $3BA5,Y (merge with weapon properties, left hand) C2/529C: 49 FF EOR #$FF (invert) C2/529E: 29 82 AND #$82 C2/52A0: 04 EF TSB $EF (if neither hand supports Runic, set Bit 7. if neither hand supports SwdTech, set Bit 1.) C2/52A2: A9 04 LDA #$04 C2/52A4: 85 EE STA $EE (counter variable.. we're going to check 4 menu slots in all) C2/52A6: DA PHX (push address of character's current menu slot) C2/52A7: 38 SEC (mark menu slot to be disabled) C2/52A8: 7B TDC (clear 16-bit A) C2/52A9: BD 00 00 LDA $0000,X (get command # in current menu slot) C2/52AC: 30 2D BMI $52DB (branch if slot empty) C2/52AE: 48 PHA (push command #) C2/52AF: 18 CLC (mark menu slot to be enabled) C2/52B0: A5 EF LDA $EF C2/52B2: 89 20 BIT #$20 (are they an Imp?) C2/52B4: F0 0D BEQ $52C3 (branch if not) C2/52B6: A3 01 LDA $01,S C2/52B8: 0A ASL (command # * 2) C2/52B9: AA TAX C2/52BA: BF 00 FE CF LDA $CFFE00,X (table of command info) C2/52BE: 89 04 BIT #$04 (is command supported while Imped?) C2/52C0: D0 01 BNE $52C3 (branch if so) C2/52C2: 38 SEC (mark menu slot to be disabled) C2/52C3: 68 PLA (fetch command #) C2/52C4: B0 15 BCS $52DB (if menu slot is disabled at this point, don't bother with our next checks) (This next loop sees if our current command is one that needs special code to assess its menu availability -- graying it if unavailable -- or another property, such as its aiming. If so, a special function is called for the command.) C2/52C6: A2 07 00 LDX #$0007 C2/52C9: DF E9 52 C2 CMP $C252E9,X (does our current command match one whose menu availability or aiming can vary?) C2/52CD: D0 08 BNE $52D7 (if not, compare it to next command in table) C2/52CF: 8A TXA C2/52D0: 0A ASL C2/52D1: AA TAX C2/52D2: FC F1 52 JSR ($52F1,X) (call special function for command) C2/52D5: 80 04 BRA $52DB (we've gotten a match, so there's no need to compare our current command against rest of list) C2/52D7: CA DEX C2/52D8: 10 EF BPL $52C9 (there are 8 possible commands that need special checks) C2/52DA: 18 CLC (if there was no match, default to enabling the menu slot) C2/52DB: FA PLX C2/52DC: 7E 01 00 ROR $0001,X (2nd byte of current menu slot will have Bit 7 set if the slot should be grayed out and unavailable. iow, Carry = 1 -> grayed. Carry = 0 -> enabled.) C2/52DF: E8 INX C2/52E0: E8 INX C2/52E1: E8 INX (point to next slot in character's menu) C2/52E2: C6 EE DEC $EE C2/52E4: D0 C0 BNE $52A6 (repeat process for all 4 menu slots) C2/52E6: 28 PLP C2/52E7: FA PLX C2/52E8: 60 RTS (Data - commands that can potentially get grayed out on the menu in battle, or have a property like their aiming altered.) C2/52E9: 03 (Morph) C2/52EA: 0B (Runic) C2/52EB: 07 (SwdTech) C2/52EC: 0C (Lore) C2/52ED: 17 (X-Magic) C2/52EE: 02 (Magic) C2/52EF: 06 (Capture) C2/52F0: 00 (Fight) (Data - addresses of functions to check whether above command should be enabled, disabled, or otherwise modified on battle menu) C2/52F1: 26 53 (Morph) C2/52F3: 22 53 (Runic) C2/52F5: 1D 53 (SwdTech) C2/52F7: 14 53 (Lore) C2/52F9: 14 53 (X-Magic) C2/52FB: 14 53 (Magic) C2/52FD: 01 53 (Capture) C2/52FF: 01 53 (Fight) (For Capture and Fight menu slots) C2/5301: B9 58 3C LDA $3C58,Y (Check for offering) C2/5304: 4A LSR C2/5305: 90 0C BCC $5313 (Exit if no Offering) C2/5307: C2 21 REP #$21 (Set 16-bit Accumulator. Clear Carry to enable menu slot.) C2/5309: A3 03 LDA $03,S C2/530B: AA TAX (get address of character's current menu slot) C2/530C: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/530E: A9 4E LDA #$4E C2/5310: 9D 02 00 STA $0002,X (update aiming byte: Cursor start on enemy, Auto select one party, Auto select both parties [in this case, that means you'll target both enemy clumps in a Pincer], and One side only.) C2/5313: 60 RTS (For Lore, X-Magic, and Magic menu slots) C2/5314: B9 E5 3E LDA $3EE5,Y C2/5317: 89 08 BIT #$08 (is character Muted?) C2/5319: F0 01 BEQ $531C (branch if not) C2/531B: 38 SEC (if they are, mark menu slot to be disabled?) C2/531C: 60 RTS (For SwdTech menu slot) C2/531D: A5 EF LDA $EF C2/531F: 4A LSR C2/5320: 4A LSR (Carry = Bit 1, which was set in function C2/527D) C2/5321: 60 RTS (if it was set, menu slot will be disabled.. if it wasn't, slot is enabled) (For Runic menu slot) C2/5322: A5 EF LDA $EF C2/5324: 0A ASL (Carry = Bit 7, which was set in function C2/527D) C2/5325: 60 RTS (if it was set, menu slot will be disabled.. if it wasn't, slot is enabled) (For Morph menu slot) C2/5326: A9 0F LDA #$0F C2/5328: CD F6 1C CMP $1CF6 (compare to Morph supply) C2/532B: 60 RTS (if Morph supply isn't at least 16, menu slot will be disabled.. if it's >=16, slot is enabled) (Change character commands when wearing MagiTek armor or visiting Fanatics' Tower. Change commands based on relics, such as Fight becoming Jump, or Steal becoming Capture. Blank or retain certain