A Simple Programme to test the sound on the SPB

Post Here To Discuss The Super Pixel Bros Video Game

Moderators: Chuckt, Garth, bitfogav

Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

A Simple Programme to test the sound on the SPB

Post by bitfogav » Sun Sep 09, 2012 1:46 am

This is A simple programme to show the sounds on the SPB.

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.
SPB_Sound Test.rar
(1.17 KiB) Downloaded 766 times
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 
If you don't know what Voltage your country is using, you shouldn't be doing electronics ;-)

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: A Simple Programme to test the sound on the SPB

Post by brad » Sun Sep 09, 2012 11:03 pm

Cheers bitfogav - always such a helpful guy!

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 3 guests