83Plus:Software:usb8x/Sample Code
From WikiTI
Revision as of 10:55, 16 July 2006 by Dan Englender (Talk | contribs)
Example code using the usb8x assembly and BASIC interfaces
BASIC
Mouse Test
This example uses the [[../BASIC_Interface/MouseInit|MouseInit]], [[../BASIC_Interface/MouseDo|MouseDo]], and [[../BASIC_Interface/KillUSB|KillUSB]] entry points to control a point on the screen with the mouse cursor.
OpenLib(USBDRV8X
{2 ;MouseInit
ExecLib
If Ans(1 ;If MouseInit returns error,
Return ; then quit
-968->Xmin
968->Xmax
-640->Ymin
640->Ymax
0->X
0->Y
Repeat getKey
{3 ;MouseDo
ExecLib
Ans->L1
If L1(1 ;If MouseDo returns error,
Goto 1 ; restart loop
If 127<L1(3 ;If x direction is left,
L1(3)-256->L1(3 ; change to negative #
If 127<L1(4 ;If y direction is up,
L1(4)-256->L1(4 ; change to negative #
Pt-Off(X,Y
X+L1(3->X
Y-L1(4->Y
Pt-On(X,Y
Lbl 1
End
{1 ;KillUSB
ExecLib