5 'SAVE "IBMMC"
10 '
12 ' ISDDRIVR - ISD DEMO DRIVER
18 ' AUTHOR - Hal W. Jennings
20 '
22 'DEMO DRIVER
24 '
35 GOSUB 2800  'INIT
40 GOSUB 1000  'DISPLAY NEXT SCREEN
45 IF INKEY$<>"" THEN 45  'CLEAR KEYBOARD BUFFER
50 IF DELAY THEN GOSUB 200 ELSE GOSUB 800  'DELAY/INPUT
55 IF TERM THEN CHAIN "MENU"
60 IF RESTART THEN NXT$=FIRSTPROG$: NMP=0: GOTO 330
65 GOTO 40
200 '
205 'DELAY LOGIC
210 '
215 T!=FNTM!(TIME$)+DSEC: IF T!>86400! THEN T!=DSEC
220 K$=INKEY$: IF K$="" AND T!>FNTM!(TIME$) THEN 220
225 IF K$=BS$ THEN 560    'F9 - BACKUP SCREEN
230 IF K$=BM$ THEN 510    'F10- BACKUP MENU
235 IF K$=TERM$ THEN  460 'CTRL END - TERMINATE
240 IF K$=ID$ THEN GOSUB 940: GOTO 220    'F8 - DISPLAY ID
245 IF K$=HELP$ THEN  GOSUB 970: GOTO 215 'F1 - HELP
250 IF K$=" " THEN 410    'SPACE BAR - PAUSE
255 IF K$<>"" THEN 220    'INVALID KEY - TIME NOT EXPIRED
300 NMP=NMP+1: NM$(NMP)=CSCR$
305 IF NMP>148 THEN I=1:FOR J=30 TO NMP:NM$(I)=NM$(J):I=I+1:NEXT J:NMP=I-1
310 IF LEFT$(NEXTSCR$,1)<>"&" THEN RETURN
315 NXT$=MID$(NEXTSCR$,2): IF NXT$="END" THEN TERM=TRUE: RETURN
320 IF NXT$="RETURN" THEN NEXTSCR$=NM$(NMP-1): NMP=NMP-2: IF LEFT$(NEXTSCR$,1)="," THEN NEXTSCR$=MID$(NEXTSCR$,2): RETURN ELSE RETURN
325 NMP=NMP+1: NM$(NMP)="&"+THISPROG$
330 LOCATE 25,1: COLOR 15,0: PRINT SPC(38);: LOCATE 25,6: PRINT "** PROGRAM ";NXT$;" LOADING **";
335 ON ERROR GOTO 340: CHAIN "A:"+NXT$
340 RESUME 345
345 ON ERROR GOTO 350: CHAIN "B:"+NXT$
350 CLS: LOCATE 10,5: PRINT "PROGRAM ";NXT$;" NOT FOUND": LOCATE 23,5: PRINT "Press any key to end demo"
355 IF INKEY$="" THEN 355 ELSE TERM=-1: GOTO 55
400 '
405 'SPACE BAR (PAUSE)
410 IF INKEY$="" THEN 410 ELSE 300
450 '
455 'CTRL END KEY (EXIT)
460 TERM=TRUE: RETURN
500 '
505 'BACKUP MENU
510 BKUPM=TRUE
515 IF INSTR(",&",LEFT$(NM$(NMP),1))=0 AND NMP>1 THEN NMP=NMP-1: GOTO 515
550 '
555 'BACKUP SCREEN
560 IF NMP<=0 THEN NEXTSCR$=CSCR$ ELSE NEXTSCR$=NM$(NMP):NMP=NMP-1: BKUP=TRUE
565 IF LEFT$(NEXTSCR$,1)="," THEN NEXTSCR$=MID$(NEXTSCR$,2): RETURN
570 IF LEFT$(NEXTSCR$,1)="&" THEN NXT$=MID$(NEXTSCR$,2): GOTO 330
575 RETURN
800 '
805 'INPUT LOGIC
810 '
815 T!=FNTM!(TIME$)+120: IF T!>86499! THEN T!=120
820 K$=INKEY$: IF K$="" AND T!>FNTM!(TIME$) THEN 820
825 IF K$=BS$ THEN 560    'F9 - BACKUP SCREEN
830 IF K$=BM$ THEN 510    'F10- BACKUP MENU
835 IF K$=TERM$ THEN  460 'CTRL END - TERMINATE
840 IF K$=ID$ THEN GOSUB 940: GOTO 820    'F8 - DISPLAY ID
845 IF K$=HELP$ THEN  GOSUB 970: GOTO 800 'F1 - HELP
850 IF (K$=ESC$) AND TIM THEN RESTART=TRUE: RETURN  'ESC KEY WITH TIME LIMIT
855 IF K$="" THEN GOSUB 910: GOTO 820  'TIME EXPIRED
860 S=ASC(K$): IF S>96 AND S<123 THEN K$=CHR$(S-32)
865 ANS=INSTR(BRANCH$,B$+K$): IF ANS=0 THEN ANS=INSTR(BRANCH$,BA$)
870 IF ANS=0 THEN BEEP: GOTO 820
875 I=INSTR(ANS,BRANCH$,D$): J=INSTR(I,BRANCH$,B$): NEXTSCR$=MID$(BRANCH$,I+1,J-I-1): IF INSTR(2,BRANCH$,B$)