;----------------------------------------
; sound.txt
;
; All the routines that play
; sound go here. 
;
; Instrument = 16 notes 
;              SMS frequency range is limited
; Note = frequency (1 byte), 
;        volume (60 bytes) 
;
; Song = instrument, note list
;----------------------------------------

;----------------------------------------
; sound_state_machine_piano
;
; Before calling this routine,
; set these variables:
;
; RAM_SOUND_STATE (0 on, 1 off)
; RAM_SOUND_SONG (base address of 1st note within song)
; RAM_SOUND_INDEX (0-59, index into volume of note)
sound_state_machine_piano:
   PUSH BC                     ; Save registers
   PUSH DE                     ;
   PUSH HL                     ;
   PUSH AF                     ;
  
; Load current state
; STOP==0, PLAY==1
   LD a, (RAM_SOUND_STATE)     ;   
   CP 0                        ;
   JP Z, ssm_end               ; Skip remainder of routine
  
; Load song index - get current note and frequency
   LD hl, (RAM_SOUND_SONG)     ;
   LD a, (hl)                  ; Get current note
   LD b, a                     ;
 
   LD hl, $0000                ; Calculate offset (15 volume + 2 frequency)
   LD de, 17                   ; Store in DE

   LD a, 0                     ; No offset?
   CP b                        ;
   JP Z, ssm_loop_skip         ;
ssm_loop_001:  
   ADD hl, de                  ; Add until correct address is obtained
   DEC b                       ;
   JP NZ, ssm_loop_001         ;  

ssm_loop_skip:
   EX de, hl                   ;
   LD hl, sound_piano_note_0   ; Base of note
   ADD hl, de                  ; Offset
  
; Write the frequency to PSG
; hl=frequency_address
   LD a, (hl)                  ; 
   OUT (PORT_PSG), a           ; Write frequency byte 1
   INC hl                      ;
   LD a, (hl)                  ; 
   OUT (PORT_PSG), a           ; Write frequency byte 2
   INC hl                      ;
  
; Load the volume
; hl=base_address + 1, de=index
; Add to get address of volume
; Write the volume to PSG
    LD de, (RAM_SOUND_INDEX)   ;
    ADD hl, de                 ; base + 2 = base + 2 + offset
    LD a, (hl)                 ;
    OUT (PORT_PSG), a          ; Write volume  

; increment index and store
; if index==15, reset index and increment RAM_SOUND_SONG
; if hit delimiter in RAM_SOUND_SONG, go to stop state
   INC de                      ;
   LD (RAM_SOUND_INDEX), de    ; Increment index
   
   LD a, e                     ; Reset at 15
   CP 15                       ; 
   JP NZ, ssm_end              ;
   
   LD de, $0000                ; Clear DE
   LD (RAM_SOUND_INDEX), de    ; Reset index   
   
   LD hl, (RAM_SOUND_SONG)     ; Increment to next note
   INC hl                      ;
   LD (RAM_SOUND_SONG), hl     ;
  
   LD a, (hl)                  ; Is this note the delimiter ($7F)?
   CP $7F                      ; 
   JP NZ, ssm_end              ;
  
   LD a, 0                     ; Go to STOP mode
   LD (RAM_SOUND_STATE), a     ;

ssm_end:
   POP AF                      ; Restore registers
   POP HL                      ;
   POP DE                      ;
   POP BC                      ;
   RET                         ; End subroutine

;----------------------------------------
; sound_state_machine_piano2
;
; Before calling this routine,
; set these variables:
;
; RAM_SOUND_STATE2 (0 on, 1 off)
; RAM_SOUND_SONG2 (base address of 1st note within song)
; RAM_SOUND_INDEX2 (0-59, index into volume of note)
sound_state_machine_piano2:
   PUSH BC                     ; Save registers
   PUSH DE                     ;
   PUSH HL                     ;
   PUSH AF                     ;
  
; Load current state
; STOP==0, PLAY==1
   LD a, (RAM_SOUND_STATE2)    ;   
   CP 0                        ;
   JP Z, ssm_end2              ; Skip remainder of routine
  
; Load song index - get current note and frequency
   LD hl, (RAM_SOUND_SONG2)    ;
   LD a, (hl)                  ; Get current note
   LD b, a                     ;
 
   LD hl, $0000                ; Calculate offset 
   LD de, 17                   ; Store in DE

   LD a, 0                     ; No offset?
   CP b                        ;
   JP Z, ssm_loop_skip2        ;
ssm_loop_0012:  
   ADD hl, de                  ; Add until correct address is obtained
   DEC b                       ;
   JP NZ, ssm_loop_0012        ;  

ssm_loop_skip2:
   EX de, hl                   ;
   LD hl, sound_piano2_note_0  ; Base of note
   ADD hl, de                  ; Offset
  
; Write the frequency to PSG
; hl=frequency_address
   LD a, (hl)                  ; 
   OUT (PORT_PSG), a           ; Write frequency byte 1
   INC hl                      ;
   LD a, (hl)                  ; 
   OUT (PORT_PSG), a           ; Write frequency byte 2
   INC hl                      ;
  
; Load the volume
; hl=base_address + 1, de=index
; Add to get address of volume
; Write the volume to PSG
    LD de, (RAM_SOUND_INDEX2)  ;
    ADD hl, de                 ; base + 2 = base + 2 + offset
    LD a, (hl)                 ;
    OUT (PORT_PSG), a          ; Write volume  

; increment index and store
; if index==15, reset index and increment RAM_SOUND_SONG
; if hit delimiter in RAM_SOUND_SONG, go to stop state
   INC de                      ;
   LD (RAM_SOUND_INDEX2), de   ; Increment index
   
   LD a, e                     ; Reset at 15
   CP 15                       ; 
   JP NZ, ssm_end2             ;
   
   LD de, $0000                ; Clear DE
   LD (RAM_SOUND_INDEX2), de   ; Reset index   
   
   LD hl, (RAM_SOUND_SONG2)    ; Increment to next note
   INC hl                      ;
   LD (RAM_SOUND_SONG2), hl    ;
  
   LD a, (hl)                  ; Is this note the delimiter ($7F)?
   CP $7F                      ; 
   JP NZ, ssm_end2             ;
  
   LD a, 0                     ; Go to STOP mode
   LD (RAM_SOUND_STATE2), a    ;

ssm_end2:
   POP AF                      ; Restore registers
   POP HL                      ;
   POP DE                      ;
   POP BC                      ;
   RET                         ; End subroutine

;----------------------------------------
; sound_state_machine_guitar3
;
; Before calling this routine,
; set these variables:
;
; RAM_SOUND_STATE2 (0 on, 1 off)
; RAM_SOUND_SONG2 (base address of 1st note within song)
; RAM_SOUND_INDEX2 (0-59, index into volume of note)
sound_state_machine_guitar3:
   PUSH BC                     ; Save registers
   PUSH DE                     ;
   PUSH HL                     ;
   PUSH AF                     ;
  
; Load current state
; STOP==0, PLAY==1
   LD a, (RAM_SOUND_STATE3)    ;   
   CP 0                        ;
   JP Z, ssm_end3              ; Skip remainder of routine
  
; Load song index - get current note and frequency
   LD hl, (RAM_SOUND_SONG3)    ;
   LD a, (hl)                  ; Get current note
   LD b, a                     ;
 
   LD hl, $0000                ; Calculate offset 
   LD de, 17                   ; Store in DE

   LD a, 0                     ; No offset?
   CP b                        ;
   JP Z, ssm_loop_skip3        ;
ssm_loop_0013:  
   ADD hl, de                  ; Add until correct address is obtained
   DEC b                       ;
   JP NZ, ssm_loop_0013        ;  

ssm_loop_skip3:
   EX de, hl                   ;
   LD hl, sound_guitar3_note_0 ; Base of note
   ADD hl, de                  ; Offset
  
; Write the frequency to PSG
; hl=frequency_address
   LD a, (hl)                  ; 
   OUT (PORT_PSG), a           ; Write frequency byte 1
   INC hl                      ;
   LD a, (hl)                  ; 
   OUT (PORT_PSG), a           ; Write frequency byte 2
   INC hl                      ;
  
; Load the volume
; hl=base_address + 1, de=index
; Add to get address of volume
; Write the volume to PSG
    LD de, (RAM_SOUND_INDEX3)  ;
    ADD hl, de                 ; base + 2 = base + 2 + offset
    LD a, (hl)                 ;
    OUT (PORT_PSG), a          ; Write volume  

; increment index and store
; if index==15, reset index and increment RAM_SOUND_SONG
; if hit delimiter in RAM_SOUND_SONG, go to stop state
   INC de                      ;
   LD (RAM_SOUND_INDEX3), de   ; Increment index
   
   LD a, e                     ; Reset at 15
   CP 15                       ; 
   JP NZ, ssm_end3             ;
   
   LD de, $0000                ; Clear DE
   LD (RAM_SOUND_INDEX3), de   ; Reset index   
   
   LD hl, (RAM_SOUND_SONG3)    ; Increment to next note
   INC hl                      ;
   LD (RAM_SOUND_SONG3), hl    ;
  
   LD a, (hl)                  ; Is this note the delimiter ($7F)?
   CP $7F                      ; 
   JP NZ, ssm_end3             ;
  
   LD a, 0                     ; Go to STOP mode
   LD (RAM_SOUND_STATE3), a    ;

ssm_end3:
   POP AF                      ; Restore registers
   POP HL                      ;
   POP DE                      ;
   POP BC                      ;
   RET                         ; End subroutine

;----------------------------------------
; sound_jump_sfx
;
; channel 1, smooth
sound_jump_sfx:
   PUSH BC                     ; Save registers
   PUSH DE                     ;
   PUSH HL                     ;
   PUSH AF                     ;

   LD a, 1                     ; PLAY
   LD (RAM_SOUND_STATE), a     ;        
   LD (RAM_SOUND_STATE2), a    ;  

   LD a, (RAM_LEVEL_B)         ; odd=bread, even=butter
   AND $01                     ;
   CP $01                      ;
   JP NZ, sjsfx_skip           ;
   
   LD hl, sound_jump_sfx1      ; Initialize intro song
   LD (RAM_SOUND_SONG), hl     ;
   LD hl, sound_jump_sfx2      ; Initialize intro song
   LD (RAM_SOUND_SONG2), hl    ;  
   JP sjsfx_skip2              ;

sjsfx_skip:
   LD hl, rev_sound_jump_sfx1  ; Initialize intro song
   LD (RAM_SOUND_SONG), hl     ;
   LD hl, rev_sound_jump_sfx2  ; Initialize intro song
   LD (RAM_SOUND_SONG2), hl    ; 
   
sjsfx_skip2:   
   LD hl, $0000                ; Initialize index
   LD (RAM_SOUND_INDEX), hl    ;   
   LD (RAM_SOUND_INDEX2), hl   ;  
   POP AF                      ; Restore registers
   POP HL                      ;
   POP DE                      ;
   POP BC                      ;
   RET                         ; End subroutine

sound_jump_sfx1:
.db 5, 9, 7, 11, $7F   
sound_jump_sfx2:
.db 3, 7, 5, 9, $7F 
rev_sound_jump_sfx1:
.db 11, 7, 9, 5, $7F   
rev_sound_jump_sfx2:
.db 9, 5, 7, 3, $7F 

;----------------------------------------
; sound_pow_sfx
;
; channel 3, rough
sound_pow_sfx:
   PUSH BC                     ; Save registers
   PUSH DE                     ;
   PUSH HL                     ;
   PUSH AF                     ;

   LD a, 1                     ; PLAY
   LD (RAM_SOUND_STATE3), a    ;        

   LD a, (RAM_LEVEL_B)         ; odd=bread, even=butter
   AND $01                     ;
   CP $01                      ;
   JP NZ, spsfx_skip           ;
   
   LD hl, sound_pow_sfx1       ; Initialize intro song
   LD (RAM_SOUND_SONG3), hl    ;
   JP spsfx_skip2              ;

spsfx_skip:
   LD hl, rev_sound_pow_sfx1   ; Initialize intro song
   LD (RAM_SOUND_SONG3), hl    ; 
   
spsfx_skip2:   
   LD hl, $0000                ; Initialize index
   LD (RAM_SOUND_INDEX3), hl   ;     

   POP AF                      ; Restore registers
   POP HL                      ;
   POP DE                      ;
   POP BC                      ;
   RET                         ; End subroutine

sound_pow_sfx1:
.db 15, 14, 13, 11, $7F   
rev_sound_pow_sfx1:
.db 11, 13, 14, 15, $7F  

;----------------------------------------
; sound_shock_sfx
;
; Channel 3, rough
sound_shock_sfx:
   PUSH BC                     ; Save registers
   PUSH DE                     ;
   PUSH HL                     ;
   PUSH AF                     ;

   LD a, 1                     ; PLAY
   LD (RAM_SOUND_STATE3), a    ;    
   
   LD hl, sound_shock_sfx1     ; Initialize intro song
   LD (RAM_SOUND_SONG3), hl    ;
  
   LD hl, $0000                ; Initialize index  
   LD (RAM_SOUND_INDEX3), hl   ;   

   POP AF                      ; Restore registers
   POP HL                      ;
   POP DE                      ;
   POP BC                      ;
   RET                         ; End subroutine

sound_shock_sfx1:
.db 6, 5, 11, 10, 6, 5, 11, 10, $7F  

;----------------------------------------
; sound_level_start_sfx
;
; Channel 1, smooth
; Channel 2, smooth
sound_level_start_sfx:
   PUSH BC                     ; Save registers
   PUSH DE                     ;
   PUSH HL                     ;
   PUSH AF                     ;

   LD a, 0                     ; STOP    
   LD (RAM_SOUND_STATE3), a    ; 
   CALL sound_off              ;
   
   LD a, 1                     ; PLAY      
   LD (RAM_SOUND_STATE), a     ; 
   LD (RAM_SOUND_STATE2), a    ; 
   
   LD hl, sound_level_start_sfx1       ; Initialize intro song   
   LD (RAM_SOUND_SONG), hl     ;
   LD hl, sound_level_start_sfx2       ; Initialize intro song   
   LD (RAM_SOUND_SONG2), hl    ;
   LD hl, $0000                ; Initialize index   
   LD (RAM_SOUND_SONG3), hl    ;
   
   LD hl, $0000                ; Initialize index
   LD (RAM_SOUND_INDEX), hl    ;   
   LD (RAM_SOUND_INDEX2), hl   ; 
   LD (RAM_SOUND_INDEX3), hl   ; 
   
   POP AF                      ; Restore registers
   POP HL                      ;
   POP DE                      ;
   POP BC                      ;
   RET                         ; End subroutine

sound_level_start_sfx1:
.db  9, 11, 13, 8, 10, 9, 14, 9, 1, 7, 15, 14, $7F
sound_level_start_sfx2:
.db  8, 10, 12, 7,  9, 8, 13, 8, 0, 6, 14, 13, $7F

;----------------------------------------
; sound_ending_sfx
;
; Channel 1, smooth
; Channel 2, smooth
sound_ending_sfx:
   PUSH BC                     ; Save registers
   PUSH DE                     ;
   PUSH HL                     ;
   PUSH AF                     ;

   LD a, 1                     ; PLAY      
   LD (RAM_SOUND_STATE), a     ; 
   LD (RAM_SOUND_STATE2), a    ; 
   
   LD hl, sound_ending_sfx1    ; Initialize intro song   
   LD (RAM_SOUND_SONG), hl     ;
   LD hl, sound_ending_sfx2    ; Initialize intro song   
   LD (RAM_SOUND_SONG2), hl    ;
   
   LD hl, $0000                ; Initialize index
   LD (RAM_SOUND_INDEX), hl    ;   
   LD (RAM_SOUND_INDEX2), hl   ; 
   
   POP AF                      ; Restore registers
   POP HL                      ;
   POP DE                      ;
   POP BC                      ;
   RET                         ; End subroutine

sound_ending_sfx1:
.db  15, 15, 15, 14, 7, 10, 8, 9, 10, 3, 15, 4, 14, 7, 9, 7, 9, 15, 3, 14, 13, 7, 12, 11, 5, 10, 9, 15, 3, $7F
sound_ending_sfx2:
.db  13, 13, 13, 12, 5,  8, 6, 7,  8, 1, 13, 2, 12, 5, 7, 5, 7, 13, 1, 12, 11, 5, 10,  9, 3,  8, 7, 13, 1, $7F

;----------------------------------------
; sound_title_sfx
;
; Turn everything off
sound_start_song_1:
sound_title_sfx:
   PUSH BC                     ; Save registers
   PUSH DE                     ;
   PUSH HL                     ;
   PUSH AF                     ;

   LD a, 0                     ; STOP 
   LD (RAM_SOUND_STATE), a     ; 
   LD (RAM_SOUND_STATE2), a    ;    
   LD (RAM_SOUND_STATE3), a    ; 
   CALL sound_off              ;
   
   POP AF                      ; Restore registers
   POP HL                      ;
   POP DE                      ;
   POP BC                      ;
   RET                         ; End subroutine



;----------------------------------------
; sound_select_sfx
;
; Channel 1, smooth
; Channel 2, smooth
sound_select_sfx:
   PUSH BC                     ; Save registers
   PUSH DE                     ;
   PUSH HL                     ;
   PUSH AF                     ;

   LD a, 1                     ; PLAY 
   LD (RAM_SOUND_STATE), a     ;   
   LD (RAM_SOUND_STATE2), a    ;       

   LD hl, sound_select_sfx1    ; Initialize intro song
   LD (RAM_SOUND_SONG), hl     ;
   LD hl, sound_select_sfx2    ; Initialize intro song
   LD (RAM_SOUND_SONG2), hl    ;
   
   LD hl, $0000                ; Initialize index
   LD (RAM_SOUND_INDEX), hl    ;   
   LD (RAM_SOUND_INDEX2), hl   ;   
   
   POP AF                      ; Restore registers
   POP HL                      ;
   POP DE                      ;
   POP BC                      ;
   RET                         ; End subroutine

sound_select_sfx1:
.db 9, 11, $7F  
sound_select_sfx2:
.db 1, 3, $7F  

;----------------------------------------
; sound_title_start_sfx
;
; Channel 1, smooth
; Channel 2, smooth
sound_title_start_sfx:
   PUSH BC                     ; Save registers
   PUSH DE                     ;
   PUSH HL                     ;
   PUSH AF                     ;

   LD a, 0                     ; STOP    
   LD (RAM_SOUND_STATE3), a    ; 
   CALL sound_off              ;
   
   LD a, 1                     ; PLAY      
   LD (RAM_SOUND_STATE), a     ; 
   LD (RAM_SOUND_STATE2), a    ; 
   
   LD hl, sound_title_start_sfx1 ; Initialize intro song   
   LD (RAM_SOUND_SONG), hl     ;
   LD hl, sound_title_start_sfx2 ; Initialize intro song   
   LD (RAM_SOUND_SONG2), hl    ;
   LD hl, $0000                ; Initialize index   
   LD (RAM_SOUND_SONG3), hl    ;
   
   LD hl, $0000                ; Initialize index
   LD (RAM_SOUND_INDEX), hl    ;   
   LD (RAM_SOUND_INDEX2), hl   ; 
   LD (RAM_SOUND_INDEX3), hl   ; 
   
   POP AF                      ; Restore registers
   POP HL                      ;
   POP DE                      ;
   POP BC                      ;
   RET                         ; End subroutine
   
sound_title_start_sfx1:
.db  9, 11, 9, 11, 8, 10, 10, 12, $7F
sound_title_start_sfx2:
.db  7,  9, 7,  9, 6,  8,  8, 10, $7F


; low byte, then high byte 
;----------------------
tool_note_table:
;    LOW  HIGH
; .db $00, $00  ; No sound - pause
; .db $08, $0E  ; G3
; .db $02, $0E  ; GS3
; .db $08, $0C  ; A4
; .db $01, $0C  ; AS4
; .db $0D, $0F  ; B4
; .db $0E, $0F  ; C4
; .db $01, $0E  ; CS4
; .db $05, $0D  ; D4
; .db $09, $0C  ; DS4
; .db $0E, $0B  ; E4
; .db $03, $0B  ; F4
; .db $09, $0A  ; FS4
; .db $0F, $09  ; G4
; .db $07, $09  ; GS4
; .db $0E, $08  ; A5
; .db $06, $08  ; AS5
; .db $0F, $07  ; B5
; .db $07, $07  ; C5
;----------------------

;-------------------------------------------
; Instrument 1 - Piano, channel 0
;
sound_piano_note_0:
.db $88, $0E  ; G3
.db $9F, $97, $93, $92, $92, $91, $90, $90, $90, 
.db $90, $91, $92, $93, $97, $9F, 
sound_piano_note_1:
.db $82, $0E  ; GS3
.db $9F, $97, $93, $92, $92, $91, $90, $90, $90, 
.db $90, $91, $92, $93, $97, $9F, 
sound_piano_note_2:
.db $88, $0C  ; A4
.db $9F, $97, $93, $92, $92, $91, $90, $90, $90, 
.db $90, $91, $92, $93, $97, $9F,  
sound_piano_note_3:
.db $81, $0C  ; AS4
.db $9F, $97, $93, $92, $92, $91, $90, $90, $90, 
.db $90, $91, $92, $93, $97, $9F, 
sound_piano_note_4:
.db $8D, $0F  ; B4
.db $9F, $97, $93, $92, $92, $91, $90, $90, $90, 
.db $90, $91, $92, $93, $97, $9F, 
sound_piano_note_5:
.db $8E, $0F  ; C4
.db $9F, $97, $93, $92, $92, $91, $90, $90, $90, 
.db $90, $91, $92, $93, $97, $9F, 
sound_piano_note_6:
.db $81, $0E  ; CS4
.db $9F, $97, $93, $92, $92, $91, $90, $90, $90, 
.db $90, $91, $92, $93, $97, $9F, 
sound_piano_note_7:
.db $85, $0D  ; D4
.db $9F, $97, $93, $92, $92, $91, $90, $90, $90, 
.db $90, $91, $92, $93, $97, $9F, 
sound_piano_note_0a:
.db $89, $0C  ; DS4
.db $9F, $97, $93, $92, $92, $91, $90, $90, $90, 
.db $90, $91, $92, $93, $97, $9F, 
sound_piano_note_1a:
.db $8E, $0B  ; E4
.db $9F, $97, $93, $92, $92, $91, $90, $90, $90, 
.db $90, $91, $92, $93, $97, $9F,  
sound_piano_note_2a:
.db $83, $0B  ; F4
.db $9F, $97, $93, $92, $92, $91, $90, $90, $90, 
.db $90, $91, $92, $93, $97, $9F,  
sound_piano_note_3a:
.db $89, $0A  ; FS4
.db $9F, $97, $93, $92, $92, $91, $90, $90, $90, 
.db $90, $91, $92, $93, $97, $9F, 
sound_piano_note_4a:
.db $8F, $09  ; G4
.db $9F, $97, $93, $92, $92, $91, $90, $90, $90, 
.db $90, $91, $92, $93, $97, $9F,   
sound_piano_note_5a:
.db $87, $09  ; GS4
.db $9F, $97, $93, $92, $92, $91, $90, $90, $90, 
.db $90, $91, $92, $93, $97, $9F,   
sound_piano_note_6a:
.db $8E, $08  ; A5
.db $9F, $97, $93, $92, $92, $91, $90, $90, $90, 
.db $90, $91, $92, $93, $97, $9F, 
sound_piano_note_7a:
.db $86, $08  ; AS5
.db $9F, $97, $93, $92, $92, $91, $90, $90, $90, 
.db $90, $91, $92, $93, $97, $9F,      

;-------------------------------------------
; Instrument 2 - Piano, channel 1
;
sound_piano2_note_0:
.db $A8, $0E  ; G3
.db $BF, $B7, $B3, $B2, $B2, $B1, $B0, $B0, $B0, 
.db $B0, $B1, $B2, $B3, $B7, $BF, 
sound_piano2_note_1:
.db $A2, $0E  ; GS3
.db $BF, $B7, $B3, $B2, $B2, $B1, $B0, $B0, $B0, 
.db $B0, $B1, $B2, $B3, $B7, $BF,  
sound_piano2_note_2:
.db $A8, $0C  ; A4
.db $BF, $B7, $B3, $B2, $B2, $B1, $B0, $B0, $B0, 
.db $B0, $B1, $B2, $B3, $B7, $BF,  
sound_piano2_note_3:
.db $A1, $0C  ; AS4
.db $BF, $B7, $B3, $B2, $B2, $B1, $B0, $B0, $B0, 
.db $B0, $B1, $B2, $B3, $B7, $BF,  
sound_piano2_note_4:
.db $AD, $0F  ; B4
.db $BF, $B7, $B3, $B2, $B2, $B1, $B0, $B0, $B0, 
.db $B0, $B1, $B2, $B3, $B7, $BF, 
sound_piano2_note_5:
.db $AE, $0F  ; C4
.db $BF, $B7, $B3, $B2, $B2, $B1, $B0, $B0, $B0, 
.db $B0, $B1, $B2, $B3, $B7, $BF, 
sound_piano2_note_6:
.db $A1, $0E  ; CS4
.db $BF, $B7, $B3, $B2, $B2, $B1, $B0, $B0, $B0, 
.db $B0, $B1, $B2, $B3, $B7, $BF,  
sound_piano2_note_7:
.db $A5, $0D  ; D4
.db $BF, $B7, $B3, $B2, $B2, $B1, $B0, $B0, $B0, 
.db $B0, $B1, $B2, $B3, $B7, $BF,  
sound_piano2_note_0a:
.db $A9, $0C  ; DS4
.db $BF, $B7, $B3, $B2, $B2, $B1, $B0, $B0, $B0, 
.db $B0, $B1, $B2, $B3, $B7, $BF,   
sound_piano2_note_1a:
.db $AE, $0B  ; E4
.db $BF, $B7, $B3, $B2, $B2, $B1, $B0, $B0, $B0, 
.db $B0, $B1, $B2, $B3, $B7, $BF,   
sound_piano2_note_2a:
.db $A3, $0B  ; F4
.db $BF, $B7, $B3, $B2, $B2, $B1, $B0, $B0, $B0, 
.db $B0, $B1, $B2, $B3, $B7, $BF,     
sound_piano2_note_3a:
.db $A9, $0A  ; FS4
.db $BF, $B7, $B3, $B2, $B2, $B1, $B0, $B0, $B0, 
.db $B0, $B1, $B2, $B3, $B7, $BF,  
sound_piano2_note_4a:
.db $AF, $09  ; G4
.db $BF, $B7, $B3, $B2, $B2, $B1, $B0, $B0, $B0, 
.db $B0, $B1, $B2, $B3, $B7, $BF,    
sound_piano2_note_5a:
.db $A7, $09  ; GS4
.db $BF, $B7, $B3, $B2, $B2, $B1, $B0, $B0, $B0, 
.db $B0, $B1, $B2, $B3, $B7, $BF,    
sound_piano2_note_6a:
.db $AE, $08  ; A5
.db $BF, $B7, $B3, $B2, $B2, $B1, $B0, $B0, $B0, 
.db $B0, $B1, $B2, $B3, $B7, $BF,  
sound_piano2_note_7a:
.db $A6, $08  ; AS5
.db $BF, $B7, $B3, $B2, $B2, $B1, $B0, $B0, $B0, 
.db $B0, $B1, $B2, $B3, $B7, $BF,  

;-------------------------------------------
; Instrument 3 - Guitar, channel 2
;
sound_guitar3_note_0:
.db $C8, $0E  ; G3
.db $DC, $D5, $D8, $D3, $D5, $D1, $D0, $D5, $D0, 
.db $D5, $D1, $D9, $D5, $DA, $DF, 
sound_guitar3_note_1:
.db $C2, $0E  ; GS3
.db $DC, $D5, $D8, $D3, $D5, $D1, $D0, $D5, $D0, 
.db $D5, $D1, $D9, $D5, $DA, $DF,   
sound_guitar3_note_2:
.db $C8, $0C  ; A4
.db $DC, $D5, $D8, $D3, $D5, $D1, $D0, $D5, $D0, 
.db $D5, $D1, $D9, $D5, $DA, $DF,  
sound_guitar3_note_3:
.db $C1, $0C  ; AS4
.db $DC, $D5, $D8, $D3, $D5, $D1, $D0, $D5, $D0, 
.db $D5, $D1, $D9, $D5, $DA, $DF,  
sound_guitar3_note_4:
.db $CD, $0F  ; B4
.db $DC, $D5, $D8, $D3, $D5, $D1, $D0, $D5, $D0, 
.db $D5, $D1, $D9, $D5, $DA, $DF,  
sound_guitar3_note_5:
.db $CE, $0F  ; C4
.db $DC, $D5, $D8, $D3, $D5, $D1, $D0, $D5, $D0, 
.db $D5, $D1, $D9, $D5, $DA, $DF, 
sound_guitar3_note_6:
.db $C1, $0E  ; CS4
.db $DC, $D5, $D8, $D3, $D5, $D1, $D0, $D5, $D0, 
.db $D5, $D1, $D9, $D5, $DA, $DF, 
sound_guitar3_note_7:
.db $C5, $0D  ; D4
.db $DC, $D5, $D8, $D3, $D5, $D1, $D0, $D5, $D0, 
.db $D5, $D1, $D9, $D5, $DA, $DF,  
sound_guitar3_note_0a:
.db $C9, $0C  ; DS4
.db $DC, $D5, $D8, $D3, $D5, $D1, $D0, $D5, $D0, 
.db $D5, $D1, $D9, $D5, $DA, $DF,  
sound_guitar3_note_1a:
.db $CE, $0B  ; E4
.db $DC, $D5, $D8, $D3, $D5, $D1, $D0, $D5, $D0, 
.db $D5, $D1, $D9, $D5, $DA, $DF,    
sound_guitar3_note_2a:
.db $C3, $0B  ; F4
.db $DC, $D5, $D8, $D3, $D5, $D1, $D0, $D5, $D0, 
.db $D5, $D1, $D9, $D5, $DA, $DF,  
sound_guitar3_note_3a:
.db $C9, $0A  ; FS4
.db $DC, $D5, $D8, $D3, $D5, $D1, $D0, $D5, $D0, 
.db $D5, $D1, $D9, $D5, $DA, $DF,  
sound_guitar3_note_4a:
.db $CF, $09  ; G4
.db $DC, $D5, $D8, $D3, $D5, $D1, $D0, $D5, $D0, 
.db $D5, $D1, $D9, $D5, $DA, $DF,    
sound_guitar3_note_5a:
.db $C7, $09  ; GS4
.db $DC, $D5, $D8, $D3, $D5, $D1, $D0, $D5, $D0, 
.db $D5, $D1, $D9, $D5, $DA, $DF,     
sound_guitar3_note_6a:
.db $CE, $08  ; A5
.db $DC, $D5, $D8, $D3, $D5, $D1, $D0, $D5, $D0, 
.db $D5, $D1, $D9, $D5, $DA, $DF, 
sound_guitar3_note_7a:
.db $C6, $08  ; AS5
.db $DC, $D5, $D8, $D3, $D5, $D1, $D0, $D5, $D0, 
.db $D5, $D1, $D9, $D5, $DA, $DF, 
   
   
   