Users browsing this thread: 1 Guest(s)
Edit Step Mine's MP

#1
Posts: 145
Threads: 47
Thanks Received: 0
Thanks Given: 0
Joined: Jan 2020
Reputation: 0
Status
None
Code:
Fork: Step Mine
C3/511A:    68          PLA            ; Spell
C3/511B:    C999        CMP #$99       ; Step Mine?
C3/511D:    D00F        BNE $512E      ; Branch if not
C3/511F:    AD1B02      LDA $021B      ; Hours played
C3/5122:    0A          ASL A          ; Double them
C3/5123:    85E0        STA $E0        ; Set MP cost
C3/5125:    AD1C02      LDA $021C      ; Minutes played
C3/5128:    C91E        CMP #$1E       ; Under 30?
C3/512A:    9002        BCC $512E      ; Branch if so
C3/512C:    E6E0        INC $E0        ; MP cost +1

Changing C3/5128, C91E to C93C, should change the formula of Step Mine cost to be divided by 60, but nothing happened. What went wrong? 

Also alternatively, how to fixed the Step Mine's MP like normal spell? OR, force the enemy to use the same MP cost as we do, instead of 1 MP?
  Find
Quote  

#2
Posts: 178
Threads: 2
Thanks Received: 23
Thanks Given: 4
Joined: Apr 2015
Reputation: 18
Status
None
What you posted is the code that calculates MP cost in the menu. If you want to change the MP cost in battle I believe you need to modify this code instead:

Code:
C2/566E: E0 44 00     CPX #$0044      ; step mine
C2/5671: D0 09        BNE $567C
C2/5673: AD 64 18     LDA $1864       ; minutes / 30
C2/5676: C9 1E        CMP #$1E
C2/5678: AD 63 18     LDA $1863
C2/567B: 2A           ROL
C2/567C: 99 91 20     STA $2091,Y     ; set mp cost

To make this work like a normal spell, you can just replace the BNE with BRA. You will also need to modify the MP cost in spell properties.

To make it divide by 60 instead of 30, just replace the ROL with NOP. It's not literally dividing by 30 here, this is just some asm trickery that multiplies hours by 2 and then adds 1 if the minutes are 30 or greater.
  Find
Quote  
[-] The following 1 user says Thank You to Everything for this post:
  • doofenH (05-10-2022)

#3
Posts: 145
Threads: 47
Thanks Received: 0
Thanks Given: 0
Joined: Jan 2020
Reputation: 0
Status
None
(05-10-2022, 09:27 AM)Everything Wrote: What you posted is the code that calculates MP cost in the menu. If you want to change the MP cost in battle I believe you need to modify this code instead:

Code:
C2/566E: E0 44 00     CPX #$0044      ; step mine
C2/5671: D0 09        BNE $567C
C2/5673: AD 64 18     LDA $1864       ; minutes / 30
C2/5676: C9 1E        CMP #$1E
C2/5678: AD 63 18     LDA $1863
C2/567B: 2A           ROL
C2/567C: 99 91 20     STA $2091,Y     ; set mp cost

To make this work like a normal spell, you can just replace the BNE with BRA. You will also need to modify the MP cost in spell properties.

To make it divide by 60 instead of 30, just replace the ROL with NOP. It's not literally dividing by 30 here, this is just some asm trickery that multiplies hours by 2 and then adds 1 if the minutes are 30 or greater.

I will go with turning it into normal spell. However, the menu still display the original MP formula. How to change that?
  Find
Quote  

#4
Posts: 178
Threads: 2
Thanks Received: 23
Thanks Given: 4
Joined: Apr 2015
Reputation: 18
Status
None
At C3/511D, try changing BNE to BRA.
  Find
Quote  

#5
Posts: 145
Threads: 47
Thanks Received: 0
Thanks Given: 0
Joined: Jan 2020
Reputation: 0
Status
None
(05-10-2022, 04:26 PM)Everything Wrote: At C3/511D, try changing BNE to BRA.

It work. thk.

Quote:To make this work like a normal spell, you can just replace the BNE with BRA. You will also need to modify the MP cost in spell properties.

To make it divide by 60 instead of 30, just replace the ROL with NOP. It's not literally dividing by 30 here, this is just some asm trickery that multiplies hours by 2 and then adds 1 if the minutes are 30 or greater.

Simple question. How does replacing ROL with NOP suddenly divide Step Mine by twice? What if I want the multiplies hours by 3 or 5?
  Find
Quote  

#6
Posts: 178
Threads: 2
Thanks Received: 23
Thanks Given: 4
Joined: Apr 2015
Reputation: 18
Status
None
ROL effectively multiplies the number of hours by 2, which is the same as minutes / 30. Replacing it with NOP just uses the number of hours, which is the same as minutes / 60. The shift instructions on the 65816 (LSR, ASL, ROR, ROL) are useful for multiplying and dividing by powers of 2. Multiplying and dividing by other numbers is not as simple. The SNES can also do hardware multiplication and division which is often faster than using the CPU, though there are some restrictions.

There are a few subroutines in the FF6 code that can do generic multiplication and division. For example, C1/18D9 and C2/4781 both do unsigned hardware multiplication.
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite