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 C24
< Final Fantasy VI | ROM map(Redirected from Final Fantasy VI:ROM map/Assembly C24)
Jump to navigation
Jump to search
This is a sub-page of Final Fantasy VI/ROM map.
C2/402C special effect: 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
C2/4044 special effect: 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
C2/404E special effect: warp effect
C2/404E: A5 B1 LDA $B1 C2/4050: 89 04 BIT #$04 (is "Can't Escape" flag set by an active enemy?) C2/4052: D0 06 BNE $405A (branch if so) 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)
C2/4061 special effect: bababreath
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 (Number of characters in party) 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
C2/4095 special effect: 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
C2/40A1 special effect: l? pearl
C2/40A1: AD 62 18 LDA $1862 (the following code will divide our 24-bit gold, held in $1860 - $1862, by 10.) 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 top 2 bytes of gold by 10. put quotient in A, and remainder in X.) C2/40AD: 8A TXA C2/40AE: EB XBA C2/40AF: AD 60 18 LDA $1860 (16-bit A = (above remainder * 256) + bottom byte of gold) C2/40B2: A2 0A LDX #$0A C2/40B4: 20 92 47 JSR $4792 (X = gold amount MOD 10, i.e. the ones digit of GP) C2/40B7: 8E A8 11 STX $11A8 (Save as Hit rate / level multiplier for LX spells) C2/40BA: 60 RTS
C2/40BB special effect: 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
C2/40C8 special effect: smoke bomb
C2/40C8: A9 04 LDA #$04 C2/40CA: 24 B1 BIT $B1 (is "Can't Escape" flag set by an active enemy?) C2/40CC: F0 EC BEQ $40BA (Exit if not) 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
C2/40DA special effect: force field
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
C2/40F1 special effect: four hits
Quadra Slam, Quadra Slice, etc. 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
C2/40FE special effect: 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
C2/410F special effect: 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 (Bitfield of targets) C2/4116: 20 2A 52 JSR $522A (A = a random target present in $A2) C2/4119: 20 F9 51 JSR $51F9 (Y = [Number of highest target set in A] * 2. so we're obtaining a target index.) C2/411C: A5 A2 LDA $A2 C2/411E: 20 0E 52 JSR $520E (X = number of bits set in A, so # of targets) 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, the number of targets) 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
C2/4136 special effect: elixir
(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
C2/413C special effect: 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
C2/414D special effect: n cross
(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 (random #: 0 to 255) C2/4150: 14 A4 TRB $A4 C2/4152: 20 5A 4B JSR $4B5A (random #: 0 to 255) C2/4155: 14 A5 TRB $A5 C2/4157: 60 RTS
C2/4158 special effect: dice
- set default flags
C2/4158 9C 14 34 STZ $3414 don't modify damage C2/415B A9 20 LDA #$20 C2/415D 0C A4 11 TSB $11A4 can't dodge C2/4160 A9 0F LDA #$0F C2/4162 85 B6 STA $B6 null third dice
- calculate first dice
C2/4164 7B TDC C2/4165 20 5A 4B JSR $4B5A A = [0, 255] C2/4168 48 PHA C2/4169 29 0F AND #$0F A = [0, 16] C2/416B A2 06 LDX #$06 X = 6 C2/416D 20 92 47 JSR $4792 A = (A / 6). X = A % 6 = [0,5].
- save first dice
C2/4170 86 B7 STX $B7 save first dice [0, 5] C2/4172 E8 INX C2/4173 86 EE STX $EE save first dice [1, 6]
- get second dice
C2/4175 68 PLA A = [0, 255] C2/4176 A2 60 LDX #$60 X = 0x60 (will divide top nibble of random number by 6) C2/4178 20 92 47 JSR $4792 A = A / X = A / 0x60 C2/417B 8A TXA A = A % X (mod of division) C2/417C 29 F0 AND #$F0 A = [0, 5], high 4 bits C2/417E 05 B7 ORA $B7 add first dice (low 4 bits) with second byte (high 4 bits) C2/4180 85 B7 STA $B7 save first and second dice (one byte)
- get second dice again
C2/4182 4A LSR C2/4183 4A LSR C2/4184 4A LSR C2/4185 4A LSR
- multiply first and second dice
C2/4186 1A INC second dice = [1, 6] C2/4187 EB XBA C2/4188 A5 EE LDA $EE first dice = [1,6] C2/418A 20 81 47 JSR $4781 multiply first and second dice C2/418D 85 EE STA $EE save it
- select two or three dices
C2/418F AD A8 11 LDA $11A8 number of dices C2/4192 C9 03 CMP #$03 C2/4194 90 15 BCC $41AB two dices
- calculate third dice
C2/4196 7B TDC A = 0 C2/4197 AD 1E 02 LDA $021E A = random number generator (frame counter?) C2/419A A2 06 LDX #$06 X = 6 C2/419C 20 92 47 JSR $4792 Division: A = (A / X). X = (A % X) C2/419F 8A TXA A = [0, 5] C2/41A0 85 B6 STA $B6 save third dice [0, 5] C2/41A2 1A INC A = [1, 6]
- multiply: first*second*third dice
C2/41A3 EB XBA C2/41A4 A5 EE LDA $EE 1st * 2nd dice C2/41A6 20 81 47 JSR $4781 A = 1st * 2nd * 3rd dice C2/41A9 85 EE STA $EE save it
- check bonus for similar dice numbers?
C2/41AB A2 00 LDX #$00 C2/41AD A5 B6 LDA $B6 0x0F if not 3th dice. Otherwise, it is [0,5]. C2/41AF 0A ASL C2/41B0 0A ASL C2/41B1 0A ASL C2/41B2 0A ASL C2/41B3 05 B6 ORA $B6 C2/41B5 C5 B7 CMP $B7 does it match 1st or end dice? C2/41B7 D0 02 BNE $41BB no match C2/41B9 A6 B6 LDX $B6 X = bonus flag.
- calculate damage based on dices
C2/41BB A5 EE LDA $EE A = 1st * 2nd or A = 1st * 2nd * 3rd dice C2/41BD EB XBA C2/41BE AD AF 11 LDA $11AF character level C2/41C1 0A ASL level = level * 2 C2/41C2 20 81 47 JSR $4781 C = (1st dice * 2nd dice * 3rd roll) * (Level * 2) C2/41C5 C2 20 REP #$20 set C register C2/41C7 85 EE STA $EE save damage C2/41C9 18 CLC C2/41CA 8D B0 11 STA $11B0 save damage
- increase damage
C2/41CD A5 EE LDA $EE damage C2/41CF 6D B0 11 ADC $11B0 increase actual damage with original damage C2/41D2 90 02 BCC $41D6 branch if it didn't overflow C2/41D4 7B TDC C2/41D5 3A DEC set maximum damage if overflow
- add damage based on bonus
C2/41D6 CA DEX bonus for similar dice numbers C2/41D7 10 F0 BPL $41C9 multiply the original damage X times
- adjust animation
C2/41D9 E2 20 SEP #$20 set A register C2/41DB A5 B5 LDA $B5 command C2/41DD C9 00 CMP #$00 is it fight? C2/41DF D0 02 BNE $41E3 don't change animation if it isn't fight C2/41E1 A9 26 LDA #$26 dice command C2/41E3 85 B5 STA $B5 store dice case as a special command for animation C2/41E5 60 RTS
C2/41E6 special effect: 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
C2/41F6 special effect: palidor
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 (branch if any set) 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 (branch if none set) 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
C2/421B special effect: 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
C2/4234 special effect: 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 (mark attacker to be removed from the battlefield?) 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
C2/424B special effect: 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 (whom you are Seizing) C2/4256: 30 F2 BMI $424A (Exit if not Seizing anybody) 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
C2/4263 special effect: 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
C2/4280 special effect: damage = damage / 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
C2/428B special effect: suplex
(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
C2/42B7 special effect: 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
C2/42CA special effect: 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
C2/42E1 pointers: special effects table
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
C2/4391 set new status to 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 "statuses to clear" below takes place later than the removal of blocked statuses from "statuses 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 to which we're immune.) 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
C2/4406 status update when attack hits
(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
C2/447F 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
C2/4490 initialize intermediary status to set or to clear
(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
C2/44D1 pointers: unknow
C2/44D1: D7 44 C2/44D3: EA 44 C2/44D5: F9 44
C2/44D7 add status for spells: to set
(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
C2/44EA add status for spells: to clear
(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
C2/44F9 add status for spells: to toggle
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)
C2/44FF clear status to set
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
C2/450D unknow
(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
C2/4585 update new status
(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 unknow
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
C2/45A3 status 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
C2/45AE status zombie: clear
C2/45AE: 20 9C 46 JSR $469C C2/45B1: 80 0E BRA $45C1
C2/45B3 status muddle: set
C2/45B3: B9 18 30 LDA $3018,Y C2/45B6: 0C 53 2F TSB $2F53 C2/45B9: 80 06 BRA $45C1
C2/45BB status 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 unknow
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 unknow
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
C2/45DF status 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 (flag character's properties to be recalculated from his/her equipment at end of turn.) C2/45F0: FA PLX C2/45F1: 60 RTS
C2/45F2 unknow
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
C2/4600 status 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)
C2/460B status 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 (clear HP Leak quasi-status that was set by Phantasm) 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
C2/4634 status 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
C2/463F status 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
C2/4653 status 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
C2/465D status seizure: set
C2/465D: A9 02 00 LDA #$0002 C2/4660: 04 F6 TSB $F6 (mark Regen to be cleared) C2/4662: 60 RTS
C2/4663 status regen: set
C2/4663: A9 00 40 LDA #$4000 C2/4666: 04 F4 TSB $F4 (mark Seizure to be cleared) C2/4668: 60 RTS
C2/4669 status slow: set
C2/4669: A9 08 00 LDA #$0008 C2/466C: 80 03 BRA $4671 (mark Haste to be cleared)
C2/466E status 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 ???)
C2/4678 status morph: set or clear
C2/4678: A9 02 00 LDA #$0002 C2/467B: 80 CF BRA $464C
C2/467D status 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
C2/4687 status 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
C2/4691 status 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
C2/469B multiple status: do nothing
(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 unknow
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 unknow
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
C2/46B0 pointers: table for setting 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)
C2/46F0 pointers: table for clearing status
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)
C2/4730 unknow
??? 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
C2/474B pointers: unknow
C2/474B: 4F 47 C2/474D: 78 47
C2/474F unknow
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 unknow
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
C2/4781 math: 16-bit A = low byte A * high byte A
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
C2/4792 division function
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
C2/47B7 multiplication function
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
C2/47D6 math: A = A * 1.5
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 remove character from party
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 unknow
C2/47ED: AD E0 3E LDA $3EE0 C2/47F0: F0 09 BEQ $47FB (branch if in 4-tier final multi-battle) 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 unknow
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 (branch if Gau not in party. note that "in party" can mean Gau's actively in the party, or that he's Leapt on the Veldt, you're fighting on the Veldt, and there's a free spot in your party for him to return.) 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 set) 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
C2/4897 warp stone effect?
(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
C2/48A6 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 (turn on "No Winning Stand" aka "No victory dance" in extra formation data. this bit is checked at C1/0124.) 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
C2/48CE Gau arrives after Veldt battle
(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
C2/48E0 gau leapt
(Gau leapt) C2/48E0: AE 0B 30 LDX $300B (which character is Gau) C2/48E3: 20 E3 47 JSR $47E3 C2/48E6: A9 08 LDA #$08 C2/48E8: 1C DF 1E TRB $1EDF (remove Gau from party) ( 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
C2/48F0 Banon fell
(Banon fell) C2/48F0: A9 36 LDA #$36 C2/48F2: 20 CA 5F JSR $5FCA C2/48F5: 80 98 BRA $488F
C2/48F7 pointers: special combat endings
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 unknow
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 unknow
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 (was this character flagged to be removed from party? [by Possessing or getting hit by BabaBreath]) C2/4952: F0 03 BEQ $4957 (branch if not) 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 (Move bit 8 of formation # into Carry and out of A) C2/49F2: D0 12 BNE $4A06 (If any of bits 9-15 were set, the formation # is over 511. skip it.) C2/49F4: AD D4 3E LDA $3ED4 (Get bits 0-7 of 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
C2/4A07 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 unknow
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 unknow
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 (is Battle formation one of the first 3 tiers of the final 4-tier multi-battle?) C2/4A81: D0 14 BNE $4A97 (branch and check another if no match) C2/4A83: BF AD 4A C2 LDA $C24AAD,X C2/4A87: 8D E0 11 STA $11E0 (update Battle formation to the next one of the tiers) 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 (clear caller address from stack?) C2/4A95: 80 8B BRA $4A22 (.. this will result in us returning somewhere other than C2/483D) C2/4A97: CA DEX C2/4A98: CA DEX C2/4A99: 10 DF BPL $4A7A (loop 3 times) C2/4A9B: E2 20 SEP #$20 C2/4A9D: 60 RTS (return normally)
C2/4A9E clear 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
C2/4AAB data: last battle formations
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 unknow
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 Number of characters in party 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
C2/4B53 random number generator: 0 or 1
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
C2/4B5A random number generator: [0, 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
C2/4B65 random number generator: [0, A - 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 unknow
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 unknow
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 unknow
C2/4C54: DA PHX C2/4C55: E8 INX C2/4C56: 20 01 03 JSR $0301 C2/4C59: FA PLX C2/4C5A: 60 RTS
C2/4C5B counter attacks
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 (did attack have X-Zone/Odin/Snare special effect, or Air Anchor special effect?) C2/4C66: F0 56 BEQ $4CBE (branch and skip counter if so) 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 (Set 8-bit accumulator) 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, or if targeting yourself) C2/4C9D: BD 69 32 LDA $3269,X (top byte of offset to monster's counterattack script) C2/4CA0: 30 0F BMI $4CB1 (branch if it has no counterattack script) 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 (Set command to #$1F (counter attack)) 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 [or Dog Block counter, or Black Belt 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
C2/4CC3 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
C2/4CD6 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 (was this target protected by a Dog block on this turn? [or if it's a multi-strike attack and Interceptor status was hacked onto multiple characters, then was this target the most recently protected on the turn?]) C2/4CDD: D0 15 BNE $4CF4 (if target wasn't protected by a dog block, branch to Black Belt) C2/4CDF: 20 5A 4B JSR $4B5A (random: 0 to 255) C2/4CE2: 4A LSR C2/4CE3: 90 0F BCC $4CF4 (50% chance branch to Black Belt) C2/4CE5: 4A LSR (Carry will determine which Interceptor counterattack is used: 50% chance of each) 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 (Store Magic in command) C2/4CF1: 4C B2 4E JMP $4EB2
C2/4CF4 black belt counter
C2/4CF4: BD 18 30 LDA $3018,X C2/4CF7: 2C 19 34 BIT $3419 (was this target damaged [by an attacker other than themselves] this turn? the target's bit will be 0 in $3419 if they were.) C2/4CFA: D0 C6 BNE $4CC2 (Exit if they weren't) 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 (Store Fight in command) C2/4D19: 9C 7B 3A STZ $3A7B C2/4D1C: 4C B2 4E JMP $4EB2
C2/4D1F unknow
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 unknow
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
C2/4DD7 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 unknow
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
C2/4E3C data: commands for spell calculation
(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)
C2/4E41 data: first spell for commands at C2/4E3C
(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)
C2/4E46 data: commands that need to retarget
(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)
C2/4E4A 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)
C2/4E52 data: joker doom targeting
(Data - Joker Doom targeting) C2/4E52: 0F (7-7-bar => your whole party) C2/4E53: 3F (7-7-7 => whole enemy party)
C2/4E54 unknow
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 add fighter to wait queue
(Add character/monster to queue of who will wait to act. One place this is called is right after a character's command is input, and before they enter their "ready stance". Monsters' ready stances aren't visible [and are generally negligible in length], but monsters still use this queue too.) C2/4E66: 8A TXA C2/4E67: DA PHX C2/4E68: AE 65 3A LDX $3A65 (get next available Wait Queue slot) C2/4E6B: 9D 20 37 STA $3720,X (store current entity in that slot) C2/4E6E: FA PLX C2/4E6F: EE 65 3A INC $3A65 (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/4E72: A9 FE LDA #$FE C2/4E74: 4C 43 0A JMP $0A43
C2/4E77 add fighter to queue of next attacker
(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 Action 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 unknow
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 unknow
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 unknow
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 unknow
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
C2/4F08 determinate mp cost of spell
(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
C2/4F57 monster command script: F7
C2/4F57: A5 B6 LDA $B6 C2/4F59: EB XBA C2/4F5A: A9 0F LDA #$0F C2/4F5C: 4C BF 62 JMP $62BF
C2/4F5F command 26
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 (set flag to zero and disable the Condemned counter after turn. this is done in case instant death is thwarted, and thus Condemned status isn't removed and C2/4644 never executes.) 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
C2/4F97 monster command script 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 unknow
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 unknow
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 unknow
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