1636

**Final Fantasy IV Research & Development / FF4 code griping thread**

« **on:**December 08, 2007, 02:30:02 AM »

Ok, I've just stumbled onto something that makes even Baby Jesus cry.

For those that may not know assembly, I'll give you what I believe this is doing.

This is changing the Direct Page register to look at xx/4200. You might already see where this is going, but for those that don't... It gets funky.

This, believe it or not, is storing to the hardware registers to do math, in this case I think division. I don't know if it's 97 divided by 100 or 100 divided by 97. In any event, the game is changing the DP register

Let the fun continue...

Code: [Select]

`$01/81D6 DA PHX A:13E9 X:D998 Y:0007 D:0100 DB:7E S:02E7 P:envmxdIzcHC:0562 VC:114 00 FL:00`

$01/81D7 5A PHY A:13E9 X:D998 Y:0007 D:0100 DB:7E S:02E5 P:envmxdIzcHC:0592 VC:114 00 FL:00

$01/81D8 C2 20 REP #$20 A:13E9 X:D998 Y:0007 D:0100 DB:7E S:02E3 P:envmxdIzcHC:0622 VC:114 00 FL:00

$01/81DA A2 7F 00 LDX #$007F A:13E9 X:D998 Y:0007 D:0100 DB:7E S:02E3 P:envmxdIzcHC:0644 VC:114 00 FL:00

$01/81DD 86 5A STX $5A [$00:015A] A:13E9 X:007F Y:0007 D:0100 DB:7E S:02E3 P:envmxdIzcHC:0668 VC:114 00 FL:00

$01/81DF E6 5A INC $5A [$00:015A] A:13E9 X:007F Y:0007 D:0100 DB:7E S:02E3 P:envmxdIzcHC:0700 VC:114 00 FL:00

$01/81E1 38 SEC A:13E9 X:007F Y:0007 D:0100 DB:7E S:02E3 P:envmxdIzcHC:0754 VC:114 00 FL:00

$01/81E2 E9 E8 03 SBC #$03E8 A:13E9 X:007F Y:0007 D:0100 DB:7E S:02E3 P:envmxdIzCHC:0768 VC:114 00 FL:00

$01/81E5 10 F8 BPL $F8 [$81DF] A:1001 X:007F Y:0007 D:0100 DB:7E S:02E3 P:envmxdIzCHC:0792 VC:114 00 FL:00

$01/81E7 18 CLC A:FC79 X:007F Y:0007 D:0100 DB:7E S:02E3 P:eNvmxdIzcHC:0170 VC:115 00 FL:00

$01/81E8 69 E8 03 ADC #$03E8 A:FC79 X:007F Y:0007 D:0100 DB:7E S:02E3 P:eNvmxdIzcHC:0184 VC:115 00 FL:00

$01/81EB 0B PHD A:0061 X:007F Y:0007 D:0100 DB:7E S:02E3 P:envmxdIzCHC:0208 VC:115 00 FL:00

$01/81EC A2 00 42 LDX #$4200 A:0061 X:007F Y:0007 D:0100 DB:7E S:02E1 P:envmxdIzCHC:0238 VC:115 00 FL:00

$01/81EF DA PHX A:0061 X:4200 Y:0007 D:0100 DB:7E S:02E1 P:envmxdIzCHC:0262 VC:115 00 FL:00

$01/81F0 2B PLD A:0061 X:4200 Y:0007 D:0100 DB:7E S:02DF P:envmxdIzCHC:0292 VC:115 00 FL:00

$01/81F1 85 04 STA $04 [$00:4204] A:0061 X:4200 Y:0007 D:4200 DB:7E S:02E1 P:envmxdIzCHC:0328 VC:115 00 FL:00

$01/81F3 E2 20 SEP #$20 A:0061 X:4200 Y:0007 D:4200 DB:7E S:02E1 P:envmxdIzCHC:0356 VC:115 00 FL:00

$01/81F5 A9 64 LDA #$64 A:0061 X:4200 Y:0007 D:4200 DB:7E S:02E1 P:envMxdIzCHC:0378 VC:115 00 FL:00

$01/81F7 85 06 STA $06 [$00:4206] A:0064 X:4200 Y:0007 D:4200 DB:7E S:02E1 P:envMxdIzCHC:0394 VC:115 00 FL:00

$01/81F9 20 45 82 JSR $8245 [$01:8245] A:0064 X:4200 Y:0007 D:4200 DB:7E S:02E1 P:envMxdIzCHC:0416 VC:115 00 FL:00

For those that may not know assembly, I'll give you what I believe this is doing.

Code: [Select]

`$01/81EC A2 00 42 LDX #$4200 A:0061 X:007F Y:0007 D:0100 DB:7E S:02E1 P:envmxdIzCHC:0238 VC:115 00 FL:00`

$01/81EF DA PHX A:0061 X:4200 Y:0007 D:0100 DB:7E S:02E1 P:envmxdIzCHC:0262 VC:115 00 FL:00

$01/81F0 2B PLD A:0061 X:4200 Y:0007 D:0100 DB:7E S:02DF P:envmxdIzCHC:0292 VC:115 00 FL:00

This is changing the Direct Page register to look at xx/4200. You might already see where this is going, but for those that don't... It gets funky.

Code: [Select]

`$01/81F1 85 04 STA $04 [$00:4204] A:0061 X:4200 Y:0007 D:4200 DB:7E S:02E1 P:envmxdIzCHC:0328 VC:115 00 FL:00`

$01/81F3 E2 20 SEP #$20 A:0061 X:4200 Y:0007 D:4200 DB:7E S:02E1 P:envmxdIzCHC:0356 VC:115 00 FL:00

$01/81F5 A9 64 LDA #$64 A:0061 X:4200 Y:0007 D:4200 DB:7E S:02E1 P:envMxdIzCHC:0378 VC:115 00 FL:00

$01/81F7 85 06 STA $06 [$00:4206] A:0064 X:4200 Y:0007 D:4200 DB:7E S:02E1 P:envMxdIzCHC:0394 VC:115 00 FL:00

This, believe it or not, is storing to the hardware registers to do math, in this case I think division. I don't know if it's 97 divided by 100 or 100 divided by 97. In any event, the game is changing the DP register

*to do math*. Completely unnecessary. Now I know why JCE thinks this game is a coding disaster. It*is*a coding disaster.Let the fun continue...