red = Color.new(255, 0, 0)
white = Color.new(255, 255, 255)
unloadbuff()
-----Menu--------------------------------------------
Select = 1
maxSelect = 3
menuBackground1=Image.load("background/mbg.png")
hud=Image.load("icons/hud.png")
oldpad = Controls.read()
----Menu---------------------------------------------
b2=Image.load("syscheck/b2.png")
b1=Image.load("syscheck/b1.png")
b3=Image.load("syscheck/b3.png")
b4=Image.load("syscheck/b4.png")
b5=Image.load("syscheck/b5.png")
b6=Image.load("syscheck/b6.png")
----Menu---------------------------------------------
while true do
pad = Controls.read()
screen:clear()
screen:blit(0,0,menuBackground1)
screen:blit(0,0,hud)
-----------------------------------------------------
if pad:right() and oldpad:right() ~= pad:right() then
Select = Select - 1
end
if pad:left() and oldpad:left() ~= pad:left() then
Select = Select + 1
end
if Select > maxSelect then
Select = 1
elseif Select <= 0 then
Select = maxSelect
end

if Select == 1 then
screen:blit(380,50,b4)
screen:blit(300,50,b2)
screen:blit(220,50,b3)
end

if Select == 2 then
screen:blit(380,50,b1)
screen:blit(300,50,b5)
screen:blit(220,50,b3)
end

if Select == 3 then
screen:blit(380,50,b1)
screen:blit(300,50,b2)
screen:blit(220,50,b6)
end

if pad:cross() and Select == 1 then
dofile("syscheck/name.lua")
end
if pad:cross() and Select == 2 then
dofile("syscheck/fw.lua")
end
if pad:cross() and Select == 3 then
dofile("index.lua")
end

screen.waitVblankStart()
screen.flip()
oldpad = pad
end