Submission #7136: naruko's NES Final Fantasy II "game end glitch" in 06:16.81

(Link to video)
Nintendo Entertainment System
game end glitch
FCEUX 2.3.0
22646
60.0988138974405
211
Unknown
SQF-FY-0 PRG.nes
Submitted by naruko on 6/5/2021 4:29:39 AM
Submission Comments

Summary

This is an improved version of "#7049: AmaizumiUni's NES Final Fantasy II in 11:26.49". It's used the glitch of the spellbook of Blink. The change is to use the joypad input for the script pointer, which allows you to see the ending more quickly.
My TAS makes 1 byte the script data by the joypad input. Ths script data is not 6502 instruction. It's not ACE.

Configuration

  • RAM init: default
  • ROM CRC32: D29DB3C7
  • Allow Left+Right / Up+Down
The system updates CPU address $62ba and $62bb when a woman equip a spellbook of Blink (ブリンクのほん) as a weapon. CPU address $62ba is assigned an event ID in the temple, CPU address $62bb is assigned at the inn.
The system initials 0x15 and 0x14, and assigned 0x00-0x19 for these addresses. These values are used for an index of a pointer table $bfc0 for address $0072 in PC $C6FB. The system runs the epilogue if the pointer reference data is 0xe7. (see Appendix)
The illegal value can store a RAM address into the pointer. The useful values are following:
event pointer
ID    address description

0x0f  $8531   Final Battle (original script)
0x43  $0020   Joypad Data Buffer
0x5c  $6011   Player Overworld Position Y (for saving)

The Final Battle

This is a normal value for the system. If the player kills the Emperor and releases Nelly, the system can display "THE END".

Joypad Data Buffer

We can make any value by Joypad input. Press left, right, down, select, B and A, the value becomes 0xe7.

Player Overworld Position Y

The position Y 0xe7 is placed near the second battleship hoabor. Go there, save the game, go to the inn without saving.

How to update and use these addresses

It is required to equip the spellbook as a weapon before the end of the battle. However the system is freezed when the character attacks with the spellbook. Another character must finish the battle before her attack.
These two values are included in the save data.

CPU address $62ba

The system updates CPU address $62ba as level up when the second battle is finished in TAS #7049. (I haven't investigated the reason for 'twice'.) The initial value is 0x15, the system assigns the maximum value is 0x0f, the system stores data 0x0f into CPU address $62ba.
If the party has dead character(s), the event ID is loaded in the temple.

CPU address $62bb

The player repeats, selects and cancels 'attack' up to the specified number of times.
The system doesn't use the initial value 0x14 if the specified number is bigger than 0x20(?). To store data 0x43 or 0x5c, repeat up to the specified number of times.
When the party finds a berth at the inn, the event ID is loaded.

The steps of the speedrun

I used the joypad data buffer for the script data.
The most important point is getting a spellbook of Blink quickly. The following are candidates.
  • Get a canoe, buy the spellbook in the town of Poft (ポフト).
  • Make a roundabout trip by walking and riding chocobo, buy the spellbook in the town of Palm (or Poft).
  • Pickup the spellbook, Ogre Mage (オーガメイジ) drops it.
After getting the spellbook do the following
  • Start the battle with anyone
  • Select 'たたかう'(attack) 67 times for a woman (second character) . Equip the spellbook as weapon in the 'もちもの' (item) command.
  • Finish and win the battle.
  • Go to the inn, choose 'はい' and press left, right, down, select, B and A at the same time.

route 'canoe' and 'roundabout trip'

The roundabout trip is faster than getting a canoe by about 1 min 20 sec.

route 'Ogre Mage'

The encounter places Ogre Mage in the north of Fin castle. It's too difficult for me to manipulate the random seed and win the battle with the initial skills. If you picked up the spellbook luckily, the Gadea inn is the best place.

Button operations at the inn

To pass the condition:
  1. moving: press B
  2. started the chat: press A, keep hold B
  3. press left, down, right and select
  4. release A
  5. displayed the choice: press A
  • If the joypad is disabled both left and right in same time, use joypad #3 like a Joy Card. (Famicom games can use joypad #3 as an alternate joypad #1. NES cannot use it due to the difference of hardware design.)
  • To train the operation, save the game after the battle.

About making a TAS

Random seed manipulation for battle

The system makes a random seed and stores it into address $0042 before the battle. It's a sum in zeropage (address $0000-$00ff) and carry flag of ADC instruction. It depended on the character order and the enemy behavior.
In normal battle, versus Sprinter, the random seed is manipulated by frame counter, uninitialized values and the joypad buffer. To affect the start or select button, close the menu and keep holding these buttons at the same time.
In the first battle, verus Black Knight (くろきし), the system clears a lot of zeropage area before the battle. I used a frame counter for the manipulation, I had to wait 27 frames...

概要

これは "#7049: AmaizumiUni's NES Final Fantasy II in 11:26.49" の改善版です. ブリンクのほんのバグを利用しています. 変更点はスクリプトのポインタをジョイパッドの入力データにして、エンディングを早く見られるようにしました.
スクリプトには任意の 1 byte のデータを読み込ませていますが、スクリプトは 6502 の命令ではないので、任意コード実行ではありません.

ブリンクのほんの動作の原理

女性キャラがブリンクのほんを武器として装備したときに更新されるメモリアドレスは $62ba と $62bb です. address $62ba は聖堂での蘇生イベントのID、address $62bb は宿屋での宿泊イベントのIDです.
この2つのIDの初期値は 0x15 と 0x14 です. この変数は PC $C6FB で参照される値で正常値は 0x00 から 0x19 です. この値をポインタテーブル $BFC0 の index と利用して, スクリプトポインタ $0072 に書き込みます. ポインタ参照先データに 0xe7 があるとエンディングとなります.
CPU address $62ba or $62bb の data 0x1a 以降の不正な値で RAM を参照するものがあり、ユーザーが操作しやすいものは下記です.
event pointer
ID    address description

0x0f  $8531   Final Battle (original script)
0x43  $0020   Joypad Data Buffer
0x5c  $6011   Player Overworld Position Y (for saving)

Final Battle

ROM に入っている想定内の値です. 皇帝を倒し、ネリーを救出していると THE END までいけます.

Joypad Data Buffer

ボタンの組み合わせで任意の data を作れます. 左右下セレクトBAを同時に押すと data 0xe7 が作成できます.

Player Overworld Position Y

Position Y 0xe7 は2番目の大戦艦停泊地付近にあります. ここにいきセーブしてその後はセーブせず宿屋に向かう必要があります.

メモリ更新と利用

2つのアドレスは戦闘終了までに武器としてブリンクの本を所持する必要があります. ただしブリンクの本で攻撃を実行するとゲームが止まりますので、それよりも早く終了する必要があります.
この2つの値はセーブデータに含まれます.

CPU address $62ba

既出の TAS の通りこの本を武器として所持し戦闘を2度(2度の理由は未調査)終了すると、熟練度レベルとして address $62ba が更新されます. 初期値は 0x15 ですが、熟練度レベルとしては最大値 0x0f なので address $62ba へ data 0x0f が書き込まれます.
利用方法は仲間のうち誰かを死亡させ、聖堂で蘇生させるとイベントが起きます.

CPU adddress $62bb

たたかうを選択してキャンセルを繰り返し指定回数まで繰り返します.
熟練度経験値としても計算するのですが大きい回数を指定すると初期値 0x14 は加算されませんでした. data 0x43, 0x5c を書き込みたい場合はその回数たたかうを選びます.
利用方法は宿屋で宿泊するだけです.

攻略チャート

Joypad Data Buffer を利用します.
ブリンクのほんを早く取得することが重要です. 下記が候補です.
  • カヌーを取り、パルムの町で買う
  • 徒歩とチョコボで遠回りし、ポフトの町(もしくはパルムの町)で買う
  • オーガメイジから拾う
ブリンクのほんを取得後は下記となります.
  • 相手は誰でもいいので戦闘開始
  • 2人目がたたかうを 67 回選び、ブリンクのほんを武器として装備して戦闘を勝利で終了させます.
  • 宿屋に行き、左右下セレクトBAを押しながら「はい」選びます.

遠回りルートとカヌールート

遠回りのほうがカヌーより1分20秒程度早いです.

オーガメイジルート

フィン城北にオーガメイジが出現します. 初期状態でオーガメイジに勝つのは乱数操作が難しく、私にはできませんでした. 運良くブリンクのほんを手に入れられたのなら、ガテアの村の宿屋が便利でしょう.

宿屋でのボタン操作

下記の順番にボタンを押せば条件を満たせます.
  1. 移動中: B を押す
  2. 会話開始: A を押す, B は押したまま
  3. B に加えて 左、右、下、セレクトを押す
  4. A を離す
  5. 選択肢表示: A を押す
  • 左と右の同時入力が禁止されている場合はジョイカードなどの外部コントローラで代用可能です.
  • 操作に自信がない場合は戦闘後にセーブしておけば簡単にやり直せます.

TAS に関して

戦闘での乱数調整

戦闘の最初に zeropage (address $0000-$00ff) の carry 込みの総和が乱数になり、行動順番や敵の行動内容がこれに依存します.
通常の戦闘ではフレームカウンタや joypad bufferで総和を操作でき移動しないボタンも利用できます. スタートボタンやセレクトボタンを反映するにはメニューを出してから押したままにすれば移動も可能です.
くろきし戦前は joypad buffer を含めて zeropage の大半は 0 で埋められるため乱数調整はフレームカウンタのみのため、27 frame も待機しています.

Appendix

routine for temple, inn and the script system

(in the temple)
8CF6: lda $62ba
8CF9: sta <$6c
8CFB: jmp $91b8
(at the inn)
8DCA: lda $62bb
8DCD: sta <$6c
8DCF: jmp $91b8
(load <$6c, store script pointer <$72)
CBF4: lda <$6c
CBF6: beq $cbfb
CBF8: jmp $c6f4
C6F4: asl a
C6F5: tax
C6F6: lda #$0d
C6F8: jsr $fe03 (switch a bank)
C6FB: lda $bfc0,x
C6FE: sta <$72
C700: lda $bfc1,x
C703: sta <$73
C705: lda #$01
C707: sta <$6c
C709: lda #$00
C70B: sta <$17
C70D: rts
(random seed calculation)
97D5: ldx #$00
97D7: adc <$00,x
97D9: inx
97DA: bne $97d7
97DC: sta $0042

proficiency address calculation

address = 0x6200 + c * 0x40 + ( (index << 1) & 0xff)
  • c: character #, 0 to 3
  • index: weapon #, the system assigns 0 to 7

index list for the spellbooks as weapon

item idx  name           | item idx  name
-
0x98 0x28 ファイアのほん | 0xac 0x1a ケアルのほん
0x99 0x00 サンダーのほん | 0xad 0x00 レイズのほん
0x9a 0x01 ブリザドのほん | 0xae 0x01 バスナのほん
0x9b 0x64 クラウダのほん | 0xaf 0x46 エスナのほん
0x9c 0x0c ドレインのほん | 0xb0 0x01 バリアのほん
0x9d 0x15 アスピルのほん | 0xb1 0x3d ブリンクのほん
0x9e 0x00 フレアーのほん | 0xb2 0x00 プロテスのほん
0x9f 0x02 スリプルのほん | 0xb3 0x02 シェルのほん
0xa0 0x28 スタンのほん   | 0xb4 0x64 ウォールのほん
0xa1 0x10 ストップのほん | 0xb5 0x10 デスペルのほん
0xa2 0x09 コンフュのほん | 0xb6 0x39 ミニマムのほん
0xa3 0x00 ブラインのほん | 0xb7 0x00 サイレスのほん
0xa4 0x02 カーズのほん   | 0xb8 0x01 アンチのほん
0xa5 0x28 トードのほん   | 0xb9 0x64 フォーグのほん
0xa6 0x0a ブレイクのほん | 0xba 0x4a スロウのほん
0xa7 0x10 デスのほん     | 0xbb 0x01 チェンジのほん
0xa8 0x00 デジョンのほん | 0xbc 0x0a フィアーのほん
0xa9 0x02 バーサクのほん | 0xbd 0x00 ホーリーのほん
0xaa 0x64 ヘイストのほん | 0xbe 0x03 テレポのほん
0xab 0x03 オーラのほん   | 0xbf 0x00 アルテマのほん
  • idx: index
  • item: item #

address list for non-proficiency

c item addr  | c item addr

0 0xac $6234 | 2 0xba $6314
1 0xac $6274 | 3 0xb6 $6332
0 0xb1 $627a | 3 0xb1 $633a
2 0xac $62b4 | 2 0x9b $6348
1 0xb1 $62ba | 2 0xaa $6348
3 0xac $62f4 | 2 0xb4 $6348
2 0xb1 $62fa | 2 0xb9 $6348
1 0x9b $6308 | 3 0xaf $634c
1 0xaa $6308 | 3 0xba $6354
1 0xb4 $6308 | 3 0x9b $6388
1 0xb9 $6308 | 3 0xaa $6388
2 0xaf $630c | 3 0xb4 $6388
3 0x98 $6310 | 3 0xb9 $6388
3 0xa0 $6310
3 0xa5 $6310
note: address $6300-$65ff is save slot #1. The system updates the values of level and experience without checksum after the battle. If the save slot has a bad checksum, the system will detect it as an empty slot.
note: address $6044 data bit 2 is a flag of release Nelly

Special Thanks

Cheap and Pirohiko

Samsara: Judging.
Samsara: Last weekend (at the time of writing this judgement), a better route for this run was shown by Pirohiko. Since that is a Twitch VOD, the link may be dead in the near future, so I'll explain the new route. The new route uses Cure to manipulate the RNG of a fight with an Ogre Mage, and attacks it with a Fire spellbook to kill it in one turn, getting the Blink book much faster. This was performed on a Famicom console, proving its legitimacy. AmaizumiUni has completed a test TAS of this route and is continuing to look into it for improvements. Pirohiko will also be looking into improving the new route in the future. Machine translation of the tweet courtesy of DeepL: "FF2 has a chart that cancels the encumbrance and a pattern that I haven't checked yet, so I'll have to check that out after I make Dr. Mario..."
Even though the test TAS is not linked, there is more than enough proof in the Twitch VOD to show me that it is both legit and the fastest known TAS for this game. For that, I have to reject this run, as it has been provably bested.
Last Edited by adelikat on 11/6/2023 3:57 AM
Page History Latest diff List referrers