Kajar notes of ChronoRET, rebuilding Chrono Trigger one matched routine at a time

Last updated: October 9, 2026

Status bar & text

The battle's status bar and the number and text formatting it uses, in bank $C1 ($C1:011F–$C1:01F8, $C1:0299–$C1:095C, $C1:104E). The status bar is built as a tilemap in WRAM (BattleUI_StatusTile, $7E:0CC0, 192 entries) with each PC's name, HP, MP and, in two of its three layouts, the ATB gauge; the enemies' names share it.

See also: Battle menu, Battle engine.

The status bar

BattleUI_BuildStatusBarFrame ($C1:0299, falling into BattleUI_DrawPcNamePanel and BattleUI_NextNamePanel, which run to $C1:05A6) rebuilds the whole map:

  1. clear it;
  2. write the "HP"/"MP" headers where the layout (!BattleUI_GaugeLayout) puts them: layout 0 is name, HP/MaxHP, MP; layout 1 is HP, MP, name, ATB gauge; layout 2 is name, HP, MP, ATB gauge;
  3. for each present PC: its 10 name tiles (5 on the line, 5 on the row above), the HP digits (in palette 3 when HP is 0, or at most an eighth of the maximum while a flag is set), and the MaxHP digits or the gauge with its end caps;
  4. the enemy-name lines (11 tiles on each of two rows);
  5. while PCs wait for a command, the command windows (or, while choosing a target from a submenu, the highlight of the targeted PC's name, BattleUI_HighlightPcName).

The per-frame peer is BattleUI_UpdateNextPcPanel ($C1:05A7): it refreshes one PC's HP and MP digits per call, round robin, then redraws every present PC's ATB gauge (BattleUI_DrawAtbGauges, layouts 1 and 2). BattleMenu_UpdateMainWindow calls the full rebuild when the shown PC changes and this one otherwise.

BattleUI_DrawSlotGaugeBar ($C1:06F0) draws a PC's 4-tile ATB gauge: the filled part is AtbCur × 256 / AtbMax scaled to 32 units, and the tiles drawn track the part still to fill, in palette 3 while AtbCur is non-zero. What the tiles look like depends on the graphics, which were not checked.

Numbers and text

Routine Address Does
BattleMsg_FormatNumberDigits $C1:011F A value 0–999 into three digit tiles (thousands blank)
BattleMsg_FormatTwoDigits $C1:0174 Tens and ones only
BattleMsg_BlankLeadingZeros $C1:104E Leading-zero suppression for the digits
BattleMsg_ReencodeTextBuffer $C1:01A9 Re-encode 16 text bytes into a row of tiles and a row of marks above them (probably the dakuten and handakuten of the Japanese text code, a leftover)
BattleMsg_FormatNumber4Digits $CF:FDAD A four-digit, long-call version of the formatter, in bank $CF

The formatters count digits with subtract-and-count loops on a 16-bit accumulator, so their SBC/ADC immediates carry an explicit .w (asar does not track the M flag).

18functions matched
1,820code bytes matched
18readable
18verified

Functions

AddressFunctionSizeStatusNotes
$C1:011FBattleMsg_FormatNumberDigits85verifiedFormat the 16-bit value in !BattleMsg_NumValue (0-999) into digit tiles: !BattleMsg_Digit1000 = blank, Digit100 / Digit10 / Digit1 = digits, tiles looked up in !BattleRom_DigitTiles.
$C1:0174BattleMsg_FormatTwoDigits53verifiedTwo-digit variant of BattleMsg_FormatNumberDigits: formats !BattleMsg_NumValue as tens+ones only.
$C1:01A9BattleMsg_ReencodeTextBuffer80verifiedBack up the 16 raw text bytes the caller left in !BattleMsg_TextTiles to !BattleMsg_TextSource, blank both tile rows (TextTiles/TextTopTiles), then re-encode each text byte into a lower-row tile...
$C1:0299BattleUI_BuildStatusBarFrame108verifiedRebuilds the battle status-bar map (BattleUI_StatusTile, $0CC0): 1.
$C1:0305BattleUI_DrawPcNamePanel448verified
$C1:04C5BattleUI_NextNamePanel226verified
$C1:05A7BattleUI_UpdateNextPcPanel308verifiedPer-frame peer of BattleUI_BuildStatusBarFrame: refreshes one PC's HP/MP digits per call (round robin through !BattleUI_NextPanelSlot), then redraws every present PC's ATB gauge (layouts 1/2).
$C1:06DBBattleUI_DrawAtbGauges20verified
$C1:06EFBattleUI_UpdateNextPcPanel_Exit1verified
$C1:06F0BattleUI_DrawSlotGaugeBar149verifiedDraw the 4-tile ATB gauge of PC slot !BattleUI_Slot into the status map at BattleRom_HpCellL1[slot] + !BattleUI_GaugeCellOffset.
$C1:0872BattleUI_ClearActivePanelColumn118verifiedZero the two tile columns of the shown PC's command column (6 rows, offset !BattleMenu_ActivePc × 12) in the status map, then, if !BattleUI_PanelRedraw is set and no target selection is running...
$C1:08E8BattleUI_HighlightPcName65verifiedHighlight PC slot A's name in the status bar: look up the slot's offset in !BattleRom_NameAttrL1 (layout 1) or !BattleRom_NameAttrL02 (layouts 0 and 2) and set the attribute of a 5-wide × 2-high...
$C1:104EBattleMsg_BlankLeadingZeros32verifiedLeading-zero suppression for the number formatter's digits.
$CD:0027BattleMsg_ShowFromTableCC3A09Vec3verified
$CD:002DBattleMsg_ShowMsg0BIfKeyChangedVec3verified
$CD:0030BattleMsg_UnkVecCD00303verified
$CD:0033BattleMsg_UnkVecCD00333verified
$CF:FDADBattleMsg_FormatNumber4Digits115verifiedA four-digit, long-call version of BattleMsg_FormatNumberDigits ($C1:011F): the same subtract-and-count loops with one more for the thousands, and the digits looked up in !BattleRom_DigitTilesB...

Generated from functions.csv. Do not edit.