| 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. | 0x10-0x8000f | 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. | 0x78159-0x781650x78322-0x7832E | 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. | 0x78194-0x781A70x78378-0x783AC | 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. | 0x78083-0x780AE0x78D02-0x78D0F | Code |
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. | 0x7F323-0x7F332 | 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. | 0x7F334-0x7F33D | Verified |
| 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. | 0x7D6AE-0x7D6B30x7D6EE-0x7D6F30x7D72E-0x7D7480x7D818-0x7D81F0x7D898-0x7D8B4 | 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. | 0x1A717-0x1A718 | 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. | 0x7D72E-0x7D7480x7D6E7-0x7D6E70x7D810-0x7D8140x7D898-0x7D8B4 | 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. | 0x3c010-0x3c07b | Code |
Mega Man 4's per-frame sound tick is Mega Man 3's sound_driver_update, byte for byte at the same address. | 0x3c07c-0x3c10d | 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. | 0x3c10e-0x3c261 | 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. | 0x3c262-0x3c3a2 | 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. | 0x3c3a3-0x3c5ed | Code |
| Mega Man 4's note-to-pitch routines are Mega Man 3's, byte for byte at the same address. | 0x3c5ee-0x3c6c9 | Code |
| Mega Man 4's volume envelope and fade code is Mega Man 3's, byte for byte at the same address. | 0x3c6ca-0x3c844 | 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. | 0x3c845-0x3c924 | 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. | 0x3c925-0x3ca4f | 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. | 0x7c38d-0x7c3e4 | 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. | 0x7c3e5-0x7c430 | 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. | 0x7c340-0x7c364 | 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. | 0x7feb5-0x7ff46 | 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. | 0x70010-0x7008f | 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. | 0x7e692-0x7e760 | 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. | 0x7e761-0x7e823 | 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. | 0x7d9af-0x7da14 | 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. | 0x7f010-0x7f107 | 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. | 0x197ce-0x198fd | 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. | 0x7f23d-0x7f33e | 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. | 0x7fc24-0x7fc8a | 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). | 0x7c365-0x7c38c | 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. | 0x10-0x39f | 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. | 0x27810-0x279af | 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. | 0x28810-0x2900f | 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. | 0x3c010-0x3c07b | Code |
| Mega Man 5's per-frame sound tick is Mega Man 4's, byte for byte at the same address. | 0x3c07c-0x3c10d | 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. | 0x3c10e-0x3c261 | Code |
| Mega Man 5's sound effect reader is Mega Man 4's, byte for byte at the same address. | 0x3c262-0x3c3a2 | Code |
| Mega Man 5's music track reader is Mega Man 4's, byte for byte at the same address. | 0x3c3a3-0x3c5ed | Code |
| Mega Man 5's note-to-pitch routines is Mega Man 4's, byte for byte at the same address. | 0x3c5ee-0x3c6c9 | Code |
| Mega Man 5's volume envelope and fade code is Mega Man 4's, byte for byte at the same address. | 0x3c6ca-0x3c844 | 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. | 0x3c845-0x3c924 | 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. | 0x3c925-0x3ca4f | 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. | 0x7f6cc-0x7f6e6 | 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. | 0x7d9ae-0x7da14 | 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. | 0x7f010-0x7f107 | 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. | 0x7f23d-0x7f33e | 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. | 0x7f6e7-0x7f7b5 | 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. | 0x7f7e8-0x7f96c | 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. | 0x70010-0x7008f | 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. | 0x700eb-0x7018e | 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. | 0x7feb5-0x7ff46 | 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). | 0x7c340-0x7c38c | 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). | 0x7c38d-0x7c3e4 | 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. | 0x7c3e5-0x7c430 | 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. | 0x7ff47-0x7ff6b | 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. | 0x7fc24-0x7fc8a | 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. | 0x7fe10-0x7fe71 | 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. | 0x28810-0x2900f | 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. | 0x27810-0x279af | 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). | 0x49b10-0x49e4f | Code |