Microsoft Small Basic

Program Listing: QHM145
GraphicsWindow.Title = LDCommPort.OpenPort ("COM12" 115200)
GraphicsWindow.BackgroundColor ="teal
GraphicsWindow.BrushColor ="red
GraphicsWindow.Width=900
GraphicsWindow.Height=900
e=Shapes.AddEllipse (10 10)
ox=-1
px=450
py=450
f512=520
While "true
rr= LDCommPort.RXChar ()
If rr>31 then
tt=text.Append (tt text.GetCharacter (rr))
Else
If Text.StartsWith (tt "X") then
yy=text.GetSubTextToEnd (tt 3)
elseIf Text.StartsWith (tt "Y") then
xx=text.GetSubTextToEnd (tt 3)
EndIf
px=px+(xx-f512)/600
py=py+(yy-f512)/600

ldShapes.Centre (e px py)
If ox>-1 then
GraphicsWindow.DrawLine (ox oy px py)
endif
ox=px
oy=py
tt=""
EndIf
EndWhile