Users browsing this thread: 1 Guest(s)
Pony Fantasy VI Remake
JSR can only call functions within the same bank, and newfunc is called from within C2. Hence, you have to restrict the !freespace define to within C2, or rewrite the code to use a long jump instead.
Edit: like so. Note that this requires 24 free bytes instead of 21.
Edit: like so. Note that this requires 24 free bytes instead of 21.
Code:
hirom
;header
!freespace = $C0D960
;(Put attacker level [or Sketcher if applicable] in $11AF) (Modified by Synchysi)
org $C22C21
PHX
LDA $3417 ;(Get Sketcher)
JSL newfunc ;(New function)
NOP #2
STA $11AF ;(Level)
PLX
RTS
org !freespace
newfunc:
;(original code)
BMI exit ;(Branch if no Sketcher)
TAX ;(if there's a valid Sketcher, use their Level
;for attack)
;(end original code)
;(new code)
LDA $11A2 ;(Spell Properties)
LSR A ;(Check if Physical/Magical)
LDA $3B41,x ;(Sketcher's Mag.Pwr)
BCC magical ;(Branch if not physical damage)
;physical
CLC
ADC $3B2C,Y ;(Target's Vigor? [not sure if doubled, but shouldn't be, for monsters])
LSR A ;(A = [Sketcher's Magic + Sketchee's Vigor] / 2)
;add overflow check and cap here
magical:
STA $11AE ;(Set Attacker's Magic or Vigor)
exit:
LDA $3B18,x ;(Level)
RTL
« Next Oldest | Next Newest »
Users browsing this thread: 1 Guest(s)