| Mega Man 4'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 |
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/bank3C.asm L179–190src/bank3C.asm L420–431 | 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/bank3C.asm L254src/bank3C.asm L510–516src/bank3C.asm L217–226src/bank3C.asm L473–496 | Verified |
A B press fires a normal shot and sets the charge counter to 1; each frame B stays held in a state below 4 the counter rises by 1, looping from 100 back to 92. On release, a counter under 32 ($20) fires nothing more, 32 or more fires a half-charged shot, and 92 ($5C) or more a full one. | src/bank3C.asm L73–95src/bank3C.asm L1694–1722src/bank3C.asm L1743–1751src/bank3C.asm L1769–1772 | Code |
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/bank3C.asm L801–811src/bank3C.asm L830–832 | Code |
| One routine, entity_player_collide, moves Mega Man vertically in every state: by the sign of his speed's whole byte it moves him down or up by the speed (8.8 fixed point, positive up), takes gravity off the speed, and only then tests the floor points under a fall or the ceiling points over a rise. The ground, air, and slide states all run it before their horizontal move, so a frame's floor and ceiling tests use the X the frame started with and its wall test the new Y. | src/fixed/fixed_entity_physics.asm L321–331src/fixed/fixed_entity_physics.asm L365–367src/fixed/fixed_entity_physics.asm L410–412src/fixed/fixed_entity_physics.asm L429–431src/bank3C.asm L171–172src/bank3C.asm L387–390src/bank3C.asm L447–453src/bank3C.asm L464–467 | Code |
Gravity takes $40/256 = 0.25 px/frame from Mega Man's upward speed every frame; the stage start writes $40 to gravity ($99). | src/fixed/fixed_game_loop.asm L76–77src/fixed/fixed_entity_physics.asm L622–629 | Verified |
When gravity takes Mega Man's speed below -7 px/frame (its whole byte under $F9), the gravity routine sets it to exactly $F9.$00, so he falls at most 7 px a frame. | src/fixed/fixed_entity_physics.asm L630–636 | Code |
On the ground Mega Man's vertical speed rests at -1 px/frame ($FF.$00), which every landing and every floor contact sets through entity_stop_y. So each grounded frame moves him 1 px down, takes gravity, and tests his floor points one row lower; ground there puts him back on it at the same speed, and none leaves him in the air, falling at 1.25 px/frame from the next frame. | src/fixed/fixed_entity_physics.asm L648–652src/fixed/fixed_entity_physics.asm L399–404 | Verified |
| When a falling Mega Man's floor points find a solid tile, align_down subtracts the tested row's depth into its 16 px tile from his Y pixel, which puts the points on the tile's top row and his feet on its top, and keeps the Y fraction; the speed goes back to -1 px/frame. A fall of up to 7 px a frame always ends on the top of the tile it reaches. | src/fixed/fixed_tile_collision.asm L1973–1981src/fixed/fixed_entity_physics.asm L399–401 | Code |
| Mega Man's position is his center. Standing, walking, and in the air his floor points are 12 px below it at x-7, x, and x+7; his ceiling points 9 px above it at x-7 and x+7; and his wall points 8 px to the side he moves toward, at 8 px above, level with, and 11 px below his center. | src/fixed/fixed_tile_collision.asm L625–631 | Code |
| When the horizontal move puts a wall point in a solid tile, the move routine pushes Mega Man back by the point's depth into that 16 px 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, his speed, and his pose stay, so he walks in place against it. | src/fixed/fixed_tile_collision.asm L1905–1916src/fixed/fixed_tile_collision.asm L1928–1937src/fixed/fixed_entity_physics.asm L125–131 | Code |
| Because the ground state tests the floor before it moves him, Mega Man walks one frame past the edge before he falls: the frame whose move takes all three floor points off a ledge still counts as grounded, and on the next the floor test finds nothing after a 1 px drop, so he leaves the ground falling 1.25 px/frame and that frame moves him by the air's rules. His feet are then 1, 2, 3, 5, 7, and 9 px below the ledge on that frame and the five after (computed). | src/bank3C.asm L171–172src/bank3C.asm L410–419src/fixed/fixed_entity_physics.asm L365–367 | Code |
| Mega Man 4 gives no grace jump off a ledge. The ground state reads A only after the air routine reports him standing, and the air state never reads it, so a press on the frame the floor test first fails, or on any later frame of the fall, doesn't jump. | src/bank3C.asm L171–175src/bank3C.asm L447–458 | Code |
| When a rising Mega Man's move puts a ceiling point, x-7 or x+7 at 9 px above his center, in a solid tile, entity_align_to_tile adds 16 minus the point's depth into the tile to his Y pixel, which puts the point on the row under the tile, and entity_stop_y sets his speed to -1 px/frame; he stays in the air and falls from the next frame. | src/fixed/fixed_entity_physics.asm L429–437src/fixed/fixed_tile_collision.asm L1949–1955 | Code |
| Nothing tests the ceiling before a jump starts: a fresh A press on the ground sets the jump speed and runs the air routine, whose rise is the first test. On tile floor the lowest ceiling he can walk under is 32 px up, 11 px over his ceiling points, so a jump there rises 5 px and then 4.75 px on its first two frames and meets the block on the 3rd, which turns it into a fall. | src/bank3C.asm L179–190 | Code |
| A jump moves Mega Man on its press frame. The ground state has already run the air routine and found the floor; the A press sets 5 px/frame and runs the air routine again, which lifts him 5 px and moves him by the air's rules, so the ground's own walk doesn't run that frame. Measured in Mesen from power-on, standing where he lands at the start of Skull Man's stage, a jump's first frame raised his Y by exactly 5 px. | src/bank3C.asm L179–190src/bank3C.asm L171–176 | Verified |
Mega Man walks and moves through the air at the speed held in his X speed (ent_xvel), 1.30 px/frame ($01.$4C) on ordinary floor; no walking or air code sets it. The slide writes 2.5 px/frame there, and its end and the jump out of it write $01.$4C back. Measured in Mesen from power-on, at the start of Skull Man's stage, the X speed read $01.$4C and each walking frame moved him 332/256 px. | src/bank3C.asm L325–331src/fixed/fixed_entity_physics.asm L793–800src/bank3C.asm L525–533 | Verified |
| On the ground Mega Man's sprite sub-type decides whether he moves. Standing ($01), a held direction sets the pause pose ($0D) and moves him one frame; in the pause pose he doesn't move until its animation advances, and then walks ($04) toward a held direction, or stands with none. Walking, the same direction keeps him moving; letting go puts him in the pause pose without a move, and the other direction does too, with one frame's move the new way. | src/bank3C.asm L286–324src/fixed/fixed_entity_physics.asm L880–884 | Code |
The pause pose lasts 6 frames: its animation (sub-type $0D in bank $0D) holds its first frame for 6 animation ticks, one a frame. So from standing, or on a turn, a held direction moves Mega Man on the first frame, holds him still on the next 5, and walks from the 7th; letting go of a walk holds him for 6 frames, whatever the d-pad does, before he stands or walks on. Measured in Mesen from power-on, at the start of Skull Man's stage, Right moved him on frame 1, not on frames 2 to 6, and on every frame from 7 to 40; letting go on frame 41 kept him still in the pause pose on frames 41 to 46, and he stood from frame 47. | src/fixed/fixed_entity_core.asm L295–306 | Verified |
| Every frame in the air the d-pad alone sets where Mega Man moves: the air routine copies the held Left or Right into his direction and moves him by his X speed that way, 1.30 px/frame, and with neither held he doesn't move. He turns at once, and nothing carries over from the ground. | src/bank3C.asm L447–453src/fixed/fixed_entity_physics.asm L793–800 | Code |
| The frame a falling Mega Man's floor test finds ground puts him in the ground state with the walking pose ($04), and still moves him by the air's rules. On the next frame he walks on at once if he holds the direction he held on landing; none starts the pause pose, and the other direction starts it with one move that way, as a turn does. The air state reads no A press, so a press on the landing frame is lost, and the next frame's press jumps. | src/bank3C.asm L432–453 | Verified |
| Down and a fresh A press start a slide only if the slide's start point, 15 px ahead of his center and 4 px below it, isn't in a wall; with a wall there the press does nothing, neither slide nor jump. The slide moves his Y pixel 2 px down and tests a lower, wider box: floor points 10 px below the new center at x-14, x, and x+14, and wall points 15 px ahead, level with it and 9 px below. With no floor under those points, ground 16 px below the center keeps the slide going, and none stands him up. | src/bank3C.asm L204–213src/bank3C.asm L229–232src/bank3C.asm L464–472 | Code |
| A slide ends in two ways. When the slide box finds no floor and no ground 16 px below his center either (slide-box), he stands up at once, with no headroom test, before that frame's A test and move. Otherwise it ends at the standing test, which a wall, the timer's end, or a turn sends it to. A turn (a held direction against the slide's) zeroes the timer and still moves him 2.5 px the new way on that frame. The test checks his standing headroom, three points 14 px above the slide's center (12 px above his standing one) at x-14, x, and x+14: a solid tile there keeps him sliding at 2.5 px/frame, testing again each frame, and otherwise he stands up in the walking pose, at walking speed, after that frame's move. A fresh A press without Down jumps out of it instead, at 5 px/frame and walking speed, if the same headroom is clear, from the 2 px lower slide center; the earliest such press comes on the slide's 3rd frame (slide-line). | src/bank3C.asm L464–472src/bank3C.asm L497–524src/bank3C.asm L525–537src/bank3C.asm L473–496 | Verified |
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/bank3C.asm L186–189src/fixed/fixed_entity_physics.asm L648–652src/bank3C.asm L425–430src/bank3C.asm L217–218src/bank3C.asm L473–478 | Code |
Mega Man 5 keeps Mega Man 4's jump. Both write 5 px/frame ($05.$00) into the vertical speed at $03F0/$03D8 on a jump, and set it to 0 on any rising frame without A. | src/bank3C.asm L186–189src/bank3C.asm L425–430 | Code |
Mega Man 5 keeps Mega Man 4's slide, 2.5 px/frame for 26 frames ($1A), with a jump out of it on any slide frame a fresh A press comes without Down and there is headroom. The earliest is the slide's 3rd frame, counting the set-up frame (Down and A) as the 1st: a fresh press needs A let go on the 2nd. | src/bank3C.asm L217–226src/bank3C.asm L474–479 | Code |
Mega Man 5's ordinary-floor movement differs from Mega Man 4's, though the walk, the step pose, the jump, gravity, the fall cap, air control, and the slide's speed, length, and start are the same. The first difference on flat ground: on a slide's last frame Mega Man 5 raises his center the 2 px the slide lowered it and sets −0.25 px/frame, where Mega Man 4 leaves it 2 px low at −1 px/frame, so for that frame Mega Man 5 stands 2 px higher, and each of its slides adds $40 to his Y fraction. Against blocks, Mega Man 5's ceiling points are 10 px above his center (Mega Man 4's 9) and his wall points 9 px above it (Mega Man 4's 8); its slide's wall points are 5 px above and 9 px below the slide's center (Mega Man 4's level and 9 below), and its slide's ceiling points 8 px above it (Mega Man 4's level with it). | src/bank3C.asm L525–539src/fixed/fixed_entity_physics.asm L648–654src/fixed/fixed_tile_collision.asm L1426–1430src/fixed/fixed_tile_collision.asm L1699–1702src/fixed/fixed_tile_collision.asm L1301–1304src/fixed/fixed_tile_collision.asm L1439–1442src/fixed/fixed_tile_collision.asm L1592–1595src/fixed/fixed_tile_collision.asm L1711–1714 | Code |
Mega Man 5 moves Mega Man 4's charge thresholds. On release its counter $38 fires a normal shot from 16 ($10), a half-charged one from 40 ($28), and a full one from 80 ($50), and nothing under 16; Mega Man 4's counter, which starts at 1 on the press, fires nothing under 32, a half charge from 32, and a full one from 92. So the full charge needs a lower count and the half charge a higher one. | src/bank3C.asm L1751src/bank3C.asm L1710–1716 | Code |
Mega Man 5 keeps the 0.5 px/frame knockback, always against the way Mega Man faces, but lets the player resist it: with the direction he faces held, the push drops to 0.25 px/frame ($40). | src/bank3C.asm L803–806 | Code |
Mega Man 6's buster fires a normal shot on the press of B, which sets the charge counter $9E to 0; each later frame with B held adds 1, and on release the counter fires a half-charged shot from 36 ($24) and a full one from 90 ($5A, kept in $06AB), and nothing under 36. Between games these are counts, not frames: Mega Man 5's counter, whose start isn't traced, fires its half charge from 40 and its full one from 80, and Mega Man 4's, which starts at 1 on the press, from 32 and 92. | src/bank3C.asm L1710–1716 | 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/bank1E.asm L1–92src/bank1E.asm L68–88 | 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/bank1E.asm L93–192 | 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/bank1E.asm L193–393 | 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/bank1E.asm L394–584 | 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/bank1E.asm L585–915 | Code |
| Mega Man 4's note-to-pitch routines are Mega Man 3's, byte for byte at the same address. | src/bank1E.asm L916–1036 | Code |
| Mega Man 4's volume envelope and fade code is Mega Man 3's, byte for byte at the same address. | src/bank1E.asm L1037–1263 | 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/bank1E.asm L1264–1388 | 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/bank1E.asm L1390–1427 | 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/fixed_nmi_irq.asm L646–717 | 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/fixed_ppu_util.asm L1–65 | 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/fixed_nmi_irq.asm L569–644 | 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/fixed_system.asm L1562–1726 | 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/bank38.asm L1–97 | 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/fixed/fixed_nametable_update.asm L792–898 | 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/fixed/fixed_nametable_update.asm L899–996 | 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/fixed_tile_collision.asm L1895–1989 | 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/fixed_entity_physics.asm L1–239 | 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/bank0C.asm L409–428src/bank0C.asm L22–24 | 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/fixed_entity_physics.asm L447–654 | 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/fixed_system.asm L1068–1143 | 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/fixed_nmi_irq.asm L598–644 | 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/bank00.asm L1–529 | 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/bank13.asm L1–527 | 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/bank14.asm L1–528 | Code |
| Mega Man 5's sound bank, bank $18, opens with Mega Man 4'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, $1D in Mega Man 4 and $1A in Mega Man 5, and the data bank it restores, $1F and $19. | src/bank1E.asm L1–92src/bank1E.asm L68–88 | Code |
| Mega Man 5's per-frame sound tick is Mega Man 4's, byte for byte at the same address. | src/bank1E.asm L93–192 | Code |
| Mega Man 5's routine that starts a song or an effect, and takes the stop, pause, fade, and transpose commands, is Mega Man 4's, byte for byte at the same address. | src/bank1E.asm L193–393 | Code |
| Mega Man 5's sound effect reader is Mega Man 4's, byte for byte at the same address. | src/bank1E.asm L394–584 | Code |
| Mega Man 5's music track reader is Mega Man 4's, byte for byte at the same address. | src/bank1E.asm L585–915 | Code |
| Mega Man 5's note-to-pitch routines is Mega Man 4's, byte for byte at the same address. | src/bank1E.asm L916–1036 | Code |
| Mega Man 5's volume envelope and fade code is Mega Man 4's, byte for byte at the same address. | src/bank1E.asm L1037–1263 | Code |
| Mega Man 5's code that writes each channel's pitch to the APU, with vibrato, detune, and slides, is Mega Man 4's, byte for byte at the same address. | src/bank1E.asm L1264–1388 | Code |
| Mega Man 5's sound driver tables, through the note period table, are Mega Man 4's at the same addresses. The 37 bytes after it ($8A1B-$8A3F), which hold data in Mega Man 4, are all zero in Mega Man 5, as in Mega Man 3. | src/bank1E.asm L1390–1427 | Code |
| Mega Man 5's fixed-bank routine that adds a sound to the queue is Mega Man 4's, byte for byte (27 bytes), at $EC5B where Mega Man 4 has it at $F6BC. | src/fixed/fixed_system.asm L1–30 | Code |
| Mega Man 5's four routines that push an object out of a wall, ceiling, or floor after a tile hit are Mega Man 4's, byte for byte but for one instruction: after a ceiling hit, Mega Man 5 clears the carry before adding where Mega Man 4 sets it, so the object ends one pixel higher than in Mega Man 4. Mega Man 5 follows them with four new routines that move an object along X or Y by the amount in $10 or $11 and compare its position with one saved in $02-$03. | src/fixed/fixed_tile_collision.asm L1895–1989 | Code |
| Mega Man 5's routines that move an object right, left, down, or up and then check tiles, and for the player the platforms it stands on, follow Mega Man 4's with three changes besides addresses. The facing flag they set or clear is bit 5 of the object's flags, where Mega Man 4 uses bit 6. A right-wall hit no longer copies the player's ground tile type from $45 to $3F. And before a vertical move, Mega Man 5 saves the player's vertical screen in $03, where Mega Man 4 saves its horizontal screen. | src/fixed/fixed_entity_physics.asm L1–239 | Code |
| Mega Man 5's routines that move an object by its speed without checking tiles, and apply gravity, follow Mega Man 4's, with the gravity amount at $A1 instead of $99 and these changes. Eight bytes before the left mover clear the facing bit and fall into it. The player's gravity is skipped whenever a flag at $52 is set, where Mega Man 4 skips it only while a timer at $43 counts down. And Mega Man 5 adds four routines after them, one of which adds gravity to the vertical speed instead of subtracting it, capped at 7 pixels a frame. | src/fixed/fixed_entity_physics.asm L447–654 | Code |
| Mega Man 5's routines for an object's distance to the player on each axis, and the direction to him in 16 steps, are Mega Man 4's, with two changes. It adds two routines that measure the same two distances to another slot's object. And its direction routine starts by setting Y to 0, the player's slot, and falls into the copy of slot Y's position, where Mega Man 4 has a separate entry that copies the player's position and jumps on. The rest is byte for byte, except the address of the 48-byte direction table, which is the same in both and follows the code directly in Mega Man 5. | src/fixed/fixed_system.asm L32–203 | Code |
Mega Man 5's two checks for a platform object that the player meets moving vertically or horizontally, and their two distance helpers, follow Mega Man 4's test for test. Both walk the slots down from $17 and skip empty, off-screen, and non-solid ones. A one-way platform only catches a falling player, and the push is capped at 8 pixels. The changes: both checks also give up unless the moving object's own Y screen is 0. The horizontal check skips objects of type $02. The helper reads both of the shape's sizes from two tables through X, which it then sets to 0, the player's slot, where Mega Man 4 looks up the second size in the vertical check itself. The smaller box for a sliding player is chosen by player_state $02, where Mega Man 4 tests the player's sub-type for $10. And the horizontal distance helper no longer masks the screen difference to one bit. The four routines that push the player off a platform, which close Mega Man 4's region, sit after the position nudges in Mega Man 5. | src/fixed/fixed_system.asm L240–523 | Code |
| Mega Man 5's spawn engine walks its stage's spawn list ahead of and behind the camera with Mega Man 4's code, instruction for instruction; only the addresses differ: the stage's placement tables, the two list cursors ($9E and $9F in Mega Man 4, $AD and $AE in Mega Man 5), the scroll direction flag ($2F, $AC), and the four window temporaries, two bytes higher. | src/bank38.asm L1–97 | Code |
Mega Man 5's routine that spawns an enemy from a spawn list entry follows Mega Man 4's step for step: the same checks for a live copy and the no-respawn bitmap, and the same slot fill from the entry's position and the parameter tables for its code, with the tables and temporaries at other addresses. It changes two things: it keeps the spawn code in the object's $0510 byte, which Mega Man 4 clears, and it masks bit 7 off the flags parameter and, when that bit is clear, ends by calling entity_facing_to_flags. | src/bank38.asm L160–239 | Code |
| Mega Man 5's cooperative task scheduler is Mega Man 4's instruction for instruction; it sits 6 bytes higher, and only its jump and call addresses differ. | src/fixed/fixed_system.asm L1562–1726 | Code |
| Mega Man 5's name table buffer flush and the four PPU routines after it are Mega Man 4's instruction for instruction; only the zero-page counter the rendering switches step differs ($EA in Mega Man 4, $F0 in Mega Man 5). | src/fixed/fixed_nmi_irq.asm L569–644 | Code |
| Mega Man 5's controller read is Mega Man 4's, byte for byte, with one addition: before it returns, it zeroes controller 2's new presses and held buttons ($15 and $17). | src/fixed/fixed_nmi_irq.asm L646–717 | Code |
| Mega Man 5's routine that fills a name table and its attributes with one value is Mega Man 4's, byte for byte; Mega Man 5 follows it with routines that clear the sprite buffer and the object slots. | src/fixed/fixed_ppu_util.asm L1–65 | Code |
| Mega Man 5's routine that maps the two switchable PRG banks from their shadows, and then runs a sound request that arrived while it was busy, is Mega Man 4's, byte for byte (37 bytes). Mega Man 5 enters it through 6 new bytes that set both shadows from one bank number, the bank and the one after it. | src/fixed/fixed_system.asm L1728–1752 | Code |
| Mega Man 5's 8-bit and 16-bit division routines are Mega Man 4's, which are Mega Man 3's, byte for byte (103 bytes), at $F207 in its fixed bank. | src/fixed/fixed_system.asm L1068–1143 | Code |
| Mega Man 5's reset begins with Mega Man 4's first 98 bytes, byte for byte at the same address ($FE00-$FE61): the interrupt, sound, and rendering shutdown, the wait through four vblanks, the PPU address precharge, the RAM clear, the sound queue's empty markers, and the PPU mask shadow. From the mapper setup on, the two differ. | src/fixed/fixed_system.asm L1433–1514 | Code |
| Mega Man 5's CHR at $31800-$31FFF holds the 128 background tiles of Mega Man 4's bank 20 at $8800-$8FFF, byte for byte (2,048 bytes): the block Mega Man 4 took from Mega Man 3's title screen tiles, with Mega Man 4's two changed tiles. | src/bank14.asm L1–528 | Code |
| Mega Man 5 has the 26 letter tiles, A to Z, that Mega Man 4 took from Mega Man 3, byte for byte (416 bytes), in its CHR at $32410. | src/bank13.asm L1–527 | Code |
| 52 tiles of Mega Man 4's font in bank 36 ($BB00-$BE3F), which look like Japanese kana when drawn out, are byte for byte tiles in Mega Man 5's CHR at $30300-$3063F (832 bytes). | src/bank24.asm L427–555 | Code |