For I=32 To 255
  If (I Mod 32)=0 Then Print Chr$(13) Chr$(10),
  If I=127 Then Print " "; Else Print Chr$(I);
Next I
Print
Print
Print
Pause 1000


Const GFX=Chr$(16)
Const ENQ=Chr$(5)
Const ACK=Chr$(6)

Print GFX "?"
Input Gw, Gh

Print GFX "clear" 0, 0, Gw, Gh
Print GFX "ink" 255, 255, 0, 7

angle=0
Y0=Int(Gh/2)
T0%=Timer

Do
  angle=(angle+2) Mod 360
  value=Sin(angle*Pi/180)
  Y1=Int(Gh/2-value*Gh/3)

  Print GFX "scroll" 0, 0, Gw-1, Gh-1, -1, 0
  Print GFX "line" Gw-10, Y0, Gw-9, Y1
  Y0=Y1

  T1%=Timer
  Print, angle, Y1, Str$(value, -3, 3),, T1%-T0% "ms"
  T0%=T1%

  Do
  Loop Until Inkey$=""

  Print ENQ;
  Do
  Loop Until (Inkey$=ACK) Or (Timer-T1%>500)

' Do
' Loop Until (Timer Mod 200)>180
Loop 