.BDENTRY LDA #0 ; Set BDBUFF = 0 to reset the current music data byte in STA BDBUFF ; BDBUFF STA counter ; Set counter = 0 to reset the rest counter STA vibrato2 ; Set vibrato2 = 0 to reset the vibrato counter for ; voice 2 STA vibrato3 ; Set vibrato3 = 0 to reset the vibrato counter for ; voice 3 ; We now zero all the SID registers from $01 to $18 to ; reset the sound chip (though it doesn't zero the first ; byte at $00, for some reason) LDX #$18 ; Set a byte counter in X .BDloop2 STA SID,X ; Zero the X-th byte of the SID registers DEX ; Decrement the counter in X BNE BDloop2 ; Loop back until we have zeroed all the registers from ; $01 to $18 IF _GMA_RELEASE LDA value5 ; Set A to the low byte of value5, which is set to the ; address before the start of the tune that is ; configured to play for docking ELIF _SOURCE_DISK LDA #LO(musicstart) ; Set A to the low byte of musicstart, which is the ; address before the start of the docking music ENDIF STA BDdataptr1 ; Set BDdataptr1 to the low byte of the music to play STA BDdataptr3 ; Set BDdataptr3 to the low byte of the music to play IF _GMA_RELEASE LDA value5+1 ; Set A to the high byte of value5, which is set to the ; address before the start of the tune that is ; configured to play for docking ELIF _SOURCE_DISK LDA #HI(musicstart) ; Set A to the high byte of musicstart, which is the ; address before the start of the docking music ENDIF STA BDdataptr2 ; Set BDdataptr2 to the high byte of the music to play, ; so BDdataptr1(1 0) is the address of the music to play ; (as BDdataptr2 = BDdataptr1 + 1) STA BDdataptr4 ; Set BDdataptr4 to the high byte of the music to play, ; so BDdataptr3(1 0) is the address of the music to play ; (as BDdataptr4 = BDdataptr3 + 1) LDA #%00001111 ; Set SID register $18 to control the sound as follows: STA SID+$18 ; ; * Bits 0-3: set the volume to 15 (maximum) ; ; * Bit 4 clear: disable the low-pass filter ; ; * Bit 5 clear: disable the bandpass filter ; ; * Bit 6 clear: disable the high-pass filter ; ; * Bit 7 clear: enable voice 3 ;SEI ; This instruction is commented out in the original ; source RTS ; Return from the subroutine ;point IRQ to start ; These instructions are commented out in the original ;LDA #LO(BDirqhere) ; source ;STA $0314 ;LDA #HI(BDirqhere) ;STA $0315 ;CLI ;BRK ;re enter monitor!Name: BDENTRY [Show more] Type: Subroutine Category: Sound Summary: Start playing a new tune as background musicContext: See this subroutine in context in the source code References: This subroutine is called as follows: * startbd calls BDENTRY
[X]
Variable BDdataptr1 in workspace ZP
The low byte of the address of the music data pointer in BDdataptr1(1 0), which points to the end of the music data currently being processed
[X]
Variable BDdataptr2 in workspace ZP
The high byte of the address of the music data pointer in BDdataptr1(1 0), which points to the end of the music data currently being processed
[X]
Variable BDdataptr3 in workspace ZP
The low byte of the address of the music data pointer in BDdataptr3(1 0), which is a backup of the initial value of the BDdataptr1(1 0) pointer, so music can be repeated
[X]
Variable BDdataptr4 in workspace ZP
The high byte of the address of the music data pointer in BDdataptr3(1 0), which is a backup of the initial value of the BDdataptr1(1 0) pointer, so music can be repeated
[X]
Label BDloop2 is local to this routine
[X]
Configuration variable SID = $D400
Registers for the SID sound synthesis chip, which are memory-mapped to the 29 bytes from $D400 to $D41C (see page 461 of the Programmer's Reference Guide)
[X]
Label musicstart in variable BDJMPTBH
[X]
Variable value5 in workspace Music variables
The address before the start of the music data for the tune that is configured to play for docking, so this can be changed to alter the docking music