.DEFINE reg_joypad ($00) .DEFINE reg_interrupt_flags ($0f) .DEFINE reg_lcd_controller ($40) .DEFINE reg_lcd_status ($41) .DEFINE reg_ly ($44) .DEFINE reg_lyc ($45) .DEFINE reg_viewport_y ($42) .DEFINE reg_viewport_x ($43) .DEFINE reg_bg_palette ($47) .DEFINE reg_obj0_palette ($48) .DEFINE reg_obj1_palette ($49) .DEFINE reg_window_y ($4a) .DEFINE reg_window_x ($4b) .DEFINE reg_interrupt_enable ($ff) .DEFINE reg_rom_bank ($2000) .DEFINE VRAM_start $8000 .DEFINE OAM_start $FE00 .DEFINE VRAM_tilemap_1 $9800 .DEFINE dungeon_generation_step $20 .DEFINE intial_duplication_probablity $01 .DEFINE entity_sprite_data_bank $01 .DEFINE mem_button_direction ($c002) .DEFINE mem_button_action ($c003) .DEFINE mem_moving_animation_step ($c004) ; frame 0: movement can be initiated when with button actions/most turn enemies AI are computed here ; frame 1: dead mode applied if animation_step going up (with the bzero/memcpy for dialogue text) ; frame 2: applying bunny attack damages ; frame 3: checking entities health and death if 0 ; frame 4: new entity spawn ; frame 5: entity collision map is being updated ; frame 8: attack is executed on the enemies if it was predicted in frame "-1" ; frame 9: entity collision map is being updated (again) ; frame 12: poison effect thingy ; frame 15: movement is ended and coordinates are updated .DEFINE mem_bunny_sprite ($cb00) .DEFINE mem_bunny_x ($cb01) .DEFINE mem_bunny_y ($cb02) .DEFINE mem_bunny_direction ($cb03) .DEFINE mem_bunny_health ($cb06) .DEFINE mem_bunny_flags ($cb07) .DEFINE mem_bunny_status ($cb08) .DEFINE mem_bunny_mana ($cb09) .DEFINE mem_bunny_animation ($cb0a) .DEFINE mem_viewport_x ($c008) .DEFINE mem_viewport_y ($c009) .DEFINE mem_rng_state_1 ($c00a) ; 2 bytes .DEFINE mem_rng_state_2 ($c00b) ; 2 bytes .DEFINE mem_map_loading_flags ($c00c) ; bit 0: scroll or first load (load map) ; bit 1: has a movement ended (objects interaction should be checked, entities should update their positions) ; bit 2: if the prepared block should be updated at the next frame ; bit 3: animation step is going up (?) ; bit 4: animation step should start to go up on next frame ; bit 5: if entity collision map should be updated .DEFINE mem_number_of_attacks ($c00d) .DEFINE mem_entity_being_attacked_low ($c00e) ; FREE SPACE POGPOGPOG $c00f .DEFINE mem_object_load_counter ($c010) .DEFINE mem_prepared_viewport_x ($c011) .DEFINE mem_prepared_viewport_y ($c012) .DEFINE mem_display_flag ($c013) ; bit 0: if dialogue box is displayed ; bit 1: dialogue box first line should be bold ; bit 2: if dialogue box text should be refreshed (part1) ; bit 3: if side window box should be displayed ; bit 4: if dialogue box text should be refreshed (part2) ; bit 5: if object display is paused ; bit 6: if additional tile should be loaded .DEFINE mem_current_mode ($c014) .DEFINE mem_requested_mode ($c015) ; bit 0-3: which vblank handler group .DEFINE enum_dungeon_mode $00 .DEFINE enum_dungeon_menu_mode $01 .DEFINE enum_dungeon_dialogue_mode $11 .DEFINE enum_loading_mode $02 .DEFINE enum_animation_wait_mode $12 .DEFINE enum_dungeon_generation_mode $03 .DEFINE enum_dead_mode $21 .DEFINE mem_menu_cursor_position ($c016) .DEFINE mem_last_button_direction ($c017) .DEFINE dialogue_menu_choice1_routine $c018 ; Takes also $c019 .DEFINE dialogue_menu_choice2_routine $c01a ; Takes also $c01b .DEFINE dialogue_menu_choice3_routine $c01c ; Takes also $c01d .DEFINE dialogue_menu_choice4_routine $c01e ; Takes also $c01f .DEFINE mem_last_button_action ($c020) .DEFINE mem_loading_step ($c021) .DEFINE mem_rom_tilemap_addr $c022 ; Takes $c022 to $c024 (bank + ptr) .DEFINE mem_loading_mode_vblank_func_pointer_high ($c025) .DEFINE mem_loading_mode_vblank_func_pointer_low ($c026) .DEFINE mem_loading_mode_regular_func_pointer_high ($c027) .DEFINE mem_loading_mode_regular_func_pointer_low ($c028) .DEFINE mem_prepared_color_palette ($c029) .DEFINE mem_bunny_current_room_idx ($c02a) .DEFINE mem_enemies_alive_count ($c02b) .DEFINE mem_bunny_predicted_x ($c02c) .DEFINE mem_bunny_predicted_y ($c02d) .DEFINE mem_animation_wait_frames ($c02e) .DEFINE mem_bunny_status_clear_turn_counter ($c02f) .DEFINE mem_bunny_attacks $c030 ; Takes the memory from c030 to c033 .DEFINE mem_current_focused_attack_ep_cost ($c034) .DEFINE mem_bunny_next_mana_regen ($c035) .DEFINE mem_blinking_animation_counter ($c036) .DEFINE mem_entity_spawning_pattern ($c037) ; 38-3a .DEFINE mem_dialogue_script_bank ($c038) .DEFINE mem_dialogue_script_program_counter $c039 ; takes c039 and c03a .DEFINE mem_floor_count_bin ($c03b) .DEFINE mem_floor_count ($c03c) .DEFINE mem_loop_frame_timer ($c03d) .DEFINE mem_bunny_status_tile ($c03e) .DEFINE mem_cursor_max_position ($c03f) .DEFINE mem_vblank_jump_instruction $c040 ; takes from c040 to c042 .DEFINE mem_vblank_jump_destination $c041 ; takes from c041 to c042 .DEFINE mem_stat_jump_instruction $c043 ; takes from c043 to c045 .DEFINE mem_stat_jump_destination $c044 ; takes from c044 to c045 .DEFINE mem_learn_attack_dialogue_ret_ptr $c046 ; Takes $c046 to $c048 (bank + ptr) .DEFINE mem_learn_attack_attack_name_ptr $c049 ; Takes $c049 to $c04b (bank + ptr) ; FREE SPACE $c04c .DEFINE mem_prepared_loading_block_position $c04e ; Takes $c04e-$c04f .DEFINE mem_prepared_loading_block_tile $c050 ; Takes $c050-c054 .DEFINE mem_additional_loading_block_x ($c055) .DEFINE mem_additional_loading_block_y ($c056) .DEFINE mem_additional_loading_block_position $c057 ; Takes $c057-$c058 .DEFINE mem_additional_loading_block_tile $c059 ; Takes $c059-$c05c .DEFINE mem_prepared_block_position $c05d ; Takes $c05d-$c05e .DEFINE mem_prepared_block_tile $c05f ; Takes $c05f-$c062 .DEFINE mem_dungeon $c063 ; Takes $c063-$c065 .DEFINE mem_dungeon_flags ($c066) .DEFINE mem_rom_collision_map_addr $c067 ; Takes $c067 to $c069 (bank + ptr) .DEFINE mem_current_vgm_pc $c070 ; Takes $c070 to $c072 (bank + ptr) .DEFINE mem_current_vgm_header $c073 ; Takes $c073 to $c075 (bank + ptr) .DEFINE mem_sound_flags ($c076) ; bit 0 = 1 => music playing ; bit 1 = 1 => sound effect playing on channel 1 (music should not use it) ; bit 2 = 1 => sound effect playing on channel 2 (music should not use it) ; bit 3 = 1 => sound effect playing on channel 3 (music should not use it) ; bit 4 = 1 => sound effect playing on channel 4 (music should not use it) ; bit 5 = 1 => $mem_sound_effect_frame_count is going down ; bit 6 = 1 => Start_Music call is requested .DEFINE mem_sound_effect_frame_count ($c077) .DEFINE mem_sound_effect_pc $c078 ; Takes $c078 - $c07a (bank + ptr) .DEFINE mem_sound_effect_hl $c07b ; Takes $c07b - $c07c .DEFINE mem_dungeon_custom_vblank_function $c07d ; Takes $c07d - $c07f (bank + ptr) ; ## WARNING THE SPACE BETWEEN $c400 and $c800 is used as a buffer for the loading map function during dungeon generation .DEFINE mem_map_loading_buffer $c400 .DEFINE mem_next_free_head_lower_bytes ($c6ff) .DEFINE mem_dungeon_generation_heads $c700 ; Takes the memory from c700 to c717 ; struct head { ; direction: u8 (really u3 but padding), ; x: u8, ; y: u8, ; } ; a bit of 1 is equivalent to an entity being on the tile .DEFINE mem_entities_collisions $c780 ; Takes the memory from c780 to c7ff ; ## END OF THE LOADING MAP FUNCTION ; a bit of 1 is equivalent to the tile being free .DEFINE mem_dungeon_map $c800 ; Takes the memory from c800 to c87f .DEFINE mem_room_list $c880 ; Takes the memory from c880 to c89f ; struct room { ; x: u8, ; sizex: u8, ; y: u8, ; sizey: u8, ; } .DEFINE mem_number_of_rooms ($c8a0) .DEFINE mem_loaded_entities_indices $c8a8 ; Takes the memory from $c8a8 to $c8ae .DEFINE mem_loaded_enemies_indices $c8ab ; Takes the memory from $c8ab to $c8ae .DEFINE mem_loaded_special_entity_index ($c8af) .DEFINE mem_loaded_entities_indices_end $c8b0 ; Takes the memory from $c8a8 to $c8af .DEFINE mem_object_list $c900 ; Takes the memory from c900 to c97f ; struct objects { ; sprite: u8, ; x: u8, ; y: u8, ; interaction_jump_table_index: u8 ; _padding: u32 ; } .DEFINE mem_oam_buffer $ca00 ; Until $ca9f .DEFINE mem_oam_buffer_low ($c980) .DEFINE dialogue_buffer $caa0 ; Until $cad6 .DEFINE dialogue_first_line $caa0 .DEFINE dialogue_second_line $cab2 .DEFINE dialogue_third_line $cac4 .DEFINE dialogue_menu_choice1 $caa1 .DEFINE dialogue_menu_choice2 $caaa .DEFINE dialogue_menu_choice3 $cac5 .DEFINE dialogue_menu_choice4 $cace .DEFINE dialogue_menu_choice1_cursor ($9cb4) .DEFINE dialogue_menu_choice2_cursor ($9cbd) .DEFINE dialogue_menu_choice3_cursor ($9cf4) .DEFINE dialogue_menu_choice4_cursor ($9cfd) .DEFINE mem_last_animation_low_pointer ($cadf) .DEFINE mem_animation_list $cae0; Until $caff ; struct animation { ; jump_table_index: u8, ; x: u8, ; y: u8, ; step: u8, ; entity_effect: u8, ; high(u4): effect to start (0 = nothing, 1 = blinking) ; low(u4): entity_id ; _padding: u24, ; } .DEFINE mem_entities_list $cb00 ; Until cbff ; struct entity { ; sprite: u8, ; x: u8, ; y: u8, ; direction: u8 (facing = bit 6-4, bit 3 = is_moving, bit 2-0: direction moving), ; 0aaamddd: f = facing direction, m = is_moving, d = moving direction ; turn_function_jump_table_index: u8 ; action_function_jump_table_index: u8 ; health: u8 (DAA decimal !!) ; flags: u8 ; bit 0: speed 2x ; bit 1: shadow mode ; bit 2: end of turn effect (attack mode for fox, die for bug) ; bit 3: blinking mode ; status: u8 ; ; bit 0: whether or not turns should be skipped ; ; bit 2: whether or not the status should be removed for the next turn ; ; 01: freeze ; ; 02: invincible ; ; 04: end of freeze ; ; 08: poison ; mana: u8 ; animation: u8 ; animations: ; nothing = 0 ; action = 1 ; death = 2 ; superjump = 3 ; shaking = 4 ; doubleseed = 5 ; slide (forcing no hops on move) = 6 ; _padding: u40 ; ; # SANTA CHRISTMAS LIST PLEASE # ; health, max health, list of possible attacks, maybe remaining attacks ? AI status (blind, scared, slow, etc..) ; } .DEFINE mem_dungeon_generation_events $cc80 ; Takes the memory from cc80 to ccff (16 events) ; struct events { ; floor_idx: u8, ; ; dungeon_gen_event_jump_table_index: u8 ; 00: Nothing ; 01: Start dialogue at the beggining ; 02: Spawn a special entity (should not be used twice on the same floor ; 03: Remove stairs ; ; free_parameters: (u24) ; 01: Dialogue script address (bank + address) ; 02: Entity template index (u8 + padding16) ; _padding: u24 ; } .DEFINE dbg_var ($dfff) .DEFINE enum_direction_left $01 .DEFINE enum_direction_right $02 .DEFINE enum_direction_up $03 .DEFINE enum_direction_down $04 .DEFINE entity_fox_index $00 .DEFINE entity_frog_index $01 .DEFINE entity_cat_index $02 .DEFINE entity_penguin_index $03 .DEFINE entity_mouse_index $04 .DEFINE entity_fimsh_index $05 .DEFINE entity_questgoalbunny_index $06 .DEFINE entity_bug_index $07 .DEFINE palette_normal $e4 .DEFINE palette_black $ff .DEFINE palette_white $94 .DEFINE palette_bold_font $f4 .DEFINE palette_thin_font $c4 .DEFINE obj_palette_normal $d3 .DEFINE obj_palette_frozen $ab .DEFINE lcdc_guibg_tilemap $8d .DEFINE lcdc_mapbg_tilemap $87 .DEFINE lcdc_titlescreen $85 .DEFINE vram_entity_index $02 .DEFINE vram_animation_index $62 .DEFINE vram_character_index $80 .DEFINE vram_icon_index $F0 .DEFINE vram_bg_index $20 .DEFINE vram_object_index $60 ; HIGH_RAM: ; .DEFINE saved_rom_bank ($80) ; 81-86 ; Free to use as temporary variables .DEFINE tmp_var_1 ($81) .DEFINE tmp_var_2 ($82) .DEFINE tmp_var_3 ($83) .DEFINE tmp_var_4 ($84) .DEFINE tmp_var_5 ($85) .DEFINE tmp_var_6 ($86) ; 86-90 ; OAM_DMA_Transfer_routine .DEFINE OAM_DMA_Transfer_routine $ff86 ; 90-fe ; Stack