diff --git a/src/bank0.asm b/src/bank0.asm index d83efcd..dae1a57 100644 --- a/src/bank0.asm +++ b/src/bank0.asm @@ -9525,6 +9525,7 @@ alien_fetus_get_aim_timer: rts ; table for delay amount between re-aiming alien fetus toward player (#$e bytes) +; CPU address $b7e8 alien_fetus_aim_timer_tbl: .byte $16,$0f,$08,$13,$3a,$06,$21 .byte $3a,$1d,$14,$12,$28,$48,$ff diff --git a/src/bank1.asm b/src/bank1.asm index bd9b6ab..e17682f 100644 --- a/src/bank1.asm +++ b/src/bank1.asm @@ -22,6 +22,7 @@ ; pointer table for music of level 1 (#$8 * #$2 = #$10 bytes) ; related to pulse channel config registers +; CPU address $8001 pulse_volume_ptr_tbl: .addr lvl_1_pulse_volume_00 ; CPU address $91dd .addr lvl_1_pulse_volume_01 ; CPU address $91e5 @@ -269,6 +270,7 @@ handle_sound_code: ; set new PULSE_VOLUME,x byte from lvl_x_pulse_volume_xx based on LVL_PULSE_VOL_INDEX,x and set pulse 1 and 2 configuration (volume) ; based on newly loaded PULSE_VOLUME,x, UNKNOWN_SOUND_01, and SOUND_CFG_HIGH,x ; called for simple sound commands as well +; CPU address $8154 ; input ; * x - sound channel offset lvl_config_pulse: @@ -413,6 +415,7 @@ handle_sound_code_exit_01: ; This mode is used for pulse channels only ; read sound byte and if not [#$fd-#$ff] interpret_sound_byte otherwise sound_cmd_routine_03 ; SOUND_FLAGS,x is odd, indicating initial sound code byte was < #$30 +; CPU address $81e7 read_low_sound_cmd: lda ($e0),y ; read sound_xx byte at current offset cmp #$fd ; compare to #$fd @@ -598,6 +601,7 @@ play_percussive_sound: ; contains sound codes to play the intro theme (#$08 bytes) ; related to music tracks instruments +; CPU address $82cd ; * sound_02 - percussive tick (bass drum/tom drum) ; * sound_25 - game intro tune song noise explosion ; * sound_5a - dmc sample (high hat) diff --git a/src/bank2.asm b/src/bank2.asm index 0a03aa2..1cf3644 100644 --- a/src/bank2.asm +++ b/src/bank2.asm @@ -726,7 +726,7 @@ level_2_4_boss_supertiles_screen_01: ; nametable data - writes addresses [$2000-$2400) ; "1 PLAYER" ; "2 PLAYERS" -; "TM AND C 1988" +; "TM AND © 1988" ; "KONAMI INDUSTRY" ; "CO.,LTD" ; "LICENSED BY" @@ -1708,6 +1708,7 @@ exe_soldier_generation: jsr run_routine_from_tbl_below ; run routine a in the following table (soldier_generation_ptr_tbl) ; pointer table for soldier generation (#$3 * #$2 = #$6 bytes) +; CPU address $b537 soldier_generation_ptr_tbl: .addr soldier_generation_00 ; CPU address $b53d .addr soldier_generation_01 ; CPU address $b581 diff --git a/src/bank3.asm b/src/bank3.asm index 1a50a53..e4a8e90 100644 --- a/src/bank3.asm +++ b/src/bank3.asm @@ -1225,6 +1225,7 @@ run_end_level_sequence_routine: jsr run_routine_from_tbl_below ; run routine a in the following table (end_level_sequence_ptr_tbl) ; pointer table for end of level sequences (#$3 * #$2 = #$6 bytes) +; CPU address $be09 end_level_sequence_ptr_tbl: .addr end_level_sequence_00 ; CPU address $be0f .addr end_level_sequence_01 ; CPU address $be3c @@ -1262,6 +1263,7 @@ end_level_sequence_00: lda #$20 ; a = #$20 jmp set_delay_adv_routine ; set LEVEL_END_DELAY_TIMER to #$20 and advance to end_level_sequence_01 +; CPU address $be3c end_level_sequence_01: lda LEVEL_END_DELAY_TIMER ; load level ending sequence delay timer beq @continue ; continue if elapsed diff --git a/src/bank4.asm b/src/bank4.asm index a1df666..c362a99 100644 --- a/src/bank4.asm +++ b/src/bank4.asm @@ -120,6 +120,7 @@ run_game_end_routine: jsr run_routine_from_tbl_below ; run routine a in the following table (game_end_routine_tbl) ; pointer table for ending (6 * 2 = c bytes) +; CPU address $b8be game_end_routine_tbl: .addr game_end_routine_00 ; CPU address $b8ca (fade away) .addr game_end_routine_01 ; CPU address $b8d3 (screen melt and init for game_end_routine_02) @@ -212,6 +213,7 @@ game_end_routine_03: ; pointer table for ending scenes (#$03 * #$02 = #06 bytes) ; analogous to end_level_sequence_ptr_tbl, but for end of game +; CPU address $b949 end_game_sequence_ptr_tbl: .addr end_game_sequence_00 ; CPU address $b94f .addr end_game_sequence_01 ; CPU address $b98f @@ -665,7 +667,7 @@ ending_credits_00: ; $5a = Z ; $87 = ! ; $b0 = , -; $c3 = ? +; $c3 = © ; $f7 = ' ; ending credits text data ; byte 0: number of bytes to process after byte 1 diff --git a/src/bank7.asm b/src/bank7.asm index 806a5ad..00cd9e4 100644 --- a/src/bank7.asm +++ b/src/bank7.asm @@ -3651,6 +3651,7 @@ set_ending_palette_animation: bne set_a_to_palette_2 ; number of palettes to cycle through per level (LEVEL_PALETTE_CYCLE) +; CPU address $d181 lvl_palette_animation_count: .byte $04,$04,$03,$04,$04,$04,$04,$04,$04 @@ -8920,7 +8921,7 @@ find_far_segment_for_a: tya ; move far_segment_code_tbl into a rts -; table for ?? (#$7 bytes) +; table for segment based on distance (#$7 bytes) far_segment_code_tbl: .byte $ff,$94,$8c,$84,$7c,$74,$6c diff --git a/src/constants.asm b/src/constants.asm index a30151d..a3e35f6 100644 --- a/src/constants.asm +++ b/src/constants.asm @@ -37,7 +37,7 @@ PLAYER_WEAPON_STRENGTH = $2f ; the damage strength of the player's cur CURRENT_LEVEL = $30 ; #$00-#$09, #$00 to #$07 represent levels 1 through 8. #$9 is interpreted as game over sequence GAME_COMPLETION_COUNT = $31 ; the number of times the game has been completed (final boss defeated) P1_NUM_LIVES = $32 ; P1 number of lives, #$00 is last life, on game over stays #$00, but P1_GAME_OVER_STATUS becomes #$01 -P2_NUM_LIVES = $33 ; P2 number of lives, #$00 is last life, on game over stays #$00, but P1_GAME_OVER_STATUS becomes #$01 +P2_NUM_LIVES = $33 ; P2 number of lives, #$00 is last life, on game over stays #$00, but P2_GAME_OVER_STATUS becomes #$01 RANDOM_NUM = $34 ; random number increased in forever_loop NUM_PALETTES_TO_LOAD = $36 ; the number of palettes to load into CPU memory INDOOR_SCREEN_CLEARED = $37 ; whether indoor screen has had all cores destroyed (0 = not cleared, 1 = cleared, #$80 = cleared and fence removed) @@ -63,7 +63,7 @@ COLLISION_CODE_1_TILE_INDEX = $49 ; pattern table tiles below this tile index COLLISION_CODE_0_TILE_INDEX = $4a ; pattern table tiles >= $49 and less than this tile index are considered Collision Code 0 (empty) COLLISION_CODE_2_TILE_INDEX = $4b ; pattern table tiles >= $4a and less than this tile index are considered Collision Code 2 (water) -LEVEL_PALETTE_CYCLE_INDEXES = $4c ; palette indexes into game_palettes to cycle through for the level [$4c-4f] +LEVEL_PALETTE_CYCLE_INDEXES = $4c ; palette indexes into game_palettes to cycle through for the level for the 4th nametable palette index [$4c-4f] LEVEL_PALETTE_INDEX = $50 ; the level's initial background palettes [$50 to $54) and sprite palettes [$54 to $58). Offsets into game_palettes table LEVEL_STOP_SCROLL = $58 ; the screen of the level to stop scrolling, set to #$ff when boss auto scroll starts @@ -85,7 +85,7 @@ LEVEL_TRANSITION_TIMER = $61 ; used in vertical levels to time animatio PPU_WRITE_ADDRESS_LOW_BYTE = $62 ; used to populate the PPU write address in the CPU_GRAPHICS_BUFFER PPU_WRITE_ADDRESS_HIGH_BYTE = $63 ; used to populate the PPU write address in the CPU_GRAPHICS_BUFFER LEVEL_SCREEN_NUMBER = $64 ; the screen number of the current level (how many screens into the level) -LEVEL_SCREEN_SCROLL_OFFSET = $65 ; the number of pixels into LEVEL_SCREEN_NUMBER the level has scrolled. Goes from $00-$ff for each screen (256 pixels) +LEVEL_SCREEN_SCROLL_OFFSET = $65 ; the number of pixels into LEVEL_SCREEN_NUMBER the level has scrolled. Goes from #$00-#$ff for each screen (256 pixels) ; for horizontal levels, this is how many pixels scrolled to the right ; for vertical levels, this is how many pixels up scrolled, note this value is equal to #$f0 - VERTICAL_SCROLL ; for indoor levels, after defeating a wall, increases from #$00 to #03 @@ -96,22 +96,22 @@ FRAME_SCROLL = $68 ; how much to scroll the screen this frame SUPERTILE_NAMETABLE_OFFSET = $69 ; base nametable offset into memory address into CPU graphics buffer starting at $0600 (LEVEL_SCREEN_SUPERTILES) ; always either #$00 (nametable 0) or #$40 (nametable 1), points to area that contains the super-tile indexes for screen SPRITE_LOAD_TYPE = $6a ; which sprites to load #$0 for normal sprites, #$1 for HUD sprites -CONT_END_SELECTION = $6b ; #$00 when "CONTINUE" is selected, #$01 when 'END" is selected, used only in game over screen (level_routine_06) +CONT_END_SELECTION = $6b ; #$00 when "CONTINUE" is selected, #$01 when "END" is selected, used only in game over screen (level_routine_06) ALT_GRAPHIC_DATA_LOADING_FLAG = $71 ; #$00 means that the alternate graphics data should not be loaded, #$01 means it should be #$02 means it currently is being loaded LEVEL_PALETTE_CYCLE = $72 ; the current iteration of the palette animation loop #$00 up to entry for level in lvl_palette_animation_count -INDOOR_SCROLL = $73 ; scrolling on indoor level changes (0 = not scrolling; 1 = scrolling, 2 = finished scrolling) +INDOOR_SCROLL = $73 ; scrolling on indoor level changes (#$00 = not scrolling; #$01 = scrolling, #$02 = finished scrolling) BG_PALETTE_ADJ_TIMER = $74 ; timer used for adjusting background palette colors (not sprite palettes). Used for fade-in effect of dragon and boss ufo as well as indoor transitions AUTO_SCROLL_TIMER_00 = $75 ; used when completing scroll to show a boss, e.g. vertical level dragon screen AUTO_SCROLL_TIMER_01 = $76 ; used when completing scroll to show a boss, e.g. alien guardian TANK_AUTO_SCROLL = $77 ; amount to scroll every frame, regardless of AUTO_SCROLL_TIMER_xx, used for snow field tanks (dogras), breaks levels if used on other levels -PAUSE_PALETTE_CYCLE = $78 ; #$00 - nametable palettes #$03 and #$04 will cycle through colors like normal, non zero pauses palette color cycling (ice field tank pauses palette cycle) +PAUSE_PALETTE_CYCLE = $78 ; #$00 - nametable palettes #$03 and #$04 will cycle through colors like normal. Non-zero values will pause palette color cycling (ice field tank pauses palette cycle) SOLDIER_GENERATION_ROUTINE = $79 ; which routine is currently in use for generating soldiers (index into soldier_generation_ptr_tbl) SOLDIER_GENERATION_TIMER = $7a ; a timer between soldier generation. #$00 means no generation. see level_soldier_generation_timer. When used in a level, every frame decrements by 2 (unless scrolling, then only by 1) SOLDIER_GENERATION_X_POS = $7b ; the initial x position of the generated soldier SOLDIER_GENERATION_Y_POS = $7c ; the initial y position of the generated soldier FALCON_FLASH_TIMER = $7d ; the number of frames to flash the screen for falcon weapon item TANK_ICE_JOINT_SCROLL_FLAG = $7f ; whether or not to have the ice joint enemy move left while player walks right to simulate being on the background -ENEMY_LEVEL_ROUTINES = $80 ; two byte address to the correct enemy_routine_level_XX for the current level, used to retrieve enemy routines for the level +ENEMY_LEVEL_ROUTINES = $80 ; two byte address to the correct enemy_routine_level_XX for the current level, used to retrieve enemy routines for the level-specific enemies ENEMY_SCREEN_READ_OFFSET = $82 ; read offset into level_xx_enemy_screen_xx table, which specifies the enemies on each screen of a level ENEMY_CURRENT_SLOT = $83 ; when in use, specifies the current enemy slot that is being executed, used to be able to restore x register after method has used it BOSS_AUTO_SCROLL_COMPLETE = $84 ; set when boss reveal auto-scrolling has completed, see AUTO_SCROLL_TIMER_00 and AUTO_SCROLL_TIMER_01 @@ -123,10 +123,11 @@ INDOOR_ENEMY_ATTACK_COUNT = $88 ; used in indoor/base levels to specify ho INDOOR_RED_SOLDIER_CREATED = $89 ; used in indoor/base levels to indicate if a red jumping soldier has been created, to prevent creation of another GRENADE_LAUNCHER_FLAG = $8a ; used in indoor/base levels to indicate that a grenade launcher enemy (ENEMY_TYPE #$17) is on the screen. Prevents other indoor enemies from being generated ALIEN_FETUS_AIM_TIMER_INDEX = $8b ; used to keep track of the index into alien_fetus_aim_timer_tbl to set the delay between re-aiming towards the player -ENEMY_ATTACK_FLAG = $8e ; whether or not enemies will fire at player, also whether or not random enemies are generated, bosses ignore this +ENEMY_ATTACK_FLAG = $8e ; whether or not enemies will fire at player, also whether or not random enemies are generated, bosses ignore this value PLAYER_STATE = $90 ; #$00 falling into level (only run once to init fall), #$01 normal state, #$02 when dead, #$03 can't move ; $91 is for p2, if p2 not playing, set to #$00 INDOOR_TRANSITION_X_ACCUM = $92 ; a variable to store INDOOR_TRANSITION_X_FRACT_VEL being added to itself to account for overflow before adding to player x velocity when moving between screens on indoor/base levels + ; $93 is for p2 PLAYER_JUMP_COEFFICIENT = $94 ; related to jump height (used by speed runners to jump higher) (https://www.youtube.com/watch?v=K7MjxHvWof8 and https://www.youtube.com/watch?v=yrnW9yQXa9I) ; used to keep track of fractional y velocity on vertical levels for overflowing fractional velocity. It isn't cleared between jumps ; also used when walking into screen for indoor screen changes to keep track of overflow of animation y fractional velocity @@ -153,13 +154,15 @@ EDGE_FALL_CODE = $a4 ; similar to PLAYER_JUMP_STATUS. Used to i ; if bit 6 is set, then walking left off edge ; if bit 5 is set, then walking right off ledge ; can change if change direction during fall, bit 0 always set when EDGE_FALL_CODE non-zero + ; $a5 is for player 2 PLAYER_ANIMATION_FRAME_INDEX = $a6 ; which frame of the player animation. Depends on player state. For example, if player is running, this cycles from #$00 to #$05 + ; $a7 is for player 2 PLAYER_INDOOR_ANIM_Y = $a8 ; the y position the player was at when they started walking into screen after clearing an indoor level. I believe it's always #$a8 since y pos is hard-coded for indoor levels ; $a9 is player 2 P1_CURRENT_WEAPON = $aa ; low nibble is what weapon P1 has, high nibble 1 is rapid fire flag, commonly abbreviated MFSL ; #$00 - Regular, #$01 - Machine Gun, #$02 - Flame Thrower, #$03 - Spray, #$04 - Laser, bit 4 set for rapid fire P2_CURRENT_WEAPON = $ab ; byte 0 is what weapon P2 has, byte 1 is rapid fire flag -PLAYER_M_WEAPON_FIRE_TIME = $ac ; used when holding down the B button wit the m weapon. High nibble is number of bullets generated (up to #$06), low nibble is counter before next bullet is generated (up to #$07) +PLAYER_M_WEAPON_FIRE_TIME = $ac ; used when holding down the B button with the m weapon. High nibble is number of bullets generated (up to #$06), low nibble is counter before next bullet is generated (up to #$07) ; $ad is for player 2 NEW_LIFE_INVINCIBILITY_TIMER = $ae ; timer for invincibility after dying ; $af is for player 2 @@ -172,69 +175,80 @@ PLAYER_WATER_STATE = $b2 ; bit 1 - horizontal sprite flip flag ; bit 7 - player is walking out of water ; $b3 is for player 2 PLAYER_DEATH_FLAG = $b4 ; bit 0 specifies whether player has died, bit 1 specifies player was facing left when hit, used so player dies lying in appropriate direction + ; $b5 is for player 2 PLAYER_ON_ENEMY = $b6 ; whether or not the player is on top of another enemy (#$14 - mining cart, #$15 - stationary mining cart, #$10 - floating rock platform) ; $b7 is for player 2 PLAYER_FALL_X_FREEZE = $b8 ; used to prevent changing X velocity shortly after walking off/falling through ledge, set to Y post of ledge + #$14 + ; $b9 is for player 2 PLAYER_HIDDEN = $ba ; #$00 player visible, #$01/#$ff player invisible (any non-zero). I believe it is meant to track distance off screen the player is ; $bb is for player 2 PLAYER_SPRITE_SEQUENCE = $bc ; which animation to show for the player ; outdoor - #$00 standing (no animation), #$01 gun pointing up, #$02 crouching, #$03 walking or curled jump animation, #$04 dead animation ; indoor - (see indoor_player_sprite_tbl), #$00 standing facing back wall, #$01 electrocuted, #$02 crouching, #$03 walking left/right animation, #$05 walking into screen (advancing), #$06 dead animation + ; $bd is for player 2 PLAYER_INDOOR_ANIM_X = $be ; the x position the player was at when they started walking into screen after clearing an indoor level ; $bf is player 2 PLAYER_AIM_PREV_FRAME = $c0 ; backup of PLAYER_AIM_DIR + ; $c1 is for player 2 PLAYER_AIM_DIR = $c2 ; which direction the player is aiming [#$00-#$0a] depends on level and jump status (00 up facing right, 1 up-right, 2 right, 3 right-down, 4 crouching facing right, 5 crouching facing left, etc) ; there are #$02 up and #$02 down values depending on facing direction ; $c3 is for player 2 -PLAYER_Y_FRACT_VELOCITY = $c4 ; the low byte of the change in vertical position velocity for a player positive pulls down, negative pulls up +PLAYER_Y_FRACT_VELOCITY = $c4 ; the fractional portion of the player's y velocity ; $c5 is for player 2 -PLAYER_Y_FAST_VELOCITY = $c6 ; the change in vertical position velocity for a player positive pulls down, negative pulls up +PLAYER_Y_FAST_VELOCITY = $c6 ; the integer portion of the player's y velocity. Positive pulls down, negative pulls up ; $c7 is for player 2 ELECTROCUTED_TIMER = $c8 ; timer for player being electrocuted, used to freeze player and modify look after touching electricity + ; $c9 is for player 2 INDOOR_PLAYER_JUMP_FLAG = $ca ; used when entering new screen to tell the engine to cause the player to jump ; $cb is player 2 PLAYER_WATER_TIMER = $cc ; timer used for getting into and out of water + ; $cd is for player 2 PLAYER_RECOIL_TIMER = $ce ; how many frames to be pushed back/down from recoil ; $cf is for player 2 INDOOR_PLAYER_ADV_FLAG = $d0 ; whether or not the player is walking into screen when advancing between screens on indoor levels, used for animating player ; $d1 is for player 2 PLAYER_SPECIAL_SPRITE_TIMER = $d2 ; used to track animation for player death animation - ; outdoor is a timer that increments once player hit, ever #$08 frames updates to next animation frame until #$04 + ; outdoor is a timer that increments once player hit, every #$08 frames updates to next animation frame until #$04 ; also used to track jumping curl animation (loops from #$00-#$04) + ; $d3 is for player 2 PLAYER_FAST_X_VEL_BOOST = $d4 ; the x fast velocity boost from landing on a non-dangerous enemy, e.g. moving cart or floating rock in vertical level + ; $d5 is for player 2 PLAYER_SPRITE_CODE = $d6 ; sprite code of the player ; $d7 is for player 2 PLAYER_SPRITE_FLIP = $d8 ; stores player sprite horizontal (bit 6) and vertical (bit 7) flip flags before saving into SPRITE_ATTR, other bits are used ; bit 3 specifies whether the PLAYER_ANIMATION_FRAME_INDEX is even or odd (see @check_anim_frame_and_collision) + ; $d9 is for player 2 PLAYER_BG_FLAG_EDGE_DETECT = $da ; bit 7 specifies the player's sprite attribute for background priority, allows player to walk behind opaque background (OAM byte 2 bit 5) ; 0 (clear) sprite in foreground, 1 (set) sprite is background ; bit 0 allows the player to keep walking horizontally off a ledge without falling + ; $db is for player 2 PLAYER_GAME_OVER_BIT_FIELD = $df ; combination of both players game over status ; #$00 = p1 not game over, p2 game over (or not playing), #$01 = p1 game over, p2 not game over, #$02 = p1 nor p2 are in game over SOUND_TABLE_PTR = $ec ; low byte of address pointing of index into sound_table_00 offset INIT_SOUND_CODE -CONTROLLER_STATE = $f1 ; stores the currently-pressed buttons for the player 1 - ; $f2 stores the currently-pressed buttons for the player 2 +CONTROLLER_STATE = $f1 ; stores the currently-pressed buttons for player 1 ; bit 7 - A, bit 6 - B, bit 5 - select, bit 4 - start ; bit 3 - up, bit 2 - down, bit 1 - left, bit 0 - right + ; $f2 stores the currently-pressed buttons for player 2 CONTROLLER_STATE_DIFF = $f5 ; stores the difference between the controller input between reads. Useful for events that should only trigger on first button press ; $f6 is for player 2 CTRL_KNOWN_GOOD = $f9 ; used in input-reading code to know the last known valid read of controller input (similar to CONTROLLER_STATE) + ; $fa is for player 2 VERTICAL_SCROLL = $fc ; the number of pixels to vertically scroll down ; (y component of PPUSCROLL) (see level_vert_scroll_and_song for initial values) ; horizontal levels are always #$e0 (224 pixels or 28 tiles down), indoor/base are always #$e8 (232 or 29 tiles down) ; waterfall level (vertical level) starts at #$00 and decrements as players move up screen (wrapping) -HORIZONTAL_SCROLL = $fd ; the horizontal scroll component of the PPUSCROLL, [#$0 - #$ff] +HORIZONTAL_SCROLL = $fd ; the horizontal scroll component of the PPUSCROLL, [#$00 - #$ff] PPUMASK_SETTINGS = $fe ; used to store value of PPUMASK before writing to PPU PPUCTRL_SETTINGS = $ff ; used to set PPUCTRL value for next frame SOUND_CMD_LENGTH = $0100 ; how many video frames the sound count should last for, i.e. the time to wait before reading next sound command - ; #$05 bytes, one for each sound slot + ; #$06 bytes, one for each sound slot SOUND_CODE = $0106 ; the sound code for the sound slot, #$06 slots SOUND_PULSE_LENGTH = $010c ; APU_PULSE_LENGTH, #$06 slots SOUND_CMD_LOW_ADDR = $0112 ; low byte of address to current sound command in sound_xx data. #$06 slots, one per sound slot SOUND_CMD_HIGH_ADDR = $0118 ; high byte of address to current sound command in sound_xx data. #$06 slots, one per sound slot SOUND_VOL_ENV = $011e ; either an offset into pulse_volume_ptr_tbl (c.f. LVL_PULSE_VOL_INDEX) which specifies the volume for the frame - ; or a specific volume to use. when bit 7 is set, then the volume will auto decrescendo + ; or a specific volume to use. When bit 7 is set, then the volume will auto decrescendo SOUND_CURRENT_SLOT = $0120 ; the current sound slot [#$00-#$05] PERCUSSION_INDEX_BACKUP = $0121 ; backup location for percussion_tbl index to restore after call to play_sound INIT_SOUND_CODE = $0122 ; the sound code to load; sound codes greater than #$5a are dmc sounds @@ -256,13 +270,13 @@ PAUSE_STATE_01 = $012f ; whether or not the game is paused, used fo DECRESCENDO_END_PAUSE = $0130 ; number of video frames before end of sound command in which the decrescendo will resume ; $0131 is for pulse channel 2 SOUND_PITCH_ADJ = $0132 ; the amount added to the sound byte low nibble before loading the correct note_period_tbl values -UNKNOWN_SOUND_00 = $0136 +UNKNOWN_SOUND_00 = $0136 ; amount to multiply to SOUND_CMD_LENGTH,x when calculating DECRESCENDO_END_PAUSE,x UNKNOWN_SOUND_01 = $013c ; used to adjust volume amount when setting volume SOUND_CFG_LOW = $0142 ; the value to merge with the high nibble before storing in apu channel config register SOUND_TRIANGLE_CFG = $0144 ; in memory value for APU_TRIANGLE_CONFIG SOUND_REPEAT_COUNT = $0148 ; used for #$fe sound commands to specify how many times to repeat a shared sound part, e.g. .byte $fe, $03, .addr sound_xx_part to loop 3 times. #$06 slots SOUND_CFG_HIGH = $014e ; the value to merge with the volume when saving the pulse config -SOUND_LENGTH_MULTIPLIER = $0154 ; value used when determining how many video frames to wait before reading next sound command, #$05 bytes, one for each sound slot +SOUND_LENGTH_MULTIPLIER = $0154 ; value used when determining how many video frames to wait before reading next sound command, #$06 bytes, one for each sound slot ; ultimately used when calculating SOUND_CMD_LENGTH, and kept around between sound commands so subsequent notes can be the same length ; for low sound codes, SOUND_LENGTH_MULTIPLIER is set to SOUND_CMD_LENGTH directly with no multiplication (see @high_nibble_not_1) SOUND_PERIOD_ROTATE = $015a ; when not #$04, the number of times to shift the high byte of note_period_tbl into the low byte @@ -289,7 +303,7 @@ LEVEL_END_LVL_ROUTINE_STATE = $0192 ; used by level end routines (end_of_lvl_rou LEVEL_END_PLAYERS_ALIVE = $0194 ; the number of players alive at the end of the level, used to know if should play level end music SOLDIER_GEN_SCREEN = $0195 ; the current screen that soldiers are being generated for SCREEN_GEN_SOLDIERS = $0196 ; the total number of soldiers that have been generated for the current screen (exe_soldier_generation) -OAMDMA_CPU_BUFFER = $0200 ; $0200-$02ff OAMDMA (sprite) read data, read once per frame, populated by load_sprite_to_cpu_mem, draw_hud_sprites, or draw_player_hud_sprites +OAMDMA_CPU_BUFFER = $0200 ; $0200-$02ff OAMDMA (sprite) read data, read once per frame, populated by load_sprite_to_CPU_mem, draw_hud_sprites, or draw_player_hud_sprites CPU_SPRITE_BUFFER = $0300 ; sprites on screen, each byte is an entry into sprite_ptr_tbl [$0300-$0387], memory is segmented as defined below PLAYER_SPRITES = $0300 ; player sprites, p1 and p2 sprite, then player bullets, each byte is an entry into sprite_ptr_tbl (#$0a bytes) @@ -315,15 +329,15 @@ PLAYER_BULLET_SPRITE_CODE = $0368 ; The sprite codes to load for the bullet, PLAYER_BULLET_SPRITE_ATTR = $0378 ; The sprite attributes for the bullet (see SPRITE_ATTR for specification) ; used for L bullets for flipping the angled sprites depending on direction PLAYER_BULLET_SLOT = $0388 ; #$00 when no bullet, otherwise stores bullet type + 1, i.e. #$01 basic, #$02 M, #$03 F bullet, #$04 S, #$05 L, can be negative sometimes -PLAYER_BULLET_VEL_Y_ACCUM = $0398 ; an accumulator to keep track of PLAYER_BULLET_X_VEL_FRACT being added to itself have elapsed before adding 1 to PLAYER_BULLET_X_POS -PLAYER_BULLET_VEL_X_ACCUM = $03a8 ; an accumulator to keep track of PLAYER_BULLET_Y_VEL_FRACT being added to itself have elapsed before adding 1 to PLAYER_BULLET_Y_POS +PLAYER_BULLET_VEL_Y_ACCUM = $0398 ; an accumulator to keep track of PLAYER_BULLET_Y_VEL_FRACT being added to itself have elapsed before adding 1 to PLAYER_BULLET_Y_POS +PLAYER_BULLET_VEL_X_ACCUM = $03a8 ; an accumulator to keep track of PLAYER_BULLET_X_VEL_FRACT being added to itself have elapsed before adding 1 to PLAYER_BULLET_X_POS PLAYER_BULLET_Y_POS = $03b8 ; the bullet's sprite y position PLAYER_BULLET_X_POS = $03c8 ; the bullet's sprite x position ; for F bullets, PLAYER_BULLET_FS_X and PLAYER_BULLET_X_POS together determine x position -PLAYER_BULLET_Y_VEL_FRACT = $03d8 ; percentage out of 0-255 set number of frames until Y position is incremented by and additional 1 unit -PLAYER_BULLET_X_VEL_FRACT = $03e8 ; percentage out of 0-255 set number of frames until X position is incremented by and additional 1 unit -PLAYER_BULLET_Y_VEL_FAST = $03f8 ; player bullet velocity y high byte -PLAYER_BULLET_VEL_X_FAST = $0408 ; player bullet velocity x high byte +PLAYER_BULLET_Y_VEL_FRACT = $03d8 ; percentage out of 0-255 set number of frames until Y position is incremented by an additional 1 unit +PLAYER_BULLET_X_VEL_FRACT = $03e8 ; percentage out of 0-255 set number of frames until X position is incremented by an additional 1 unit +PLAYER_BULLET_Y_VEL_FAST = $03f8 ; player bullet velocity y integer portion +PLAYER_BULLET_VEL_X_FAST = $0408 ; player bullet velocity x integer portion PLAYER_BULLET_TIMER = $0418 ; 'timer' starts at #$00. Used by F, S (indoor only) and L ; for indoor S, used to specify size of bullet ; For F, used to set x and y pos when traveling to create swirl (see f_bullet_outdoor_x_swirl_amt_tbl, and f_bullet_outdoor_y_swirl_amt_tbl) @@ -344,7 +358,7 @@ PLAYER_BULLET_F_Y = $0488 ; Specifies center y position on screen f b PLAYER_BULLET_S_RAPID = $0488 ; (same address as previous) for S weapon in indoor levels, specifies whether weapon is rapid fire or not, not sure why $09 wasn't used like other bullet routines PLAYER_BULLET_VEL_FS_X_ACCUM = $0498 ; (for F weapon only) an accumulator to keep track of PLAYER_BULLET_X_VEL_FRACT being added to itself have elapsed before adding 1 to PLAYER_BULLET_X_POS PLAYER_BULLET_VEL_F_Y_ACCUM = $04a8 ; (for F weapon only) an accumulator to keep track of PLAYER_BULLET_Y_VEL_FRACT being added to itself have elapsed before adding 1 to PLAYER_BULLET_Y_POS -PLAYER_BULLET_S_BULLET_NUM = $04a8 ; (same address as previous) for S weapon only, specifies the number the bullet it in the current 'spray' for the shot +PLAYER_BULLET_S_BULLET_NUM = $04a8 ; (same address as previous) for S weapon only, specifies the number the bullet in the current 'spray' for the shot ; per shot of S weapon, #$05 bullets are generated. If no other bullets exist then ; $04a8 would have #$00, $04a9 would have #$01, $04a9 would have #$02, etc. @@ -365,17 +379,17 @@ ENEMY_Y_VELOCITY_FRACT = $04f8 ; percentage out of 0-255 of a unit to add, e.g. ENEMY_X_VELOCITY_FAST = $0508 ; the number of units to add to ENEMY_X_POS every frame ENEMY_X_VELOCITY_FRACT = $0518 ; percentage out of 0-255 of a unit to add, e.g. if #$80 (#$80/#$ff = 50%), then every other frame will cause X pos to increment by 1 -ENEMY_TYPE = $0528 ; a list of current enemy types for the level, used when executing the enemy routines for the level -ENEMY_ANIMATION_DELAY = $0538 ; the delay before the enemy starts moving +ENEMY_TYPE = $0528 ; enemy type, e.g. #$03 = flying capsule +ENEMY_ANIMATION_DELAY = $0538 ; used for various delays by enemy logic ENEMY_VAR_A = $0548 ; the sound code to play when enemy hit by player bullet, also used for other logic ; dragon arm orb uses it for adjusting enemy position, fire beam uses it for animation delay ENEMY_ATTACK_DELAY = $0558 ; the delay before an enemy attacks, for weapon items and grenades this is used for helping calculate falling arc trajectory instead of enemy delay -ENEMY_VAR_B = $0558 ; for weapon items and grenades this is used for helping calculate falling arc trajectory instead of enemy delay -ENEMY_FRAME = $0568 ; a list of numbers which each represent which animation frame the enemy is in, for example offset into soldier_sprite_codes -ENEMY_SCORE_COLLISION = $0588 ; a list of bytes, each byte represents 3 things for an enemy +ENEMY_VAR_B = $0558 ; for weapon items and grenades this is used for helping calculate falling arc trajectory +ENEMY_FRAME = $0568 ; animation frame the enemy is in, typically indexes into an enemy type-specific table of sprite codes +ENEMY_SCORE_COLLISION = $0588 ; represents 3 things for an enemy ; SSSS CCCC - score code (see `score_codes_tbl`), and collision type (entry in collision_box_codes_XX) ; also explosion type -ENEMY_HP = $0578 ; a list of enemy hp for each enemy in ENEMY_TYPE +ENEMY_HP = $0578 ; the HP of the enemy ENEMY_STATE_WIDTH = $0598 ; loaded from enemy_prop_ptr_tbl ; bit 7 set to allow bullets to travel through enemy, e.g. weapon item ; bit 6 specifies whether player can land on enemy (floating rock and moving cart), bit 4 also has to be 0 (see `beq @land_on_enemy`) @@ -384,13 +398,13 @@ ENEMY_STATE_WIDTH = $0598 ; loaded from enemy_prop_ptr_tbl ; bit 2 for bullets specifies whether to play sound on collision ; bit 1 specifies whether to play explosion noise; also specifies width of enemy ; bit 0 - #$00 test player-enemy collision, #$01 means to skip player-enemy collision test -ENEMY_ATTRIBUTES = $05a8 ; a list of enemy attributes that define how an enemy behaves and/or looks [$05a8 to 05b7] +ENEMY_ATTRIBUTES = $05a8 ; enemy type-specific attributes that define how an enemy behaves and/or looks ENEMY_VAR_1 = $05b8 ; a byte available to each enemy for whatever they want to use it for (#$f bytes, 1 per enemy) ENEMY_VAR_2 = $05c8 ; a byte available to each enemy for whatever they want to use it for (#$f bytes, 1 per enemy) ENEMY_VAR_3 = $05d8 ; a byte available to each enemy for whatever they want to use it for (#$f bytes, 1 per enemy) ENEMY_VAR_4 = $05e8 ; a byte available to each enemy for whatever they want to use it for (#$f bytes, 1 per enemy) -LEVEL_SCREEN_SUPERTILES = $0600 ; cpu memory address where super tiles indexes for the screens of the level are loaded (level_X_supertiles_screen_XX data) - ; 2 screens are stored in the cpu buffer. The second screen loaded at $0640. Indexes are into level_x_supertile_data +LEVEL_SCREEN_SUPERTILES = $0600 ; CPU memory address where super tiles indexes for the screens of the level are loaded (level_X_supertiles_screen_XX data) + ; 2 screens are stored in the CPU buffer. The second screen loaded at $0640. Indexes are into level_x_supertile_data ; This data specifies the super-tiles (indexes) to load for the screens BG_COLLISION_DATA = $0680 ; map of collision types for each of the super-tiles for both nametables, each 2 bits encode 1/4 of a super-tile's collision information ; first 8 nibbles are a row of the top of super-tile, the next 8 are the middle middle. Not used on base (indoor) levels @@ -410,7 +424,7 @@ CPU_GRAPHICS_BUFFER = $0700 ; used to store data that will be then moved to ; the block of text is ended with a #$ff, if the byte after #$ff is the vram_address_increment offset ; then the the process continues, i.e. read #$02 PPU address bytes, read next text -PALETTE_CPU_BUFFER = $07c0 ; [$07c0-$07df] the cpu memory address of the palettes eventually loaded into the PPU $3f00 to $3f1f +PALETTE_CPU_BUFFER = $07c0 ; [$07c0-$07df] the CPU memory address of the palettes eventually loaded into the PPU $3f00 to $3f1f HIGH_SCORE_LOW = $07e0 ; the low byte of the high score score HIGH_SCORE_HIGH = $07e1 ; the high byte of the high score score