// This file is part of Gopher2600.
//
// Gopher2600 is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Gopher2600 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Gopher2600.  If not, see <https://www.gnu.org/licenses/>.

package symbols_test

import (
	"os"
	"testing"

	"github.com/jetsetilly/gopher2600/disassembly/symbols"
	"github.com/jetsetilly/gopher2600/hardware/memory/cartridge"
	"github.com/jetsetilly/gopher2600/test"
)

func TestDefaultSymbols(t *testing.T) {
	var sym symbols.Symbols

	cart := cartridge.NewCartridge(nil)
	err := sym.ReadDASMSymbolsFile(cart)
	if err != nil {
		t.Errorf("unexpected error (%s)", err)
	}
	tw := &test.Writer{}

	sym.ListSymbols(os.Stdout)
	sym.ListSymbols(tw)

	if !tw.Compare(expectedDefaultSymbols) {
		t.Errorf("default symbols list is wrong")
	}
}

func TestFlappySymbols(t *testing.T) {
	var sym symbols.Symbols

	// make a dummy cartridge with the minimum amount of information required
	// for ReadSymbolsFile() to work
	cart := cartridge.NewCartridge(nil)
	cart.Filename = "testdata/flappy.bin"

	err := sym.ReadDASMSymbolsFile(cart)
	if err != nil {
		t.Errorf("unexpected error (%s)", err)
	}

	tw := &test.Writer{}

	sym.ListSymbols(os.Stdout)
	sym.ListSymbols(tw)

	if !tw.Compare(expectedFlappySymbols) {
		t.Errorf("flappy symbols list is wrong")
	}
}

const expectedDefaultSymbols = `Labels
------

Read Symbols
------------
0x0000 -> CXM0P [System]
0x0001 -> CXM1P [System]
0x0002 -> CXP0FB [System]
0x0003 -> CXP1FB [System]
0x0004 -> CXM0FB [System]
0x0005 -> CXM1FB [System]
0x0006 -> CXBLPF [System]
0x0007 -> CXPPMM [System]
0x0008 -> INPT0 [System]
0x0009 -> INPT1 [System]
0x000a -> INPT2 [System]
0x000b -> INPT3 [System]
0x000c -> INPT4 [System]
0x000d -> INPT5 [System]
0x0280 -> SWCHA [System]
0x0281 -> SWACNT [System]
0x0282 -> SWCHB [System]
0x0283 -> SWBCNT [System]
0x0284 -> INTIM [System]
0x0285 -> TIMINT [System]

Write Symbols
-------------
0x0000 -> VSYNC [System]
0x0001 -> VBLANK [System]
0x0002 -> WSYNC [System]
0x0003 -> RSYNC [System]
0x0004 -> NUSIZ0 [System]
0x0005 -> NUSIZ1 [System]
0x0006 -> COLUP0 [System]
0x0007 -> COLUP1 [System]
0x0008 -> COLUPF [System]
0x0009 -> COLUBK [System]
0x000a -> CTRLPF [System]
0x000b -> REFP0 [System]
0x000c -> REFP1 [System]
0x000d -> PF0 [System]
0x000e -> PF1 [System]
0x000f -> PF2 [System]
0x0010 -> RESP0 [System]
0x0011 -> RESP1 [System]
0x0012 -> RESM0 [System]
0x0013 -> RESM1 [System]
0x0014 -> RESBL [System]
0x0015 -> AUDC0 [System]
0x0016 -> AUDC1 [System]
0x0017 -> AUDF0 [System]
0x0018 -> AUDF1 [System]
0x0019 -> AUDV0 [System]
0x001a -> AUDV1 [System]
0x001b -> GRP0 [System]
0x001c -> GRP1 [System]
0x001d -> ENAM0 [System]
0x001e -> ENAM1 [System]
0x001f -> ENABL [System]
0x0020 -> HMP0 [System]
0x0021 -> HMP1 [System]
0x0022 -> HMM0 [System]
0x0023 -> HMM1 [System]
0x0024 -> HMBL [System]
0x0025 -> VDELP0 [System]
0x0026 -> VDELP1 [System]
0x0027 -> VDELBL [System]
0x0028 -> RESMP0 [System]
0x0029 -> RESMP1 [System]
0x002a -> HMOVE [System]
0x002b -> HMCLR [System]
0x002c -> CXCLR [System]
0x0280 -> SWCHA [System]
0x0281 -> SWACNT [System]
0x0282 -> SWCHB [System]
0x0283 -> SWBCNT [System]
0x0294 -> TIM1T [System]
0x0295 -> TIM8T [System]
0x0296 -> TIM64T [System]
0x0297 -> T1024T [System]
`

const expectedFlappySymbols = `Labels
------
0x1000 -> DATA_SEGMENT [DASM]
0x1008 -> TEXT_OK [DASM]
0x1010 -> TEXT_QMARK [DASM]
0x1018 -> WINGS [DASM]
0x1020 -> WINGS_FLAT [DASM]
0x1028 -> WINGS_DOWN [DASM]
0x1030 -> HEADS [DASM]
0x1038 -> HEAD_BOY_A [DASM]
0x1040 -> HEAD_GIRL_B [DASM]
0x1048 -> HEAD_BOY_B [DASM]
0x1050 -> HEADS_TABLE [DASM]
0x1054 -> _SPLASH [DASM]
0x1056 -> SPLASH [DASM]
0x105e -> DIGIT_0 [DASM]
0x1063 -> DIGIT_1 [DASM]
0x1068 -> DIGIT_2 [DASM]
0x106d -> DIGIT_3 [DASM]
0x1072 -> DIGIT_4 [DASM]
0x1077 -> DIGIT_5 [DASM]
0x107c -> DIGIT_6 [DASM]
0x1081 -> DIGIT_7 [DASM]
0x1086 -> DIGIT_8 [DASM]
0x108b -> DIGIT_9 [DASM]
0x1090 -> DIGIT_TABLE [DASM]
0x109a -> FOLIAGE [DASM]
0x10b8 -> FOREST_MID_0_INIT [DASM]
0x10b9 -> FOREST_MID_1_INIT [DASM]
0x10ba -> FOREST_MID_2_INIT [DASM]
0x10bb -> FOREST_STATIC_0 [DASM]
0x10bc -> FOREST_STATIC_1 [DASM]
0x10bd -> FOREST_STATIC_2 [DASM]
0x1100 -> SET_OBSTACLE_TABLE [DASM]
0x1137 -> FINE_POS_TABLE [DASM]
0x1204 -> OBSTACLES [DASM]
0x120b -> BRANCHES [DASM]
0x1212 -> EASY_FLIGHT_PATTERN [DASM]
0x1228 -> __FINE_POS_TABLE [DASM]
0x1237 -> SFX_TABLE [DASM]
0x123d -> SFX_FLAP [DASM]
0x1243 -> SFX_COLLISION [DASM]
0x1255 -> SFX_SPLASH [DASM]
0x127f -> setup [DASM]
0x1285 -> .CLEAR_STACK [DASM]
0x128d -> title_screen [DASM]
0x128f -> .VSLP1 [DASM]
0x1296 -> .vblank [DASM]
0x12a5 -> .done [DASM]
0x12ab -> .vblank_loop [DASM]
0x12b4 -> .visible_loop [DASM]
0x12b9 -> .overscan_kernel [DASM]
0x12c1 -> .overscan_loop [DASM]
0x12c9 -> .vblank_loop [DASM]
0x12d2 -> .overscan_kernel [DASM]
0x12da -> .overscan_loop [DASM]
0x12df -> game_state_init [DASM]
0x1338 -> game_restart [DASM]
0x1342 -> .done [DASM]
0x1351 -> .done_hiscore [DASM]
0x135b -> .coarse_div [DASM]
0x135f -> .done_coarse_div [DASM]
0x1372 -> .coarse_div [DASM]
0x1376 -> .done_coarse_div [DASM]
0x13b9 -> game_vsync [DASM]
0x13bb -> .VSLP1_1 [DASM]
0x13c2 -> game_vblank [DASM]
0x13dc -> .far_jmp_collision [DASM]
0x13df -> .far_jmp_drown [DASM]
0x13e2 -> .far_jmp_approach [DASM]
0x13e5 -> .far_jmp_play [DASM]
0x13e8 -> game_vblank_ready [DASM]
0x13f0 -> .done [DASM]
0x1406 -> .no_store_index [DASM]
0x1418 -> .ready_state_triage [DASM]
0x1426 -> .update_foliage [DASM]
0x142f -> .rotate_forest [DASM]
0x143b -> .jump_tree [DASM]
0x1442 -> .cont_forest [DASM]
0x144b -> .carry_tree [DASM]
0x1451 -> .foliage_updated [DASM]
0x1453 -> .prepare_display [DASM]
0x1459 -> .display_empty [DASM]
0x1464 -> .display_ready_logo [DASM]
0x147b -> .coarse_div [DASM]
0x147f -> .done_coarse_div [DASM]
0x1490 -> .coarse_div [DASM]
0x1494 -> .done_coarse_div [DASM]
0x14a3 -> game_vblank_death_collision [DASM]
0x14b0 -> .update_foliage [DASM]
0x14b9 -> .foliage_updated [DASM]
0x14be -> .update_bird [DASM]
0x14c8 -> .use_wings_up [DASM]
0x14cf -> .use_wings_flat [DASM]
0x14d6 -> .use_wings_down [DASM]
0x14da -> .wings_updated [DASM]
0x14eb -> .update_pattern_idx [DASM]
0x14f7 -> .store_index [DASM]
0x1503 -> .enter_drowning_state [DASM]
0x1523 -> .prepare_display [DASM]
0x1528 -> .coarse_div [DASM]
0x152c -> .done_coarse_div [DASM]
0x1540 -> .coarse_div [DASM]
0x1544 -> .done_coarse_div [DASM]
0x1553 -> game_vblank_death_drown [DASM]
0x1560 -> .update_foliage [DASM]
0x1569 -> .foliage_updated [DASM]
0x156e -> .update_bird [DASM]
0x1579 -> .drowning_end [DASM]
0x157f -> .prepare_display [DASM]
0x1584 -> .coarse_div [DASM]
0x1588 -> .done_coarse_div [DASM]
0x159c -> .coarse_div [DASM]
0x15a0 -> .done_coarse_div [DASM]
0x15b1 -> .coarse_div [DASM]
0x15b5 -> .done_coarse_div [DASM]
0x15cc -> .coarse_div [DASM]
0x15d0 -> .done_coarse_div [DASM]
0x15df -> .show_obstacle_1 [DASM]
0x15e4 -> .coarse_div [DASM]
0x15e8 -> .done_coarse_div [DASM]
0x15f4 -> .flipped_obstacles [DASM]
0x160b -> game_vblank_approach [DASM]
0x161f -> .hpos_done [DASM]
0x162d -> game_vblank_main_triage [DASM]
0x163a -> .far_jmp_sprite [DASM]
0x163d -> game_vblank_foliage [DASM]
0x1646 -> .rotate_forest [DASM]
0x1652 -> .jump_tree [DASM]
0x1659 -> .cont_forest [DASM]
0x1662 -> .carry_tree [DASM]
0x1668 -> .forest_done [DASM]
0x166d -> game_vblank_collisions [DASM]
0x168a -> .reset_obstacle_0 [DASM]
0x1697 -> .reset_obstacle_1 [DASM]
0x16ab -> .bird_collision [DASM]
0x16b9 -> .no_store_index [DASM]
0x16c5 -> .done_vblank_collisions [DASM]
0x16c8 -> game_vblank_sprite [DASM]
0x16d0 -> .done [DASM]
0x16ed -> .flip_sprite_use_flat [DASM]
0x16f1 -> .flip_sprite_end [DASM]
0x1701 -> .use_wings_up_sprite [DASM]
0x1708 -> .use_glide_sprite [DASM]
0x170c -> .sprite_set [DASM]
0x1717 -> .begin_drowning [DASM]
0x173a -> .limit_height [DASM]
0x173c -> .update_pattern_idx [DASM]
0x1748 -> .store_index [DASM]
0x174a -> game_vblank_position_sprites [DASM]
0x174f -> .coarse_div [DASM]
0x1753 -> .done_coarse_div [DASM]
0x1767 -> .coarse_div [DASM]
0x176b -> .done_coarse_div [DASM]
0x1780 -> .fine_move_done [DASM]
0x178b -> .fine_move_done [DASM]
0x1792 -> .coarse_div [DASM]
0x1796 -> .done_coarse_div [DASM]
0x17a8 -> .coarse_div [DASM]
0x17ac -> .done_coarse_div [DASM]
0x17b8 -> .scoring_check [DASM]
0x17c9 -> .score_obstacle [DASM]
0x17d5 -> .end_scoring [DASM]
0x17f0 -> .vblank_loop [DASM]
0x17fb -> foliage [DASM]
0x1812 -> .set_trunk [DASM]
0x1818 -> .new_foliage [DASM]
0x181a -> .cont_foliage [DASM]
0x1827 -> game_play_area_prepare [DASM]
0x1840 -> .precalc_forest_static [DASM]
0x1855 -> .end_forest_precalc [DASM]
0x1871 -> game_play_area [DASM]
0x1881 -> .set_missile_sprites [DASM]
0x1891 -> .precalc_missile_size [DASM]
0x1899 -> .done_precalc_missile_size [DASM]
0x189b -> .precalc_missile_sprites [DASM]
0x18a6 -> .set_player_sprites [DASM]
0x18b2 -> .precalc_players_sprites [DASM]
0x18c7 -> .done_precalc_players [DASM]
0x18cf -> .next_scanline [DASM]
0x18da -> .end_game_play_area [DASM]
0x1905 -> display_score [DASM]
0x1927 -> .prep_score [DASM]
0x1982 -> .prep_hiscore [DASM]
0x19d0 -> .tens_digits [DASM]
0x19de -> .scoring_loop [DASM]
0x19e8 -> .next_scanline [DASM]
0x19ee -> game_overscan [DASM]
0x1a08 -> .done [DASM]
0x1a13 -> .swap_heads [DASM]
0x1a1a -> .done_head_check [DASM]
0x1a3c -> .set_width_for_ready [DASM]
0x1a44 -> .done_set_width [DASM]
0x1a4e -> .next_obstacle [DASM]
0x1a58 -> .next_branch [DASM]
0x1a80 -> .done_drowning_compensation [DASM]
0x1a86 -> .sfx_new_event [DASM]
0x1a91 -> .sfx_queue_event [DASM]
0x1acd -> .sfx_cont [DASM]
0x1adb -> .sfx_done [DASM]
0x1adf -> .is_positive [DASM]
0x1ae9 -> .positive_reset [DASM]
0x1aee -> .is_negative [DASM]
0x1af5 -> .negative_reset [DASM]
0x1af7 -> .store [DASM]
0x1af9 -> .overscan_loop [DASM]
0x1b01 -> initialisation [DASM]

Read Symbols
------------
0x0000 -> CXM0P [System]
0x0001 -> CXM1P [System]
0x0002 -> CXP0FB [System]
0x0003 -> CXP1FB [System]
0x0004 -> CXM0FB [System]
0x0005 -> CXM1FB [System]
0x0006 -> CXBLPF [System]
0x0007 -> CXPPMM [System]
0x0008 -> INPT0 [System]
0x0009 -> INPT1 [System]
0x000a -> INPT2 [System]
0x000b -> INPT3 [System]
0x000c -> INPT4 [System]
0x000d -> INPT5 [System]
0x000e -> PF1 [DASM]
0x000f -> PF2 [DASM]
0x0010 -> RESP0 [DASM]
0x0011 -> RESP1 [DASM]
0x0012 -> RESM0 [DASM]
0x0013 -> RESM1 [DASM]
0x0014 -> RESBL [DASM]
0x0015 -> AUDC0 [DASM]
0x0016 -> AUDC1 [DASM]
0x0017 -> AUDF0 [DASM]
0x0018 -> AUDF1 [DASM]
0x0019 -> AUDV0 [DASM]
0x001a -> AUDV1 [DASM]
0x001b -> GRP0 [DASM]
0x001c -> GRP1 [DASM]
0x001d -> ENAM0 [DASM]
0x001e -> OVERSCAN_SCANLINES [DASM]
0x001f -> ENABL [DASM]
0x0020 -> FOREST_COLOR [DASM]
0x0021 -> HMP1 [DASM]
0x0022 -> HMM0 [DASM]
0x0023 -> HMM1 [DASM]
0x0024 -> CTRLPF_FOLIAGE [DASM]
0x0025 -> .SCANLINES [DASM]
0x0026 -> HISCORE_COLOR [DASM]
0x0027 -> VDELBL [DASM]
0x0028 -> RESMP0 [DASM]
0x0029 -> RESMP1 [DASM]
0x002a -> HMOVE [DASM]
0x002b -> .TIMER_VAL [DASM]
0x002c -> CXCLR [DASM]
0x002e -> OKAY_COLOR [DASM]
0x0030 -> FOLIAGE_COLOR [DASM]
0x0032 -> FOREST_BACKGROUND [DASM]
0x003c -> .CYCLES [DASM]
0x0040 -> .CYCLES_1 [DASM]
0x004c -> .CYCLES_PER_SCANLINE [DASM]
0x0069 -> VERSION_VCS [DASM]
0x006a -> VERSION_MACRO [DASM]
0x006f -> BIRD_VPOS_INIT [DASM]
0x0070 -> SWAMP_COLOR [DASM]
0x0072 -> SWAMP_BACKGROUND [DASM]
0x0080 -> __MULTI_COUNT_STATE [DASM]
0x0081 -> __STATE_INPT4 [DASM]
0x0082 -> __STATE_SWCHB [DASM]
0x0083 -> __SFX_NEW_EVENT [DASM]
0x0084 -> __SFX_QUEUE_EVENT [DASM]
0x0085 -> __SFX_SUB_FRAMES [DASM]
0x0086 -> .YSTATE [DASM]
0x0087 -> .MISSILE_0_SET [DASM]
0x0088 -> .MISSILE_1_SET [DASM]
0x0089 -> .MISSILE_1_NUSIZ [DASM]
0x008a -> .PLAYER_0_SPRITE [DASM]
0x008b -> _localF [DASM]
0x008c -> _localG [DASM]
0x008d -> PLAY_STATE [DASM]
0x008e -> SELECTED_HEAD [DASM]
0x008f -> FLIGHT_PATTERN [DASM]
0x0091 -> ADDRESS_SPRITE_0 [DASM]
0x0093 -> ADDRESS_SPRITE_1 [DASM]
0x0094 -> BIRD_HIGH [DASM]
0x0095 -> BIRD_VPOS [DASM]
0x0096 -> BIRD_HPOS [DASM]
0x0097 -> BIRD_HEAD_OFFSET [DASM]
0x0098 -> PATTERN_INDEX [DASM]
0x0099 -> FOLIAGE_SEED [DASM]
0x009a -> OBSTACLE_SEED [DASM]
0x009b -> BRANCH_SEED [DASM]
0x009c -> OB_0 [DASM]
0x009e -> OB_1 [DASM]
0x00a0 -> OB_0_BRANCH [DASM]
0x00a1 -> OB_1_BRANCH [DASM]
0x00a2 -> OB_0_HPOS [DASM]
0x00a3 -> OB_1_HPOS [DASM]
0x00a4 -> OB_0_SPEED [DASM]
0x00a5 -> OB_1_SPEED [DASM]
0x00a6 -> FOREST_MID_0 [DASM]
0x00a7 -> FOREST_MID_1 [DASM]
0x00a8 -> FOREST_MID_2 [DASM]
0x00a9 -> SPLASH_COLOR [DASM]
0x00aa -> SCORE [DASM]
0x00ab -> HISCORE [DASM]
0x00c0 -> DISPLAY_SCANLINES [DASM]
0x00e4 -> .CLOCK_COUNTS_PER_SCANLINE [DASM]
0x00f2 -> _PAGE_CHECK [DASM]
0x00fe -> PLAY_STATE_DROWN [DASM]
0x00ff -> PLAY_STATE_COLLISION [DASM]
0x0280 -> SWCHA [System]
0x0281 -> SWACNT [System]
0x0282 -> SWCHB [System]
0x0283 -> SWBCNT [System]
0x0284 -> INTIM [System]
0x0285 -> TIMINT [System]
0x0294 -> TIM1T [DASM]
0x0295 -> TIM8T [DASM]
0x0296 -> TIM64T [DASM]
0x0297 -> T1024T [DASM]
0x2e20 -> _MSG_MARKER [DASM]

Write Symbols
-------------
0x0000 -> VSYNC [System]
0x0001 -> VBLANK [System]
0x0002 -> WSYNC [System]
0x0003 -> RSYNC [System]
0x0004 -> NUSIZ0 [System]
0x0005 -> NUSIZ1 [System]
0x0006 -> COLUP0 [System]
0x0007 -> COLUP1 [System]
0x0008 -> COLUPF [System]
0x0009 -> COLUBK [System]
0x000a -> CTRLPF [System]
0x000b -> REFP0 [System]
0x000c -> REFP1 [System]
0x000d -> PF0 [System]
0x000e -> PF1 [System]
0x000f -> PF2 [System]
0x0010 -> RESP0 [System]
0x0011 -> RESP1 [System]
0x0012 -> RESM0 [System]
0x0013 -> RESM1 [System]
0x0014 -> RESBL [System]
0x0015 -> AUDC0 [System]
0x0016 -> AUDC1 [System]
0x0017 -> AUDF0 [System]
0x0018 -> AUDF1 [System]
0x0019 -> AUDV0 [System]
0x001a -> AUDV1 [System]
0x001b -> GRP0 [System]
0x001c -> GRP1 [System]
0x001d -> ENAM0 [System]
0x001e -> ENAM1 [System]
0x001f -> ENABL [System]
0x0020 -> HMP0 [System]
0x0021 -> HMP1 [System]
0x0022 -> HMM0 [System]
0x0023 -> HMM1 [System]
0x0024 -> HMBL [System]
0x0025 -> VDELP0 [System]
0x0026 -> VDELP1 [System]
0x0027 -> VDELBL [System]
0x0028 -> RESMP0 [System]
0x0029 -> RESMP1 [System]
0x002a -> HMOVE [System]
0x002b -> HMCLR [System]
0x002c -> CXCLR [System]
0x002e -> OKAY_COLOR [DASM]
0x0030 -> FOLIAGE_COLOR [DASM]
0x0032 -> FOREST_BACKGROUND [DASM]
0x003c -> .CYCLES [DASM]
0x0040 -> .CYCLES_1 [DASM]
0x004c -> .CYCLES_PER_SCANLINE [DASM]
0x0069 -> VERSION_VCS [DASM]
0x006a -> VERSION_MACRO [DASM]
0x006f -> BIRD_VPOS_INIT [DASM]
0x0070 -> SWAMP_COLOR [DASM]
0x0072 -> SWAMP_BACKGROUND [DASM]
0x0080 -> __MULTI_COUNT_STATE [DASM]
0x0081 -> __STATE_INPT4 [DASM]
0x0082 -> __STATE_SWCHB [DASM]
0x0083 -> __SFX_NEW_EVENT [DASM]
0x0084 -> __SFX_QUEUE_EVENT [DASM]
0x0085 -> __SFX_SUB_FRAMES [DASM]
0x0086 -> .YSTATE [DASM]
0x0087 -> .MISSILE_0_SET [DASM]
0x0088 -> .MISSILE_1_SET [DASM]
0x0089 -> .MISSILE_1_NUSIZ [DASM]
0x008a -> .PLAYER_0_SPRITE [DASM]
0x008b -> _localF [DASM]
0x008c -> _localG [DASM]
0x008d -> PLAY_STATE [DASM]
0x008e -> SELECTED_HEAD [DASM]
0x008f -> FLIGHT_PATTERN [DASM]
0x0091 -> ADDRESS_SPRITE_0 [DASM]
0x0093 -> ADDRESS_SPRITE_1 [DASM]
0x0094 -> BIRD_HIGH [DASM]
0x0095 -> BIRD_VPOS [DASM]
0x0096 -> BIRD_HPOS [DASM]
0x0097 -> BIRD_HEAD_OFFSET [DASM]
0x0098 -> PATTERN_INDEX [DASM]
0x0099 -> FOLIAGE_SEED [DASM]
0x009a -> OBSTACLE_SEED [DASM]
0x009b -> BRANCH_SEED [DASM]
0x009c -> OB_0 [DASM]
0x009e -> OB_1 [DASM]
0x00a0 -> OB_0_BRANCH [DASM]
0x00a1 -> OB_1_BRANCH [DASM]
0x00a2 -> OB_0_HPOS [DASM]
0x00a3 -> OB_1_HPOS [DASM]
0x00a4 -> OB_0_SPEED [DASM]
0x00a5 -> OB_1_SPEED [DASM]
0x00a6 -> FOREST_MID_0 [DASM]
0x00a7 -> FOREST_MID_1 [DASM]
0x00a8 -> FOREST_MID_2 [DASM]
0x00a9 -> SPLASH_COLOR [DASM]
0x00aa -> SCORE [DASM]
0x00ab -> HISCORE [DASM]
0x00c0 -> DISPLAY_SCANLINES [DASM]
0x00e4 -> .CLOCK_COUNTS_PER_SCANLINE [DASM]
0x00f2 -> _PAGE_CHECK [DASM]
0x00fe -> PLAY_STATE_DROWN [DASM]
0x00ff -> PLAY_STATE_COLLISION [DASM]
0x0280 -> SWCHA [System]
0x0281 -> SWACNT [System]
0x0282 -> SWCHB [System]
0x0283 -> SWBCNT [System]
0x0284 -> INTIM [DASM]
0x0285 -> TIMINT [DASM]
0x0294 -> TIM1T [System]
0x0295 -> TIM8T [System]
0x0296 -> TIM64T [System]
0x0297 -> T1024T [System]
0x2e20 -> _MSG_MARKER [DASM]
`
