Learning Magic
#7
(06-30-2012, 10:49 PM)Edrin Wrote: Ok, so what about editing the current code to reuse the same 12 lists by using the remainder of the actor number devided by twelve to choose what address to look for? Shared magic is better than none. All I need is the location of the code for both read and write for battle and menu. I think I can figure out the rest.

I think you will have to change code in 3 places. First, you will ne to change when the magic list is populated for battle (bank C2). Second you will need to change when the magic is saved after a battle (bank C2) and third, when magic is read for the menu outside battle (bank C3).

Here is your entrance door for saving magic. Routines $6283 and$ 602A are where those changes need to be I think but I haven't found explicitly where is it read and save to the RAM:

Code:
C2/5E60: 20 83 62     JSR $6283   (Stores address for spells known by character in $F4)
C2/5E63: BE 10 30     LDX $3010,Y (get offset to character info block)
C2/5E66: 5A           PHY
C2/5E67: 20 EF 5F     JSR $5FEF   (Cursed Shield check)
C2/5E6A: BD 1E 16     LDA $161E,X (Esper equipped)
C2/5E6D: 30 03        BMI $5E72   (Branch if no esper equipped)
C2/5E6F: 20 2A 60     JSR $602A   (Learn spells taught by esper)


I'm still not sure but this is partially where the magic menu might be populated:

Code:
C2/56DC: C2 21        REP #$21     (Set 16-bit A, clear Carry)
C2/56DE: 69 6E 1A     ADC #$1A6E
C2/56E1: 85 F0        STA $F0

As for bank C3 I found not 1 but 2 places where magic spell list is read:

Code:
Get spell's learned amount, or, if it's Gogo, branch below to check everybody
else in the party.
C3/50A2:    85E0        STA $E0
C3/50A4:    20DD4E      JSR $4EDD
C3/50A7:    B90000      LDA $0000,Y
C3/50AA:    C90C        CMP #$0C
C3/50AC:    F017        BEQ $50C5     (Branch if it's Gogo)
C3/50AE:    8D0242      STA $4202
C3/50B1:    A936        LDA #$36
C3/50B3:    8D0342      STA $4203
C3/50B6:    7B          TDC
C3/50B7:    A5E0        LDA $E0
C3/50B9:    C220        REP #$20      (16 bit memory/accum.)
C3/50BB:    6D1642      ADC $4216
C3/50BE:    AA          TAX
C3/50BF:    E220        SEP #$20      (8 bit memory/accum.)
C3/50C1:    BD6E1A      LDA $1A6E,X
C3/50C4:    60          RTS

Code:
Determine if a character actually knows magic
C3/0D2B:    AD691A      LDA $1A69      (from C3/0CB7)
C3/0D2E:    0D6A1A      ORA $1A6A
C3/0D31:    0D6B1A      ORA $1A6B
C3/0D34:    0D6C1A      ORA $1A6C
C3/0D37:    D02A        BNE $0D63      (branch if you have at least one esper)
C3/0D39:    A667        LDX $67
C3/0D3B:    7B          TDC
C3/0D3C:    BD0000      LDA $0000,X    (character ID)
C3/0D3F:    C90C        CMP #$0C
C3/0D41:    F020        BEQ $0D63      (Branch if it's Gogo)
C3/0D43:    B01C        BCS $0D61      (Branch if it's Umaro or higher)
C3/0D45:    8D0242      STA $4202      (we're here if character is below Gogo, and you have no espers)
C3/0D48:    A936        LDA #$36
C3/0D4A:    8D0342      STA $4203      (#$36 as multiplier)
C3/0D4D:    EA          NOP
C3/0D4E:    EA          NOP
C3/0D4F:    EA          NOP
C3/0D50:    A03600      LDY #$0036     (TAY?)
C3/0D53:    AE1642      LDX $4216      (load character * spell total)
C3/0D56:    BD6E1A      LDA $1A6E,X    (load spell at X)
C3/0D59:    C9FF        CMP #$FF       (learned it?)
C3/0D5B:    F006        BEQ $0D63      (branch if so)
C3/0D5D:    E8          INX
C3/0D5E:    88          DEY
C3/0D5F:    D0F5        BNE $0D56      (branch if we haven't checked every spell)
C3/0D61:    18          CLC            (used by C3/0C6C, says that this character doesn't know magic)
C3/0D62:    60          RTS

I found all that code by doing a search for "1A6E" in bank C2 and C3, which is the starting offset of the magic list for character 00. I can't really help you more than this, as I am a bit unfamiliar with all that code.
Reply


Messages In This Thread
Learning Magic - by B-Run - 06-28-2012, 12:34 PM
RE: Learning Magic - by madsiur - 06-28-2012, 07:01 PM
RE: Learning Magic - by B-Run - 06-28-2012, 08:19 PM
RE: Learning Magic - by madsiur - 06-28-2012, 10:24 PM
RE: Learning Magic - by B-Run - 06-29-2012, 09:07 AM
RE: Learning Magic - by B-Run - 06-30-2012, 10:49 PM
RE: Learning Magic - by madsiur - 07-01-2012, 08:24 AM
RE: Learning Magic - by B-Run - 07-01-2012, 10:09 PM
RE: Learning Magic - by Angelo26 - 07-01-2012, 11:26 PM
RE: Learning Magic - by madsiur - 07-01-2012, 11:42 PM
RE: Learning Magic - by B-Run - 07-01-2012, 11:47 PM
RE: Learning Magic - by madsiur - 07-02-2012, 12:00 AM
RE: Learning Magic - by B-Run - 07-05-2012, 07:38 PM
RE: Learning Magic - by Synchysi - 07-05-2012, 09:05 PM
RE: Learning Magic - by B-Run - 07-05-2012, 09:32 PM
RE: Learning Magic - by Synchysi - 07-05-2012, 10:33 PM
RE: Learning Magic - by B-Run - 07-06-2012, 07:40 AM
RE: Learning Magic - by B-Run - 07-07-2012, 02:32 PM
RE: Learning Magic - by B-Run - 07-13-2012, 05:59 PM
RE: Learning Magic - by SSJ Rick - 07-13-2012, 06:06 PM
RE: Learning Magic - by B-Run - 07-13-2012, 07:16 PM
RE: Learning Magic - by SSJ Rick - 07-13-2012, 07:23 PM
RE: Learning Magic - by B-Run - 07-13-2012, 08:26 PM
RE: Learning Magic - by Angelo26 - 07-13-2012, 08:56 PM
RE: Learning Magic - by B-Run - 07-14-2012, 07:25 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Add learning new spells doofenH 11 9,034 02-13-2020, 08:02 PM
Last Post: C-Dude
  Lets discuss the Lore magic or magic menus in general JCE3000GT 0 1,860 05-20-2017, 08:49 PM
Last Post: JCE3000GT
  Questions: Learning magic for PC's 12-16 Zozma 8 7,241 11-26-2015, 05:39 PM
Last Post: Zozma
  Gau: Automatic Rage Learning aatc85 9 10,914 11-30-2013, 10:48 PM
Last Post: aatc85
  Esper Learning Rate HELP! Snap006 3 3,839 11-13-2013, 12:01 AM
Last Post: madsiur
  learning new Lore magic? xeblon 3 4,195 07-06-2013, 01:34 PM
Last Post: xeblon

Forum Jump:


Users browsing this thread: 1 Guest(s)