FF6 Hacking
Pony Fantasy VI Remake - Printable Version

+- FF6 Hacking (https://www.ff6hacking.com/forums)
+-- Forum: Discussion Forums (https://www.ff6hacking.com/forums/forum-5.html)
+--- Forum: Dragons' Den (https://www.ff6hacking.com/forums/forum-13.html)
+--- Thread: Pony Fantasy VI Remake (/thread-3106.html)



RE: Pony Fantasy VI Remake - seibaby - 08-07-2016

Copy the entire text in the code tag to a text editor, then change the !freespace address to an area of your ROM where you're sure you have enough free space for the code (21 bytes, if I counted correctly), and save it as an .asm file.

Comment or uncomment the "header" line in the asm depending on whether your rom has a header or not. Then use xkas 0.06 to apply the patch to your ROM.

Using xkas is as simple as putting the asm file, your ROM, and xkas.exe in the same folder, opening a command prompt, and typing "xkas asmfile.asm romfile.smc". Obviously backup your ROM first.


RE: Pony Fantasy VI Remake - DrakeyC - 08-07-2016

Says Line 15 invalid.

Code:
hirom
;header
!freespace = $C0D960

;(Put attacker level [or Sketcher if applicable] in $11AF) (Modified by Synchysi)
org $C22C21
PHX                  
LDA $3417       ;(Get Sketcher)
JSR newfunc     ;(New function)
LDA $3B18,x     ;(Level)
STA $11AF       ;(Level)
PLX                    
RTS                  

org !freespace



RE: Pony Fantasy VI Remake - madsiur - 08-07-2016

(08-06-2016, 09:39 PM)seibaby Wrote: Ya'll wanted a Sketch improvement patch?

Neat! I was going to do something similar but lacked the motivation yesterday.

(08-07-2016, 06:35 AM)DrakeyC Wrote: Says Line 15 invalid.

What is the error message?

try org $C0D960 instead of org !freespace. Make sure the following line is newfunc:


RE: Pony Fantasy VI Remake - DrakeyC - 08-07-2016

error: Sketch.asm: line 15: define not declared (yet?)
error: Sketch.asm: line 15: invalid opcode or command [org]
error: Sketch.asm: line 15: define not declared (yet?)

Your fix did not work.


RE: Pony Fantasy VI Remake - madsiur - 08-07-2016

You no longer have a define at line 15 if you changed !freespace to $C0D960. Also org is recognized by all xkas version so you are doing something wrong and the problem is not the original code. The first thing that would have needed to be done is check what is at line 15 and post that line. Notepad++ shows the line numbers.

But as I said, I don't think line 15 is the problem.


RE: Pony Fantasy VI Remake - seibaby - 08-07-2016

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.
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



RE: Pony Fantasy VI Remake - madsiur - 08-07-2016

So I thought xkas (0.06 at least) was interpreting JSR $XXXXXX as a JSL and JSL $XXXX as a JSR... or is it only one of the two.. or none? That doesn't really make sense anyway now that I think of it so I'll shut up.


RE: Pony Fantasy VI Remake - seibaby - 08-07-2016

(08-07-2016, 11:33 AM)Madsiur Wrote: So I thought xkas (0.06 at least) was interpreting JSR $XXXXXX as a JSL and JSL $XXXX as a JSR... or is it only one of the two.. or none? That doesn't really make sense anyway now that I think of it so I'll shut up.

You know, I'm really not sure. But xkas does some weird things so I wouldn't be surprised. If it silently accepted a JSR long as a JSL long, then the result would be four bytes, and the following LDA $3B18,X would be corrupted into a CLC/TSC instead. Which would cause whatever's on the stack to be used as the attack's level, but not result in the problem DrakeyC had. Not sure what caused THAT without seeing the exact code he used.


RE: Pony Fantasy VI Remake - DrakeyC - 08-07-2016

Put it a $C266F0, plenty of room. Made sure Rom had a header and the .asm did too. Assembled it, seemed to work. Tested in-game, no effect.

Code:
hirom
;header
!freespace = $C266F0

;(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



RE: Pony Fantasy VI Remake - seibaby - 08-07-2016

(08-07-2016, 06:13 PM)DrakeyC Wrote: Put it a $C266F0, plenty of room. Made sure Rom had a header and the .asm did too. Assembled it, seemed to work. Tested in-game, no effect.

EDIT - Durr, didn't notice updated code. Hang on.

(08-07-2016, 06:13 PM)DrakeyC Wrote:
Code:
;header

It's the same code, just relocated to C0 where you tried to locate it the first time. Both versions work fine on my end. If your ROM has a header, you need to uncomment the header line. Remove the semicolon in front of it.