Digger Architecture part 2
Music and sound effects. I was lucky to work with Uctumi who created charming music and all SFX. As I have explained in my âPlaying the memory tetrisâ post, Digger has 2 SID files that Uctumi created with GoatTracker. They contain the following subtunes:
SID1 located at $C000: MUSIC_POPCORN (main theme), MUSIC_DEATH (funeral march) and MUSIC_SUCCESS (level completed)
SID2 located at $A200: MUSIC_BONUS (bonus mode theme), MUSIC_INTRO, MUSIC_ENDING.
Now, music playback is the only Assembler routine in the game. Itâs implemented with the global sid_index variable and the play_popcorn() function. To start playing e.g. MUSIC_SUCCESS, I am calling sid_index = 2; play_popcorn(). The function sets the subtune index and points the raster interrupt (happening at line 40) vector at int_music or int2_music function, depending on sid_index. These interrupt handlers simply jump to SID playing routing from SID1 or SID2.
For SFX playback, each subtune has also GoatTrackerâs SFX player built in. There are functions play_sfx_eat(), play_sfx_gold_broken() etc. that point AX to SFX binary data and jump to SFX playing routine of SID1 or SID2, depending on which music is currently playing, for example:
.proc _play_sfx_eat_gold lda _sid_index ; Check which SID is active. cmp #03 bmi sfxeatgoldbank_1 lda #<(_sfx_eat_gold_data) ; Load SFX address. ldy #>(_sfx_eat_gold_data) ldx #14 ; Always use voice 3. bmi sfxeatgoldbank_1 jsr sid2_play+3 rts sfxeatgoldbank_1: lda #<(_sfx_eat_gold_data) ldy #>(_sfx_eat_gold_data) ldx #14 jsr sid_play+3 rts .endproc _sfx_gold_fall_data: .byte $00, $F8, $00, $D2, ...
Worth mentioning that our music uses 3 voices, and when SFX is playing, the 3rd voice is interrupted. However the music composed in such way that itâs barely noticeable.












