screen:clear()
-- MENU --

Select = 1
maxSelect = 3
gamestate = "Menu"
IntroFrame = 1


-- ##### Load Sounds #####
Move = Sound.load("Sounds/Move.wav",false)
SelectSound = Sound.load("Sounds/Select.wav",false)
Music.playFile("Sounds/Title.xm", true)

MenuSelect = Image.load("icons/MenuSelection.png")
menuBackground = Image.load("background/mbg.png")
Back = Image.load("icons/Back.png")
usb = Image.load("icons/usb.png")
ton = Image.load("icons/ton.png")

 
 screen:blit(0, 0, menuBackground)

     if pad:down() and oldpad:down() ~= pad:down() and Select <= 3 then
          Select = Select + 1
          Move:play()
     end
     if pad:up() and oldpad:up() ~= pad:up() and Select >= 1 then
          Select = Select - 1
          Move:play()
     end



	if Select > maxSelect then
		Select = 1
	elseif Select <= 0 then
		Select = maxSelect
	end

     if Select == 1 then
          screen:blit(0,157,MenuSelect)
          screen:blit(15,170,usb)
          screen:blit(15,200,ton)
          screen:blit(15,230,Back)
     end
     if Select == 2 then
          screen:blit(0,187,MenuSelect)
          screen:blit(15,170,usb)
          screen:blit(15,200,ton)
          screen:blit(15,230,Back)
     end
     if Select == 3 then
          screen:blit(0,217,MenuSelect)
          screen:blit(15,170,usb)
          screen:blit(15,200,ton)
          screen:blit(15,230,Back)
     end

     if Select == 1 and pad:cross() and oldpad:cross() ~= pad:cross() then
                System.usbDiskModeActivate()
     end

     if Select == 1 and pad:circle() and oldpad:circle() ~= pad:circle() then
                System.usbDiskModeDeactivate()
     end

     if Select == 2 and pad:cross() and oldpad:cross() ~= pad:cross() then
                Music.volume(128)
     end


     if Select == 2 and pad:circle() and oldpad:circle() ~= pad:circle() then
                Music.volume(0)
     end

     if Select == 3 and pad:cross() and oldpad:cross() ~= pad:cross() then
          gamestate = "Menu"
     end

