1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
|
.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 VRAM_start $8000
.DEFINE OAM_start $FE00
.DEFINE dungeon_generation_step $20
.DEFINE intial_duplication_probablity $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
; frame 2: applying bunny attack damages
; frame 3: checking entities health and death if 0
; frame 4: new entity spawn
; frame 9: entity collision map is being updated
; frame 8: attack is executed on the enemies if it was predicted in frame "-1"
; 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_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: if the object should be reloaded (scroll or first load)
; 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
.DEFINE mem_prepared_block_tile ($c00d)
.DEFINE mem_prepared_block_position_1 ($c00e)
.DEFINE mem_prepared_block_position_2 ($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_dead_mode $10
.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 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_prepared_loading_block_tile ($c022)
.DEFINE mem_prepared_loading_block_position_1 ($c023)
.DEFINE mem_prepared_loading_block_position_2 ($c024)
.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_additional_loading_block_x ($c037)
.DEFINE mem_additional_loading_block_y ($c038)
.DEFINE mem_additional_loading_block_tile ($c039)
.DEFINE mem_additional_loading_block_position_1 ($c03a)
.DEFINE mem_additional_loading_block_position_2 ($c03b)
.DEFINE mem_floor_count ($c03c)
.DEFINE mem_loop_frame_timer ($c03d)
.DEFINE mem_dialogue_script_program_counter $c03e ; takes c03e and c03f
.DEFINE mem_entity_being_attacked_low ($c040)
.DEFINE mem_vblank_jump_instruction $c041 ; takes from c041 to c043
.DEFINE mem_vblank_jump_destination $c042 ; takes from c042 to c043
.DEFINE mem_stat_jump_instruction $c044 ; takes from c044 to c046
.DEFINE mem_stat_jump_destination $c045 ; takes from c045 to c046
; ## 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_dungeon_generation_events $c9c0 ; Takes the memory from c9c0 to c9ff (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
;
; free_parameters: (u16)
; 01: Dialogue script address
; 02: Entity template index (u8 + padding8)
; }
.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 (animation = bit 7-4, bit 3 = is_moving, bit 2-0: direction),
; aaaamddd: a = animation, m = is_moving, d = direction
; animations:
; nothing = 0
; action = 1
; death = 2
; superjump = 3
; shaking = 4
; 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 attack mode
; 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
; mana: u8
; _padding: u48
;
; # SANTA CHRISTMAS LIST PLEASE #
; health, max health, list of possible attacks, maybe remaining attacks ? AI status (blind, scared, slow, etc..)
; }
.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 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 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:
;
; 80-85 ; Free to use as temporary variables
.DEFINE tmp_var_1 ($80)
.DEFINE tmp_var_2 ($81)
.DEFINE tmp_var_3 ($82)
.DEFINE tmp_var_4 ($83)
.DEFINE tmp_var_5 ($84)
.DEFINE tmp_var_6 ($85)
; 86-90 ; OAM_DMA_Transfer_routine
.DEFINE OAM_DMA_Transfer_routine $ff86
; 90-fe ; Stack
|