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 C23
< Final Fantasy VI | ROM map
Jump to navigation
Jump to search
C2/30DC unknow
C2/30DC: 98 TYA C2/30DD: EB XBA C2/30DE: A9 25 LDA #$25 (multiple by 37 bytes, size of character block) C2/30E0: 20 81 47 JSR $4781 C2/30E3: A8 TAY C2/30E4: B9 00 16 LDA $1600,Y (sprite? actual # of character?) C2/30E7: 60 RTS
C2/30E8 loads battle formation data
C2/30E8: 08 PHP C2/30E9: C2 30 REP #$30 (Set 16-bit A, X, & Y) C2/30EB: AD B9 3E LDA $3EB9 C2/30EE: 85 EE STA $EE C2/30F0: A2 1C 00 LDX #$001C C2/30F3: A5 EE LDA $EE C2/30F5: 10 10 BPL $3107 C2/30F7: BF 80 37 CF LDA $CF3780,X C2/30FB: CD E0 11 CMP $11E0 C2/30FE: D0 07 BNE $3107 (If Battle formation is not 1C4 (SrBehemoth)) C2/3100: BF 82 37 CF LDA $CF3782,X C2/3104: 8D E0 11 STA $11E0 (Change Battle formation to 1A8 (SrBehemoth undead)) C2/3107: 06 EE ASL $EE C2/3109: CA DEX C2/310A: CA DEX C2/310B: CA DEX C2/310C: CA DEX C2/310D: 10 E4 BPL $30F3 C2/310F: A9 00 80 LDA #$8000 C2/3112: 1C E0 11 TRB $11E0 (Clear highest bit of battle formation) C2/3115: F0 10 BEQ $3127 (Branch if not rand w/ next 3) C2/3117: E2 30 SEP #$30 C2/3119: 7B TDC C2/311A: 20 5A 4B JSR $4B5A (0 to 255) C2/311D: 29 03 AND #$03 (0 to 3) C2/311F: C2 31 REP #$31 (set 16-bit A, X and Y. clear Carry) C2/3121: 6D E0 11 ADC $11E0 C2/3124: 8D E0 11 STA $11E0 (Add 0 to 3 to battle formation) C2/3127: AD D4 3E LDA $3ED4 C2/312A: 0A ASL C2/312B: AD E0 11 LDA $11E0 (Battle formation) C2/312E: 90 03 BCC $3133 (If highest bit of Battle formation not set) C2/3130: 8D D4 3E STA $3ED4 C2/3133: 0A ASL C2/3134: 0A ASL C2/3135: AA TAX C2/3136: BF 02 59 CF LDA $CF5902,X (bytes 2-3 of extra enemy formation data) C2/313A: 8D 4A 2F STA $2F4A C2/313D: BF 00 59 CF LDA $CF5900,X (bytes 0-1 of extra enemy formation data) C2/3141: 49 F0 00 EOR #$00F0 (invert the top nibble of byte 0, which contains the attack formations masked -- Front, Back, Pincer, Side) C2/3143: 8D 48 2F STA $2F48 C2/3147: AD E0 11 LDA $11E0 C2/314A: 0A ASL C2/314B: 0A ASL C2/314C: 0A ASL C2/314D: 0A ASL C2/314E: 38 SEC C2/314F: ED E0 11 SBC $11E0 (A = Monster formation * 15) C2/3152: AA TAX C2/3153: 7B TDC C2/3154: A8 TAY C2/3155: BF 00 62 CF LDA $CF6200,X (Load Battle formation data) C2/3159: 99 44 3F STA $3F44,Y C2/315C: E8 INX C2/315D: E8 INX C2/315E: C8 INY C2/315F: C8 INY C2/3160: C0 10 00 CPY #$0010 C2/3163: 90 F0 BCC $3155 C2/3165: 28 PLP C2/3166: 60 RTS
C2/3167 unknow
C2/3167: A9 80 LDA #$80 C2/3169: 14 B3 TRB $B3 (Set Ignore Clear) C2/316B: A9 0C LDA #$0C C2/316D: 04 BA TSB $BA (Sets Can target dead/hidden entities, and Don't retarget if target invalid) C2/316F: 9C 1B 34 STZ $341B C2/3172: C2 20 REP #$20 C2/3174: BD 18 30 LDA $3018,X C2/3177: 85 B8 STA $B8 (Sets attacker as target) C2/3179: E2 20 SEP #$20
C2/317B character executes one hit
Character Executes One Hit (Loops for Multiple-Strike Attack) C2/317B: DA PHX C2/317C: A5 BD LDA $BD C2/317E: 85 BC STA $BC (Damage increment) C2/3180: A9 FF LDA #$FF C2/3182: 8D 82 3A STA $3A82 (Null Golem block) C2/3185: 8D 83 3A STA $3A83 (Null Dog block) C2/3188: AD 00 34 LDA $3400 (Spell # for a second attack. Used by the Magicite item, weapons with normal addition magic [Flame Sabre, Pearl Lance, etc], and Tempest. Sketch also sets $3400, but the variable is swapped into $B6 by the Sketch command (C2/151F) rather than by this routine. Thus, $3400 will always be null at this point for Sketch.) C2/318B: 1A INC C2/318C: D0 25 BNE $31B3 (Branch if there is a spell [i.e. the spell # is not FFh]) C2/318E: AD 13 34 LDA $3413 (If Fight or Capture command, holds command number. [Note that Rage's Battle and Special also qualify as "Fight".] That way, if a spell is cast by a weapon for one strike (which will overwrite the command # and attack data), we'll be able to continue with the Fight/Capture command and use the weapon as normal on the next strike. If command isn't Fight or Capture, this holds FFh. ) C2/3191: 30 20 BMI $31B3 (branch if negative) C2/3193: 85 B5 STA $B5 (Restore command #) C2/3195: 20 D3 26 JSR $26D3 (Load command data and data of "Battle" spell) C2/3198: AD 70 3A LDA $3A70 (# of extra attacks - set by Quadra Slam, Dragon Horn, Offering, etc) C2/319B: 1A INC (add one. even number will check right hand, odd number the left. so in a Genji Glove+Offering sequence, for instance, we'd have: 8 = Right, 7 = Left, 6 = Right, 5 = Left, 4 = Right, 3 = Left, 2 = Right, then 1 = Left) C2/319C: 4A LSR (put bottommost bit of # attacks in carry flag) C2/319D: 20 9F 29 JSR $299F (Load weapon data into attack data. Plus Sniper Sight, Offering and more) C2/31A0: AD A6 11 LDA $11A6 C2/31A3: D0 03 BNE $31A8 C2/31A5: 4C 75 32 JMP $3275 (branch if zero battle power, which can result from a hand without a weapon, among other things. Fight/Capture set the strike quantity to 2 -- or 8 if you have Offering -- regardless of whether you have Genji Glove. thus, when there's only 1 attack hand, this branch is what skips all the even or odd strikes corresponding to the other hand.) C2/31A8: A5 B5 LDA $B5 C2/31AA: C9 06 CMP #$06 C2/31AC: D0 05 BNE $31B3 (branch if command isn't Capture) C2/31AE: A9 A4 LDA #$A4 (Causes attack to also steal) C2/31B0: 8D A9 11 STA $11A9 (save special effect) C2/31B3: 20 EB 37 JSR $37EB (Set up weapon addition magic, Tempest's Wind Slash, and Espers summoned by the Magicite item) C2/31B6: A9 20 LDA #$20 C2/31B8: 14 B2 TRB $B2 (Bit 5 is set to begin a turn) C2/31BA: F0 05 BEQ $31C1 (branch if it was already clear -- in other words, if we're on the second strike or later of this turn.) C2/31BC: 2C A3 11 BIT $11A3 C2/31BF: D0 04 BNE $31C5 (Branch if Retarget if target invalid/dead) C2/31C1: A9 04 LDA #$04 C2/31C3: 04 BA TSB $BA (NOTE: in $BA, the bit now means *Don't* retarget if target dead/invalid) (To recap the above: if we're on the 1st strike, "Don't Retarget if no valid targets" will depend on the attack stats. If we're on a later strike, it always gets set. This explains why Genji Glove's [sans Offering] second strike will always smack the initial target, even if the first one killed it. However, most multi-strike attacks -- Offering, Dragon Horn, and Quadra Slam/Slice -- set "Randomize Target", which makes you retarget anyway.) C2/31C5: A5 B8 LDA $B8 C2/31C7: 05 B9 ORA $B9 C2/31C9: D0 08 BNE $31D3 (branch if at least one target exists) C2/31CB: A9 04 LDA #$04 C2/31CD: 24 B3 BIT $B3 C2/31CF: F0 02 BEQ $31D3 C2/31D1: 14 BA TRB $BA (clear "Don't retarget if target invalid".. iow, retarget if target invalid) C2/31D3: AD 15 34 LDA $3415 (will be zero for: the attack performed via Sketch, Umaro's Blizzard, Runic, Tempest's Wind Slash, and Espers summoned with the Magicite item) C2/31D6: 30 04 BMI $31DC (otherwise, it's FFh, so branch.) C2/31D8: A9 40 LDA #$40 C2/31DA: 04 BA TSB $BA (Set randomize targets) C2/31DC: A5 B3 LDA $B3 C2/31DE: 4A LSR C2/31DF: B0 08 BCS $31E9 (branch if Bit 0 of $B3 set. to my knowledge, it's only UNset by a failed Blitz input.) C2/31E1: A9 04 LDA #$04 C2/31E3: 04 BA TSB $BA (set Don't retarget if target invalid) C2/31E5: 64 B8 STZ $B8 C2/31E7: 64 B9 STZ $B9 (clear targets) C2/31E9: 20 66 36 JSR $3666 C2/31EC: AD 17 34 LDA $3417 C2/31EF: 30 01 BMI $31F2 (branch if Sketcher is null) C2/31F1: AA TAX (use Sketcher as attacker) C2/31F2: AD 7C 3A LDA $3A7C C2/31F5: C9 1E CMP #$1E (is command Enemy Roulette?) C2/31F7: D0 08 BNE $3201 (branch if not) C2/31F9: 64 B8 STZ $B8 C2/31FB: 64 B9 STZ $B9 (clear targets) C2/31FD: A9 04 LDA #$04 C2/31FF: 85 BA STA $BA (Don't retarget if target invalid) C2/3201: AD A5 11 LDA $11A5 C2/3204: F0 1F BEQ $3225 (If 0 MP cost) C2/3206: BD E5 3E LDA $3EE5,X C2/3209: 89 08 BIT #$08 C2/320B: D0 0E BNE $321B (Branch if Mute) C2/320D: BD E4 3E LDA $3EE4,X C2/3210: 89 20 BIT #$20 (Check for Imp status) C2/3212: F0 11 BEQ $3225 (Branch if not ^) C2/3214: AD 10 34 LDA $3410 C2/3217: C9 23 CMP #$23 C2/3219: F0 0A BEQ $3225 (Branch if spell is Imp?) C2/321B: 8A TXA C2/321C: 4A LSR C2/321D: EB XBA C2/321E: A9 0E LDA #$0E C2/3220: 20 BF 62 JSR $62BF C2/3223: 80 50 BRA $3275 C2/3225: 20 2B 35 JSR $352B (Runic function) C2/3228: 20 38 38 JSR $3838 (Check Air Anchor action death) C2/322B: 20 9D 2B JSR $2B9D (Damage Calculation) C2/322E: 20 4A 0D JSR $0D4A (Atlas Armlet / Earring) C2/3231: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3233: 20 92 32 JSR $3292 C2/3236: AD A2 11 LDA $11A2 C2/3239: 4A LSR C2/323A: B0 07 BCS $3243 (Branch if physical attack) C2/323C: A5 A6 LDA $A6 (Reflected spell or Launcher/Super Ball special effect?) C2/323E: F0 03 BEQ $3243 (branch if not) C2/3240: 20 83 34 JSR $3483 (Super Ball, Launcher, and Reflected spells function) C2/3243: AD 30 3A LDA $3A30 C2/3246: 85 B8 STA $B8 C2/3248: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/324A: 20 91 43 JSR $4391 (update statuses for everybody onscreen) C2/324D: 20 3E 36 JSR $363E (handle random addition magic for weapons, in preparation for next strike) C2/3250: AD 01 34 LDA $3401 C2/3253: C9 FF CMP #$FF (is there text to display for the command or attack?) C2/3255: F0 0B BEQ $3262 (branch if not) C2/3257: EB XBA C2/3258: A9 02 LDA #$02 C2/325A: 20 BF 62 JSR $62BF (queue display of text?) C2/325D: A9 FF LDA #$FF C2/325F: 8D 01 34 STA $3401 (no more text to display) C2/3262: AD A7 11 LDA $11A7 C2/3265: 89 02 BIT #$02 C2/3267: F0 0C BEQ $3275 (if there's no text if spell hits, branch) C2/3269: E0 08 CPX #$08 C2/326B: 90 08 BCC $3275 (if attacker isn't monster, branch) C2/326D: A5 B6 LDA $B6 (get attack/spell #) C2/326F: EB XBA C2/3270: A9 02 LDA #$02 C2/3272: 20 BF 62 JSR $62BF (queue display of text for spell that hit) C2/3275: A9 FF LDA #$FF C2/3277: 8D 14 34 STA $3414 (clear Ignore Damage Modification) C2/327A: 8D 15 34 STA $3415 C2/327D: 8D 1C 34 STA $341C C2/3280: AD 83 3A LDA $3A83 (get Dog block) C2/3283: 30 03 BMI $3288 (if it didn't occur, branch) C2/3285: 8D 16 34 STA $3416 (save backup of who benefitted from Dog block as $3A83 will be nulled on next strike should it be a multi-strike attack.) C2/3288: FA PLX C2/3289: CE 70 3A DEC $3A70 (# more attacks set by Offering, Quadra Slam, Dragon Horn, etc) C2/328C: 30 03 BMI $3291 (if it's negative, there's no more, so exit) C2/328E: F4 7A 31 PEA $317A (if there are more, repeat this $317B function) C2/3291: 60 RTS C2/3292: 9C 5A 3A STZ $3A5A C2/3295: 9C 54 3A STZ $3A54 C2/3298: 20 00 64 JSR $6400 (Zero $A0 through $AF) C2/329B: 20 7E 58 JSR $587E (targeting function) C2/329E: DA PHX C2/329F: A5 B8 LDA $B8 (load targets) C2/32A1: 20 0E 52 JSR $520E (Number of bits set in A) C2/32A4: 8E C9 3E STX $3EC9 (# of targets) C2/32A7: FA PLX C2/32A8: 20 3B 12 JSR $123B (True Knight and Love Token) C2/32AB: 20 C2 57 JSR $57C2 C2/32AE: 20 65 38 JSR $3865 C2/32B1: AD 4C 3A LDA $3A4C (actual MP cost to caster) C2/32B4: F0 36 BEQ $32EC (if there is none, skip these affordability checks) C2/32B6: 38 SEC (set Carry for upcoming subtraction) C2/32B7: BD 08 3C LDA $3C08,X (attacker MP) C2/32BA: ED 4C 3A SBC $3A4C (MP cost to attacker) C2/32BD: 9C 4C 3A STZ $3A4C (clear MP cost) C2/32C0: B0 1E BCS $32E0 (branch if attacker had sufficient MP) C2/32C2: E0 08 CPX #$08 C2/32C4: 90 04 BCC $32CA (branch if character) C2/32C6: A0 12 LDY #$12 C2/32C8: 84 B5 STY $B5 C2/32CA: 20 AD 35 JSR $35AD C2/32CD: 64 A2 STZ $A2 C2/32CF: 64 A4 STZ $A4 C2/32D1: A9 02 00 LDA #$0002 C2/32D4: 1C A7 11 TRB $11A7 (clear Text if Hits bit) C2/32D7: A9 02 28 LDA #$2802 C2/32DA: 20 9B 62 JSR $629B (Copy $3A28-$3A2B variables into ($76) buffer) C2/32DD: 4C DB 63 JMP $63DB (Copy $An variables to ($78) buffer) C2/32E0: 9D 08 3C STA $3C08,X (attacker MP = attacker MP - spell MP cost) C2/32E3: A9 80 00 LDA #$0080 C2/32E6: 1D 04 32 ORA $3204,X C2/32E9: 9D 04 32 STA $3204,X C2/32EC: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/32EE: AD 12 34 LDA $3412 C2/32F1: C9 06 CMP #$06 C2/32F3: D0 5A BNE $334F C2/32F5: DA PHX C2/32F6: A9 02 LDA #$02 C2/32F8: 04 B2 TSB $B2 (Set no critical & ignore True Knight) C2/32FA: 4A LSR C2/32FB: 04 A0 TSB $A0 C2/32FD: BD 81 3C LDA $3C81,X C2/3300: 85 B7 STA $B7 C2/3302: BD 2D 32 LDA $322D,X (get monster's special attack) C2/3305: 48 PHA C2/3306: 0A ASL (is bit 6, "Do no damage," set?) C2/3307: 10 08 BPL $3311 (if it isn't, branch) C2/3309: 9C A6 11 STZ $11A6 (clear Battle Power) C2/330C: A9 01 LDA #$01 C2/330E: 0C A7 11 TSB $11A7 (set to "Miss if No Status Set or Clear") C2/3311: 90 05 BCC $3318 (branch if Bit 7 wasn't set) C2/3313: A9 20 LDA #$20 C2/3315: 0C A4 11 TSB $11A4 (set Can't be Dodged) C2/3318: 68 PLA C2/3319: 29 3F AND #$3F (get bottom 6 bits of monster's special attack) C2/331B: C9 30 CMP #$30 C2/331D: 90 1A BCC $3339 (branch if value < 30h, "Absorb HP") C2/331F: C9 32 CMP #$32 C2/3321: B0 0F BCS $3332 (branch if value > 31h, "Absorb MP") C2/3323: 4A LSR (get bottom bit) C2/3324: A9 02 LDA #$02 C2/3326: 0C A4 11 TSB $11A4 (turn on Redirection bit of spell) C2/3329: 90 23 BCC $334E (branch if bottom bit of attack byte was 0) C2/332B: A9 80 LDA #$80 C2/332D: 0C A3 11 TSB $11A3 (Set to Concern MP) C2/3330: 80 1C BRA $334E C2/3332: A9 04 LDA #$04 (s/b reached if bottom 6 bits of attack byte >= 32h. so real examples are 32h, "Remove Reflect", and Skull Dragon's 3Fh, which had "???" for description) C2/3334: 0C A4 11 TSB $11A4 (turn on "Lift status" spell bit) C2/3337: A9 17 LDA #$17 (act is if just "Reflect" is in attack byte, so there'll be no attack power) C2/3339: C9 20 CMP #$20 C2/333B: 90 08 BCC $3345 (if value < 20h, there is no Attack Level boost, but there is a status to alter) C2/333D: E9 20 SBC #$20 C2/333F: 65 BC ADC $BC C2/3341: 85 BC STA $BC (add attack level btwn 0 and Fh, plus the carry flag [which is always 1 here], to Damage Incrementer) C2/3343: 80 09 BRA $334E (don't mess with statuses) C2/3345: 20 17 52 JSR $5217 (transform the attack byte value 0 to 1F into a spell status bit to set in $11AA, $11AB, $11AC, or $11AD) C2/3348: 1D AA 11 ORA $11AA,X C2/334B: 9D AA 11 STA $11AA,X C2/334E: FA PLX C2/334F: A9 40 LDA #$40 C2/3351: 04 B2 TSB $B2 (Clear little Runic sword animation?) C2/3353: D0 0F BNE $3364 (If it wasn't set to begin with, branch over this animation code.) C2/3355: A9 25 LDA #$25 C2/3357: EB XBA C2/3358: A9 06 LDA #$06 C2/335A: 20 BF 62 JSR $62BF C2/335D: 20 DB 63 JSR $63DB (Copy $An variables to ($78) buffer) C2/3360: A9 10 LDA #$10 C2/3362: 14 A0 TRB $A0 C2/3364: A9 08 LDA #$08 C2/3366: 3C F9 3E BIT $3EF9,X C2/3369: F0 04 BEQ $336F (Branch if attacker not morphed) C2/336B: E6 BC INC $BC C2/336D: E6 BC INC $BC (Double damage if morphed) C2/336F: AD A2 11 LDA $11A2 C2/3372: 4A LSR C2/3373: 90 09 BCC $337E (Branch if magic damage) C2/3375: A9 10 LDA #$10 C2/3377: 3C E5 3E BIT $3EE5,X C2/337A: F0 02 BEQ $337E (Branch if attacker not berserked) C2/337C: E6 BC INC $BC (Add 50% damage if berserk and physical attack) C2/337E: AD A2 11 LDA $11A2 C2/3381: 89 40 BIT #$40 C2/3383: D0 0D BNE $3392 (Branch if no split damage) C2/3385: AD C9 3E LDA $3EC9 C2/3388: C9 02 CMP #$02 C2/338A: 90 06 BCC $3392 (Branch if only one target) C2/338C: 4E B1 11 LSR $11B1 C2/338F: 6E B0 11 ROR $11B0 (Cut damage in half) C2/3392: A9 20 LDA #$20 C2/3394: 24 B3 BIT $B3 C2/3396: D0 0B BNE $33A3 (Branch if ignore attacker row) C2/3398: 3C A1 3A BIT $3AA1,X C2/339B: F0 06 BEQ $33A3 (Branch if attacker in Front Row) C2/339D: 4E B1 11 LSR $11B1 C2/33A0: 6E B0 11 ROR $11B0 (Cut damage in half) C2/33A3: 20 AD 14 JSR $14AD C2/33A6: 20 7D 3E JSR $3E7D (Special effect code from 42E1, once per strike) C2/33A9: C2 20 REP #$20 (Set 16-bit Accumulator) C2/33AB: AC 05 34 LDY $3405 (# of hits left from Super Ball/Launcher) C2/33AE: 30 01 BMI $33B1 (If there aren't any, those special effects aren't being used, so jump to the normal Combat function. If there are, we skip the Combat function, as C2/3483 more or less takes its place.) C2/33B0: 60 RTS
C2/33B1 combat function
C2/33B1: A0 12 LDY #$12 C2/33B3: B9 18 30 LDA $3018,Y C2/33B6: 24 A4 BIT $A4 C2/33B8: F0 07 BEQ $33C1 (Skip if spell doesn't target that target) C2/33BA: 20 0D 22 JSR $220D (Hit or miss function) C2/33BD: 90 02 BCC $33C1 C2/33BF: 14 A4 TRB $A4 (Makes attack miss target) C2/33C1: 88 DEY C2/33C2: 88 DEY C2/33C3: 10 EE BPL $33B3 (Do for all 10 possible targets) C2/33C5: E2 20 SEP #$20 (Set 8-bit accumulator) C2/33C7: AD 1C 34 LDA $341C C2/33CA: 30 0A BMI $33D6 (branch if not a missable weapon spellcasting) C2/33CC: A5 A4 LDA $A4 C2/33CE: 05 A5 ORA $A5 C2/33D0: D0 04 BNE $33D6 (Branch if at least one target hit) C2/33D2: A9 12 LDA #$12 C2/33D4: 85 B5 STA $B5 (use null animation for strike) C2/33D6: AD 1D 34 LDA $341D C2/33D9: 30 0A BMI $33E5 (branch if an insta-kill weapon hasn't activated instant death this turn.) C2/33DB: A5 A2 LDA $A2 C2/33DD: 05 A3 ORA $A3 C2/33DF: D0 04 BNE $33E5 (Branch if at least one target targetted) C2/33E1: A9 12 LDA #$12 C2/33E3: 85 B5 STA $B5 (use null animation for strike) C2/33E5: A9 40 LDA #$40 C2/33E7: 3C 95 3C BIT $3C95,X C2/33EA: F0 06 BEQ $33F2 (Branch if not auto critical when Imp) C2/33EC: 4A LSR C2/33ED: 3C E4 3E BIT $3EE4,X C2/33F0: D0 1A BNE $340C (If Attacker is imp do auto critical) C2/33F2: A9 02 LDA #$02 C2/33F4: 24 B3 BIT $B3 C2/33F6: F0 14 BEQ $340C (Automatic critical if bit 1 of $B3 not set) C2/33F8: 24 B2 BIT $B2 C2/33FA: D0 18 BNE $3414 (No critical if bit 1 of $B2 set) C2/33FC: 24 BA BIT $BA C2/33FE: F0 14 BEQ $3414 (No critical if not attacking opposition) C2/3400: 20 5A 4B JSR $4B5A (Random Number 0 to 255) C2/3403: C9 08 CMP #$08 (1 in 32 chance) C2/3405: B0 0D BCS $3414 C2/3407: AD C9 3E LDA $3EC9 C2/340A: F0 08 BEQ $3414 (No critical if no targets) C2/340C: E6 BC INC $BC (Critical hit x2 damage) C2/340E: E6 BC INC $BC C2/3410: A9 20 LDA #$20 (Set to flash screen?) C2/3412: 04 A0 TSB $A0 C2/3414: 20 AD 35 JSR $35AD C2/3417: C2 20 REP #$20 C2/3419: AD B0 11 LDA $11B0 (Maximum Damage) C2/341C: 20 0B 37 JSR $370B (Increment damage function) C2/341F: 8D B0 11 STA $11B0 (Maximum Damage) C2/3422: E2 20 SEP #$20 C2/3424: AD A3 11 LDA $11A3 C2/3427: 0A ASL C2/3428: 10 04 BPL $342E (Branch if not Caster dies) C2/342A: 9B TXY C2/342B: 20 52 38 JSR $3852 (Kill caster) C2/342E: BC B9 32 LDY $32B9,X (who's Controlling this entity?) C2/3431: 30 09 BMI $343C (branch if nobody is) C2/3433: DA PHX C2/3434: BB TYX (X points to controller) C2/3435: BC B8 32 LDY $32B8,X (Y = whom the controller is controlling [in other words, the entity we previously had in X]) C2/3438: 20 2F 37 JSR $372F (regenerate the Control menu. it will account for the MP cost of a spell cast this turn, but unfortunately, the call is too early to account for actual MP damage/healing/ draining done by the spell, so the menu will lag a turn behind in that respect.) C2/343B: FA PLX (restore X pointing to original entity) C2/343C: C2 20 REP #$20 C2/343E: A0 12 LDY #$12 C2/3440: B9 18 30 LDA $3018,Y C2/3443: 14 A4 TRB $A4 (Make spell miss target) C2/3445: F0 25 BEQ $346C (Skip if not target of spell) C2/3447: 2C 54 3A BIT $3A54 C2/344A: F0 02 BEQ $344E C2/344C: E6 BC INC $BC (Increment damage) C2/344E: 20 E3 35 JSR $35E3 (initialize several variables for counterattack purposes) C2/3451: CC F8 33 CPY $33F8 (Has this target used Zinger?) C2/3454: F0 16 BEQ $346C (If it has, branch to next target) C2/3456: 9C 48 3A STZ $3A48 C2/3459: 20 06 44 JSR $4406 (determine status to be set/removed when attack hits; miss if attack doesn't change target status) C2/345C: 20 7E 38 JSR $387E (Special effect code for target) C2/345F: AD 48 3A LDA $3A48 C2/3462: D0 08 BNE $346C (If $3A48 is not 0) C2/3464: B9 18 30 LDA $3018,Y C2/3467: 04 A4 TSB $A4 (Make attack hit target) C2/3469: 20 83 0B JSR $0B83 (Modify Damage, Heal Undead, and Elemental modification) C2/346C: 88 DEY C2/346D: 88 DEY C2/346E: 10 D0 BPL $3440 C2/3470: 20 EF 62 JSR $62EF C2/3473: 20 D6 36 JSR $36D6 (Learn lore) C2/3476: A5 A4 LDA $A4 C2/3478: D0 06 BNE $3480 (Branch if 1 or more targets) C2/347A: A9 02 00 LDA #$0002 C2/347D: 1C A7 11 TRB $11A7 (Clear text if hit if no targets hit) C2/3480: 4C DB 63 JMP $63DB (Copy $An variables to ($78) buffer) (Super Ball / Launcher / Reflected off targets function. Seems to be a specialized counterpart of the "Combat Function" at C2/33B1. For Super Ball / Launcher, it replaces that function. For Reflect, this is called shortly after that function.) C2/3483: DA PHX C2/3484: 48 PHA C2/3485: 20 00 64 JSR $6400 (Zero $A0 through $AF) C2/3488: 9C 5A 3A STZ $3A5A (Set no targets as missed) C2/348B: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/348D: A9 22 LDA #$22 C2/348F: 0C A3 11 TSB $11A3 (Set Retarget on dead, not reflectable) C2/3492: A9 40 LDA #$40 C2/3494: 85 BB STA $BB (Set to cursor start on enemy. Note we're NOT doing any spread-aim here, as the game hits at most one target for each target reflected off. Likewise, each Launcher firing or Super Ball bounce will only hit 1 target.) C2/3496: A9 50 LDA #$50 C2/3498: 04 BA TSB $BA (Sets randomize target & Reflected) C2/349A: A5 B6 LDA $B6 C2/349C: 8D 2A 3A STA $3A2A (Stores final damage) C2/349F: AE 05 34 LDX $3405 (# more times to attack, for Super Ball or Launcher) C2/34A2: 30 08 BMI $34AC (branch if negative, which should only happen if this function was reached due to Reflection) C2/34A4: A9 10 LDA #$10 C2/34A6: 14 BA TRB $BA (Clear Reflected property) C2/34A8: A9 15 LDA #$15 C2/34AA: 80 02 BRA $34AE C2/34AC: A9 09 LDA #$09 C2/34AE: 20 9B 62 JSR $629B (Copy $3A28-$3A2B variables into ($76) buffer) C2/34B1: A9 FF LDA #$FF C2/34B3: A0 09 LDY #$09 C2/34B5: 99 A0 00 STA $00A0,Y ($A0 thru $A9 = #$FF) C2/34B8: 88 DEY C2/34B9: 10 FA BPL $34B5 (loop 10 times. as this little loop suggests, you can't go setting the Launcher/Super Ball effect to have more than 10 "hits." that means that $3405 can have a maximum of 9, for those of you planning your own special effect.) C2/34BB: C2 20 REP #$20 (Set 16-bit Accumulator) C2/34BD: 4E B0 11 LSR $11B0 (Half damage) C2/34C0: A0 12 LDY #$12 C2/34C2: B9 18 30 LDA $3018,Y C2/34C5: 23 01 AND $01,S (is the target among those being "reflected off" by Reflect/Super Ball/Launcher ?) C2/34C7: F0 46 BEQ $350F (if not, skip it) C2/34C9: BB TYX (save loop variable) C2/34CA: 20 7E 58 JSR $587E (get new targets.. since the targeting at C2/3494 was set to "cursor start on enemy" and X holds the "reflected off" target going into the call, we're essentially performing a reflection here) C2/34CD: A5 B8 LDA $B8 (new targets after reflection) C2/34CF: F0 3E BEQ $350F (if there's none, skip our current loop target) C2/34D1: 5A PHY C2/34D2: 20 F9 51 JSR $51F9 (Y = [Number of highest target after reflection] * 2) C2/34D5: DA PHX C2/34D6: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/34D8: 8A TXA C2/34D9: 4A LSR C2/34DA: AA TAX ( [onscreen target # of reflected off target] / 2. so characters are now 0-3, and enemies are 4-9) C2/34DB: AD 05 34 LDA $3405 (# more times to attack, for Super Ball or Launcher) C2/34DE: 30 04 BMI $34E4 (branch if negative, which should only happen if this function was reached due to Reflection) C2/34E0: CE 05 34 DEC $3405 (decrement it) C2/34E3: AA TAX (replace reflected off target # with our iterator for Super Ball/Launcher?) C2/34E4: 98 TYA C2/34E5: 4A LSR (A = bit # of highest target after reflection) C2/34E6: 95 A0 STA $A0,X (Reflect: $A0,reflected_off_target = new_target Super Ball/Launcher: $A0,hit_iterator = new_target ) C2/34E8: C2 20 REP #$20 (Set 16-bit Accumulator) C2/34EA: FA PLX C2/34EB: 20 0D 22 JSR $220D (Determine if attack hits) C2/34EE: B0 19 BCS $3509 (branch if it misses) C2/34F0: 9C 48 3A STZ $3A48 C2/34F3: 20 E3 35 JSR $35E3 (initialize several variables for counterattack purposes) C2/34F6: 20 06 44 JSR $4406 (determine status to be set/removed when attack hits; miss if attack doesn't change target status) C2/34F9: 20 7E 38 JSR $387E (special effect code for target) C2/34FC: AD 48 3A LDA $3A48 (does attack miss due to status unchange [immunity] ?) C2/34FF: D0 08 BNE $3509 (if so, branch) C2/3501: BD 18 30 LDA $3018,X C2/3504: 04 AE TSB $AE (Set this Reflector as AN originator of the attack graphically? Since $AE will get overwritten later in the case of Super Ball / Launcher, this setting only applies to Reflection) C2/3506: 20 83 0B JSR $0B83 (Modify Damage, Heal Undead, and Elemental modification) C2/3509: 7A PLY C2/350A: AE 05 34 LDX $3405 (# more times to attack, for Super Ball or Launcher) C2/350D: 10 B3 BPL $34C2 (If it's positive, go again. This means that for Super Ball/Launcher, if "reflecting off" a certain initial target produces at least one valid final target, *all* our final targets will be determined by that initial one. Also note that "reflecting off" multiple initial targets for Super Ball / Launcher -- which the game never does -- would produce rather meaningless results. $3405 would equal FFh after the first such target, but the main loop would still get repeated by C2/3511. Shouldn't glitch anything, though. ) C2/350F: 88 DEY C2/3510: 88 DEY C2/3511: 10 AF BPL $34C2 (loop for everybody on screen) (Uh oh..! If there were no targets found to reflect onto above, we can reach this point with $3405 not being FFh. As a result, the branch at C2/33AE will keep skipping the normal "Combat function" at C2/33B1.. bugging up the current battle. This will continue until another Launcher/Super Ball is attempted when there are actually target(s) to hit. C2/3483 will then loop through those targets, bringing $3405 to a "safe" FFh in the process.) C2/3513: 68 PLA C2/3514: FA PLX C2/3515: A9 10 00 LDA #$0010 C2/3518: 24 BA BIT $BA (was there Reflection?) C2/351A: D0 09 BNE $3525 (branch if so) C2/351C: BD 18 30 LDA $3018,X C2/351F: 85 AE STA $AE (Set the missile launcher or the Super Ball thrower as THE originator of attack graphically?) C2/3521: 64 AA STZ $AA C2/3523: 64 AC STZ $AC C2/3525: 20 EF 62 JSR $62EF (Related to display of damage and healing numbers and "Miss" messages) C2/3528: 4C DB 63 JMP $63DB (Copy $An variables to ($78) buffer)
C2/352B runic function
C2/352B: AD A3 11 LDA $11A3 C2/352E: 89 08 BIT #$08 (can this spell by absorbed by Runic?) C2/3530: F0 7A BEQ $35AC (Exits function if not) C2/3532: 64 EE STZ $EE C2/3534: 64 EF STZ $EF (start off assuming no eligible Runickers) C2/3536: A0 12 LDY #$12 C2/3538: B9 A0 3A LDA $3AA0,Y C2/353B: 4A LSR (is this a valid target?) C2/353C: 90 20 BCC $355E (branch if not) C2/353E: B9 4C 3E LDA $3E4C,Y C2/3541: 89 06 BIT #$06 C2/3543: F0 19 BEQ $355E (Branch if not runic or enemy runic) C2/3545: 29 FB AND #$FB C2/3547: 99 4C 3E STA $3E4C,Y (clear runic) C2/354A: F4 C0 80 PEA $80C0 (Sleep, Death, Petrify) C2/354D: F4 10 22 PEA $2210 (Freeze, Hide, Stop) C2/3550: 20 64 58 JSR $5864 C2/3553: 90 09 BCC $355E (Branch if entity has any of above ailments) C2/3555: C2 20 REP #$20 C2/3557: B9 18 30 LDA $3018,Y C2/355A: 04 EE TSB $EE (mark this entity as an eligible Runicker) C2/355C: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/355E: 88 DEY C2/355F: 88 DEY (have we run through all 10 entities yet?) C2/3560: 10 D6 BPL $3538 (loop if not) C2/3562: A5 EE LDA $EE C2/3564: 05 EF ORA $EF (are there any eligible Runickers?) C2/3566: F0 44 BEQ $35AC (Exits function if not) C2/3568: DA PHX C2/3569: 20 65 38 JSR $3865 C2/356C: 9C 15 34 STZ $3415 C2/356F: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3571: A5 EE LDA $EE (get eligible Runickers) C2/3573: 85 B8 STA $B8 (save as targets) C2/3575: 20 0E 52 JSR $520E (X = # of bits set in A, i.e. the # of targets) C2/3578: 9C AA 11 STZ $11AA C2/357B: 9C AC 11 STZ $11AC (Make attack set no statuses) C2/357E: A9 82 21 LDA #$2182 C2/3581: 8D A3 11 STA $11A3 (Set concern MP, not reflectable, Unblockable, Heal) C2/3584: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/3586: A9 60 LDA #$60 C2/3588: 8D A2 11 STA $11A2 (Set ignore defense, no split damage) C2/358B: 7B TDC C2/358C: AD A5 11 LDA $11A5 (MP cost of spell) C2/358F: 20 92 47 JSR $4792 (divide by X) C2/3592: 8D A6 11 STA $11A6 (save as Battle Power) C2/3595: 20 5E 38 JSR $385E (Sets level, magic power to 0) C2/3598: 9C 14 34 STZ $3414 (Skip damage modification) C2/359B: A9 40 LDA #$40 C2/359D: 14 B2 TRB $B2 (Flag little Runic sword animation?) C2/359F: A9 04 LDA #$04 C2/35A1: 85 BA STA $BA (Don't retarget if target invalid) C2/35A3: A9 03 LDA #$03 C2/35A5: 1C A7 11 TRB $11A7 (turn off text and miss if status isn't set or clear) C2/35A8: 9C A9 11 STZ $11A9 (Set attack to no special effect) C2/35AB: FA PLX C2/35AC: 60 RTS
C2/35AD unknow
C2/35AD: DA PHX C2/35AE: AE 72 3A LDX $3A72 (get ($76) animation buffer pointer) C2/35B1: 8E 71 3A STX $3A71 (copy to "previous ($76) animation buffer pointer"?) C2/35B4: FA PLX C2/35B5: 20 D4 35 JSR $35D4 C2/35B8: 4C 9E 62 JMP $629E
C2/35BB change atma weapon length
C2/35BB: 20 D4 35 JSR $35D4 C2/35BE: DA PHX (preserve X) C2/35BF: 08 PHP C2/35C0: AE 72 3A LDX $3A72 C2/35C3: DA PHX (preserve animation buffer pointer) C2/35C4: AE 71 3A LDX $3A71 (get "previous ($76) animation buffer pointer"?) C2/35C7: 8E 72 3A STX $3A72 (copy it into current ($76) animation buffer pointer) C2/35CA: 20 9E 62 JSR $629E (update animation data in the previous ($76) buffer entry) C2/35CD: FA PLX C2/35CE: 8E 72 3A STX $3A72 (restore ($76) animation buffer pointer) C2/35D1: 28 PLP C2/35D2: FA PLX (restore X) C2/35D3: 60 RTS
C2/35D4 unknow
(Copy animation data from $B4 - $B7 into $3A28 - $3A2B variables) C2/35D4: 08 PHP C2/35D5: C2 20 REP #$20 (Set 16-bit Accumulator) C2/35D7: A5 B4 LDA $B4 C2/35D9: 8D 28 3A STA $3A28 C2/35DC: A5 B6 LDA $B6 C2/35DE: 8D 2A 3A STA $3A2A C2/35E1: 28 PLP C2/35E2: 60 RTS
C2/35E3 initialize counterattack variables
(Initialize several variables for counterattack purposes) C2/35E3: 08 PHP C2/35E4: E2 30 SEP #$30 C2/35E6: 20 1B 36 JSR $361B C2/35E9: 8A TXA C2/35EA: 99 90 32 STA $3290,Y (save attacker [or reflector if reflection involved] #) C2/35ED: AD 7C 3A LDA $3A7C C2/35F0: 99 48 3D STA $3D48,Y (save command #) C2/35F3: AD 10 34 LDA $3410 C2/35F6: C9 FF CMP #$FF C2/35F8: F0 07 BEQ $3601 (branch if there's no Spell # [or a Skean/Tool/ piece of equipment using a spell] defined for attack.) C2/35FA: 99 49 3D STA $3D49,Y (save the spell #) C2/35FD: 8A TXA C2/35FE: 99 91 32 STA $3291,Y (save attacker [or reflector if reflection involved] #) C2/3601: AD 11 34 LDA $3411 C2/3604: C9 FF CMP #$FF C2/3606: F0 07 BEQ $360F (branch if there's no Item # [or a Skean/Tool that doesn't use a spell] defined for attack.) C2/3608: 99 5C 3D STA $3D5C,Y (save item #) C2/360B: 8A TXA C2/360C: 99 A4 32 STA $32A4,Y (save attacker [or reflector if reflection involved] #) C2/360F: AD A1 11 LDA $11A1 C2/3612: 99 5D 3D STA $3D5D,Y (save attack's element/s) C2/3615: 8A TXA C2/3616: 99 A5 32 STA $32A5,Y (save attacker [or reflector if reflection involved] #) C2/3619: 28 PLP C2/361A: 60 RTS
C2/361B unknow
C2/361B: 08 PHP C2/361C: E2 21 SEP #$21 (Set 8-bit Accumulator, and set Carry) C2/361E: B9 E0 32 LDA $32E0,Y C2/3621: 10 05 BPL $3628 (branch if this target doesn't yet have an attacker [which can be a reflector, if reflection is involved]) C2/3623: 20 53 4B JSR $4B53 C2/3626: 90 05 BCC $362D (50% chance this attacker overwrites current one) C2/3628: 8A TXA C2/3629: 6A ROR ( [onscreen index of attacker] / 2. so characters are now 0-3, and enemies are 4-9) C2/362A: 99 E0 32 STA $32E0,Y (save index in bottom 7 bits, and turn on top bit) C2/362D: 28 PLP C2/362E: 60 RTS
C2/362F unknow
C2/362F: 48 PHA C2/3630: 08 PHP C2/3631: B9 E0 32 LDA $32E0,Y C2/3634: 30 05 BMI $363B (branch if this target already has an attacker for this turn) C2/3636: 8A TXA C2/3637: 6A ROR (Bits 0-6 = [onscreen index of attacker] / 2. so characters are now 0-3, and enemies are 4-9. Bit 7 = Carry flag passed by caller. sadly, it's arbitrary gibberish from three of the callers: function C2/0C2D, function C2/384A when called via C2/387E, and function C2/384A when called via C2/3E7D.) C2/3638: 99 E0 32 STA $32E0,Y C2/363B: 28 PLP C2/363C: 68 PLA C2/363D: 60 RTS
C2/363E weapon spell cast
(Weapon "addition magic") C2/363E: A5 B5 LDA $B5 C2/3640: C9 16 CMP #$16 (is Command Jump?) C2/3642: D0 05 BNE $3649 (if not, branch) C2/3644: AD 70 3A LDA $3A70 (are there more attacks to do from Offering / Quadra Slam / Dragon Horn / etc?) C2/3647: D0 1C BNE $3665 (if so, exit function) C2/3649: AD 89 3A LDA $3A89 C2/364C: 89 40 BIT #$40 (is "cast randomly with fight" bit set in the weapon spellcast byte?) C2/364E: F0 15 BEQ $3665 (if not, Exit function) C2/3650: EB XBA C2/3651: 20 5A 4B JSR $4B5A (random #, 0 to 255) C2/3654: C9 40 CMP #$40 C2/3656: B0 0D BCS $3665 (if that # is 64 or greater, exit function. iow, exit 3/4 of time.) C2/3658: EB XBA C2/3659: 29 3F AND #$3F (isolate spell # of weapon in bottom 6 bits) C2/365B: 8D 00 34 STA $3400 (save it) C2/365E: A9 10 LDA #$10 C2/3660: 14 B2 TRB $B2 (this bit distinguishes traditional "addition magic" spellcasts from Tempest's Wind Slash in a few ways in C2/37EB.) (one is that it'll cause the targeting byte to be set to only "Cursor start on enemy" for the followup spell. maybe the goal is to prevent the spell from targeting multiple enemies..? but i'm not sure when the spellcast would even try to target anything other than the target whacked by the weapon, unless the spell randomizes targets, which no normal "addition magic" does.) C2/3662: EE 70 3A INC $3A70 (increment # of attacks remaining. since the calling code will soon decrement this, the addition magic should be cast with the same # of attacks remaining as the weapon strike preceding it was) C2/3665: 60 RTS
C2/3666 unknow
C2/3666: A9 01 LDA #$01 C2/3668: 14 B2 TRB $B2 C2/366A: F0 F9 BEQ $3665 C2/366C: AD 12 34 LDA $3412 C2/366F: 30 F4 BMI $3665 C2/3671: DA PHX C2/3672: 9B TXY C2/3673: 8D 29 3A STA $3A29 C2/3676: 0A ASL C2/3677: AA TAX C2/3678: A9 01 LDA #$01 C2/367A: 8D 28 3A STA $3A28 C2/367D: FC C4 36 JSR ($36C4,X) C2/3680: 8D 2A 3A STA $3A2A C2/3683: FA PLX C2/3684: 4C 9E 62 JMP $629E C2/3687: A5 B6 LDA $B6 C2/3689: 60 RTS C2/368A: AD 7D 3A LDA $3A7D C2/368D: 60 RTS C2/368E: 38 SEC C2/368F: A5 B6 LDA $B6 C2/3691: E9 36 SBC #$36 C2/3693: 60 RTS C2/3694: A5 B5 LDA $B5 C2/3696: 60 RTS C2/3697: A9 11 LDA #$11 C2/3699: 8D 28 3A STA $3A28 C2/369C: B9 A8 33 LDA $33A8,Y C2/369F: 8D 29 3A STA $3A29 C2/36A2: B9 A9 33 LDA $33A9,Y C2/36A5: 60 RTS
C2/36A6 joker doom
(Joker Dooms) C2/36A6: A9 02 LDA #$02 C2/36A8: 0C 46 3A TSB $3A46 (set flag to let attack target normally untargetable entities: Jumpers [err, scratch that, since they'd have to be un-Hidden, which i don't think is possible], Seized characters, etc.) C2/36AB: 1C A2 11 TRB $11A2 (Clear miss if death protected) C2/36AE: A9 20 LDA #$20 C2/36B0: 0C A4 11 TSB $11A4 (Sets unblockable) C2/36B3: A9 00 LDA #$00 C2/36B5: 8D 29 3A STA $3A29 C2/36B8: A9 55 LDA #$55 (Joker Doom) C2/36BA: 60 RTS
C2/36BB unknow
C2/36BB: A9 00 LDA #$00 C2/36BD: 8D 29 3A STA $3A29 C2/36C0: AD 7D 3A LDA $3A7D C2/36C3: 60 RTS
C2/36C4 pointers: commands
C2/36C4: 87 36 (Magic, non-Summoning non-Joker Doom Slot, successful Dance, Lore, Magitek, enemy non-Specials, and many others) C2/36C6: 8A 36 (Item) C2/36C8: 8E 36 (Esper Summon) C2/36CA: 65 36 C2/36CC: 87 36 (SwdTech) C2/36CE: 94 36 (GP Rain) C2/36D0: 97 36 (enemy Special) C2/36D2: A6 36 (Slot - Joker Dooms) C2/36D4: BB 36 (Blitz)
C2/36D6 learn lore if casted
C2/36D6: DA PHX C2/36D7: 08 PHP C2/36D8: E2 20 SEP #$20 C2/36DA: AD A3 11 LDA $11A3 C2/36DD: 89 04 BIT #$04 C2/36DF: F0 27 BEQ $3708 (Branch if not learn when casted) C2/36E1: AC 07 30 LDY $3007 C2/36E4: 30 22 BMI $3708 (Exit if Strago not in party) C2/36E6: F4 C3 B0 PEA $B0C3 (Death, Petrify, Zombie, Dark, Sleep, Muddled, Berserk) C2/36E9: F4 10 23 PEA $2310 (Stop, Hide, Rage, Freeze) C2/36EC: 20 64 58 JSR $5864 C2/36EF: 90 17 BCC $3708 (Exit function if any set) C2/36F1: A5 B6 LDA $B6 C2/36F3: E9 8B SBC #$8B C2/36F5: 18 CLC C2/36F6: 20 17 52 JSR $5217 C2/36F9: E0 03 CPX #$03 C2/36FB: B0 0B BCS $3708 C2/36FD: 3C 29 1D BIT $1D29,X (Known lores) C2/3700: D0 06 BNE $3708 C2/3702: 1D 84 3A ORA $3A84,X (Lores to learn) C2/3705: 9D 84 3A STA $3A84,X C2/3708: 28 PLP C2/3709: FA PLX C2/370A: 60 RTS
C2/370B damage increment function
Damage = damage * (1 + (.5 * $BC)) C2/370B: 5A PHY C2/370C: A4 BC LDY $BC C2/370E: F0 1D BEQ $372D (Exit if $BC = 0) C2/3710: 48 PHA C2/3711: A5 B2 LDA $B2 C2/3713: 0A ASL C2/3714: 2D A1 11 AND $11A1 C2/3717: 0A ASL C2/3718: 0A ASL C2/3719: 0A ASL C2/371A: 68 PLA C2/371B: B0 10 BCS $372D (Exit function if Ignores defense and bit 4 of $B3 [Ignore Damage Increment on Ignore Defense] is set) C2/371D: 85 EE STA $EE C2/371F: 46 EE LSR $EE C2/3721: 18 CLC C2/3722: 65 EE ADC $EE (Add 50% damage) C2/3724: 90 02 BCC $3728 C2/3726: 7B TDC C2/3727: 3A DEC (Set damage to 65535) C2/3728: 88 DEY C2/3729: D0 F6 BNE $3721 (Do this $BC times) C2/372B: 84 BC STY $BC (Store 0 in $BC) C2/372D: 7A PLY C2/372E: 60 RTS
C2/372F: DA PHX C2/3730: 5A PHY C2/3731: 08 PHP C2/3732: C2 31 REP #$31 (set 16-bit A, X and Y. clear Carry) C2/3734: BF 4A 54 C2 LDA $C2544A,X (address of controlling character's menu?) C2/3738: 69 30 00 ADC #$0030 C2/373B: 8F 81 21 00 STA $002181 C2/373F: BB TYX C2/3740: BD 08 3C LDA $3C08,X (MP of monster?) C2/3743: 1A INC C2/3744: 85 EE STA $EE (add 1, as it'll make future comparisons easier) C2/3746: BD F9 1F LDA $1FF9,X (Monster Type) C2/3749: 0A ASL C2/374A: 0A ASL C2/374B: AA TAX (X = monster number * 4) C2/374C: E2 20 SEP #$20 (set 8-bit accumulator) C2/374E: 7B TDC (clear A) C2/374F: 8F 83 21 00 STA $002183 C2/3753: A0 04 00 LDY #$0004 C2/3756: 7B TDC C2/3757: 48 PHA C2/3758: BF 00 3D CF LDA $CF3D00,X (get Relm's Control command) C2/375C: 8F 80 21 00 STA $002180 (store it in a menu) C2/3760: C9 FF CMP #$FF C2/3762: F0 1C BEQ $3780 (branch if the command [aka the spell #] was null) C2/3764: EB XBA C2/3765: A9 0E LDA #$0E (there are 14d bytes per spell in magic data) C2/3767: 20 81 47 JSR $4781 (spell number * 14) C2/376A: DA PHX C2/376B: AA TAX C2/376C: BF C5 6A C4 LDA $C46AC5,X (get MP cost) C2/3770: EB XBA C2/3771: BF C0 6A C4 LDA $C46AC0,X (get targeting byte) C2/3775: FA PLX (restore X = monster num * 4) C2/3776: 83 01 STA $01,S (replace zero value on stack from C2/3757 with targeting byte?) C2/3778: 18 CLC (clear carry) C2/3779: A5 EF LDA $EF (retrieve (MP of monster + 1) / 256 ?) C2/377B: D0 03 BNE $3780 (if it's nonzero, branch. spell MP costs are only 1 byte, so we don't have to worry whether it's castable) C2/377D: EB XBA (get MP cost of spell) C2/377E: C5 EE CMP $EE (carry will be clear if the Cost of spell is less than (monster MP + 1), or if the foe has >= 255 MP) (IOW, if the spell is affordable.) C2/3780: 6A ROR (rotate carry into top bit of A. doubt the other bits matter, given the XBA above is only done sometimes..) C2/3781: 8F 80 21 00 STA $002180 C2/3785: 68 PLA (get the targeting byte, or zero if the menu entry was null) C2/3786: 8F 80 21 00 STA $002180 C2/378A: E8 INX C2/378B: 88 DEY C2/378C: D0 C8 BNE $3756 (loop 4 times, once for each Control command) C2/378E: 28 PLP C2/378F: 7A PLY C2/3790: FA PLX C2/3791: 60 RTS
C2/3792 sketch and control chance
(Returns Carry clear if successful, set if fails) C2/3792: DA PHX C2/3793: B9 18 3B LDA $3B18,Y (Target's Level) C2/3796: 90 07 BCC $379F (if sketch/control chance isn't boosted by equip, branch) C2/3798: EB XBA C2/3799: A9 AA LDA #$AA C2/379B: 20 81 47 JSR $4781 (Multiply target level by #$AA) C2/379E: EB XBA (Multiply target level by 170 / 256) C2/379F: 48 PHA (save target level (or target level * 170/256)) C2/37A0: 7B TDC C2/37A1: BD 18 3B LDA $3B18,X (Attacker's Level) C2/37A4: EB XBA (* 256) C2/37A5: FA PLX (restore target level (or target level * 170/256)) C2/37A6: 20 92 47 JSR $4792 (A / X) C2/37A9: 48 PHA C2/37AA: 18 CLC C2/37AB: EB XBA C2/37AC: D0 05 BNE $37B3 (Automatically hit if result of division is >= 256) C2/37AE: 20 5A 4B JSR $4B5A (random #: 0 to 255) C2/37B1: C3 01 CMP $01,S (compare to result of division) C2/37B3: 68 PLA C2/37B4: FA PLX C2/37B5: 60 RTS
C2/37B6 reduce gold for steal or GP rain
Reduce gold for GP Rain or Enemy Steal Gold = Gold - A (no lower than 0) For GP Rain: A = Level * 30 (Gold if gold < level * 30) For Enemy Steal: High A = Enemy level, low A = 20 (14 hex) (Enemy level * 256 + 20) (Gold if gold < (Enemy level * 256) + 20) C2/37B6: 48 PHA C2/37B7: 38 SEC C2/37B8: AD 60 18 LDA $1860 (party's gold, bottom 16 bits) C2/37BB: 85 EE STA $EE C2/37BD: E3 01 SBC $01,S C2/37BF: 8D 60 18 STA $1860 (subtract A from gold) C2/37C2: E2 20 SEP #$20 (8-bit mem/acc) C2/37C4: AD 62 18 LDA $1862 (party's gold, top 8 bits) C2/37C7: E9 00 SBC #$00 C2/37C9: 8D 62 18 STA $1862 (now continue subtraction with borrow) C2/37CC: C2 20 REP #$20 (16-bit mem/acc) C2/37CE: B0 0A BCS $37DA (branch if party's gold was >= amount thrown or stolen) C2/37D0: A5 EE LDA $EE C2/37D2: 83 01 STA $01,S (otherwise, lower amount thrown/stolen to what the party's gold was) C2/37D4: 9C 60 18 STZ $1860 C2/37D7: 9C 61 18 STZ $1861 (zero the party's gold, all 3 bytes) C2/37DA: 68 PLA C2/37DB: 60 RTS
C2/37DC pick random esper
Pick a random Esper (not Odin or Raiden) C2/37DC: A9 19 LDA #$19 C2/37DE: 20 65 4B JSR $4B65 (0 to $18) C2/37E1: C9 0B CMP #$0B C2/37E3: 90 02 BCC $37E7 (Branch if A < $0B) C2/37E5: 1A INC (Add 2 if over $0B) C2/37E6: 1A INC C2/37E7: 18 CLC C2/37E8: 69 36 ADC #$36 C2/37EA: 60 RTS
C2/37EB setup weapon addition magic
(Set up weapon addition magic, Tempest's Wind Slash, and Espers summoned by the Magicite item) C2/37EB: AD 00 34 LDA $3400 C2/37EE: C9 FF CMP #$FF C2/37F0: F0 45 BEQ $3837 (Exit if $3400 = #$FF) C2/37F2: 85 B6 STA $B6 (Set spell #) C2/37F4: 20 BF 1D JSR $1DBF (Get command based on attack/spell number. A bottom = Command #, A top = Attack #) C2/37F7: 85 B5 STA $B5 (Set command to that type) C2/37F9: 20 D3 26 JSR $26D3 (load command and spell data) C2/37FC: 20 51 29 JSR $2951 (Load Magic Power / Vigor and Level) C2/37FF: 9C A5 11 STZ $11A5 (Set MP cost to 0) C2/3802: A9 FF LDA #$FF C2/3804: 8D 00 34 STA $3400 (null out the "spell # for a second attack", as we've already processed it.) C2/3807: A9 02 LDA #$02 C2/3809: 04 B2 TSB $B2 (Set no critical & ignore True Knight) C2/380B: A9 10 LDA #$10 C2/380D: 24 B2 BIT $B2 C2/380F: F0 03 BEQ $3814 (branch if it's weapon addition magic, which won't let the followup spell hit anybody but the initial weapon victim. why the hell doesn't this just branch directly to $3816?) C2/3811: 9C 15 34 STZ $3415 C2/3814: D0 17 BNE $382D (and why the hell isn't this an unconditional BRA? i'm tempted to make a Readability patch just combining these two trivial changes..) (To be clear: Traditional weapon "addition magic" will start its journey at C2/3816. As far as I know, anything else will take the C2/382D path. That includes Espers summoned by the Magicite item and Tempest's Wind Slash [which is technically addition magic, but a special case].) C2/3816: A9 0C LDA #$0C C2/3818: 1C A3 11 TRB $11A3 (Clear learn if cast, clear enable Runic) C2/381B: 04 BA TSB $BA (Set Don't retarget if target invalid, and Can target dead/hidden targets) C2/381D: A9 40 LDA #$40 C2/381F: 85 BB STA $BB (Set only to cursor start on enemy [and clear any multi-targeting ability]). C2/3821: A9 10 LDA #$10 C2/3823: 2C A4 11 BIT $11A4 C2/3826: F0 05 BEQ $382D (Branch if Stamina can't block) C2/3828: 9C 1C 34 STZ $341C (this makes a weapon spell -- like Soul Sabre's Doom -- have its animation skipped entirely when missing rather than show a "Miss" message) C2/382B: 80 05 BRA $3832 C2/382D: A9 20 LDA #$20 C2/382F: 0C A4 11 TSB $11A4 (Set Unblockable) C2/3832: A9 02 LDA #$02 C2/3834: 0C A3 11 TSB $11A3 (Set Not Reflectable) C2/3837: 60 RTS
C2/3838 air anchor effect: kill target if it acts
C2/3838: BD 05 32 LDA $3205,X C2/383B: 89 04 BIT #$04 C2/383D: D0 0A BNE $3849 (Exit function if not under Air Anchor effect) C2/383F: 09 04 ORA #$04 C2/3841: 9D 05 32 STA $3205,X (Clear Air Anchor effect) C2/3844: A9 40 LDA #$40 C2/3846: 0C A3 11 TSB $11A3 (Set caster dies) C2/3849: 60 RTS
C2/384A unknow
C2/384A: BD E9 3D LDA $3DE9,X C2/384D: 09 20 ORA #$20 C2/384F: 9D E9 3D STA $3DE9,X (Mark Hide status to be set) C2/3852: 20 2F 36 JSR $362F C2/3855: A9 80 LDA #$80 C2/3857: 1D D4 3D ORA $3DD4,X C2/385A: 9D D4 3D STA $3DD4,X (Mark Death status to be set) C2/385D: 60 RTS
C2/385E null level and magic power
Sets level, and magic power for attack to 0 C2/385E: 9C AF 11 STZ $11AF C2/3861: 9C AE 11 STZ $11AE C2/3864: 60 RTS
C2/3865 unknow
C2/3865: 08 PHP C2/3866: C2 20 REP #$20 C2/3868: AD 14 34 LDA $3414 C2/386B: 30 07 BMI $3874 C2/386D: AD 30 3A LDA $3A30 C2/3870: 85 B8 STA $B8 C2/3872: 80 08 BRA $387C C2/3874: A5 B8 LDA $B8 C2/3876: 8D 30 3A STA $3A30 C2/3879: 0C 4E 3A TSB $3A4E C2/387C: 28 PLP C2/387D: 60 RTS
C2/387E calls special effect for attacks
C2/387E: DA PHX C2/387F: 5A PHY C2/3880: 08 PHP C2/3881: E2 30 SEP #$30 C2/3883: AE A9 11 LDX $11A9 C2/3886: FC CD 3D JSR ($3DCD,X) C2/3889: 28 PLP C2/388A: 7A PLY C2/388B: FA PLX C2/388C: 60 RTS
C2/388D special effect: scimitar
( Slice/Scimitar special effect starts here ) C2/388D: 38 SEC C2/388E: A9 EE LDA #$EE C2/3890: EB XBA (Call from Kill with "X" effect enters here, with A = #$7E) C2/3891: B9 A1 3A LDA $3AA1,Y C2/3894: 89 04 BIT #$04 C2/3896: D0 F4 BNE $388C (Exit function if prot. from death) C2/3898: B0 05 BCS $389F (Skip code to make auto hit undead) C2/389A: B9 95 3C LDA $3C95,Y C2/389D: 30 0C BMI $38AB (If Undead auto hit 100% of time) C2/389F: 20 5A 4B JSR $4B5A (Random number 0 to 255) C2/38A2: C9 40 CMP #$40 C2/38A4: B0 E6 BCS $388C (Exit 75% chance) C2/38A6: 20 B2 23 JSR $23B2 (Check if Stamina blocks) C2/38A9: B0 E1 BCS $388C (Exit if it does) C2/38AB: AD 70 3A LDA $3A70 (number of strikes remaining from Offering / Dragon Horn / etc) C2/38AE: F0 06 BEQ $38B6 (if this is final strike, branch) C2/38B0: A5 B5 LDA $B5 C2/38B2: C9 16 CMP #$16 C2/38B4: F0 D6 BEQ $388C (Exit if Command = Jump) C2/38B6: B9 18 30 LDA $3018,Y C2/38B9: 04 A4 TSB $A4 (Related to animation? This special effect function is different in that it jumps to C2/63DB instead of immediately returning. When it does return, the caller sets $A4 in an identical fashion, so I can't think of any reason to do it here outside of animation.) C2/38BB: 1C 4E 3A TRB $3A4E (Remove this [character] target from a "backup targets byte", which stops Offering/ Genji Glove/etc from beating on their corpse..) C2/38BE: B9 19 30 LDA $3019,Y C2/38C1: 04 A5 TSB $A5 (see note at C2/38B9.) C2/38C3: 1C 4F 3A TRB $3A4F (Remove this [monster] target from a "backup targets byte". see C2/38BB note for elaboration.) C2/38C6: A9 10 LDA #$10 C2/38C8: 04 A0 TSB $A0 C2/38CA: A9 80 LDA #$80 C2/38CC: 20 32 0E JSR $0E32 (Set Death in Status to Set) C2/38CF: 9C 1D 34 STZ $341D (this will make C2/33B1 null the animation for each strike in the remainder of this turn where no targets are found. this is part of the "corpse beating" prevention described above. without this instruction, the character will wave their hand around like an idiot.) C2/38D2: 9C A6 11 STZ $11A6 (set Battle Power to 0) C2/38D5: A9 02 LDA #$02 C2/38D7: 85 B5 STA $B5 C2/38D9: EB XBA C2/38DA: 85 B6 STA $B6 C2/38DC: C9 EE CMP #$EE C2/38DE: D0 0C BNE $38EC (Kill with 'X' branches) C2/38E0: C0 08 CPY #$08 (Check for monster or character) C2/38E2: 90 08 BCC $38EC (branch if character target) C2/38E4: B9 E9 3D LDA $3DE9,Y C2/38E7: 09 20 ORA #$20 C2/38E9: 99 E9 3D STA $3DE9,Y (Set Hide in Status to Set) C2/38EC: 20 AD 35 JSR $35AD C2/38EF: 4C DB 63 JMP $63DB (Copy $An variables to ($78) buffer)
C2/38F2 special effect: double damage for humans
C2/38F2: B9 95 3C LDA $3C95,Y C2/38F5: 89 10 BIT #$10 C2/38F7: F0 04 BEQ $38FD (Exit if target not human) C2/38F9: E6 BC INC $BC C2/38FB: E6 BC INC $BC (Double damage dealt) C2/38FD: 60 RTS
C2/38FE special effect: throw weapon
Sniper/Hawk Eye effect C2/38FE: 20 53 4B JSR $4B53 (0 or 1) C2/3901: 90 FA BCC $38FD (50% chance exit) C2/3903: E6 BC INC $BC (Add 1 to damage incrementor) C2/3905: B9 F9 3E LDA $3EF9,Y C2/3908: 10 F3 BPL $38FD (Exit if not target not Floating) C2/390A: A5 B5 LDA $B5 C2/390C: C9 00 CMP #$00 C2/390E: D0 ED BNE $38FD (Exit if command not Fight?) C2/3910: E6 BC INC $BC C2/3912: E6 BC INC $BC C2/3914: E6 BC INC $BC (Add another 3 to damage incrementor) C2/3916: A9 08 LDA #$08 C2/3918: 85 B5 STA $B5 (Store Throw for *purposes of animation*) C2/391A: A5 B7 LDA $B7 C2/391C: 3A DEC C2/391D: 85 B6 STA $B6 C2/391F: 4C BB 35 JMP $35BB
C2/3922 special effect: stone lore effect
C2/3922: A3 05 LDA $05,S C2/3924: AA TAX C2/3925: BD 18 3B LDA $3B18,X (Attacker's level) C2/3928: D9 18 3B CMP $3B18,Y (Target's Level) C2/392B: D0 06 BNE $3933 (If not same level, exit) C2/392D: A9 0D LDA #$0D (Add 13 to damage incrementer) C2/392F: 65 BC ADC $BC C2/3931: 85 BC STA $BC C2/3933: 60 RTS
C2/3934 special effect: palidor
C2/3934: A9 01 LDA #$01 C2/3936: 20 4C 46 JSR $464C C2/3939: B9 CC 32 LDA $32CC,Y C2/393C: 48 PHA C2/393D: 20 54 4E JSR $4E54 C2/3940: 99 CC 32 STA $32CC,Y C2/3943: A8 TAY C2/3944: 0A ASL C2/3945: AA TAX C2/3946: 68 PLA C2/3947: C9 FF CMP #$FF C2/3949: F0 03 BEQ $394E C2/394B: 99 84 31 STA $3184,Y C2/394E: 7B TDC C2/394F: 9D 20 36 STA $3620,X C2/3952: C2 20 REP #$20 C2/3954: 9D 20 35 STA $3520,X C2/3957: A9 16 00 LDA #$0016 C2/395A: 9D 20 34 STA $3420,X C2/395D: 60 RTS
C2/395E special effect: engulf
C2/395E: B9 18 30 LDA $3018,Y C2/3961: 0C 8A 3A TSB $3A8A (Set character as engulfed) C2/3964: 80 06 BRA $396C (Branch to remove from combat code)
C2/3966 special effect: bababreath
Bababreath from 3DCD C2/3966: B9 18 30 LDA $3018,Y C2/3969: 0C 88 3A TSB $3A88 (flag to remove target from party at end of battle) C2/396C: C2 20 REP #$20 (Special effect $27 & $38 & $4B jump here) (Escape, Sneeze, Smoke Bomb) C2/396E: B9 18 30 LDA $3018,Y C2/3971: 0C 4C 2F TSB $2F4C (mark target to removed from the battlefield?) C2/3974: 0C 39 3A TSB $3A39 C2/3977: 60 RTS
C2/3978 special effect: dischord
C2/3978: BB TYX C2/3979: FE 18 3B INC $3B18,X (Level) C2/397C: 5E 18 3B LSR $3B18,X (Half level rounded up) C2/397F: 60 RTS
C2/3980 special effect: R. polarity
C2/3980: B9 A1 3A LDA $3AA1,Y (Target's Row) C2/3983: 49 20 EOR #$20 C2/3985: 99 A1 3A STA $3AA1,Y (Switch) C2/3988: 60 RTS
C2/3989 special effect: wall change
C2/3989: 7B TDC C2/398A: A9 FF LDA #$FF C2/398C: 20 2A 52 JSR $522A (Pick a random bit) C2/398F: 99 E0 3B STA $3BE0,Y (Set your weakness to A) C2/3992: 49 FF EOR #$FF C2/3994: 99 CD 3B STA $3BCD,Y (Nullify all other elements) C2/3997: 20 2A 52 JSR $522A (Pick a random bit, not the one picked for weakness) C2/399A: 99 CC 3B STA $3BCC,Y (Absorb that element) C2/399D: 60 RTS
C2/399E special effect: steal
C2/399E: A3 05 LDA $05,S (Attacker) C2/39A0: AA TAX C2/39A1: A9 01 LDA #$01 C2/39A3: 8D 01 34 STA $3401 (=1) (Sets message to "Doesn't have anything!") C2/39A6: E0 08 CPX #$08 (Check if attacker is monster) C2/39A8: B0 5F BCS $3A09 (Branch if monster) C2/39AA: C2 20 REP #$20 (Set 16-bit accumulator) C2/39AC: B9 08 33 LDA $3308,Y (Target's stolen items) C2/39AF: 1A INC C2/39B0: E2 21 SEP #$21 (Set 8-bit Accumulator AND Carry Flag) C2/39B2: F0 4D BEQ $3A01 (Fail to steal if no items) C2/39B4: EE 01 34 INC $3401 (now = 2) (Sets message to "Couldn't steal!!") C2/39B7: BD 18 3B LDA $3B18,X (Attacker's Level) C2/39BA: 69 32 ADC #$32 (adding 51, since Carry Flag was set) C2/39BC: B0 1A BCS $39D8 (Automatically steal if level >= 205) C2/39BE: F9 18 3B SBC $3B18,Y (Subtract Target's Level, along with an extra 1 because Carry Flag is unset at this point. Don't worry; this cancels out with the extra 1 from C2/39BA.) (StealValue = [attacker level + 51] - [target lvl + 1] = Attacker level + 50 - Target level ) C2/39C1: 90 3E BCC $3A01 (Fail to steal if StealValue < 0) C2/39C3: 30 13 BMI $39D8 (Automatically steal if StealValue >= 128) C2/39C5: 85 EE STA $EE (save StealValue) C2/39C7: BD 45 3C LDA $3C45,X C2/39CA: 4A LSR C2/39CB: 90 02 BCC $39CF (If no sneak ring) C2/39CD: 06 EE ASL $EE (Double value) C2/39CF: A9 64 LDA #$64 C2/39D1: 20 65 4B JSR $4B65 (Random: 0 to 99) C2/39D4: C5 EE CMP $EE C2/39D6: B0 29 BCS $3A01 (Fail to steal if the random number >= StealValue) C2/39D8: 5A PHY C2/39D9: 20 5A 4B JSR $4B5A (Random: 0 to 255) C2/39DC: C9 20 CMP #$20 C2/39DE: 90 01 BCC $39E1 (branch 1/8 of the time, so Rare steal slot will be checked) C2/39E0: C8 INY (Check the 2nd [Common] slot 7/8 of the time) C2/39E1: B9 08 33 LDA $3308,Y (Target's stolen item) C2/39E4: 7A PLY C2/39E5: C9 FF CMP #$FF (If no item) C2/39E7: F0 18 BEQ $3A01 (Fail to steal) C2/39E9: 8D 35 2F STA $2F35 (Item stolen, for message purposes) C2/39EC: 9D F4 32 STA $32F4,X (Store in "Acquired item") C2/39EF: BD 18 30 LDA $3018,X C2/39F2: 0C 8C 3A TSB $3A8C (flag character to have any applicable item in $32F4,X added to inventory when turn is over.) C2/39F5: A9 FF LDA #$FF C2/39F7: 99 08 33 STA $3308,Y (Set to no item to steal) C2/39FA: 99 09 33 STA $3309,Y (in both slots) C2/39FD: EE 01 34 INC $3401 (now = 3) (Sets message to "Stole #whatever ") C2/3A00: 60 RTS If no items to steal C2/3A01: E2 20 SEP #$20 C2/3A03: A9 00 LDA #$00 C2/3A05: 99 48 3D STA $3D48,Y C2/3A08: 60 RTS (Steal for monsters) C2/3A09: 9C 3A 2F STZ $2F3A C2/3A0C: EE 01 34 INC $3401 (Sets message to "Couldn't steal!!") C2/3A0F: 20 5A 4B JSR $4B5A (random #: 0 to 255) C2/3A12: C9 C0 CMP #$C0 C2/3A14: B0 EB BCS $3A01 (fail to steal 1/4 of the time) C2/3A16: CE 01 34 DEC $3401 (Sets message to "Doesn't have anything!") C2/3A19: BD 18 3B LDA $3B18,X (enemy level) C2/3A1C: EB XBA C2/3A1D: A9 14 LDA #$14 (enemy will swipe: level * 256 + 20 gold) C2/3A1F: C2 20 REP #$20 (set 16-bit A) C2/3A21: 20 B6 37 JSR $37B6 (subtract swiped gold from party's inventory) C2/3A24: F0 DB BEQ $3A01 (branch if party had zero gold before the steal) C2/3A26: 8D 38 2F STA $2F38 (save gold swiped for message output) C2/3A29: 18 CLC C2/3A2A: 7D 98 3D ADC $3D98,X (add amount stolen to gold possessed by enemy) C2/3A2D: 90 02 BCC $3A31 (branch if no overflow) C2/3A2F: 7B TDC C2/3A30: 3A DEC (if sum overflowed, set enemy's gold to 65535) C2/3A31: 9D 98 3D STA $3D98,X (update enemy's gold) C2/3A34: E2 20 SEP #$20 (set 8-bit A) C2/3A36: A9 3F LDA #$3F C2/3A38: 8D 01 34 STA $3401 (Set message to "# GP was stolen!!") C2/3A3B: 60 RTS
C2/3A3C special effect: metamorph
C2/3A3C: C0 08 CPY #$08 (Checks if target is monster) C2/3A3E: 90 4A BCC $3A8A (branch if not) C2/3A40: B9 94 3C LDA $3C94,Y (Metamorph info: Morph chance in bits 5-7, and Morph pack in bits 0-4) C2/3A43: 48 PHA C2/3A44: 29 1F AND #$1F (isolate pack #) C2/3A46: 20 53 4B JSR $4B53 (Random number 0 or 1) C2/3A49: 2A ROL C2/3A4A: 20 53 4B JSR $4B53 (Random number 0 or 1) C2/3A4D: 2A ROL C2/3A4E: AA TAX (now we have the Metamorph pack # in bits 2-6, and a random 0-3 index into that pack in bits 0-1) C2/3A4F: BF 40 7F C4 LDA $C47F40,X (get the item we're attempting to Metamorph the enemy into) C2/3A53: 8D 35 2F STA $2F35 (save it for message purposes) C2/3A56: A9 02 LDA #$02 C2/3A58: 8D 28 3A STA $3A28 C2/3A5B: A9 1D LDA #$1D C2/3A5D: 8D 29 3A STA $3A29 C2/3A60: 20 BE 35 JSR $35BE C2/3A63: 20 AD 35 JSR $35AD C2/3A66: 68 PLA C2/3A67: 4A LSR C2/3A68: 4A LSR C2/3A69: 4A LSR C2/3A6A: 4A LSR C2/3A6B: 4A LSR (isolate 0-7 Metamorph Chance index) C2/3A6C: AA TAX (copy it to X) C2/3A6D: 20 5A 4B JSR $4B5A (Random number 0 to 255) C2/3A70: DF C5 3D C2 CMP $C23DC5,X (compare to actual Metamorph Chance) C2/3A74: B0 14 BCS $3A8A (if greater than or equal, branch and fail to Metamorph) C2/3A76: A3 05 LDA $05,S C2/3A78: AA TAX C2/3A79: AD 35 2F LDA $2F35 (get ID of Metamorphed item) C2/3A7C: 9D F4 32 STA $32F4,X (save it in this character's "Item to add to inventory" variable) C2/3A7F: BD 18 30 LDA $3018,X C2/3A82: 0C 8C 3A TSB $3A8C (flag this character to have their inventory variable checked when the turn ends) C2/3A85: A9 80 LDA #$80 C2/3A87: 4C 32 0E JMP $0E32 (Mark death status to be set) C2/3A8A: 4C 1B 3B JMP $3B1B (flag Miss message)
C2/3A8D special effect: debilitator
C2/3A8D: 7B TDC C2/3A8E: B9 E0 3B LDA $3BE0,Y (Elements weak against) C2/3A91: 0D C8 3E ORA $3EC8 (Elements nullified by ForceField) C2/3A94: 49 FF EOR #$FF C2/3A96: F0 F2 BEQ $3A8A (Miss if weak to all) C2/3A98: 20 2A 52 JSR $522A (Randomly pick an element not weak to that hasn't been nullified by ForceField) C2/3A9B: 48 PHA C2/3A9C: 20 F0 51 JSR $51F0 C2/3A9F: 8A TXA C2/3AA0: 18 CLC C2/3AA1: 69 0B ADC #$0B C2/3AA3: 8D 01 34 STA $3401 (Set to display that element as text) C2/3AA6: A3 01 LDA $01,S C2/3AA8: 19 E0 3B ORA $3BE0,Y C2/3AAB: 99 E0 3B STA $3BE0,Y (Make weak vs. that element) C2/3AAE: 68 PLA C2/3AAF: 49 FF EOR #$FF C2/3AB1: 48 PHA C2/3AB2: 39 E1 3B AND $3BE1,Y C2/3AB5: 99 E1 3B STA $3BE1,Y (Make not resist that element) C2/3AB8: A3 01 LDA $01,S C2/3ABA: EB XBA C2/3ABB: 68 PLA C2/3ABC: C2 20 REP #$20 (Set 16-bit accumulator) C2/3ABE: 39 CC 3B AND $3BCC,Y C2/3AC1: 99 CC 3B STA $3BCC,Y (Make not absorb or nullify that element) C2/3AC4: 60 RTS
C2/3AC5 special effect: control
C2/3AC5: C0 08 CPY #$08 C2/3AC7: 90 4D BCC $3B16 (Miss w/text if target is character) C2/3AC9: B9 80 3C LDA $3C80,Y C2/3ACC: 30 48 BMI $3B16 (Miss w/text if Can't Control bit set) C2/3ACE: F4 D2 B0 PEA $B0D2 (Death, Petrify, Clear, Zombie, Sleep, Muddled, Berserk) C2/3AD1: F4 00 29 PEA $2900 (Rage, Morph, Hide) C2/3AD4: 20 64 58 JSR $5864 C2/3AD7: 90 3D BCC $3B16 (Miss w/text if any set on target) C2/3AD9: B9 B9 32 LDA $32B9,Y C2/3ADC: 10 38 BPL $3B16 (If already controlled then miss w/text) C2/3ADE: A3 05 LDA $05,S C2/3AE0: AA TAX C2/3AE1: BD 45 3C LDA $3C45,X (Coronet "boost Control chance" in Bit 3) C2/3AE4: 4A LSR C2/3AE5: 4A LSR C2/3AE6: 4A LSR C2/3AE7: 4A LSR C2/3AE8: 20 92 37 JSR $3792 (Sketch/Control Chance - pass bit 3 of $3C45 as carry) C2/3AEB: B0 2E BCS $3B1B (Miss w/o text) C2/3AED: 98 TYA C2/3AEE: 9D B8 32 STA $32B8,X (save who attacker is Controlling) C2/3AF1: 8A TXA C2/3AF2: 99 B9 32 STA $32B9,Y (save who target is Controlled by) C2/3AF5: B9 19 30 LDA $3019,Y C2/3AF8: 0C 54 2F TSB $2F54 C2/3AFB: BD 4D 3E LDA $3E4D,X C2/3AFE: 09 01 ORA #$01 C2/3B00: 9D 4D 3E STA $3E4D,X C2/3B03: BD F9 3E LDA $3EF9,X C2/3B06: 09 10 ORA #$10 C2/3B08: 9D F9 3E STA $3EF9,X (Set spell status to attacker) C2/3B0B: B9 A1 3A LDA $3AA1,Y C2/3B0E: 09 40 ORA #$40 C2/3B10: 99 A1 3A STA $3AA1,Y (Set controlled bit to target) C2/3B13: 4C 2F 37 JMP $372F (generate the Control menu) C2/3B16: A9 04 LDA #$04 C2/3B18: 8D 01 34 STA $3401 (Set to display text #4) C2/3B1B: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3B1D: B9 18 30 LDA $3018,Y (Represents the target) C2/3B20: 8D 48 3A STA $3A48 (Indicate a Miss, due to the attack not changing any statuses or due to checks in its special effect) C2/3B23: 0C 5A 3A TSB $3A5A (Set target as missed) C2/3B26: 14 A4 TRB $A4 (Miss target) C2/3B28: 60 RTS
C2/3B29: C0 08 CPY #$08 C2/3B2B: 90 EE BCC $3B1B (Miss if aimed at party) C2/3B2D: B9 80 3C LDA $3C80,Y C2/3B30: 89 20 BIT #$20 C2/3B32: D0 30 BNE $3B64 (Branch if can't sketch) C2/3B34: A3 05 LDA $05,S C2/3B36: AA TAX C2/3B37: BD 45 3C LDA $3C45,X (Beret "boost Sketch chance" in Bit 2) C2/3B3A: 4A LSR C2/3B3B: 4A LSR C2/3B3C: 4A LSR C2/3B3D: 20 92 37 JSR $3792 (Sketch/Control chance - pass bit 2 of $3C45 as carry) C2/3B40: B0 D9 BCS $3B1B (branch if sketch missed) C2/3B42: 8C 17 34 STY $3417 (save Target as Sketchee) C2/3B45: 98 TYA C2/3B46: E9 07 SBC #$07 (subtract 8, as Carry is clear) C2/3B48: 4A LSR C2/3B49: 85 B7 STA $B7 (save 0-5 index of our Sketched monster) C2/3B4B: 20 BB 35 JSR $35BB C2/3B4E: 20 5A 4B JSR $4B5A (random: 0 to 255) C2/3B51: C9 40 CMP #$40 (75% chance for second sketch attack) C2/3B53: C2 30 REP #$30 (Set 16-bit Accumulator and Index registers) C2/3B55: B9 F9 1F LDA $1FF9,Y (get monster #) C2/3B58: 2A ROL C2/3B59: AA TAX C2/3B5A: BF 00 43 CF LDA $CF4300,X C2/3B5E: E2 30 SEP #$30 (Set 8-bit A,X & Y) C2/3B60: 8D 00 34 STA $3400 (Set attack to sketched attack) C2/3B63: 60 RTS C2/3B64: A9 1F LDA #$1F C2/3B66: 8D 01 34 STA $3401 (Store can't sketch message) C2/3B69: 80 B0 BRA $3B1B (Make attack miss)
C2/3B6B special effect: quake
C2/3B6B: B9 F9 3E LDA $3EF9,Y C2/3B6E: 30 AB BMI $3B1B (If Float status set, miss) C2/3B70: 60 RTS
C2/3B71 special effect: leap
C2/3B71: AD 49 2F LDA $2F49 C2/3B74: 89 08 BIT #$08 C2/3B76: D0 18 BNE $3B90 (Miss w/text) C2/3B78: AD 76 3A LDA $3A76 (Number of characters in party) C2/3B7B: C9 02 CMP #$02 C2/3B7D: 90 11 BCC $3B90 (Miss w/text) C2/3B7F: A3 05 LDA $05,S C2/3B81: AA TAX C2/3B82: BD E9 3D LDA $3DE9,X C2/3B85: 09 20 ORA #$20 C2/3B87: 9D E9 3D STA $3DE9,X (Mark Hide status to be set in attacker) C2/3B8A: A9 04 LDA #$04 C2/3B8C: 8D 6E 3A STA $3A6E C2/3B8F: 60 RTS C2/3B90: A9 05 LDA #$05 C2/3B92: 8D 01 34 STA $3401 (Set to display text #5) C2/3B95: 4C 1B 3B JMP $3B1B (Miss target)
C2/3B98 special effect: possess
C2/3B98: A3 05 LDA $05,S C2/3B9A: AA TAX C2/3B9B: BD 18 30 LDA $3018,X C2/3B9E: 0C 4C 2F TSB $2F4C (mark Possessor to be removed from battlefield?) (what about the Possessee?) C2/3BA1: 0C 88 3A TSB $3A88 (flag to remove Possessor from party at end of battle) C2/3BA4: 20 4A 38 JSR $384A C2/3BA7: DA PHX C2/3BA8: BB TYX C2/3BA9: 20 4A 38 JSR $384A C2/3BAC: 7A PLY C2/3BAD: 4C 1B 36 JMP $361B
C2/3BB0 special effect: mind blast
C2/3BB0: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3BB2: 20 FF 44 JSR $44FF (Clear Status to Set and Status to Clear bytes) C2/3BB5: B9 18 30 LDA $3018,Y C2/3BB8: A2 06 LDX #$06 C2/3BBA: 3C 5C 3A BIT $3A5C,X (is this target in list of "Mind Blast victims"? [this list was created previously in the other Mind Blast special effect function.]) C2/3BBD: F0 07 BEQ $3BC6 (branch if not) C2/3BBF: 48 PHA C2/3BC0: DA PHX C2/3BC1: 20 D0 3B JSR $3BD0 (Randomly mark a status from attack data to be set) C2/3BC4: FA PLX C2/3BC5: 68 PLA C2/3BC6: CA DEX C2/3BC7: CA DEX C2/3BC8: 10 F0 BPL $3BBA (Do for all 4 list entries. an entity who's listed N times can get N statuses from this spell.) C2/3BCA: 60 RTS
C2/3BCB special effect: evil toot
(Sets a random status from attack data) C2/3BCB: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3BCD: 20 FF 44 JSR $44FF (Clear Status to Set and Status to Clear bytes) C2/3BD0: AD AA 11 LDA $11AA C2/3BD3: 20 0E 52 JSR $520E (X = Number of statuses set by attack in bytes 1 & 2) C2/3BD6: 86 EE STX $EE C2/3BD8: AD AC 11 LDA $11AC C2/3BDB: 20 0E 52 JSR $520E (X = Number of statuses set by attack in bytes 3 & 4) C2/3BDE: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/3BE0: 8A TXA C2/3BE1: 18 CLC C2/3BE2: 65 EE ADC $EE (A = # of total statuses flagged in attack data) C2/3BE4: 20 65 4B JSR $4B65 (random number: 0 to A - 1) C2/3BE7: C5 EE CMP $EE (Clear Carry if the random status we want to set is in spell status byte 1 or 2; Set Carry if it's in byte 3 or 4.) C2/3BE9: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3BEB: 08 PHP C2/3BEC: AD AA 11 LDA $11AA C2/3BEF: 90 03 BCC $3BF4 (branch if we're attempting to set a status from status byte 1 or 2) C2/3BF1: AD AC 11 LDA $11AC (otherwise, it's from byte 3 or 4) C2/3BF4: 20 2A 52 JSR $522A (randomly pick a bit set in A) C2/3BF7: 28 PLP C2/3BF8: B0 03 BCS $3BFD C2/3BFA: 4C 32 0E JMP $0E32 (Set status picked bytes 1 or 2) C2/3BFD: 19 E8 3D ORA $3DE8,Y (Set status picked bytes 3 or 4) C2/3C00: 99 E8 3D STA $3DE8,Y C2/3C03: 60 RTS
C2/3C04 special effect: rippler
C2/3C04: A3 05 LDA $05,S C2/3C06: AA TAX C2/3C07: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3C09: BD E4 3E LDA $3EE4,X (status bytes 1-2, caster) C2/3C0C: 39 E4 3E AND $3EE4,Y (status bytes 1-2, target) C2/3C0F: 49 FF FF EOR #$FFFF C2/3C12: 85 EE STA $EE (save the statuses that aren't shared among caster and target. iow, turn on any bits that aren't set in both) C2/3C14: BD E4 3E LDA $3EE4,X C2/3C17: 25 EE AND $EE (get statuses exclusive to caster) C2/3C19: 99 D4 3D STA $3DD4,Y (target status to set = statuses that were only set in caster) C2/3C1C: 9D FC 3D STA $3DFC,X (caster status to clear = statuses that were only set in caster) C2/3C1F: B9 E4 3E LDA $3EE4,Y C2/3C22: 25 EE AND $EE (get statuses exclusive to target) C2/3C24: 9D D4 3D STA $3DD4,X (caster status to set = statuses that were only set in target) C2/3C27: 99 FC 3D STA $3DFC,Y (target status to clear = statuses that were only set in target) C2/3C2A: BD F8 3E LDA $3EF8,X (status bytes 3-4, caster) C2/3C2D: 39 F8 3E AND $3EF8,Y (status bytes 3-4, target) C2/3C30: 49 FF FF EOR #$FFFF C2/3C33: 85 EE STA $EE (save the statuses that aren't shared among caster and target. iow, turn on any bits that aren't set in both) C2/3C35: BD F8 3E LDA $3EF8,X C2/3C38: 25 EE AND $EE (get statuses exclusive to caster) C2/3C3A: 99 E8 3D STA $3DE8,Y (target status to set = statuses that were only set in caster) C2/3C3D: 9D 10 3E STA $3E10,X (caster status to clear = statuses that were only set in caster) C2/3C40: B9 F8 3E LDA $3EF8,Y C2/3C43: 25 EE AND $EE (get statuses exclusive to target) C2/3C45: 9D E8 3D STA $3DE8,X (caster status to set = statuses that were only set in target) C2/3C48: 99 10 3E STA $3E10,Y (target status to clear = statuses that were only set in target) C2/3C4B: 60 RTS
C2/3C4C special effect: exploder
Exploder effect from 3DCD C2/3C4C: A3 05 LDA $05,S C2/3C4E: AA TAX C2/3C4F: 86 EE STX $EE C2/3C51: C4 EE CPY $EE C2/3C53: D0 05 BNE $3C5A C2/3C55: BD 18 30 LDA $3018,X C2/3C58: 14 A4 TRB $A4 C2/3C5A: 60 RTS
C2/3C5B special effect: scan
C2/3C5B: B9 80 3C LDA $3C80,Y C2/3C5E: 89 10 BIT #$10 C2/3C60: D0 06 BNE $3C68 (Branch if can't scan) C2/3C62: BB TYX C2/3C63: A9 27 LDA #$27 C2/3C65: 4C 91 4E JMP $4E91 C2/3C68: A9 2C LDA #$2C C2/3C6A: 8D 01 34 STA $3401 (Store "Can't Scan" message) C2/3C6D: 60 RTS
C2/3C6E special effect: suplex
C2/3C6E: B9 80 3C LDA $3C80,Y C2/3C71: 89 04 BIT #$04 (Is Can't Suplex set in Misc/Special enemy byte?) C2/3C73: F0 E5 BEQ $3C5A (If not, exit function) C2/3C75: 4C 1B 3B JMP $3B1B (Makes miss)
C2/3C78 special effect: air anchor
C2/3C78: B9 A1 3A LDA $3AA1,Y C2/3C7B: 89 04 BIT #$04 C2/3C7D: D0 F6 BNE $3C75 (Miss if death prot.) C2/3C7F: A9 13 LDA #$13 C2/3C81: 8D 01 34 STA $3401 (Display text $13 - "Move, and you're dust!") C2/3C84: B9 05 32 LDA $3205,Y C2/3C87: 29 FB AND #$FB C2/3C89: 99 05 32 STA $3205,Y (Set Air Anchor effect) C2/3C8C: 9C 1A 34 STZ $341A (Special Effect $23 -- X-Zone, Odin, etc -- jumps here) C2/3C8F: 60 RTS
C2/3C90 special effect: L? peral
C2/3C90: 60 RTS
C2/3C91 special effect: charm
C2/3C91: A3 05 LDA $05,S C2/3C93: AA TAX C2/3C94: BD 94 33 LDA $3394,X C2/3C97: 10 DC BPL $3C75 (Miss if attacker already charmed a target) C2/3C99: 98 TYA C2/3C9A: 9D 94 33 STA $3394,X (Attacker data: save which target they charmed) C2/3C9D: 8A TXA C2/3C9E: 99 95 33 STA $3395,Y (Target data: save who has charmed them) C2/3CA1: 60 RTS
C2/3CA2 special effect: tapir
C2/3CA2: B9 E5 3E LDA $3EE5,Y C2/3CA5: 10 CE BPL $3C75 (Miss if target is not asleep) C2/3CA7: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3CA9: B9 1C 3C LDA $3C1C,Y C2/3CAC: 99 F4 3B STA $3BF4,Y (Set HP to max HP) C2/3CAF: C2 20 REP #$20 (Pep Up and Elixir/Megalixir branch here) C2/3CB1: B9 30 3C LDA $3C30,Y C2/3CB4: 99 08 3C STA $3C08,Y (Set MP to max MP) C2/3CB7: 60 RTS
C2/3CB8 special effect: pep up
C2/3CB8: A3 05 LDA $05,S C2/3CBA: AA TAX C2/3CBB: 20 4A 38 JSR $384A (Mark death and hide to be set) C2/3CBE: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3CC0: BD 18 30 LDA $3018,X C2/3CC3: 0C 4C 2F TSB $2F4C (mark caster to be removed from the battlefield?) C2/3CC6: 9E F4 3B STZ $3BF4,X (Set caster HP to 0) C2/3CC9: 9E 08 3C STZ $3C08,X (Set caster MP to 0) C2/3CCC: 80 E1 BRA $3CAF (Set target's MP to max MP)
C2/3CCE special effect: seize
C2/3CCE: A3 05 LDA $05,S C2/3CD0: AA TAX C2/3CD1: BD 58 33 LDA $3358,X (who attacker is Seizing) C2/3CD4: 10 9F BPL $3C75 (branch if already Seizing someone. this jumps to $3B1B - Miss) C2/3CD6: C0 08 CPY #$08 C2/3CD8: B0 9B BCS $3C75 (If target is not character - Miss) C2/3CDA: 98 TYA C2/3CDB: 9D 58 33 STA $3358,X (save who attacker is Seizing) C2/3CDE: 8A TXA C2/3CDF: 99 59 33 STA $3359,Y (save who target is Seized by) C2/3CE2: BD AC 3D LDA $3DAC,X C2/3CE5: 09 80 ORA #$80 C2/3CE7: 9D AC 3D STA $3DAC,X C2/3CEA: B9 18 30 LDA $3018,Y C2/3CED: 1C 03 34 TRB $3403 C2/3CF0: B9 A0 3A LDA $3AA0,Y C2/3CF3: 29 7F AND #$7F (Clear bit 7) C2/3CF5: 99 A0 3A STA $3AA0,Y C2/3CF8: A9 40 LDA #$40 C2/3CFA: 4C 4C 46 JMP $464C
C2/3CFF special effect: discard
C2/3CFD: A3 05 LDA $05,S C2/3CFF: AA TAX C2/3D00: BD AC 3D LDA $3DAC,X C2/3D03: 29 7F AND #$7F C2/3D05: 9D AC 3D STA $3DAC,X C2/3D08: A9 FF LDA #$FF C2/3D0A: 9D 58 33 STA $3358,X (attacker Seizing nobody) C2/3D0D: 99 59 33 STA $3359,Y (target Seized by nobody) C2/3D10: B9 18 30 LDA $3018,Y C2/3D13: 0C 03 34 TSB $3403 C2/3D16: 60 RTS
C2/3D17 special effect: elixir
(Special effect $4C - Elixir and Megalixir. In Item data, this appears as Special effect $04) C2/3D17: A9 80 LDA #$80 C2/3D19: 20 4C 46 JSR $464C (Sets bit 7 in $3204,Y) C2/3D1C: 80 91 BRA $3CAF (Set MP to Max MP)
C2/3D1E special effect: overcast
C2/3D1E: B9 4D 3E LDA $3E4D,Y C2/3D21: 09 02 ORA #$02 C2/3D23: 99 4D 3E STA $3E4D,Y (Turn on Overcast bit, which will be checked by function C2/450D to give a dying target Zombie instead) C2/3D26: 60 RTS
C2/3D27 special effect: zinger
C2/3D27: A3 05 LDA $05,S C2/3D29: AA TAX C2/3D2A: 8E F8 33 STX $33F8 (save attacker as the Zingerer) C2/3D2D: 8C F9 33 STY $33F9 (save target as who's being Zingered) C2/3D30: BD 19 30 LDA $3019,X C2/3D33: 0C 4D 2F TSB $2F4D (mark attacker to be removed from the battlefield?) C2/3D36: 60 RTS
C2/3D37 special effect: love token
C2/3D37: A3 05 LDA $05,S C2/3D39: AA TAX C2/3D3A: 98 TYA C2/3D3B: 9D 6C 33 STA $336C,X (Attacker data: save which target takes damage for them) C2/3D3E: 8A TXA C2/3D3F: 99 6D 33 STA $336D,Y (Target data: save who they're taking damage for) C2/3D42: 60 RTS
C2/3D43 special effect: kill target
(Auto hit undead, Restores undead) C2/3D43: 18 CLC C2/3D44: A9 7E LDA #$7E C2/3D46: 20 90 38 JSR $3890 C2/3D49: B9 95 3C LDA $3C95,Y (Doom effect jumps here) C2/3D4C: 10 14 BPL $3D62 (Exit function if not undead) C2/3D4E: C0 08 CPY #$08 C2/3D50: B0 11 BCS $3D63 (Branch if not character) C2/3D52: B9 D4 3D LDA $3DD4,Y C2/3D55: 29 7F AND #$7F C2/3D57: 99 D4 3D STA $3DD4,Y (Remove Death from Status to Set) C2/3D5A: C2 20 REP #$20 C2/3D5C: B9 1C 3C LDA $3C1C,Y C2/3D5F: 99 F4 3B STA $3BF4,Y (Fully heal HP) C2/3D62: 60 RTS
C2/3D63 unknow
C2/3D63: 7B TDC C2/3D64: B9 E9 3D LDA $3DE9,Y C2/3D67: 09 20 ORA #$20 C2/3D69: 99 E9 3D STA $3DE9,Y (Add hide to target) C2/3D6C: B9 19 30 LDA $3019,Y C2/3D6F: EB XBA C2/3D70: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3D72: 85 B8 STA $B8 C2/3D74: A2 0A LDX #$0A C2/3D76: A9 24 00 LDA #$0024 C2/3D79: 4C 91 4E JMP $4E91
C2/3D7C special effect: phantasm
C2/3D7C: B9 4D 3E LDA $3E4D,Y C2/3D7F: 09 40 ORA #$40 C2/3D81: 99 4D 3E STA $3E4D,Y (give Seizure-like quasi status to target) C2/3D84: 60 RTS
C2/3D85 special effect: stunner
(Only a Hit Rate / 256 chance it will actually try to inflict statuses on the target) C2/3D85: 20 5A 4B JSR $4B5A (random: 0 to 255) C2/3D88: CD A8 11 CMP $11A8 C2/3D8B: 90 1A BCC $3DA7 (If less than hit rate then exit) C2/3D8D: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3D8F: AD AA 11 LDA $11AA (Spell's Status to Set bytes 1+2) C2/3D92: 49 FF FF EOR #$FFFF C2/3D95: 39 D4 3D AND $3DD4,Y (Subtract it from target's Status to Set bytes 1+2) C2/3D98: 99 D4 3D STA $3DD4,Y C2/3D9B: AD AC 11 LDA $11AC (Spell's Status to Set bytes 3+4) C2/3D9E: 49 FF FF EOR #$FFFF C2/3DA1: 39 E8 3D AND $3DE8,Y (Subtract it from target's Status to Set bytes 3+4) C2/3DA4: 99 E8 3D STA $3DE8,Y C2/3DA7: 60 RTS
C2/3DA8 special effect: targeting
C2/3DA8: A3 05 LDA $05,S C2/3DAA: AA TAX C2/3DAB: 98 TYA C2/3DAC: 9D F5 32 STA $32F5,X (Stores target) C2/3DAF: 60 RTS
C2/3DB0 special effect: fallen one
C2/3DB0: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3DB2: 7B TDC (Clear Accumulator) C2/3DB3: 1A INC C2/3DB4: 99 F4 3B STA $3BF4,Y (Store 1 in HP) C2/3DB7: 60 RTS
C2/3DB8 special effect: super ball
C2/3DB8: 20 5A 4B JSR $4B5A (Random Number 0 to 255) C2/3DBB: 29 07 AND #$07 (Random Number 0 to 7) C2/3DBD: 1A INC (1 to 8) C2/3DBE: 8D B1 11 STA $11B1 (Set damage to 256 to 2048 in steps of 256) C2/3DC1: 9C B0 11 STZ $11B0 C2/3DC4: 60 RTS
C2/3DC5 data: metamorph chance
C2/3DC5: FF C2/3DC6: C0 C2/3DC7: 80 C2/3DC8: 40 C2/3DC9: 20 C2/3DCA: 10 C2/3DCB: 08 C2/3DCC: 00
C2/3DCD pointers: special effects
C2/3DCD: 8C 38 C2/3DCF: 8C 38 C2/3DD1: 8C 38 C2/3DD3: 43 3D ($03) C2/3DD5: F2 38 ($04) C2/3DD7: 8C 38 C2/3DD9: 8C 38 C2/3DDB: 8C 38 C2/3DDD: FE 38 ($08) C2/3DDF: 8C 38 C2/3DE1: 8C 38 C2/3DE3: 8C 38 C2/3DE5: 8C 38 C2/3DE7: 8D 38 ($0D) C2/3DE9: 8C 38 C2/3DEB: 8C 38 C2/3DED: 5B 3C ($10) C2/3DED: 8C 38 C2/3DF1: 3C 3A ($12) C2/3DF3: 34 39 ($13) C2/3DF5: 8C 38 C2/3DF7: 8C 38 C2/3DF9: 8C 38 C2/3DFB: A2 3C ($17) C2/3DFD: 8C 38 C2/3DFF: 4C 3C ($19) C2/3E01: 8C 38 C2/3E03: 8C 38 C2/3E05: 90 3C ($1C) C2/3E08: 8C 38 C2/3E09: 8C 38 C2/3E0B: 78 39 ($1F) C2/3E0D: B8 3C ($20) C2/3E0F: 04 3C ($21) C2/3E11: 22 39 ($22) C2/3E13: 8C 3C ($23) C2/3E15: 8C 38 C2/3E17: 6B 3B ($25) C2/3E19: 89 39 ($26) C2/3E1B: 6C 39 ($27) C2/3E1D: B0 3B ($28) C2/3E1F: 8C 38 C2/3E21: 8C 38 C2/3E23: 80 39 ($2B) C2/3E25: 8C 38 C2/3E27: 37 3D ($2D) C2/3E29: CE 3C ($2E) C2/3E2B: A8 3D ($2F) C2/3E2D: 6E 3C ($30) C2/3E2F: 8C 38 C2/3E31: 8C 38 C2/3E33: 66 39 ($33) C2/3E35: 91 3C ($34) C2/3E37: 49 3D ($35) C2/3E39: 8C 38 C2/3E3B: 1E 3D ($37) C2/3E3D: 6C 39 ($38) C2/3E3F: 5E 39 ($39) C2/3E41: 27 3D ($3A) C2/3E43: CB 3B ($3B) C2/3E45: 8C 38 C2/3E47: 8C 38 C2/3E49: 7C 3D ($3E) C2/3E4B: 85 3D ($3F) C2/3E4D: B0 3D ($40) C2/3E4F: 8C 38 C2/3E51: 8C 38 C2/3E53: 8C 38 C2/3E55: FD 3C ($44) C2/3E57: 8C 38 C2/3E59: 8C 38 C2/3E5B: 8C 38 C2/3E5D: 8C 38 C2/3E5F: 8C 38 C2/3E61: B8 3D ($4A) C2/3E63: 6C 39 ($4B) C2/3E65: 17 3D ($4C) C2/3E67: 8C 38 C2/3E69: 8C 38 C2/3E6B: 8C 38 C2/3E6D: 98 3B ($50) C2/3E6F: 8C 38 C2/3E71: 9E 39 ($52) C2/3E73: C5 3A ($53) C2/3E75: 71 3B ($54) C2/3E77: 29 3B ($55) C2/3E79: 8D 3A ($56) C2/3E7B: 78 3C ($57)
C2/3E7D unknow
C2/3E7D: DA PHX C2/3E7E: 08 PHP C2/3E7F: E2 30 SEP #$30 C2/3E81: 9B TXY C2/3E82: AE A9 11 LDX $11A9 C2/3E85: FC E1 42 JSR ($42E1,X) (Calls special effect code) C2/3E88: 28 PLP C2/3E89: FA PLX C2/3E8A: 60 RTS
C2/3E8B special effect: random steal
C2/3E8B: 20 53 4B JSR $4B53 (50% chance to steal) C2/3E8E: B0 0F BCS $3E9F C2/3E90: A9 A4 LDA #$A4 (Add steal effect to attack) C2/3E92: 8D A9 11 STA $11A9 C2/3E95: A5 B5 LDA $B5 C2/3E97: C9 00 CMP #$00 C2/3E99: D0 04 BNE $3E9F (Exit if $B5 is not 0) C2/3E9B: A9 06 LDA #$06 C2/3E9D: 85 B5 STA $B5 (Set $B5 to $06) C2/3E9F: 60 RTS
C2/3EA0 special effect: step mine
C2/3EA0: 9C 14 34 STZ $3414 (Set to ignore damage modifiers) C2/3EA3: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3EA5: 7B TDC C2/3EA6: 3A DEC C2/3EA7: 8D B0 11 STA $11B0 (Store 65535 in maximum damage) C2/3EAA: AD 67 18 LDA $1867 (Steps High 2 Bytes) C2/3EAD: AE A6 11 LDX $11A6 (Spell Power) C2/3EB0: 20 92 47 JSR $4792 (Division function Steps / Spell Power) C2/3EB3: E2 20 SEP #$20 (Set 8-bit Accumulator) C2/3EB5: EB XBA C2/3EB6: D0 11 BNE $3EC9 (If the top byte of quotient is nonzero, we know the final result will exceed 2 bytes, so leave it at 65535 and branch) C2/3EB8: 8A TXA C2/3EB9: EB XBA C2/3EBA: 8D B1 11 STA $11B1 (Store in Maximum Damage high byte) C2/3EBD: AD 66 18 LDA $1866 (Steps Low Byte) C2/3EC0: AE A6 11 LDX $11A6 (Spell Power) C2/3EC3: 20 92 47 JSR $4792 (Division function) C2/3EC6: 8D B0 11 STA $11B0 (Store in Maximum Damage low byte) C2/3EC9: 60 RTS
C2/3ECA special effect: weapon randomly breaks
(Ogre Nix - Weapon randomly breaks. Also uses MP for criticals) C2/3ECA: A5 B1 LDA $B1 C2/3ECC: 4A LSR C2/3ECD: B0 53 BCS $3F22 (Jump to code for attack with MP if bit 0 of $B1 is set) C2/3ECF: B9 A0 3A LDA $3AA0,Y C2/3ED2: 89 04 BIT #$04 C2/3ED4: D0 4C BNE $3F22 (Jump to code for attack with MP if bit 2 of $3AA0,Y is set) C2/3ED6: B9 F5 3B LDA $3BF5,Y (Load high byte of HP) C2/3ED9: EB XBA C2/3EDA: B9 F4 3B LDA $3BF4,Y (Load low byte of HP) C2/3EDD: A2 0A LDX #$0A C2/3EDF: 20 92 47 JSR $4792 (HP / 10. X = remainder, or the ones digit) C2/3EE2: E8 INX C2/3EE3: 8A TXA C2/3EE4: 20 65 4B JSR $4B65 (Random number 0 to last digit of HP) C2/3EE7: 3A DEC C2/3EE8: 10 38 BPL $3F22 (If number was not 0, branch) C2/3EEA: 98 TYA C2/3EEB: 4A LSR C2/3EEC: AA TAX (X = target [0, 1, 2, 3, etc]) C2/3EED: FE 30 2F INC $2F30,X (flag character's properties to be recalculated from his/her equipment at end of turn.) C2/3EF0: EB XBA C2/3EF1: A9 05 LDA #$05 C2/3EF3: 20 81 47 JSR $4781 (Multiplication function) C2/3EF6: 85 EE STA $EE (save target # * 5) C2/3EF8: BB TYX C2/3EF9: AD 70 3A LDA $3A70 (# of strikes remaining in attack. with Fight/Capture, this value is always odd when the right hand is striking, and even when the left is. unfortunately, that's not the case with Jump -- the hand used has nothing to do with the strike # (in fact, it's random when Genji Glove is worn) -- resulting in a bug where Ogre Nix fails to break when it should [as C2/3F0B will check the wrong hand].) C2/3EFC: 4A LSR (Carry = 1 for right hand, 0 for left) C2/3EFD: B0 07 BCS $3F06 (branch if right hand is attacking) C2/3EFF: E8 INX (point to left hand equipment slot) C2/3F00: A5 EE LDA $EE C2/3F02: 69 14 ADC #$14 C2/3F04: 85 EE STA $EE (point to the character's left hand in their menu data?) C2/3F06: 9E 68 3B STZ $3B68,X (zero this hand's Battle Power) C2/3F09: A6 EE LDX $EE C2/3F0B: BD 86 2B LDA $2B86,X (get item in this hand) C2/3F0E: C9 17 CMP #$17 C2/3F10: D0 10 BNE $3F22 (Branch if it's not Ogre Nix) C2/3F12: A9 FF LDA #$FF C2/3F14: 9D 86 2B STA $2B86,X (null this hand slot in the character's menu data) C2/3F17: 9D 87 2B STA $2B87,X C2/3F1A: 9E 89 2B STZ $2B89,X C2/3F1D: A9 44 LDA #$44 C2/3F1F: 8D 01 34 STA $3401 (Display weapon broke text) C2/3F22: A9 0C LDA #$0C (Special Effect 7 - Use MP for criticals - jumps here. Featured in weapons such as Rune Edge and Illumina.) C2/3F24: 85 EE STA $EE C2/3F26: A5 B2 LDA $B2 C2/3F28: 89 02 BIT #$02 C2/3F2A: D0 23 BNE $3F4F (Exit function if "No Critical and Ignore True Knight" is set) C2/3F2C: AD C9 3E LDA $3EC9 C2/3F2F: F0 1E BEQ $3F4F (Exit function if no targets) C2/3F31: 7B TDC (Clear 16-bit A) C2/3F32: 20 5A 4B JSR $4B5A (random #: 0 to 255) C2/3F35: 29 07 AND #$07 (now random #: 0 to 7) C2/3F37: 18 CLC C2/3F38: 65 EE ADC $EE (Add to $EE [#$0C]) C2/3F3A: C2 20 REP #$20 (Set 16-bit Accumulator) C2/3F3C: 85 EE STA $EE C2/3F3E: B9 08 3C LDA $3C08,Y (MP) C2/3F41: C5 EE CMP $EE C2/3F43: 90 0A BCC $3F4F (Exit function if weapon would drain more MP than the wielder currently has) C2/3F45: E5 EE SBC $EE C2/3F47: 99 08 3C STA $3C08,Y (MP - $EE) C2/3F4A: A9 00 02 LDA #$0200 C2/3F4D: 14 B2 TRB $B2 (Set always critical) C2/3F4F: 60 RTS
C2/3F50 special effect: use MP for criticals (unused)
C2/3F50: A9 1C LDA #$1C C2/3F52: 80 D0 BRA $3F24
C2/3F54 special effect: pearl wind
C2/3F54: A9 60 LDA #$60 C2/3F56: 0C A2 11 TSB $11A2 (Sets no split damage, and ignore defense) C2/3F59: 9C 14 34 STZ $3414 (Set to not modify damage) C2/3F5C: C2 20 REP #$20 C2/3F5E: B9 F4 3B LDA $3BF4,Y (HP) C2/3F61: 8D B0 11 STA $11B0 (Maximum Damage = HP) C2/3F64: 60 RTS
C2/3F65 special effect: golem
C2/3F65: C2 20 REP #$20 C2/3F67: B9 F4 3B LDA $3BF4,Y (HP) C2/3F6A: 8D 36 3A STA $3A36 (HP that Golem will absorb) C2/3F6D: 60 RTS
C2/3F6E special effect: soul sabre
C2/3F6E: A9 80 LDA #$80 C2/3F70: 0C A3 11 TSB $11A3 (Sets attack to Concern MP) C2/3F73: A9 08 LDA #$08 (Special Effect 5 - Drainer jumps here) C2/3F75: 0C A2 11 TSB $11A2 (Sets attack to heal undead) C2/3F78: A9 02 LDA #$02 C2/3F7A: 0C A4 11 TSB $11A4 (Sets attack to redirection) C2/3F7D: 60 RTS
C2/3F7E special effect: heal rod
C2/3F7E: A9 20 LDA #$20 C2/3F80: 0C A2 11 TSB $11A2 (Sets attack to ignore defense) C2/3F83: A9 01 LDA #$01 C2/3F85: 0C A4 11 TSB $11A4 (Sets attack to heal) C2/3F88: 60 RTS
C2/3F89 special effect: valiant knife
C2/3F89: A9 20 LDA #$20 C2/3F8B: 0C A2 11 TSB $11A2 (Sets attack to ignore defense) C2/3F8E: C2 20 REP #$20 C2/3F90: 38 SEC C2/3F91: B9 1C 3C LDA $3C1C,Y (Max HP) C2/3F94: F9 F4 3B SBC $3BF4,Y (HP) C2/3F97: 18 CLC C2/3F98: 6D B0 11 ADC $11B0 (Add Max HP - Current HP to damage) C2/3F9B: 8D B0 11 STA $11B0 C2/3F9E: 60 RTS
C2/3F9F special effect: wind slash
(Wind Slash - Tempest) C2/3F9F: 20 5A 4B JSR $4B5A (Random Number Function: 0 to 255) C2/3FA2: C9 80 CMP #$80 C2/3FA4: B0 10 BCS $3FB6 (50% chance exit function) C2/3FA6: 9C A6 11 STZ $11A6 (Clear Battle Power) C2/3FA9: A9 65 LDA #$65 (Wind Slash spell number) C2/3FAB: 80 03 BRA $3FB0
C2/3FAD special effect: magicite
(Magicite) C2/3FAD: 20 DC 37 JSR $37DC (Picks random Esper, not Odin or Raiden) C2/3FB0: 8D 00 34 STA $3400 (Save the spell number) C2/3FB3: EE 70 3A INC $3A70 (Increment the number of attacks remaining) C2/3FB6: 60 RTS
C2/3FB7 special effect: GP rain
C2/3FB7: B9 18 3B LDA $3B18,Y (Attacker's Level) C2/3FBA: EB XBA C2/3FBB: A9 1E LDA #$1E C2/3FBD: 20 81 47 JSR $4781 (attack will cost: Attacker's Level * 30) C2/3FC0: C2 20 REP #$20 (Set 16-bit accumulator) C2/3FC2: C0 08 CPY #$08 C2/3FC4: B0 0D BCS $3FD3 (Branch if attacker is monster) C2/3FC6: 20 B6 37 JSR $37B6 (deduct thrown gold from party's inventory) C2/3FC9: D0 1E BNE $3FE9 (branch if there was actually some GP to throw) C2/3FCB: 64 A4 STZ $A4 (Makes attack target nothing) C2/3FCD: A2 08 LDX #$08 C2/3FCF: 8E 01 34 STX $3401 (Set to display text 8 - "No money!!") C2/3FD2: 60 RTS C2/3FD3: 85 EE STA $EE (Level * 30) C2/3FD5: B9 98 3D LDA $3D98,Y (Gold monster gives) C2/3FD8: F0 F1 BEQ $3FCB (Miss all w/text if = 0) C2/3FDA: E5 EE SBC $EE C2/3FDC: B0 06 BCS $3FE4 (Branch if monster's gold >= Level * 30) C2/3FDE: B9 98 3D LDA $3D98,Y C2/3FE1: 85 EE STA $EE (if gold to consume was more than current gold, set $EE to current gold) C2/3FE3: 7B TDC C2/3FE4: 99 98 3D STA $3D98,Y (Set Gold to 0 or Gold - Level * 30) C2/3FE7: A5 EE LDA $EE (get amount of gold to consume) C2/3FE9: A2 02 LDX #$02 C2/3FEB: 86 E8 STX $E8 C2/3FED: 20 B7 47 JSR $47B7 (24-bit $E8 = A * 2) C2/3FF0: A5 E8 LDA $E8 (A = gold to consume * 2) C2/3FF2: AE C9 3E LDX $3EC9 (Number of targets) C2/3FF5: 20 92 47 JSR $4792 (A / number of targets) C2/3FF8: 8D B0 11 STA $11B0 (Sets maximum damage) C2/3FFB: 60 RTS
C2/3FFC special effect: exploder
C2/3FFC: BB TYX C2/3FFD: 64 BC STZ $BC C2/3FFF: A9 10 LDA #$10 C2/4001: 04 B0 TSB $B0 C2/4003: 9C 14 34 STZ $3414 (Set to not modify damage) C2/4006: C2 20 REP #$20 (Set 16-bit A) C2/4008: A5 A4 LDA $A4 (Load target hit) C2/400A: 48 PHA C2/400B: BD 18 30 LDA $3018,X C2/400E: 85 B8 STA $B8 C2/4010: 20 C2 57 JSR $57C2 C2/4013: 20 DB 63 JSR $63DB (Copy $An variables to ($78) buffer) C2/4016: A3 01 LDA $01,S C2/4018: 85 B8 STA $B8 C2/401A: 20 C2 57 JSR $57C2 C2/401D: 68 PLA C2/401E: 1D 18 30 ORA $3018,X C2/4021: 85 A4 STA $A4 C2/4023: BD F4 3B LDA $3BF4,X C2/4026: 8D B0 11 STA $11B0 (Sets damage to HP) C2/4029: 4C AD 35 JMP $35AD