#ifndef SM_VARIABLES_H_
#define SM_VARIABLES_H_
#include "types.h"

extern uint8 g_ram[0x20000];

#define INT16_SHL8(x) ((int16)(x) << 8)
#define INT16_SHL16(x) ((int16)(x) << 16)

static inline void AddToHiLo(uint16 *hi, uint16 *lo, uint32 v) {
  uint32 t = *lo + (*hi << 16) + v;
  *lo = t;
  *hi = t >> 16;
}

static inline void SetHiLo(uint16 *hi, uint16 *lo, uint32 t) {
  *lo = t;
  *hi = t >> 16;
}

extern int32 *cur_coll_amt32;

// Not used anymore
#define REMOVED_R18 *(uint16*)(g_ram + 18)
#define REMOVED_R20 *(uint16*)(g_ram + 20)
#define REMOVED_R22 *(uint16*)(g_ram + 22)

#define reg_INIDISP (*(uint8*)(g_ram+0x51))
#define reg_OBSEL (*(uint8*)(g_ram+0x52))
#define reg_OAMaddr_UNUSED (*(uint16*)(g_ram+0x53))
#define reg_BGMODE (*(uint8*)(g_ram+0x55))
#define reg_BGMODE_fake (*(uint8*)(g_ram+0x56))
#define reg_MOSAIC (*(uint8*)(g_ram+0x57))
#define reg_BG1SC (*(uint8*)(g_ram+0x58))
#define reg_BG2SC (*(uint8*)(g_ram+0x59))
#define reg_BG3SC (*(uint8*)(g_ram+0x5A))
#define gameplay_BG3SC (*(uint8*)(g_ram+0x5B))
#define reg_BG4SC (*(uint8*)(g_ram+0x5C))
#define reg_BG12NBA (*(uint8*)(g_ram+0x5D))
#define reg_BG34NBA (*(uint8*)(g_ram+0x5E))
#define reg_M7SEL (*(uint8*)(g_ram+0x5F))
#define reg_W12SEL (*(uint8*)(g_ram+0x60))
#define reg_W34SEL (*(uint8*)(g_ram+0x61))
#define reg_WOBJSEL (*(uint8*)(g_ram+0x62))
#define reg_WH0 (*(uint8*)(g_ram+0x63))
#define reg_WH1 (*(uint8*)(g_ram+0x64))
#define reg_WH2 (*(uint8*)(g_ram+0x65))
#define reg_WH3 (*(uint8*)(g_ram+0x66))
#define reg_WBGLOG (*(uint8*)(g_ram+0x67))
#define reg_WOBJLOG (*(uint8*)(g_ram+0x68))
#define reg_TM (*(uint8*)(g_ram+0x69))
#define gameplay_TM (*(uint8*)(g_ram+0x6A))
#define reg_TS (*(uint8*)(g_ram+0x6B))
#define reg_TMW (*(uint8*)(g_ram+0x6C))
#define reg_TSW (*(uint8*)(g_ram+0x6D))
#define next_gameplay_CGWSEL (*(uint8*)(g_ram+0x6E))
#define reg_CGWSEL (*(uint8*)(g_ram+0x6F))
#define gameplay_CGWSEL (*(uint8*)(g_ram+0x70))
#define next_gameplay_CGADSUB (*(uint8*)(g_ram+0x71))
#define reg_CGADSUB (*(uint8*)(g_ram+0x72))
#define gameplay_CGADSUB (*(uint8*)(g_ram+0x73))
#define reg_COLDATA ((uint8*)(g_ram+0x74))
#define reg_SETINI (*(uint8*)(g_ram+0x77))
#define reg_M7A (*(uint16*)(g_ram+0x78))
#define reg_M7B (*(uint16*)(g_ram+0x7A))
#define reg_M7C (*(uint16*)(g_ram+0x7C))
#define reg_M7D (*(uint16*)(g_ram+0x7E))
#define reg_M7X (*(uint16*)(g_ram+0x80))
#define reg_M7Y (*(uint16*)(g_ram+0x82))
#define reg_NMITIMEN (*(uint8*)(g_ram+0x84))
#define reg_HDMAEN (*(uint8*)(g_ram+0x85))
#define reg_MEMSEL (*(uint8*)(g_ram+0x86))
#define joypad_ctr_repeat_first (*(uint16*)(g_ram+0x87))
#define joypad_ctr_repeat_next (*(uint16*)(g_ram+0x89))
#define joypad1_lastkeys (*(uint16*)(g_ram+0x8B))
#define joypad2_last (*(uint16*)(g_ram+0x8D))
#define joypad1_newkeys (*(uint16*)(g_ram+0x8F))
#define joypad2_new_keys (*(uint16*)(g_ram+0x91))
#define joypad1_newkeys2_UNUSED (*(uint16*)(g_ram+0x93))
#define joypad2_newkeys2 (*(uint16*)(g_ram+0x95))
#define joypad1_prev (*(uint16*)(g_ram+0x97))
#define joypad2_prev (*(uint16*)(g_ram+0x99))
#define joypad1_keyrepeat_ctr (*(uint16*)(g_ram+0xA3))
#define joypad2_keyrepeat_ctr (*(uint16*)(g_ram+0xA5))
#define irqhandler_next_handler (*(uint16*)(g_ram+0xA7))
#define room_loading_irq_handler (*(uint16*)(g_ram+0xA9))
#define cur_irq_handler (*(uint16*)(g_ram+0xAB))
#define REMOVED_ptr_to_retaddr_parameters (*(uint16*)(g_ram+0xAD))
#define current_region_animated_palette_fx (*(uint16*)(g_ram+0xAF))
#define reg_BG1HOFS (*(uint16*)(g_ram+0xB1))
#define reg_BG1VOFS (*(uint16*)(g_ram+0xB3))
#define reg_BG2HOFS (*(uint16*)(g_ram+0xB5))
#define reg_BG2VOFS (*(uint16*)(g_ram+0xB7))
#define reg_BG3HOFS (*(uint16*)(g_ram+0xB9))
#define reg_BG3VOFS (*(uint16*)(g_ram+0xBB))
#define reg_BG4HOFS (*(uint16*)(g_ram+0xBD))
#define reg_BG4VOFS (*(uint16*)(g_ram+0xBF))
#define g_word_7E00C4 ((uint16*)(g_ram+0xC4))
#define vram_write_queue ((VramWriteEntry*)(g_ram+0xD0))
#define mode7_write_queue ((Mode7VramWriteQueue*)(g_ram+0x2D0))
#define vram_write_queue_tail (*(uint16*)(g_ram+0x330))
#define mode7_vram_write_queue_tail (*(uint16*)(g_ram+0x334))
#define vram_read_queue ((VramReadQueueEnt*)(g_ram+0x340))
#define vram_read_queue_tail (*(uint16*)(g_ram+0x360))
#define oam_ent ((OamEnt*)(g_ram+0x370))
#define oam_ext ((uint16*)(g_ram+0x570))
#define oam_next_ptr (*(uint16*)(g_ram+0x590))
#define power_bomb_explosion_status (*(uint16*)(g_ram+0x592))

// This is used to handle WaitForNMI that is nested deep inside other
// functions.
#define coroutine_state_0 (*(uint8*)(g_ram+0x611))
#define coroutine_state_1 (*(uint8*)(g_ram+0x612))
#define coroutine_state_2 (*(uint8*)(g_ram+0x613))
#define coroutine_state_3 (*(uint8*)(g_ram+0x614))
#define coroutine_state_4 (*(uint8*)(g_ram+0x615))
#define coroutine_completion_flags (*(uint8*)(g_ram+0x782))
#define my_counter (*(uint16*)(g_ram+0x77E))
#define my_counter2 (*(uint16*)(g_ram+0x780))

// Keep track of which bug fixes have been made to prevent
// replays from desyncing.
#define bug_fix_counter_BAD (*(uint16*)(g_ram+0x1FF00))
#define bug_fix_counter (*(uint16*)(g_ram+0xC2))

#define g_word_7E0596 (*(uint16*)(g_ram+0x596))
#define g_word_7E0598 (*(uint16*)(g_ram+0x598))
#define set_to_e0_by_scrolling_sky (*(uint16*)(g_ram+0x59A))
#define UNUSED_word_7E059C (*(uint16*)(g_ram+0x59C))
#define UNUSED_hdma_contracting_flag (*(uint16*)(g_ram+0x5A0))
#define message_box_animation_y_radius (*(uint16*)(g_ram+0x5A2))
#define message_box_animation_y0 (*(uint16*)(g_ram+0x5A4))
#define message_box_animation_y1 (*(uint16*)(g_ram+0x5A6))
#define message_box_animation_y2 (*(uint16*)(g_ram+0x5A8))
#define message_box_animation_y3 (*(uint16*)(g_ram+0x5AA))
#define map_min_x_scroll (*(uint16*)(g_ram+0x5AC))
#define map_max_x_scroll (*(uint16*)(g_ram+0x5AE))
#define map_min_y_scroll (*(uint16*)(g_ram+0x5B0))
#define map_max_y_scroll (*(uint16*)(g_ram+0x5B2))
#define waiting_for_nmi (*(uint8*)(g_ram+0x5B4))
#define nmi_frame_counter_byte (*(uint8*)(g_ram+0x5B5))
#define nmi_frame_counter_word (*(uint16*)(g_ram+0x5B6))
#define nmi_frame_counter_including_lag (*(uint16*)(g_ram+0x5B8))
#define nmi_frames_missed (*(uint8*)(g_ram+0x5BA))
#define nmi_frames_missed_max (*(uint8*)(g_ram+0x5BB))
#define joypad_dbg_1 (*(uint16*)(g_ram+0x5C5))
#define joypad_dbg_2 (*(uint16*)(g_ram+0x5C7))
#define joypad_dbg_missiles_swap (*(uint16*)(g_ram+0x5C9))
#define joypad_dbg_super_missiles_swap (*(uint16*)(g_ram+0x5CB))
#define joypad_dbg_power_bombs_swap (*(uint16*)(g_ram+0x5CD))
#define joypad_dbg_flags (*(uint16*)(g_ram+0x5CF))
#define enable_debug (*(uint16*)(g_ram+0x5D1))
#define debug_saveload_scrollpos_toggle (*(uint16*)(g_ram+0x5D3))
#define debug_saved_xscroll (*(uint16*)(g_ram+0x5D5))
#define debug_saved_yscroll (*(uint16*)(g_ram+0x5D7))
#define joypad_released_keys (*(uint16*)(g_ram+0x5D9))
#define timed_held_input_timer (*(uint16*)(g_ram+0x5DB))
#define timed_held_input_timer_reset (*(uint16*)(g_ram+0x5DD))
#define timed_held_input (*(uint16*)(g_ram+0x5DF))
#define newly_held_down_timed_held_input (*(uint16*)(g_ram+0x5E1))
#define previous_timed_held_input (*(uint16*)(g_ram+0x5E3))
#define random_number (*(uint16*)(g_ram+0x5E5))
#define bitmask (*(uint16*)(g_ram+0x5E7))
#define REMOVED_mult_tmp_a (*(uint16*)(g_ram+0x5E9))
#define REMOVED_mult_tmp_y (*(uint16*)(g_ram+0x5EB))
#define REMOVED_mult_product_lo (*(uint16*)(g_ram+0x5F1))
#define REMOVED_mult_product_hi (*(uint16*)(g_ram+0x5F3))
#define debug_disable_sounds (*(uint16*)(g_ram+0x5F5))
#define debug_disable_minimap (*(uint16*)(g_ram+0x5F7))
#define save_confirmation_selection (*(uint16*)(g_ram+0x5F9))
#define map_scrolling_gear_switch_timer (*(uint16*)(g_ram+0x5FB))
#define map_scrolling_direction (*(uint16*)(g_ram+0x5FD))
#define map_scrolling_speed_index (*(uint16*)(g_ram+0x5FF))
#define pause_hook (*(LongPtr*)(g_ram+0x601))
#define unpause_hook (*(LongPtr*)(g_ram+0x604))
#define earthquake_sfx_index (*(uint16*)(g_ram+0x607))
#define earthquake_sfx_timer (*(uint16*)(g_ram+0x609))
#define eproj_init_param_3 (*(uint8*)(g_ram+0x60B))
#define REMOVED_remaining_enemy_hitbox_entries (*(uint16*)(g_ram+0x60D))
#define REMOVED_num_projectiles_to_check_enemy_coll (*(uint16*)(g_ram+0x60F))
#define is_uploading_apu (*(uint16*)(g_ram+0x617))
#define music_queue_track ((uint16*)(g_ram+0x619))
#define music_queue_delay ((uint16*)(g_ram+0x629))
#define music_queue_write_pos (*(uint16*)(g_ram+0x639))
#define music_queue_read_pos (*(uint16*)(g_ram+0x63B))
#define music_entry (*(uint16*)(g_ram+0x63D))
#define music_timer (*(uint16*)(g_ram+0x63F))
#define REMOVED_apu_attempts_countdown (*(uint16*)(g_ram+0x641))
#define sfx_readpos ((uint8*)(g_ram+0x643))
#define sfx_writepos ((uint8*)(g_ram+0x646))
#define sfx_state ((uint8*)(g_ram+0x649))
#define cur_music_track (*(uint8*)(g_ram+0x64C))
#define sfx_cur ((uint8*)(g_ram+0x64D))
#define sfx_clear_delay ((uint8*)(g_ram+0x650))
#define sfx_max_queued ((uint8*)(g_ram+0x653))
#define sfx1_queue ((uint8*)(g_ram+0x656))
#define sfx2_queue ((uint8*)(g_ram+0x666))
#define sfx3_queue ((uint8*)(g_ram+0x676))
#define sound_handler_downtime (*(uint16*)(g_ram+0x686))
#define croco_target_0688 (*(uint16*)(g_ram+0x688))
#define g_word_7E068A (*(uint16*)(g_ram+0x68A))
#define croco_word_068C (*(uint8*)(g_ram+0x68C))
#define g_word_7E068E (*(uint16*)(g_ram+0x68E))
#define croco_cur_vline_idx (*(uint16*)(g_ram+0x690))
#define g_word_7E0692 (*(uint16*)(g_ram+0x692))
#define g_word_7E0694 (*(uint16*)(g_ram+0x694))
#define g_word_7E0696 (*(uint16*)(g_ram+0x696))
#define g_word_7E0698 (*(uint16*)(g_ram+0x698))
#define croco_word_7E069A (*(uint16*)(g_ram+0x69A))
#define croco_vline_height ((uint8*)(g_ram+0x69C))
#define UNUSED_byte_7E071C (*(uint8*)(g_ram+0x71C))
#define nmi_copy_samus_halves (*(uint16*)(g_ram+0x71D))
#define nmi_copy_samus_top_half_src (*(uint16*)(g_ram+0x71F))
#define nmi_copy_samus_bottom_half_src (*(uint16*)(g_ram+0x721))
#define screen_fade_delay (*(uint16*)(g_ram+0x723))
#define screen_fade_counter (*(uint16*)(g_ram+0x725))
#define menu_index (*(uint16*)(g_ram+0x727))
#define pausemenu_start_lr_pressed_highlight_timer (*(uint16*)(g_ram+0x729))
#define pausemenu_lr_animation_timer (*(uint16*)(g_ram+0x72B))
#define pausemenu_item_selector_animation_timer (*(uint16*)(g_ram+0x72D))
#define pausemenu_reserve_tank_animation_timer (*(uint16*)(g_ram+0x72F))
#define UNUSED_word_7E0731 (*(uint16*)(g_ram+0x731))
#define pausemenu_uparrow_animation_timer (*(uint16*)(g_ram+0x733))
#define pausemenu_downarrow_animation_timer (*(uint16*)(g_ram+0x735))
#define pausemenu_rightarrow_animation_timer (*(uint16*)(g_ram+0x737))
#define pausemenu_leftarrow_animation_timer (*(uint16*)(g_ram+0x739))
#define pausemenu_palette_animation_timer (*(uint16*)(g_ram+0x73B))
#define UNUSED_word_7E073D (*(uint16*)(g_ram+0x73D))
#define pausemenu_lr_animation_frame (*(uint16*)(g_ram+0x73F))
#define pausemenu_item_selector_animation_frame (*(uint16*)(g_ram+0x741))
#define pausemenu_reserve_tank_animation_frame (*(uint16*)(g_ram+0x743))
#define UNUSED_word_7E0745 (*(uint16*)(g_ram+0x745))
#define pausemenu_uparrow_animation_frame (*(uint16*)(g_ram+0x747))
#define pausemenu_downarrow_animation_frame (*(uint16*)(g_ram+0x749))
#define pausemenu_rightarrow_animation_frame (*(uint16*)(g_ram+0x74B))
#define pausemenu_leftarrow_animation_frame (*(uint16*)(g_ram+0x74D))
#define pausemenu_palette_animation_frame (*(uint16*)(g_ram+0x74F))
#define pausemenu_shoulder_button_highlight (*(uint16*)(g_ram+0x751))
#define pausemenu_button_label_mode (*(uint16*)(g_ram+0x753))
#define pausemenu_equipment_category_item (*(uint16*)(g_ram+0x755))
#define pausemenu_reserve_tank_delay_ctr (*(uint16*)(g_ram+0x757))
#define UNUSED_word_7E0759 (*(uint16*)(g_ram+0x759))
#define UNUSED_word_7E075B (*(uint16*)(g_ram+0x75B))
#define UNUSED_word_7E075D (*(uint16*)(g_ram+0x75D))
#define UNUSED_word_7E075F (*(uint16*)(g_ram+0x75F))
#define UNUSED_word_7E0761 (*(uint16*)(g_ram+0x761))
#define pause_screen_mode (*(uint16*)(g_ram+0x763))
#define pausemenu_bak_BG1SC (*(uint8*)(g_ram+0x765))
#define pausemenu_bak_BG2SC (*(uint8*)(g_ram+0x766))
#define pausemenu_bak_BG3SC (*(uint8*)(g_ram+0x767))
#define pausemenu_bak_BG12NBA (*(uint8*)(g_ram+0x768))
#define pausemenu_bak_BG34NBA (*(uint8*)(g_ram+0x769))
#define pausemenu_bak_OBSEL (*(uint8*)(g_ram+0x76A))
#define pausemenu_bak_BG1HOFS (*(uint8*)(g_ram+0x76B))
#define pausemenu_bak_BG2HOFS (*(uint8*)(g_ram+0x76C))
#define pausemenu_bak_BG3HOFS (*(uint8*)(g_ram+0x76D))
#define pausemenu_bak_BG1VOFS (*(uint8*)(g_ram+0x76E))
#define pausemenu_bak_BG2VOFS (*(uint8*)(g_ram+0x76F))
#define pausemenu_bak_BG3VOFS (*(uint8*)(g_ram+0x770))
#define pausemenu_bak_BGMODE (*(uint8*)(g_ram+0x771))
#define pausemenu_bak_layer2_scroll_x (*(uint8*)(g_ram+0x772))
#define pausemenu_bak_layer2_scroll_y (*(uint8*)(g_ram+0x773))
#define pausemenu_bak_MOSAIC (*(uint8*)(g_ram+0x774))
#define pausemenu_bak_CGADSUB (*(uint8*)(g_ram+0x775))
#define samus_position_indicator_animation_frame (*(uint16*)(g_ram+0x776))
#define samus_position_indicator_animation_timer (*(uint16*)(g_ram+0x778))
#define samus_position_indicator_animation_loop_counter (*(uint16*)(g_ram+0x77A))
#define hud_item_tilemap_palette_bits (*(uint16*)(g_ram+0x77C))
#define irq_enable_mode7 (*(uint16*)(g_ram+0x783))
#define mode7_rotation_angle (*(uint16*)(g_ram+0x785))
#define g_word_7E0787 (*(uint16*)(g_ram+0x787))
#define has_area_map (*(uint16*)(g_ram+0x789))
#define load_station_index (*(uint16*)(g_ram+0x78B))
#define door_def_ptr (*(uint16*)(g_ram+0x78D))
#define REMOVED_door_bts (*(uint16*)(g_ram+0x78F))
#define door_direction (*(uint16*)(g_ram+0x791))
#define elevator_door_properties_orientation (*(uint16*)(g_ram+0x793))
#define door_transition_flag_elevator_zebetites (*(uint16*)(g_ram+0x795))
#define door_transition_flag_enemies (*(uint16*)(g_ram+0x797))
#define elevator_direction (*(uint16*)(g_ram+0x799))
#define room_ptr (*(uint16*)(g_ram+0x79B))
#define room_index (*(uint16*)(g_ram+0x79D))
#define area_index (*(uint16*)(g_ram+0x79F))
#define room_x_coordinate_on_map (*(uint16*)(g_ram+0x7A1))
#define room_y_coordinate_on_map (*(uint16*)(g_ram+0x7A3))
#define room_width_in_blocks (*(uint16*)(g_ram+0x7A5))
#define room_height_in_blocks (*(uint16*)(g_ram+0x7A7))
#define room_width_in_scrolls (*(uint16*)(g_ram+0x7A9))
#define room_height_in_scrolls (*(uint16*)(g_ram+0x7AB))
#define up_scroller (*(uint16*)(g_ram+0x7AD))
#define down_scroller (*(uint16*)(g_ram+0x7AF))
#define previous_cre_bitset (*(uint16*)(g_ram+0x7B1))
#define cre_bitset (*(uint16*)(g_ram+0x7B3))
#define door_list_pointer (*(uint16*)(g_ram+0x7B5))
#define REMOVED_event_pointer (*(uint16*)(g_ram+0x7B7))
#define room_size_in_blocks (*(uint16*)(g_ram+0x7B9))
#define roomdefroomstate_ptr (*(uint16*)(g_ram+0x7BB))
#define room_compr_level_data_ptr (*(LongPtr*)(g_ram+0x7BD))
#define tileset_tile_table_pointer (*(LongPtr*)(g_ram+0x7C0))
#define tileset_tiles_pointer (*(LongPtr*)(g_ram+0x7C3))
#define tileset_compr_palette_ptr (*(LongPtr*)(g_ram+0x7C6))
#define room_music_track_index (*(uint16*)(g_ram+0x7C9))
#define room_music_data_index (*(uint16*)(g_ram+0x7CB))
#define room_layer3_asm_ptr (*(uint16*)(g_ram+0x7CD))
#define room_enemy_population_ptr (*(uint16*)(g_ram+0x7CF))
#define room_enemy_tilesets_ptr (*(uint16*)(g_ram+0x7D1))
#define room_main_code_ptr (*(uint16*)(g_ram+0x7DF))
#define room_main_asm_variables ((uint8*)(g_ram+0x7E1))
#define scrolling_finished_hook (*(uint16*)(g_ram+0x7E9))
#define hdma_data_table_in_ceres (*(uint16*)(g_ram+0x7EB))
#define music_data_index (*(uint16*)(g_ram+0x7F3))
#define music_track_index (*(uint16*)(g_ram+0x7F5))
#define map_tiles_explored ((uint8*)(g_ram+0x7F7))
#define layer1_x_block (*(uint16*)(g_ram+0x8F7))
#define layer1_y_block (*(uint16*)(g_ram+0x8F9))
#define layer2_x_block (*(uint16*)(g_ram+0x8FB))
#define layer2_y_block (*(uint16*)(g_ram+0x8FD))
#define previous_layer1_x_block (*(uint16*)(g_ram+0x8FF))
#define previous_layer1_y_block (*(uint16*)(g_ram+0x901))
#define previous_layer2_x_block (*(uint16*)(g_ram+0x903))
#define previous_layer2_y_block (*(uint16*)(g_ram+0x905))
#define bg1_x_block (*(uint16*)(g_ram+0x907))
#define bg1_y_block (*(uint16*)(g_ram+0x909))
#define bg2_x_block (*(uint16*)(g_ram+0x90B))
#define bg2_y_block (*(uint16*)(g_ram+0x90D))
#define layer1_x_subpos (*(uint16*)(g_ram+0x90F))
#define layer1_x_pos (*(uint16*)(g_ram+0x911))
#define layer1_y_subpos (*(uint16*)(g_ram+0x913))
#define layer1_y_pos (*(uint16*)(g_ram+0x915))
#define layer2_x_pos (*(uint16*)(g_ram+0x917))
#define layer2_y_pos (*(uint16*)(g_ram+0x919))
#define layer2_scroll_x (*(uint8*)(g_ram+0x91B))
#define layer2_scroll_y (*(uint8*)(g_ram+0x91C))
#define bg1_x_offset (*(uint16*)(g_ram+0x91D))
#define bg1_y_offset (*(uint16*)(g_ram+0x91F))
#define bg2_x_scroll (*(uint16*)(g_ram+0x921))
#define bg2_y_scroll (*(uint16*)(g_ram+0x923))
#define door_transition_frame_counter (*(uint16*)(g_ram+0x925))
#define door_destination_x_pos (*(uint16*)(g_ram+0x927))
#define door_destination_y_pos (*(uint16*)(g_ram+0x929))
#define samus_door_transition_subspeed (*(uint16*)(g_ram+0x92B))
#define samus_door_transition_speed (*(uint16*)(g_ram+0x92D))
#define downwards_elevator_delay_timer (*(uint16*)(g_ram+0x92F))
#define door_transition_flag (*(uint16*)(g_ram+0x931))
#define REMOVED_var933 (*(uint16*)(g_ram+0x933))
#define REMOVED_var935 (*(uint16*)(g_ram+0x935))
#define REMOVED_var937 (*(uint16*)(g_ram+0x937))
#define REMOVED_var939 (*(uint16*)(g_ram+0x939))
#define REMOVED_var93B (*(uint16*)(g_ram+0x93B))
#define ceres_status (*(uint16*)(g_ram+0x93F))
#define camera_distance_index (*(uint16*)(g_ram+0x941))
#define timer_status (*(uint16*)(g_ram+0x943))
#define timer_centiseconds (*(uint8*)(g_ram+0x945))
#define timer_seconds (*(uint8*)(g_ram+0x946))
#define timer_minutes (*(uint8*)(g_ram+0x947))
#define timer_x_pos (*(uint16*)(g_ram+0x948))
#define timer_y_pos (*(uint16*)(g_ram+0x94A))
#define file_select_map_area_index (*(uint16*)(g_ram+0x950))
#define selected_save_slot (*(uint16*)(g_ram+0x952))
#define nonempty_save_slots (*(uint16*)(g_ram+0x954))
#define bg1_update_col_unwrapped_size (*(uint16*)(g_ram+0x956))
#define bg1_update_col_wrapped_size (*(uint16*)(g_ram+0x958))
#define bg1_update_col_unwrapped_dst (*(uint16*)(g_ram+0x95A))
#define bg1_update_col_wrapped_dst (*(uint16*)(g_ram+0x95C))
#define bg1_update_col_wrapped_left_src (*(uint16*)(g_ram+0x95E))
#define bg1_update_col_wrapped_right_src (*(uint16*)(g_ram+0x960))
#define bg1_update_col_enable (*(uint16*)(g_ram+0x962))
#define bg1_update_row_unwrapped_size (*(uint16*)(g_ram+0x964))
#define bg1_update_row_wrapped_size (*(uint16*)(g_ram+0x966))
#define bg1_update_row_unwrapped_dst (*(uint16*)(g_ram+0x968))
#define bg1_update_row_wrapped_dst (*(uint16*)(g_ram+0x96A))
#define bg1_update_row_wrapped_top_src (*(uint16*)(g_ram+0x96C))
#define bg1_update_row_wrapped_bottom_src (*(uint16*)(g_ram+0x96E))
#define bg1_update_row_enable (*(uint16*)(g_ram+0x970))
#define bg2_update_col_unwrapped_size (*(uint16*)(g_ram+0x972))
#define bg2_update_col_wrapped_size (*(uint16*)(g_ram+0x974))
#define bg2_update_col_unwrapped_dst (*(uint16*)(g_ram+0x976))
#define bg2_update_col_wrapped_dst (*(uint16*)(g_ram+0x978))
#define bg2_update_col_wrapped_left_src (*(uint16*)(g_ram+0x97A))
#define bg2_update_col_wrapped_right_src (*(uint16*)(g_ram+0x97C))
#define bg2_update_col_enable (*(uint16*)(g_ram+0x97E))
#define bg2_update_row_unwrapped_size (*(uint16*)(g_ram+0x980))
#define bg2_update_row_wrapped_size (*(uint16*)(g_ram+0x982))
#define bg2_update_row_unwrapped_dst (*(uint16*)(g_ram+0x984))
#define bg2_update_row_wrapped_dst (*(uint16*)(g_ram+0x986))
#define bg2_update_row_wrapped_top_src (*(uint16*)(g_ram+0x988))
#define bg2_update_row_wrapped_bottom_src (*(uint16*)(g_ram+0x98A))
#define bg2_update_row_enable (*(uint16*)(g_ram+0x98C))
#define size_of_bg2 (*(uint16*)(g_ram+0x98E))
#define blocks_to_update_x_block (*(uint16*)(g_ram+0x990))
#define blocks_to_update_y_block (*(uint16*)(g_ram+0x992))
#define vram_blocks_to_update_x_block (*(uint16*)(g_ram+0x994))
#define vram_blocks_to_update_y_block (*(uint16*)(g_ram+0x996))
#define game_state (*(uint16*)(g_ram+0x998))
#define door_transition_function (*(uint16*)(g_ram+0x99C))
#define menu_option_index (*(uint16*)(g_ram+0x99E))
#define equipped_items (*(uint16*)(g_ram+0x9A2))
#define collected_items (*(uint16*)(g_ram+0x9A4))
#define equipped_beams (*(uint16*)(g_ram+0x9A6))
#define collected_beams (*(uint16*)(g_ram+0x9A8))
#define button_config_up (*(uint16*)(g_ram+0x9AA))
#define button_config_down (*(uint16*)(g_ram+0x9AC))
#define button_config_left (*(uint16*)(g_ram+0x9AE))
#define button_config_right (*(uint16*)(g_ram+0x9B0))
#define button_config_shoot_x (*(uint16*)(g_ram+0x9B2))
#define button_config_jump_a (*(uint16*)(g_ram+0x9B4))
#define button_config_run_b (*(uint16*)(g_ram+0x9B6))
#define button_config_itemcancel_y (*(uint16*)(g_ram+0x9B8))
#define button_config_itemswitch (*(uint16*)(g_ram+0x9BA))
#define button_config_aim_down_L (*(uint16*)(g_ram+0x9BC))
#define button_config_aim_up_R (*(uint16*)(g_ram+0x9BE))
#define reserve_health_mode (*(uint16*)(g_ram+0x9C0))
#define samus_health (*(uint16*)(g_ram+0x9C2))
#define samus_max_health (*(uint16*)(g_ram+0x9C4))
#define samus_missiles (*(uint16*)(g_ram+0x9C6))
#define samus_max_missiles (*(uint16*)(g_ram+0x9C8))
#define samus_super_missiles (*(uint16*)(g_ram+0x9CA))
#define samus_max_super_missiles (*(uint16*)(g_ram+0x9CC))
#define samus_power_bombs (*(uint16*)(g_ram+0x9CE))
#define samus_max_power_bombs (*(uint16*)(g_ram+0x9D0))
#define hud_item_index (*(uint16*)(g_ram+0x9D2))
#define samus_max_reserve_health (*(uint16*)(g_ram+0x9D4))
#define samus_reserve_health (*(uint16*)(g_ram+0x9D6))
#define samus_reserve_missiles (*(uint16*)(g_ram+0x9D8))
#define game_time_frames (*(uint16*)(g_ram+0x9DA))
#define game_time_seconds (*(uint16*)(g_ram+0x9DC))
#define game_time_minutes (*(uint16*)(g_ram+0x9DE))
#define game_time_hours (*(uint16*)(g_ram+0x9E0))
#define japanese_text_flag (*(uint16*)(g_ram+0x9E2))
#define moonwalk_flag (*(uint16*)(g_ram+0x9E4))
#define debug_flag (*(uint16*)(g_ram+0x9E6))
#define UNUSED_word_7E09E8 (*(uint16*)(g_ram+0x9E8))
#define hud_auto_cancel_flag (*(uint16*)(g_ram+0x9EA))
#define samus_auto_cancel_hud_item_index (*(uint16*)(g_ram+0xA04))
#define samus_prev_health (*(uint16*)(g_ram+0xA06))
#define samus_prev_missiles (*(uint16*)(g_ram+0xA08))
#define samus_prev_super_missiles (*(uint16*)(g_ram+0xA0A))
#define samus_prev_power_bombs (*(uint16*)(g_ram+0xA0C))
#define samus_prev_hud_item_index (*(uint16*)(g_ram+0xA0E))
#define samus_prev_movement_type (*(uint8*)(g_ram+0xA11))
#define samus_prev_health_for_flash (*(uint16*)(g_ram+0xA12))
#define controller1_input_for_demo (*(uint16*)(g_ram+0xA14))
#define controller1_new_input_for_demo (*(uint16*)(g_ram+0xA16))
#define UNUSED_word_7E0A18 (*(uint16*)(g_ram+0xA18))
#define samus_pose (*(uint16*)(g_ram+0xA1C))
#define samus_pose_x_dir (*(uint8*)(g_ram+0xA1E))
#define samus_movement_type (*(uint8*)(g_ram+0xA1F))
#define samus_prev_pose (*(uint16*)(g_ram+0xA20))
#define samus_prev_pose_x_dir (*(uint8*)(g_ram+0xA22))
#define samus_prev_movement_type2 (*(uint8*)(g_ram+0xA23))
#define samus_last_different_pose (*(uint16*)(g_ram+0xA24))
#define samus_last_different_pose_x_dir (*(uint8*)(g_ram+0xA26))
#define samus_last_different_pose_movement_type (*(uint8*)(g_ram+0xA27))
#define samus_new_pose (*(uint16*)(g_ram+0xA28))
#define samus_new_pose_interrupted (*(uint16*)(g_ram+0xA2A))
#define samus_new_pose_transitional (*(uint16*)(g_ram+0xA2C))
#define samus_momentum_routine_index (*(uint16*)(g_ram+0xA2E))
#define samus_special_transgfx_index (*(uint16*)(g_ram+0xA30))
#define samus_hurt_switch_index (*(uint16*)(g_ram+0xA32))
#define solid_enemy_collision_flags (*(uint16*)(g_ram+0xA34))
#define block_collision_flags (*(uint16*)(g_ram+0xA36))
#define samus_space_to_move_up_blocks (*(uint16*)(g_ram+0xA38))
#define samus_y_radius_diff (*(uint16*)(g_ram+0xA3A))
#define samus_space_to_move_down_blocks (*(uint16*)(g_ram+0xA3C))
#define samus_space_to_move_up_enemy (*(uint16*)(g_ram+0xA3E))
#define samus_space_to_move_down_enemy (*(uint16*)(g_ram+0xA40))
#define frame_handler_alfa (*(uint16*)(g_ram+0xA42))
#define frame_handler_beta (*(uint16*)(g_ram+0xA44))
#define enable_horiz_slope_coll (*(uint16*)(g_ram+0xA46))
#define samus_hurt_flash_counter (*(uint16*)(g_ram+0xA48))
#define samus_special_super_palette_flags (*(uint16*)(g_ram+0xA4A))
#define samus_subunit_health (*(uint16*)(g_ram+0xA4C))
#define samus_periodic_subdamage (*(uint16*)(g_ram+0xA4E))
#define samus_periodic_damage (*(uint16*)(g_ram+0xA50))
#define knockback_dir (*(uint16*)(g_ram+0xA52))
#define knockback_x_dir (*(uint16*)(g_ram+0xA54))
#define bomb_jump_dir (*(uint16*)(g_ram+0xA56))
#define samus_movement_handler (*(uint16*)(g_ram+0xA58))
#define frame_handler_gamma (*(uint16*)(g_ram+0xA5A))
#define samus_draw_handler (*(uint16*)(g_ram+0xA5C))
#define UNUSED_word_7E0A5E (*(uint16*)(g_ram+0xA5E))
#define samus_input_handler (*(uint16*)(g_ram+0xA60))
#define samus_var62 (*(uint16*)(g_ram+0xA62))
#define samus_grapple_flags (*(uint16*)(g_ram+0xA64))
#define samus_x_speed_divisor (*(uint16*)(g_ram+0xA66))
#define samus_shine_timer (*(uint16*)(g_ram+0xA68))
#define samus_health_warning (*(uint16*)(g_ram+0xA6A))
#define samus_x_speed_table_pointer (*(uint16*)(g_ram+0xA6C))
#define samus_contact_damage_index (*(uint16*)(g_ram+0xA6E))
#define samus_visor_palette_timer_index (*(uint16*)(g_ram+0xA72))
#define samus_suit_palette_index (*(uint16*)(g_ram+0xA74))
#define hyper_beam_flag (*(uint16*)(g_ram+0xA76))
#define time_is_frozen_flag (*(uint16*)(g_ram+0xA78))
#define demo_input_pre_instr (*(uint16*)(g_ram+0xA7A))
#define demo_input_instr_timer (*(uint16*)(g_ram+0xA7C))
#define demo_input_instr_ptr (*(uint16*)(g_ram+0xA7E))
#define demo_timer_counter (*(uint16*)(g_ram+0xA80))
#define xray_angle (*(uint16*)(g_ram+0xA82))
#define demo_input (*(uint16*)(g_ram+0xA84))
#define demo_input_new (*(uint16*)(g_ram+0xA86))
#define demo_enable (*(uint16*)(g_ram+0xA88))

// These are aliased
#define hdma_ptr_1 (*(LongPtr*)(g_ram+0xA88))
#define hdma_ptr_2 (*(LongPtr*)(g_ram+0xA8B))
#define hdma_ptr_3 (*(LongPtr*)(g_ram+0xA8E))
#define hdma_var_1 (*(uint16*)(g_ram+0xA91))

#define demo_num_input_frames (*(uint16*)(g_ram+0xA8A))
#define demo_input_prev (*(uint16*)(g_ram+0xA8C))
#define demo_input_prev_new (*(uint16*)(g_ram+0xA8E))
#define demo_backup_prev_controller_input (*(uint16*)(g_ram+0xA90))
#define demo_backup_prev_controller_input_new (*(uint16*)(g_ram+0xA92))
#define samus_anim_frame_timer (*(uint16*)(g_ram+0xA94))
#define samus_anim_frame (*(uint16*)(g_ram+0xA96))
#define samus_anim_frame_skip (*(uint16*)(g_ram+0xA9A))
#define samus_anim_frame_buffer (*(uint16*)(g_ram+0xA9C))
#define grapple_walljump_timer (*(uint16*)(g_ram+0xA9E))
#define reached_ceres_elevator_fade_timer (*(uint16*)(g_ram+0xAA0))
#define timer_for_shinesparks_startstop (*(uint16*)(g_ram+0xAA2))
#define UNUSEDword_7E0AA4 (*(uint16*)(g_ram+0xAA4))
#define flag_arm_cannon_open_or_opening (*(uint8*)(g_ram+0xAA6))
#define flag_arm_cannon_opening_or_closing (*(uint8*)(g_ram+0xAA7))
#define arm_cannon_frame (*(uint16*)(g_ram+0xAA8))
#define hud_item_changed_this_frame (*(uint16*)(g_ram+0xAAA))
#define arm_cannon_drawing_mode (*(uint16*)(g_ram+0xAAC))
#define speed_echoes_index (*(uint16*)(g_ram+0xAAE))
#define speed_echo_xpos ((uint16*)(g_ram+0xAB0))
#define speed_echo_ypos ((uint16*)(g_ram+0xAB8))
#define speed_echo_xspeed ((uint16*)(g_ram+0xAC0))
#define samus_top_half_spritemap_index (*(uint16*)(g_ram+0xAC8))
#define samus_bottom_half_spritemap_index (*(uint16*)(g_ram+0xACA))
#define timer_for_shine_timer (*(uint16*)(g_ram+0xACC))
#define special_samus_palette_frame (*(uint16*)(g_ram+0xACE))
#define special_samus_palette_timer (*(uint16*)(g_ram+0xAD0))
#define liquid_physics_type (*(uint16*)(g_ram+0xAD2))
#define atmospheric_gfx_anim_timer ((uint16*)(g_ram+0xAD4))
#define atmospheric_gfx_x_pos ((uint16*)(g_ram+0xADC))
#define atmospheric_gfx_y_pos ((uint16*)(g_ram+0xAE4))
#define atmospheric_gfx_frame_and_type ((uint16*)(g_ram+0xAEC))
#define autojump_timer (*(uint16*)(g_ram+0xAF4))
#define samus_x_pos (*(uint16*)(g_ram+0xAF6))
#define samus_x_subpos (*(uint16*)(g_ram+0xAF8))
#define samus_y_pos (*(uint16*)(g_ram+0xAFA))
#define samus_y_subpos (*(uint16*)(g_ram+0xAFC))
#define samus_x_radius (*(uint16*)(g_ram+0xAFE))
#define samus_y_radius (*(uint16*)(g_ram+0xB00))
#define samus_collision_direction (*(uint16*)(g_ram+0xB02))
#define samus_spritemap_x_pos (*(uint16*)(g_ram+0xB04))
#define samus_spritemap_y_pos (*(uint16*)(g_ram+0xB06))
#define ideal_layer1_xpos (*(uint16*)(g_ram+0xB0A))
#define ideal_layer1_ypos (*(uint16*)(g_ram+0xB0E))
#define samus_prev_x_pos (*(uint16*)(g_ram+0xB10))
#define samus_prev_x_subpos (*(uint16*)(g_ram+0xB12))
#define samus_prev_y_pos (*(uint16*)(g_ram+0xB14))
#define samus_prev_y_subpos (*(uint16*)(g_ram+0xB16))
#define charged_shot_glow_timer (*(uint16*)(g_ram+0xB18))
#define UNUSED_word_7E0B1A (*(uint16*)(g_ram+0xB1A))
#define used_for_ball_bounce_on_landing (*(uint16*)(g_ram+0xB20))
#define samus_is_falling_flag (*(uint16*)(g_ram+0xB22))
#define tempB24 (*(uint16*)(g_ram+0xB24))
#define tempB26 (*(uint16*)(g_ram+0xB26))
#define UNUSED_word_7E0B2A (*(uint16*)(g_ram+0xB2A))
#define samus_y_subspeed (*(uint16*)(g_ram+0xB2C))
#define samus_y_speed (*(uint16*)(g_ram+0xB2E))
#define samus_y_subaccel (*(uint16*)(g_ram+0xB32))
#define samus_y_accel (*(uint16*)(g_ram+0xB34))
#define samus_y_dir (*(uint16*)(g_ram+0xB36))
#define UNUSED_word_7E0B38 (*(uint16*)(g_ram+0xB38))
#define samus_has_momentum_flag (*(uint16*)(g_ram+0xB3C))
#define speed_boost_counter (*(uint16*)(g_ram+0xB3E))
#define samus_echoes_sound_flag (*(uint16*)(g_ram+0xB40))
#define samus_x_extra_run_speed (*(uint16*)(g_ram+0xB42))
#define samus_x_extra_run_subspeed (*(uint16*)(g_ram+0xB44))
#define samus_x_base_speed (*(uint16*)(g_ram+0xB46))
#define samus_x_base_subspeed (*(uint16*)(g_ram+0xB48))
#define samus_x_accel_mode (*(uint16*)(g_ram+0xB4A))
#define samus_x_decel_mult (*(uint8*)(g_ram+0xB4C))
#define extra_samus_x_subdisplacement (*(uint16*)(g_ram+0xB56))
#define extra_samus_x_displacement (*(uint16*)(g_ram+0xB58))
#define extra_samus_y_subdisplacement (*(uint16*)(g_ram+0xB5A))
#define extra_samus_y_displacement (*(uint16*)(g_ram+0xB5C))
#define new_projectile_direction_changed_pose (*(uint16*)(g_ram+0xB5E))
#define used_for_sba_attacksB60 (*(uint16*)(g_ram+0xB60))
#define samus_charge_palette_index (*(uint16*)(g_ram+0xB62))
#define projectile_x_pos ((uint16*)(g_ram+0xB64))
#define projectile_y_pos ((uint16*)(g_ram+0xB78))
#define projectile_bomb_x_subpos ((uint16*)(g_ram+0xB8C))
#define projectile_bomb_y_subpos ((uint16*)(g_ram+0xBA0))
#define projectile_x_radius ((uint16*)(g_ram+0xBB4))
#define projectile_y_radius ((uint16*)(g_ram+0xBC8))
#define projectile_bomb_x_speed ((uint16*)(g_ram+0xBDC))
#define projectile_bomb_y_speed ((uint16*)(g_ram+0xBF0))
#define projectile_dir ((uint16*)(g_ram+0xC04))
#define projectile_type ((uint16*)(g_ram+0xC18))
#define projectile_damage ((uint16*)(g_ram+0xC2C))
#define projectile_bomb_instruction_ptr ((uint16*)(g_ram+0xC40))
#define projectile_bomb_instruction_timers ((uint16*)(g_ram+0xC54))
#define projectile_bomb_pre_instructions ((uint16*)(g_ram+0xC68))
#define bomb_functions ((uint16*)(g_ram+0xC72))
#define projectile_variables ((uint16*)(g_ram+0xC7C))
#define bomb_timers ((uint16*)(g_ram+0xC86))
#define projectile_timers ((uint16*)(g_ram+0xC90))
#define bomb_subspeeds ((uint16*)(g_ram+0xC9A))
#define projectile_unk_A ((uint16*)(g_ram+0xCA4))
#define projectile_spritemap_pointers ((uint16*)(g_ram+0xCB8))
#define cooldown_timer (*(uint16*)(g_ram+0xCCC))
#define projectile_counter (*(uint16*)(g_ram+0xCCE))
#define flare_counter (*(uint16*)(g_ram+0xCD0))
#define bomb_counter (*(uint16*)(g_ram+0xCD2))
#define bomb_spread_charge_timeout_counter (*(uint16*)(g_ram+0xCD4))
#define flare_animation_frame (*(uint16*)(g_ram+0xCD6))
#define flare_slow_sparks_anim_frame (*(uint16*)(g_ram+0xCD8))
#define flare_fast_sparks_anim_frame (*(uint16*)(g_ram+0xCDA))
#define flare_animation_timer (*(uint16*)(g_ram+0xCDC))
#define flare_slow_sparks_anim_timer (*(uint16*)(g_ram+0xCDE))
#define flare_fast_sparks_anim_timer (*(uint16*)(g_ram+0xCE0))
#define power_bomb_explosion_x_pos (*(uint16*)(g_ram+0xCE2))
#define power_bomb_explosion_y_pos (*(uint16*)(g_ram+0xCE4))
#define power_bomb_explosion_x_pos_plus_0x100 (*(uint16*)(g_ram+0xCE6))
#define power_bomb_explosion_y_pos_rsub_0x1ff (*(uint16*)(g_ram+0xCE8))
#define power_bomb_explosion_radius (*(uint16*)(g_ram+0xCEA))
#define power_bomb_pre_explosion_flash_radius (*(uint16*)(g_ram+0xCEC))
#define power_bomb_flag (*(uint16*)(g_ram+0xCEE))
#define power_bomb_pre_explosion_radius_speed (*(uint16*)(g_ram+0xCF0))
#define pre_scaled_power_bomb_explosion_shape_def_ptr (*(uint16*)(g_ram+0xCF2))
#define grapple_beam_flags (*(uint16*)(g_ram+0xCF4))
#define grapple_varCF6 (*(uint16*)(g_ram+0xCF6))
#define slow_grabble_scrolling_flag (*(uint16*)(g_ram+0xCF8))
#define grapple_beam_end_angle16 (*(uint16*)(g_ram+0xCFA))
#define grapple_beam_end_angle_hi (*(uint8*)(g_ram+0xCFB))
#define grapple_beam_end_angles_mirror (*(uint16*)(g_ram+0xCFC))
#define grapple_beam_length (*(uint16*)(g_ram+0xCFE))
#define grapple_beam_length_delta (*(uint16*)(g_ram+0xD00))
#define grapple_beam_origin_x_offset (*(uint16*)(g_ram+0xD02))
#define grapple_beam_origin_y_offset (*(uint16*)(g_ram+0xD04))
#define grapple_beam_end_x_subpos (*(uint16*)(g_ram+0xD06))
#define grapple_beam_end_x_pos (*(uint16*)(g_ram+0xD08))
#define grapple_beam_end_y_subpos (*(uint16*)(g_ram+0xD0A))
#define grapple_beam_end_y_pos (*(uint16*)(g_ram+0xD0C))
#define grapple_beam_end_x_suboffset (*(uint16*)(g_ram+0xD0E))
#define grapple_beam_end_x_offset (*(uint16*)(g_ram+0xD10))
#define grapple_beam_end_y_suboffset (*(uint16*)(g_ram+0xD12))
#define grapple_beam_end_y_offset (*(uint16*)(g_ram+0xD14))
#define x_pos_of_start_of_grapple_beam (*(uint16*)(g_ram+0xD16))
#define y_pos_of_start_of_grapple_beam (*(uint16*)(g_ram+0xD18))
#define x_pos_of_start_of_grapple_beam_prevframe (*(uint16*)(g_ram+0xD1A))
#define y_pos_of_start_of_grapple_beam_prevframe (*(uint16*)(g_ram+0xD1C))
#define grapple_beam_unkD1E (*(uint16*)(g_ram+0xD1E))
#define grapple_beam_unkD20 (*(uint16*)(g_ram+0xD20))
#define grapple_beam_extension_x_velocity (*(uint16*)(g_ram+0xD22))
#define grapple_beam_extension_y_velocity (*(uint16*)(g_ram+0xD24))
#define grapple_beam_unkD26 (*(uint16*)(g_ram+0xD26))
#define grapple_beam_unkD28 (*(uint16*)(g_ram+0xD28))
#define grapple_beam_unkD2A (*(uint16*)(g_ram+0xD2A))
#define grapple_beam_unkD2C (*(uint16*)(g_ram+0xD2C))
#define grapple_beam_unkD2E (*(uint16*)(g_ram+0xD2E))
#define grapple_beam_unkD30 (*(uint16*)(g_ram+0xD30))
#define grapple_beam_function (*(uint16*)(g_ram+0xD32))
#define grapple_beam_direction (*(uint16*)(g_ram+0xD34))
#define grapple_beam_unkD36 (*(uint16*)(g_ram+0xD36))
#define grapple_beam_unkD38 (*(uint16*)(g_ram+0xD38))
#define grapple_beam_unkD3A (*(uint16*)(g_ram+0xD3A))
#define grapple_beam_unkD3C (*(uint16*)(g_ram+0xD3C))
#define grapple_point_anim_timer (*(uint16*)(g_ram+0xD3E))
#define grapple_point_anim_ptr (*(uint16*)(g_ram+0xD40))
#define grapple_segment_anim_instr_timers ((uint16*)(g_ram+0xD42))
#define grapple_segment_anim_instr_ptrs ((uint16*)(g_ram+0xD62))
#define button_config_shoot_x_saved (*(uint16*)(g_ram+0xD82))
#define button_config_jump_a_saved (*(uint16*)(g_ram+0xD84))
#define button_config_run_b_saved (*(uint16*)(g_ram+0xD86))
#define button_config_itemcancel_y_saved (*(uint16*)(g_ram+0xD88))
#define button_config_itemswitch_saved (*(uint16*)(g_ram+0xD8A))
#define button_config_aim_down_L_saved (*(uint16*)(g_ram+0xD8C))
#define button_config_aim_up_R_saved (*(uint16*)(g_ram+0xD8E))
#define grapple_beam_grapple_start_x (*(uint16*)(g_ram+0xD90))
#define grapple_beam_grapple_start_y (*(uint16*)(g_ram+0xD92))
#define grapple_beam_grapple_start_block_x (*(uint16*)(g_ram+0xD94))
#define grapple_beam_grapple_start_block_y (*(uint16*)(g_ram+0xD96))
#define g_word_7E0D98 (*(uint16*)(g_ram+0xD98))
#define g_word_7E0D9C (*(uint16*)(g_ram+0xD9C))
#define g_byte_7E0D9E (*(uint8*)(g_ram+0xD9E))
#define g_byte_7E0D9F (*(uint8*)(g_ram+0xD9F))
#define loop_counter_transfer_enemies_to_vram (*(uint16*)(g_ram+0xDA0))
#define absolute_moved_last_frame_x (*(uint16*)(g_ram+0xDA2))
#define absolute_moved_last_frame_x_fract (*(uint16*)(g_ram+0xDA4))
#define absolute_moved_last_frame_y (*(uint16*)(g_ram+0xDA6))
#define absolute_moved_last_frame_y_fract (*(uint16*)(g_ram+0xDA8))
#define projectile_init_speed_samus_moved_left (*(uint16*)(g_ram+0xDAA))
#define projectile_init_speed_samus_moved_left_fract (*(uint16*)(g_ram+0xDAC))
#define projectile_init_speed_samus_moved_right (*(uint16*)(g_ram+0xDAE))
#define projectile_init_speed_samus_moved_right_fract (*(uint16*)(g_ram+0xDB0))
#define projectile_init_speed_samus_moved_up (*(uint16*)(g_ram+0xDB2))
#define projectile_init_speed_samus_moved_up_fract (*(uint16*)(g_ram+0xDB4))
#define projectile_init_speed_samus_moved_down (*(uint16*)(g_ram+0xDB6))
#define projectile_init_speed_samus_moved_down_fract (*(uint16*)(g_ram+0xDB8))
#define samus_pos_adjusted_by_slope_flag (*(uint16*)(g_ram+0xDBA))
#define samus_total_x_speed (*(uint16*)(g_ram+0xDBC))
#define samus_total_x_subspeed (*(uint16*)(g_ram+0xDBE))
#define play_resume_charging_beam_sfx (*(uint16*)(g_ram+0xDC0))
#define prev_beam_charge_counter (*(uint16*)(g_ram+0xDC2))
#define cur_block_index (*(uint16*)(g_ram+0xDC4))
#define input_to_pose_calc (*(uint16*)(g_ram+0xDC6))
#define queued_message_box_index (*(uint16*)(g_ram+0xDC8))
#define samus_collides_with_solid_enemy (*(uint16*)(g_ram+0xDCE))
#define samus_collision_flag (*(uint16*)(g_ram+0xDD0))
#define REMOVED_temp_collision_DD2 (*(uint16*)(g_ram+0xDD2))
#define REMOVED_temp_collision_DD4 (*(uint16*)(g_ram+0xDD4))
#define REMOVED_temp_collision_DD6 (*(uint16*)(g_ram+0xDD6))
#define suit_pickup_light_beam_widening_speed (*(uint16*)(g_ram+0xDDC))
#define projectile_index (*(uint16*)(g_ram+0xDDE))
#define debug_invincibility (*(uint16*)(g_ram+0xDE0))
#define game_options_screen_index (*(uint16*)(g_ram+0xDE2))
#define g_word_7E0DE4 (*(uint16*)(g_ram+0xDE4))
#define g_word_7E0DE6 (*(uint16*)(g_ram+0xDE6))
#define g_word_7E0DE8 (*(uint16*)(g_ram+0xDE8))
#define which_item_to_pickup (*(uint16*)(g_ram+0xDEA))
#define substate (*(uint16*)(g_ram+0xDEC))
#define suit_pickup_light_beam_pos (*(uint16*)(g_ram+0xDEE))
#define suit_pickup_color_math_R (*(uint8*)(g_ram+0xDF0))
#define suit_pickup_color_math_G (*(uint8*)(g_ram+0xDF1))
#define suit_pickup_color_math_B (*(uint8*)(g_ram+0xDF2))
#define suit_pickup_palette_transition_color (*(uint8*)(g_ram+0xDF3))
#define UNUSED_debug_spare_cpu_display_flag (*(uint16*)(g_ram+0xDF4))
#define UNUSED_word_7E0DF6 (*(uint16*)(g_ram+0xDF6))
#define UNUSED_word_7E0DF8 (*(uint16*)(g_ram+0xDF8))
#define UNUSED_word_7E0DFA (*(uint16*)(g_ram+0xDFA))
#define UNUSED_word_7E0DFC (*(uint16*)(g_ram+0xDFC))
#define joypad1_input_samusfilter (*(uint16*)(g_ram+0xDFE))
#define joypad1_newinput_samusfilter (*(uint16*)(g_ram+0xE00))
#define REMOVED_samus_bottom_boundary_position (*(uint16*)(g_ram+0xE02))
#define distance_to_eject_samus_left (*(uint16*)(g_ram+0xE04))
#define distance_to_eject_samus_right (*(uint16*)(g_ram+0xE06))
#define distance_to_eject_samus_up (*(uint16*)(g_ram+0xE08))
#define distance_to_eject_samus_down (*(uint16*)(g_ram+0xE0A))
#define g_byte_7E0E0C ((uint8*)(g_ram+0xE0C))
#define debug_disable_sprite_interact (*(uint16*)(g_ram+0xE12))
#define elevator_flags (*(uint16*)(g_ram+0xE16))
#define elevator_status (*(uint16*)(g_ram+0xE18))
#define health_drop_bias_flag (*(uint16*)(g_ram+0xE1A))
#define enemy_index_to_shake (*(uint16*)(g_ram+0xE1C))
#define nmi_flag_bg2_enemy_vram_transfer (*(uint16*)(g_ram+0xE1E))
#define REMOVED_varE20 (*(uint16*)(g_ram+0xE20))
#define REMOVED_varE22 (*(uint16*)(g_ram+0xE22))
#define REMOVED_varE24 (*(uint16*)(g_ram+0xE24))
#define REMOVED_varE26 (*(uint16*)(g_ram+0xE26))
#define REMOVED_varE28 (*(uint16*)(g_ram+0xE28))
#define REMOVED_varE2A (*(uint16*)(g_ram+0xE2A))
#define REMOVED_varE2C (*(uint16*)(g_ram+0xE2C))
#define REMOVED_varE2E (*(uint16*)(g_ram+0xE2E))
#define REMOVED_varE32 (*(uint16*)(g_ram+0xE32))
#define REMOVED_varE34 (*(uint16*)(g_ram+0xE34))
#define REMOVED_varE36 (*(uint16*)(g_ram+0xE36))
#define REMOVED_varE38 (*(uint16*)(g_ram+0xE38))
#define REMOVED_varE3A (*(uint16*)(g_ram+0xE3A))
#define REMOVED_varE3C (*(uint16*)(g_ram+0xE3C))
#define REMOVED_varE3E (*(uint16*)(g_ram+0xE3E))
#define last_enemy_power (*(uint16*)(g_ram+0xE40))
#define random_enemy_counter (*(uint16*)(g_ram+0xE44))
#define UNUSED_word_7E0E46 (*(uint16*)(g_ram+0xE46))
#define UNUSED_word_7E0E48 (*(uint16*)(g_ram+0xE48))
#define REMOVED_new_enemy_index (*(uint16*)(g_ram+0xE4A))
#define first_free_enemy_index (*(uint16*)(g_ram+0xE4C))
#define num_enemies_in_room (*(uint16*)(g_ram+0xE4E))
#define num_enemies_killed_in_room (*(uint16*)(g_ram+0xE50))
#define num_enemy_deaths_left_to_clear (*(uint16*)(g_ram+0xE52))
#define cur_enemy_index (*(uint16*)(g_ram+0xE54))
#define REMOVED_cur_enemy_index_backup (*(uint16*)(g_ram+0xE56))
#define REMOVED_enemy_data_ptr (*(uint16*)(g_ram+0xE58))
#define enemy_tile_load_data ((EnemyTileLoadData*)(g_ram+0xE5A))
#define enemy_tile_load_data_write_pos (*(uint16*)(g_ram+0xE7A))
#define enemy_tile_vram_src (*(uint16*)(g_ram+0xE7C))
#define enemy_tile_vram_dst (*(uint16*)(g_ram+0xE7E))
#define enemy_drawing_queue ((uint16*)(g_ram+0xE84))
#define enemy_drawing_queue_sizes ((uint16*)(g_ram+0xF68))
#define enemy_data ((EnemyData*)(g_ram+0xF78))
#define fireflea_flashing_timer (*(uint16*)(g_ram+0x1778))
#define fireflea_flashing_index (*(uint16*)(g_ram+0x177A))
#define UNUSED_word_7E177C (*(uint16*)(g_ram+0x177C))
#define fireflea_darkness_level (*(uint16*)(g_ram+0x177E))
#define UNUSED_word_7E1780 (*(uint16*)(g_ram+0x1780))
#define UNUSED_word_7E1782 (*(uint16*)(g_ram+0x1782))
#define REMOVED_enemy_ai_pointer (*(LongPtr*)(g_ram+0x1784))
#define REMOVED_enemy_ai_pointer_backup (*(LongPtr*)(g_ram+0x1788))
#define enemy_gfx_drawn_hook (*(LongPtr*)(g_ram+0x178C))
#define REMOVED_set_to_rtl_when_loading_enemies_unused (*(LongPtr*)(g_ram+0x1790))
#define variables_for_enemy_graphics_drawn_hook ((uint16*)(g_ram+0x1794))
#define enemy_bg2_tilemap_size (*(uint16*)(g_ram+0x179A))
#define boss_id (*(uint16*)(g_ram+0x179C))
#define UNUSED_word_7E179E (*(uint16*)(g_ram+0x179E))
#define UNUSED_word_7E17A0 (*(uint16*)(g_ram+0x17A0))
#define UNUSED_word_7E17A2 (*(uint16*)(g_ram+0x17A2))
#define active_enemy_indexes_write_ptr (*(uint16*)(g_ram+0x17A4))
#define interactive_enemy_indexes_write_ptr (*(uint16*)(g_ram+0x17A6))
#define REMOVED_active_enemy_indexes_index (*(uint16*)(g_ram+0x17A8))
#define REMOVED_interactive_enemy_indexes_index (*(uint16*)(g_ram+0x17AA))
#define active_enemy_indexes ((uint16*)(g_ram+0x17AC))
#define interactive_enemy_indexes ((uint16*)(g_ram+0x17EC))
#define enemy_index_colliding_dirs ((uint16*)(g_ram+0x182C))
#define REMOVED_distance_to_enemy_colliding_dirs ((uint16*)(g_ram+0x1834))
#define flag_process_all_enemies (*(uint16*)(g_ram+0x183C))
#define earthquake_type (*(uint16*)(g_ram+0x183E))
#define earthquake_timer (*(uint16*)(g_ram+0x1840))
#define frame_counter_every_frame (*(uint16*)(g_ram+0x1842))
#define sprite_object_index (*(uint16*)(g_ram+0x1844))
#define debug_enemy_index_UNUSED (*(uint16*)(g_ram+0x1846))
#define log_index_UNUSED (*(uint16*)(g_ram+0x1848))
#define REMOVED_samus_x_pos_colliding_solid (*(uint16*)(g_ram+0x184A))
#define REMOVED_samus_x_subpos_colliding_solid (*(uint16*)(g_ram+0x184C))
#define REMOVED_enemy_x_pos_colliding_solid (*(uint16*)(g_ram+0x184E))
#define REMOVED_enemy_x_subpos_colliding_solid (*(uint16*)(g_ram+0x1850))
#define REMOVED_samus_pos_delta_colliding_solid (*(uint16*)(g_ram+0x1852))
#define REMOVED_samus_subpos_delta_colliding_solid (*(uint16*)(g_ram+0x1854))
#define REMOVED_samus_y_pos_colliding_solid (*(uint16*)(g_ram+0x1856))
#define REMOVED_samus_y_subpos_colliding_solid (*(uint16*)(g_ram+0x1858))
#define REMOVED_solid_enemy_collision_type (*(uint16*)(g_ram+0x185A))
#define debug_index (*(uint16*)(g_ram+0x185C))
#define debug_time_frozen_for_enemies (*(uint16*)(g_ram+0x185E))
#define debug_text_cursor_x (*(uint16*)(g_ram+0x1860))
#define debug_text_cursor_y (*(uint16*)(g_ram+0x1862))
#define debug_enemy_set_entry_index (*(uint16*)(g_ram+0x1864))
#define debug_enemy_population_pointer (*(uint16*)(g_ram+0x1866))
#define debug_enemy_spawn_x_pos (*(uint16*)(g_ram+0x1868))
#define debug_enemy_spawn_y_pos (*(uint16*)(g_ram+0x186A))
#define REMOVED_enemy_spritemap_entry_pointer (*(uint16*)(g_ram+0x186E))
#define REMOVED_enemy_left_border_collision (*(uint16*)(g_ram+0x1870))
#define REMOVED_enemy_bottom_border_collision (*(uint16*)(g_ram+0x1872))
#define REMOVED_enemy_right_border_collision (*(uint16*)(g_ram+0x1874))
#define REMOVED_enemy_top_border_collision (*(uint16*)(g_ram+0x1876))
#define REMOVED_hitbox_ptr (*(uint16*)(g_ram+0x1878))
#define REMOVED_enemy_spritemap_entry_coll_x_pos (*(uint16*)(g_ram+0x187A))
#define REMOVED_enemy_spritemap_entry_coll_y_pos (*(uint16*)(g_ram+0x187C))
#define REMOVED_samus_right_border_coll (*(uint16*)(g_ram+0x187E))
#define REMOVED_samus_left_border_coll (*(uint16*)(g_ram+0x1880))
#define REMOVED_samus_bottom_border_coll (*(uint16*)(g_ram+0x1882))
#define REMOVED_samus_top_border_coll (*(uint16*)(g_ram+0x1884))
#define REMOVED_samus_target_x_pos (*(uint16*)(g_ram+0x189A))
#define REMOVED_samus_target_x_subpos (*(uint16*)(g_ram+0x189C))
#define REMOVED_samus_target_y_pos (*(uint16*)(g_ram+0x189E))
#define REMOVED_samus_target_y_subpos (*(uint16*)(g_ram+0x18A0))
#define REMOVED_samus_x_radius_mirror (*(uint16*)(g_ram+0x18A2))
#define REMOVED_samus_y_radius_mirror (*(uint16*)(g_ram+0x18A4))
#define collision_detection_index (*(uint16*)(g_ram+0x18A6))
#define samus_invincibility_timer (*(uint16*)(g_ram+0x18A8))
#define samus_knockback_timer (*(uint16*)(g_ram+0x18AA))
#define projectile_invincibility_timer (*(uint16*)(g_ram+0x18AC))
#define flag_disable_projectile_interaction (*(uint16*)(g_ram+0x18AE))
#define hdma_objects_enable_flag (*(uint16*)(g_ram+0x18B0))
#define hdma_object_index (*(uint16*)(g_ram+0x18B2))
#define hdma_object_channels_bitmask ((uint16*)(g_ram+0x18B4))
#define hdma_object_bank_slot ((uint16*)(g_ram+0x18C0))
#define hdma_object_instruction_list_pointers ((uint16*)(g_ram+0x18CC))
#define hdma_object_table_pointers ((uint16*)(g_ram+0x18D8))
#define hdma_object_instruction_timers ((uint16*)(g_ram+0x18E4))
#define hdma_object_pre_instructions ((uint16*)(g_ram+0x18F0))
#define hdma_object_pre_instruction_bank ((uint16*)(g_ram+0x18FC))
#define hdma_object_timers ((uint16*)(g_ram+0x1908))
#define hdma_object_A ((uint16*)(g_ram+0x1914))
#define hdma_object_B ((uint16*)(g_ram+0x1920))
#define hdma_object_C ((uint16*)(g_ram+0x192C))
#define hdma_object_D ((uint16*)(g_ram+0x1938))
#define hdma_object_E ((uint16*)(g_ram+0x1944))
#define hdma_object_F ((uint16*)(g_ram+0x1950))
#define fx_y_subpos (*(uint16*)(g_ram+0x195C))
#define fx_y_pos (*(uint16*)(g_ram+0x195E))
#define lava_acid_y_subpos (*(uint16*)(g_ram+0x1960))
#define lava_acid_y_pos (*(uint16*)(g_ram+0x1962))
#define fx_tilemap_ptr (*(uint16*)(g_ram+0x1964))
#define fx_rising_function_bank_88 (*(uint16*)(g_ram+0x196C))
#define fx_type (*(uint16*)(g_ram+0x196E))
#define fx_y_suboffset (*(uint16*)(g_ram+0x1970))
#define fx_y_offset (*(uint16*)(g_ram+0x1972))
#define tide_phase (*(uint16*)(g_ram+0x1974))
#define fx_base_y_subpos (*(uint16*)(g_ram+0x1976))
#define fx_base_y_pos (*(uint16*)(g_ram+0x1978))
#define fx_target_y_pos (*(uint16*)(g_ram+0x197A))
#define fx_y_vel (*(uint16*)(g_ram+0x197C))
#define fx_liquid_options (*(uint16*)(g_ram+0x197E))
#define fx_timer (*(uint16*)(g_ram+0x1980))
#define fx_layer_blending_config_a (*(uint16*)(g_ram+0x1982))
#define fx_layer_blending_config_b (*(uint16*)(g_ram+0x1984))
#define fx_layer_blending_config_c (*(uint16*)(g_ram+0x1986))
#define phantom_related_layer_flag (*(uint16*)(g_ram+0x1988))
#define eproj_enable_flag (*(uint16*)(g_ram+0x198D))
#define eproj_unk198F (*(uint16*)(g_ram+0x198F))
#define eproj_index (*(uint16*)(g_ram+0x1991))
#define eproj_init_param_1 (*(uint16*)(g_ram+0x1993))
#define eproj_unk1995 (*(uint16*)(g_ram+0x1995))
#define eproj_id ((uint16*)(g_ram+0x1997))
#define eproj_gfx_idx ((uint16*)(g_ram+0x19BB))
#define eproj_timers ((uint16*)(g_ram+0x19DF))
#define eproj_pre_instr ((uint16*)(g_ram+0x1A03))
#define eproj_x_subpos ((uint16*)(g_ram+0x1A27))
#define eproj_x_pos ((uint16*)(g_ram+0x1A4B))
#define eproj_y_subpos ((uint16*)(g_ram+0x1A6F))
#define eproj_y_pos ((uint16*)(g_ram+0x1A93))
#define eproj_x_vel ((uint16*)(g_ram+0x1AB7))
#define eproj_y_vel ((uint16*)(g_ram+0x1ADB))
#define eproj_E ((uint16*)(g_ram+0x1AFF))
#define eproj_F ((uint16*)(g_ram+0x1B23))
#define eproj_instr_list_ptr ((uint16*)(g_ram+0x1B47))
#define eproj_spritemap_ptr ((uint16*)(g_ram+0x1B6B))
#define eproj_instr_timers ((uint16*)(g_ram+0x1B8F))
#define eproj_radius ((uint16*)(g_ram+0x1BB3))
#define eproj_properties ((uint16*)(g_ram+0x1BD7))
#define eproj_G ((uint16*)(g_ram+0x1BFB))
#define message_box_index (*(uint16*)(g_ram+0x1C1F))
#define plm_flag (*(uint16*)(g_ram+0x1C23))
#define plm_draw_tilemap_index (*(uint16*)(g_ram+0x1C25))
#define plm_id (*(uint16*)(g_ram+0x1C27))
#define plm_x_block (*(uint16*)(g_ram+0x1C29))
#define plm_y_block (*(uint16*)(g_ram+0x1C2B))
#define plm_item_gfx_index (*(uint16*)(g_ram+0x1C2D))
#define plm_item_gfx_ptrs ((uint16*)(g_ram+0x1C2F))
#define plm_header_ptr ((uint16*)(g_ram+0x1C37))
#define plm_block_indices ((uint16*)(g_ram+0x1C87))
#define plm_pre_instrs ((uint16*)(g_ram+0x1CD7))
#define plm_instr_list_ptrs ((uint16*)(g_ram+0x1D27))
#define plm_timers ((uint16*)(g_ram+0x1D77))
#define plm_room_arguments ((uint16*)(g_ram+0x1DC7))
#define plm_variable ((uint16*)(g_ram+0x1E17))
#define custom_draw_instr_num_blocks (*(uint16*)(g_ram+0x1E67))
#define custom_draw_instr_plm_block (*(uint16*)(g_ram+0x1E69))
#define custom_draw_instr_zero_terminator (*(uint16*)(g_ram+0x1E6B))
#define tourian_entrance_statue_finished (*(uint16*)(g_ram+0x1E6D))
#define tourian_entrance_statue_animstate (*(uint16*)(g_ram+0x1E6F))
#define flag_samus_in_quicksand (*(uint16*)(g_ram+0x1E71))
#define inside_block_reaction_samus_point (*(uint16*)(g_ram+0x1E73))
#define save_station_lockout_flag (*(uint16*)(g_ram+0x1E75))
#define current_slope_bts (*(uint16*)(g_ram+0x1E77))
#define flag_for_palette_fx_objects (*(uint16*)(g_ram+0x1E79))
#define palettefx_index (*(uint16*)(g_ram+0x1E7B))
#define palettefx_ids ((uint16*)(g_ram+0x1E7D))
#define palettefx_color_indexes ((uint16*)(g_ram+0x1E8D))
#define palettefx_pre_instr ((uint16*)(g_ram+0x1EAD))
#define palettefx_instr_list_ptrs ((uint16*)(g_ram+0x1EBD))
#define palettefx_instr_timers ((uint16*)(g_ram+0x1ECD))
#define palettefx_timers ((uint16*)(g_ram+0x1EDD))
#define samus_in_heat_palfx_index (*(uint16*)(g_ram+0x1EED))
#define samus_in_heat_palettefx_prev_index (*(uint16*)(g_ram+0x1EEF))
#define animtiles_enable_flag (*(uint16*)(g_ram+0x1EF1))
#define animtiles_object_index (*(uint16*)(g_ram+0x1EF3))
#define animtiles_ids ((uint16*)(g_ram+0x1EF5))
#define animtiles_timers ((uint16*)(g_ram+0x1F01))
#define animtiles_instr_list_ptrs ((uint16*)(g_ram+0x1F0D))
#define animtiles_instr_timers ((uint16*)(g_ram+0x1F19))
#define animtiles_src_ptr ((uint16*)(g_ram+0x1F25))
#define animtiles_sizes ((uint16*)(g_ram+0x1F31))
#define animtiles_vram_ptr ((uint16*)(g_ram+0x1F3D))
#define animtiles_instruction (*(uint16*)(g_ram+0x1F49))
#define cinematic_function (*(uint16*)(g_ram+0x1F51))
#define demo_timer (*(uint16*)(g_ram+0x1F53))
#define demo_set (*(uint16*)(g_ram+0x1F55))
#define demo_scene (*(uint16*)(g_ram+0x1F57))
#define num_demo_sets (*(uint16*)(g_ram+0x1F59))
#define tilemap_stuff ((uint16*)(g_ram+0x2000))
#define ram3000 (*(Ram3000*)(g_ram+0x3000))
#define ram3800 (*(Ram3800*)(g_ram+0x3800))
#define ram4000 (*(Ram4000*)(g_ram+0x4000))
#define enemy_spawn_data ((EnemySpawnData*)(g_ram+0x7000))
#define enemy_ram7800 ((ExtraEnemyRam7800*)(g_ram+0x7800))
#define extra_enemy_ram8000 ((ExtraEnemyRam8000*)(g_ram+0x8000))
#define extra_enemy_ram8800 ((ExtraEnemyRam8800*)(g_ram+0x8800))
#define kraid_unk9000 (*(uint16*)(g_ram+0x9000))
#define g_word_7E9002 (*(uint16*)(g_ram+0x9002))
#define g_word_7E9004 (*(uint16*)(g_ram+0x9004))
#define g_word_7E9006 (*(uint16*)(g_ram+0x9006))
#define g_word_7E9008 (*(uint16*)(g_ram+0x9008))
#define g_word_7E900A (*(uint16*)(g_ram+0x900A))
#define g_word_7E900C (*(uint16*)(g_ram+0x900C))
#define g_word_7E900F (*(uint16*)(g_ram+0x900F))
#define g_word_7E9012 (*(uint16*)(g_ram+0x9012))
#define g_word_7E9015 (*(uint16*)(g_ram+0x9015))
#define g_word_7E9018 (*(uint16*)(g_ram+0x9018))
#define g_word_7E9020 (*(uint16*)(g_ram+0x9020))
#define g_word_7E9022 (*(uint16*)(g_ram+0x9022))
#define g_word_7E9030 (*(uint16*)(g_ram+0x9030))
#define g_word_7E9032 (*(uint16*)(g_ram+0x9032))
#define g_word_7E9040 (*(uint16*)(g_ram+0x9040))
#define g_word_7E9042 (*(uint16*)(g_ram+0x9042))
#define g_word_7E9050 (*(uint16*)(g_ram+0x9050))
#define g_word_7E9052 (*(uint16*)(g_ram+0x9052))
#define g_word_7E9060 (*(uint16*)(g_ram+0x9060))
#define g_word_7E9062 (*(uint16*)(g_ram+0x9062))
#define g_word_7E9070 (*(uint16*)(g_ram+0x9070))
#define g_word_7E9072 (*(uint16*)(g_ram+0x9072))
#define g_word_7E9080 (*(uint16*)(g_ram+0x9080))
#define g_word_7E9082 (*(uint16*)(g_ram+0x9082))
#define g_word_7E9090 (*(uint16*)(g_ram+0x9090))
#define g_word_7E9092 (*(uint16*)(g_ram+0x9092))
#define g_word_7E90A0 (*(uint16*)(g_ram+0x90A0))
#define g_word_7E90A2 (*(uint16*)(g_ram+0x90A2))
#define g_word_7E90B0 (*(uint16*)(g_ram+0x90B0))
#define g_word_7E90B2 (*(uint16*)(g_ram+0x90B2))
#define g_word_7E90C0 (*(uint16*)(g_ram+0x90C0))
#define g_word_7E90C2 (*(uint16*)(g_ram+0x90C2))
#define g_word_7E90D0 (*(uint16*)(g_ram+0x90D0))
#define g_word_7E90D2 (*(uint16*)(g_ram+0x90D2))
#define g_word_7E9100 (*(uint16*)(g_ram+0x9100))
#define g_word_7E9140 (*(uint16*)(g_ram+0x9140))
#define g_word_7E9180 (*(uint16*)(g_ram+0x9180))
#define g_byte_7E9500 (*(uint8*)(g_ram+0x9500))
#define g_byte_7E9510 (*(uint8*)(g_ram+0x9510))
#define g_byte_7E9520 (*(uint8*)(g_ram+0x9520))
#define g_byte_7E9530 (*(uint8*)(g_ram+0x9530))
#define g_byte_7E9540 (*(uint8*)(g_ram+0x9540))
#define g_byte_7E9550 (*(uint8*)(g_ram+0x9550))
#define g_byte_7E9560 (*(uint8*)(g_ram+0x9560))
#define g_byte_7E9570 (*(uint8*)(g_ram+0x9570))
#define g_byte_7E9580 (*(uint8*)(g_ram+0x9580))
#define g_byte_7E9590 (*(uint8*)(g_ram+0x9590))
#define g_byte_7E95A0 (*(uint8*)(g_ram+0x95A0))
#define g_byte_7E95B0 (*(uint8*)(g_ram+0x95B0))
#define g_byte_7E95C0 (*(uint8*)(g_ram+0x95C0))
#define g_byte_7E95D0 (*(uint8*)(g_ram+0x95D0))
#define g_byte_7E95E0 (*(uint8*)(g_ram+0x95E0))
#define g_byte_7E95F0 (*(uint8*)(g_ram+0x95F0))
#define g_byte_7E9600 (*(uint8*)(g_ram+0x9600))
#define g_byte_7E9610 (*(uint8*)(g_ram+0x9610))
#define g_word_7E97DC ((uint16*)(g_ram+0x97DC))
#define hdma_table_1 ((uint16*)(g_ram+0x9800))
#define mother_brain_indirect_hdma ((uint8*)(g_ram+0x9C00))
#define g_word_7E9C44 (*(uint16*)(g_ram+0x9C44))
#define g_word_7E9C46 ((uint16*)(g_ram+0x9C46))
#define hdma_table_2 ((uint16*)(g_ram+0x9D00))
#define hdma_window_1_left_pos ((ExpandingSquareTransitionHdma*)(g_ram+0x9E00))
#define hdma_window_1_right_pos ((ExpandingSquareTransitionHdma*)(g_ram+0x9E10))
#define expand_sq_topbottom_margin_right_pos (*(uint16*)(g_ram+0x9E20))
#define expand_sq_topbottom_margin_left_pos (*(uint16*)(g_ram+0x9E22))
#define expand_sq_left_subpos (*(uint16*)(g_ram+0x9E30))
#define expand_sq_left_pos (*(uint16*)(g_ram+0x9E32))
#define expand_sq_right_subpos (*(uint16*)(g_ram+0x9E34))
#define expand_sq_right_pos (*(uint16*)(g_ram+0x9E36))
#define expand_sq_top_subpos (*(uint16*)(g_ram+0x9E38))
#define expand_sq_top_pos (*(uint16*)(g_ram+0x9E3A))
#define expand_sq_bottom_subpos (*(uint16*)(g_ram+0x9E3C))
#define expand_sq_bottom_pos (*(uint16*)(g_ram+0x9E3E))
#define expand_sq_left_subvel (*(uint16*)(g_ram+0x9E40))
#define expand_sq_left_vel (*(uint16*)(g_ram+0x9E42))
#define expand_sq_right_subvel (*(uint16*)(g_ram+0x9E44))
#define expand_sq_right_vel (*(uint16*)(g_ram+0x9E46))
#define expand_sq_top_subvel (*(uint16*)(g_ram+0x9E48))
#define expand_sq_top_vel (*(uint16*)(g_ram+0x9E4A))
#define expand_sq_bottom_subvel (*(uint16*)(g_ram+0x9E4C))
#define expand_sq_bottom_vel (*(uint16*)(g_ram+0x9E4E))
#define expand_sq_timer (*(uint16*)(g_ram+0x9E50))
#define g_word_7E9E80 ((uint16*)(g_ram+0x9E80))
#define scrolling_sky_bg2_indirect_hdma ((uint8*)(g_ram+0x9F00))
#define scrolling_sky_bg2_hdma_data ((uint16*)(g_ram+0x9F80))
#define tile_table (*(TileTables*)(g_ram+0xA000))
#define palette_buffer ((uint16*)(g_ram+0xC000))
#define target_palettes ((uint16*)(g_ram+0xC200))
#define palette_change_num (*(uint16*)(g_ram+0xC400))
#define palette_change_denom (*(uint16*)(g_ram+0xC402))
#define g_word_7EC404 (*(uint16*)(g_ram+0xC404))
#define power_bomb_explosion_left_hdma ((uint8*)(g_ram+0xC406))
#define power_bomb_explosion_right_hdma ((uint8*)(g_ram+0xC506))
#define offscreen_power_bomb_left_hdma (*(uint8*)(g_ram+0xC606))
#define offscreen_power_bomb_right_hdma (*(uint8*)(g_ram+0xC607))
#define hud_tilemap ((uint16*)(g_ram+0xC608))
#define plm_draw_tilemap ((uint16*)(g_ram+0xC6C8))
#define bg1_column_update_tilemap_left_halves ((uint16*)(g_ram+0xC8C8))
#define bg1_column_update_tilemap_right_halves ((uint16*)(g_ram+0xC908))
#define bg1_column_update_tilemap_top_halves ((uint16*)(g_ram+0xC948))
#define bg1_column_update_tilemap_bottom_halves ((uint16*)(g_ram+0xC98C))
#define bg2_column_update_tilemap_left_halves ((uint8*)(g_ram+0xC9D0))
#define bg2_column_update_tilemap_right_halves ((uint16*)(g_ram+0xCA10))
#define bg2_column_update_tilemap_top_halves ((uint8*)(g_ram+0xCA50))
#define bg2_column_update_tilemap_bottom_halves ((uint8*)(g_ram+0xCA94))
#define hud_bg3_xpos (*(uint16*)(g_ram+0xCAD8))
#define hud_bg3_ypos (*(uint16*)(g_ram+0xCADA))
#define bg3_xpos (*(uint16*)(g_ram+0xCADC))
#define bg3_ypos (*(uint16*)(g_ram+0xCADE))
#define crocomire_bg2_scroll_hdma_indirect ((uint8*)(g_ram+0xCAE0))
#define crocomire_bg2_scroll_hdma_data ((uint16*)(g_ram+0xCAF0))
#define scrolls ((uint8*)(g_ram+0xCD20))
#define explored_map_tiles_saved ((uint16*)(g_ram+0xCD52))
#define debug_enemy_set_name ((uint8*)(g_ram+0xD552))
#define debug_enemy_set_data ((uint8*)(g_ram+0xD55A))
#define wrecked_ship_robot_palanim_palindex (*(uint16*)(g_ram+0xD652))
#define wrecked_ship_robot_palanim_timer (*(uint16*)(g_ram+0xD654))
#define wrecked_ship_robot_palanim_table_index (*(uint8*)(g_ram+0xD656))
#define projectiletrail_left_instr_timer ((uint16*)(g_ram+0xD658))
#define projectiletrail_right_instr_timer ((uint16*)(g_ram+0xD67C))
#define projectiletrail_left_instr_list_ptr ((uint16*)(g_ram+0xD6A0))
#define projectiletrail_right_instr_list_ptr ((uint16*)(g_ram+0xD6C4))
#define projectiletrail_left_tile_and_attribs ((uint16*)(g_ram+0xD6E8))
#define projectiletrail_right_tile_and_attribs ((uint16*)(g_ram+0xD70C))
#define projectiletrail_left_x_pos ((uint16*)(g_ram+0xD730))
#define projectiletrail_right_x_pos ((uint16*)(g_ram+0xD754))
#define projectiletrail_left_y_pos ((uint16*)(g_ram+0xD778))
#define projectiletrail_right_y_pos ((uint16*)(g_ram+0xD79C))
#define player_data_saved ((uint16*)(g_ram+0xD7C0))
#define events_that_happened ((uint8*)(g_ram+0xD820))
#define boss_bits_for_area ((uint8*)(g_ram+0xD828))
#define room_chozo_bits ((uint8*)(g_ram+0xD830))
#define item_bit_array ((uint8*)(g_ram+0xD870))
#define opened_door_bit_array ((uint8*)(g_ram+0xD8B0))
#define UNUSED_word_7ED8F0 ((uint16*)(g_ram+0xD8F0))
#define used_save_stations_and_elevators ((uint8*)(g_ram+0xD8F8))
#define map_station_byte_array ((uint8*)(g_ram+0xD908))
#define loading_game_state (*(uint16*)(g_ram+0xD914))
#define sram_save_station_index (*(uint16*)(g_ram+0xD916))
#define sram_area_index (*(uint16*)(g_ram+0xD918))
#define global_number_of_items_loaded_ctr (*(uint16*)(g_ram+0xD91A))
#define compressed_map_data ((uint8*)(g_ram+0xD91C))
#define plm_instruction_timer ((uint16*)(g_ram+0xDE1C))
#define plm_instruction_draw_ptr ((uint16*)(g_ram+0xDE6C))
#define plm_instruction_list_link_reg ((uint16*)(g_ram+0xDEBC))
#define plm_variables ((uint16*)(g_ram+0xDF0C))
#define backup_of_bg2_during_pause ((uint16*)(g_ram+0xDF5C))
#define enemy_def_ptr ((uint16*)(g_ram+0xEF5C))
#define enemy_gfxdata_tiles_index ((uint16*)(g_ram+0xEF64))
#define enemy_gfxdata_vram_ptr ((uint16*)(g_ram+0xEF6C))
#define REMOVED_enemy_gfx_data_write_ptr (*(uint16*)(g_ram+0xEF74))
#define REMOVED_next_enemy_tiles_index (*(uint16*)(g_ram+0xEF76))
#define sprite_instr_list_ptrs ((uint16*)(g_ram+0xEF78))
#define sprite_instr_timer ((uint16*)(g_ram+0xEFF8))
#define sprite_palettes ((uint16*)(g_ram+0xF078))
#define sprite_x_pos ((uint16*)(g_ram+0xF0F8))
#define sprite_x_subpos ((uint16*)(g_ram+0xF178))
#define sprite_y_pos ((uint16*)(g_ram+0xF1F8))
#define sprite_y_subpos ((uint16*)(g_ram+0xF278))
#define sprite_disable_flag ((uint16*)(g_ram+0xF2F8))
#define enemy_processing_stage (*(uint16*)(g_ram+0xF378))
#define eproj_flags ((uint16*)(g_ram+0xF380))
#define eproj_enemy_header_ptr ((uint16*)(g_ram+0xF3C8))
#define eproj_killed_enemy_index ((uint16*)(g_ram+0xF410))
#define special_death_item_drop_x_origin_pos (*(uint16*)(g_ram+0xF434))
#define special_death_item_drop_y_origin_pos (*(uint16*)(g_ram+0xF436))
#define ram7F_start (*(uint16*)(g_ram+0x10000))
#define level_data ((uint16*)(g_ram+0x10002))
#define BTS ((uint8*)(g_ram+0x16402))
#define custom_background ((uint16*)(g_ram+0x19602))
#define kSramChecksum ((uint16*)(g_sram+0x0))
#define kSramChecksumInverted ((uint16*)(g_sram+0x8))
#define sram_save_slot_selected (*(uint16*)(g_sram+0x1FEC))
#define sram_save_slot_selected_complement (*(uint16*)(g_sram+0x1FEE))
#define kSramChecksumUpper ((uint16*)(g_sram+0x1FF0))
#define kSramChecksumInvertedUpper ((uint16*)(g_sram+0x1FF8))

#include "variables_extra.h"

#define ADDR16_OF_RAM(x) ((uint8*)&(x) - g_ram)

#endif // SM_VARIABLES_H_
