| Mega Man 3's cartridge ROM, counted by part of the game: each stretch of code or data goes to the part the disassembly's labels and comments say it serves, and the value sums the bytes of each part. | Makefile | Code notes |
A fresh A press on the ground without Down sets Mega Man's upward speed to $04.$E5, 4.89 px/frame, and runs the airborne state at once. | src/fixed/player_ground.asm L59–78 | Code |
Mega Man 3 raises the take-off speed from Mega Man 2's $04.$DF (4.87 px/frame) to $04.$E5 (4.89) and keeps gravity at $40, but caps a fall at 7 px/frame ($F9) where Mega Man 2 allows 12 ($F4). | src/fixed/player_ground.asm L74–77src/fixed/game_loop.asm L648–649src/fixed/movement.asm L393–402 | Code |
On every rising frame without A held, Mega Man 3 sets the vertical speed to $FF.$C0, 0.25 px/frame downward, whatever the speed was, before the frame's move. Mega Man 2 only lowers a rise of 2 px/frame or more to 1, after the move. | src/fixed/player_ground.asm L260–267src/fixed/movement.asm L424–428src/fixed/player_ground.asm L272–277 | Code |
Mega Man 3 drops Mega Man 2's slow step speed but keeps a pause. Before each frame's state runs, the prelude sets the speed to $01.$4C (1.30 px/frame) unless he is sliding. From standing, a held direction moves him by it at once and starts the turning animation ($0D); while that animation is on its first frame the ground state doesn't move him, and once it advances he walks at the same 1.30. In the air a held direction moves him at 1.30 on every frame. | src/fixed/game_loop.asm L636–645src/fixed/player_ground.asm L115–128src/fixed/player_ground.asm L94–102src/fixed/sprites.asm L210–217src/fixed/player_ground.asm L360–364src/fixed/movement.asm L259–265 | Code |
Down and a fresh A press on the ground start a slide if no wall is ahead: 2 px lower, at 2.5 px/frame ($02.$80), with a timer of 20 ($14). The set-up frame moves once, and each slide frame moves before it tests the timer, so an unbroken slide moves on 21 frames. A turn, a wall, the timer's end, or (from the 9th frame) a fresh A press all lead to the standing test, where a solid tile at standing height keeps the slide going; otherwise it ends, with a jump at walking speed if A was pressed. | src/fixed/player_states.asm L286–299src/fixed/player_states.asm L318src/fixed/player_states.asm L344–366src/fixed/player_states.asm L328–334src/fixed/player_states.asm L367–390 | Verified |
A hit (state $06) sets Mega Man's vertical speed to the resting $FF.$C0 on its first frame, then each frame applies gravity and pushes him against his facing at 0.5 px/frame ($00.$80) until the hurt animation's state reaches 9; a hit during a slide doesn't push him. | src/fixed/player_states.asm L750–753src/fixed/player_states.asm L776–790src/fixed/player_states.asm L806–808 | Code |
Mega Man 3 starts the invincibility after the knockback: when the hurt state ends it sets invincibility_timer to 60 ($3C), which the prelude counts down every frame. Mega Man 2 sets 111 at the moment of the hit. | src/fixed/player_states.asm L828–830src/fixed/game_loop.asm L657–659src/fixed/collision.asm L141–142 | Code |
Mega Man 3 moves weapon costs into two tables indexed by weapon: weapon_cost, the units taken, and weapon_framerate, how many uses (or frames, for Rush Marine and Rush Jet) each take costs, counted on one shared counter. Needle Cannon costs 1 unit per 4 shots and Gemini Laser 2 per shot. Mega Man 2 writes the costs into the weapons' own routines, as its Air Shooter, Crash Bomber, and Metal Blade code shows. | src/fixed/player_warp.asm L254–268src/fixed/player_warp.asm L289–296include/constants.inc L64–75 | Code |
Mega Man 3 indexes each weapon's 256-byte damage table by the target's main routine id, one table for regular enemies and bosses alike, where Mega Man 2 gives each weapon a separate 14-entry boss table. In the Spark Shock table the entry for routine id $C1 is 7, and $58 marks targets the shock freezes instead of damaging. That $C1 is Magnet Man is the disassembly's labeling, not checked here. | src/bank1C_1D_entity_ai.asm L290–299src/bank1C_1D_entity_ai.asm L562–565src/bank0A_damage_tables.asm L424–425src/bank0A_damage_tables.asm L451src/bank1C_1D_entity_ai.asm L301–307 | Code |
Landing on Rush Coil launches Mega Man at $06.$EE, 6.93 px/frame, once per bounce, and sets force_full_jump, so releasing A doesn't cut that rise. | src/fixed/player_ground.asm L32–38src/fixed/player_ground.asm L260–263 | Code |
Mega Man 3 moves Mega Man vertically before horizontally. Every frame on the ground or in the air first runs the airborne routine: a rise without A held is cut (release-cut), then move_vertical_gravity moves him by his vertical speed, takes gravity from it, and tests the floor under a fall or the ceiling over a rise. Only then does the frame's horizontal move run: the air move if he is still airborne, the ground state's move if he stood on a floor. | src/fixed/player_ground.asm L4–7src/fixed/player_ground.asm L260–278src/fixed/player_ground.asm L343–364src/fixed/movement.asm L176–223 | Code |
Gravity takes $40/256 = 0.25 px/frame from Mega Man's upward speed every frame out of water, after the frame's vertical move. | src/fixed/game_loop.asm L648–649src/fixed/movement.asm L393–399 | Code |
A fall is capped at 7 px/frame: when gravity takes the speed's whole byte below $F9, apply_gravity sets it to $F9.$00. | src/fixed/movement.asm L400–409 | Code |
| Mega Man's position is his center. A fall tests the floor at x − 7, x, and x + 7, 12 px below it, and a rise tests the ceiling at x − 7 and x + 7, 12 px above it; a horizontal move tests x + 8 or x − 8 at 11 px above, level with, and 11 px below the center. Each point reads the 16 px tile holding it. | src/fixed/collision.asm L491–499src/fixed/collision.asm L525–532src/fixed/collision.asm L64–77src/fixed/player_ground.asm L153–159src/fixed/movement.asm L208 | Code |
When a fall's floor points find a solid tile, snap_y_to_floor subtracts (Y + 12) mod 16 from Mega Man's Y pixel, which puts his feet on the tile's top, and leaves the Y fraction as it was; his vertical speed becomes the resting $FF.$C0, 0.25 px/frame down. Every grounded frame repeats the fall, so standing still his Y pixel holds while the fraction steps by $40 each frame: in Top Man's stage start in Mesen it cycles through $00, $40, $80, and $C0. | src/fixed/collision.asm L626–634src/fixed/movement.asm L203–206src/fixed/movement.asm L424–428 | Verified |
| A grounded frame tests the floor before it moves Mega Man: if no floor point under his last position is solid, he falls 0.25 px, takes the jumping animation and the airborne state, and that frame's horizontal move is the air move, 1.30 px/frame toward a held direction or none. No grace period follows: only the ground state reads a jump press, and it runs only on frames that found a floor. | src/fixed/player_ground.asm L4–7src/fixed/player_ground.asm L343–364src/fixed/player_ground.asm L59–61 | Code |
| When a horizontal move puts a wall point in a solid tile, the move routine pushes Mega Man back by the point's depth into the tile, so x + 8 ends on the wall's first column moving right and x − 8 on the first column past it moving left. The X fraction stays as it was, and his speed and state are untouched, so he walks in place against the wall. | src/fixed/movement.asm L45–53src/fixed/collision.asm L565–571src/fixed/collision.asm L585–590 | Code |
When a rise puts a ceiling point, x − 7 or x + 7 at 12 px above his center, in a solid tile, snap_y_to_ceil adds 16 − ((Y − 12) mod 16) to Mega Man's Y pixel, which puts that point on the row under the tile, keeps the Y fraction, and sets the resting speed, 0.25 px/frame down; he stays airborne. Since a jump runs the airborne routine on its press frame, a ceiling within the first frame's 4.89 px is met on that frame. | src/fixed/movement.asm L222–231src/fixed/collision.asm L604–609src/fixed/player_ground.asm L71–78 | Code |
The turning animation, $0D, has 2 frames of 6 ticks each: its sequence's count byte is 1 and its tick byte 5, and the sprite engine advances a frame when the tick that started equal to the tick byte ends. While it shows its first frame the ground state doesn't move Mega Man. | src/bank1A_1B_oam_sequences.asm L199src/fixed/sprites.asm L201–217src/fixed/player_ground.asm L94–102 | Code |
| On the ground Mega Man 3 picks the move from his animation. Standing, a held direction faces him that way, starts the turning animation, and moves him 1.30 px; on the turning animation's first frame he doesn't move; once it reaches its second, a held direction starts the walking animation and moves him, and nothing held stands him. Walking, a direction matching his facing moves him; anything else, letting go or the other direction, starts the turning animation and moves him once more toward his facing. Down alone does nothing on open ground. | src/fixed/player_ground.asm L89–102src/fixed/player_ground.asm L105–121src/fixed/player_ground.asm L125–141src/fixed/player_ground.asm L163–168 | Code |
| Measured in Mesen from a standstill in Top Man's stage start, Right held moves Mega Man 1.30 px on its first frame, not at all on the next 5, and 1.30 px on every frame after; let go after a walk, he moves 1.30 px on one more frame and then stands. | src/fixed/player_ground.asm L115–121src/bank1A_1B_oam_sequences.asm L199 | Verified |
| A jump lifts Mega Man on its press frame: the ground state sets the jump speed and runs the airborne routine at once, which moves him 4.89 px up from where that frame's floor test left him (the test takes him 0.25 px down, or, when that crosses into the next pixel and the snap puts his feet back on the floor, 0.75 px up), takes gravity, and gives the frame the air move, 1.30 px/frame toward a held direction or none, in place of the ground move. A press in a walking pause still jumps, since the press is read before the walk. | src/fixed/player_ground.asm L59–65src/fixed/player_ground.asm L71–78 | Verified |
| A landing frame moves Mega Man only vertically: the airborne routine snaps him onto the floor, sets the ground state and the turning animation already on its second frame, and returns before the air move. From the next frame he walks at once if a direction is held, with no pause. An A press on the landing frame is lost, since the airborne state reads no presses. | src/fixed/player_ground.asm L322–339 | Verified |
| Starting a slide, Mega Man 3 first tests for a wall 8 and 22 px ahead of his center at its height, and a wall there cancels the press. A slide lowers him 2 px, tests the floor at x − 15, x, and x + 15, 10 px below his lowered center, and moves with a wall point 16 px ahead, at 5 px above and 7 px below that center. A turn, a wall, the timer's end, or a jump press leads to the standing test, the ceiling points 12 px over his lowered center. | src/fixed/player_states.asm L269–282src/fixed/collision.asm L491–501src/fixed/collision.asm L525–533src/fixed/player_states.asm L324–343src/fixed/player_states.asm L361–365 | Code |
| A slide that ends on open ground leaves Mega Man in the ground state with the walking animation, still 2 px low; the next frame's floor test pushes him back up. That walking animation moves him on the next frame toward his facing, so with no direction held he steps once more at 1.30 px/frame and then pauses, and with one held he walks on at once. A slide whose floor test finds nothing ends without moving that frame, and he falls from the next. | src/fixed/player_states.asm L366–384src/fixed/player_states.asm L324–327 | Verified |
| Mega Man 3's ordinary-floor movement differs from Mega Man 2's from the first frame of a walk: Right held from a standstill moves him 1.30 px, then nothing for 5 frames, then 1.30 px a frame, where Mega Man 2 moves 0.125 px a frame for 7 frames, then 1.375. A jump differs from its press frame, which lifts him 4.89 px where Mega Man 2 lifts him 0. Letting go of A mid-rise starts the fall at once, where Mega Man 2 cuts a rise of 2 px/frame or more to 1, and falls cap at 7 px/frame instead of 12. He keeps Mega Man 2's gravity, floor and ceiling corners, and 16 px tiles, and adds the slide. | src/fixed/player_ground.asm L115–121src/fixed/game_loop.asm L642–645src/fixed/player_ground.asm L71–78src/fixed/player_ground.asm L260–267src/fixed/movement.asm L393–402 | Code |
Mega Man 4 takes off at exactly 5 px/frame ($05.$00), up from Mega Man 3's $04.$E5, and a release cuts any rise to a speed of 0 where Mega Man 3 sets 0.25 px/frame downward. Both cut on every rising frame without A. | src/fixed/player_ground.asm L74–77src/fixed/movement.asm L424–427 | Code |
Mega Man 4's slide keeps Mega Man 3's 2.5 px/frame but moves on 26 frames (a timer of $1A, counted after each move from the set-up frame on) where Mega Man 3's moves on 21 (a timer of 20). Its A test runs on every slide frame, the set-up's included: a fresh A press without Down jumps out whenever he has headroom, where Mega Man 3 waits for its 9th frame, and A with Down held keeps sliding. The set-up's own press comes with Down, and A held from it into the second frame is no fresh press, so the earliest jump out comes on the slide's 3rd frame. | src/fixed/player_states.asm L288–289src/fixed/player_states.asm L344–348src/fixed/player_states.asm L349–355 | Verified |
Mega Man 4 keeps Mega Man 3's knockback, 0.5 px/frame ($00.$80) against his facing under gravity until the hurt animation reaches 9, with no push when the hit lands during a slide. | src/fixed/player_states.asm L776–786 | Code |
Mega Man 4's movement on ordinary floor differs from Mega Man 3's in five numbers. The first is the jump's take-off speed: 5 px/frame ($05.$00) against Mega Man 3's 4.89 ($04.$E5). The second is the speed on the ground and after a landing: -1 px/frame ($FF.$00) against -0.25 ($FF.$C0). Third, a release cuts a rise to 0, where Mega Man 3 sets the same -0.25. Fourth, the slide timer starts at 26 ($1A) against 20 ($14), so the slide moves on 26 frames against 21 (slide-line, mega-man-3/slide). Fifth, Mega Man 4 tests for the jump out of a slide on every slide frame, where Mega Man 3 skips the test while the timer is 12 ($0C) or more, so the earliest jump out comes on the 3rd frame against the 9th. | src/fixed/player_ground.asm L74–77src/fixed/movement.asm L203–204src/fixed/movement.asm L424–428src/fixed/player_ground.asm L264–267src/fixed/player_states.asm L288–289src/fixed/player_states.asm L349–355 | Code |
Mega Man 3's divide_8bit is Mega Man 2's _divide_mod with its zero-page operands one byte lower ($00-$03 for $01-$04). Its 16-bit division is Mega Man 2's _divide_fraction with its RAM moved and two changes: Mega Man 3 saves and restores X around the loop, and stores the low byte of each successful subtraction back in the remainder ($01), where Mega Man 2 writes it to $09, outside its shift chain. | src/fixed/movement.asm L1269–1363 | Code |
| Doc Robot's Air Man fight in Mega Man 3 uses Air Man's tornado tables from Mega Man 2 byte for byte (155 bytes): the five delays between rounds, then five patterns of six tornadoes each, with their Y and X speeds (whole and fraction) and how long each flies. | src/bank05_doc_robot_b.asm L954–976 | Code |
Mega Man 3's sprite CHR banks $00-$01, mapped at sprite tiles $00-$7F throughout play, start from Mega Man 2's first 128 sprite tiles (the disassembly's megaman_capsule_e_tank_bullet_mega_buster.chr): 84 of the 127 non-blank tiles are the same at the same numbers, the longest run tiles $20-$37 (384 bytes). | src/chr.asm L1–2 | Code |
| The first 32 tiles of 17 of Mega Man 3's sprite CHR banks ($08, $0A, $0C, $0F, $11, $13, $15, $1D, $20, $24, $26, $27, $2A, $2C, $2E, $32, and $3C) are Mega Man 2's sprite tiles $60-$7F, from the same set as Mega Man's own: 29 of the 32 are the same at the same numbers, the longest run tiles $0B-$1F (336 bytes). | src/chr.asm L1–2 | Code |
Mega Man 3's title screen background tiles (CHR banks $76-$77) are largely Mega Man 2's title set (title.chr, loaded at _load_title_chr), moved a few tile numbers: 102 of their 128 non-blank tiles appear in it, 96 different ones, in runs of up to 16 tiles (256 bytes). | src/chr.asm L1–2 | Code |
Mega Man 3's background CHR bank $66, mapped for Wily stage 6, holds 27 of the 31 non-blank tiles of Mega Man 2's third font set (the disassembly's font_3.chr), the longest aligned run 10 tiles (160 bytes). | src/chr.asm L1–2 | Code |
Mega Man 3's sprite CHR bank $3C holds 13 of the 23 non-blank tiles of Mega Man 2's set of Dr. Wily bowing down (the disassembly's dogeza.chr), six of them in a run (96 bytes). | src/chr.asm L1–2 | Code |
| Mega Man 3's sprite CHR bank $22 holds 17 tiles of Mega Man 2's boss sets, 9 from Wood Man's and 8 from Heat Man's, and bank $21 holds 4 of Crash Man's; the longest run is 9 of Wood Man's tiles (144 bytes). | src/chr.asm L1–2 | Code |
Mega Man 3's check_new_enemies is the enemy half of Mega Man 2's _find_objects, instruction for instruction, with new RAM and table addresses: both take the screen's left and right edges, then on the side the screen moves toward spawn each placement that comes into range and on the other side move a second cursor past placements left behind. Mega Man 3 drops Mega Man 2's matching walk over a separate item list and the switch to the stage bank around it. The spawn routine each calls starts the same way, skipping a placement already in a slot and taking a free one, and then differs: Mega Man 2 fills the slot from per-type tables in its fixed bank, and Mega Man 3 skips a placement marked defeated and copies the type's properties from bank 0. | src/bank1A_1B_oam_sequences.asm L1017–1101src/bank1A_1B_oam_sequences.asm L1103–1170 | Code |
| Both games run their sound driver from the NMI, but Mega Man 3's is new code with a new layout. Mega Man 2 keeps the driver and its songs together in bank 12, queues up to 16 tracks, and works out a note's length as a table value times its channel's tempo byte. Mega Man 3 keeps the code in bank 22 and the data in bank 23, reading bank 24 for data addresses from $C000; it takes sound IDs from an eight-entry ring buffer in the fixed bank, and refuses a sound whose priority byte is lower than the one playing. | src/bank16_sound_driver.asm L1–15src/bank16_sound_driver.asm L82–115src/bank16_sound_driver.asm L216–249src/fixed/system.asm L448–478 | Code |
Both games strobe the controllers and merge each port's two data bits, but Mega Man 3's routine is new code. Mega Man 2's _joy reads one pad after the other and leaves the newly pressed buttons to the frame wait that calls it; Mega Man 3's read_controllers reads both pads in one loop, works out the new presses itself, and clears the d-pad when opposite directions are held together. | src/fixed/ppu_utils.asm L124–188 | Code |
| Both games flag a bank switch in progress and catch up on the frame's sound afterward if the NMI arrived during it, but Mega Man 3's switch is new code for a different board: Mega Man 2 maps one 16 KB bank at $8000 by writing its number to MMC1 one bit at a time, and Mega Man 3 writes two 8 KB banks, at $8000 and $A000, to the MMC3 as whole bytes. | src/fixed/system.asm L427–478 | Code |
| Both games' NMI handlers copy the sprites by DMA, write the queued screen and palette updates, set the scroll, and run the sound driver, but Mega Man 3's handler is new code. Mega Man 2's offsets the scroll for the Mecha Dragon and puts the sound off when the NMI interrupts a bank switch; Mega Man 3's also loads the MMC3's scanline counter for the frame's split-screen interrupt and picks the interrupt handler for the screen mode. | src/fixed/nmi.asm L1–134 | Code |
Both games run a stage a frame at a time in step with the NMI, but Mega Man 3's frame loop is new code built on a task scheduler. Mega Man 2's stage loop calls its routines in turn and then spins in _nmi_wait_0e until the NMI sets a flag, reading the pads after it. Mega Man 3 runs up to four tasks, each resumed from its own saved stack pointer; gameplay_frame_loop gives up the CPU for a frame through the scheduler, which reads the controllers only when it resumes task 0. | src/fixed/system.asm L232–300src/fixed/game_loop.asm L252–363 | Code |
Both games move an object each frame by a speed with a fraction and change its Y speed by gravity, but Mega Man 3's movers are new code that Mega Man and the enemies share. Mega Man 2's enemy routine, left undecoded by its disassembly, checks the object's hits, moves it by its Y speed, subtracts gravity from that speed when a flag bit asks for it, moves it by its X speed in the way it faces, and removes it once it leaves the screen; walls and floors are a separate routine, and Mega Man moves with his own code. Mega Man 3's move_vertical_gravity and move_right_collide serve slot 0, the player, and every enemy alike, and run the tile check inside each move, snapping the object to the floor, ceiling, or wall it reaches. | src/fixed/movement.asm L1–60src/fixed/movement.asm L170–239 | Code |
Both games find the 32-pixel block at a point in the screen's layout and then its 16-pixel quarter, but Mega Man 3's tile check is new code with a new type format. Mega Man 2's _tsa_collision tests one point a call and takes its type from the quarter byte's top two bits, which a per-stage table remaps; Mega Man 3's check_tile_collision tests a list of points from a hitbox table in one call, clamps them to the screen, takes each type from the upper four bits of the tile's entry in a table at $BF00 in the stage bank, and ORs the types together. | src/fixed/collision.asm L181–300 | Code |
Both games' stage selects move a cursor over the bosses' portraits and start the chosen stage, but Mega Man 3's is new code. Mega Man 2's _stage_select blanks a beaten boss's portrait by writing empty tiles to the name table, and on a d-pad press calls _stage_select_set to move the cursor; Mega Man 3 keeps the cursor's column and row apart, moves each by a table offset and ignores a move off its 3 by 3 grid, redraws the six sprites of Mega Man's eyes in the center portrait for the cursor's position, and confirms on A as well as Start. | src/bank18_stage_select.asm L990–1100 | Code |
| Mega Man 4's sound bank opens with Mega Man 3's entry jumps, multiply, and sound-data read, at the same addresses; only the two bank numbers the read maps differ: the overflow data bank, $18 in Mega Man 3 and $1D in Mega Man 4, and the data bank it restores, $17 and $1F. | src/bank16_sound_driver.asm L1–115src/bank16_sound_driver.asm L97–115 | Code |
Mega Man 4's per-frame sound tick is Mega Man 3's sound_driver_update, byte for byte at the same address. | src/bank16_sound_driver.asm L117–201 | Code |
| Mega Man 4's routine that starts a song or an effect, and takes the stop, pause, fade, and transpose commands, is Mega Man 3's, byte for byte at the same address. | src/bank16_sound_driver.asm L203–378 | Code |
Mega Man 4's sound effect reader is Mega Man 3's (labeled parse_music_data there), byte for byte at the same address. | src/bank16_sound_driver.asm L380–543 | Code |
Mega Man 4's music track reader is Mega Man 3's (labeled process_sfx_channel there), byte for byte at the same address, so the two games read the same track format. | src/bank16_sound_driver.asm L545–831 | Code |
| Mega Man 4's note-to-pitch routines are Mega Man 3's, byte for byte at the same address. | src/bank16_sound_driver.asm L833–940 | Code |
| Mega Man 4's volume envelope and fade code is Mega Man 3's, byte for byte at the same address. | src/bank16_sound_driver.asm L942–1133 | Code |
| Mega Man 4's code that writes each channel's pitch to the APU, with vibrato, detune, and slides, is Mega Man 3's, byte for byte at the same address. | src/bank16_sound_driver.asm L1134–1246 | Code |
| Mega Man 4's sound driver tables, through the note period table, are Mega Man 3's at the same addresses; the 37 bytes after it ($8A1B-$8A3F), all zero in Mega Man 3, hold data in Mega Man 4. | src/bank16_sound_driver.asm L1248–1290 | Code |
Mega Man 4's controller read, which works out the new presses and cancels opposite directions, is Mega Man 3's read_controllers, byte for byte. | src/fixed/ppu_utils.asm L124–188 | Code |
Mega Man 4's routine that fills a name table and its attributes with one value is Mega Man 3's fill_nametable, byte for byte. | src/fixed/ppu_utils.asm L190–246 | Code |
Mega Man 4's name table buffer flush is Mega Man 3's drain_ppu_buffer, byte for byte (37 bytes). Mega Man 4 follows it with four short routines: two that change PPUCTRL and two that turn rendering off and on. | src/fixed/ppu_utils.asm L1–45 | Code |
Mega Man 4's cooperative task scheduler, with its routines to start, kill, and yield tasks, is Mega Man 3's task_scheduler instruction for instruction; it sits 5 bytes lower, and only its jump and call addresses differ. | src/fixed/system.asm L232–378 | Code |
Mega Man 4's enemy spawn engine is Mega Man 3's check_new_enemies instruction for instruction, moved from bank 26 at $9C00 to bank 56 at $8000; only the addresses of the stage's placement tables and one zero-page variable ($2E in Mega Man 3, $2F in Mega Man 4) differ. | src/bank1A_1B_oam_sequences.asm L1017–1101 | Code |
Mega Man 4's first boss door routine follows Mega Man 3's close_boss_door step for step: the door sound, then four 16x16 blocks of tiles and attributes through the same buffer, one every 4 frames. Mega Man 4 runs it from the fixed bank, with the stage's bank mapped at $A000, and reads the door's addresses and tiles from fixed places in that bank ($B570-$B57B), where Mega Man 3 indexes tables in its door bank by the door's number. | src/bank10_boss_doors.asm L1–180 | Code |
Mega Man 4's second boss door routine follows Mega Man 3's open_boss_door the same way, with the same changes: it runs from the fixed bank and reads its door's data from $B57C-$B587 in the stage's bank. | src/bank10_boss_doors.asm L234–329 | Code |
Mega Man 4's four routines that push an entity out of a wall, ceiling, or floor after a tile hit are Mega Man 3's snap_x_to_wall_right, snap_x_to_wall_left, snap_y_to_ceil, and snap_y_to_floor instruction for instruction; only the addresses of the entity position arrays differ. Mega Man 3 follows them with two calls into its boss door bank, which Mega Man 4 doesn't have there. | src/fixed/collision.asm L558–642 | Code |
Mega Man 4's four routines that move an entity by its speed and stop it at a wall, floor, or ceiling follow Mega Man 3's move_right_collide, move_left_collide, move_down_collide, and move_up_collide step for step. Each saves the player's position before the move, checks for a platform, pushes the player off it, and on a push that crosses a screen retries with the opposite side's tile check. Two things changed. Each tile check is one call, where Mega Man 3 calls its tile check and then update_collision_flags. And when the right mover hits a solid tile, Mega Man 4 first copies $45 to $3F for the player, which its disassembly reads as the ground tile type. Two of the screen-crossing tests also test their two flags in the other order, to the same effect. | src/fixed/movement.asm L1–168 | Code |
| 304 bytes of Mega Man 3's default sprite position offsets, $A078-$A1A7 of its bank $19, are byte for byte in Mega Man 4's player animation bank $0C at $97BE-$98ED. They are position sets $08-$17 in both games' pointer tables: sixteen lists of signed Y and X offsets, one pair per tile, 4 to 12 tiles each. | src/bank19_sprite_offsets.asm L57–103src/fixed/sprites.asm L307–312 | Code |
| Mega Man 4's routines that move an entity by its speed without checking tiles, and apply gravity, follow Mega Man 3's with the entity arrays moved, and with four changes. Mega Man 4 drops Mega Man 3's routine that sets a behind-the-background flag from the tile hit. Its gravity tests one flag at $43 first, where Mega Man 3 tests for the player and then a flag at $B9. It drops Mega Man 3's exemption, for one animation ($13), from the cap on falling speed. And when gravity resets, it sets one speed ($FF00) for every entity, where Mega Man 3 sets $FFC0 for the player and $FFAB for the rest. | src/fixed/movement.asm L241–433 | Code |
Mega Man 4's 8-bit and 16-bit division routines, used to aim enemies, are Mega Man 3's divide_8bit and its 16-bit version, byte for byte (103 bytes), at $FC14 in its fixed bank where Mega Man 3 has them at $FCEB. | src/fixed/movement.asm L1269–1363 | Code |
Mega Man 4's four routines after its name table buffer flush, two that reset or set bits of PPUCTRL and two that turn rendering off and on, are Mega Man 3's disable_nmi, dead_code_enable_nmi, rendering_off, and rendering_on instruction for instruction; only the zero-page counter the last two step differs ($EE in Mega Man 3, $EA in Mega Man 4). | src/fixed/ppu_utils.asm L47–122 | Code |
| The first 57 sprite tiles ($00-$38) of the set Mega Man 4 shares across its stages (912 bytes) are byte for byte the first 57 tiles of Mega Man 3's sprite CHR banks $00-$01, the set it maps throughout play. Of the first 128 tiles, 96 are the same at the same numbers. | src/chr.asm L1–2 | Code |
| Mega Man 4 has Mega Man 3's 26 letter tiles, A to Z, byte for byte (416 bytes), in its bank 19 at $9800. Mega Man 3 has two copies, in its password screen tiles (after its digits 0 to 9) and in its stage start sprite tiles; Mega Man 4's digits before them differ. | src/chr.asm L1–2 | Code |
| Mega Man 4's bank 20 holds, at $8800-$8FFF, Mega Man 3's 128 title screen background tiles (CHR banks $76-$77), the same in all but two: tiles $20 and $2F, which in Mega Man 4 are plain outlined squares. | src/chr.asm L1–2 | Code |