#!/ram/bin/ksh
#set -v

#=========================
echo "Starting Photon..."
#=========================

photon()
{
# start shared libs
export HOME=/ram
export PATH_PHOTON=/ram/usr/photon/bin:/ram/usr/photon/font:/ram/usr/photon/palette:
export PATH_DEMO=/ram/demo:/demo
export PATH=/ram/bin:$PATH_PHOTON:$PATH_DEMO:/ram:.

phlib_s11 &
Aplib_s11 &
Photon -N /dev/photon &
}

input_ser3()
{
Input kbd -R fd -d/dev/kbd msoft -3 -R fd -d/dev/ser1 &
}

input_ps2()
{
Input kbd -R fd -d/dev/kbd ps2 -r kb -2 &
}

input_ser2()
{
Input kbd -R fd -d/dev/kbd msoft fd -d/dev/ser1 &
}

grafx1()
{
vesabios.ms -i0x12 &
Pg.vga4 -HNqnx/crt -g640x480x4 -A0xA0000,0x10000 -P/ram/usr/photon/palette/default.pal -WB80 &
}

grafx2()
{
vesabios.ms -i0x102 &
Pg.vga4 -HNqnx/crt -g800x600x4 -A0xA0000,0x10000 -P/ram/usr/photon/palette/default.pal -WB100 &
}


application()
{
phfontphf -d /ram/usr/photon/font -E normal &
pwm &
Dev.pty &

cd /demo
usp &
cool &
pterm /ram/bin/ksh &
}

/ram/bin/prefix -R /=/ram

typeset -i j=0

until test $j -eq 0012
do
	j=$j+1
	echo 
	echo Make your choice according to your video and mouse capabilities:
	echo "Press: 1   for 640x480x4  PS2    Mouse" 
	echo "Press: 2   for 800x600x4  PS2    Mouse" 
	echo "Press: 3   for 640x480x4  Serial Mouse (3 buttons)" 
	echo "Press: 4   for 800x600x4  Serial Mouse (3 buttons)" 
	echo "Press: 5   for 640x480x4  Serial Mouse (2 buttons)" 
	echo "Press: 6   for 800x600x4  Serial Mouse (2 buttons)" 

	typeset -i i=5
	echo -n "Enter your choice: " 
	read i

	case $i in
	1)	photon
		grafx1
        input_ps2
		application ;;
	2)	photon
		grafx2
        input_ps2
		application ;;
	3)	photon
		grafx1
        input_ser3
		application ;;
	4)	photon
		grafx2
		input_ser3
		application ;;
	5)	photon
		grafx1
        input_ser2
		application ;;
	6)	photon
		grafx2
		input_ser2
		application ;;
	?)	echo ; echo Unknown value, please try again...; echo; echo; echo; echo
		echo "                             ...press any key to continue..."
		read k
		continue
	esac
done
echo 
echo
echo
echo
echo "  ...Too much stress....take a coffee and try later...   :-)" 
echo
echo
echo

