How to use: Load the Hex file below onto the SPB using your Pickit2 or Pickit3? then power on SPB, the first FX sound should play and repeat, Next press and hold the JUMP button untill the LCD displays the next Sound/Song and then release the button to activate next sound/song.
Note: you may need to press and hold the JUMP button for atleast 10secs on certain sounds/songs for LCD to change to next sound/song.
The Programme works by cycling through each sound/song in sequence.
You will then have to reload the SPB Game Hex found at the bottom of the page here Super Pixel Bros Game to play SPB again
Code: Select all
' Super Pixel Bros Sound Test by Bitfogav Sept 2012
Device = 18F4550
Clock = 8
Config FOSC= INTOSCIO_EC
// some LCD options...
#option LCD_DATA = PORTB.4
#option LCD_EN = PORTE.0
#option LCD_RS = PORTE.1
Include "LCD.bas"
Include "convert.bas"
Include "utils.bas"
// const declaration
Const FXsound(8) As String = ("FX Jump ","FX Falling","FX Squash ","FX Dying ","FX Coins ","FX Phaser ","Title Song","End Song ")
// variable declaration
Dim Button As PORTD.0
Dim SoundSelect0 As PORTC.2
Dim SoundSelect1 As PORTC.1
Dim SoundSelect2 As PORTE.2
Dim SoundEnable As PORTA.5
Dim soundSelect As Byte
// Sub Routines
Sub testSounds()
Select soundSelect
Case 0
SoundSelect0 = 0 '
SoundSelect1 = 0 ' Jump
SoundSelect2 = 0 '
SoundEnable = 1 ' Enable sound
SoundEnable = 0
DelayMS(2000) ' delay to play FX
Case 1
SoundSelect0 = 1 '
SoundSelect1 = 0 ' Falling
SoundSelect2 = 0 '
SoundEnable = 1 ' Enable sound
SoundEnable = 0
DelayMS(2000) ' delay to play FX
Case 2
SoundSelect0 = 0 '
SoundSelect1 = 1 ' Squash
SoundSelect2 = 0 '
SoundEnable = 1 ' Enable sound
SoundEnable = 0
DelayMS(2000) ' delay to play FX
Case 3
SoundSelect0 = 1 '
SoundSelect1 = 1 ' Dying
SoundSelect2 = 0 '
SoundEnable = 1 ' Enable sound
SoundEnable = 0
DelayMS(4000) ' delay to play FX
Case 4
SoundSelect0 = 0 '
SoundSelect1 = 0 ' Coins
SoundSelect2 = 1 '
SoundEnable = 1 ' Enable sound
SoundEnable = 0
DelayMS(2000) ' delay to play FX
Case 5
SoundSelect0 = 1 '
SoundSelect1 = 0 ' Phaser
SoundSelect2 = 1 '
SoundEnable = 1 ' Enable sound
SoundEnable = 0
DelayMS(2000) ' delay to play FX
Case 6
SoundSelect0 = 0 '
SoundSelect1 = 1 ' Title song
SoundSelect2 = 1 '
SoundEnable = 1 ' Enable song
DelayMS(10000) ' delay to play song
SoundEnable = 0 ' Disable song
Case 7
SoundSelect0 = 1 '
SoundSelect1 = 1 ' End song
SoundSelect2 = 1 '
SoundEnable = 1 ' Enable song
DelayMS(10000) ' delay to play song
SoundEnable = 0 ' Disable song
End Select
End Sub
// Start Of Program...
OSCCON = %01111111 // Sets the internal oscillator for 8Mhz
SetAllDigital // digital I/O's
TRISA = %11011111
TRISB = %00001111
TRISC = %11111001
TRISD = %11111111
TRISE = %11111000
SoundEnable = 0
soundSelect = 0
LCD.WriteAt(1,1,"SBP Sound Test")
LCD.WriteAt(2,1,FXsound(soundSelect))
// Main Loop
While True()
testSounds()
If Button = 0 Then
Inc(soundSelect)
If soundSelect = 8 Then
soundSelect = 0
EndIf
LCD.WriteAt(2,1,FXsound(soundSelect))
Repeat
SoundEnable = 0
Until Button = 1
EndIf
Wend