# display keyboard and joystick values
cls
print tab(2);"Keyboard and Joystick Values"

loop
	#keyboard
	%keyPress$ = inkey$
	if %keyPress$<>"" then %lastKey$ = %keyPress$
	print@32*2+6,"Last Keypress: ";

	if (%lastKey$="") then
		print " none"
	else
		print using "### ";asc(%lastKey$);
		if (%lastKey$>" ") then
			print %lastKey$;
		else
			print " ";
		endif
	endif

	#joysticks
	%rightHorizontal% = joystk(0)
	%rightVertical% = joystk(1)
	%leftHorizontal% = joystk(2)
	%leftVertical% = joystk(3)

	print@32*5+11,"Joysticks";
	print@32*6+8,"X  Y";
	print@32*6+24,"X  Y";

	print@32*7+1,"Left: ";
	print using "## ##";%leftHorizontal%, %leftVertical%;
	print@32*7+16,"Right: ";
	print using "## ##";%rightHorizontal%, %rightVertical%;

	%button% = peek(65280)

	print@32*8+2,"Button ";
	if ((2 and not %button%)=2) then
		print "on ";
	else
		print "off";
	endif

	print@32*8+17,"Button ";
	if ((1 and not %button%)=1) then
		print "on ";
	else
		print "off";
	endif

	print@32*10+8,"Button Peek:";%button%
endloop
