Claim set · data/claims/earthbound-av.yaml

EarthBound battle backgrounds (Herringway's ebsrc)

Game: EarthBound.

EarthBound's battle backgrounds are built from 327 layer entries of 17 bytes each: the layer's graphics and palette, its bit depth (2 or 4 bits a pixel), a palette-cycling style with up to two ranges of colors and the frames between steps, up to four scrolling movements, and up to four distortions, each played in turn. 275 entries cycle colors, 237 scroll, and 285 distort. earthbound-av/layers

No.IDGraphicsPaletteBits a pixelPalette styleCycle 1 colorsCycle 2 colorsFrames a stepScrolling entriesDistortion entries
0NONE00231–330
1UNKNOWN00111432–1587660
2UNKNOWN00212412–1577661
3UNKNOWN00323432–15847
4UNKNOWN00432412–1557643
5UNKNOWN00544412–15870, 7173
6UNKNOWN00644412–15870, 7173
7UNKNOWN00744412–15870, 7175
8UNKNOWN00844412–15870, 7173
9UNKNOWN00955431–158767
10UNKNOWN01016411–1587626
11UNKNOWN01167432–156777
12UNKNOWN01276411–158778
13UNKNOWN01388432–15674, 7521
14UNKNOWN01499412–15974, 7522
15UNKNOWN015210412–15974, 7548
16UNKNOWN0161011412–151074, 7522
17UNKNOWN017811412–151074, 7563
18UNKNOWN0181111412–151074, 7564
19UNKNOWN0191212422–78–13574, 7526
20UNKNOWN020109412–15972, 7321, 22
21UNKNOWN02175431–1587799, 100
22UNKNOWN022137432–15545
23UNKNOWN0231413412–1577
24UNKNOWN0241514422–89–15674, 7515
25UNKNOWN025415431–15674, 7560, 59
26UNKNOWN0261615431–15674, 7558, 59
27UNKNOWN0271710432–15874, 7549, 50
28UNKNOWN028515431–15674, 7537
29UNKNOWN029315431–1567720
30UNKNOWN030316412–1577725
31UNKNOWN0311513412–1577726
32UNKNOWN032113412–1577746
33UNKNOWN0331813412–1573781, 82
34UNKNOWN0341815431–1563781, 82
35UNKNOWN0351317412–1567765
36UNKNOWN036417412–1567760
37UNKNOWN037217412–1567745
38UNKNOWN03878432–1567626
39UNKNOWN039196411–15874, 752
40UNKNOWN0401018412–15874, 7526
41UNKNOWN0411019431–1582226
42UNKNOWN0421920412–15774, 752
43UNKNOWN0432021432–1552381, 82
44UNKNOWN044217432–1532746
45UNKNOWN0452222202348
46UNKNOWN046123412–131074, 7564
47UNKNOWN0471024412–1572265
48UNKNOWN0481024412–1573860
49UNKNOWN049124412–15774, 7527
50UNKNOWN0502317412–1564541
51UNKNOWN0512417412–1564541
52UNKNOWN052410412–1594830
53UNKNOWN0531410412–1597221, 22
54UNKNOWN0541410412–1567221, 22
55UNKNOWN0551710412–1567211
56UNKNOWN056710412–1567665
57UNKNOWN0572525414–157452
58UNKNOWN0581825414–1574541
59UNKNOWN0591715431–1574553
60UNKNOWN0602514422–89–156455
61UNKNOWN061414422–89–1564565
62UNKNOWN0621714422–89–156456
63UNKNOWN0631514422–89–15845116
64UNKNOWN064626412–1583949
65UNKNOWN0652626412–15849
66UNKNOWN066827412–1583069
67UNKNOWN0672528414–15846, 49, 50, 5249
68UNKNOWN0681828414–1554740, 41, 42
69UNKNOWN069828414–15846, 49, 50, 5269
70UNKNOWN0702724411–1574673
71UNKNOWN071623412–1383837
72UNKNOWN072929412–1577645
73UNKNOWN073929412–15672, 7346
74UNKNOWN074729412–1587641
75UNKNOWN075429412–15107765
76UNKNOWN0761029412–15107760
77UNKNOWN077229412–15107715
78UNKNOWN0782829412–15107727
79UNKNOWN0791630412–1587721
80UNKNOWN080130412–1577725
81UNKNOWN081930412–1567759
82UNKNOWN08245431–1587769
83UNKNOWN0832931412–158772
84UNKNOWN0843032412–9536116
85UNKNOWN0853133422–70–04
86UNKNOWN0863234422–78–1352893, 94
87UNKNOWN0873335422–78–13611
88UNKNOWN0883335422–78–1363891, 92
89UNKNOWN0893335422–78–136
90UNKNOWN0903335422–78–1363818
91UNKNOWN0913335422–78–13638
92UNKNOWN0923036412–1574316
93UNKNOWN0933136412–15741115
94UNKNOWN0943236412–15791, 92
95UNKNOWN0953217412–15693, 94
96UNKNOWN0963317412–15614
97UNKNOWN0971917412–1564646
98UNKNOWN098217412–15630, 3150
99UNKNOWN0991217412–156399
100UNKNOWN100537411–1583660
101UNKNOWN1011737411–1584643
102UNKNOWN1021337411–1584549
103UNKNOWN1031637411–1584940
104UNKNOWN1042738411–15847, 4845
105UNKNOWN1051838411–15841
106UNKNOWN106538411–1584787, 88
107UNKNOWN1071439432–15726, 27, 28, 2969
108UNKNOWN1083139432–15726, 27, 28, 29116
109UNKNOWN1091839432–15526, 27, 28, 2945
110UNKNOWN1102940432–9826, 27, 28, 2993, 94
111UNKNOWN1111739432–155472
112UNKNOWN1121239432–15638, 3926
113UNKNOWN1133439432–1564564
114UNKNOWN1141441412–15659
115UNKNOWN1153442432–15660
116UNKNOWN1161443431–15796, 97, 98, 99
117UNKNOWN1172544414–158492
118UNKNOWN118613412–1573111
119UNKNOWN1192813412–15760
120UNKNOWN120713412–1572221
121UNKNOWN121413412–1572937
122UNKNOWN122145431–158388
123UNKNOWN123745431–1583825
124UNKNOWN124945431–1593860
125UNKNOWN1251346432–1583872
126UNKNOWN126447432–1585226
127UNKNOWN1271047432–1585226
128UNKNOWN1283547432–1583821
129UNKNOWN1291647432–1583845
130UNKNOWN1301947432–1583845
131UNKNOWN131645431–1583864
132UNKNOWN13245431–1583925
133UNKNOWN133105431–1583945
134UNKNOWN1341048412–1583949
135UNKNOWN135848412–1583845
136UNKNOWN1361649432–15839
137UNKNOWN137349432–1583920
138UNKNOWN1381350432–1583959
139UNKNOWN1393050432–158397
140UNKNOWN1401051412–1583926
141UNKNOWN1411751412–1583941
142UNKNOWN142451412–1583969
143UNKNOWN1431651412–158391
144UNKNOWN144351412–1583924
145UNKNOWN145281412–1583953
146UNKNOWN146101412–1583964
147UNKNOWN1473152412–15882, 836
148UNKNOWN1481452412–15882, 8349
149UNKNOWN1491852412–15882, 8350
150UNKNOWN1502452412–15882, 8347
151UNKNOWN1511053412–15882, 8341
152UNKNOWN1522654432–1510
153UNKNOWN1531454412–15864
154UNKNOWN1541854412–1587754
155UNKNOWN15597412–1587763
156UNKNOWN1563549432–15827
157UNKNOWN157277412–1583950
158UNKNOWN1581455412–15869
159UNKNOWN1593555412–15865
160UNKNOWN1603655412–1584318
161UNKNOWN1612855412–15826
162UNKNOWN162955412–1582850
163UNKNOWN1633756231–38116
164UNKNOWN1643756231–3848
165UNKNOWN1653857231–3852
166UNKNOWN1663857231–3814
167UNKNOWN1673958231–31048
168UNKNOWN1683958231–31014
169UNKNOWN1694059231–3751
170UNKNOWN1704059231–3713
171UNKNOWN1714160231–3614
172UNKNOWN1724160231–3639
173UNKNOWN1733961211–320
174UNKNOWN1743961231–33051
175UNKNOWN1754262231–35
176UNKNOWN1764262231–3539
177UNKNOWN1774363231–3548
178UNKNOWN1784363231–3513
179UNKNOWN1794458211–30385
180UNKNOWN1804464211–30396
181UNKNOWN1814465211–3092, 936
182UNKNOWN1824464211–3093, 927
183UNKNOWN1834566211–302844
184UNKNOWN1844667231–3038115
185UNKNOWN185476820385
186UNKNOWN186476820396
187UNKNOWN1874869205647
188UNKNOWN1884869205748
189UNKNOWN1894970412–1544267
190UNKNOWN1905071211–304337
191UNKNOWN191517220115
192UNKNOWN19251722049
193UNKNOWN19351722030
194UNKNOWN19451722011
195UNKNOWN1955217412–15660, 6143
196NUMBER35350432–15544
197UNKNOWN1975473432–15665
198UNKNOWN198553432–15771
199UNKNOWN1992021432–155467
200UNKNOWN2005674208266
201UNKNOWN2015674208367
202UNKNOWN20244682060, 6172
203UNKNOWN2034466208273
204UNKNOWN2045775211–33056, 5763
205UNKNOWN2055876211–3455514
206UNKNOWN20656692058, 5973
207UNKNOWN20756692056, 5763
208UNKNOWN2081417412–15658, 5968
209UNKNOWN2093477432–15634
210UNKNOWN2103756231–33071
211UNKNOWN21151722058, 5969
212UNKNOWN21246672058, 5969
213UNKNOWN21346672084, 8571
214UNKNOWN21446672088, 89, 86, 8770
215UNKNOWN21546672088, 89, 86, 8751
216UNKNOWN21646672060, 6166
217UNKNOWN21746672058, 5967
218UNKNOWN2184465211–30467
219UNKNOWN2195978211–3604765
220GIYGAS_DEVILSMACHINE6079438–158130
221GIYGAS_DEVILSMACHINE_OFF_CUTSCENE1618020102, 103, 118, 119
222GIYGAS_DEVILSMACHINE_OFF_CUTSCENE26281211–2848
223GIYGAS_DEVILSMACHINE_OFF_1618020104, 105, 124, 125
224GIYGAS_DEVILSMACHINE_OFF_2618020106, 107, 126, 127
225GIYGAS_VULNERABLE638240128, 129
226GIYGAS_UNSTABLE_16483424–510–112112, 113, 114, 11553
227GIYGAS_UNSTABLE_26483411–15396, 97, 98, 99120, 121, 114
228SOUNDSTONE16584412–157
229SOUNDSTONE26685411–154
230FILE_SELECT678640
231COFFEE16887412–158100, 101, 102, 103122
232COFFEE26888412–1510101, 100, 103, 102123
233TEA16989412–155100, 101, 102, 103
234TEA27090432–15343
235UNKNOWN2357139432–157
236UNKNOWN2367245431–158
237UNKNOWN2377347432–158
238UNKNOWN238745431–158
239UNKNOWN2397548411–158
240UNKNOWN2405350411–158
241UNKNOWN2417651411–158
242UNKNOWN242771411–158
243UNKNOWN2437852431–1532413
244UNKNOWN2447954411–158
245UNKNOWN2458030411–158
246UNKNOWN246217412–158
247UNKNOWN2478155412–158
248UNKNOWN248618020
249UNKNOWN249638240
250UNKNOWN250648340
251UNKNOWN251607940
252UNKNOWN252628120
253UNKNOWN253824412–158
254UNKNOWN254836411–158
255MU_TRAINING8491412–15526, 27, 28, 2999, 100
256UNKNOWN2562692432–157
257UNKNOWN25756411–158767
258UNKNOWN2582222202248
259UNKNOWN2593593432–1574631
260UNKNOWN2608520412–157397
261UNKNOWN2618510412–15958, 5941
262UNKNOWN2628531412–15660, 6120
263MAGIC_CAKE1869420110, 112, 110, 111
264MAGIC_CAKE2869520111, 113, 110, 110
265GIYGAS_UNUSED8796411–155
266UNKNOWN2664566204343
267UNKNOWN2674566204544
268UNKNOWN268697432–1572775
269UNKNOWN2694875205649
270UNKNOWN2704869205748
271UNKNOWN2718898434–1584611
272UNKNOWN2725074204039
273UNKNOWN2735974211–3601739
274UNKNOWN274467220385
275UNKNOWN275467220396
276UNKNOWN2764672203944
277UNKNOWN277467220106, 10744
278UNKNOWN2788999431–154117
279UNKNOWN2799010040
280UNKNOWN28091101412–1466
281UNKNOWN281446520386
282UNKNOWN28244102203911
283UNKNOWN2839253432–154
284UNKNOWN28493103432–15628
285UNKNOWN28593104432–15767
286UNKNOWN28694105431–156116
287UNKNOWN2871452412–15882, 8342
288UNKNOWN288277432–1543946
289UNKNOWN28936106411–157108, 10948
290UNKNOWN29036106411–157108, 10944
291UNKNOWN29195107412–1510108, 10941
292UNKNOWN292961082060, 6143
293UNKNOWN293966120110, 11143
294UNKNOWN2943317412–158
295UNKNOWN2956483411–153114
296UNKNOWN29697109411–15101, 2, 3, 444
297UNKNOWN29798110431–1571, 2, 3, 447
298UNKNOWN2989941431–15648
299UNKNOWN299100111431–153
300UNKNOWN30098110431–1531, 2, 3, 445
301UNKNOWN30197109411–1561, 2, 3, 446
302UNKNOWN3029943431–15648
303UNKNOWN303100111431–15460, 616
304UNKNOWN304101112431–146116, 117, 118, 11945
305UNKNOWN305101112431–145116, 117, 118, 11949
306UNKNOWN306476820386
307UNKNOWN307476120397
308UNKNOWN3087852431–1533015
309UNKNOWN30910242431–15629
310UNKNOWN31010242431–155319
311UNKNOWN311102105431–1563815
312UNKNOWN31210285431–158315
313UNKNOWN313146432–157387
314UNKNOWN314645431–1583848
315UNKNOWN31535113432–1573866
316UNKNOWN316316412–15777
317UNKNOWN317116412–1577741
318UNKNOWN3183593432–1573435
319UNKNOWN319417412–1567746
320UNKNOWN3202021432–15426133, 134
321UNKNOWN3211416412–1587222
322UNKNOWN322623412–1383956
323UNKNOWN3233587412–1563435
324UNKNOWN3241052412–15882, 8346
325UNKNOWN3252738411–15347
326UNKNOWN3265071202945
Codeebsrc: Source code recreation for the game Earthbound · src/data/battle/backgrounds/config_table.asm#L1-L5887 BG_DATA_TABLE: .BYTE $00 ;Graphics .BYTE $00 ;Palette .BYTE $02 ;BPP .BYTE $03 ;??? .BYTE $01 ;Palette cycle #1 - first palette .BYTE $03 ;Palette cycle #1 - last palette .BYTE $00 ;Palette cycle #2 - first palette .BYTE $00 ;Palette cycle #2 - last palette .BYTE $1E ;Palette change speed .BYTE $00 ;Scrolling movement #1 …ebsrc: Source code recreation for the game Earthbound · include/structs.asm#L447-L465.STRUCT bg_layer_config_entry graphics .byte ;0 palette .byte ;1 bitdepth .byte ;2 palette_shifting_style .byte ;3 palette_cycle_1_first .byte ;4 palette_cycle_1_last .byte ;5 palette_cycle_2_first .byte ;6 palette_cycle_2_last .byte ;7 palette_change_speed .byte ;8 scrolling_movement_1 .byte ;9 scrolling_movement_2 .byte ;10 …EarthBound (USA) · 0xadca1-0xaf257 — $CA:DCA1-$CA:F257: BG_DATA_TABLE, 17 bytes a layerEach frame, unless the layer's freeze flag is set, a background layer's speed grows by its acceleration and its position by its speed, horizontally and vertically, in 256ths of a pixel; the position's whole pixels (to 255) plus the screen effect's offset go to the layer's scroll registers. When a movement's frame count runs out the layer moves to the next of its four movement slots, back to the first after the fourth; an empty slot also sends it back to the first, and if that is empty too, no movement loads and the old speed and acceleration keep running. A count of 0 never runs out. CodeA distorting layer's scroll register gets a new value on every one of the 224 visible scanlines: the frame routine fills a 224-entry buffer, and an indirect HDMA channel in repeat mode writes the line's two bytes to the layer's horizontal scroll register (or, for the vertical kind, its vertical one) as each line is drawn. Each frame the distortion's frequency, amplitude, start phase, and compression change by their per-frame steps before the buffer is refilled; when the second layer exists and its first distortion slot isn't empty, each layer's buffer is refilled only every other frame, the two layers taking turns by the frame counter's low bit. When a distortion's frame count runs out the next of the layer's four distortion slots starts; an empty slot sends it back to the first, and if that is empty too, no distortion loads and the current one keeps running. A count of 0 never runs out. CodeChecked by claude, 2026-11-08 — parsed every entry's 17 lines on the US branch at the pinned commit and compared each byte with the ROMRevised after a check by a second AI model, 2026-11-08.

Scrolling and distortion columns list the entries of earthbound-av/scrolling and earthbound-av/distortions a layer plays in turn. Most IDs are the disassembly's placeholders (UNKNOWN001…). The fourth byte, which the table's comment leaves as ???, is the palette-cycling style the frame routine reads (earthbound-av/palette-cycling). An entry counts as cycling when its palette-cycling style isn't 0, as scrolling when any of its four scrolling slots isn't 0, and as distorting when any of its four distortion slots isn't 0. Each slot plays in turn as earthbound-av/scroll-motion and earthbound-av/distortion-hdma say.

The scrolling table holds 120 movements, 10 bytes each: how many frames the movement lasts (0 for as long as the layer shows), and a horizontal and vertical speed and acceleration, in 256ths of a pixel a frame. earthbound-av/scrolling

No.FramesHorizontal speedVertical speedHorizontal accelerationVertical acceleration
000000
1180-25625600
218025625600
3180256-25600
4180-256-25600
5600-25608
60-256000
70256000
80025600
900-25600
100256-25600
11025625600
120-25625600
130-256-25600
140128-25600
150256-12800
16025612800
17012825600
180-12825600
190-25612800
200-256-12800
210-128-25600
220-128000
230128000
240012800
2500-12800
260128-12800
27012812800
280-12812800
290-128-12800
30064-12800
310128-6400
3201286400
3306412800
340-6412800
350-1286400
360-128-6400
370-64-12800
380-64000
39064000
40006400
4100-6400
42064-6400
430646400
440-646400
450-64-6400
46032-6400
47064-3200
480643200
490326400
500-326400
510-643200
520-64-3200
530-32-6400
541201200-10
55120-120010
5660-60-6011
576060-60-11
582400010
592402400-10
604800010
614804800-10
625512000
635-512000
645051200
6550-51200
6651024000
675-1024000
6850102400
6950-102400
709012832-10
7190-1283210
7212002560-2
7312001602
7460963200
756096-3200
76120-128-12800
77120-64-6400
78128256256-1-1
79128128-1281-1
80128-256-25611
81128-128128-11
8212806400
831280-6400
84256166400
85256-16-6400
86192032000
8719200-3200
881920-32000
89192003200
90600600-1
91600001
9225610240-40
935120020
941200000
9506412800
967200011
97720720720-1-1
9872000-11
99720-7207201-1
100163664-6400
101835646400
102835-646400
1031200-64-6400
1041920128000
10519200-12800
1061920-128000
1071920012800
108180963200
10918096-3200
1105000010
1115005000-10
1124000011
113400400400-1-1
11440000-11
115400-4004001-1
116240-12812800
11718012812800
118240128-12800
119180-128-12800
Codeebsrc: Source code recreation for the game Earthbound · src/data/battle/backgrounds/scrolling_table.asm#L1-L123 ;Duration, Horizontal movement, Vertical movement, Horizontal acceleration, Vertical acceleration BG_SCROLLING_TABLE: .WORD $0000, $0000, $0000, $0000, $0000 .WORD $00B4, $FF00, $0100, $0000, $0000 .WORD $00B4, $0100, $0100, $0000, $0000 …EarthBound (USA) · 0xaf258-0xaf707 — $CA:F258-$CA:F707: BG_SCROLLING_TABLE, 10 bytes a movementChecked by claude, 2026-11-08 — parsed the table on the US branch at the pinned commit; read how the frame routine applies it (earthbound-av/scroll-motion)Checked by a second AI model, 2026-11-08.

Values are signed: $FF00 is −256, one pixel a frame left or up.

The distortion table holds 135 distortions, 17 bytes each: how many frames it lasts (0 for as long as the layer shows), its kind (none, horizontal, interlaced, vertical, or a fourth kind, earthbound-av/distortion-kind-4), and a ripple frequency, ripple amplitude, starting phase, and compression rate, each with a change applied every frame. earthbound-av/distortions

No.FramesKindFrequencyAmplitudeStart phaseCompressionFrequency change a frameAmplitude change a framePhase change a frameCompression change a frame
00none00000000
10horizontal10242048000020
20horizontal10244096000020
30horizontal10248192000020
40horizontal102416384000020
50horizontal7682048000020
60horizontal7684096000020
70horizontal7688192000020
80horizontal76816384000020
90horizontal5122048000020
100horizontal5124096000020
110horizontal5128192000020
120horizontal51216384000020
130horizontal2562048000020
140horizontal2564096000020
150horizontal2568192000020
160horizontal25616384000020
170horizontal102432768000020
180horizontal51232768000020
190horizontal51265535000020
200interlaced10242048000020
210interlaced10244096000020
220interlaced10248192000020
230interlaced102416384000020
240interlaced7682048000020
250interlaced7684096000020
260interlaced7688192000020
270interlaced76816384000020
280interlaced5122048000020
290interlaced5124096000020
300interlaced5128192000020
310interlaced51216384000020
320interlaced2562048000020
330interlaced2564096000020
340interlaced2568192000020
350interlaced25616384000020
360interlaced102432768000020
370interlaced51232768000020
380interlaced51265535000020
390vertical10242048000020
400vertical10244096000020
410vertical10248192000020
420vertical102416384000020
430vertical7682048000020
440vertical7684096000020
450vertical7688192000020
460vertical76816384000020
470vertical5122048000020
480vertical5124096000020
490vertical5128192000020
500vertical51216384000020
510vertical2562048000020
520vertical2564096000020
530vertical2568192000020
540vertical25616384000020
550vertical102432768000020
560vertical51232768000020
570vertical51265535000020
580kind 410242048000020
590kind 410244096000020
600kind 410248192000020
610kind 4102416384000020
620kind 47682048000020
630kind 47684096000020
640kind 47688192000020
650kind 476816384000020
660kind 45122048000020
670kind 45124096000020
680kind 45128192000020
690kind 451216384000020
700kind 42562048000020
710kind 42564096000020
720kind 42568192000020
730kind 425616384000020
740kind 4102432768000020
750kind 451232768000020
760kind 451265535000020
77120kind 45128192000256100
78120horizontal5128192000256100
79120interlaced5128192000256100
80120vertical5128192000256100
81255vertical512000025600
82255vertical51265280000-25600
83255horizontal512000025600
84255horizontal51265280000-25600
850vertical5123276805120000
860vertical5123276801280000
87256vertical10241638402560002
88256vertical1024163840768000-2
891024horizontal2048163841280-2010
901024horizontal016384128020-10
91600vertical0002560003
92600vertical0002056000-3
93512vertical000512000-1
94512vertical00000001
95240vertical000736000-2
96240vertical00000002
97240horizontal10243276810-2-10010
98240horizontal544876824102100-10
99256kind 45121638422562012
100256kind 41024163842768-20-1-2
1010horizontal1282048100000
102256horizontal1024020012800
103256horizontal102432768200-12800
104500horizontal512020012800
105500horizontal51264000200-12800
106500horizontal512010008000
107500horizontal512400001000-8000
108240vertical5122048200001
109480vertical51220482-4096000-2
110240horizontal00000000
111180horizontal00000000
112360horizontal256020012800
113360horizontal25602006400
1140interlaced4096641281000000
115480interlaced5124096000020
116240horizontal5124096000020
1170vertical2244096000020
118256vertical1024020012800
119256vertical102432768200-12800
120480vertical512102422560002
121480vertical512102421216000-2
1220vertical76816384000020
1230vertical10248192000020
124256vertical1024020012800
125256vertical102432768200-12800
126256vertical1024020015000
127256vertical102438400200-15000
128360kind 425600006020
129360kind 425621600000-6020
1300vertical2561024000020
131240kind 425600009020
132240kind 425621600000-9020
133510vertical512000012800
134510vertical51265280000-12800
Codeebsrc: Source code recreation for the game Earthbound · src/data/battle/backgrounds/distortion_table.asm#L1-L1486 BG_DISTORTION_TABLE: .WORD $0000 ;Duration .BYTE DISTORTION_STYLE::NONE .WORD $0000 ;Ripple frequency .WORD $0000 ;Ripple amplitude .BYTE $00 ;Unknown .WORD $0000 ;Compression rate .WORD $0000 ;Ripple frequency acceleration .WORD $0000 ;Ripple amplitude acceleration .BYTE $00 ;Speed .WORD $0000 ;Compression rate acceleration …ebsrc: Source code recreation for the game Earthbound · include/structs.asm#L426-L437.STRUCT distortion_entry duration .word ;0 style .byte ;2 ripple_frequency .word ;3 ripple_amplitude .word ;5 speed .byte ;7 compression_rate .word ;8 ripple_frequency_acceleration .word ;10 ripple_amplitude_acceleration .word ;12 speed_acceleration .byte ;14 compression_acceleration .word;15 .ENDSTRUCTebsrc: Source code recreation for the game Earthbound · include/enums.asm#L331-L337.ENUM DISTORTION_STYLE NONE = 0 HORIZONTAL_SMOOTH = 1 HORIZONTAL_INTERLACED = 2 VERTICAL_SMOOTH = 3 UNKNOWN = 4 .ENDENUMEarthBound (USA) · 0xaf708-0xafffe — $CA:F708-$CA:FFFE: BG_DISTORTION_TABLE, 17 bytes a distortionA distorting layer's scroll register gets a new value on every one of the 224 visible scanlines: the frame routine fills a 224-entry buffer, and an indirect HDMA channel in repeat mode writes the line's two bytes to the layer's horizontal scroll register (or, for the vertical kind, its vertical one) as each line is drawn. Each frame the distortion's frequency, amplitude, start phase, and compression change by their per-frame steps before the buffer is refilled; when the second layer exists and its first distortion slot isn't empty, each layer's buffer is refilled only every other frame, the two layers taking turns by the frame counter's low bit. When a distortion's frame count runs out the next of the layer's four distortion slots starts; an empty slot sends it back to the first, and if that is empty too, no distortion loads and the current one keeps running. A count of 0 never runs out. CodeThe horizontal kind (1) shifts each scanline sideways by a sine wave: line by line, the offset is the layer's horizontal scroll plus the sine of the phase times the amplitude's high byte ÷ 256; the phase starts at the start phase plus the target layer's vertical scroll and moves on by the frequency (in 256ths of a sine step) each line. The sine table has 256 entries, one turn. As the start phase changes from frame to frame, the wave travels up or down the screen. CodeChecked by claude, 2026-11-08 — parsed every entry's ten lines on the US branch at the pinned commit and compared the duration, kind, frequency, amplitude, phase, and phase change with the ROM's 17 bytes per entry; the audit of 2026-11-08 compared the remaining columns with the ROM and found them matchingRevised after a check by a second AI model, 2026-11-08.

The table's comments call the eighth byte Unknown and the fifteenth Speed; the structure names them speed and speed_acceleration, and the frame routine passes the first as the sine table's starting index and adds the second to it every frame, so here they are the start phase and its change a frame. earthbound-av/distortion-kind-4 says what the fourth kind does.

Each of the 484 battle groups names two background layers from the layer table, either of which may be none; 52 use both and the rest one or none. earthbound-av/battle-backgrounds

GroupLayer 1Layer 2
000
12620
22600
32610
41140
51150
61160
71170
850
960
1070
1180
121240
131230
141220
151250
163130
171250
181250
191260
201270
211290
223150
233150
241300
253150
263140
271310
281250
291310
3090
3190
32120
33100
3490
3590
3610
37140
38140
39269270
40269270
4190
4290
43110
44110
45210
46210
47210
48110
49220
50200
51200
52220
53200
54160
55160
5610
5710
58140
59140
60269270
6130
6230
63150
64250
65250
66270
67260
68280
69270
70260
71260
72270
73280
74280
75270
76290
77270
783170
793170
80320
81320
82320
83320
84300
853160
86300
87310
883160
89310
90310
91320
92320
93320
943170
953170
96320
97320
983170
99300
100300
101310
102310
103330
104340
10590
106210
107210
10890
109350
110350
111350
112380
1132590
1143180
1153180
1163180
1172590
1182590
119360
120360
1213190
1223190
123360
124410
125390
126420
127400
128430
1291890
1303200
131440
1321570
1332880
134203202
135203202
136480
137460
138490
139490
140530
141530
1423210
143540
144560
145560
146520
147520
148520
1493210
150530
151530
1523210
153550
154570
155610
156590
157580
158580
159570
160600
161600
162620
163620
164620
165630
166630
167610
168590
169590
170640
171650
172660
173710
1743220
175700
176670
1773230
1782680
1792680
180680
181680
182720
183720
184100
185100
186100
187750
188750
189730
190730
191730
192730
193740
194740
195740
196780
197800
198810
199810
200810
201790
202790
203790
204800
205800
206820
207730
208730
209730
210730
211820
212820
213760
214760
2151530
2161530
2171540
2181520
2191520
2201520
2211520
222186185
223274275
224274275
225274275
226276277
227276277
2282800
2292800
2302800
231192191
232192191
233192191
234281282
235281282
2361340
2371340
2381350
2391350
2401330
2411350
2421340
2431350
2441320
2451330
2461330
2471330
2481320
2491390
2501380
2511390
2521380
2531360
2541370
2551390
2561360
2571360
2581360
2591380
2601380
2611370
2621380
2631360
2641380
2651380
266850
267860
268850
269870
270840
271840
272860
2731420
2741430
2751410
2761410
2771430
2781430
2791420
2801430
2811410
2821410
2831400
2841410
2851430
2861430
287510
2881460
2893040
2901460
2913040
2923050
293510
2943050
2951460
2961440
2971440
2981450
2993050
3001460
301950
302950
3032940
304960
305950
306950
307950
308950
309960
310950
311980
312970
313970
314990
315950
316950
317950
318950
319980
320980
321960
322980
3231590
3241550
3251550
3261580
32745258
32845258
3291620
3301610
3311610
3321610
3331600
3341600
3351610
3361610
3371610
3381560
3391560
3401560
3411980
3421510
3433240
3442830
3451510
3462830
3471980
3481510
3491510
3502710
3511980
3523240
3533240
3542710
3552430
3562430
3572710
3581480
3592860
3602860
3612430
3622430
3632710
3641480
3652430
3662430
3672870
3682870
3692900
3702910
3712890
3723120
3731000
3743120
3751020
3762900
3772910
3781000
3793090
3803110
3811030
3821000
3833110
3843110
3851020
3863100
3873100
3881030
3891060
3903030
3911040
3922990
3932990
3941040
3952990
3961060
3971060
3981050
3993250
4003030
4013030
4021060
4032970
4041110
4052090
4062960
4072970
4081070
4091100
4103000
4113010
4121090
413212213
414212213
415212213
416160
417160
418260
419890
420890
4212590
422830
423266267
424190326
42500
426306307
42730
4282590
429490
430600
43150
43270
43360
434306307
435307306
436307306
437192191
438430
4391570
440440
4412840
4421950
443970
444990
445213212
446215214
447217216
448180179
449182181
450170169
451184183
452184183
453273272
4542780
455172171
456194193
457174173
458293292
4591960
4601970
4613020
4622850
463178177
464176175
465168167
4661990
467201200
4682080
469211210
470164163
471166165
4722980
47300
474219218
4752200
476222221
477224223
4782250
4792260
4802270
48100
482192191
4832650
Code notesebsrc: Source code recreation for the game Earthbound · src/data/battle/background_layer_table.asm#L1-L486 BTL_ENTRY_BG_TABLE: .WORD BATTLEBG_LAYER::NONE, BATTLEBG_LAYER::NONE ;0 .WORD BATTLEBG_LAYER::UNKNOWN262, BATTLEBG_LAYER::NONE ;1 .WORD BATTLEBG_LAYER::UNKNOWN260, BATTLEBG_LAYER::NONE ;2 .WORD BATTLEBG_LAYER::UNKNOWN261, BATTLEBG_LAYER::NONE ;3 …EarthBound (USA) · 0xbd89a-0xbe029 — $CB:D89A-$CB:E029: BTL_ENTRY_BG_TABLE, two layer numbers a group, 484 groupsChecked by claude, 2026-11-08 — parsed the table on the US branch at the pinned commitRevised after a check by a second AI model, 2026-11-08.

Group numbers match earthbound-tables/battle-groups. Layer numbers index earthbound-av/layers.

Every frame, each background layer counts down its palette timer (a timer at 0 never runs); when it runs out it is reset to the layer's frames-a-step value and the layer's colors move one step. Style 1 rotates the colors of cycle 1's range by one place, wrapping at its end; style 2 rotates cycle 2's range the same way and then cycle 1's; style 3 runs cycle 1's range forth and back, the colors sliding one way and then mirrored back over twice the range's length. Style 0 doesn't cycle. earthbound-av/palette-cycling

About: EarthBound Palette cycling

Codeebsrc: Source code recreation for the game Earthbound · src/misc/battlebgs/generate_frame.asm#L23-L59LDY #loaded_bg_data::freeze_palette_scrolling LDA (@LOCAL07),Y AND #$00FF BNEL @TARGET_BG_LAYER_SELECTION_COMPLETE LDA @LOCAL07 CLC ADC #loaded_bg_data::palette_change_duration_left TAX SEP #PROC_FLAGS::ACCUM8 LDA __BSS_START__,X STA @LOCAL05 REP #PROC_FLAGS::ACCUM8 …Our readinga frozen layer skips cycling and scrolling23–26count the timer down; unless it reaches 0, skip27–43reset it to the frames-a-step value44–47branch on the style: 2, 1, 3, else none48–58ebsrc: Source code recreation for the game Earthbound · src/misc/battlebgs/generate_frame.asm#L143-L227@PALETTE_SHIFTING_STYLE1: LDY #loaded_bg_data::palette_cycle_1_last SEP #PROC_FLAGS::ACCUM8 LDA (@LOCAL07),Y LDY #loaded_bg_data::palette_cycle_1_first SEC SBC (@LOCAL07),Y REP #PROC_FLAGS::ACCUM8 AND #$00FF STA @VIRTUAL02 INC @VIRTUAL02 LDX #0 …Our readingn = the range's last color − first + 1143–153for each color i of the range157 source = i − step, plus n when i is below the step158–176 color i = the layer's stored color at the source177–207step += 1, back to 0 at n212–227ebsrc: Source code recreation for the game Earthbound · src/misc/battlebgs/generate_frame.asm#L228-L338@PALETTE_SHIFTING_STYLE3: LDY #loaded_bg_data::palette_cycle_1_last SEP #PROC_FLAGS::ACCUM8 LDA (@LOCAL07),Y LDY #loaded_bg_data::palette_cycle_1_first SEC SBC (@LOCAL07),Y REP #PROC_FLAGS::ACCUM8 AND #$00FF INC STA @LOCAL01 LDY #0 …Our readingn = the range's length228–238for each color i: k = i + step; past 2n, less 2n; past n, mirrored (2n − 1 − k)242–280 color i = the stored color at k281–310step += 1, back to 0 at 2n316–337ebsrc: Source code recreation for the game Earthbound · src/misc/battlebgs/generate_frame.asm#L59-L143@PALETTE_SHIFTING_STYLE2: LDY #loaded_bg_data::palette_cycle_2_last SEP #PROC_FLAGS::ACCUM8 LDA (@LOCAL07),Y LDY #loaded_bg_data::palette_cycle_2_first SEC SBC (@LOCAL07),Y REP #PROC_FLAGS::ACCUM8 AND #$00FF STA @VIRTUAL02 INC @VIRTUAL02 LDX #0 …Checked by claude, 2026-11-08 — read GENERATE_BATTLEBG_FRAME's palette part on the US branch at the pinned commit; style 2 runs cycle 2's loop and then style 1'sRevised after a check by a second AI model, 2026-11-08.

A step copies colors from the layer's stored palette into the live one, so a cycle never drifts. The per-entry styles and ranges are in earthbound-av/layers.

Each frame, unless the layer's freeze flag is set, a background layer's speed grows by its acceleration and its position by its speed, horizontally and vertically, in 256ths of a pixel; the position's whole pixels (to 255) plus the screen effect's offset go to the layer's scroll registers. When a movement's frame count runs out the layer moves to the next of its four movement slots, back to the first after the fourth; an empty slot also sends it back to the first, and if that is empty too, no movement loads and the old speed and acceleration keep running. A count of 0 never runs out. earthbound-av/scroll-motion

Codeebsrc: Source code recreation for the game Earthbound · src/misc/battlebgs/generate_frame.asm#L346-L555LDA @LOCAL07 CLC ADC #loaded_bg_data::scrolling_duration_left TAX LDA __BSS_START__,X BEQL @UNKNOWN29 DEC STA __BSS_START__,X BNEL @UNKNOWN29 … STX @LOCAL00 SEP #PROC_FLAGS::ACCUM8 …Our readingcount the movement's frames down; when they run out348–354next of the four slots; an empty slot goes back to the first357–388load the movement's frames, speeds, and accelerations389–445speed += acceleration; position += speed, horizontally446–467and vertically468–486pick the layer the result goes to487–496ebsrc: Source code recreation for the game Earthbound · src/misc/battlebgs/generate_frame.asm#L23-L26LDY #loaded_bg_data::freeze_palette_scrolling LDA (@LOCAL07),Y AND #$00FF BNEL @TARGET_BG_LAYER_SELECTION_COMPLETEChecked by claude, 2026-11-08 — read GENERATE_BATTLEBG_FRAME's scrolling part on the US branch at the pinned commitRevised after a check by a second AI model, 2026-11-08.

Scrolling and palette cycling stop once Giygas is defeated. The movements are earthbound-av/scrolling.

A distorting layer's scroll register gets a new value on every one of the 224 visible scanlines: the frame routine fills a 224-entry buffer, and an indirect HDMA channel in repeat mode writes the line's two bytes to the layer's horizontal scroll register (or, for the vertical kind, its vertical one) as each line is drawn. Each frame the distortion's frequency, amplitude, start phase, and compression change by their per-frame steps before the buffer is refilled; when the second layer exists and its first distortion slot isn't empty, each layer's buffer is refilled only every other frame, the two layers taking turns by the frame counter's low bit. When a distortion's frame count runs out the next of the layer's four distortion slots starts; an empty slot sends it back to the first, and if that is empty too, no distortion loads and the current one keeps running. A count of 0 never runs out. earthbound-av/distortion-hdma

Codeebsrc: Source code recreation for the game Earthbound · src/misc/battlebgs/generate_frame.asm#L556-L822@TARGET_BG_LAYER_SELECTION_COMPLETE: LDA @LOCAL07 CLC ADC #loaded_bg_data::distortion_duration_left TAX LDA __BSS_START__,X BEQL @DISTORTION_DMA_DONE DEC STA __BSS_START__,X BNEL @DISTORTION_DMA_DONE LDA @LOCAL07 CLC …Our readingcount the distortion's frames down; when they run out, the next of four slots557–599load the entry's kind, frequency, amplitude, phase, compression, and their steps600–715the vertical kind sends the buffer to the vertical scroll register, the rest to the horizontal717–737none: stop738–745frequency, amplitude, phase, and compression each += their step748–785pass the kind − 1 and the compression to the buffer routine786–798at 30 frames a second, refill only on this layer's frames799–805fill the buffer from frequency, amplitude's high byte, and phase806–820ebsrc: Source code recreation for the game Earthbound · src/misc/battlebgs/do_battlebg_dma.asm#L1-L53 DO_BATTLEBG_DMA: PHY TAY LDA f:DMA_TARGET_REGISTERS,X PHA TYA ASL ASL ASL ASL TAX …Our readingthe channel's target is the layer's scroll register5–6mode $42: indirect, two writes to one register20–21copy the HDMA table for layer 1 or 225–43start the channel with the frame's HDMA45–51ebsrc: Source code recreation for the game Earthbound · src/data/unknown/C0AE26.asm#L2-L8;an HDMA table (indirect) for battle backgrounds UNKNOWN_C0AE26: .BYTE $E4 .WORD .LOWORD(ANIMATED_BACKGROUND_LAYER_1_HDMA_BUFFER) .BYTE $FC .WORD .LOWORD(ANIMATED_BACKGROUND_LAYER_1_HDMA_BUFFER) + 200 .BYTE $00ebsrc: Source code recreation for the game Earthbound · src/data/dma_target_registers.asm#L1-L3 DMA_TARGET_REGISTERS: .LOBYTES WMDATA, BG1HOFS, BG2HOFS, BG3HOFS, BG4HOFS, BG1VOFS, BG2VOFS, BG3VOFS, BG4VOFSebsrc: Source code recreation for the game Earthbound · src/battle/load_battlebg.asm#L706-L717@UNKNOWN23: REP #PROC_FLAGS::ACCUM8 STZ DISTORT_30FPS LDA LOADED_BG_DATA_LAYER2 AND #$00FF BEQ @UNKNOWN24 LDA LOADED_BG_DATA_LAYER2 + loaded_bg_data::distortion_styles AND #$00FF BEQ @UNKNOWN24 LDA #1 STA DISTORT_30FPS @UNKNOWN24:Checked by claude, 2026-11-08 — read GENERATE_BATTLEBG_FRAME's distortion part, DO_BATTLEBG_DMA, its HDMA table, and the target registers on the US branch at the pinned commitRevised after a check by a second AI model, 2026-11-08.

The HDMA table hands the channel 100 lines from the buffer's start and then 124 from 200 bytes in, two bytes a line ($E4 and $FC are repeat counts of 100 and 124).

The horizontal kind (1) shifts each scanline sideways by a sine wave: line by line, the offset is the layer's horizontal scroll plus the sine of the phase times the amplitude's high byte ÷ 256; the phase starts at the start phase plus the target layer's vertical scroll and moves on by the frequency (in 256ths of a sine step) each line. The sine table has 256 entries, one turn. As the start phase changes from frame to frame, the wave travels up or down the screen. earthbound-av/distortion-horizontal

Codeebsrc: Source code recreation for the game Earthbound · src/misc/battlebgs/prepare_bg_offset_tables.asm#L2-L34PREPARE_BG_OFFSET_TABLES: PHD PHA TDC SEC SBC #$000B AND #$FF00 TCD PLA STA $00 TXA SEP #PROC_FLAGS::ACCUM8 …Our readingthe amplitude goes to the multiplier; phase = the start phase, in 256ths11–19one layer's buffer is 224 lines; the second layer's follows it21–29the kind picks the loop: 0 and 1, 2, or 330–34ebsrc: Source code recreation for the game Earthbound · src/misc/battlebgs/prepare_bg_offset_tables.asm#L35-L70@UNKNOWN2: LDA BACKGROUND_DISTORTION_TARGET_LAYER BEQ @UNKNOWN3 DEC ASL ASL TAX LDA __BSS_START__+51,X CLC ADC $03 AND #$00FF STA $03 …Our readingwith a target layer: phase += its vertical scroll; base = its horizontal scroll36–48kind 0: for each line50–53 offset = base + sine(phase) × amplitude ÷ 25654–60 phase += frequency61–64until the buffer is full65–68ebsrc: Source code recreation for the game Earthbound · src/data/sine_table.asm#L1-L258SINE_LOOKUP_TABLE: .BYTE $00 .BYTE $03Checked by claude, 2026-11-08 — read PREPARE_BG_OFFSET_TABLES on the US branch at the pinned commit; the product is the PPU multiplier's (M7A × M7B, read from MPYM)Revised after a check by a second AI model, 2026-11-08.

Distortion kinds are the table's numbers less 1 in this routine. Which layer's scroll the target layer names is read from the scroll mirrors at $31 and $33 (the disassembly's __BSS_START__+49 and +51).

The interlaced kind (2) draws the same sine wave as the horizontal kind but alternates its sign: even scanlines move by + the wave and odd ones by −, so neighboring lines pull apart in opposite directions. earthbound-av/distortion-interlaced

Codeebsrc: Source code recreation for the game Earthbound · src/misc/battlebgs/prepare_bg_offset_tables.asm#L2-L34PREPARE_BG_OFFSET_TABLES: PHD PHA TDC SEC SBC #$000B AND #$FF00 TCD PLA STA $00 TXA SEP #PROC_FLAGS::ACCUM8 …Our readingthe amplitude goes to the multiplier; phase = the start phase, in 256ths11–19one layer's buffer is 224 lines; the second layer's follows it21–29the kind picks the loop: 0 and 1, 2, or 330–34ebsrc: Source code recreation for the game Earthbound · src/misc/battlebgs/prepare_bg_offset_tables.asm#L35-L103@UNKNOWN2: LDA BACKGROUND_DISTORTION_TARGET_LAYER BEQ @UNKNOWN3 DEC ASL ASL TAX LDA __BSS_START__+51,X CLC ADC $03 AND #$00FF STA $03 …Our readingwith a target layer: phase += its vertical scroll; base = its horizontal scroll36–48kind 1: for each pair of lines71–73 first: base + sine(phase) × amplitude ÷ 256; phase += frequency74–84 second: base − sine(phase) × amplitude ÷ 256; phase += frequency85–95until the buffer is full96–103ebsrc: Source code recreation for the game Earthbound · src/misc/battlebgs/prepare_bg_offset_tables.asm#L71-L95@UNKNOWN5: LDY $07 @UNKNOWN6: LDX $03 LDA f:SINE_LOOKUP_TABLE,X STA f:M7B LDA f:MPYM CLC ADC $05 STA ANIMATED_BACKGROUND_LAYER_1_HDMA_BUFFER,Y LDA $02 CLC …Checked by claude, 2026-11-08 — read PREPARE_BG_OFFSET_TABLES on the US branch at the pinned commitRevised after a check by a second AI model, 2026-11-08.

The vertical kind (3) writes the vertical scroll register line by line: an accumulator starts at the target layer's vertical scroll × 256 and grows by the compression rate before each line's value is taken, and each line gets the accumulator's whole part (to 255) plus the sine wave. With a compression of 0 every line gets the layer's vertical scroll plus the wave; a rate r adds (line + 1) × r ÷ 256 more, line by line, in 256ths of a row. earthbound-av/distortion-vertical

Codeebsrc: Source code recreation for the game Earthbound · src/misc/battlebgs/prepare_bg_offset_tables.asm#L2-L34PREPARE_BG_OFFSET_TABLES: PHD PHA TDC SEC SBC #$000B AND #$FF00 TCD PLA STA $00 TXA SEP #PROC_FLAGS::ACCUM8 …Our readingthe amplitude goes to the multiplier; phase = the start phase, in 256ths11–19one layer's buffer is 224 lines; the second layer's follows it21–29the kind picks the loop: 0 and 1, 2, or 330–34ebsrc: Source code recreation for the game Earthbound · src/misc/battlebgs/prepare_bg_offset_tables.asm#L104-L139@UNKNOWN7: LDA BACKGROUND_DISTORTION_TARGET_LAYER BEQ @UNKNOWN8 DEC ASL ASL TAX LDA __BSS_START__+51,X @UNKNOWN8: XBA AND #$FF00 STA $05 …Our readingstart the accumulator at the target layer's vertical scroll × 256105–115for each line: accumulator += compression117–124 offset = the accumulator's high byte + sine(phase) × amplitude ÷ 256125–128 phase += frequency, until the buffer is full129–139ebsrc: Source code recreation for the game Earthbound · src/misc/battlebgs/prepare_bg_offset_tables.asm#L104-L137@UNKNOWN7: LDA BACKGROUND_DISTORTION_TARGET_LAYER BEQ @UNKNOWN8 DEC ASL ASL TAX LDA __BSS_START__+51,X @UNKNOWN8: XBA AND #$FF00 STA $05 …Checked by claude, 2026-11-08 — read PREPARE_BG_OFFSET_TABLES on the US branch at the pinned commitRevised after a check by a second AI model, 2026-11-08.

The fourth kind (4), unnamed in the disassembly, runs the vertical kind's sums (the compression accumulator plus the wave) with the interlaced kind's alternating sign, but its buffer goes to the horizontal scroll register, as every kind but 3 does. So neighboring lines wave apart sideways as in the interlaced kind, around a base that the routine takes from the target layer's vertical scroll, and a compression rate shears the layer sideways one step further each line. earthbound-av/distortion-kind-4

Codeebsrc: Source code recreation for the game Earthbound · src/misc/battlebgs/prepare_bg_offset_tables.asm#L2-L34PREPARE_BG_OFFSET_TABLES: PHD PHA TDC SEC SBC #$000B AND #$FF00 TCD PLA STA $00 TXA SEP #PROC_FLAGS::ACCUM8 …Our readingthe amplitude goes to the multiplier; phase = the start phase, in 256ths11–19one layer's buffer is 224 lines; the second layer's follows it21–29the kind picks the loop: 0 and 1, 2, or 330–34ebsrc: Source code recreation for the game Earthbound · src/misc/battlebgs/prepare_bg_offset_tables.asm#L140-L193@UNKNOWN10: LDA BACKGROUND_DISTORTION_TARGET_LAYER BEQ @UNKNOWN11 DEC ASL ASL TAX LDA __BSS_START__+51,X @UNKNOWN11: XBA AND #$FF00 STA $05 …Our readingstart the accumulator at the target layer's vertical scroll × 256141–151for each pair of lines: accumulator += compression; first = its high byte + the wave153–168 accumulator += compression; second = its high byte − the wave169–184until the buffer is full185–193ebsrc: Source code recreation for the game Earthbound · src/misc/battlebgs/generate_frame.asm#L717-L737 CMP #DISTORTION_STYLE::VERTICAL_SMOOTH BNE @HORIZONTAL_DISTORTION LDY @LOCAL08 LDX @LOCAL06 INX INX INX INX LDA @LOCAL08 CLC ADC #5 JSL DO_BATTLEBG_DMA …ebsrc: Source code recreation for the game Earthbound · src/misc/battlebgs/prepare_bg_offset_tables.asm#L153-L184@UNKNOWN12: LDX $03 LDA f:SINE_LOOKUP_TABLE,X STA f:M7B LDA $05 CLC ADC BACKGROUND_DISTORTION_COMPRESSION_RATE STA $05 XBA AND #$00FF CLC ADC f:MPYM …Checked by claude, 2026-11-08 — read PREPARE_BG_OFFSET_TABLES and the frame routine's register choice on the US branch at the pinned commitRevised after a check by a second AI model, 2026-11-08.

26 entries of the distortion table are kind 4, 2 of them with a compression rate.

The battle swirl is one of 6 swirl animations (entry 0 is empty), each a run of window shapes from a list of 126 HDMA window tables: swirl 1 shows shapes 0–22, a new one every 2 frames, and swirl 3 shows shapes 38–59, a new one every 3 frames. Battle groups from 448 on use swirl 3, and every other battle uses swirl 1. earthbound-av/battle-swirl

About: EarthBound HDMA

SwirlFrames per shapeFirst shapeShapes
0000
12023
242315
333822
446021
528128
6310917
Codeebsrc: Source code recreation for the game Earthbound · src/bankconfig/common/bank0e.asm#L464-L465SWIRL_PRIMARY_TABLE: .BYTE $00, $00, $00, $00, $02, $00, $17, $00, $04, $17, $0F, $00, $03, $26, $16, $00, $04, $3C, $15, $00, $02, $51, $1C, $00, $03, $6D, $11, $00Our readingeach 4 bytes: frames per shape, first shape, shape count, 0465EarthBound (USA) · 0xedd41-0xedd5c — the swirl table, 7 four-byte entriesebsrc: Source code recreation for the game Earthbound · src/unknown/C4/C4A67E.asm#L11-L86 STX @OPTIONS STA @VIRTUAL04 LDA @OPTIONS AND #$0002 BEQ @UNKNOWN0 SEP #PROC_FLAGS::ACCUM8 … ADC @VIRTUAL06 STA @VIRTUAL06 SEP #PROC_FLAGS::ACCUM8 LDA [@VIRTUAL06] STA @LOCAL00 …Our readingoptions bit 0 → SWIRL_REVERSED; entry → FRAMES_UNTIL_NEXT_SWIRL_FRAME, SWIRL_FRAMES_LEFT, SWIRL_HDMA_TABLE_ID52–86ebsrc: Source code recreation for the game Earthbound · src/data/battle/swirl_pointers.asm#L1-L128 SWIRL_POINTER_TABLE: .WORD .LOWORD(SWIRL_DATA_0) .WORD .LOWORD(SWIRL_DATA_1) …ebsrc: Source code recreation for the game Earthbound · src/overworld/battle_swirl_sequence.asm#L12-L96LDA #$0001 STA $16 … @UNKNOWN3: LDA CURRENT_BATTLE_GROUP CMP #ENEMY_GROUP::BOSS_FRANK BCC @UNKNOWN4 LDA #$0003 STA $16 … LDY #$001E LDX $02 …Our readinginitiative → color and music; group ≥ BOSS_FRANK → swirl 312–96ebsrc: Source code recreation for the game Earthbound · include/constants/enemy_groups.asm#L451-L451BOSS_FRANK = 448ebsrc: Source code recreation for the game Earthbound · src/battle/init_scripted.asm#L51-L51JSL BATTLE_SWIRL_SEQUENCEChecked by claude, 2026-11-08 — Parsed SWIRL_PRIMARY_TABLE (src/bankconfig/common/bank0e.asm) and found its 28 bytes once in the ROM; checked that the shape counts sum to the 126 entries of SWIRL_POINTER_TABLE and that the runs are contiguous; read battle_swirl_sequence.asm, C2E8C4.asm, and C4A67E.asm; scratch/swirl.mjs.Revised after a check by a second AI model, 2026-11-08.

Other code starts the remaining swirls: the battle's opening animation (start_battle_animation.asm) starts swirls 5, 4, and 2, the final battle's scene changes start swirl 6, and the screen transitions pass a swirl number from their own data. The 126 window tables are data lines in swirl_pointers.asm's bank; their format is not read here.

Cited by: Battle transition

During the battle swirl the screen subtracts a fixed color inside the color window. The swirl sets that color to red 4, green 4, blue 0 for a normal battle; red 28, green 5, blue 12 when the party strikes first; and red 0, green 31, blue 31 when the enemies strike first. It halves the result for a normal battle and for battle groups from 448 on, whoever strikes first. earthbound-av/battle-swirl-tint

Codeebsrc: Source code recreation for the game Earthbound · src/overworld/battle_swirl_sequence.asm#L12-L91LDA #$0001 STA $16 LDA #$0004 STA @SWIRL_RED STA @SWIRL_GREEN LDY #$0000 STY @SWIRL_BLUE LDA BATTLE_INITIATIVE BEQ @UNKNOWN0 CMP #INITIATIVE::PARTY_FIRST BEQ @UNKNOWN1 CMP #INITIATIVE::ENEMIES_FIRST …ebsrc: Source code recreation for the game Earthbound · include/hardware.asm#L70-L94.ENUM CGWSEL_BITS … COLOUR_MATH_ENABLE_ALWAYS = 0 << 4 COLOUR_MATH_ENABLE_MATHWIN = 1 << 4 … SUBSCREEN_BGOBJ_ENABLE = 1 << 1 SUBSCREEN_BGOBJ_DISABLE = 0 << 1 … .ENUM CGADSUB_BITS COLOUR_MATH_ADDSUB = 1 << 7 COLOUR_MATH_DIV2 = 1 << 6ebsrc: Source code recreation for the game Earthbound · include/constants/enemy_groups.asm#L451-L451BOSS_FRANK = 448PPU registers · CGADSUB - Color math designation ($2131 write)+--------- Operator type (0 = add, 1 = subtract)PPU registers · CGADSUB - Color math designation ($2131 write)|+-------- Half color mathPPU registers · CGWSEL - Color addition select ($2130 write)|||| +-- Addend (0 = fixed color, 1 = subscreen)PPU registers · CGWSEL - Color addition select ($2130 write)||++------ Sub screen color window transparent regionPPU registers · CGWSEL - Color addition select ($2130 write)1 |Outside color windowPPU registers · CGWSEL - Color addition select ($2130 write)The sub-screen setting is for masking color math.Checked by claude, 2026-11-08 — read battle_swirl_sequence.asm's initiative and group tests and its SET_COLDATA and SET_COLOUR_ADDSUB_MODE calls on the US branch at the pinned commit, the CGWSEL and CGADSUB bit names in hardware.asm, and what those bits do in the SNESdev Wiki's PPU registers page: subtract (bit 7) and half (bit 6) set, the fixed color as addend, and the sub-screen side made transparent outside the color windowRevised after a check by a second AI model, 2026-11-08.

Cited by: Battle transition, Color math

The battle swirl plays song 176 for a normal battle or a party first strike, song 9 for an enemy first strike, and song 8 for battle groups from 448 on. earthbound-av/battle-swirl-music

Codeebsrc: Source code recreation for the game Earthbound · src/overworld/battle_swirl_sequence.asm#L19-L71LDA BATTLE_INITIATIVE BEQ @UNKNOWN0 CMP #INITIATIVE::PARTY_FIRST BEQ @UNKNOWN1 CMP #INITIATIVE::ENEMIES_FIRST BEQ @UNKNOWN2 BRA @UNKNOWN3 @UNKNOWN0: LDX #MUSIC::BATTLE_SWIRL4 STX @SWIRL_MUSIC … @UNKNOWN1: …ebsrc: Source code recreation for the game Earthbound · include/constants/music.asm#L10-L11BATTLE_SWIRL1 = 8 BATTLE_SWIRL2 = 9ebsrc: Source code recreation for the game Earthbound · include/constants/music.asm#L178-L178BATTLE_SWIRL4 = 176ebsrc: Source code recreation for the game Earthbound · include/constants/enemy_groups.asm#L451-L451BOSS_FRANK = 448The song table has 191 entries, one for each song number from 1 to 191; each is three bytes, the primary sample pack, the secondary sample pack, and the sequence pack that the sound driver loads (255 skips that load). This is the game's track listing, by song number, with where the game plays each, from every request found: the music byte of each enemy (the battle's first enemy sets the battle music), the map's music lists that the 2560 map sectors point to, the Sound Stone's list, the song each final-battle scene is passed, the calls to the music-change routine in the code, and the music control codes in the text scripts, battle messages included. 186 entries are requested; no request found reaches 10, 109, 133, 180, 189. These are candidates for unused, not findings: the debug sound menu, where it can be reached, steps through every number from 0 to 191, and a text control code with a zero argument takes its song from a value the script set earlier. CodeChecked by claude, 2026-11-08 — read battle_swirl_sequence.asm's song choices and its CHANGE_MUSIC call on the US branch at the pinned commit, and the song numbers in music.asmRevised after a check by a second AI model, 2026-11-08.