8-Bit Software Online Conversion
Presenting Programs Example - Listing
10REM >Input
20REM by Steven Flintham
30REM
40REM Friday 31st December 1993 (New
Year's Eve)
50:
60MODE 7
70PROCdisable
80PROCinit
90PROCtitle
100PRINT'CHR$(131);"Please enter a str
ing:";CHR$(135);
110string$=FNinput(10,FALSE)
120PRINT'CHR$(131);"You entered ";stri
ng$
130PROCenable
140END
150:
160DEF PROCdisable
170*FX229,1
180*FX4,1
190ENDPROC
200:
210DEF PROCenable
220*FX229
230*FX4
240ENDPROC
250:
260DEF PROCinit
270ON ERROR MODE 7:REPORT:PRINT " at l
ine ";ERL:PROCenable:END
280ENDPROC
290:
300DEF PROCtitle
310VDU 26,12
320PRINTTAB(1,0);CHR$141;CHR$132;CHR$1
57;CHR$131;"Controlled input demonstrati
on ";CHR$156
330PRINTTAB(1,1);CHR$141;CHR$132;CHR$1
57;CHR$131;"Controlled input demonstrati
on ";CHR$156
340PRINTTAB(7,2);CHR$131;"(C) Steven F
lintham 1993"
350ENDPROC
360:
370DEF FNinput(max%,null%)
380LOCAL text$,key%
390text$=""
400REPEAT
410REPEAT
420*FX21
430key%=GET
440UNTIL key%=13 OR (key%>=32 AND key%
<=127)
450IF key%=127 AND LEN(text$)>0 THEN V
DU 127:text$=LEFT$(text$,LEN(text$)-1)
460IF key%<>127 AND key%<>13 AND LEN(t
ext$)<max% THEN VDU key%:text$=text$+CHR
$(key%)
470UNTIL (key%=13 AND LEN(text$)>=ABS(
NOT null%))
480=text$