1
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

rem Colour Bars program.
rem By Wenlock Burton 17 July 2008
Rem Actually written on a PS3
'V2.0 rewritten on a flaky old PS2 in June 2015
label init
wi=640 : hi=512
sel=8 :rem display menu on startup
open window wi,hi
label main
repeat
setdrawbuf dd
dd=1-dd
setdispbuf dd
window origin "lb"
setrgb 0,0,0,20
setrgb 1,0,255,255
'New selection routine
'Read and update sel
a=peek("port1")
if a=0 hold=0
if a>0 and hold=0 then
if and(a,64)>0 then sel=sel+1:hold=1
fi
if sel>8 then sel=1
fi
if and(a,16)>0 then sel=sel-1:hold=1
fi
if sel<1 then sel=8
fi
fi
'Display selected test:
if sel=1 then gosub cbar
fi
if sel=2 then gosub greyscale
fi
if sel=3 then gosub Red
fi
if sel=4 then gosub Green
fi
if sel=5 then gosub Blue
fi
if sel=6 then gosub White
fi
if sel=7 then gosub crosshatch
fi
if sel=8 then gosub list
fi
until (1=2)
label Red
window origin "lb"
setrgb 0,255,0,0
clear window
return
label Green
window origin "lb"
setrgb 0,0,255,0
clear window
return
label Blue
window origin "lb"
setrgb 0,0,0,255
clear window
return
label White
window origin "lb"
setrgb 0,255,255,255
clear window
return
label cbar
window origin "lb"
rem dark blue bg
setrgb 0,0,0,40
rem cyan text, 90% intensity
setrgb 1,0,240,240
clear window
rem Draw colour bars
restore
for x=1 to 640 step 80
read r,g,b
setrgb 1,r,g,b
fill rect x,1 to x+80,512
next x
for r=220 to 224
rem circle
circle 320, 240, r
next r
rem ident
text 100, 50, "VK3YWB"
return
label crosshatch
window origin "lb"
rem dark blue bg
setrgb 0,0,0,40
setrgb 1,255,255,255
clear window
rem horiz lines
for y=1 to 512 step 29.9
line 0,y to 640,y
next y
rem vert lines
for x=0 to 639 step 29
line x,0 to x,512
next x
return
label greyscale
setrgb 0,0,0,40
rem cyan text, 90% intensity
setrgb 1,0,240,240
clear window
for x=1 to 640 step 80
b=int(x/2.4)
setrgb 1,255-b,255-b,255-b
fill rect x,1 to x+80,512
next x
rem circle
for r=220 to 224
circle 320, 240, r
next r
rem ident
text 100, 50, "VK3YWB"
return
label list
clear window
setrgb 1,255,255,255
text 240,470, "Screen Test Program"
text 210,450, "List of available patterns"
setrgb 1,255,0,255
text 20,390, "1) Colour Bars"
setrgb 1,180,180,180
text 20,360, "2) Greyscale"
setrgb 1,255,0,0
text 20,330, "3) Red Raster"
setrgb 1,0,255,0
text 20,300, "4) Green Raster"
setrgb 1,0,0,255
text 20,270, "5) Blue Raster"
setrgb 1,255,255,255
text 20,240, "6) White Raster"
setrgb 1,125,125,125
text 20,210, "7) Crosshatch"
setrgb 1,180,180,180
text 45,100, "Use the D-Pad Left and Right buttons to select patterns"
return
Rem RGB values for colour bars
data 255,255,255 : rem White
data 255,255,0 : rem Yellow
data 0,255,255 : rem Cyan
data 0,255,0 : rem Green
data 255,0,255 : rem Magenta
data 255,0,0 : rem Red
data 0,0,255 : rem Blue
data 50,50,50 : rem Black
'*** PS Controller diagnostic by Wenlock Burton 2008
'
'*** Displays buttons pressed on controller 1 and 2
'
' proc_buttons takes buttons and returns names in button$
open window 640,512
setrgb 0,0,20,20
setrgb 1,0,255,255
curbuf=0
buttons=0
buttons1=0
buttons2=0
button$=" "
button1$=" "
button2$=" "
cbuttons=0
fgred=25: fggreen=255: fgblue=255
cbred=105: cbgreen=105: cbblue=105
clear window
gosub disp_result
gosub flip_screen
label loop
gosub read_buttons
rem Process Controller 1 buttons
buttons=buttons1
gosub proc_buttons
button1$=button$
rem process Controller 2 buttons
buttons=buttons2
gosub proc_buttons
button2$=button$
gosub disp_result
gosub flip_screen
goto loop
label flip_screen
setdispbuf curbuf
curbuf=1-curbuf
setdrawbuf curbuf
return
label read_buttons
cbuttons=0
buttons1=0
buttons2=0
label read_kbd
cbuttons=buttons1+buttons2
if cbuttons<1 then
buttons1=peek("port1")
buttons2=peek("port2")
else goto read_kbd
fi
return
label proc_buttons
button$=""
if and (buttons,1)=1 then button$="Select "
fi
if and (buttons,2)=2 then button$=button$+"L3 "
fi
if and (buttons,4)=4 then button$=button$+"R3 "
fi
if and (buttons,8)=8 then button$=button$+"Start "
fi
if and (buttons,16)=16 then button$=button$+"Up "
fi
if and (buttons,32)=32 then button$=button$+"Right "
fi
if and (buttons,64)=64 then button$=button$+"Down "
fi
if and (buttons,128)=128 then button$=button$+"Left "
fi
if and (buttons,256)=256 then button$=button$+"L2 "
fi
if and (buttons,512)=512 then button$=button$+"R2 "
fi
if and (buttons,1024)=1024 then button$=button$+"L1 "
fi
if and (buttons,2048)=2048 then button$=button$+"R1 "
fi
if and (buttons,4096)=4096 then button$=button$+"Triangle "
fi
if and (buttons,8192)=8192 then button$=button$+"Circle "
fi
if and (buttons,16384)=16384 then button$=button$+"Cross "
fi
if and (buttons,32768)=32768 then button$=button$+"Square "
fi
return
label disp_result
clear window
gosub cbars
setrgb 1,fgred, fggreen, fgblue
text 86,50,"Wenlock's Playstation Controller Diagnostic"
text 100,400,"Controller 1 buttons - "+button1$
text 100,420,"Controller 2 buttons - "+button2$
buttons=0
button$=""
button1$=""
button2$=""
return
label cbars
rem White bar
setrgb 1,cbred,cbgreen,cbblue
fill rectangle 0,0 to 80,512
rem Yellow bar
setrgb 1,cbred,cbgreen,0
fill rectangle 80,0 to 160,512
rem Cyan bar
setrgb 1,0,cbgreen,cbblue
fill rectangle 160,0 to 240,512
rem Violet bar
setrgb 1,cbred,0,cbblue
fill rectangle 240,0 to 320,512
rem Green bar
setrgb 1,0,cbgreen,0
fill rectangle 320,0 to 400,512
rem Red bar
setrgb 1,cbred,0,0
fill rectangle 400,0 to 480,512
rem Blue bar
setrgb 1,0,0,cbblue
fill rectangle 480,0 to 560,512
rem Black bar
setrgb 1,0,0,0
fill rectangle 560,0 to 640,512
for r=220 to 224
rem circle
circle 320, 240, r
next r
setrgb 1,25,255,255
return
[/font]