øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1507.msg15074e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexa117-2.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&action=profile;area=showposts;sa=topics;u=169e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexa117-2.html.zx~™h^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ0Pd+:OKtext/htmlISO-8859-1gzip8:Ö+:ÿÿÿÿÿÿÿÿWed, 11 Mar 2020 08:12:07 GMT0ó°° ®0®P®€§²ð®~™h^ÿÿÿÿÿÿÿÿH)+: Increasing Esper Name length to 12 Letters

Author Topic: Increasing Esper Name length to 12 Letters  (Read 4155 times)

angelo26

  • Guard Leader
  • *
  • Posts: 44
    • View Profile
Increasing Esper Name length to 12 Letters
« on: December 08, 2010, 06:29:16 PM »
Hey Guys,

I've been trying to increase the esper names up to 12 letters, but I've run into a certain problem that I'm unsure of how to explain. I'll show a couple of pictures:

Ramuh (Name is displayed properly)


Ifrit (Name is not displayed properly)


Shiva Esper (Names are not displayed properly)


I believe I've found the code that messes up the esper names (when more than 9 letters or so)

Code: [Select]
C3/34F0: 0A ASL A
C3/34F1: 0A ASL A
C3/34F2: 0A ASL A
C3/34F3: AA TAX

C3/59BD: 0A ASL A
C3/59BE: 0A ASL A
C3/59BF: 0A ASL A
C3/59C0: AA TAX


To me it seems as if the game is introducing 4 to 5 extra spaces to each esper name, which messes up all names after ramuh.
In the Pics, terra has the Terrato Esper Equipped But I am unsure of what this code does at all apart from shifting bits to the left...Can anyone explain how this works so I can hopefully change it to display the esper names correctly? Thanks
« Last Edit: December 08, 2010, 06:45:31 PM by angelo26 »

Lenophis

  • Forum Overlord
  • *
  • Posts: 1,688
  • Gender: Male
  • I sad
    • View Profile
    • Slick Productions
Re: Increasing Esper Name length to 12 Letters
« Reply #1 on: December 08, 2010, 08:50:43 PM »
There's two routines to do esper names. There's one to do the giant list in the equip screen, and there's one for the individual screens.

Quote
Can anyone explain how this works so I can hopefully change it to display the esper names correctly?
Shifting left can be used for multiplying, and shifting right can be used for dividing. It's multiplying here. Can you guess how much it's multiplying by?

119 bugs fixed and counting.

angelo26

  • Guard Leader
  • *
  • Posts: 44
    • View Profile
Re: Increasing Esper Name length to 12 Letters
« Reply #2 on: December 08, 2010, 09:25:59 PM »
Ok each time a bit is shifted to the left in that particular code, 0A=10 so the game is multiplying by three times 10...it's then 1000?

What about the AA (TAX) part?

Vehek

  • Siren
  • *
  • Posts: 75
    • View Profile
Re: Increasing Esper Name length to 12 Letters
« Reply #3 on: December 08, 2010, 11:48:15 PM »
0A is the ASL opcode, not a value.
ASL mulitplies by 2. Can you figure it out now?

angelo26

  • Guard Leader
  • *
  • Posts: 44
    • View Profile
Re: Increasing Esper Name length to 12 Letters
« Reply #4 on: December 09, 2010, 12:35:04 AM »
I see now, thanks Vehek! they use three ASL to multiply by 2 each time, which equals the 8 characters used for esper names.

I was looking for some information and I came up with an idea on how to do this, please correct me if I'm wrong.

If I want the name of espers to be 12 characters, I need to use ASL 4 times. The command TAX transfers whatever we have on A to X, and then after that command can I use four consecutive DEX's to finally have the 12 characters?

And I will need to use a JSR/RTS as well.

The code may look like this:
Code: [Select]
20 ?? ??     JSR
0A     ASL
0A     ASL
0A     ASL
0A     ASL
AA     TAX
CA     DEX
CA     DEX
CA     DEX
CA     DEX
60             RTS

Thanks for the help and the patience :laugh:

Lenophis

  • Forum Overlord
  • *
  • Posts: 1,688
  • Gender: Male
  • I sad
    • View Profile
    • Slick Productions
Re: Increasing Esper Name length to 12 Letters
« Reply #5 on: December 09, 2010, 07:26:46 AM »
...No. DEX will decrement X by 1. -1

You need to do fancy stuff to multiply by 12, since you can't just shift to it. Lucky for you, the game does this elsewhere, so you can build off of that:
Code: [Select]
C3/5683: 48      PHA            (from only C3/565D)
C3/5684: 0A      ASL A          (multiply by 2)
C3/5685: 0A      ASL A          (multiply by 4)
C3/5686: 0A      ASL A          (mulitply by 8)
C3/5687: 85E0    STA $E0        (store * 8 multiplier)
C3/5689: 68      PLA
C3/568A: 0A      ASL A          (multiply by 2)
C3/568B: 0A      ASL A          (multiply by 4)
C3/568C: 18      CLC            (shifting should've taken care of carry)
C3/568D: 65E0    ADC $E0        (add both and the multiplier is 12)
C3/568F: AA      TAX            (transfer multiplier to X)
C3/5690: A08B9E  LDY #$9E8B
C3/5693: 8C8121  STY $2181
C3/5696: A00A00  LDY #$000A
C3/5699: DA      PHX
C3/569A: BF407AC4 LDA $C47A40,X  (Load blitz specification character)
C3/569E: 0A      ASL A
C3/569F: AA      TAX
C3/56A0: BF1C5CC3 LDA $C35C1C,X  (blitz character determines which number to get from the font for display)
C3/56A4: 8D8021  STA $2180
C3/56A7: E8      INX
C3/56A8: BF1C5CC3 LDA $C35C1C,X  (20 is normal
                                                A0 is vertical flip
                                                60 is horizontal flip
                                                C0 is vertical and horizontal flip)
C3/56AC: 8D8021  STA $2180
C3/56AF: E8      INX
C3/56B0: FA      PLX            (the previous INX is pointless)
C3/56B1: E8      INX
C3/56B2: 88      DEY
C3/56B3: D0E4    BNE $5699
C3/56B5: 9C8021  STZ $2180      (end this string)
C3/56B8: 9C8021  STZ $2180      (end this string)
C3/56BB: 60      RTS

119 bugs fixed and counting.

angelo26

  • Guard Leader
  • *
  • Posts: 44
    • View Profile
Re: Increasing Esper Name length to 12 Letters
« Reply #6 on: December 11, 2010, 10:24:26 AM »
Ok I see. Thanks Lenophis! I've been trying to modify the code and it works almost completely, except for a glitch. I made these changes to the code:

Code: [Select]
C3/34F0: 20 91 F0  JSR $F091
C3/34F3: AA TAX

C3/59BD: 20 91 F0  JSR $F091
C3/59C0: AA TAX

C3/F091: 48      PHA           
C3/F092: 0A      ASL A          (multiply by 2)
C3/F093: 0A      ASL A          (multiply by 4)
C3/F094: 0A      ASL A          (mulitply by 8)
C3/F095: 85E0    STA $E0        (store * 8 multiplier)
C3/F097: 68      PLA
C3/F098: 0A      ASL A          (multiply by 2)
C3/F099: 0A      ASL A          (multiply by 4)
C3/F09A: 18      CLC            (shifting should've taken care of carry)
C3/F09B: 65E0    ADC $E0        (add both and the multiplier is 12)
C3/F09D: 60      RTS 


I got most names to display correctly except for Golem, Unicorn, Fenrir, Starlet (Lakshmi) and Phoenix. It looks like as if after Seraphim, it starts looking at the start of the esper list again to display more names. (Pictures of the issue are below)



 The only thing I could think of is that somewhere in the code, the letters for esper names are still 8. I double checked the code and made sure all references in the code to esper names are updated from 08 to 0C no. And I also tried changing the code for the 12 letters but what I show is the one that gets me veery close to what I want. Anyone has any ideas?


Thanks a lot for the time and patience :sad:





Lenophis

  • Forum Overlord
  • *
  • Posts: 1,688
  • Gender: Male
  • I sad
    • View Profile
    • Slick Productions
Re: Increasing Esper Name length to 12 Letters
« Reply #7 on: December 11, 2010, 11:25:10 AM »
The only thing I could think of is that somewhere in the code, the letters for esper names are still 8.
There's two routines to do esper names. There's one to do the giant list in the equip screen, and there's one for the individual screens.
:picard:

119 bugs fixed and counting.

angelo26

  • Guard Leader
  • *
  • Posts: 44
    • View Profile
Re: Increasing Esper Name length to 12 Letters
« Reply #8 on: December 14, 2010, 12:21:46 PM »
Yes sir, I believe you're referring to these instances in the code:
Code: [Select]
C3/34F0: 0A      ASL A                                                CHANGED
C3/34F1: 0A      ASL A                                                CHANGED
C3/34F2: 0A      ASL A                                                CHANGED
C3/34F3: AA      TAX
C3/34F4: A00800  LDY #$0008     (esper name length)    CHANGED TO A00C00
C3/34F7: BFE1F6E6 LDA $E6F6E1,X  (Load Esper name)     CHANGED

C3/3508: A00800  LDY #$0008                                         CHANGED TO A00C00
C3/350B: A9FF    LDA #$FF
C3/350D: 8D8021  STA $2180      (blank esper name)
C3/3510: 88      DEY            (have we done 8 letters yet?)
C3/3511: D0FA    BNE $350D      (branch if not)
C3/3513: 9C8021  STZ $2180      (end this string)
C3/3516: 4CD97F  JMP $7FD9

Code: [Select]
C3/54FA: A00800  LDY #$0008      (esper name length)            CHANGED TO A00C00
C3/54FD: 84EB    STY $EB
C3/54FF: A0E1F6  LDY #$F6E1      (esper name address)          CHANGED
C3/5502: 84EF    STY $EF
C3/5504: A9E6    LDA #$E6        (esper name bank)                CHANGED
C3/5506: 85F1    STA $F1
C3/5508: 60      RTS

C3/555D: A00C00  LDY #$000C     (esper name is 8 letters, 1 for space, 3 more for MP cost) CHANGED TO A01000

Code: [Select]
C3/59BD: 0A      ASL A          CHANGED
C3/59BE: 0A      ASL A          CHANGED
C3/59BF: 0A      ASL A          CHANGED
C3/59C0: AA      TAX           
C3/59C1: A00800  LDY #$0008 (Indirectly says below is 8 chars long)   CHANGED TO A00C00
C3/59C4: BFE1F6E6 LDA $E6F6E1,X (Load Esper X's name)                                   CHANGED

Are there any other instances in the code that handles esper names? I've looked and I can't seem to find anything else...

Lenophis

  • Forum Overlord
  • *
  • Posts: 1,688
  • Gender: Male
  • I sad
    • View Profile
    • Slick Productions
Re: Increasing Esper Name length to 12 Letters
« Reply #9 on: December 14, 2010, 01:14:34 PM »
There's code in C1, and I think that's all of it.

119 bugs fixed and counting.

darkmage

  • Phantom Train
  • *
  • Posts: 339
  • Skating the Razor
    • View Profile
Re: Increasing Esper Name length to 12 Letters
« Reply #10 on: December 21, 2010, 04:27:59 PM »
Glad to see my patch is already in use, flawed though it may be.  :happy:

angelo26

  • Guard Leader
  • *
  • Posts: 44
    • View Profile
Re: Increasing Esper Name length to 12 Letters
« Reply #11 on: December 27, 2010, 02:15:21 PM »
Glad to see my patch is already in use, flawed though it may be.  :happy:
Thanks for your efforts on the patch, darkmage.

There's code in C1, and I think that's all of it.

 :hmm: I was wondering if the esper names have some kind of space limitation in the rom?  The reason for me concluding that there's a limit is because, while messing around to see if esper names could be increased to 16 letters long each, I can only get 16 of the 27 names to display correctly on the menu. 16 espers times 16 letters gives 256 total characters.

If the names are 12 letters long, then only 22 of the 27 esper names are properly displayed (because the 256 limit is exceeded). And since the game originally uses 8 letters per esper, there's a total of 217 letters., which gives no problem at the time of displaying the names.

Thanks for the help and Happy Holidays

Lenophis

  • Forum Overlord
  • *
  • Posts: 1,688
  • Gender: Male
  • I sad
    • View Profile
    • Slick Productions
Re: Increasing Esper Name length to 12 Letters
« Reply #12 on: December 27, 2010, 02:48:36 PM »
It's a problem if the indexing goes beyond the 8-bit range while the index register is still in 8-bit mode. For example:

Code: [Select]
Esper name displaying in most menus (this is not used to generate the esper list!)
C3/34E6: 201935  JSR $3519
C3/34E9: B91E00  LDA $001E,Y
C3/34EC: C9FF    CMP #$FF
C3/34EE: F018    BEQ $3508      (branch if no esper equipped)
C3/34F0: 0A      ASL A
C3/34F1: 0A      ASL A
C3/34F2: 0A      ASL A
C3/34F3: AA      TAX
C3/34F4: A00800  LDY #$0008     (esper name length)
C3/34F7: BFE1F6E6 LDA $E6F6E1,X  (Load Esper name)
C3/34FB: 8D8021  STA $2180
C3/34FE: E8      INX
C3/34FF: 88      DEY
C3/3500: D0F5    BNE $34F7
C3/3502: 9C8021  STZ $2180      (end this string)
C3/3505: 4CD97F  JMP $7FD9
A is 8-bit, while X and Y are 16-bit. Now imagine if it read like this:
Code: [Select]
Esper name displaying in most menus (this is not used to generate the esper list!)
C3/34E6: 201935  JSR $3519
C3/34E9: B91E00  LDA $001E,Y
C3/34EC: C9FF    CMP #$FF
C3/34EE: F018    BEQ $3508      (branch if no esper equipped)
C3/34F0: 0A      ASL A
C3/34F1: 0A      ASL A
C3/34F2: 0A      ASL A
C3/34F3: AA      TAX
C3/34F4: A008  LDY #$08     (esper name length)
C3/34F7: BFE1F6E6 LDA $E6F6E1,X  (Load Esper name)
C3/34FB: 8D8021  STA $2180
C3/34FE: E8      INX
C3/34FF: 88      DEY
C3/3500: D0F5    BNE $34F7
C3/3502: 9C8021  STZ $2180      (end this string)
C3/3505: 4CD97F  JMP $7FD9
Here, X and Y are 8-bit, which means any number greater than 255 would wrap back to 0, giving bad look-ups. There's no such thing as a "rom limit," only hardware limitations, and amount of effort you're willing to put into it.

119 bugs fixed and counting.

angelo26

  • Guard Leader
  • *
  • Posts: 44
    • View Profile
Re: Increasing Esper Name length to 12 Letters
« Reply #13 on: December 30, 2010, 03:35:19 PM »
Ok then if ASL is 8-bit and I need to make it compatible with X and Y, right?

While looking through some code I saw that the code to do the ASL for two bytes is

06F0   ASL $F0

But I'm unsure if it works the same way as the one bit ASL? Also, what is the function of F0 in that piece of code?


angelo26

  • Guard Leader
  • *
  • Posts: 44
    • View Profile
Re: Increasing Esper Name length to 12 Letters
« Reply #14 on: January 08, 2011, 08:50:58 PM »
I think I finally managed to do this, I'm so happy lol

What needed to be done is to increase only the accumulator capacity from 8 bits to 16 bits using the command C2 20, then include the code to multiply by 12 and after the multiplier is stored, the accumulator needs to be returned to a capacity of 8 bits using E2 20.

I'm testing to see if nothing's messed up, but everything seems fine so far...