If you are still using the old URL (datacrystal.romhacking.net), please update your bookmarks! The old URL may stop working soon.
The current URL is datacrystal.tcrf.net.
The current URL is datacrystal.tcrf.net.
Final Fantasy VI/ROM map/Assembly C21
< Final Fantasy VI | ROM map
Jump to navigation
Jump to search
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 any of bits 6, 5, 4, or 2 are set in $3AA0,X , branch to next target) C2/115A: 89 04 BIT #$04 C2/115C: F0 1E BEQ $117C (If bit 3 isn't set in $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 not 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 (save updated timer) 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 (zero top byte of ATB Timer) C2/11D4: 9E B5 3A STZ $3AB5,X (zero top of of Wait Timer) 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 ($3359 = who is Seizing you) 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,Y (bit representing target) (was typoed as "LDA $3018,X") C2/1281: 1D 18 30 ORA $3018,X (bit representing attacker) C2/1284: 14 F0 TRB $F0 (Clear attacker and target 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 for True Knight or Love Token) 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 ($32B9 = who is Controlling you) C2/12CC: 10 25 BPL $12F3 (Exit if you're controlled) C2/12CE: BD 58 33 LDA $3358,X ($3359 = who is Seizing you) C2/12D1: 10 20 BPL $12F3 (Exit if you're 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 (Do HP or MP Damage/Healing to an entity) 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 and/or healing) C2/1303: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/1305: 90 15 BCC $131C (Branch if no damage done to target, or if healing done on same strike matched or exceeded damage) C2/1307: A3 02 LDA $02,S (get attacker?) C2/1309: AA TAX (save in X) C2/130A: 86 EE STX $EE (and in a RAM variable, too) C2/130C: 20 2F 36 JSR $362F C2/130F: C4 EE CPY $EE (does target == attacker?) C2/1311: F0 09 BEQ $131C (branch if so) C2/1313: 99 7C 32 STA $327C,Y (save attacker in byte that's used by FC 05 script command) C2/1316: B9 18 30 LDA $3018,Y C2/1319: 1C 19 34 TRB $3419 (indicate target as being damaged [by an attacker other than themselves] this turn. will be used by Black Belt function.) 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 (Returns in Carry: Set if damage done to target, and damage exceeds any healing done on same strike. Clear if damage not done to target, or if healing done on same strike matches or exceeds it.) 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 (Returns in Carry: Set if damage done to target, and damage exceeds any healing done on same strike. Clear if damage not done to target, or if healing done on same strike matches or exceeds it.) 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 ($3410 - $341F = FFh) 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 update dead/petrify status C2/140C: 20 5B 4C JSR $4C5B check for counter-attack 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 (branch if Umaro) 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 (Magic command enters here) 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 (branch if command is not Slot) 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, treat 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 opposed 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 Damage 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 (flag character to have any applicable item in $32F4,X added back to inventory when turn is over.) 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 (get item #) 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 (Characters that are alive and present) 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 (get spell #) C2/18EC: 85 B6 STA $B6 C2/18EE: 64 BD STZ $BD (if we reached here for Throw, it's for a Skean casting magic, so zero out the Damage Increment given by the Throw command.) 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 Defend C2/196A: BB TYX C2/196B: A9 02 LDA #$02 C2/196D: 20 AB 5B JSR $5BAB (set Defending flag) 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) (Enemy Roulette) 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, up through an FEh or FFh command C2/1A43: 7B TDC C2/1A44: BF 00 87 CF LDA $CF8700,X (read first byte of command) 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 (subtract F0h) C2/1A4F: 90 F3 BCC $1A44 (Branch if not a control command) C2/1A51: DA PHX C2/1A52: AA TAX C2/1A53: BF AF 1D C2 LDA $C21DAF,X (# of bytes in the control command) C2/1A57: FA PLX C2/1A58: CA DEX C2/1A59: E8 INX C2/1A5A: 3A DEC C2/1A5B: D0 FC BNE $1A59 (loop through the whole command to reach the next one) C2/1A5D: 80 E5 BRA $1A44 (go read the first byte of next command) 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 (get script position to start reading from) C2/1AA5: 20 43 1A JSR $1A43 (Read command script, up through an FEh or FFh command) C2/1AA8: 1A INC C2/1AA9: F0 D0 BEQ $1A7B (branch if FFh command was last thing read) C2/1AAB: 86 F0 STX $F0 (save script position of next command) 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 (compare the first one to FCh) C2/1ABD: B0 11 BCS $1AD0 (Branch if FD or FE or FFh) 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 (A = 0) 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 (if not control command, it'll be 1 byte long) C2/1ADC: AA TAX C2/1ADD: BF AF 1D C2 LDA $C21DAF,X (# of bytes in the command) C2/1AE1: AA TAX C2/1AE2: C8 INY C2/1AE3: CA DEX C2/1AE4: D0 FC BNE $1AE2 (loop, advancing Y by size of command) C2/1AE6: 84 F0 STY $F0 (save updated script position) 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 (get $3290 or $3291 or $32A4, depending on where we entered function.) C2/1C44: 30 0D BMI $1C53 C2/1C46: BD 48 3D LDA $3D48,X (get $3D48 or $3D49 or $3D5C, depending on where we entered function.) 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.) C2/1C65: 30 08 BMI $1C6F C2/1C67: BD 48 3D LDA $3D48,X (get attack's element(s). accessed as $3D5D in C2/35E3.) 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) (specifically, this variable is the number of unique enemy names still active in battle. it's capped at 4, since it's based on the enemy list on the bottom left of the screen in battle, but that limitation doesn't matter since we're only comparing it to #$01 here.) 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 (if first byte of FC command is 0, set it to current monster) 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 (if first byte of FC command is 0, set it to current monster) C2/1CE9: AD 73 3A LDA $3A73 (bitfield of monsters in formation) 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 (Number of characters in party) 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 Sets bit #X in A (C2/1E57 and this are identical) 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) (If first byte of FC command is 0, set it to current monster.) 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/1D2D and this are identical) 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 command #$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) (44) 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 (randomly 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 (set 8-bit Accumulator, and set Carry) 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 (get last entity to attack monster. 0-9 indicates a valid previous attacker. 7Fh indicates no previous attacker.) C2/2002: C9 0A CMP #$0A C2/2004: B0 8D BCS $1F93 (branch if no previous attacker) C2/2006: 0A ASL C2/2007: AA TAX (turn our 0-9 index into the more common 0,2,4,6,8,10,12,14,16,18 index used to address battle entities.) 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