   10REM SAVE"$.Arabic.Test.NumberDemo"
   20PRINT"Type things at me - numbers will be reversed"
   30 
   40Idx = 0
   50DIM Buff 127
   60REPEAT
   70  C%=FNReadCh
   80UNTIL 0
   90END
  100 
  110DEFFNReadCh
  120LOCAL C%
  130  C%=GET
  140  IF C%=127 THEN PROCdel ELSE PROCMyVDU(C%)
  150  IF C%=13 THEN VDU 10
  160=C%
  170 
  180DEFPROCMyVDU(C%)
  190IF Idx<>0 THEN PROCNum(C%):ENDPROC
  200IF (ASC("0") <= C%) AND (C% <= ASC("9")) THEN Buff?0=C%:Idx=1
  210VDU C%
  220ENDPROC
  230 
  240DEFPROCNum(C%)
  250LOCAL I
  260IF (ASC("0") <= C%) AND (C% <= ASC("9")) THEN PROCReverse(C%):ENDPROC
  270VDU C%
  280Idx = 0
  290ENDPROC
  300 
  310DEFPROCReverse(C%)
  320LOCAL I
  330PROCdelbuf
  340Buff?Idx=C%
  350Idx=Idx+1
  360PROCwritebuf
  370ENDPROC
  380 
  390DEFPROCdel
  400LOCAL I
  410IF Idx=0 THEN VDU 127:ENDPROC
  420PROCdelbuf
  430Idx=Idx-1
  440IF Idx=0 THEN ENDPROC
  450PROCwritebuf
  460ENDPROC
  470 
  480DEFPROCdelbuf
  490FOR I=Idx-1 TO 0 STEP -1
  500  VDU 127
  510NEXT
  520ENDPROC
  530 
  540DEFPROCwritebuf
  550FOR I=Idx-1 TO 0 STEP -1
  560  VDU Buff?I
  570NEXT
  580ENDPROC
