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:
- clear it;
- 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; - 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;
- the enemy-name lines (11 tiles on each of two rows);
- 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).
Functions
| Address | Function | Size | Status | Notes |
|---|---|---|---|---|
$C1:011F | BattleMsg_ | 85 | verified | Format 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:0174 | BattleMsg_ | 53 | verified | Two-digit variant of BattleMsg_FormatNumberDigits: formats !BattleMsg_NumValue as tens+ones only. |
$C1:01A9 | BattleMsg_ | 80 | verified | Back 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:0299 | BattleUI_ | 108 | verified | Rebuilds the battle status-bar map (BattleUI_StatusTile, $0CC0): 1. |
$C1:0305 | BattleUI_ | 448 | verified | |
$C1:04C5 | BattleUI_ | 226 | verified | |
$C1:05A7 | BattleUI_ | 308 | verified | Per-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:06DB | BattleUI_ | 20 | verified | |
$C1:06EF | BattleUI_ | 1 | verified | |
$C1:06F0 | BattleUI_ | 149 | verified | Draw the 4-tile ATB gauge of PC slot !BattleUI_Slot into the status map at BattleRom_HpCellL1[slot] + !BattleUI_GaugeCellOffset. |
$C1:0872 | BattleUI_ | 118 | verified | Zero 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:08E8 | BattleUI_ | 65 | verified | Highlight 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:104E | BattleMsg_ | 32 | verified | Leading-zero suppression for the number formatter's digits. |
$CD:0027 | BattleMsg_ | 3 | verified | |
$CD:002D | BattleMsg_ | 3 | verified | |
$CD:0030 | BattleMsg_ | 3 | verified | |
$CD:0033 | BattleMsg_ | 3 | verified | |
$CF:FDAD | BattleMsg_ | 115 | verified | A 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... |