Ninja Gaiden:ROM map
0x00000 to 0x0000F = iNES header 0x00010 to 0x0240F = Level data 0x02410 to 0x0243F = unused 0x02440 to 0x02C3F = Collision data sets. Each set has x200 bytes, 2 for each type of available 4x4 tile of level data 0x02C40 to 0x02C9F = Pointers to level data for each room. 0x02CA0 to 0x02CCF = Upper nybble of each byte selects the universal background color for a room. Lower nybble is the sprite CHR Page. 0x02CD0 to 0x02CFF = Selects sprite palette 2 for each room. 0x02D00 to 0x02D2F = Selects sprite palette 3 for each room. 0x02D30 to 0x02D5F = The length of each room, in full screens. If the top bit is set, you start on the right side of the room and move left (reverse room). 0x02D60 to 0x02D8F = Player's starting X position in each room. 0x02D90 to 0x02DBF = Player's starting Y position in each room. 0x02DC0 to 0x02DEF = Player's starting X position in each room when returning from the next room. 0x02DF0 to 0x02E1F = Player's starting Y position in each room when returning from the next room. 0x02E20 to 0x02E4F = # of Powerups in each room. 0x02E50 to 0x02E7F = # of Enemies in each room. 0x02E80 to 0x02F0F = unused 0x02F10 to 0x02F25 = Tile, palette, and collision selectors for each stage. Bits 0-1 select the 4x4 tileset, collision set, and palette set. Bits 2-4 select the 2x2 tileset. 0x02F26 to 0x02F3B = Background CHR page for the level environment in each stage (bits 3-7 are used, so divide by 8) 0x02F3C to 0x02F51 = Starting room # for each stage (stages can have multiple rooms). 0x02F52 to 0x02F67 = Selects BG palette 1 for each stage. 0x02F68 to 0x02F7D = Selects BG palette 2 for each stage. 0x02F7E to 0x02F93 = Stage # to display on the status bar for each stage(upper nybble and lower nybble are each a decimal number to display) 0x02F94 to 0x02FA9 = Powerup animation sequence to use for each stage 0x02FAA to 0x02FBF = Cut scene # to display at the end of each stage (Cut scene only occurs if you hit a special collision tile or defeat a boss). 0x02FC0 to 0x02FD5 = Time to complete each stage 0x02FD6 to 0x02FEB = Music track for each stage 0x02FEC to 0x0300F = unused 0x03010 to 0x0310F = Palette data for backgrounds (later values are unused) 0x03110 to 0x0320F = Palette data for sprites (later values are unused) 0x03210 to 0x03218 = Universal BG colors for stages 0x03219 to 0x0330F = unused 0x03310 to 0x03410 = Width of enemy animation frames, in pixels. 0x03410 to 0x0350F = Height of enemy animation frames, in pixels. 0x03510 to 0x0353F = Score bonus for defeating each type of enemy 0x03540 to 0x0356F = HP for each enemy type 0x03570 to 0x0359F = Damage for each enemy type 0x035A0 to 0x03FE9 = unused 0x03FEA to 0x03FEF = Copy of reset code, placed in each bank. 0x03FF0 to 0x04005 = Selects BG palette 3 for each stage 0x04006 to 0x04009 = unused 0x0400A to 0x0400F = Copy of interrupt vectors. 0x04010 to 0x0580F = Tile selectors for 2x2 tiles (top left,bottom left, top right, bottom right). Each set is x400 bytes, 4 bytes per 2x2 tile. 0x05810 to 0x0600F = unused (space for 2 more sets of tile selectors) 0x06010 to 0x0700F = 2x2 tile selectors for 4x4 tiles. Each set is x400 bytes, 4 bytes per 4x4 tile. Each byte in an entry selects a 2x2 tile. 0x07010 to 0x0740F = Palette selectors for 4x4 tiles. Each set of selectors is x100 bytes, one per 4x4 tile. 0x07410 to 0x07419 = Pointers to fixed PPU transmissions. 0x0741A to 0x0742D = PPU transmission to set palettes for debug stage select or debug sound test. 0x0742E to 0x07480 = PPU transmission to draw the status bar 0x07481 to 0x0748D = PPU transmission to display GAME OVER 0x0748E to 0x07497 = PPU transmission for the debug stage select ("SCENE-") 0x07498 to 0x074A1 = PPU transmission for the debug sound select ("SOUND-") 0x074A2 to 0x07FE9 = unused 0x07FEA to 0x07FEF = Copy of reset code, placed in each bank. 0x07FF0 to 0x08009 = unused 0x0800A to 0x0800F = Copy of interrupt vectors 0x08010 to 0x0820F = Sprite animation frame pointers for enemies (latter values unused) 0x08210 to 0x0840F = Sprite animation frame attribute pointers for enemies (latter values unused) 0x08410 to 0x0850F = Sprite animation frame pointers for Ryu and powerups (latter values unused) 0x08510 to 0x0860F = Sprite animation frame attribute pointers for Ryu and powerups (latter values unused) 0x08610 to 0x0870F = Sprite animation sequence pointers (latter values unused) 0x08710 to 0x0876F = Pointers to powerup spawn positions for each room 0x08770 to 0x087CF = Pointers to powerup type and Y position arrays for each room (upper nybble is Y position at spawn, lower nybble is powerup type) 0x087D0 to 0x0882F = Pointers to enemy spawn positions for each room. 0x08830 to 0x0888F = Pointers to enemy spawn X and Y positions for each room. Upper nybble is Y position at spawn, lower nybble is X position at spawn. 0x08890 to 0x088EF = Pointers to enemy type arrays for each room. 0x0A285 to 0x0BFE9 = unused 0x0BFEA to 0x0BFEF = Copy of reset code, placed in each bank. 0x0BFF0 to 0x0C009 = unused 0x0C00A to 0x0C00F = Copy of interrupt vectors 0x0C010 to 0x0C57D = ASM for sound engine 0x0C57E to 0x0C78C = Data arrays for sound engine 0x0C78D to 0x0C836 = Music/SFX pointers 0x0FFEA to 0x0FFEF = Copy of reset code, placed in each bank. 0x0FFF0 to 0x10009 = unused 0x1000A to 0x1000F = Copy of interrupt vectors 0X10010 to 0x108BE = ASM for cut-scene scripting 0x108BF to 0x108DE = Timer values for cut-scene fade in/out (values equal to array offset currently) 0x108DF to 0x108F2 = Timer values for cut-scene animated sprite sequences 0x108F3 to 0x108F4 = Timer values for cut-scene fixed sprite movement sequences. 0x108F5 to 0x108F6 = Timer values for cut-scene earthquake scroll sequences 0x108F7 to 0x108FA = Pointers for cut-scene earthquake scroll sequences 0x108FB to 0x10907 = Cut-scene earthquake 1 scroll sequence data 0x10908 to 0x10917 = Cut-scene earthquake 2 scroll sequence data 0x10918 to 0x1094F = Pointers for cut-scene SCROLL_SETUP command data 0x10950 to 0x10B13 = Data for cut-scene SCROLL_SETUP command. 0x10B14 to 0x10B7B = Cut-scene speed values for linear motion sprites. 4 bytes per entry, X fine, X coarse, Y fine, Y coarse. 0x10B7C to 0x10BC1 = Cut-scene speed and acceleration values for accelerating sprites. 6 bytes per entry, X fine, X coarse, Y fine, Y coarse, X accel, Y accel. 0x10BC4 to 0x10BC7 = Pointers to cut-scene palette data ("negative" palettes use the second pointer) 0x10BC8 to 0x10D2C = Cut-scene palette data 0x10D2D to 0x10EAF = Cut-scene PPU transmission strings. These are used by cut-scene script command 07, PPU_TRANSMIT 0x10EB0 to 0x10EEF = Cut-scene PPU base addresses for displaying background images. 2 bytes per entry. 0x10EF0 to 0x10F0B = Pointers to cut-scene scripting for each cut-scene 0x10F0C to 0x111E6 = Cut scene 0 scripting (intro scene) 0x111E7 to 0x113C0 = Cut scene 1 scripting 0x113C1 to 0x11615 = Cut scene 2 scripting 0x11616 to 0x119F6 = Cut scene 3 scripting 0x119F7 to 0x11A30 = Cut scene 4 scripting 0x11A31 to 0x11C4F = Cut scene 5 scripting 0x11C50 to 0x11CF7 = Cut scene 6 scripting 0x11CF8 to 0x11D61 = Cut scene 7 scripting 0x11D62 to 0x11F6A = Cut scene 8 scripting 0x11F6B to 0x1215E = Cut scene 9 scripting 0x1215F to 0x12263 = Cut scene A scripting 0x12264 to 0x1279E = Cut scene B scripting 0x1279F to 0x127CA = Cut scene C scripting 0x127CB to 0x127E8 = Cut scene D scripting 0x127E9 to 0x13E0F = unused 0x13E10 to 0x13E70 = ???? 0x13E71 to 0x13FA7 = unused 0x13FA8 to 0x13FC2 = ASM to switch banks for BG/text/sprite processing in cut-scenes 0x13FC3 to 0x13FCF = Variable Function call and associated function pointers for cut-scene operations 0x13FD0 to 0x13FE9 = unused, with a small amount of unfinished ASM code. 0x13FEA to 0x13FEF = Copy of reset code, placed in each bank. 0x13FF0 to 0x14009 = unused, with a small amount of unfinished ASM code. 0x1400A to 0x1400F = Interrupt vectors (all set to reset) 0x14010 to 0x143EF = ASM for cut scene sprites and text 0x143EF to 0x14417 = Cut scene X/Y position table for sprite tiles 0x14418 to 0x1443F = Pointers for cut scene animated sprite sequences 0x14440 to 0x144BA = Cut scene animated sprite sequence data 0x144BB to 0x144BE = Pointers to cut scene fixed sprite movement sequences 0x144BF to 0x144C3 = Data for cut scene fixed sprite movement sequence 1 0x144C4 to 0x144C8 = Data for cut scene fixed sprite movement sequence 2 0x144C9 to 0x1459A = Pointers to cut scene sprite definitions 0x1459B to 0x152D2 = Cut scene sprite data. Format: Byte 0: CHR sprite page Byte 1: X position of sprite tile column (using 0x143EF lookup table) Byte 2: # of tiles in this column Byte 3: Tile value Byte 4: Attributes and Y position of tile. Upper 5 bits index into 0x143EF lookup table for Y position. Bit 0 is horizontal flip. Bits 1-2 are palette data. ... loop over all tiles in the column ... Process next sprite tile column, looping back to same format as in Byte 1. Loop ends when a negative value is reached. 0x152D3 to 0x152DF = Cut scene animated sprite sequence timer values. These values are used instead of the ones in the previous bank when an animated sprite is activated using a command built in to the dialog engine (Command FD). 0x152E0 to 0x153C1 = Pointers to cut scene text sequences. 0x153C2 to 0x172DF = Cut scene text. Special characters: F8: End Text F9: Set indentation by the following byte FA: Line break and increase indent by 1 FB: Clear dialog/go to the next page of dialog FC: Delay the next character by 1 second FD: Animate sprite, using the sprite sequence from the following byte FE: Set sprite. Bits 6-7 choose the sprite slot to change, bits 0-5 choose the sprite number. FF: Line break 0x172E0 to 0x17FA7 = unused 0x17FA8 to 0x17FC2 = ASM to switch banks within a cut-scene 0x17FC3 to 0x17FCF = Variable function call and function pointers for cut scene operations 0x17FEA to 0x17FEF = Copy of reset code, placed in each bank 0x1800A to 0x1800F = Interrupt vectors (all set to reset value) 0x18010 to 0x182D9 = ASM for cut scene BG drawing 0x182DA to 0x182E3 = Fixed data string to be transmitted to PPU. Unknown purpose. 0x182E4 to 0x18365 = Pointers to cut scene background arrangements. 0x18366 to 0x18B80 = Cut scene BG arrangement data. Format: Byte 0: Bits 5-7 select the 2x4 tile set to use. Bits 0-4 select the CHR page for the BG. Byte 1: Upper nybble is the # of 2x4 tiles to draw across the screen, lower nybble is the # of 2x4 tiles to draw down. Byte 2-X: 2x4 tiles to use for the arrangement. 0x18B81 to 0x18B86 = Pointers to cut scene 2x4 tile set definitions 0x18B87 to 0x18B8C = Pointers to cut scene 2x4 tile set palette definitions 0x18B8D to 0x1A154 = Cut scene 2x4 tile set definitions. 3 sets of tiles, 8 bytes per tile. The final set does not have a complete set of x100 tiles. 0x1A154 to 0x1A2B1 = Cut scene 2x4 tile set palette definitions. 3 sets of tiles, each byte defines 2 tiles. 0x1A2B2 to 0x1B2CE = unused cut scene data. Includes some scripting, text, and probably other data as well. 0x1BFA8 to 0x1BFC2 = ASM to switch banks within a cut-scene 0x1BFC3 to 0x1BFCF = Variable function call and function pointers for some cut scene operations 0x1BFEA to 0x1BFEF = Copy of reset code, placed in each bank 0x1C00A to 0x1C00F = Interrupt vectors (all set to reset value) 0x1C010 to 0x1C023 = JSR to select CHR bank at PPU $0000 0x1C024 to 0x1C037 = JSR to select CHR bank at PPU $1000 0x1C038 to 0x1C04D = JSR to select PRG bank. JSR $C028 stores the bank in $5C. JSR $C02A changes the bank without storing in $5C. 0x1C04E to 0x1C094 = Reset/Game start code 0x1C095 to 0x1C0F8 = Main ASM loop during gameplay. 0x1C0F9 to 0x1C133 = Code for debug sound test and stage select 0x1C134 to 0x1C194 = JSR to handle player input and update #'s on-screen during debug sound test and stage select 0x1C195 to 0x1C1A4 = Tile values to display digits 0-F (hexadecimal) for debug stage select and sound test 0x1C1A5 to 0x1C1FC = Pointers to enemy AI function pointers for each enemy type 0x1C1FD to 0x1C208 = Enemy AI function pointers for enemy 0 (Boxer) 0x1C209 to 0x1C22C = Boxer AI stage 0 0x1C22D to 0x1C250 = Boxer AI stage 1 0x1C251 to 0x1C279 = Boxer AI stage 2 0x1C27A to 0x1C28B = Boxer AI stage 3 0x1C28C to 0x1C2B2 = Boxer AI stage 4 0x1C2B3 to 0x1C2BF = Boxer AI stage 5 0x1C2C0 to 0x1C2C5 = Enemy AI function pointers for enemy 1 (Machine gunner) 0x1C2C6 to 0x1C2EB = Machine gunner AI stage 0 0x1C2EC to 0x1C316 = Machine gunner AI stage 1 0x1C317 to 0x1C34B = Machine gunner AI stage 2 0x1C34C to 0x1C353 = Enemy AI function pointers for enemy 2 (Thrower) 0x1C354 to 0x1C377 = Thrower AI stage 0 0x1C378 to 0x1C38D = Thrower AI stage 1 0x1C38E to 0x1C3BD = Thrower AI stage 2 0x1C3BE to 0x1C3C8 = Thrower AI stage 3 0x1C3C9 to 0x1C3CC = Enemy AI function pointers for enemy 3 (Sword guy) 0x1C3CD to 0x1C3F0 = Sword guy AI stage 0 0x1C3F1 to 0x1C405 = Sword guy AI stage 1 0x1C406 to 0x1C411 = Enemy AI function pointers for enemy 4 (Knife guy) 0x1C412 to 0x1C42A = Knife guy AI stage 0 0x1C42B to 0x1C440 = Knife guy AI stage 1 0x1C441 to 0x1C475 = Knife guy AI stage 2 0x1C476 to 0x1C496 = Knife guy AI stage 3 0x1C497 to 0x1C4CD = Knife guy AI stage 4 0x1C4CE to 0x1C4DE = Knife guy AI stage 5 0x1C4DF to 0x1C4E4 = Enemy AI function pointers for enemy 5 (Soldier, crouch & gun) 0x1C4E5 to 0x1C500 = Soldier, crouch & gun AI stage 0 0x1C501 to 0x1C52C = Soldier, crouch & gun AI stage 1 0x1C52D to 0x1C541 = Soldier, crouch & gun AI stage 2 0x1C542 to 0x1C54B = Enemy AI function pointers for enemy 6 (Jump kicker) 0x1C54C to 0x1C569 = Jump kicker AI stage 0 0x1C56A to 0x1C586 = Jump kicker AI stage 1 0x1C587 to 0x1C59D = Jump kicker AI stage 2 0x1C59E to 0x1C5BD = Jump kicker AI stage 3 0x1C5BE to 0x1C5CA = Jump kicker AI stage 4 0x1C5CB to 0x1C5D0 = Enemy AI function pointers for enemy 7 (Soldier, run) 0x1C5D1 to 0x1C5F4 = Soldier, run AI stage 0 0x1C5F5 to 0x1C60E = Soldier, run AI stage 1 0x1C60F to 0x1C620 = Soldier, run AI stage 2 0x1C621 to 0x1C624 = Enemy AI function pointers for enemy 8 (Zig-zag bat) 0x1C625 to 0x1C65D = Zig-zag bat AI stage 0 0x1C65E to 0x1C68A = Zig-zag bat AI stage 1 0x1C68B to 0x1C68E = Enemy AI function pointers for enemy 9 (Attacking dog) 0x1C68F to 0x1C6C2 = Attacking dog AI stage 0 0x1C6C3 to 0x1C6DD = Attacking dog AI stage 1 0x1C6DE to 0x1C6E3 = Enemy AI function pointers for enemy A (Waiting dog) 0x1C6E4 to 0x1C704 = Waiting dog AI stage 0 0x1C705 to 0x1C729 = Waiting dog AI stage 1 0x1C72A to 0x1C744 = Waiting dog AI stage 2 0x1C745 to 0x1C748 = Enemy AI function pointers for enemy B (Flying Bird) 0x1C749 to 0x1C76C = Flying Bird AI stage 0 0x1C76D to 0x1C7B4 = Flying Bird AI stage 1 0x1C7B5 to 0x1C7BA = Enemy AI function pointers for enemy C (Jetpack Ninja) 0x1C7BB to 0x1C7E6 = Jetpack Ninja AI stage 0 0x1C7E7 to 0x1C81D = Jetpack Ninja AI stage 1 0x1C81E to 0x1C82D = Jetpack Ninja AI stage 2 0x1C82E to 0x1C837 = Enemy AI function pointers for enemy D (Running Ninja) 0x1C838 to 0x1C858 = Running Ninja AI stage 0 0x1C859 to 0x1C87A = Running Ninja AI stage 1 0x1C87B to 0x1C89B = Running Ninja AI stage 2 0x1C89C to 0x1C8B2 = Running Ninja AI stage 3 0x1C8B3 to 0x1C8C3 = Running Ninja AI stage 4 0x1C8C4 to 0x1C8CD = Enemy AI function pointers for enemy E (Stone man) 0x1C8CE to 0x1C8F9 = Stone man AI stage 0 0x1C8FA to 0x1C94A = Stone man AI stage 1 0x1C94B to 0x1C972 = Stone man AI stage 2 0x1C973 to 0x1C9B8 = Stone man AI stage 3 0x1C9B9 to 0x1C9C3 = Stone man AI stage 4 0x1C9C4 to 0x1C9C9 = Enemy AI function pointers for enemy F (Crouched ghoul) 0x1C9CA to 0x1C9F9 = Crouched ghoul AI stage 0 0x1C9FA to 0x1CA22 = Crouched ghoul AI stage 1 0x1CA23 to 0x1CA35 = Crouched ghoul AI stage 2 0x1CA36 to 0x1CA3D = Enemy AI function pointers for enemy 10 (Waiting ghoul) 0x1CA3E to 0x1CA61 = Waiting ghoul AI stage 0 0x1CA62 to 0x1CA74 = Waiting ghoul AI stage 1 0x1CA75 to 0x1CA9D = Waiting ghoul AI stage 2 0x1CA9E to 0x1CAB0 = Waiting ghoul AI stage 3 0x1CAB1 to 0x1CAB4 = Enemy AI function pointers for enemy 11 (Machine gunner's bullet) 0x1CAB5 to 0x1CAF4 = JSR spawn machine gunner's bullet. Also bullet AI stage 0. 0x1CAF5 to 0x1CAF8 = Enemy AI function pointers for enemy 12 (Thrower's axe) 0x1CAF9 to 0x1CB3F = JSR spawn Thrower's axe. Also thrower's axe AI stage 0. 0x1CB40 to 0x1CB42 = Thrower's axe AI stage 1 (JMP to enemy gravity function) 0x1CB43 to 0x1CB46 = Enemy AI function pointers for enemy 13 (Knife guy's knife) 0x1CB47 to 0x1CB7E = JSR spawn Knife guy's knife. Also knife guy's knife AI stage 0. 0x1CB7F to 0x1CB82 = Enemy AI function pointers for enemy 14 (Crouch & Gun Soldier's bullet) 0x1CB83 to 0x1CBCD = JSR spawn Soldier, (Crouch & gun)'s bullet. Also AI stage 0 for that enemy. 0x1CBCE to 0x1CBD1 = Enemy AI function pointers for enemy 15 (Jetpack ninja star) 0x1CBD2 to 0x1CC18 = JSR spawn Jetpack ninja star. Also AI stage 0 for this enemy. 0x1CC19 to 0x1CC1A = Enemy AI function pointer for enemy 16 (Stone man's circle) 0x1CC1B to 0x1CC5D = JSR spawn Stone man's circle 0x1CC5E to 0x1CCA4 = Stone man's circle AI stage 0 0x1CCA5 to 0x1CCB4 = Enemy AI function pointers for enemy 17 (Boss 1) 0x1CCB5 to 0x1CCD4 = Boss 1 AI stage 0 0x1CCD5 to 0x1CCF0 = Boss 1 AI stage 1 0x1CCF1 to 0x1CCFB = Boss 1 AI stage 2 0x1CCFC to 0x1CD11 = Boss 1 AI stage 3 0x1CD12 to 0x1CD1C = Boss 1 AI stage 4 0x1CD1D to 0x1CD2D = Boss 1 AI stage 5 0x1CD2E to 0x1CD3D = Boss 1 AI stage 6 0x1CD3E to 0x1CD48 = Boss 1 AI stage 7 0x1CD49 to 0x1CD50 = Enemy AI function pointers for enemy 18 (Boss 2) 0x1CD51 to 0x1CD96 = Boss 2 AI stage 0 0x1CD97 to 0x1CDB3 = Boss 2 AI stage 1 0x1CDB4 to 0x1CDD4 = Boss 2 AI stage 2 0x1CDD5 to 0x1CDE5 = Boss 2 AI stage 3 0x1CDE6 to 0x1CE0B = JSR spawn Boss 2's axe 0x1CE0C to 0x1CE0D = Enemy AI function pointers for enemy 2A (Boss 2's axe) 0x1CE0E to 0x1CE82 = Boss 2's axe AI stage 0 0x1CE83 to 0x1CE8E = Enemy AI function pointers for enemy 19 (Boss 3) 0x1CE8F to 0x1CEB7 = Boss 3 AI stage 0 0x1CEB8 to 0x1CED0 = Boss 3 AI stage 1 (and part of stage 0 overlapping) 0x1CED1 to 0x1CEF2 = Boss 3 AI stage 2 0x1CEF3 to 0x1CF10 = Boss 3 AI stage 3 0x1CF11 to 0x1CF23 = Boss 3 AI stage 4 0x1CF24 to 0x1CF2F = Boss 3 AI stage 5 0x1CF30 to 0x1CF48 = JSR Boss3Projectile1 0x1CF49 to 0x1CF61 = JSR Boss3Projectile2 0x1CF62 to 0x1CF78 = JSR Boss3Projectile3 0x1CF79 to 0x1CFB1 = JSR spawnBoss3projectile 0x1CFB2 to 0x1CFB3 = Enemy AI function pointers for enemy 1A (Boss 3's projectile) 0x1CFB4 to 0x1CFBF = Boss 3's projectile AI stage 0 0x1CFC0 to 0x1CFC5 = Enemy AI function pointers for enemy 1B (Boss 4) 0x1CFC6 to 0x1D024 = Boss 4 AI stage 0 0x1D025 to 0x1D03C = JSR setupBoss4Clone 0x1D03D to 0x1D061 = Boss 4 AI stage 1 0x1D062 to 0x1D0AF = Boss 4 AI stage 2 0x1D0B0 to 0x1D0FA = JSR spawnBoss4Fireball 0x1D0FB to 0x1D0FC = Enemy AI function pointer for enemy 1C (Boss 4 Fireball) 0x1D0FD to 0x1D106 = Enemy AI function pointers for enemy 1E (Boss 5, Bloody Malth) 0x1D107 to 0x1D140 = Boss 5 AI stage 0 0x1D141 to 0x1D15C = Boss 5 AI stage 1 0x1D15D to 0x1D16A = Boss 5 AI stage 2 0x1D16B to 0x1D17F = Boss 5 AI stage 3 0x1D180 to 0x1D188 = Boss 5 AI stage 4 0x1D189 to 0x1D1D2 = JSR spawnBoss5LightningBall 0x1D1D3 to 0x1D1D8 = Enemy AI function pointers for enemy 1F (Boss 5 lightning balls) 0x1D1D9 to 0x1D1ED = Boss 5 lightning balls AI stage 0 0x1D1EE to 0x1D20D = Boss 5 lightning balls AI stage 1 0x1D20E to 0x1D22E = Boss 5 lightning balls AI stage 2 0x1D22F to 0x1D232 = Enemy AI function pointers for enemy 21 (Boss 6 Masked Devil) 0x1D233 to 0x1D265 = Masked Devil AI stage 0 0x1D266 to 0x1D27F = Masked Devil AI stage 1 0x1D280 to 0x1D2BD = JSR spawnBoss6Fireballs 0x1D2BE to 0x1D2C1 = Enemy AI function pointers for enemy 23 (Boss 6 fireballs) 0x1D2C2 to 0x1D2FB = Boss 6 fireballs AI stage 0 0x1D2FC to 0x1D338 = Boss 6 fireballs AI stage 1 0x1D339 to 0x1D33C = Enemy AI function pointers for enemy 24 (Boss 6 controller) 0x1D33D to 0x1D366 = Boss 6 controller AI stage 0 0x1D367 to 0x1D36A = Enemy AI function pointers for enemy 25 (Boss 7 Jaquio) 0x1D36B to 0x1D3A3 = Jaquio AI stage 0 0x1D3A4 to 0x1D3C9 = Jaquio AI stage 1 0x1D3CA to 0x1D3D8 = JSR JaquioFireballLeft 0x1D3D9 to 0x1D3E7 = JSR JaquioFireballRight 0x1D3E8 to 0x1D418 = JSR spawnJaquioFireball 0x1D419 to 0x1D41A = Enemy AI function pointer for enemy 27 (Jaquio Fireball) 0x1D41B to 0x1D44C = Jaquio Fireball AI stage 0 0x1D44D to 0x1D452 = Enemy AI function pointers for enemy 28 (Boss 8) 0x1D453 to 0x1D48F = Boss 8 AI stage 0 0x1D490 to 0x1D4A1 = Boss 8 AI stage 1 0x1D4A2 to 0x1D4CE = Boss 8 AI stage 2 0x1D4CF to 0x1D501 = JSR spawnBoss8Head 0x1D502 to 0x1D534 = JSR spawnBoss8Tail 0x1D535 to 0x1D53A = Enemy AI function pointers for enemy 26 (Boss 8 head) 0x1D53B to 0x1D54F = Boss 8 head AI stage 0 0x1D550 to 0x1D56B = Boss 8 head AI stage 1 0x1D56C to 0x1D56D = Enemy AI function pointer for enemy 29 (Boss 8 fireballs) 0x1D56E to 0x1D5BC = JSR spawnBoss8Fireball 0x1D5BD to 0x1D5BF = Boss 8 fireball AI stage 0 0x1D5C0 to 0x1D5C1 = Enemy AI function pointer for enemy 2B (Boss 8 tail) 0x1D5C2 to ------- = RTS. Empty AI stage for many enemies. Machine gunner bullet, Knife guy's knife, Crouch & gun soldier's bullet, jetpack ninja star, Boss 4 fireball, Boss 6 controller, boss 8 head, boss 8 tail 0x1D5C3 to 0x1D641 = Boss death handler code. 0x1D642 to 0x1D649 = Code to kill Ryu if he falls below the screen after boss death. 0x1D64A to 0x1D669 = JSR animate Boss and Explosions during boss death 0x1D66A to 0x1D6A4 = JSR to drop Ninja power and time remaining and increase score after boss death. 0x1D6A5 to 0x1D716 = JSR bossDeath 0x1D717 to 0x1D71F = JSR spawnBossDeathExplosion 0x1D720 to 0x1D77D = sub-weapon Handler 0x1D77E to 0x1D7F8 = Boomerang throwing star movement code 0x1D7F9 to 0x1D827 = JSR animatePlayerProjectile 0x1D828 to 0x1D86C = JSR movePlayerProjectile 0x1D86D to 0x1D8E4 = JSR subWeaponSpriteHandler 0x1D8E5 to 0x1D986 = JSR spawnPowerups 0x1D987 to 0x1D98B = ???? unused check to see if the room has no scrolling. Branches to unused code at x1D9C8 that would spawn a powerup on the interior of the screen. 0x1D98C to 0x1D998 = JSR resetRoomPowerups 0x1D999 to 0x1D9C7 = JSR despawnPowerupRightEdge 0x1D99E to 0x1D9C7 = JSR despawnPowerupLeftEdge (overlaps with previous function) 0x1D9C8 to 0x1D9F3 = ???? unused code to spawn a powerup on the interior of the screen. Since it is unused, powerups can only spawn at the edges. 0x1D9F4 to 0x1DAB1 = powerup Handler 0x1DAB2 to 0x1DB98 = revealPowerupFromLanternCollision 0x1DB99 to 0x1DBD8 = JSR playerPowerupCollision 0x1DBD9 to 0x1DBF0 = Function Pointers for Powerups 0x1DBF1 to 0x1DBF4 = Powerup 0 code. (+5 Ninja power) 0x1DBF5 to 0x1DC07 = Powerup 1 code. (+10 Ninja power) 0x1DC08 to 0x1DC0F = Powerup 2 code. (Extra life) 0x1DC10 to 0x1DC22 = Powerup 3 code. (+6 Health) 0x1DC23 to 0x1DC39 = Powerup 5 code. (+5 Score) 0x1DC27 to 0x1DC39 = Powerup 6 code. (+10 Score) 0x1DC3A to 0x1DC57 = Powerup 4 code. (Time stop) 0x1DC58 to 0x1DC75 = Powerup 7 code. (Invincibility) 0x1DC76 to 0x1DC7B = Powerup 8 code. (shuriken) 0x1DC7C to 0x1DC81 = Powerup 9 code. (Boomerang throwing star) 0x1DC82 to 0x1DC87 = Powerup A code. (Fire wheel) 0x1DC88 to 0x1DC97 = Powerup B code. (Spin slash) 0x1DC98 to 0x1DCFD = JSR powerupSpriteHandler 0x1DCFE to 0x1DD01 = Adjustment to powerup sprite attribute pointer for powerups having an alternate set of attributes 0x1DD02 to 0x1DD3B = JSR equipped sub-weapon SpriteHandler for status bar 0x1DD3C to 0x1DD41 = Sub-weapon animation frame for status bar 0x1DD42 to 0x1DD72 = Enemy Action Loop. Loops X times per frame, calling the enemy handler if it finds an active enemy in a slot. 0x1DD73 to 0x1DD7B = # of enemy actions per frame. Originally intended to be dependent on the total # of enemies on-screen. Instead all values are 07. 0x1DD7C to 0x1DE3A = JSR EnemyHandler 0x1DE3B to 0x1DE4F = JSR TurnEnemyTowardRyu 0x1DE50 to 0x1DE69 = JSR TurnOtherEnemyTowardRyu (direction stored directly to $0440 array value, not to $007A as in the previous function) 0x1DE6A to 0x1DE8A = JSR MoveEnemyTowardRyu 0x1DE8B to 0x1DEDE = JSR invincibilityEnemyCollision 0x1DEDF to 0x1DF49 = JSR swordEnemyCollision 0x1DF4A to 0x1DF96 = JSR EnemyDeath 0x1DF97 to 0x1DFA6 = JSR EnemyPlatformAhead (Returns nonzero result if a platform is in front of the enemy, according to its movement direction) 0x1DFA7 to 0x1DFBA = JSR isEnemyFacingRyu (returns 0(positive) if yes, FF(negative) if not) 0x1DFBB to 0x1DFCC = JSR isEnemyCloseEnough (Returns Carry set if distance between enemy and Ryu is greater than accumulator value, else carry clear) 0x1DFCD to 0x1DFE2 = JSR isEnemyMovingTowardRyu (returns 0(positive) if yes, FF(negative) if not) 0x1DFE3 to 0x1DFF2 = JSR isEnemyWallAhead (Nonzero result if a wall is ahead of the enemy in the direction of its movement) 0x1DFF3 to 0x1DFF8 = code used at conclusion of the isEnemyFacingRyu and isEnemyMovingTowardRyu functions to return 0 or FF. 0x1DFF9 to 0x1E033 = JSR animateEnemy (counts down animation timer and advances to next animation frame if zero) 0x1E034 to 0x1E08A = JSR enemyMovement 0x1E08B to 0x1E131 = JSR enemyEnvironmentCollision 0x1E132 to 0x1E141 = Collision value array used for enemies and powerups. Each byte holds collision flags for a given type of collision tile. 0x1E142 to 0x1E153 = JSR enemyGravity 0x1E154 to 0x1E1CC = JSR enemyHitRyuCollision 0x1E1CD to 0x1E1DD = JSR EnemyReverseXMovement 0x1E1DE to 0x1E242 = JSR projectileHitEnemyCollision 0x1E243 to 0x1E252 = JSR reverseVelocity (coarse speed value in A, fine value in Y) 0x1E253 to 0x1E263 = JSR gotoEnemyAIStage 0x1E264 to 0x1E294 = JSR SetEnemyAnimation 0x1E295 to 0x1E29E = JSR SetEnemyHP 0x1E29F to 0x1E2AD = JSR EnemyJump (sets Y velocity to accumulator value) 0x1E2AE to 0x1E2BE = JSR otherEnemyJump (sets $0498 array flags directly instead of $79 for current enemy). 0x1E2BF to 0x1E2D2 = JSR SpawnEnemy (new enemy slot is returned in X. FF returned if no available slot) 0x1E2D3 to 0x1E319 = JSR deSpawnEnemy 0x1E31A to 0x1E32E = JSR despawnAllEnemies 0x1E32F to 0x1E356 = JSR enemyAccelerateXForward (increases X speed by value in A, in direction enemy is facing) 0x1E357 to 0x1E3C3 = initiateCutSceneCheck (code that skips bosses that have already been defeated in final boss rush is included here) 0x1E3C4 to 0x1E535 = playerDeathHandler 0x1E536 to 0x1E56F = JSR playIntroAndSetupStage1 0x1E570 to 0x1E5C2 = JSR enemySpawnHandler 0x1E5C3 to 0x1E614 = JSR spawnEnemyFromList (Spawns a specific enemy from the list of preset enemies for the current room. If the enemy already exists on-screen, skip) 0x1E615 to 0x1E618 = projectile size list. All projectiles are considered square, so each byte is both the width and height of the projectile in pixels. 0x1E619 to 0x1E61C = projectile damage list. 0x1E61D to 0x1E628 = animation frame list for powerups. 0x1E629 to 0x1E634 = sprite attribute list for powerups. 0x1E635 to 0x1E67E = JSR animateRyu 0x1E67F to 0x1E686 = Bit conversion array (ie Bit 7 = 0x80, bit 6 = 0x40, etc) 0x1E687 to 0x1E791 = JSR RyuEnvironmentCollision 0x1E792 to 0x1E7A1 = Collision value array used for Ryu. Each byte holds collision flags for a given type of collision tile. 0x1E7A2 to 0x1E7DB = JSR getCollisionTypeFromPosition (pass in horizontal position through accumulator, vertical position in $02. 0x1E7DC to 0x1E7EB = Array of starting collision tile column offsets within the current screen (6 collision tiles in a column). 0x1E7EC to 0x1E828 = JSR eraseScreen 0x1E829 to 0x1E842 = JSR getControllerInput 0x1E843 to 0x1E884 = JSR moveRyuWithoutScrolling 0x1E885 to 0x1E89B = JSR specialCollisionTileHandler 0x1E89C to 0x1E8A7 = Functioon pointers for special collision tiles 0x1E8A8 to ------- = RTS (collision tiles A and B are unused, and simply RTS from here if reached). 0x1E8A9 to 0x1E8AF = Code for collision tile C: Goto cut-scene. 0x1E8B0 to 0x1E8E1 = Code for collision tile F: Advance stage. 0x1E8E2 to 0x1E8F9 = Code for collision tile D: Advance room. 0x1E8FA to 0x1E911 = Code for collision tile E: Retreat room. 0x1E912 to 0x1EAD0 = JSR loadRoomProperties 0x1EAD1 to 0x1EB73 = JSR loadStageProperties 0x1EB74 to 0x1EB8A = JSR spriteDrawingHandler 0x1EB8B to 0x1EC69 = Ryu animation, environment collision, and player input handler 0x1EC6A to 0x1EC8A = code to start Ryu freefall (does not appear to be used. Would play a sound effect and allow passing through walls) 0x1EC8B to 0x1ED1C = Player input code when pressing no buttons on the D-pad (also if conflicting buttons are pressed, such as up+down at the same time) 0x1ED1D to 0x1EDC0 = Player input code when pressing right on the D-pad (also down+right, up+right) 0x1EDC1 to 0x1EE64 = Player input code when pressing left on the D-pad (also down+left, up+left) 0x1EE65 to 0x1EEA8 = Player input code when pressing down on the D-pad 0x1EEA9 to 0x1EEF6 = Player input code when pressing up on the D-pad 0x1EEF7 to 0x1EEFF = JSR setNormalMovementSpeed 0x1EF00 to 0x1EF08 = JSR setReducedMovementSpeed (used when attempting to move in the opposite direction Ryu is facing while mid-air) 0x1EF09 to 0x1EF65 = JSR spawnFireWheelProjectile 0x1EF66 to 0x1EFB3 = JSR spawnThrowingStar 0x1EFB4 to 0x1F000 = JSR spawnBoomerangThrowingStar 0x1F001 to 0x1F096 = JSR RyuHitboxSize_and_PlatformResponse 0x1F097 to 0x1F0B6 = Function pointers for player D-pad input 0x1F0B7 to 0x1F102 = JSR RyuSpriteDrawingHandler 0x1F103 to 0x1F11C = JSR fixedPPUTransmissionString 0x1F114 to 0x1F11C = JSR waitForNMI 0x1F11D to 0x1F1A7 = JSR enemySpriteDrawingHandler 0x1F1A8 to 0x1F1BB = JSR waitForSprite0HitToChangeCHR (this function does not appear to be used. It is similar to $F5A2, but does not set the scroll for the level environment. 0x1F1BC to 0x1F22B = Player X movement and stage scrolling handler 0x1F22C to 0x1F35F = scrollStageRight 0x1F360 to 0x1F48D = scrollStageLeft 0x1F48E to 0x1F54D = Code to setup a column of tiles to transmit to PPU during stage scrolling 0x1F54E to 0x1F5AB = JSR copy4by2TilesToPPUTransmission 0x1F5AC to 0x1F5B1 = array of offsets into a PPU transmission to store palette data bytes when setting up tile data to transmit for scrolling. 0x1F5B2 to 0x1F5F9 = Status bar sprite 0 hit handler 0x1F5FA to 0x1F63C = JSR copyCollisionDataFromROM (stores collision data for the current room into the array at $0300-$03BF) 0x1F63D to 0x1F662 = JSR setRyuAnimation 0x1F663 to 0x1F69B = JSR fadeInNewStage 0x1F69C to 0x1F6C4 = JSR fadeOutStage 0x1F6C5 to 0x1F754 = JSR setupLevelPalettes 0x1F755 to 0x1F777 = JSR copyPaletteToPPUTransmission 0x1F778 to 0x1F78B = JSR clearAllSprites 0x1F78C to 0x1F7F3 = JSR drawSprite 0x1F7F4 to 0x1F840 = JSR updateStatusBar 0x1F841 to 0x1F84D = updateScoreDisplay 0x1F84E to 0x1F85F = updateTimeDisplay 0x1F860 to 0x1F86C = updateNinjaPowerDisplay 0x1F86D to 0x1F879 = updateLivesDisplay 0x1F87A to 0x1F87E = updateRyuHealthDisplay (shares code with boss health display) 0x1F87F to 0x1F8A0 = updateBossHealthDisplay 0x1F8A1 to 0x1F8E1 = convertHexToDecimalPPUTransmission 0x1F8E2 to 0x1F8E7 = # of tiles for each type of status bar update 0x1F8E8 to 0x1F8ED = Low byte of PPU address for each type of status bar update 0x1F8EE to 0x1F8F3 = Offset to write null terminator in PPU transmission string for each type of status bar update 0x1F8F4 to 0x1F8FF = Function pointers for updating status bar 0x1F900 to 0x1F929 = JSR blackOutPalettes 0x1F92A to 0x1FA2F = NMI handler 0x1FA30 to 0x1FC0F = unused 0x1FC10 to 0x1FC0F = kick drum PCM data 0x1FD10 to 0x1FF0F = snare drum PCM data 0x1FF10 to 0x1FFE9 = unused 0x1FFEA to 0x1FFEF = Reset vector code. 0x1FFF0 to 0x20009 = unused 0x2000A to 0x2000F = Interrupt vectors.
0x0F7DC to 0x0F7EA = Jump 0x0FB50 to 0x0FB61 = Sword Attack 0x0FADD to 0x0FB03 = Pause sound 0x0F96F to 0x0F9A7 = Gun 0x0F83A to 0x0F860 = Spin slash 0x0FC5B to 0x0FC89 = Bomb 0x0F671 to 0x0F6DA = Take damage 0x0F708 to 0x0F746 = Pick up item 0x0F747 to 0x0F77B = 1up pick sound 0x0F77C to 0x0F7C4 = HP pick sound 0x0F7C5 to 0x0F7DB = Invincibility pickup sound 0x0F861 to 0x0F874 = Time stopped sound
0x0F931 to 0x0F959 = Soldier (Machine Gun) 0x0F96F to 0x0F9A7 = Soldier (Crouch + Gun) 0x0F83A to 0x0F860 = Stone Man 0x0F7DC to 0x0F802 = Orb Thrower 0x0F652 to 0x0F660 = Knife Dropper 0x0F96F to 0x0F9A7 = Shoot&Defend 0x0F803 to 0x0F839 = Lightning summoner 0x0FC28 to 0x0FC5A = T-Ray - jump sound 0x0FC28 to 0x0FC5A = Mutants - jump sound 0x0F815 to 0x0F839 = Carnage Axe sound 0x0F875 to 0x0F8C1 = Carnage Axe sound 0x0F8C2 to 0x0F930 = Ajax fireballs 0x0F83A to 0x0F860 = Controller 0x0F95A to 0x0F96E = Death 0x0F815 to 0x0F839 = Mephisto fireballs 0x0F875 to 0x0F8C1 = Mephisto fireballs 0x0F803 to 0x0F839 = Doom - balls sound 0x0F803 to 0x0F839 = lightning sound 0x0FB50 to 0x0FB5D = Ryu hits boss sound 0x0FC15 to 0x0FC27 = boss dies sound
0x0FB39 to 0x0FB5A = When Ryu's dad running at the beginning [legs sound] 0x0FC5B to 0x0FC89 = Ryu turns forward Death 0x0FB13 to 0x0FB38 = Ryu looks Death with image going gray 0x0F8C2 to 0x0F930 = ???? 0x0FBB9 to 0x0FC14 = Helicopter sound before stage 4 0x0FB6F to 0x0FB8F = Ryu falls beginning scene 0x0FB90 to 0x0FBB8 = Girl shot Ryu bullet sound 0x0FC28 to 0x0FE0C = Mephisto raise (image 5) / Castle fall
Square and triangle
$7F(Pulse / Triangle): Inputs a note.
- High nybble is the octave
- Low nybble is the pitch name (
is used for note rest.
00 - C-1 01 - C#1 02 - D-1 03 - D#1 04 - E-1 05 - F-1 06 - F#1 07 - G-1 08 - G#1 09 - A-1 0A - A#1 0B - B-1 0C - Rest
00 - C-1 10 - C-2 20 - C-3 30 - C-4 40 - C-5 50 - C-6 60 - C-7 70 - C-8
$10(Noise): Inputs a note.
$10is used for note rest.
00 - F-# 01 - E-# 02 - D-# 03 - C-# 04 - B-# 05 - A-# 06 - 9-# 07 - 8-# 08 - 7-# 09 - 6-# 0A - 5-# 0B - 4-# 0C - 3-# 0D - 2-# 0E - 1-# 0F - 0-# 10 - Rest
Sound Engine Commands
80 - AF: Sets the note duration using the tick count table at $8586. The sound engine does not have the concept of tempo, all time control must be done through ticks. The following length values are actually used: 80 90 A0 00 01 02 03 04 05 06 07 08 09 0A 0C 0E 0F 10 12 14 15 18 1B 1C 1E 20 24 28 2A 30 36 38 3C 40 48 50 54 60 6C 70 80 90 C0 FF E0 xx: Uses the volume envelope selected from the table at $85B1. Each volume envelope is defined by length-value pairs; the last item has a length of FF. 23 volume envelopes are defined. E2 xx: Sets the duty cycle of the pulse tracks. 00 / 40 / 80 / C0 corresponds to 12.5% / 25% / 50% / 75% respectively. E3 xx: Reduces the output volume of the track by (xx + 1). E4 xx: (used in sound effects only, controls the pulse hardware sweep unit) E5 xx: Detune, operates by adding xx, unsigned, to the period register. Higher value means more downward detune; there is no way to detune upwards. E8 xxxx: Unconditionally moves the track pointer to xxxx. Used for looping a song or sharing entire streams between tracks. E9 xxxx: Invokes the pattern at xxxx. Patterns can be nested once within other patterns. EA: Returns from a pattern. EB xx: Starts a local loop that plays the contents xx times. Like patterns, they can be nested once. EC: Ends a local loop. ED: Enables vibrato. EF: Disables vibrato. F8: (used in sound effects only). This enables the DPCM channel F9: (used in sound effects only, seems to silence the DPCM channel) FA xx yy zz: Plays a DPCM sample by writing xx, yy, zz to $4010, $4012, and $4013 respectively; does not interrupt currently playing samples. Unless you are planning to add your own samples, the only parameters that appear in the game are 0F F0 10 for kick, and 0F F4 20 for snare. FB xx yy zz: As above, but will interrupt playing samples. FE xx: Causes the track to fade out by reducing the final volume by 1 per xx ticks. FF: Ends the current track. Channel data: 00: pulse1 (sfx) 01: pulse2 (sfx) 02: Triangle (music) 03: noise (sfx) 04: pulse1 (music) 05: pulse2 (music) 06: DPCM (music) 07: Noise (music)
Sound effect structure
The sound effect data has two parts: a segment for pointers and a part for the music data. Both are terminates with
. For example: the menu sound effect starts with
04 88 55. The first byte has to do with the sound channel (this needs more research), however, the last two bytes translates to a pointer in Little Endian. Here's how to compute the pointer:
The pointer points to
FF. The game's sound engine uses this pointer in particular to disable sound channels. The menu sound effect is one example of this. If you disable sound channels with this method, they won't enable back.
This is Ryu's slash:
Bytes: 03 44 BB FF E0 00 E3 00 81 ---------------------------------------------------------------------------------------------------------- Value: Noise chnl pointer for SFX Delimiter Volme env 0 Volume Full volumeSpeed 1 Bytes: 0A 08 82 06 05 83 01 FF ----------------------------------------------------------------------------------------------- Value: 5-# 7-# Speed 2 9-# A-# Speed 3 C#1 END
|Internal Data for Ninja Gaiden|