Direct Page and Stack at C2 Bank, and Other Fundamental Info
#8
For the Final Fantasy 3 game, with a few exceptions, the developers didn't program with the direct page methodology. They set the direct page as zero and generally use it to clear the B register. (top byte of the A register in 8-bit mode).

If you need a example of direct page, you can check the following code in the assembly:
Code:
C2/286E: F4 00 11     PEA $1100         (Set direct page register 11 $1100)
C2/2871: 2B           PLD 
C2/2872: A5 C9        LDA $C9 ($11C9)
C2/2874: C9 9F        CMP #$9F          (Moogle Suit in character's Armor slot?)
C2/2876: D0 0B        BNE $2883         (if not, branch)

For this example, PEA will put the address in the stack (two bytes) and PLD will remove it from the stack and set it as the direct page address. Note that the direct page is a special register and there are other opcodes which can copy or setup it as well. Common opcodes related with the setting/copy of the direct page are TCD, TDC, PHD and PLD.

Opcodes related with the direct page has only one byte in the range [0, 255]. However, they are incremented with the direct page when they are executed. In this example, LDA $C9 is actually equivalent to LDA $11C9. The effective address is the direct page value ($1100) plus the operand ($C9), which is $11C9.

I never found any opcode in the game related with the relocation of the stack pointer. However, specific opcodes exist for the stack relocation. They are TCS, TSC, TXS and TSX.
Reply


Messages In This Thread
RE: Direct Page and Stack at C2 Bank, and Other Fundamental Info - by HatZen08 - 03-06-2016, 05:01 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Utility Patch - Moved Ending (Free your CA bank!) DrakeyC 0 1,286 06-14-2022, 03:18 PM
Last Post: DrakeyC
  I need help with a 'mystery' code located in my project's F0 bank Marketa Lazarova 4 3,779 08-30-2021, 10:02 PM
Last Post: SilentEnigma
  Stack Bonus Physical Dmg doofenH 3 3,304 02-25-2020, 10:01 AM
Last Post: PowerPanda
  Better bank C2 disassembly 13375K37CH3R 21 22,791 03-01-2017, 05:00 PM
Last Post: madsiur
  ROM expantion and bank shifting dachschaden 2 3,666 12-31-2014, 10:45 AM
Last Post: dachschaden
  Modifying Portrait Info in FF6 Advance DarkPhoenix 6 7,607 06-11-2013, 06:59 PM
Last Post: madsiur
  C1 - C3 Disassembly Bank Help Angelo26 2 4,243 07-18-2010, 05:35 PM
Last Post: Angelo26

Forum Jump:


Users browsing this thread: 1 Guest(s)