1 INTEGER : EXTEND 
2 REM ----- INPUTLINE VER 1.1 (C) Peter Anvin 1985-07-31
3 DIM Inst$=1000 ! Valfritt
4 Ja=-1 : Nej=0
5 REM ----- Anrop med ;FNInplin$(VAROOT(Variabel$),"SLUT",Stympa)
6 ; FNInplin$(VAROOT(Inst$),CHR$(9,9,9,9),Ja)
7 ; Inst$
200 ! -------------------------------------------------------------------------
201 !  Det som {r nedan om detta {r sj{lva funktionen.
202 ! -------------------------------------------------------------------------
203 DEF FNInplin$(Varot,Slut$,Noend) LOCAL Dimlen,Vptr,Ln,Key$=1,Deltab,Loop
204   ; "Stoppvillkor:  ";
205   FOR I=1 TO LEN(Slut$) : ; FNPrt$(MID$(Slut$,I,1)); : NEXT I : ; 
206   Dimlen=PEEK2(Varot) : Vptr=PEEK2(Varot+2) : Ln=0
207   GET Key$
208   IF PEEK(Vptr+Ln-1)=13 AND Key$=CHR$(8) AND Ln>0 THEN ; FNDelcr$; : Deltab=2 : GOTO 210
209   Deltab=LEN(FNPrt$(CHR$(PEEK(Vptr+Ln-1))))
210   IF Key$=CHR$(8) AND Ln>0 THEN Ln=Ln-1 : ; STRING$(Deltab,8) STRING$(Deltab,32) STRING$(Deltab,8);
211   IF Key$=CHR$(8) THEN 207
212   IF Ln>=Dimlen THEN ; CHR$(7); : GOTO 207
213   POKE Vptr+Ln,ASCII(Key$)
214   Ln=Ln+1
215   ; FNPrt$(Key$);
216   IF Ln<LEN(Slut$) THEN 207
217   Loop=Ln-LEN(Slut$)
218   WHILE Loop<Ln
219     IF CHR$(PEEK(Vptr+Loop))<>MID$(Slut$,Loop-Ln+LEN(Slut$)+1,1) THEN 207
220     Loop=Loop+1
221   WEND 
222   IF Noend THEN Ln=Ln-LEN(Slut$)
223   POKE Varot+4,Ln,SWAP%(Ln)
224   RETURN ""
225 FNEND 
226 DEF FNPrt$(Key$)
227   IF Key$=CHR$(13) THEN RETURN "_M"+CHR$(13,10)
228   IF Key$<CHR$(31) THEN RETURN "_"+CHR$(ASCII(Key$)+64)
229   IF Key$=CHR$(31) THEN RETURN "__"
230   IF Key$<="" THEN RETURN Key$
231   IF (ASCII(Key$) AND 200)<>192 THEN RETURN "<CHR$ "+NUM$(ASCII(Key$))+">"
232   IF Key$<CHR$(200) THEN RETURN "PF"+NUM$(ASCII(Key$)-191)
233   IF Key$<CHR$(216) THEN RETURN "S_PF"+NUM$(ASCII(Key$)-207)
234   IF Key$<CHR$(232) THEN RETURN "C_PF"+NUM$(ASCII(Key$)-223)
235   RETURN "S_C_PF"+NUM$(ASCII(Key$)-239)
236 FNEND 
237 DEF FNDelcr$ LOCAL X,Y
238   X=PEEK(65363)-1 : Y=PEEK(65362) : IF Y<>0 THEN ; "FEL!" : STOP 
239   Y=79
240   WHILE Y>=0
241     IF PEEK(30720+X*80+Y)=77 THEN RETURN CUR(X,Y)+"M"
242     Y=Y-1
243   WEND 
244   X=X-1 : GOTO 239
245 FNEND 
