data/claims/dkc-av.yamlDonkey Kong Country graphics and sound (Yoshifanatic's disassembly)
Game: Donkey Kong Country.
In the first US release, each sprite pose is one block in ROM: an 8-byte header, then 2 bytes per piece (its X, then its Y), then the pose's tiles, which the game sends to video memory as they stand, 32 bytes a tile (dkc-av/sprite-pose-upload). Header byte 0 counts the large pieces; bytes 1 and 3 count two groups of small pieces, and bytes 2 and 4 give each group's first tile number, counted from the sprite's own tile base. Each large piece's tile number is 2 past the last, plus 16 more on reaching a multiple of 16, so from a base that is a multiple of 16 eight large pieces fill each pair of tile rows (computed); each small piece's is 1 past the last. Large pieces get both of a sprite's two extra bits in the sprite table, the second as the size bit; small pieces get the second bit never. A piece whose Y comes out at $F0 or more after the sprite's offset is added is left out of the frame, and the first extra bit, the ninth X bit, is kept only when X passes 255. dkc-av/sprite-pose-format
About: Donkey Kong Country Metasprites
Value: header bytes 8 · bytes per piece 2 · bytes per tile 32
CodeDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly ·DKC1/Routine_Macros_DKC1.asm#L76180-L76190CODE_BBA7A5: TXA STA.w !RAM_DKC1_NorSpr_RAMTable0CDDLo,y BEQ.b CODE_BBA7C9 LDA.l DATA_BBCC9C,x STA.b $5A INC STA.b $5E LDA.l DATA_BBCC9C+$02,x STA.b $5C STA.b $60Our readingpose 0: draw nothing76181–76183the pose number indexes a table of pointers to pose blocks76184$5A points at the block; $5E one byte on, at the Y coordinates76185–76190Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L76563-L76576CODE_BBAADF: LDY.w #$0000 LDA.b [$5A],y STA.b $50 LDY.w #$0002 LDA.b [$5A],y STA.b $52 LDY.w #$0004 LDA.b [$5A],y STA.b $54 LDY.w #$0006 LDA.b [$5A],y STA.b $56 LDY.w #$0008Our readingcopy the 8 header bytes to $50-$5776564–76575the piece list starts at byte 876576Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L76539-L76540 — masks for a sprite's pair of extra bits, four sprites to a byte; the first four set both bits, the rest the first onlyDATA_BBAA40: db $03,$0C,$30,$C0,$01,$04,$10,$40Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L76589-L76599CODE_BBAB0F: TXA LSR LSR AND.b #$1F STA.b $6E TXA AND.b #$03 TAX LDA.w DATA_BBAA40,x STA.b $58Our readingthe large pieces' mask: both bits of the sprite's pair76595–76599Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L76602-L76659CODE_BBAB22: DEC.b $50 BMI.b CODE_BBAB80 LDA.b [$5E],y REP.b #$20 AND.w #$00FF ADC.b $92 CMP.w #$00F0 BCS.b CODE_BBAB6B … LDA.b [$5A],y AND.w #$00FF CLC ADC.b $90 CMP.w #$0100 SEP.b #$20 STA.b DKC1_Global_OAMBuffer[$00].XDisp,x LDA.b $58 BCS.b CODE_BBAB4E AND.b #$AA CODE_BBAB4E: ORA.b ($6E) STA.b ($6E) … LDA.b $4E STA.b DKC1_Global_OAMBuffer[$00].Tile,x … CODE_BBAB6B: CLC LDA.b $4E INC INC BIT.w #$0010 BEQ.b CODE_BBAB78 ADC.w #$0010 CODE_BBAB78: STA.b $4E SEP.b #$20 INY INY BRA.b CODE_BBAB22Our readingfor each of byte 0's large pieces76603–76604 Y = the piece's Y byte + the sprite's offset; at $F0 or more, skip the piece76605–76610 X = the piece's X byte + the sprite's offset76613–76619 X below 256: drop the first bit of each pair, keeping the second76620–76622 write the bits into the sprite table's extra bits76623–76625 write the tile number76639–76640 tile number + 2; on reaching a multiple of 16, add 16 more76646–76652 next piece, 2 bytes on76654–76658Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L76673-L76727CODE_BBAB93: LDA.b $52 CLC ADC.b $4C STA.b $4E CODE_BBAB9A: DEC.b $51 BMI.b CODE_BBABEF … LDA.w DATA_BBAA40+$04,x ORA.b ($6E) STA.b ($6E) … CODE_BBABE7: INC.b $4E SEP.b #$20 INY INY BRA.b CODE_BBAB9AOur readingthe first small group starts at the base tile + byte 276674–76677for each of byte 1's pieces76679–76680 the only extra-bit write: the first bit of the pair76709–76711 tile number + 1, next piece76722–76726Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L76741-L76747CODE_BBAC02: LDA.b $54 CLC ADC.b $4C STA.b $4E CODE_BBAC09: DEC.b $53Our readingthe second small group starts at the base tile + byte 4, for byte 3's pieces76742–76747In the first US release, a sprite's tiles go to video memory only when its pose changes: the game queues one transfer of header byte 5 × 32 bytes, read straight from the pose's block in ROM after its piece list, to video memory at the sprite's own tile base, and a second of byte 7's low four bits × 32 bytes, landing byte 6 × 16 words further on, when that count isn't 0. A later routine runs the queue as DMA transfers to video memory. The queue has a limit on uploads; at or past it, nothing is queued, and poses from number 141 up are drawn as the pose last uploaded. CodePPU registers · OBJSEL - Object size and Character address ($2101 write) — object size setting 0, which several screen setups write (DKC1/Routine_Macros_DKC1.asm line 6878 and others)0: 8x8 and 16x16Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/AsarScripts/AssetPointersAndFiles.asm#L121-L121 — the asset table that lists the poses' tile blocks, one file per pose, from here to line 3004DynamicSpriteGFXPointersStart:Checked by claude-agent, 2026-11-08 — read the pose lookup in CODE_BBA772, CODE_BBAADF's header read, its three piece loops with their extra-bit writes and tile steps, and the mask table; checked the header against the pose block at $8A:B534, which the disassembly files as K. Rool's first run frame (15 large pieces, 2 and 10 small at $2E and $3E, a first transfer of $48 tiles = $900 bytes, the size its incbin comment gives)Revised after a check by a second AI model, 2026-11-08.With object size setting 0 the two sizes are 8×8 and 16×16 (snesdev-ppu-registers), which the tile steps fit: a large piece takes a 2×2 square of tiles. Which size setting holds during levels, and the sprite table's bit layout, aren't read here. The disassembly's own extraction script (AsarScripts/ExtractOAMData.asm) sizes a pose the same way: 8 + 2 × (byte 0 + byte 1 + byte 3) header bytes and byte 0 × 128 + (byte 1 + byte 3) × 32 tile bytes. Its asset table lists 2,882 pose files (counted).
In the first US release, a sprite's tiles go to video memory only when its pose changes: the game queues one transfer of header byte 5 × 32 bytes, read straight from the pose's block in ROM after its piece list, to video memory at the sprite's own tile base, and a second of byte 7's low four bits × 32 bytes, landing byte 6 × 16 words further on, when that count isn't 0. A later routine runs the queue as DMA transfers to video memory. The queue has a limit on uploads; at or past it, nothing is queued, and poses from number 141 up are drawn as the pose last uploaded. dkc-av/sprite-pose-upload
About: Donkey Kong Country Metasprites
CodeDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly ·DKC1/Routine_Macros_DKC1.asm#L76166-L76179LDX.w !RAM_DKC1_NorSpr_CurrentPoseLo,y BEQ.b CODE_BBA7C9 LDA.w $170D CMP.b $3C BCC.b CODE_BBA7A5 CPX.w #$008D BCC.b CODE_BBA7A5 LDX.w !RAM_DKC1_NorSpr_DisplayedPoseLo,yOur readingno pose: draw nothing76172–76173queue below its limit, or pose below 141: draw the current pose76174–76178otherwise draw the pose last uploaded76179Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L76191-L76266LDA.w $170D CMP.b $3C BCC.b CODE_BBA7CB CODE_BBA7C9: PLB RTL CODE_BBA7CB: LDA.w !RAM_DKC1_NorSpr_CurrentPoseLo,x CMP.w !RAM_DKC1_NorSpr_DisplayedPoseLo,x BEQ.b CODE_BBA7C9 STA.w !RAM_DKC1_NorSpr_DisplayedPoseLo,x LDX.w $170D TYA CLC ADC.b $5A STA.w DKC1_NorSpr_GraphicsDMATable[$00].SourceLo,x LDA.b $55 AND.w #$00FF ASL ASL ASL ASL ASL STA.w DKC1_NorSpr_GraphicsDMATable[$00].SizeLo,x ADC.w DKC1_NorSpr_GraphicsDMATable[$00].SourceLo,x TAY LDA.b $4C AND.w #$01FF ASL ASL ASL ASL STA.w DKC1_NorSpr_GraphicsDMATable[$00].VRAMAddressLo,x LDA.b $5C ORA.w #$FF00 STA.w DKC1_NorSpr_GraphicsDMATable[$00].SourceBank,x LDA.b $57 AND.w #$000F BNE.b CODE_BBA818 … CODE_BBA818: ASL ASL ASL ASL ASL STA.w DKC1_NorSpr_GraphicsDMATable[$01].SizeLo,x … LDA.b $56 AND.w #$00FF ASL ASL ASL ASL ADC.w DKC1_NorSpr_GraphicsDMATable[$00].VRAMAddressLo,x STA.w DKC1_NorSpr_GraphicsDMATable[$01].VRAMAddressLo,x TYA STA.w DKC1_NorSpr_GraphicsDMATable[$01].SourceLo,xOur readingqueue at or past its limit: stop76194–76199pose unchanged since the last upload: stop76201–76204record the pose as uploaded76205source = the block's address + the header and piece list's length76207–76210size = byte 5 × 3276211–76218video memory address = the sprite's tile base × 16 words76221–76227bank from the block's pointer76228–76230byte 7's low four bits 0: one transfer only76231–76233else a second: byte 7 × 32 bytes, from where the first ends, to byte 6 × 16 words past the first76242–76264Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L15928-L15953CODE_818CB0: LDA.w #(!REGISTER_WriteToVRAMPortLo&$0000FF<<8)+$01 STA.w DMA[$00].Parameters … CODE_818CBC: LDA.w DKC1_NorSpr_GraphicsDMATable[$00].SourceBank,x BPL.b CODE_818CE4 STA.w DMA[$00].SourceBank LDA.w DKC1_NorSpr_GraphicsDMATable[$00].SizeLo,x STA.w DMA[$00].SizeLo LDA.w DKC1_NorSpr_GraphicsDMATable[$00].VRAMAddressLo,x STA.w !REGISTER_VRAMAddressLo LDA.w DKC1_NorSpr_GraphicsDMATable[$00].SourceLo,x STA.w DMA[$00].SourceLo STZ.w DKC1_NorSpr_GraphicsDMATable[$00].SourceBank,x STY.w !REGISTER_DMAEnableOur readingDMA channel 0 writes the video memory data port15929–15930for each queued transfer: set bank, size, address, source, clear the entry, start15935–15950an entry whose bank word isn't negative ends the queue15935–15936Checked by claude-agent, 2026-11-08 — read CODE_BBA772 through CODE_BBA818 and the queue runner CODE_818CB0; the source is the ROM pointer from the pose table plus the header's length, with no decompression step betweenRevised after a check by a second AI model, 2026-11-08.The limit is the value at $3C, compared with the queue's fill at $170D; pose 141 is $8D.
In the first US release, sprites draw from eight palette slots of 15 colors each: the game copies 30 bytes per palette to color memory at entry 129 + 16 × the slot (computed), leaving the 16-color block's first entry alone. A sprite asks for a palette by its address. A slot that holds that palette and whose use count isn't negative is shared, and its count goes up; a holder whose count is negative is passed over. Without a match, the first empty slot takes the palette and its upload joins a queue of 16, from which each call of the upload routine sends one. With neither, the sprite gets slot 0 and the request is kept with a retry value of 120 (computed), whose unit isn't read. In one mode, set by a flag the code tests, the colors come from a copy in RAM laid out like the ROM's palette area instead of from ROM. dkc-av/sprite-palettes
About: Donkey Kong Country Palette swap
Value: slots 8 · colors 15 · bytes 30 · queue 16
CodeDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly ·DKC1/Routine_Macros_DKC1.asm#L90682-L90722CODE_BDF1F4: STA.b $8C LDX.w #$FFFE CODE_BDF1F9: INX INX CPX.w #$0010 BEQ.b CODE_BDF22B LDA.w !RAM_DKC1_Global_CurrentlyLoadedSpritePalettePtrsLo,x BEQ.b CODE_BDF210 CMP.b $8C BNE.b CODE_BDF1F9 LDA.w $1AE3,x BMI.b CODE_BDF1F9 BRA.b CODE_BDF225 CODE_BDF210: STX.b $76 CODE_BDF212: INX INX CPX.w #$0010 BEQ.b CODE_BDF266 … CODE_BDF225: INC.w $1AE3,x TXA XBA RTS CODE_BDF22B: LDA.w #$0078 STA.w $1E3D LDA.b $8C STA.w $1E35 LDA.w #$0000 RTSOur readingfor each of the 8 slots (2 bytes each)90685–90689 empty: remember it as the free slot, then keep looking for a match @90690-90691,90699–90709 holds this palette: check its use count90692–90694 count negative: pass it over90695 else share it90696a match: count + 1, return the slot90711–90714no match, a free slot: load the palette there90703–90704no match and no free slot: $1E3D = $78, keep the request, return slot 0 @90689,90717–90722Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L90749-L90808CODE_BDF266: LDA.w $1E15 AND.w #$0010 BNE.b CODE_BDF2A0 LDA.w $1AD1 ASL ASL TAX LDA.b $8C STA.w DKC1_NorSpr_SpritePaletteUploadTable[$00].PtrLo,x LDA.b $76 ASL ASL ASL CLC ADC.w #$0081 XBA … LDA.w $1AD1 INC AND.w #$000F STA.w $1AD1 LDX.b $76 INC.w $1AE3,x LDA.b $8C STA.w !RAM_DKC1_Global_CurrentlyLoadedSpritePalettePtrsLo,x … CODE_BDF2A0: … ADC.w #!RAM_DKC1_Level_SpritePaletteBuffer-(DATA_BC81CC&$00FFFF)Our readingbit $10 of $1E15 set: the RAM-copy path90750–90752queue the palette's address, with color entry $81 + 16 × slot90753–90766the queue index wraps at 1690768–90771count the slot's use, record which palette it holds90772–90775RAM path: the same, from $7F2779 + (the palette's address - $81CC)90780–90806Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L4119-L4146CODE_80A2CD: STZ.w $1E43 LDA.w $1ACF CMP.w $1AD1 BEQ.b CODE_80A32A ASL ASL TAX LDA.w $1ACF INC AND.w #$000F STA.w $1ACF … LDA.w #(!REGISTER_WriteToCGRAMPort&$0000FF<<8)+$00 STA.w DMA[$00].Parameters LDA.w #$001E STA.w DMA[$00].SizeLo … XBA STA.w !REGISTER_CGRAMAddress LDA.b #$01 STA.w !REGISTER_DMAEnableOur readingqueue empty: nothing to do4121–4123take the next entry; the read index wraps at 164124–4130DMA 30 bytes to color memory at the entry's color number4131–4146Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/RAM_Map_DKC1.asm#L207-L207!RAM_DKC1_Level_SpritePaletteBuffer = $7F2779Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/AsarScripts/AssetPointersAndFiles.asm#L3439-L3439 — the asset table's first sprite palette, at $FC:81CC, 30 bytesdl $FC81CC,$FC81EA,PAL_Sprite_UnknownPalette1,PAL_Sprite_UnknownPalette1EndChecked by claude-agent, 2026-11-08 — read the palette request routine CODE_BDF1F4 and its loader CODE_BDF266/CODE_BDF2A0, and the queue's upload CODE_80A2CDRevised after a check by a second AI model, 2026-11-08.Entry 129 is $81. The mode flag is bit $10 of the word at $1E15; in it the colors are read from $7F2779 + (the palette's address − $81CC), $FC:81CC being the asset table's first sprite palette. The request is kept at $1E35 and the value 120 ($78) at $1E3D.
In the first US release, the two Kongs' palettes are swapped by which Kong the game has as current. When the word the disassembly names the current Kong is 1, the palette the disassembly files as Donkey Kong's active one goes to the sprite a first Kong slot names, and Diddy's inactive one to sprite 4; otherwise Diddy's active one goes to the sprite a second slot names and Donkey Kong's inactive one to sprite 2. A slot holding 0 falls back to sprite 2 or 4. Under one condition, read but not identified, all four move two palettes on, to the ones the disassembly files as the Kongs' P2 palettes. dkc-av/kong-palettes
About: Donkey Kong Country Palette swap
CodeDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly ·DKC1/Routine_Macros_DKC1.asm#L64097-L64147CODE_B880D2: STZ.b $4C LDA.b $42 CMP.w #$0002 BNE.b CODE_B880E4 LDA.b $44 BEQ.b CODE_B880E4 LDA.w #$003C STA.b $4C CODE_B880E4: LDA.w !RAM_DKC1_Player_CurrentKongLo CMP.w #$0001 BEQ.b CODE_B8810A LDX.w #$0004 JSR.w CODE_B88128 LDA.w #DATA_BC8422 CLC ADC.b $4C JSL.l CODE_BDF254 LDX.w #$0002 LDA.w #DATA_BC84B8 CLC ADC.b $4C JSL.l CODE_BDF254 RTS CODE_B8810A: LDX.w #$0002 JSR.w CODE_B88128 LDA.w #DATA_BC849A CLC ADC.b $4C JSL.l CODE_BDF254 LDX.w #$0004 LDA.w #DATA_BC8440 CLC ADC.b $4C JSL.l CODE_BDF254 RTS CODE_B88128: TXY DEY DEY LDA.w $0512,y BNE.b CODE_B88131 RTS CODE_B88131: TAX RTSOur readingoffset 0, or 60 bytes when $42 is 2 and $44 isn't 064098–64105current Kong 1:64107–64109 the sprite $0512 names (sprite 2 if it holds 0) gets $849A + offset64124–64129 sprite 4 gets $8440 + offset64130–64134otherwise: the sprite $0514 names (sprite 4 if it holds 0) gets $8422 + offset64110–64115 sprite 2 gets $84B8 + offset64116–64120the slot lookup: the word at $0512 + (the fallback - 2); nonzero replaces it64138–64146Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L90739-L90747CODE_BDF254: STA.b $8C LDA.w !RAM_DKC1_NorSpr_YXPPCCCTLo,x XBA AND.w #$000E STA.b $76 JSR.w CODE_BDF266 DEC.w $1AE3,x RTLOur readingload the palette into the sprite's own slot, from its attribute word90740–90745without counting another use of the slot90746Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L80432-L80448 — the disassembly's names for the palette files; each Kong's two P2 palettes sit 60 bytes past the first twoDATA_BC8422: incbin "Palettes/Sprite_Diddy_Active.bin" DATA_BC8440: incbin "Palettes/Sprite_Diddy_Inactive.bin" DATA_BC845E: incbin "Palettes/Sprite_Diddy_P2Active.bin" DATA_BC847C: incbin "Palettes/Sprite_Diddy_P2Inactive.bin" DATA_BC849A: incbin "Palettes/Sprite_DonkeyKong_Active.bin" DATA_BC84B8: incbin "Palettes/Sprite_DonkeyKong_Inactive.bin"Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/AsarScripts/AssetPointersAndFiles.asm#L3459-L3464 — the files' places in ROM, in bank FC, 30 bytes eachdl $FC8422,$FC8440,PAL_Sprite_Diddy_Active,PAL_Sprite_Diddy_ActiveEnd … dl $FC84B8,$FC84D6,PAL_Sprite_DonkeyKong_Inactive,PAL_Sprite_DonkeyKong_InactiveEndDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/RAM_Map_DKC1.asm#L55-L55!RAM_DKC1_Player_CurrentKongLo = $00056FChecked by claude-agent, 2026-11-08 — read CODE_B880D2 to CODE_B88131 and CODE_BDF254; only the first palette in each branch goes through the slot lookup, the second to a fixed sprite number; the palettes and their order are the incbin lines in bank FC and the asset table's addressesRevised after a check by a second AI model, 2026-11-08.The slots are $0512 (first) and $0514 (second); the palettes are $FC:849A (Donkey Kong active), $FC:8440 (Diddy inactive), $FC:8422 (Diddy active) and $FC:84B8 (Donkey Kong inactive). The condition is the word at $42 being 2 and the one at $44 not 0, and it adds 60 bytes. A new game sets the current Kong word to 1 (DKC1/Routine_Macros_DKC1.asm#L64320-L64321).
In the first US release, each animation is a script of entries, each a length byte below 128 followed by a 2-byte pose number. Each frame the game takes the sprite's animation speed from its timer; when the timer reaches 0 or less it adds the next entry's length × 256 and shows that entry's pose, so at the speed an animation starts with a length counts frames (computed). An entry that leaves the timer still negative is passed over, so a higher speed can skip poses. A byte from 128 up is a command: the first restarts the animation from its first entry, and the second calls a routine named by a 3-byte address. dkc-av/animation-scripts
About: Donkey Kong Country Metasprites
CodeDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly ·DKC1/Routine_Macros_DKC1.asm#L93271-L93289CODE_BE80AF: PHK PLB LDX.b !RAM_DKC1_NorSpr_CurrentIndexLo STA.w !RAM_DKC1_NorSpr_AnimationIDLo,x TAY LDA.w #$0100 STA.w !RAM_DKC1_NorSpr_AnimationSpeedLo,x STZ.w !RAM_DKC1_NorSpr_DisplayCurrentPoseTimerLo,x … LDA.l DATA_BE8572,x TYX STA.w !RAM_DKC1_NorSpr_AnimationScriptIndexLo,x TAY BRA.b CODE_BE80F6Our readingstarting an animation: speed $0100, timer 093274–93279the script's address from the table at $BE8572, by animation number93281–93288Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L93300-L93381CODE_BE80E1: LDX.b !RAM_DKC1_NorSpr_CurrentIndexLo LDA.w !RAM_DKC1_NorSpr_DisplayCurrentPoseTimerLo,x SEC SBC.w !RAM_DKC1_NorSpr_AnimationSpeedLo,x STA.w !RAM_DKC1_NorSpr_DisplayCurrentPoseTimerLo,x BEQ.b CODE_BE80F1 BPL.b CODE_BE812E … CODE_BE80F6: DEY LDA.w $0000,y BMI.b CODE_BE813E AND.w #$FF00 CLC ADC.w !RAM_DKC1_NorSpr_DisplayCurrentPoseTimerLo,x STA.w !RAM_DKC1_NorSpr_DisplayCurrentPoseTimerLo,x BPL.b CODE_BE8120 INY INY INY INY BRA.b CODE_BE80F6 … CODE_BE8120: INY INY LDA.w $0000,y STA.w !RAM_DKC1_NorSpr_CurrentPoseLo,x INY INY TYA STA.w !RAM_DKC1_NorSpr_AnimationScriptIndexLo,x … CODE_BE813E: AND.w #$FF00 INY XBA SEC SBC.w #$0080 ASL TAX JMP.w (DATA_BE83CD,x) CODE_BE814C: LDX.b !RAM_DKC1_NorSpr_CurrentIndexLo LDA.w !RAM_DKC1_NorSpr_AnimationIDLo,x ASL TXY TAX LDA.l DATA_BE8572,xOur readingtimer -= speed; still above 0: keep the pose93301–93307next byte from $80 up: a command93313–93315timer += length × 25693316–93319still negative: pass over this entry93320–93324else show the entry's pose and move past it93342–93348a command: jump through the command table93362–93369command $80: back to the script's start93372–93378Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L93719-L93723 — the disassembly's comments; the $80 handler, CODE_BE814C, starts the script overDATA_BE83CD: ; Script commands ; XX < 80 - Display pose for XX time. dw CODE_BE814C ; 80 - End animation dw CODE_BE815F ; 81 - Execute subroutine (24-bit pointer)Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L93383-L93398CODE_BE815F: LDX.b !RAM_DKC1_NorSpr_CurrentIndexLo INY LDA.w $0000,y STA.b $7A INY INY LDA.w $0000,y STA.b $7C … JMP.w [$007A]Our readingcommand $81: call the routine at the next 3 bytes93384–93398Checked by claude-agent, 2026-11-08 — read the animation start CODE_BE80AF, the stepper CODE_BE80E1 through CODE_BE8120, the command dispatch, and the $80 and $81 handlersRevised after a check by a second AI model, 2026-11-08.An animation starts at speed $0100, one length unit taken off each frame. The two commands are $80 (restart) and $81 (call); the command table holds more, unread here.
In the first US release, eight looping animations of the two Kongs list these pose entries before their restart command (counted, computed). At the speed an animation starts with, the lengths add up to the frames one pass takes (computed), as long as the routines the scripts call (commands $81, $83 and $84, unread) leave the speed and the script alone. The animations the disassembly names Donkey Kong's walk and run each step through 20 poses, one length unit apiece; the ones it names Diddy's walk and run have 16 and 13 poses, two units apiece. dkc-av/kong-animation-frames
About: Donkey Kong Country Metasprites
CodeDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly ·DKC1/Routine_Macros_DKC1.asm#L93972-L93986 — the animation table; entries 2, 3, 6, $15, $18, $69, $6A, $6BDATA_BE8572: dw DATA_BE8C41,DATA_BEA10E,DATA_BE9DE7,DATA_BE9F40,DATA_BEA8E3,DATA_BEA6A9,DATA_BEA8AA,DATA_BEA5E0 … dw DATA_BE984F,DATA_BE97B4,DATA_BE97F3,DATA_BE97CF,DATA_BE9776,DATA_BE974C,DATA_BE96AE,DATA_BE95F6 dw DATA_BE927E, … dw DATA_BEA661,DATA_BEAEFE,DATA_BEB720,DATA_BEB0DEDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L96184-L96216DATA_BE9DE7: %DKC1_AnS1_OpXX($01, $033C) … %DKC1_AnS1_OpXX($01, $037C) %DKC1_AnS1_Op81(CODE_BE9E5F) %DKC1_AnS1_OpXX($01, $0330) %DKC1_AnS1_OpXX($01, $0334) %DKC1_AnS1_OpXX($01, $0338) %DKC1_AnS1_Op80()Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L96350-L96387DATA_BE9F40: %DKC1_AnS1_OpXX($01, $00E0) … %DKC1_AnS1_OpXX($01, $012C) %DKC1_AnS1_Op81(CODE_BE9FE1) %DKC1_AnS1_Op80()Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L97328-L97335DATA_BEA8AA: %DKC1_AnS1_OpXX($02, $0180) %DKC1_AnS1_OpXX($02, $0184) %DKC1_AnS1_Op81(CODE_BEA8CF) %DKC1_AnS1_OpXX($02, $0184) %DKC1_AnS1_OpXX($02, $0180) %DKC1_AnS1_Op81(CODE_BEA8C7) %DKC1_AnS1_Op80()Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L95470-L95484DATA_BE974C: %DKC1_AnS1_OpXX($02, $0158) %DKC1_AnS1_Op83(CODE_BE852C) %DKC1_AnS1_OpXX($01, $015C) … %DKC1_AnS1_OpXX($02, $017C) %DKC1_AnS1_Op81(CODE_BE9CA0) %DKC1_AnS1_Op80()Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L94980-L94995DATA_BE927E: %DKC1_AnS1_Op84(CODE_BE94A7) %DKC1_AnS1_OpXX($03, $04B8) %DKC1_AnS1_OpXX($03, $04C0) … %DKC1_AnS1_OpXX($03, $04EC) %DKC1_AnS1_Op80()Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L97928-L98001DATA_BEAEFE: %DKC1_AnS1_Op84(CODE_BEA592) %DKC1_AnS1_OpXX($04, $0954) … %DKC1_AnS1_OpXX($04, $0F5C) %DKC1_AnS1_Op80()Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L98714-L98736DATA_BEB720: %DKC1_AnS1_OpXX($02, $09EC) %DKC1_AnS1_OpXX($02, $09F0) … %DKC1_AnS1_OpXX($02, $0A1C) %DKC1_AnS1_Op81(CODE_BE9E6B) %DKC1_AnS1_Op81(CODE_BE9EEA) %DKC1_AnS1_Op80()Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L98107-L98140DATA_BEB0DE: %DKC1_AnS1_OpXX($02, $09AC) %DKC1_AnS1_Op81(CODE_BEA02E) %DKC1_AnS1_OpXX($02, $09B0) … %DKC1_AnS1_OpXX($02, $09E8) %DKC1_AnS1_Op81(CODE_BE9FE1) %DKC1_AnS1_Op80()Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Misc_Defines_DKC1.asm#L685-L708 — the disassembly's names, the Named column!Define_DKC1_AnimationID_DK_Run = $0002 !Define_DKC1_AnimationID_DK_Walk = $0003 … !Define_DKC1_AnimationID_DK_Turn = $0006 … !Define_DKC1_AnimationID_DK_Fall = $0015 … !Define_DKC1_AnimationID_DK_Roll = $0018Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Misc_Defines_DKC1.asm#L789-L791!Define_DKC1_AnimationID_Diddy_Idle = $0069 !Define_DKC1_AnimationID_Diddy_Run = $006A !Define_DKC1_AnimationID_Diddy_Walk = $006BIn the first US release, each animation is a script of entries, each a length byte below 128 followed by a 2-byte pose number. Each frame the game takes the sprite's animation speed from its timer; when the timer reaches 0 or less it adds the next entry's length × 256 and shows that entry's pose, so at the speed an animation starts with a length counts frames (computed). An entry that leaves the timer still negative is passed over, so a higher speed can skip poses. A byte from 128 up is a command: the first restarts the animation from its first entry, and the second calls a routine named by a 3-byte address. CodeChecked by claude-agent, 2026-11-08 — counted each script's length-and-pose entries from its label to its $80 with a scratch script (scratch/anims.py), and read the turn, fall, roll, and run scripts line by lineRevised after a check by a second AI model, 2026-11-08.The counts are the scripts' entries, not a measured cycle; the fall script holds commands $83 and $81, and the roll and Diddy's idle scripts start with $84. Donkey Kong's idle script (animation 1) and both Kongs' jump scripts run into routines before any restart, so they aren't counted. Which of animations 2 and 3 plays when is the disassembly's naming, unchecked.
In the first US release, the game sends the sound driver to the audio processor once, at reset: first a small loader, then 3,454 bytes of driver to audio RAM from address 1,248 (both computed), the first 256 of them zeros, then the sound effects. To start a song it sends the song's data, each block headed by its length and its address in audio RAM, restarts the driver at its entry point, and waits for the driver to answer 255. Each byte goes over the ports with a toggling handshake that the loader echoes back. dkc-av/sound-driver-load
About: Donkey Kong Country Music driver
Value: driver bytes 3454 · driver address $04E0 · restart $05E0
CodeDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly ·DKC1/RomMap/ROM_Map_DKC1_U1.asm#L88-L88!EmulationModeResetVector = CODE_808000Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L79-L96CODE_808000: CLC XCE SEI … LDA.w #$01FF TCS JMP.w CODE_80A8D8Our readingthe reset entry: native mode, stack set, on to the RAM clear79–96Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L4701-L4723CODE_80A8D8: JSR.w CODE_80A8AD … LDA.w #$01FF TCS JMP.w CODE_808020Our readingthen on to the start-up routine4723Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L98-L111CODE_808020: JSR.w CODE_80A8B4 … LDA.w #$FFFF STA.w $0521 … JSL.l CODE_8AB0E8 JSL.l CODE_8AB12EOur readingno sample list loaded ($0521 = $FFFF)105–106send the loader, then the driver and the sound effects110–111Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L23400-L23421CODE_8AB12E: PHP SEP.b #$20 REP.b #$10 LDX.w #DATA_8AA36A-$04 STX.b $4C LDA.b #(DATA_8AA36A-$04)>>16 STA.b $4E LDX.w #$0D7E STX.b $4F LDA.b #$E0 XBA LDA.b #$04 JSR.w CODE_8AB4FF LDX.w #DATA_C92D95 STX.b $4C LDA.b #DATA_C92D95>>16 STA.b $4E JSR.w CODE_8AB4E6Our readingsend $0D7E bytes of the driver to audio RAM $04E023404–23413then the sound effects block, with its own header23414–23418Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L23469-L23505CODE_8AB1C6: REP.b #$30 PHP PHA REP.b #$30 PLA STA.b $4C ASL CLC ADC.b $4C TAX LDA.l DATA_8AB159,x … JSR.w CODE_8AB4E6 SEP.b #$20 REP.b #$10 LDY.w #$05E0 … STY.w !REGISTER_APUPort2 … CODE_8AB204: LDA.w !REGISTER_APUPort1 CMP.b #$FF BNE.b CODE_8AB204Our readingthe song's pointer: entry A × 3 of the song table23474–23484send the song's data23486restart the driver at $05E023489–23500wait until the driver answers $FF on port 123501–23503Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L23738-L23784CODE_8AB4E6: PHP SEP.b #$20 REP.b #$10 LDY.w #$0000 LDA.b [$4C],y STA.b $4F INY LDA.b [$4C],y STA.b $50 INY LDA.b [$4C],y XBA INY LDA.b [$4C],y PLP CODE_8AB4FF: … CODE_8AB512: LDA.w !REGISTER_APUPort0 EOR.b $00 BNE.b CODE_8AB512 LDA.b [$4C],y STA.w !REGISTER_APUPort1 STX.w !REGISTER_APUPort2 LDA.b $00 EOR.b #$80 ORA.b #$01 STA.b $00 STA.w !REGISTER_APUPort0 INX INY CPY.b $4F BNE.b CODE_8AB512Our readinga block's header: 2 bytes of length, 2 of audio RAM address23741–23752for each byte: wait for the loader's echo, send byte and address, flip the toggle23766–23780Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/SPC700/SPC700_Engine_DKC1.asm#L8-L26 — the driver's first 256 bytes are zeros, and its code starts at $05E0DATA_04E0: dw $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 … CODE_05E0:Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/SPC700/InitializeSPC700.asm#L3-L21base $04B8 CODE_04B8: MOV X, #$00 CODE_04BA: MOV A, $F4 CMP A, DATA_04D6 BEQ CODE_04BA MOV DATA_04D6, A AND A, #$01 BEQ CODE_04D3 MOV A, $F5 MOV ($F6+x), A MOV A, DATA_04D6 MOV $F4, A BRA CODE_04BA CODE_04D3: JMP ($00F6+x)Our readingthe loader, at audio RAM $04B83wait for a new toggle on port 07–11bit 0 set: store port 1's byte at port 2-3's address, echo the toggle @12,14–18bit 0 clear: jump to the address on ports 2-3 @13,20–21Checked by claude-agent, 2026-11-08 — followed the reset vector through CODE_808000 and CODE_80A8D8 to CODE_808020's two calls; read the driver upload CODE_8AB12E, the song load CODE_8AB1C6, the block sender CODE_8AB4E6/CODE_8AB4FF, and the loader in InitializeSPC700.asmRevised after a check by a second AI model, 2026-11-08.The driver goes to $04E0 (1,248), its length is $0D7E, its entry point is $05E0, and the answer is $FF. Rev 2's driver is not the same bytes; a byte diff against the build shows it moved and its command table changed, so these lines describe 1.0 only.
In the first US release, the game loads samples into audio RAM a list at a time and keeps a 255-byte map from each sample's number to its slot. It points the sound chip's sample directory at $3200, 4 bytes a slot (the sample's start and its loop point), and puts sample data from $3300. A list of 29 samples loads once, the first time either of the two routines that ask for it runs; after it, each song's own list loads in its place, starting where the 29 end, unless the same list is already loaded. For each sample the game sends its data, then its directory entry, and writes its slot into the map, which it then copies to audio RAM at $04E0. The driver's instrument command reads that map. dkc-av/sample-loading
About: Donkey Kong Country Sampled sound
Value: directory $3200 · data $3300 · map $04E0 · map bytes 255 · shared samples 29
CodeDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly ·DKC1/Routine_Macros_DKC1.asm#L23513-L23517 — the shared list, 29 sample numbers and an end markDATA_8AB245: dw $0001,$0002,$0003,$0006,$0007,$0008,$0009,$000A … dw $002B,$0011,$001D,$0016,$0036,$FFFFDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L23608-L23736CODE_8AB3F1: REP.b #$30 LDA.w #DATA_8AB245 … JSR.w CODE_8AB424 REP.b #$20 LDA.b $04 STA.b $16 LDA.b $06 STA.b $18 LDA.b $10 STA.b $1A RTL CODE_8AB40F: REP.b #$30 ASL TAX LDA.l DATA_8AB20D,x … JSR.w CODE_8AB437 … CODE_8AB424: REP.b #$30 LDY.w #$0000 LDA.w #$3200 STA.b $04 LDA.w #$3300 STA.b $06 STZ.b $10 BRA.b CODE_8AB44A CODE_8AB437: REP.b #$30 LDY.w #$0000 LDA.b $16 STA.b $04 LDA.b $18 STA.b $06 LDA.b $1A STA.b $10 … CODE_8AB44A: LDA.b [$12],y CMP.w #$FFFF BEQ.b CODE_8AB4CA PHY TAX SEP.b #$20 LDA.b $10 STA.l $7E7000,x REP.b #$20 INC.b $10 LDA.b [$12],y ASL CLC ADC.b [$12],y TAX LDA.l DATA_89FF00,x … LDY.w #$0000 LDA.b [$4C],y STA.b $0C INY INY LDA.b [$4C],y STA.b $0E STA.b $4F … JSR.w CODE_8AB4FF REP.b #$20 LDA.b $06 STA.b $08 CLC ADC.b $0C STA.b $0A … LDA.b $04 CLC ADC.w #$0004 STA.b $04 LDA.b $06 CLC ADC.b $0E STA.b $06 … CODE_8AB4CA: LDA.w #$7E6FFC … LDA.w #$00FF STA.b $4F SEP.b #$20 LDA.b #$E0 XBA LDA.b #$04 JSR.w CODE_8AB4FFOur readingthe shared list: start the directory at $3200, the data at $3300, slot 0 @23609-23614,23636–23644then save where it ended, for the song lists23615–23622a song's list: by number from the list table, starting where the shared list ended @23625-23633,23646–23655for each sample number until $FFFF23657–23660 map[number] = the next slot23662–23667 the sample's address from the sample table, 3 bytes an entry23668–23677 its header: loop offset, then length23678–23685 send its data to the current data address23687–23691 directory entry = start, start + loop offset; send it23692–23708 next slot 4 bytes on, next data address after this sample23709–23718send 255 bytes of the map to audio RAM $04E023723–23734Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L7790-L7796CODE_80C239: LDA.w $0525 BNE.b CODE_80C245 INC.w $0525 JSL.l CODE_8AB3F1 CODE_80C245: RTLOur readingthe shared list loads only once7791–7794Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L7553-L7557 — one of the routine's two callers loads the shared list, then list 9 and song 9; the other is at line 141JSL.l CODE_80C239 LDA.w #$0009 JSL.l CODE_B99023 LDA.w #!Define_DKC1_MusicID_TitleTheme JSL.l CODE_8AB1C6Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L72068-L72080CODE_B99023: JSR.w CODE_B99027 RTL CODE_B99027: CMP.w $0521 BEQ.b CODE_B99035 STA.w $0521 PHA PLA JSL.l CODE_8AB40F CODE_B99035: RTSOur readingthe list asked for is already loaded: skip @72069,72073–72074else record it and load it72075–72078Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/SPC700/SPC700_Engine_DKC1.asm#L1518-L1519 — the driver writes $32 to the sound chip's register $5DMOV $F2, #$5D MOV $F3, #$32S-DSP registers · DIR - Sample directory page ($5D)DIR is the high-byte of the 256-byte-aligned address of the BRR samples directory. … Each entry in the directory is 4 bytes, two 16-bit (little-endian) addresses pointing to BRR sample blocks: The first address is the start of the sample. … The second address is the loop address of the sample.Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/SPC700/SPC700_Engine_DKC1.asm#L701-L713CODE_0AB5: POP X MOV A, #$00 MOV $6C+x, A … MOV A, ($01)+y MOV X, A MOV A, $04E0+x POP X MOV $0244+x, AOur readinginstrument command: the next byte is a sample number; its slot comes from the map at $04E0708–713Checked by claude-agent, 2026-11-08 — read CODE_8AB3F1 through CODE_8AB4CA, the once-only guard CODE_80C239 and its title-screen call, the list guard CODE_B99027, the driver's directory setting against the S-DSP register page, and its instrument commandRevised after a check by a second AI model, 2026-11-08.Sample data has the space from $3300 to the echo buffer at $DF00, 44,032 bytes (computed); the code sets no limit of its own. The 70 samples total 73,787 bytes in Rev 2 (computed from dkc-av/sample-table), more than that space, which is why the songs carry lists. The map covers sample numbers 0 to 254.
The sample table holds 70 entries, each a 3-byte pointer into banks C7 and C8; each sample there starts with two 16-bit words, its loop offset and its length in bytes, and its data follows. The table and the rest of bank C9 are byte-identical in the first US release and Rev 2; banks C7 and C8 may differ, so the rows' lengths and loop offsets are Rev 2's. In Rev 2, 8 of the 70 samples have a loop offset other than 0, and 32 have the loop flag set in their last block, so they repeat (counted, computed). dkc-av/sample-table
About: Donkey Kong Country Sampled sound
CodeDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly ·DKC1/Routine_Macros_DKC1.asm#L23245-L23321 — 70 entries from $C9:FF00 to $C9:FFD1%BeginROMMirroring($C9FF00, $00, !HiROMAddressOffset) DATA_89FF00: dl DATA_C70000 dl DATA_C70E39 … dl DATA_C81FEB dl DATA_C821A9 %EndROMMirroring() %FREE_BYTES($C9FFD2, 46, $00)Donkey Kong Country (USA) (Rev 2) · 0x09FF00-0x09FFD1 — the table in Rev 2, bank C9 at $FF00, byte for byte the build'sDonkey Kong Country (USA) (Rev 2) · 0x070000-0x0821E3 — the 70 samples in Rev 2, each header and last block read through the table with a scratch scriptDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L23678-L23685LDY.w #$0000 LDA.b [$4C],y STA.b $0C INY INY LDA.b [$4C],y STA.b $0E STA.b $4FOur readingword 0: the loop offset; word 1: the length, also the byte count sent23678–23685Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/AsarScripts/AssetPointersAndFiles.asm#L3647-L3648 — the asset table cuts the first sample's data at $C70004, after its 4-byte header, to $C70E39, where the next entry startsBRRPointersStart: dl $C70004,$C70E39,BRRFile00,BRRFile00EndChecked by claude-agent, 2026-11-08 — read the table and the header read in CODE_8AB44A; compared the table's bytes in the build and Rev 2 (identical); read the 70 headers from Rev 2 with a scratch script, each sample ending where the next beginsRevised after a check by a second AI model, 2026-11-08.Within each bank, each sample's 4 header bytes and its length end where the next sample starts; the last sample in bank C7 ends before the bank does, and the next starts at $C8:0000. In Rev 2 the first block with the end flag ends one byte before the length in 68 samples and at it in samples 16 and 26 (computed). The asset table names the data files BRRFile00 to BRRFile45, numbered in hex.
In the first US release, the song table has 27 entries, each a 3-byte pointer to a song's data, and a second table holds 28 sample lists. Starting a song through the game's music routine first loads the sample list with the song's own number, so the Samples column is each song's set beside the 29 shared ones. Lists 18 and 26 are one list; list 27 has no song of its own: when the boot screen's fanfare (song 10) starts before the shared 29 have loaded, list 27 loads in their place, and otherwise list 10 does. dkc-av/song-table
About: Donkey Kong Country Music driver
CodeDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly ·DKC1/Routine_Macros_DKC1.asm#L23423-L23450DATA_8AB159: dl DATA_8A9361 dl DATA_C90000 dl DATA_C90838 … dl DATA_D3DEAB dl DATA_FC5A12Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L23507-L23606 — the 28 list pointers (entries 18 and 26 both DATA_8AB385) and the lists, each ended by $FFFFDATA_8AB20D: dw DATA_8AB281,DATA_8AB297,DATA_8AB2A3,DATA_8AB2B1,DATA_8AB2C9,DATA_8AB2D7,DATA_8AB2E7,DATA_8AB2F3 … dw DATA_8AB3DD,DATA_8AB3EB,DATA_8AB385,DATA_8AB32B … DATA_8AB32B: dw $0001,$000B,$0010,$000E,$FFFFDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L72082-L72091CODE_B99036: PHA JSR.w CODE_B99061 JSL.l CODE_B990E7 PLA PHA JSR.w CODE_B99027 PLA JSL.l CODE_B990CE RTLOur readingthe music routine: load the sample list with the song's number72085–72087then start the song72088–72089Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L72173-L72175CODE_B990CE: STA.w $0523 JSL.l CODE_8AB1C6Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L6856-L6872LDA.w $0525 BNE.b CODE_80BA60 LDA.w #$3200 STA.b $16 LDA.w #$3300 STA.b $18 STZ.b $1A LDA.w #$001B JSL.l CODE_B99023 BRA.b CODE_80BA67 CODE_80BA60: LDA.w #$000A JSL.l CODE_B99023 CODE_80BA67: LDA.w #!Define_DKC1_MusicID_SplashScreenFanfare JSL.l CODE_8AB1C6Our readingshared list not loaded yet: song lists start at $3200/$3300, slot 0; load list 276856–6864else load list 106867–6869then play song 106870–6872Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Misc_Defines_DKC1.asm#L8-L34 — the disassembly's names for the 27 song numbers, given in the notes!Define_DKC1_MusicID_DKIslandSwing = $0000 … !Define_DKC1_MusicID_SplashScreenFanfare = $000A … !Define_DKC1_MusicID_BeatLevel = $001AChecked by claude-agent, 2026-11-08 — read the song table, the list table and its 28 lists (rows compiled by scratch/values.py from the dl and dw lines), the music routine CODE_B99036, and the boot screen's list choiceChecked by a second AI model, 2026-11-08.The disassembly names the songs, by number: 0 DKIslandSwing, 1 CaveDwellerConcert, 2 MistyMenance, 3 AquaticAmbience, 4 MineCartMadness, 5 NorthernHemispheres, 6 VoicesOfTheTemple, 7 FearFactory, 8 LifeInTheMines, 9 TitleTheme, 10 SplashScreenFanfare, 11 IceCaveChant, 12 SimianSegue, 13 ForestFrenzy, 14 CreditsConcerto, 15 GameOver, 16 BonusRoomBlitz, 17 DeathMusic, 18 Victory, 19 TreetopRock, 20 FunkysFugue, 21 BadBossBoogie, 22 CandysLoveSong, 23 CrankysTheme, 24 GangplankGalleon, 25 Failure, 26 BeatLevel. Its asset table also lists three songs no entry points to (EarlyTitleTheme, EarlyCreditsConcerto, EarlyBadBossBoogie); the first's end address, $93FFB5, is written with the wrong bank.
In the first US release, the sound driver reads each track as bytes: from $81 up a note, followed by its length, where the note byte plus the track's transpose picks the entry in a table of 61 pitches; $80 a rest; and below $80 one of 49 commands, $00 to $30, through a jump table. A note writes the voice's volume, pitch, sample, and envelope to the sound chip and keys the voice on. The rows give each command's length in bytes, as its handler moves the track on, and what it sets; four of the commands set parameters for effects the driver runs each tick, whose use isn't read here. dkc-av/driver-commands
About: Donkey Kong Country Music driver
CodeDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly ·DKC1/SPC700/SPC700_Engine_DKC1.asm#L261-L352CODE_0786: MOV A, $4C+x MOV $01, A MOV A, $5C+x MOV $02, A MOV Y, #$00 MOV A, ($01)+y CMP A, #$00 BMI CODE_079C PUSH X ASL A MOV X, A JMP ($100F+x) … CODE_07A5: CMP A, #$80 BNE CODE_07C9 … CODE_07C9: CLRC ADC A, $0140+x ASL A PUSH X MOV Y, $6C+x BEQ CODE_080F … CODE_080F: MOV X, A MOV A, DATA_11E1+x MOV $03, A MOV A, DATA_11E1+$01+x MOV $04, AOur readingread the track's next byte262–267below $80: a command, through the jump table at $100F268–273$80: key the voice off, a rest282–297else: byte + transpose, doubled, indexes the pitch table @302-304,347–351a fine-tune scales that pitch306–344Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/SPC700/SPC700_Engine_DKC1.asm#L355-L441AND A, #$07 XCN A MOV $F2, A MOV A, $01A0+x BEQ CODE_0829 JMP CODE_08DE CODE_0829: MOV A, $0254+x MOV $F3, A INC $F2 MOV A, $0264+x MOV $F3, A INC $F2 … CODE_08A8: MOV A, $03 MOV $8C+x, A MOV $F3, A INC $F2 MOV A, $04 MOV $7C+x, A MOV $F3, A INC $F2 MOV A, $0244+x MOV $F3, A INC $F2 MOV A, $0274+x MOV $F3, A INC $F2 MOV A, $0284+x MOV $F3, A INC $F2 MOV $F3, #$7F MOV $F2, #$5C MOV $F3, #$00 MOV $F2, #$4C MOV A, DATA_0FFF+x MOV $F3, AOur readingthe voice's first register, voice × 16355–357an effect holds the voice: write nothing358–360left and right volume363–368pitch, low and high419–426the sample's slot427–429the two envelope bytes430–435GAIN $7F436key-off 0, key-on this voice437–441Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/SPC700/SPC700_Engine_DKC1.asm#L1460-L1468 — the voice bits, then the jump table at $100F, 49 handler addresses ($0A69 for $00 to $0FF3 for $30)DATA_0FFF: db $01,$02,$04,$08,$10,$20,$40,$80,$01,$02,$04,$08,$10,$20,$40,$80 db $69,$0A,$B5,$0A,$DE,$0A,$0F,$0B,$24,$0B,$59,$0B,$9F,$0B,$C4,$0B … db $F3,$0FDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/SPC700/SPC700_Engine_DKC1.asm#L1641-L1649 — the pitch table, a 0 entry and 61 pitches from $0200 to $3FFFDATA_11E1: db $00,$00,$00,$02,$1E,$02,$3F,$02,$61,$02,$85,$02,$AB,$02,$D4,$02 … db $F2,$2F,$CC,$32,$D1,$35,$04,$39,$68,$3C,$FF,$3F,$00Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/SPC700/SPC700_Engine_DKC1.asm#L452-L466CODE_08F2: MOV Y, #$01 MOV A, ($01)+y MOV $3C+x, A MOV A, $0190+x BEQ CODE_0906 MOV A, $3C+x MOV $2C+x, A INC Y MOV A, ($01)+y MOV $3C+x, A CODE_0906: INC Y MOV $01, YOur readinga note's length byte follows it; in two-byte mode a second one follows453–462move the track past the note464–465Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/SPC700/SPC700_Engine_DKC1.asm#L658-L851CODE_0A69: POP X MOV A, #$00 MOV $0110+x, A MOV A, $01A0+x BNE CODE_0A7C MOV $F2, #$5C MOV A, DATA_0FFF+x MOV $F3, A … CODE_0AB5: … MOV A, $04E0+x POP X MOV $0244+x, A MOV $01, #$02 CODE_0ACE: MOV $02, #$00 MOV A, $4C+x MOV Y, $5C+x ADDW YA, $01 … CODE_0ADE: … MOV A, $25 BEQ CODE_0AFE MOV A, ($01)+y INC Y CLRC ADC A, ($01)+y ROR A MOV $0254+x, A MOV $0264+x, A MOV $01, #$03 … CODE_0AFE: … MOV $01, #$03 … CODE_0B0F: … MOV A, ($01)+y MOV $4C+x, A INC Y MOV A, ($01)+y MOV $5C+x, A … CODE_0B24: … MOV $0434+y, A … CODE_0B59: … MOV A, $0434+y DEC A MOV $0434+y, A BEQ CODE_0B99 … CODE_0B99: MOV $01, #$04 … CODE_0B9F: … MOV A, ($01)+y MOV $0120+x, A MOV A, $0190+x BEQ CODE_0BBE … INC Y MOV A, ($01)+y MOV $0120+x, A CODE_0BBE: INC Y MOV $01, YOur reading$00: key the voice off unless an effect holds it659–666$01: the sample's slot from the map; 2 bytes709–714the common exit: move the track on by the length in $01715–721$02: volume left and right, or their average when $25 is set; 3 bytes725–750$03: the track goes on at the address given752–764$04: save the count and the return place, go to the address766–793$05: count down; at 0, go on past the $04's 4 bytes, else back to its address795–831$06: one fixed length, two in two-byte mode; 2 or 3 bytes833–851Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/SPC700/SPC700_Engine_DKC1.asm#L853-L1080CODE_0BC4: POP X MOV A, #$00 MOV $0120+x, A MOV $0130+x, A JMP CODE_0C44 CODE_0BD0: POP X MOV A, $0150+x OR A, #$01 … MOV $01, #$06 … CODE_0C04: POP X MOV A, $0150+x OR A, #$01 … MOV $01, #$06 … CODE_0C3B: POP X MOV A, $0150+x AND A, #$FE MOV $0150+x, A CODE_0C44: MOV A, #$01 MOV $01, A … CODE_0C51: POP X MOV Y, #$01 MOV A, ($01)+y MOV $27, A … MOV $01, #$02 … CODE_0C66: … ADC A, $27 MOV $27, A JMP CODE_0C58 CODE_0C73: POP X MOV A, $0150+x OR A, #$02 … MOV $01, #$04 … CODE_0CA0: POP X MOV A, $0150+x AND A, #$FD … CODE_0CAC: … MOV $01, #$05 … CODE_0CDA: … MOV $0274+x, A INC Y MOV A, ($01)+y MOV $0284+x, A MOV $01, #$03 … CODE_0CF4: POP X MOV $F2, #$0C … MOV A, $25 BEQ CODE_0D15 … MOV $01, #$03 … CODE_0D2D: … MOV $6C+x, A MOV $01, #$02 … CODE_0D40: … MOV $0140+x, A MOV $01, #$02 … CODE_0D54: … ADC A, $0140+x MOV $0140+x, A MOV $01, #$02Our reading$07: clear the fixed length; 1 byte @853-858,919–921$08, $09: turn on the first tick effect, store 5 bytes; 6 bytes @860-884,886–912$0A: turn it off; 1 byte914–921$0B: tempo = the byte; 2 bytes927–937$0C: tempo + the byte; 2 bytes940–947$0D: turn on the second tick effect, store 3 bytes; 4 bytes949–968$0E: turn it off; 1 byte971–976$0F: the second effect with 4 bytes; 5 bytes978–998$10: the two envelope bytes; 3 bytes1001–1012$11: main volume left and right, or their average; 3 bytes1015–1044$12: fine-tune; 2 bytes1047–1055$13: transpose = the byte; 2 bytes1058–1066$14: transpose + the byte; 2 bytes1069–1079Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/SPC700/SPC700_Engine_DKC1.asm#L1082-L1187CODE_0D6C: POP X MOV $F2, #$0D MOV Y, #$01 MOV A, ($01)+y MOV $F3, A INC Y MOV $F2, #$2C MOV A, ($01)+y MOV $0232, A MOV $F3, A MOV $F2, #$3C INC Y MOV A, ($01)+y MOV $0233, A MOV $F3, A MOV A, #$00 MOV $0F, A MOV $F2, #$6C MOV $F3, A MOV $01, #$04 … CODE_0D9B: POP X MOV $F2, #$4D MOV A, DATA_0FFF+x OR A, $F3 MOV $F3, A … MOV $0294+x, A MOV $01, A … CODE_0DB6: POP X MOV $F2, #$4D MOV A, DATA_0FFF+x EOR A, #$FF AND A, $F3 MOV $F3, A MOV A, #$00 MOV $0294+x, A … CODE_0DD3: … MOV $F2, #$0F CODE_0DDF: MOV A, ($01)+y MOV $F3, A INC Y CLRC ADC $F2, #$10 CMP $F2, #$8F BNE CODE_0DDF MOV $01, #$09 … CODE_0DF3: … MOV $0E, A OR A, $0F MOV $F2, #$6C MOV $F3, A … MOV $01, #$02 … CODE_0E0D: POP X MOV $F2, #$3D MOV A, DATA_0FFF+x OR A, $F3 MOV $F3, A CODE_0E18: … MOV $01, A … CODE_0E25: POP X MOV $F2, #$3D MOV A, DATA_0FFF+x EOR A, #$FF AND A, $F3 MOV $F3, A JMP CODE_0E18Our reading$15: register $0D = feedback; $2C, $3C = echo volume; $6C = 0; 4 bytes1083–1102$16: this voice's bit on in register $4D, noted for after an effect; 1 byte1106–1116$17: the bit off, the note cleared; 1 byte1120–1131$18: 8 bytes to registers $0F, $1F, … $7F; 9 bytes1140–1149$19: the noise value into register $6C; 2 bytes1152–1163$1A, $1B: this voice's bit on or off in register $3D; 1 byte @1167-1177,1181–1187Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/SPC700/SPC700_Engine_DKC1.asm#L1189-L1458CODE_0E35: MOV X, #$00 BRA CODE_0E47 … CODE_0E47: MOV Y, #$01 MOV A, ($01)+y MOV $10+x, A INC Y MOV A, ($01)+y MOV $15+x, A INC Y MOV A, ($01)+y MOV $1A+x, A INC Y MOV A, ($01)+y MOV $1F+x, A … MOV $01, #$05 … CODE_0E7D: POP A PUSH A XCN A MOV $01, A MOV $F2, A MOV A, $10+x MOV $F3, A INC $F2 MOV A, $15+x MOV $F3, A MOV A, $01 OR A, #$05 MOV $F2, A MOV A, $1A+x MOV $F3, A INC $F2 MOV A, $1F+x MOV $F3, A POP X JMP CODE_0E18 CODE_0EA2: POP X MOV A, $0150+x OR A, #$01 … MOV $01, #$05 … CODE_0ED7: POP X MOV A, $0150+x OR A, #$01 … MOV $01, #$05 … CODE_0F09: … MOV A, $04E0+x POP X MOV $0244+x, A … MOV $01, #$04 … CODE_0F48: … MOV $0D, A MOV $01, #$02 … CODE_0F5B: … MOV $EC, A MOV $01, #$02 … CODE_0F6D: POP X MOV A, #$01 MOV $0190+x, A MOV $01, A … CODE_0F7D: POP X MOV A, #$01 MOV $3C+x, A MOV $01, A DEC A MOV $2C+x, A MOV $0190+x, A … CODE_0F8D: … MOV A, $ED ASL A INC A MOV Y, A MOV A, ($01)+y MOV $4C+x, A … CODE_0FA7: … MOV $ED, A MOV $01, #$02 … CODE_0FB9: POP X MOV A, $0150+x OR A, #$04 … MOV $01, #$05 … CODE_0FF3: POP X MOV A, $0150+x AND A, #$FB MOV $0150+x, A JMP CODE_0C44Our reading$1C-$20: store 4 bytes as preset 0-4; 5 bytes1189–1225$21-$25: write preset 0-4 to the voice's registers 0, 1, 5 and 6; 1 byte (the length set at line 1177)1228–1266$26, $27: turn on the first tick effect, store 4 bytes; 5 bytes @1268-1292,1295–1317$28: sample through the map, then volume; 4 bytes1320–1343$29: the fade's step; 2 bytes1355–1363$2A: the tick period; 2 bytes1366–1374$2B, $2C: two-byte lengths on or off; 1 byte @1377-1385,1387–1395$2D: the track goes on at entry ($ED) of the address list after it1397–1413$2E: $ED = the byte; 2 bytes1415–1423$2F: turn on the third tick effect, store 4 bytes; 5 bytes1426–1450$30: turn it off; 1 byte (the length set at line 921)1453–1458Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/SPC700/SPC700_Engine_DKC1.asm#L40-L91CODE_05FE: MOV A, $F4 MOV X, A CMP A, $04D6 BEQ CODE_0641 MOV A, $F6 MOV $04D8, A MOV A, $F5 … CMP A, #$FF BNE CODE_0619 JMP CODE_0717 CODE_0619: CMP A, #$FE BEQ CODE_063B CMP A, #$FD BEQ CODE_062D CMP A, #$FC BEQ CODE_0634 … CODE_062D: MOV A, $04D8 MOV $ED, A … CODE_0634: MOV A, $04D8 MOV $25, A … CODE_0641: MOV A, $24 BEQ CODE_05FE MOV $FA, $EC MOV $F1, #$01 … CODE_064F: MOV $F1, #$01 MOV $28, #$00 CLRC ADC $26, $27 ROR $28Our readinga message from the game: $FD sets the value command $2D chooses by @57-58,65–68$FC sets the value at $25 @59-60,70–73the tick period at $EC goes to timer 0's interval81each tick, add the tempo to a counter; a carry steps the song87–91Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/SPC700/SPC700_Engine_DKC1.asm#L113-L160CODE_0682: MOV A, $0D BEQ CODE_06DE MOV Y, #$00 ADDW YA, $0B MOVW $0B, YA CMPW YA, $05 BCS CODE_0678 CODE_0690: MOV $03, A … MOV A, $0230 MOV Y, #$00 SUBW YA, $03 BPL CODE_06A9 MOV A, #$00 CODE_06A9: MOV $F2, #$0C MOV $F3, A … MOV A, $0233 MOV Y, #$00 SUBW YA, $03 BPL CODE_06D9 MOV A, #$00 CODE_06D9: MOV $F2, #$3C MOV $F3, AOur readingfade step 0: no fade114–115fade += step, up to $FF116–120main and echo volume, left and right = the stored value - fade, at least 0122–160S-DSP registers · S-DSP global register summaryMVOLL MVOL (L) $0C VVVV VVVV RW Left channel main volume, signed. … EVOLL EVOL (L) $2C VVVV VVVV RW Left channel echo volume, signed. … KON $4C 7654 3210 RW Key on. … KOFF KOF $5C 7654 3210 RW Key off. … FLG $6C RMEN NNNN RW Flags: soft reset (R), mute all (M), echo disable (E), noise frequency (N). … EFB $0D VVVV VVVV RW Echo feedback, signed. … NON $3D 7654 3210 RW For each channel, replaces the sample waveform with the noise generator output. EON $4D 7654 3210 RW For each channel, sends to the echo unit. … FIR0 C0 $0F VVVV VVVV RW Echo filter coefficient.S-DSP registers · S-DSP voice register summaryVxVOLL VOL (L) $X0 SVVV VVVV RW Left channel volume, signed. … VxPITCHL P (L) $X2 LLLL LLLL RW Low 8 bits of sample pitch. … VxSRCN SRCN $X4 SSSS SSSS RW Selects a sample source entry from the directory (see DIR below). VxADSR1 ADSR (1) $X5 EDDD AAAA RW ADSR enable (E), decay rate (D), attack rate (A). VxADSR2 ADSR (2) $X6 SSSR RRRR RW Sustain level (S), sustain rate (R). VxGAIN GAIN $X7S-SMP · T0TARGETT0TARGET Timer 0 $FA TTTT TTTT W8 8KHz timer 0 interval.Checked by claude-agent, 2026-11-08 — read the dispatcher, the note writer, the 49-entry jump table, and every handler from CODE_0A69 to CODE_0FF3; each row's length is what its handler moves the track pointer by (MOV $01 then the common exit at CODE_0ACE), and the registers are named from the S-DSP register pageRevised after a check by a second AI model, 2026-11-08.The three tick effects are the bits $01, $02 and $04 of the voice's flags at $0150; the routine at $0917 that runs them isn't read here, so their parameters aren't named. Message $FC sets the value at $25 that switches $02 and $11 to the average. The table is 1.0's: Rev 2's driver has a different command table.
In the first US release, every song gets the same echo buffer and delay: when it restarts, the driver sets the sound chip's echo delay to 4, which makes an 8,192-byte buffer (computed), and its buffer to start at $DF00, and clears the 8,192 bytes from there (computed). It also sets echo volume, feedback, and every voice's echo bit to 0, and starts the song with echo writing off. A song turns echo on with its own commands: $15 gives the feedback and the echo volume and turns writing on, $16 and $17 set echo per voice, and $18 the filter. dkc-av/echo-setup
About: Donkey Kong Country Echo
Value: delay 4 · buffer $DF00 · buffer bytes 8192
CodeDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly ·DKC1/SPC700/SPC700_Engine_DKC1.asm#L1470-L1587CODE_1071: MOV A, #$00 MOV $F2, #$6C MOV $F3, #$E0 MOV A, #$00 MOV $F2, #$2C MOV $0232, A MOV $F3, A MOV $F2, #$3C MOV $0233, A MOV $F3, A … MOV $F2, #$4D MOV $F3, A MOV $F2, #$7D MOV $F3, #$04 MOV $F2, #$6D MOV $F3, #$DF MOV $F2, #$0D MOV $F3, A MOV Y, #$00 MOV $01, Y MOV $02, #$DF CODE_10BD: MOV A, #$00 CODE_10BF: MOV ($01)+y, A INC Y BNE CODE_10BF MOV A, $02 INC A MOV $02, A CMP A, #$FF BNE CODE_10BD … MOV $F2, #$6C MOV $F3, #$20 RETOur readingregister $6C = $E0: reset, mute, echo writing off1471–1473registers $2C and $3C, echo volume left and right, = 01475–1480register $4D, every voice's echo bit, = 01489–1490register $7D, echo delay, = 4; $6D, the buffer, = $DF; $0D, feedback, = 01491–1496clear page $DF and each page after it, up to $FE1497–1508register $6C = $20: echo writing off1584–1586Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/SPC700/SPC700_Engine_DKC1.asm#L26-L33 — the restart the game triggers before each song runs this setupCODE_05E0: CLRP MOV X, #$FF MOV SP, X MOV A, $F4 MOV $04D6, A MOV $F4, A CALL CODE_1071S-DSP registers · S-DSP global register summaryEVOLL EVOL (L) $2C VVVV VVVV RW Left channel echo volume, signed. … FLG $6C RMEN NNNN RW Flags: soft reset (R), mute all (M), echo disable (E), noise frequency (N). … EFB $0D VVVV VVVV RW Echo feedback, signed. … EON $4D 7654 3210 RW For each channel, sends to the echo unit. … ESA $6D EEEE EEEE RW Pointer to the start of the echo memory region at $EE00. EDL $7D ---- DDDD RW Echo delay time (D).S-DSP registers · EDL - Echo delay ($7D)EDL controls the size (DDDD * 2048 bytes) and length (DDDD * 512 samples or 16ms @ 32000Hz) of the echo buffer.S-DSP registers · FLG - Flags register ($6C)Disable echo write: When set, echo buffer writes are disabledIn the first US release, the sound driver reads each track as bytes: from $81 up a note, followed by its length, where the note byte plus the track's transpose picks the entry in a table of 61 pitches; $80 a rest; and below $80 one of 49 commands, $00 to $30, through a jump table. A note writes the voice's volume, pitch, sample, and envelope to the sound chip and keys the voice on. The rows give each command's length in bytes, as its handler moves the track on, and what it sets; four of the commands set parameters for effects the driver runs each tick, whose use isn't read here. CodeChecked by claude-agent, 2026-11-08 — read the driver's setup CODE_1071 to its RET against the S-DSP register page, and the echo commands $15 to $18 (in dkc-av/driver-commands)Revised after a check by a second AI model, 2026-11-08.Echo delay 4 is 4 × 16 ms = 64 ms at 32 kHz (computed from the S-DSP page). The flags go to $E0 at the start of setup and $20 at its end; bit $20 is the echo-write disable. The cleared range is $DF00 to $FEFF. The driver writes the delay and buffer registers nowhere else, so no song can change them.
In the first US release, sound effects play on the same eight voices as the music: the driver runs 16 tracks, the music's eight and eight for effects, and effect track 8 + n uses voice n. An effect that starts takes its voice over, turning its noise and echo bits off; while it plays, the music track for that voice keeps its place, and a music note on that voice writes nothing to it. When the effect ends the voice goes back to the music, with its echo bit set again if the music had turned echo on. dkc-av/sound-effect-voices
About: Donkey Kong Country Music driver
CodeDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly ·DKC1/SPC700/SPC700_Engine_DKC1.asm#L1589-L1639CODE_1173: ASL A PUSH A MOV A, #$01 MOV $01A0+x, A MOV $F2, #$3D MOV A, DATA_0FFF+x EOR A, #$FF AND A, $F3 MOV $F3, A MOV A, X CLRC ADC A, #$08 MOV X, A … POP Y MOV A, $2380+y MOV $4C+x, A INC Y MOV A, $2380+y MOV $5C+x, A … MOV $F2, #$4D MOV A, DATA_0FFF+x EOR A, #$FF AND A, $F3 MOV $F3, A RETOur readingmark voice X as taken by an effect; its bit off in register $3D, noise1591–1598the effect runs as track X + 81599–1602its data from the effect table at $23801626–1631its bit off in register $4D, echo1634–1638Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/SPC700/SPC700_Engine_DKC1.asm#L161-L199CODE_06DE: MOV X, #$00 CODE_06E0: … MOV A, $01A0+x BEQ CODE_070C PUSH X MOV A, X CLRC ADC A, #$08 MOV X, A … CODE_070C: INC X CMP X, #$08 BEQ CODE_0714 JMP CODE_06E0Our readingfor each voice: step its music track; if an effect holds it, step track voice + 8 too162–194Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/SPC700/SPC700_Engine_DKC1.asm#L358-L360 — a music note on a voice an effect holds skips every register writeMOV A, $01A0+x BEQ CODE_0829 JMP CODE_08DEDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/SPC700/SPC700_Engine_DKC1.asm#L667-L697CODE_0A7C: MOV A, X CMP A, #$08 BCC CODE_0AB2 PUSH X SETC SBC A, #$08 MOV X, A MOV A, #$00 MOV $01A0+x, A … MOV $F2, #$4D MOV A, $0294+x BEQ CODE_0AA8 MOV A, DATA_0FFF+x OR A, $F3 MOV $F3, AOur readingan effect track's end: free the voice668–676its noise bit off677–681its echo bit back on if the music track set it, else off682–694Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/SPC700/SPC700_Engine_DKC1.asm#L54-L62 — any other message from the game starts an effect, the voice given on port 2CODE_0619: CMP A, #$FE BEQ CODE_063B CMP A, #$FD BEQ CODE_062D CMP A, #$FC BEQ CODE_0634 MOV X, $04D8 CALL CODE_1173S-DSP registers · S-DSP global register summaryNON $3D 7654 3210 RW For each channel, replaces the sample waveform with the noise generator output. EON $4D 7654 3210 RW For each channel, sends to the echo unit.Checked by claude-agent, 2026-11-08 — read the effect start CODE_1173, the main loop's per-voice stepping, the note writer's guard, and the end command's effect branch, with the registers named from the S-DSP pageRevised after a check by a second AI model, 2026-11-08.In the first US release, each entrance (a stage's start, its checkpoint barrel, a way into or out of a bonus room) picks the routines that run each frame while that entrance is in play from a table of 230 rows, one per entrance number. Each row is a pair of routines; each of the first routines named here writes the background layers' scroll registers (dkc-av/parallax-layers), and one caller runs the first alone while another runs the first and then the second. The frame interrupt runs the current task of a list, and the list the game sets up for play holds a loading task and then that second caller, so once the loading task moves the list on, both routines of the entrance's pair run on each frame interrupt; the interrupt that comes while a frame's work is still running only rewrites the brightness and returns. The 230 rows hold 21 different pairs (counted). By the disassembly's names for the entrance numbers, Torchlight Trouble's rows hold the pair that Reptile Rumble, Bouncy Bonanza, Manic Mincers and Elevator Antics also use, and Orang-utan Gang's start and its five returns from bonus rooms hold a pair no other entrance uses. dkc-av/level-display-routines
About: Donkey Kong Country Scrolling
Value: rows 230 · pairs 21
CodeDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly ·DKC1/Routine_Macros_DKC1.asm#L2713-L2728CODE_809713: LDA.b !RAM_DKC1_Global_EntranceIDLo ASL ASL TAX PHX JSR.w (DATA_80C5BD,x) PLX JMP.w (DATA_80C5BD+$02,x) CODE_809720: LDA.b !RAM_DKC1_Global_EntranceIDLo ASL ASL TAX JMP.w (DATA_80C5BD,x)Our readingentrance × 4 picks a row; run its first routine, then go to its second2713–2721or run the first alone2723–2728Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L8230-L8460DATA_80C5BD: dw CODE_808C6C,CODE_809728 dw CODE_808E38,CODE_809756 … dw CODE_808E38,CODE_809756 … dw CODE_808D43,CODE_809728 … dw CODE_808E38,CODE_809756 dw CODE_808E38,CODE_809756 … dw CODE_8095B6,CODE_8099DBOur readingrow 0, no entrance: the pair the jungle stages use8231row $01, Reptile Rumble: the cave pair8232row $07, Bouncy Bonanza: the cave pair8238row $0D, Orang-utan Gang's start: a pair of its own8244rows $12-$14, Manic Mincers and Torchlight Trouble's checkpoint and start: the cave pair8249–8251row $18, Elevator Antics: the cave pair8255rows $71-$75, Orang-utan Gang's returns from bonus rooms: its own pair8344–8348the last row, $E58460Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L1563-L1583 — the first routine of row 0 writes the first layer's scroll registersCODE_808C6C: LDA.w $1B03 STA.w !REGISTER_DMAEnable … LDA.w !RAM_DKC1_Global_Layer1XPosLo STA.w !REGISTER_BG1HorizScrollOffset LDA.w !RAM_DKC1_Global_Layer1XPosHi STA.w !REGISTER_BG1HorizScrollOffset LDA.w !RAM_DKC1_Global_Layer1YPosLo STA.w !REGISTER_BG1VertScrollOffsetIn the first US release, the stages' display routines move the second background layer at half the first layer's horizontal speed in the jungle, Orang-utan Gang, snow and cave pairs (dkc-av/level-display-routines). Vertically the jungle pair moves it at a quarter of the first layer's speed, and Orang-utan Gang's and the snow pair at an eighth, the snow pair holding it at 31 px at most; the cave pair moves it at an eighth of the first layer's position held at 287 px or less (both converted from hex). The underwater pair holds the second layer's vertical scroll at -1 (converted from hex) and moves the third layer vertically with the first. The cave and underwater pairs move the third layer horizontally at one and a half times the first layer's speed (computed), except in Poison Pond, where HDMA rewrites the third layer's scroll down the screen (dkc-av/poison-pond-blend). Code — its quotes show the first routines of the jungle, Orang-utan Gang, snow, cave and underwater pairs writing the layers' scroll registersDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/RomMap/ROM_Map_DKC1_U1.asm#L79!NativeModeNMIVector = CODE_80A968Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L4767-L4792CODE_80A968: JML.l CODE_80A96C CODE_80A96C: REP.b #$30 PHA PHX PHY SEP.b #$20 LDA.w !REGISTER_NMIEnable LDA.b #$8F STA.w !REGISTER_ScreenDisplayRegister REP.b #$20 JMP.w ($001C) CODE_80A980: SEP.b #$20 LDA.w !RAM_DKC1_Global_ScreenDisplayRegister STA.w !REGISTER_ScreenDisplayRegister REP.b #$20 CODE_80A98A: REP.b #$30 PLY PLX PLA RTIOur readingthe frame interrupt goes on through the address held at $1C4767–4780the busy path: brightness from its copy, then return4782–4792Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L152-L194LDA.w #CODE_8080AB JMP.w CODE_808110 CODE_8080AB: LDA.w #$01FF TCS LDA.w $1A6B BMI.b CODE_8080FA … INC.b $2A LDA.w #CODE_80A980 STA.b $1C INC.b $28 LDX.w #$0000 JSR.w ($0508,x) … CODE_8080F2: LDA.w #CODE_8080AB STA.b $1C CODE_8080F7: WAI BRA.b CODE_8080F7Our readingthe frame routine set at $1C152–153while it runs, the busy path is set; the counters at $2A and $28 count up163–166the current task at $0508 runs167–168the frame routine set again, then wait for the next interrupt189–194Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L303-L329CODE_8081C9: STA.w $050A STZ.w $050C BRA.b CODE_8081D4 CODE_8081D1: INC.w $050C CODE_8081D4: LDA.w $050C ASL CLC ADC.w $050A TAX … STA.w $0508 RTS DATA_8081E3: dw CODE_80822E DATA_8081E5: dw CODE_80827B dw CODE_809713Our readingset a list and its first task, or move on to the next303–321the play list: the loading task, then the caller that runs both routines327–329Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L392-L393 — the start-up task (CODE_80822E, the only task of the first list) sets the play list; the loading task CODE_80827B ends with JMP.w CODE_8081D1 at line 609LDA.w #DATA_8081E5 JSR.w CODE_8081C9Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Misc_Defines_DKC1.asm#L176-L405!Define_DKC1_EntranceID_InvalidID = $0000 !Define_DKC1_EntranceID_ReptileRumble_Main2 = $0001 … !Define_DKC1_EntranceID_BouncyBonanza_Main = $0007 … !Define_DKC1_EntranceID_OrangutanGang_Main = $000D … !Define_DKC1_EntranceID_ManicMincers_Main = $0012 !Define_DKC1_EntranceID_TorchlightTrouble_CheckpointBarrel = $0013 !Define_DKC1_EntranceID_TorchlightTrouble_Main = $0014 … !Define_DKC1_EntranceID_ElevatorAntics_Main = $0018 … !Define_DKC1_EntranceID_OrangutanGang_ExitBonus1 = $0071 … !Define_DKC1_EntranceID_OrangutanGang_ExitBonus5 = $0075 … !Define_DKC1_EntranceID_BumbleBRumble_Main = $00E5Checked by claude-agent, 2026-11-08 — read the two callers that index the table by entrance number, the whole table (a scratch script grouped its 230 rows by pair and named each row from the entrance defines), the first routine of row 0, and the frame interrupt through the task list to the caller that runs both routinesRevised after a check by a second AI model, 2026-11-08.The pairs are named here by their first routine: CODE_808C6C for the jungle stages, CODE_808E38 for the caves, CODE_808D43 for Orang-utan Gang. Rows go past the bonus rooms to the bosses ($E0-$E5); the entrance defines continue to $FF with no table rows.
In the first US release, the stages' display routines move the second background layer at half the first layer's horizontal speed in the jungle, Orang-utan Gang, snow and cave pairs (dkc-av/level-display-routines). Vertically the jungle pair moves it at a quarter of the first layer's speed, and Orang-utan Gang's and the snow pair at an eighth, the snow pair holding it at 31 px at most; the cave pair moves it at an eighth of the first layer's position held at 287 px or less (both converted from hex). The underwater pair holds the second layer's vertical scroll at -1 (converted from hex) and moves the third layer vertically with the first. The cave and underwater pairs move the third layer horizontally at one and a half times the first layer's speed (computed), except in Poison Pond, where HDMA rewrites the third layer's scroll down the screen (dkc-av/poison-pond-blend). dkc-av/parallax-layers
About: Donkey Kong Country Scrolling
Value: bg 2 horizontal 0.5 · bg 2 vertical jungle 0.25 · bg 2 vertical snow 0.125 · snow cap 31 · cave hold 287 · bg 3 horizontal cave water 1.5
CodeIn the first US release, each entrance (a stage's start, its checkpoint barrel, a way into or out of a bonus room) picks the routines that run each frame while that entrance is in play from a table of 230 rows, one per entrance number. Each row is a pair of routines; each of the first routines named here writes the background layers' scroll registers (dkc-av/parallax-layers), and one caller runs the first alone while another runs the first and then the second. The frame interrupt runs the current task of a list, and the list the game sets up for play holds a loading task and then that second caller, so once the loading task moves the list on, both routines of the entrance's pair run on each frame interrupt; the interrupt that comes while a frame's work is still running only rewrites the brightness and returns. The 230 rows hold 21 different pairs (counted). By the disassembly's names for the entrance numbers, Torchlight Trouble's rows hold the pair that Reptile Rumble, Bouncy Bonanza, Manic Mincers and Elevator Antics also use, and Orang-utan Gang's start and its five returns from bonus rooms hold a pair no other entrance uses. CodeDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly ·DKC1/Routine_Macros_DKC1.asm#L1563-L1598CODE_808C6C: … LDA.w !RAM_DKC1_Global_Layer1XPosLo LSR SEP.b #$20 STA.w !REGISTER_BG2HorizScrollOffset … LDA.w !RAM_DKC1_Global_Layer1YPosLo LSR LSR SEP.b #$20 STA.w !REGISTER_BG2VertScrollOffsetOur readingjungle pair: second layer X = first layer X / 21585–1590second layer Y = first layer Y / 41592–1598Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L1608-L1648CODE_808CDC: … LDA.w !RAM_DKC1_Global_Layer1XPosLo LSR SEP.b #$20 STA.w !REGISTER_BG2HorizScrollOffset … LDA.w !RAM_DKC1_Global_Layer1YPosLo LSR LSR LSR CMP.w #$001F BMI.b CODE_808D37 LDA.w #$001F CODE_808D37: SEP.b #$20 STA.w !REGISTER_BG2VertScrollOffsetOur readingsnow pair: second layer X = first layer X / 21630–1635second layer Y = first layer Y / 8, at most $1F (31)1637–1648Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L1652-L1688CODE_808D43: … LDA.w !RAM_DKC1_Global_Layer1XPosLo LSR SEP.b #$20 STA.w !REGISTER_BG2HorizScrollOffset … LDA.w !RAM_DKC1_Global_Layer1YPosLo LSR LSR LSR SEP.b #$20 STA.w !REGISTER_BG2VertScrollOffsetOur readingOrang-utan Gang's pair: second layer X = first layer X / 21674–1679second layer Y = first layer Y / 81681–1688Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L1698-L1747CODE_808DB4: … LDA.w !RAM_DKC1_Global_Layer1XPosLo LSR CLC ADC.w !RAM_DKC1_Global_Layer1XPosLo SEP.b #$20 STA.w !REGISTER_BG3HorizScrollOffset XBA STA.w !REGISTER_BG3HorizScrollOffset REP.b #$20 LDA.w #$FFFF SEP.b #$20 STA.w !REGISTER_BG2VertScrollOffset XBA STA.w !REGISTER_BG2VertScrollOffset LDA.w !RAM_DKC1_Global_Layer1YPosLo STA.w !REGISTER_BG3VertScrollOffset LDA.w !RAM_DKC1_Global_Layer1YPosHi STA.w !REGISTER_BG3VertScrollOffsetOur readingunderwater pair: third layer X = first layer X / 2 + first layer X1730–1737second layer Y = $FFFF1739–1743third layer Y = first layer Y1744–1747Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L1751-L1804CODE_808E38: … LDA.w !RAM_DKC1_Global_Layer1XPosLo LSR SEP.b #$20 STA.w !REGISTER_BG2HorizScrollOffset XBA STA.w !REGISTER_BG2HorizScrollOffset REP.b #$20 LDA.w !RAM_DKC1_Global_Layer1XPosLo LSR CLC ADC.w !RAM_DKC1_Global_Layer1XPosLo SEP.b #$20 STA.w !REGISTER_BG3HorizScrollOffset … LDA.w !RAM_DKC1_Global_Layer1YPosLo CMP.w #$011F BMI.b CODE_808EA8 LDA.w #$011F CODE_808EA8: STA.b $4C LSR LSR LSR SEP.b #$20 STA.w !REGISTER_BG2VertScrollOffset XBA STA.w !REGISTER_BG2VertScrollOffsetOur readingcave pair: second layer X = first layer X / 21776–1781third layer X = first layer X / 2 + first layer X1783–1790second layer Y = first layer Y held at $11F (287) or less, / 81792–1804Checked by claude-agent, 2026-11-08 — read the scroll writes of the jungle, snow, Orang-utan Gang, underwater and cave display routinesRevised after a check by a second AI model, 2026-11-08.Each routine also writes the first layer's scroll from the camera words as they stand. The holds compare with BMI, a signed test. The underwater pair writes the second layer's horizontal scroll at half speed too, but an HDMA channel rewrites that register on every line in those stages (dkc-av/poison-pond-blend); the cave pair writes the third layer's vertical scroll from the held position's low byte and the first layer's high byte. Which hardware layer holds which picture (the foreground, the far background) isn't read.
In the first US release, Torchlight Trouble's beam is window 1 reshaped on every line by HDMA. The second start step of 45 entrances (counted), Torchlight Trouble's among them, points HDMA channel 2 at a table in RAM of 224 one-line entries (computed), each writing window 1's left and right edges, all set to 255 and 254, and turns that channel on. Only the 6 entrances whose flag word has bit 2 set (converted from hex), which by the disassembly's names are Torchlight Trouble's start, checkpoint and bonus-room ways in and out, rewrite the table each frame, and only while the game keeps a sprite number for it. The beam starts at a point set by that sprite's position and offsets carried in its current pose, which also carries two slopes, one for the beam's upper edge and one for its lower edge, in 1/256 px a line; when bit 14 of the sprite's attribute word is set (converted from hex), both slopes and the horizontal offset are taken negated. The point's line is held between 0 and 223 (converted from hex). From it, each line up moves the edge by the upper slope and each line down by the lower: with a positive slope the window runs from the edge to 255, with a negative one from 0 to the edge, and once the edge passes the screen's side every line beyond is set back to 255 and 254. Every frame the cave display routine makes the table's first entry 1 line or 3 by the low bit of a counter, so on alternate counts the whole shape sits 2 lines lower (computed). dkc-av/torchlight-beam-window
About: Donkey Kong Country HDMA
Value: lines 224 · entrances 6 · flag bit $0004 · mirror bit $4000 · jitter lines 2
CodeIn the first US release, each entrance (a stage's start, its checkpoint barrel, a way into or out of a bonus room) picks the routines that run each frame while that entrance is in play from a table of 230 rows, one per entrance number. Each row is a pair of routines; each of the first routines named here writes the background layers' scroll registers (dkc-av/parallax-layers), and one caller runs the first alone while another runs the first and then the second. The frame interrupt runs the current task of a list, and the list the game sets up for play holds a loading task and then that second caller, so once the loading task moves the list on, both routines of the entrance's pair run on each frame interrupt; the interrupt that comes while a frame's work is still running only rewrites the brightness and returns. The 230 rows hold 21 different pairs (counted). By the disassembly's names for the entrance numbers, Torchlight Trouble's rows hold the pair that Reptile Rumble, Bouncy Bonanza, Manic Mincers and Elevator Antics also use, and Orang-utan Gang's start and its five returns from bonus rooms hold a pair no other entrance uses. Code — its quotes show the entrance's two display routines running from the frame interrupt, once a frameDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly ·DKC1/Routine_Macros_DKC1.asm#L71247-L71297CODE_B9887B: SEP.b #$20 LDX.w #(!REGISTER_Window1LeftPositionDesignation&$0000FF<<8)+$01 STX.w HDMA[$02].Parameters LDX.w #$7F1C28 STX.w HDMA[$02].SourceLo LDA.b #$7F1C28>>16 STA.w HDMA[$02].SourceBank … CODE_B988AB: LDA.w #$0001 STA.l $7F1C28,x DEC LDA.w #$FEFF STA.l $7F1C29,x INX INX INX CPX.w #$02A0 BNE.b CODE_B988AB LDA.w #$0000 STA.l $7F1C28,x … LDA.w #$0401 STA.w $1B03Our readingchannel 2: pattern 1 to window 1's left edge, from $7F1C2871248–71255$2A0 / 3 = 224 entries of 1 line, edges $FF and $FE71265–71276a 0 ends the table71277–71278the frame's enable word: HDMA channel 2 ($04 in the high byte)71294–71295Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L70473-L70494 — 45 rows of this table take the cave setup, counted by a scratch scriptDATA_B981EA: dw CODE_B9861B dw CODE_B9887B … dw CODE_B9887B dw CODE_B9887BOur readingthe start code's second step by entrance: rows $13 and $14, Torchlight Trouble, take the cave setup70493–70494Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L70229-L70233CODE_B98010: LDA.b !RAM_DKC1_Global_EntranceIDLo ASL TAX JMP.w (DATA_B981EA,x)Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L1751-L1763CODE_808E38: LDA.w $1B03 STA.w !REGISTER_DMAEnable … SEP.b #$20 LDA.b $2A AND.b #$01 ASL INC STA.l $7F1C28Our readingthe enable word goes to the DMA and HDMA enables in one 16-bit store1752–1753first entry's line count = (low bit of $2A) × 2 + 11758–1763Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L428-L432 — each entrance's flag word goes to $1E15LDA.b !RAM_DKC1_Global_EntranceIDLo ASL TAX LDA.l DATA_81D102,x STA.w $1E15Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L18851-L18876 — no other row of the table has bit $0004 (checked by a scratch script over all 256 rows)DATA_81D102: … dw $005A,$0232,$0049,$0156,$0015,$005A,$0041,$0001 … dw $0042,$0136,$0116,$0136,$0116,$0022,$0222,$0202Our readingrows $13 and $14: $0156 and $0015, bit $0004 set18854rows $C1-$C4: $0136, $0116, $0136, $011618876Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L2748-L2758 — the cave pair's second routine runs the table writer only with bit $0004CODE_809756: … LDA.w $1E15 AND.w #$0004 BEQ.b CODE_809776 JSL.l CODE_819370Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L16595-L16749CODE_819374: LDX.w #$0002 LDY.b $DD BNE.b CODE_81937C RTS CODE_81937C: LDX.w !RAM_DKC1_NorSpr_CurrentPoseLo,y … LDA.l DATA_BBCC9C,x SEC SBC.w #$0006 TAX LDA.w $0005,x AND.w #$00FF STA.b $4E LDA.w $0004,x AND.w #$00FF STA.b $4C LDA.w $0002,x STA.b $54 LDA.w $0000,x STA.b $52 PLB LDA.w !RAM_DKC1_NorSpr_YXPPCCCTLo,y BIT.w #$4000 BEQ.b CODE_8193CF LDA.b $52 EOR.w #$FFFF INC STA.b $52 LDA.b $54 EOR.w #$FFFF INC STA.b $54 LDA.b $4E EOR.w #$FFFF INC STA.b $4E CODE_8193CF: LDA.b $4C SEC SBC.w !RAM_DKC1_NorSpr_YPosLo,y SEC SBC.w !RAM_DKC1_Global_Layer1YPosLo CLC ADC.w #$0100 BPL.b CODE_8193E2 LDA.w #$0000 CODE_8193E2: CMP.w #$00DF BCC.b CODE_8193EA LDA.w #$00DF CODE_8193EA: STA.b $4C ASL ADC.b $4C STA.b $4C TAX LDA.b $4E CLC ADC.w !RAM_DKC1_NorSpr_XPosLo,y SEC SBC.w !RAM_DKC1_Global_Layer1XPosLo XBA STA.b $4E STA.b $50 LDA.b $52 BPL.b CODE_81941C CODE_819405: LDA.b $50 CLC ADC.b $52 BCC.b CODE_819434 STA.b $50 AND.w #$FF00 STA.l $7F1C29,x DEX DEX DEX BPL.b CODE_819405 BRA.b CODE_819440 CODE_81941C: LDA.b $50 CLC ADC.b $52 BCS.b CODE_819434 STA.b $50 XBA ORA.w #$FF00 STA.l $7F1C29,x DEX DEX DEX BPL.b CODE_81941C BRA.b CODE_819440 CODE_819434: LDA.w #$FEFF CODE_819437: STA.l $7F1C29,x DEX DEX DEX BPL.b CODE_819437 CODE_819440: LDX.b $4C LDA.b $54 BPL.b CODE_81945F … CPX.w #$029D BCC.b CODE_819446 RTS CODE_81945F: … CPX.w #$029D BCC.b CODE_81945F RTS CODE_819479: LDA.w #$FEFF CODE_81947C: STA.l $7F1C29,x INX INX INX CPX.w #$029D BCC.b CODE_81947C RTSOur readingno sprite number kept ($DD = 0): nothing16596–16599from the 6 bytes before the pose's data: upper slope, lower slope, line offset, X offset16602–16621mirrored (bit $4000): both slopes and the X offset negated16623–16637line = offset - sprite Y - camera Y + $100, held to 0..$DF16639–16653edge = X offset + sprite X - camera X, as the high byte of a 1/256 px word16654–16665upper slope negative: left 0, right = edge, line by line upward16668–16680positive: left = edge, right $FF16682–16695edge past the side: every line above gets $FEFF16697–16704the same downward with the lower slope, to entry $29A (line 222); entry 223 only from the upward pass16706–16749SNES-ROM-Framework: Yoshifanatic's asar framework for SNES disassemblies · Global/HardwareRegisters/SNES.asm#L480-L492 — a 16-bit store to Parameters writes the channel's control byte and its registerstruct HDMA $004300 .Parameters: skip $01 .Destination: skip $01 .SourceLo: skip $01 .SourceHi: skip $01 .SourceBank: skip $01SNES-ROM-Framework: Yoshifanatic's asar framework for SNES disassemblies · Global/HardwareRegisters/SNES.asm#L306-L307!REGISTER_Window1LeftPositionDesignation = $002126 !REGISTER_Window1RightPositionDesignation = $002127SNES-ROM-Framework: Yoshifanatic's asar framework for SNES disassemblies · Global/HardwareRegisters/SNES.asm#L431-L432!REGISTER_DMAEnable = $00420B !REGISTER_HDMAEnable = $00420CPPU registers · WH0 - Window 1 left position ($2126 write)++++-++++- Window 1 left edge positionPPU registers · WH1 - Window 1 right position ($2127 write)++++-++++- Window 1 right edge positionDMA registers · Line count, repeat mode byte$00: Stop processing HDMA on that channel for the rest of the frame. $01-$80: Write once, then wait for X scanlinesDMA registers · DMAPn - DMA/HDMA parameters ($43n0 read/write) (n = 0..7)pattern 1 allows a DMA copy to VRAM, which requires writing to two alternating addresses.Checked by claude-agent, 2026-11-08 — read the cave start step that builds the window table, the start-step table rows for Torchlight Trouble, the flag table and its load, the cave pair's second routine and its guard, the table writer CODE_81937C through both passes and their fills, and the cave display routine's first entry; a scratch script listed every flag-table row with bit $0004Revised after a check by a second AI model, 2026-11-08.The table is at $7F1C28, three bytes a line (a line count of 1, then the left and right edges); the writer stores each line's edges as one word at $7F1C29. The kept sprite number is at $DD and the counter at $2A. The slopes and offsets are the six bytes before the address the pose table gives (dkc-av/sprite-pose-format), as words at offsets 0 and 2 and bytes at 4 and 5. Pattern 1 writes two registers in turn, so each entry reaches the left edge and then the right. The flag word is $1E15 and the bit $0004; the attribute bit is $4000, and that it is the horizontal flip rests on the disassembly's name for the attribute word, YXPPCCCT.
In the first US release, Torchlight Trouble dims the stage with color math outside its beam (dkc-av/torchlight-beam-window). The start code of its 6 entrances loads 128 background colors into color memory with every bit inverted, sets color 0, the backdrop, to a gray of 16 of 31 in each channel (converted from hex), writes 255 to both bytes of color 17 (white, converted from hex), and fills the third background layer's map with one tile word (in the value). It puts the third layer alone on the main screen with window 1, inverted, applied to it, and the first and second layers and the sprites on the subscreen, with no color window in use. Color math subtracts the subscreen from the third layer and from the backdrop, and the cave display routine writes the same layers and color math again every frame. Where the third layer shows color 17, 31 less an inverted channel gives the channel back (computed), so the stage shows its own background colors; where the backdrop shows, 16 less the inverted channel leaves the channel 15 lower (computed). While a countdown the game keeps is above 0, each frame takes 1 off it, writes to the backdrop the color the new count picks from four (in the value, for counts 0 to 3), and turns off the main screen's layers and color math, so that frame shows the backdrop alone. dkc-av/torchlight-color-math
About: Donkey Kong Country Color math
Value: backdrop $4210 · tile word $1001 · entrances 6 · flash colors $4E73, $7FFF, $5318, $3210
CodeIn the first US release, Torchlight Trouble's beam is window 1 reshaped on every line by HDMA. The second start step of 45 entrances (counted), Torchlight Trouble's among them, points HDMA channel 2 at a table in RAM of 224 one-line entries (computed), each writing window 1's left and right edges, all set to 255 and 254, and turns that channel on. Only the 6 entrances whose flag word has bit 2 set (converted from hex), which by the disassembly's names are Torchlight Trouble's start, checkpoint and bonus-room ways in and out, rewrite the table each frame, and only while the game keeps a sprite number for it. The beam starts at a point set by that sprite's position and offsets carried in its current pose, which also carries two slopes, one for the beam's upper edge and one for its lower edge, in 1/256 px a line; when bit 14 of the sprite's attribute word is set (converted from hex), both slopes and the horizontal offset are taken negated. The point's line is held between 0 and 223 (converted from hex). From it, each line up moves the edge by the upper slope and each line down by the lower: with a positive slope the window runs from the edge to 255, with a negative one from 0 to the edge, and once the edge passes the screen's side every line beyond is set back to 255 and 254. Every frame the cave display routine makes the table's first entry 1 line or 3 by the low bit of a counter, so on alternate counts the whole shape sits 2 lines lower (computed). CodeIn the first US release, each entrance (a stage's start, its checkpoint barrel, a way into or out of a bonus room) picks the routines that run each frame while that entrance is in play from a table of 230 rows, one per entrance number. Each row is a pair of routines; each of the first routines named here writes the background layers' scroll registers (dkc-av/parallax-layers), and one caller runs the first alone while another runs the first and then the second. The frame interrupt runs the current task of a list, and the list the game sets up for play holds a loading task and then that second caller, so once the loading task moves the list on, both routines of the entrance's pair run on each frame interrupt; the interrupt that comes while a frame's work is still running only rewrites the brightness and returns. The 230 rows hold 21 different pairs (counted). By the disassembly's names for the entrance numbers, Torchlight Trouble's rows hold the pair that Reptile Rumble, Bouncy Bonanza, Manic Mincers and Elevator Antics also use, and Orang-utan Gang's start and its five returns from bonus rooms hold a pair no other entrance uses. Code — its quotes show the entrance's two display routines running from the frame interrupt, once a frameDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly ·DKC1/Routine_Macros_DKC1.asm#L71166-L71218CODE_B987B7: JSR.w CODE_B98854 LDA.w #$5800 STA.w !REGISTER_VRAMAddressLo LDX.w #$0400 LDA.w #$1001 CODE_B987C6: STA.w !REGISTER_WriteToVRAMPortLo DEX BNE.b CODE_B987C6 … STZ.w !REGISTER_ObjectAndColorWindowSettings LDA.w #$0058 STA.w !REGISTER_BG3AddressAndSize LDA.w #$A422 STA.w !REGISTER_ColorMathInitialSettings LDA.w #$0300 STA.w !REGISTER_BG1And2WindowMaskSettings LDA.w #$0004 STA.w !REGISTER_MainScreenWindowMask LDA.w #$1304 STA.w !REGISTER_MainScreenLayers SEP.b #$20 STZ.w !REGISTER_CGRAMAddress LDX.w #$0000 CODE_B98807: LDA.l DATA_B9A01C,x EOR.b #$FF STA.w !REGISTER_WriteToCGRAMPort INX CPX.w #$0100 BNE.b CODE_B98807 REP.b #$20 LDA.w #$4210 SEP.b #$20 STZ.w !REGISTER_CGRAMAddress STA.w !REGISTER_WriteToCGRAMPort XBA STA.w !REGISTER_WriteToCGRAMPort LDA.b #$11 STA.w !REGISTER_CGRAMAddress LDA.b #$FF STA.w !REGISTER_WriteToCGRAMPort STA.w !REGISTER_WriteToCGRAMPortOur readingthe third layer's map at $5800 filled with $0400 (1,024) words of $100171168–71175no color window ($2125 = 0)71184the third layer's map address $5871185–71186color math: $2130 = $22, $2131 = $A471187–71188window masks: $2123 = $00, $2124 = $0371189–71190window on the main screen's third layer ($212E = $04)71191–71192main screen the third layer ($04), subscreen the first, second and sprites ($13)71193–71194$100 bytes (128 colors) from color 0, each byte inverted71196–71204color 0 = $421071206–71211color 17 ($11) = $FF, $FF71212–71216Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L70241-L70262 — rows $C1-$C4 run it too (L70435-L70438); these 6 rows are the only ones, counted by a scratch scriptDATA_B9801E: dw CODE_B98590 … dw CODE_B987B7 dw CODE_B987B7Our readingthe first start step by entrance: rows $13 and $14 run the Torchlight setup70261–70262Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L1826-L1852LDA.w $1E15 AND.w #$0004 BEQ.b CODE_808F1F LDA.w #$1304 STA.w !REGISTER_MainScreenLayers LDA.w #$A422 STA.w !REGISTER_ColorMathInitialSettings LDA.w $1E1D BEQ.b CODE_808F1F SEP.b #$20 STZ.w !REGISTER_CGRAMAddress DEC STA.w $1E1D ASL TAX LDA.l DATA_808F20,x STA.w !REGISTER_WriteToCGRAMPort LDA.l DATA_808F20+$01,x STA.w !REGISTER_WriteToCGRAMPort REP.b #$20 STZ.w !REGISTER_MainScreenLayers STZ.w !REGISTER_ColorMathInitialSettings CODE_808F1F: RTS DATA_808F20: ; Note: Palette data dw $4E73,$7FFF,$5318,$3210Our readingbit $0004: layers and color math written again each frame1826–1832countdown $1E1D above 0: one less, its color to color 01833–1845main screen layers and color math off1846–1847the four colors1851–1852SNES-ROM-Framework: Yoshifanatic's asar framework for SNES disassemblies · Global/HardwareRegisters/SNES.asm#L253-L272!REGISTER_CGRAMAddress = $002121 !REGISTER_WriteToCGRAMPort = $002122 !REGISTER_BG1And2WindowMaskSettings = $002123 … !REGISTER_BG3And4WindowMaskSettings = $002124SNES-ROM-Framework: Yoshifanatic's asar framework for SNES disassemblies · Global/HardwareRegisters/SNES.asm#L336-L362!REGISTER_MainScreenLayers = $00212C !REGISTER_SubScreenLayers = $00212D … !REGISTER_MainScreenWindowMask = $00212E … !REGISTER_ColorMathInitialSettings = $002130 … !REGISTER_ColorMathSelectAndEnable = $002131PPU registers · TM - Main screen layer enable ($212C write)| |+--- Enable BG3 on main screenPPU registers · TS - Subscreen layer enable ($212D write)| |||+- Enable BG1 on subscreen | ||+-- Enable BG2 on subscreenPPU registers · TS - Subscreen layer enable ($212D write)+------ Enable OBJ on subscreenSNES-ROM-Framework: Yoshifanatic's asar framework for SNES disassemblies · Global/HardwareRegisters/SNES.asm#L289!REGISTER_ObjectAndColorWindowSettings = $002125PPU registers · WOBJSEL - Window Mask Settings for OBJ and Color Window ($2125 write)|||+------ Invert window 1 for color ||+------- Enable window 1 for color |+-------- Invert window 2 for color +--------- Enable window 2 for colorPPU registers · W34SEL - Window Mask Settings for BG3 and BG4 ($2124 write)|||| |||+- Invert window 1 for BG3 |||| ||+-- Enable window 1 for BG3PPU registers · TMW - Main screen layer window enable ($212E write)| |+--- Apply enabled windows to main screen BG3PPU registers · CGWSEL - Color addition select ($2130 write)|||| +-- Addend (0 = fixed color, 1 = subscreen) ||++------ Sub screen color window transparent regionPPU registers · CGWSEL, region typesIf the color windows are not enabled by WOBJSEL, everything is "outside" them.PPU registers · CGADSUB - Color math designation ($2131 write)|||| |+--- BG3 color math enablePPU registers · CGADSUB - Color math designation ($2131 write)||+------- Backdrop color math enable |+-------- Half color math +--------- Operator type (0 = add, 1 = subtract)PPU registers · CGDATA - CGRAM data write ($2122 write twice)|||+-++++- Red componentChecked by claude-agent, 2026-11-08 — read the Torchlight start step CODE_B987B7 to its jump, the start-step table rows, the cave display routine's bit-$0004 branch and its color table, and the register bits on the SNESdev PPU pageRevised after a check by a second AI model, 2026-11-08.$A422 writes $22 to $2130 (subscreen addend; the subscreen's transparent region set to inside the color window, which is empty with no color window enabled) and $A4 to $2131 (subtract, backdrop and BG3, no half). $0300 writes $00 to $2123 and $03 to $2124 (window 1 enabled and inverted for BG3). $4210 is 16 in each 5-bit channel; inverted, a channel c is 31 − c, so 16 − (31 − c) = c − 15, and a channel below 15 can't go under 0. The countdown is at $1E1D; the colors are picked at index count − 1 after the decrement.
In the first US release, the snow stages can wave their third background layer up and down, line by line, with HDMA. The second start step of 15 entrances (by the disassembly's names, Snow Barrel Blast's, Ice Age Alley's and Rambi's bonus room's) builds a table in RAM of 288 one-line entries for that layer's vertical scroll, from a table of 64 values rising from 0 to 127: down the screen the values run 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 1, 0, 0, then the same below 0, a 32-line wave of up to 2 px either way (computed). The step points HDMA channel 2 at the table and leaves HDMA off. The snow display routine starts the channel one entry further back every 2 counts of a counter it reads, so the wave moves down a line every 2 counts and repeats every 64 (computed), and turns the channel on, with the third layer's map moved to another address in video memory, only while a weather stage the game keeps is 5. dkc-av/snow-wave
About: Donkey Kong Country HDMA
Value
{
"entries": 288,
"period": 32,
"amplitude": 2,
"wave": [
0,
0,
0,
1,
1,
1,
2,
2,
2,
2,
2,
1,
1,
1,
0,
0,
0,
0,
0,
-1,
-1,
-1,
-2,
-2,
-2,
-2,
-2,
-1,
-1,
-1,
0,
0
],
"weatherStage": 5
}DKC1/Routine_Macros_DKC1.asm#L71486-L71566CODE_B98AD4: JSR.w CODE_B98AF4 LDA.w #$0001 STA.w $1B03 … CODE_B98AE2: JSR.w CODE_B98AF4 JSL.l CODE_80A992 LDA.w #$0001 STA.w $1B03 … CODE_B98AF4: STZ.w $1DF3 STZ.w $1DF1 SEP.b #$20 LDX.w #(!REGISTER_BG3VertScrollOffset&$0000FF<<8)+$02 STX.w HDMA[$02].Parameters LDX.w #$7F1C28 STX.w HDMA[$02].SourceLo … LDX.w #$0000 LDY.w #$0000 CODE_B98B18: STX.b $4E TYA AND.w #$007F BIT.w #$0040 BEQ.b CODE_B98B26 EOR.w #$007F CODE_B98B26: TAX LDA.l DATA_808BA8,x AND.w #$00FF XBA LSR STA.b $4C LSR LSR LSR CLC ADC.b $4C LSR LSR LSR LSR LSR XBA AND.w #$00FF STA.b $4C TYA BIT.w #$0080 BEQ.b CODE_B98B51 LDA.b $4C EOR.w #$FFFF INC STA.b $4C CODE_B98B51: LDA.w #$0001 LDX.b $4E STA.l $7F1C28,x LDA.b $4C STA.l $7F1C29,x TYA CLC ADC.w #$0008 TAY INX INX INX STX.b $4E CPX.w #$0360 BNE.b CODE_B98B18Our readingboth start steps build the table and set the enable word to $0001: no HDMA channel71486–71499weather words cleared71502–71503channel 2: pattern 2 to the third layer's vertical scroll, from $7F1C2871505–71511the phase steps 8 a line; its low 7 bits, mirrored past $40, pick a table value71515–71525value × 256 / 2, plus an eighth of that, / 32, high byte: value × 9 / 51271526–71541bit $80 of the phase: negated71542–71548one line, then the value; $360 / 3 = 288 entries71550–71564Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L70473-L70684 — 6 rows take the first step and 9 the second, the same 15 rows that hold the snow display pair (counted by a scratch script)DATA_B981EA: dw CODE_B9861B … dw CODE_B98AD4 … dw CODE_B98AE2 … dw CODE_B98AE2Our readingrow $24, Snow Barrel Blast's start70510row $A7, Ice Age Alley's start70641row $D2, Rambi's bonus room70684Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L1505-L1509DATA_808BA8: db $00,$03,$06,$09,$0C,$10,$13,$16,$19,$1C,$1F,$22,$25,$28,$2B,$2E … db $75,$76,$78,$79,$7A,$7A,$7B,$7C,$7D,$7D,$7E,$7E,$7E,$7F,$7F,$7FDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L1608-L1615CODE_808CDC: LDA.w $1B03 STA.w !REGISTER_DMAEnable … JSR.w CODE_8089A0Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L1288-L1299CODE_8089A0: LDA.b $28 LSR EOR.w #$001F AND.w #$001F STA.b $4C ASL CLC ADC.b $4C CLC ADC.w #$1C28 STA.w HDMA[$02].SourceLoOur readingstart = $1C28 + 3 × (31 − (counter / 2) mod 32)1289–1299Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L1434-L1448CODE_808B0E: LDA.w #$0078 STA.w !REGISTER_BG3AddressAndSize LDA.w $1DF1 CMP.w #$0005 BEQ.b CODE_808B1F JMP.w CODE_808BA7 CODE_808B1F: SEP.b #$20 LDA.b #$04 STA.w !REGISTER_HDMAEnable REP.b #$20 LDA.w #$007C STA.w !REGISTER_BG3AddressAndSizeOur readingthe third layer's map at $781435–1436weather stage 5: HDMA channel 2 on, the map at $7C1437–1448SNES-ROM-Framework: Yoshifanatic's asar framework for SNES disassemblies · Global/HardwareRegisters/SNES.asm#L82-L82!REGISTER_BG3AddressAndSize = $002109SNES-ROM-Framework: Yoshifanatic's asar framework for SNES disassemblies · Global/HardwareRegisters/SNES.asm#L222-L222!REGISTER_BG3VertScrollOffset = $002112DMA registers · Line count, repeat mode byte$01-$80: Write once, then wait for X scanlinesDMA registers · DMAPn - DMA/HDMA parameters ($43n0 read/write) (n = 0..7) — the transfer-pattern table's row for pattern 2, two bytes to one register2 2 +0 +0 OAM, CGRAMChecked by claude-agent, 2026-11-08 — read both snow start steps and the table builder, the start-step rows, the rising table, the snow display routine's pointer and its weather-stage branch; a scratch script ran the builder's arithmetic for all 288 entries (values −2 to 2, 32-line period)Revised after a check by a second AI model, 2026-11-08.The table is at $7F1C28, the RAM the caves use for their window table (dkc-av/torchlight-beam-window). Pattern 2 writes one register twice, the low and high bytes of the scroll. The map setting moves from $78 to $7C. The weather stage is the word at $1DF1; the counter is $28. The routine reached at weather stages 2 and up also sends new tiles to video memory at $5E00 and $5F00 every frame or every other frame, not read here as graphics. The second start step also runs CODE_80A992, and the builder ends with a call to CODE_80AA42 (line 71565); neither is read.
In the first US release, Poison Pond lays its third background layer over the rest of the stage at half strength. The second start step of its 2 entrances (by the disassembly's names, its start and its checkpoint) puts the third layer alone on the main screen and the first and second layers and the sprites on the subscreen, and sets color math to add the subscreen at half to the third layer and the backdrop. It turns on HDMA channels 2, 5 and 6; the underwater stages' channel setup points them at tables in RAM that set the second layer's horizontal scroll, the first layer's scroll and the third's down the screen. The other 7 underwater entrances (Croctopus Chase's, Coral Capers', Clam City's and Enguarde's bonus room's) take a second step that turns on channels 2 and 5 and sets the color math's layers and operation and the fixed color from a per-entrance table: adding on the second layer and the backdrop for Croctopus Chase, Coral Capers and Enguarde's bonus room, and subtracting at half on the second layer for Clam City. dkc-av/poison-pond-blend
About: Donkey Kong Country Color math
Value
{
"entrances": 2,
"otherUnderwater": 7,
"hdmaPoisonPond": [
2,
5,
6
],
"hdmaOther": [
2,
5
],
"designation": {
"croctopusChase": "$22",
"coralCapers": "$22",
"enguardeBonus": "$22",
"clamCity": "$C2"
}
}DKC1/Routine_Macros_DKC1.asm#L71438-L71453CODE_B98A5B: JSL.l CODE_8197DD JSL.l CODE_B9AD17 LDA.w #$1304 STA.w !REGISTER_MainScreenLayers LDA.w #$6402 STA.w !REGISTER_ColorMathInitialSettings LDA.w #$6401 STA.w $1B03 RTL CODE_B98A76: JSL.l CODE_8197DD LDA.w #$2401 STA.w $1B03 JML.l CODE_B9AD17Our readingchannel setup71439main screen the third layer ($04), subscreen the first, second and sprites ($13)71441–71442$2130 = $02, $2131 = $6471443–71444HDMA channels 2, 5 and 6 ($64)71445–71446the other step: channel setup, HDMA channels 2 and 5 ($24), no color math71449–71453Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L70473-L70537 — the other step also serves rows $A6, $BF, $C0, $DE and $DF, 7 rows in all (counted by a scratch script)DATA_B981EA: dw CODE_B9861B … dw CODE_B98A5B … dw CODE_B98A5B … dw CODE_B98A76 dw CODE_B98A76Our readingrows $22 and $2A, Poison Pond's start and checkpoint @70508,70516rows $3E and $3F, Croctopus Chase's70536–70537Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L17140-L17162CODE_8197DD: SEP.b #$20 LDX.w #(!REGISTER_BG2HorizScrollOffset&$0000FF<<8)+$02 STX.w HDMA[$02].Parameters LDX.w #$7F0390 STX.w HDMA[$02].SourceLo … LDX.w #(!REGISTER_BG1HorizScrollOffset&$0000FF<<8)+$03 STX.w HDMA[$05].Parameters LDX.w #$7F0200 STX.w HDMA[$05].SourceLo … LDX.w #(!REGISTER_BG3HorizScrollOffset&$0000FF<<8)+$03 STX.w HDMA[$06].Parameters LDX.w #$02C8 STX.w HDMA[$06].SourceLo LDA.b #$7F STA.w HDMA[$06].SourceBankOur readingchannel 2: pattern 2 to the second layer's horizontal scroll, from $7F039017142–17148channel 5: pattern 3 from the first layer's horizontal scroll (its horizontal and vertical), from $7F020017149–17155channel 6: pattern 3 from the third layer's, from $7F02C817156–17162Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L73305-L73344CODE_B9AD17: LDA.b !RAM_DKC1_Global_EntranceIDLo ASL ASL TAX LDA.l DATA_B9D7AE,x SEP.b #$20 STA.w !REGISTER_ColorMathSelectAndEnable REP.b #$20 LDA.l DATA_B9D7AE+$01,x STA.b $4C AND.w #$001F ORA.w #$0020 SEP.b #$20 STA.w !REGISTER_FixedColorData … ORA.w #$0040 SEP.b #$20 STA.w !REGISTER_FixedColorData … ORA.w #$0080 SEP.b #$20 STA.w !REGISTER_FixedColorData REP.b #$20 RTLOur readingthe entrance's 4-byte row: its first byte to $213173306–73312the next word's low 5 bits to the fixed color's red73314–73319the next 5 bits to green73321–73331the next 5 bits to blue73333–73342SNES-ROM-Framework: Yoshifanatic's asar framework for SNES disassemblies · Global/HardwareRegisters/SNES.asm#L372!REGISTER_FixedColorData = $002132PPU registers · COLDATA - Fixed color data ($2132 write)|||+-++++- Color value ||+------- Write color value to red channel |+-------- Write color value to green channel +--------- Write color value to blue channelDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L73727 — rows $3E and $3F, Croctopus Chase's start and checkpoint, $22 with a fixed color of 0; rows $A6 (line 73753) and $BF and $C0 (lines 73759-73760) hold $22 toodb $24,$00,$00,$00,$93,$00,$00,$00,$22,$00,$00,$00,$22,$00,$00,$00Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L73767 — rows $DC-$DF; $DE and $DF are Clam City's start and checkpoint, $C2 with the fixed-color word $1464db $C2,$64,$14,$00,$C2,$64,$14,$00,$C2,$64,$14,$00,$C2,$64,$14,$00Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L1608-L1610 — a 16-bit store, so the enable word's high byte goes to the HDMA enable register; the cave and underwater pairs' first routines do the same (line 1752 and others)CODE_808CDC: LDA.w $1B03 STA.w !REGISTER_DMAEnableSNES-ROM-Framework: Yoshifanatic's asar framework for SNES disassemblies · Global/HardwareRegisters/SNES.asm#L431-L432!REGISTER_DMAEnable = $00420B !REGISTER_HDMAEnable = $00420CDMA registers · DMAPn - DMA/HDMA parameters ($43n0 read/write) (n = 0..7) — the transfer-pattern table's row for pattern 3, four bytes, two to each of two registers3 4 +0 +0 +1 +1 Scroll positions, Mode 7 parametersSNES-ROM-Framework: Yoshifanatic's asar framework for SNES disassemblies · Global/HardwareRegisters/SNES.asm#L336-L362!REGISTER_MainScreenLayers = $00212C !REGISTER_SubScreenLayers = $00212D … !REGISTER_ColorMathInitialSettings = $002130 … !REGISTER_ColorMathSelectAndEnable = $002131PPU registers · CGWSEL - Color addition select ($2130 write)|||| +-- Addend (0 = fixed color, 1 = subscreen)PPU registers · CGADSUB - Color math designation ($2131 write)|||| |+--- BG3 color math enablePPU registers · CGADSUB - Color math designation ($2131 write)|||| ||+-- BG2 color math enablePPU registers · CGADSUB - Color math designation ($2131 write)||+------- Backdrop color math enable |+-------- Half color math +--------- Operator type (0 = add, 1 = subtract)PPU registers · TM - Main screen layer enable ($212C write)| |+--- Enable BG3 on main screenPPU registers · TS - Subscreen layer enable ($212D write)| |||+- Enable BG1 on subscreen | ||+-- Enable BG2 on subscreenPPU registers · TS - Subscreen layer enable ($212D write)+------ Enable OBJ on subscreenChecked by claude-agent, 2026-11-08 — read both underwater second start steps, their rows in the start-step table, and the underwater channel setup CODE_8197DD, with the register bits on the SNESdev PPU pageRevised after a check by a second AI model, 2026-11-08.$6402 writes $02 to $2130 (subscreen addend) and $64 to $2131 (add, half, backdrop and BG3). The enable word's high byte is the HDMA enable: $64 is channels 2, 5 and 6, $24 channels 2 and 5. Pattern 3 writes two registers twice each, so channel 5 reaches the first layer's horizontal and vertical scroll and channel 6 the third's. The setup fills the channel 5 and 6 tables with four copies of a 100-byte table of entries of 22, 11, 10 and 21 lines and the channel 2 table with 224 one-line entries. In the per-entrance table, $22 is add on BG2 and the backdrop and $C2 subtract at half on BG2; whether the addend is the subscreen or the fixed color is set by $2130, which the other step doesn't write and which isn't read here. Poison Pond's step also runs CODE_B9AD17, then writes its own $2131.
In the first US release, the game's fades step the screen's brightness by one of its 16 levels at a fixed pace. A control byte beside the brightness copy holds the pace: a value n from 1 to 127 brightens one level every n frames up to full, and 128 plus n darkens one level every n frames down to black, then the byte clears itself. Each frame the copy is written to the brightness register. Every fade-out start in the code uses a pace of 2, so a fade from full brightness to black takes 15 steps and 30 frames (computed); fade-ins start at black with a pace of 2 or, in three places, 3. dkc-av/screen-fade
About: Donkey Kong Country Screen fade
Value: levels 16 · fade out pace 2 · fade out frames 30 · fade in paces 2, 3
CodeDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly ·DKC1/Routine_Macros_DKC1.asm#L5492-L5523CODE_80AF77: SEP.b #$20 LDA.w $051B BEQ.b CODE_80AFB7 BMI.b CODE_80AF9D INC.w $051C CMP.w $051C BNE.b CODE_80AFB7 STZ.w $051C INC.w !RAM_DKC1_Global_ScreenDisplayRegister LDA.b #$0F CMP.w !RAM_DKC1_Global_ScreenDisplayRegister BCS.b CODE_80AFB7 STA.w !RAM_DKC1_Global_ScreenDisplayRegister STZ.w $051B BRA.b CODE_80AFB7 CODE_80AF9D: AND.b #$7F INC.w $051C CMP.w $051C BNE.b CODE_80AFB7 STZ.w $051C DEC.w !RAM_DKC1_Global_ScreenDisplayRegister BMI.b CODE_80AFB1 BNE.b CODE_80AFB7 CODE_80AFB1: STZ.w $051B STZ.w !RAM_DKC1_Global_ScreenDisplayRegisterOur readingno fade when the control byte is 0; its top bit picks darkening5494–5496count frames until the count equals the pace, then restart the count5497–5500brighten one level; past 15, hold 15 and end the fade5501–5506darkening: the pace is the low 7 bits5510darken one level; at 0, or below, hold 0 and end the fade5515–5520Donkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L5536-L5564 — a second copy of the same steps, which the level code reaches through CODE_80AFBA (DKC1/Routine_Macros_DKC1.asm lines 2741 and others)CODE_80AFCF: SEP.b #$20 LDA.w $051B BEQ.b CODE_80B00F BMI.b CODE_80AFF5 … DEC.w !RAM_DKC1_Global_ScreenDisplayRegister BMI.b CODE_80B009 BNE.b CODE_80B00FDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/RAM_Map_DKC1.asm#L31 — the control byte at $051B is the byte after the brightness copy, so a 16-bit store sets both!RAM_DKC1_Global_ScreenDisplayRegister = $00051ADonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L196-L203 — the frame routine CODE_8080AB (set at line 152) branches here at line 159CODE_8080FA: LDA.w #$0100 CLC ADC.w $1A6B STA.w $1A6B SEP.b #$20 LDA.w !RAM_DKC1_Global_ScreenDisplayRegister STA.w !REGISTER_ScreenDisplayRegisterDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L1572-L1573 — in the jungle pair's first routine; the level display routines from line 1573 to line 2699 make the same copy (21 such writes, counted by grep)LDA.w !RAM_DKC1_Global_ScreenDisplayRegister STA.w !REGISTER_ScreenDisplayRegisterDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L2730-L2741 — the jungle pair's second routine runs the fade step; other second routines call it too (lines 2764 and others)CODE_809728: JSR.w CODE_80A257 … JSR.w CODE_80AFBAIn the first US release, each entrance (a stage's start, its checkpoint barrel, a way into or out of a bonus room) picks the routines that run each frame while that entrance is in play from a table of 230 rows, one per entrance number. Each row is a pair of routines; each of the first routines named here writes the background layers' scroll registers (dkc-av/parallax-layers), and one caller runs the first alone while another runs the first and then the second. The frame interrupt runs the current task of a list, and the list the game sets up for play holds a loading task and then that second caller, so once the loading task moves the list on, both routines of the entrance's pair run on each frame interrupt; the interrupt that comes while a frame's work is still running only rewrites the brightness and returns. The 230 rows hold 21 different pairs (counted). By the disassembly's names for the entrance numbers, Torchlight Trouble's rows hold the pair that Reptile Rumble, Bouncy Bonanza, Manic Mincers and Elevator Antics also use, and Orang-utan Gang's start and its five returns from bonus rooms hold a pair no other entrance uses. Code — its quotes show the entrance's two display routines running from the frame interrupt, once a frameDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L9042-L9043 — one of 13 writes to the control byte (counted): 12 load $82 (converted from hex, 128 plus 2) and one (line 11201) loads $02. Of the 16-bit stores to the brightness copy, 10 load $820F (full brightness, then a fade-out at pace 2), 11 load $0200 and 3 load $0300 (black, then a fade-in at pace 2 or 3), one $0080 (forced blank, no fade) and one $000F (counted by grep)LDA.w #$0082 STA.w $051BDonkey-Kong-Country-1-Disassembly: Donkey Kong Country (SNES) disassembly · DKC1/Routine_Macros_DKC1.asm#L52031-L52033CODE_B69E35: LDA.w #$820F STA.w !RAM_DKC1_Global_ScreenDisplayRegisterSNES-ROM-Framework: Yoshifanatic's asar framework for SNES disassemblies · Global/HardwareRegisters/SNES.asm#L3!REGISTER_ScreenDisplayRegister = $002100PPU registers · INIDISP - Screen display ($2100 write)++++- Screen brightness (linear steps from 0 = none to $F = full)Checked by claude-agent, 2026-11-08 — read both copies of the fade steps, the brightness copy's address and its per-frame write to the register, and every load stored to the control byte and the brightness copy, with the register bits on the SNESdev PPU pageRevised after a check by a second AI model, 2026-11-08.A fade-in from black runs 15 steps; the 16th step finds the level past 15, holds it at 15 and ends the fade, so the byte clears two frames after full brightness is reached. Which transition (level entry, bonus room, death, the map) starts which fade isn't read here: the fade-out stores sit in sprite and level code in banks B6 and BE, the fade-in stores in the screen setups of bank 80. One screen setup (line 9895) also points HDMA channel 3 at the brightness register, from a table in ROM, which can change brightness line by line; what it draws isn't read.