øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1837.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexfa7a.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&board=8.180e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexfa7a.html.zx<&h^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈà•¤ÞOKtext/htmlISO-8859-1gzip0|ÖÞÿÿÿÿÿÿÿÿWed, 11 Mar 2020 00:00:20 GMT0ó°° ®0®P®€§²ð®;&h^ÿÿÿÿÿÿÿÿ‰ Þ FF6 Overworld sprite pointers

Author Topic: FF6 Overworld sprite pointers  (Read 2846 times)

Edrin

  • Ymir
  • *
  • Posts: 12
    • View Profile
FF6 Overworld sprite pointers
« on: June 19, 2013, 08:42:23 AM »
So I'm trying to track down the overworld sprite pointers in an attempt to increase the total number of PC sprite sheets available. I've been able to get new sheets working in battle, but I can't find the overworld pointer list so that I can add new entries. Anyone know where these can be found? I have been trying to track them down in C0, perhaps around the code for the event queue commands... but it all looks like logic to me instead of display.

Lenophis

  • Forum Overlord
  • *
  • Posts: 1,688
  • Gender: Male
  • I sad
    • View Profile
    • Slick Productions
Re: FF6 Overworld sprite pointers
« Reply #1 on: June 19, 2013, 10:00:04 AM »
No such "list" exists for the world map. Anything involving the world map is going to be in bank EE.

119 bugs fixed and counting.

Edrin

  • Ymir
  • *
  • Posts: 12
    • View Profile
Re: FF6 Overworld sprite pointers
« Reply #2 on: June 19, 2013, 03:03:01 PM »
Does that apply to towns and such as well?

Madsiur

  • Tunnel Armor
  • *
  • Posts: 149
  • Gender: Male
  • FF6AE coder
    • View Profile
    • Madsiur's Lair
Re: FF6 Overworld sprite pointers
« Reply #3 on: June 19, 2013, 09:02:31 PM »
For the leader, the sprite displayed on the map, the slot number found with the party data is used to get the sprite ID from the character. I don't really see how you could add easily a slot. There are 16 slots in the party data and 16 character info blocks in the RAM. Same logic apply for party leader in towns. As for NPC, they work differently, but I know little about their loading process.

Code: [Select]
EE/030B: B95018  LDA $1850,Y    (Party information for the current character)
EE/030E: 8940    BIT #$40       (Is the character available?)
EE/0310: F017    BEQ $0329      (Branch if not)
EE/0312: 2907    AND #$07       (Isolate the party number for the character)
EE/0314: CD6D1A  CMP $1A6D      (Compare to the number of the active party)
EE/0317: D010    BNE $0329      (Branch if not equal)
EE/0319: B95018  LDA $1850,Y    (Party information for the current character)
EE/031C: 4A      LSR A          (Divide by 2)
EE/031D: 4A      LSR A          (Divide by 4)
EE/031E: 4A      LSR A          (Divide by 8)
EE/031F: 2903    AND #$03       (Isolate the character's position in the party)
EE/0321: C558    CMP $58        (Compare to the value of the general-purpose variable)
EE/0323: B004    BCS $0329      (Branch if equal or greater)
EE/0325: 8558    STA $58        (Store the position number to said variable)
EE/0327: 845A    STY $5A        (Store the character number to another such variable)
EE/0329: C8      INY            (Point to next character)
EE/032A: C01000  CPY #$0010     (Processed all 16 character slots?)
EE/032D: D0DC    BNE $030B      (Loop if not)
EE/032F: A55A    LDA $5A        (Slot number for leader)
EE/0331: 8D0242  STA $4202      (Save as multiplicand A)
EE/0334: A925    LDA #$25       (Number of bytes per character in SRAM)
EE/0336: 8D0342  STA $4203      (Set multiplier B to 37)
EE/0339: EA      NOP
EE/033A: EA      NOP
EE/033B: EA      NOP
EE/033C: AE1642  LDX $4216      (Load X with the product)
EE/033F: BD0116  LDA $1601,X    (Sprite number of leader)
« Last Edit: June 19, 2013, 09:22:59 PM by Madsiur »

Vehek

  • Siren
  • *
  • Posts: 75
    • View Profile
Re: FF6 Overworld sprite pointers
« Reply #4 on: June 19, 2013, 09:48:20 PM »
Was that really what Edrin was asking? I don't see what PC slots have to do with this. I thought Edrin was expanding sprite sheets to player character-completeness.

The sprite pointers in towns and the overworld are split up. The lower 16-bit offsets are at 0xD0F2 while the bank byte and another value are at 0xD23C.

I don't know where this routine is used, but it's the only one in the disassembly that labels what these particular offsets are.
Code: [Select]
C0/69A3: BFF3D0C0 LDA $C0D0F3,X (Loads pointer to Map character graphcis)
C0/69A7: 852B    STA $2B
C0/69A9: 852E    STA $2E
C0/69AB: 8531    STA $31
C0/69AD: 8534    STA $34
C0/69AF: BF3CD2C0 LDA $C0D23C,X (Bank pointers and Number of Bytes to Copy per Tile for Map Char Gfx)
C0/69B3: 852C    STA $2C
C0/69B5: 852F    STA $2F
C0/69B7: 8532    STA $32
C0/69B9: 8535    STA $35

The routine for the behind-view sprite used when riding a chocobo is in bank $EE. It does not access a pointer table, instead calculating an address based on the assumption that all sheets are 0x16A0 bytes long.

Code: (Novalia's Disassembly: Overworld chocobo rider sprite) [Select]
EE/8943: ADFB11  LDA $11FB      (Sprite number for map character)
EE/8946: 8D0242  STA $4202      (Save as multiplicand)
EE/8949: A9A0    LDA #$A0
EE/894B: 8D0342  STA $4203      (Set multiplier to 160)
EE/894E: EA      NOP
EE/894F: EA      NOP
EE/8950: EA      NOP
EE/8951: AE1642  LDX $4216      (Product)
EE/8954: 866A    STX $6A        (Save the address temporarily)
EE/8956: A916    LDA #$16
EE/8958: 8D0342  STA $4203      (Set multiplier to 22)
EE/895B: EA      NOP
EE/895C: EA      NOP
EE/895D: EA      NOP
EE/895E: AD1642  LDA $4216      (Load low byte of product)
EE/8961: 18      CLC            (Clear Carry for addition)
EE/8962: 656B    ADC $6B        (Add middle byte of address)
EE/8964: 856B    STA $6B        (Save updated address)
EE/8966: AD1742  LDA $4217      (Load high byte of product)
EE/8969: 656C    ADC $6C        (Add to high byte of address)
EE/896B: 856C    STA $6C        (Save updated address)
EE/896D: 18      CLC            (Clear Carry for addition)
EE/896E: A56A    LDA $6A        (Low byte of address)
EE/8970: 6980    ADC #$80       (Add 128)
EE/8972: 856A    STA $6A        (Save changes)
EE/8974: A56B    LDA $6B        (Middle byte of address)
EE/8976: 6901    ADC #$01       (Add one, or two if an overflow occurred)
EE/8978: 856B    STA $6B        (Save changes)
EE/897A: A56C    LDA $6C        (High byte of address)
EE/897C: 69D5    ADC #$D5       (Add #$D5, or #$D6 if an overflow occurred)
EE/897E: 856C    STA $6C        (Save changes; D5/0180+X)

Madsiur

  • Tunnel Armor
  • *
  • Posts: 149
  • Gender: Male
  • FF6AE coder
    • View Profile
    • Madsiur's Lair
Re: FF6 Overworld sprite pointers
« Reply #5 on: June 20, 2013, 05:18:20 AM »
Was that really what Edrin was asking? I don't see what PC slots have to do with this. I thought Edrin was expanding sprite sheets to player character-completeness.

I simply thought he wanted more PC because he said he wants more PC sprite sheets. The reason why I posted the code is because only the Leader is displayed on the world map and the spite ID is in the Actor block of the party leader. I though that this sprite ID was taken then multiplied by the size of a full sprite sheet to have the correct offset of the character sprite to load. You're right, this doesn't require extra PC slots at all.
« Last Edit: June 20, 2013, 05:34:43 AM by Madsiur »

Edrin

  • Ymir
  • *
  • Posts: 12
    • View Profile
Re: FF6 Overworld sprite pointers
« Reply #6 on: June 20, 2013, 10:49:13 AM »
Was that really what Edrin was asking? I don't see what PC slots have to do with this. I thought Edrin was expanding sprite sheets to player character-completeness.

The sprite pointers in towns and the overworld are split up. The lower 16-bit offsets are at 0xD0F2 while the bank byte and another value are at 0xD23C.

I don't know where this routine is used, but it's the only one in the disassembly that labels what these particular offsets are.
Code: [Select]
C0/69A3: BFF3D0C0 LDA $C0D0F3,X (Loads pointer to Map character graphcis)
C0/69A7: 852B    STA $2B
C0/69A9: 852E    STA $2E
C0/69AB: 8531    STA $31
C0/69AD: 8534    STA $34
C0/69AF: BF3CD2C0 LDA $C0D23C,X (Bank pointers and Number of Bytes to Copy per Tile for Map Char Gfx)
C0/69B3: 852C    STA $2C
C0/69B5: 852F    STA $2F
C0/69B7: 8532    STA $32
C0/69B9: 8535    STA $35

The routine for the behind-view sprite used when riding a chocobo is in bank $EE. It does not access a pointer table, instead calculating an address based on the assumption that all sheets are 0x16A0 bytes long.

Code: (Novalia's Disassembly: Overworld chocobo rider sprite) [Select]
EE/8943: ADFB11  LDA $11FB      (Sprite number for map character)
EE/8946: 8D0242  STA $4202      (Save as multiplicand)
EE/8949: A9A0    LDA #$A0
EE/894B: 8D0342  STA $4203      (Set multiplier to 160)
EE/894E: EA      NOP
EE/894F: EA      NOP
EE/8950: EA      NOP
EE/8951: AE1642  LDX $4216      (Product)
EE/8954: 866A    STX $6A        (Save the address temporarily)
EE/8956: A916    LDA #$16
EE/8958: 8D0342  STA $4203      (Set multiplier to 22)
EE/895B: EA      NOP
EE/895C: EA      NOP
EE/895D: EA      NOP
EE/895E: AD1642  LDA $4216      (Load low byte of product)
EE/8961: 18      CLC            (Clear Carry for addition)
EE/8962: 656B    ADC $6B        (Add middle byte of address)
EE/8964: 856B    STA $6B        (Save updated address)
EE/8966: AD1742  LDA $4217      (Load high byte of product)
EE/8969: 656C    ADC $6C        (Add to high byte of address)
EE/896B: 856C    STA $6C        (Save updated address)
EE/896D: 18      CLC            (Clear Carry for addition)
EE/896E: A56A    LDA $6A        (Low byte of address)
EE/8970: 6980    ADC #$80       (Add 128)
EE/8972: 856A    STA $6A        (Save changes)
EE/8974: A56B    LDA $6B        (Middle byte of address)
EE/8976: 6901    ADC #$01       (Add one, or two if an overflow occurred)
EE/8978: 856B    STA $6B        (Save changes)
EE/897A: A56C    LDA $6C        (High byte of address)
EE/897C: 69D5    ADC #$D5       (Add #$D5, or #$D6 if an overflow occurred)
EE/897E: 856C    STA $6C        (Save changes; D5/0180+X)

That's the one! Shouldn't be too hard to get this working now. Big thanks.