Below is an unedited cut-and-paste from MCS. Even when I go back and try to clean it up, the final results look terrible. I'd post more code if it didn't look so bad.



Code:
GetNum:
        Result = 
0
        MaxNum = 
5     ; set for max number of digits you will 
accept
        YY = 
1
 
POSN=0
        IsNeg = 
0
        TimedOut = 
0
        ArrayWrite InputString,[Rep 
$FF\8]  ; Fill with 
$FF
 
GetMoreN:              
 
        HSERIN 
9000,InputTimeout,[Keyin]
 
IF Keyin = ESC THEN 
ZeroNum
            If 
Keyin = CR THEN 
DunInputn
 
If allowNeg 
then
            IF 
Keyin = "-" and Posn = 0 THEN 
 
 
IsNeg = 
1
 
Hserout 
["-"]
 
goto 
GetMoreN
 
ENDIF 
 
endif   
 
            IF Keyin 
= BS 
THEN
 
HSEROUT 
[BS,SP,BS]
 
IF POSN > 0 
THEN
 
POSN = POSN - 
1
 
InputString [POSN] = 
$FF
 
GOTO 
GetMoreN
 
ENDIF   
 
 
ENDIF
        IF Keyin < "0" or Keyin 
> "9" THEN GetMoreN 
        HSEROUT 
[Keyin]
        InputString [POSN] = Keyin 
- "0"
        IF POSN >= (MaxNum -1) 
THEN DunInputN
        POSN = POSN 
+1
        GOTO 
GetMoreN
DunInputN:
        For xN = 7 
to 0 STEP - 1 
 
IF InputString[XN]= 255 THEN 
NoMoreNum
 
Result = Result + 
(InputString[xN]*YY)
 
YY = YY 
*10
NoMoreNum:            
 
        Next 
XN
 
 
        If Isneg 
then
          If result < 
32768 
then
 
Result = 0 - Result
 
else