10	COMMON (DEVICE_FLAGS) RDR.FLAG%, PUN.FLAG%, LST.FLAG%
	RDR.FLAG%,PUN.FLAG%,LST.FLAG%=0%
	CALL SYS$SETSFM(1% BY VALUE)
	PRINT "VAX CPM V1.3"
	PRINT "DISK A";
	LINPUT A$
	D%=0%
	  WHILE LEN(A$)
	  CALL SYS$CRELOG(2% BY VALUE,"CPM$DISK",A$,)
	  CALL MAP_DISK(D% BY VALUE)
	  D%=D%+1%
	  PRINT "DISK ";CHR$(65%+D%);
	  LINPUT A$
	  NEXT
	CALL PROM_BOOT
99	END
110	SUB ASKDISK(D%)
	CALL CONSOLE_CANCEL
	PRINT cr;lf;"enter VMS file for disk ";chr$(ascii("A")+D%);
	INPUT A$
	CALL SYS$CRELOG(2% BY VALUE,"CPM$DISK",A$,)
	CALL MAP_DISK(D% BY VALUE)
	CALL CONSOLE_READ
199	SUBEND
210	FUNCTION LONG CTRLY 
	COMMON (DEVICE_FLAGS) RDR.FLAG%, PUN.FLAG%, LST.FLAG%
	COMMON (READER_AREA) RDR.POS%, RDR.SIZE%, RDR.LINE$=270%
	CALL SYS$SETSFM(0% BY VALUE)
	ON ERROR GOTO 250
230	PRINT LF;CR;LF;"Insert/Remove/Lock/Unlock Disk(A-P)"
	PRINT" or Open/Close List/Reader/Punch device:"
	PRINT" or Bye or Reset"
	INPUT ANS$
	ANS$=EDIT$(ANS$,-1%)
	CALL SYS$EXIT(1% BY VALUE) IF ANS$='BYE' OR ANS$='B'
	CALL PROM_BOOT IF ANS$='RESET' OR ANS$='R'
	IF len(ANS$)<>2 then 230
240	IF ANS$="OL" THEN
	  LINPUT "List device ";LIST$
	  OPEN LIST$ FOR OUTPUT AS FILE 1%, ACCESS WRITE, RECORDTYPE NONE
	  NOMARGIN #1%
	  LST.FLAG%=-1%
	ELSE IF ANS$="CL" THEN
	  CLOSE 1%
	  LST.FLAG%=0%
	  PRINT "List device closed"
	ELSE IF ANS$="OP" THEN
	  LINPUT "Punch device ";PUNCH$
	  OPEN PUNCH$ FOR OUTPUT AS FILE 3%, ACCESS WRITE, RECORDTYPE NONE
	  NOMARGIN #3%
	  PUN.FLAG%=-1%
	ELSE IF ANS$="CP" THEN
	  CLOSE 3%
	  PUN.FLAG%=0%
	  PRINT "Punch device closed"
	ELSE IF ANS$="OR" THEN
	  LINPUT "Reader device ";READER$
	  OPEN READER$ FOR INPUT AS FILE 2%, ACCESS READ
	  RDR.POS%=1%
	  RDR.SIZE%=0%
	  RDR.FLAG%=-1%
	ELSE IF ANS$="CR" THEN
	  CLOSE 2%
	  PRINT "Reader device closed"
	  RDR.POS%=1%
	  RDR.SIZE%=270%
	  RDR.LINE$=STRING$(RDR.SIZE%,26%)
	  RDR.FLAG%=0%
	ELSE
	TASK$=LEFT(ANS$,1%)
	D%=ASCII(MID(ANS$,2%,1%))-ASCII("A")
	IF D%<0% OR D%>15% THEN
		PRINT "BAD DISC   "
	ELSE IF (LEFT$(ANS$,1)="I") THEN
	  CALL REM_DISK(D% BY VALUE)
	  INPUT "file for disk";A$
	  CALL SYS$CRELOG(2% BY VALUE,"CPM$DISK",A$,)
	  CALL MAP_DISK(D% BY VALUE)
	ELSE IF (LEFT$(ANS$,1)="R") THEN
	  CALL REM_DISK(D% BY VALUE)
	ELSE IF (LEFT$(ANS$,1)="L") THEN
	  CALL LOCK_DISK(D% BY VALUE)
	ELSE IF (LEFT$(ANS$,1)="U") THEN
	  CALL UNLOCK_DISK(D% BY VALUE)
	ELSE PRINT "NOT YET IMPLEMENTED (IF IT IS EVER GOING TO BE)"
246	GOTO 299
250	PRINT "?Error during function"
	PRINT ERR;ERN$;" ";ERT$(ERR);" at line ";ERL
	RESUME 299
299	PRINT
	CALL SYS$SETSFM(1% BY VALUE)
	FUNCTIONEND
310	SUB LISTCH(C%)
	COMMON (DEVICE_FLAGS) RDR.FLAG%, PUN.FLAG%, LST.FLAG%
	IF NOT LST.FLAG% THEN
	  CALL CONSOLE_CANCEL
	  print cr;lf;
	  linput "List device ";LIST$
	  CALL CONSOLE_READ
	  open list$ for output as file 1%, access write, recordtype none
	  lst.flag%=-1%
320	print #1%,CHR$(C%);
399	SUBEND
410	SUB PUNCHCH(C%)
	COMMON (DEVICE_FLAGS) RDR.FLAG%, PUN.FLAG%, LST.FLAG%
	IF NOT PUN.FLAG% THEN
	  CALL CONSOLE_CANCEL
	  print cr;lf;
	  linput "Punch device ";PUNCH$
	  CALL CONSOLE_READ
	  open punch$ for output as file 3%, access write, recordtype none
	  pun.flag%=-1%
420	print #3%,chr$(c%);
499	SUBEND
510	FUNCTION LONG READERCH
	COMMON (DEVICE_FLAGS) RDR.FLAG%, PUN.FLAG%, LST.FLAG%
	COMMON (READER_AREA) RDR.POS%, RDR.SIZE%, RDR.LINE$=270%
	IF RDR.FLAG%=0% THEN
	  CALL CONSOLE_CANCEL
	  PRINT CR;LF;
	  LINPUT "Reader device ";READER$
	  OPEN READER$ FOR INPUT AS FILE 2%, ACCESS READ
	  RDR.POS%=1%
	  RDR.SIZE%=0%
	  RDR.FLAG%=-1%
	  CALL CONSOLE_READ
520	CALL SYS$SETSFM(0% BY VALUE)
	ON ERROR GOTO 580
	IF RDR.POS%>RDR.SIZE% THEN
	  LINPUT #2%, L$
	  RDR.LINE$=L$+CHR$(13%)+CHR$(10%)
	  RDR.POS%=1%
	  RDR.SIZE%=LEN(L$)+2%
540	READERCH=ASCII(MID(RDR.LINE$,RDR.POS%,1%))
	RDR.POS%=RDR.POS%+1%
	GOTO 599
580	IF ERR=11% THEN
	  RESUME 590
	 ELSE
	  ON ERROR GOTO 0
	  STOP
590	READERCH=26%
	RDR.POS%=1%
	RDR.SIZE%=270%
	RDR.LINE$=STRING$(RDR.SIZE%,26%)
	CLOSE 2%
	RDR.FLAG%=0%
599	CALL SYS$SETSFM(1% BY VALUE)
	FUNCTIONEND
600	SUB NOTFND
	PRINT "CANNOT OPEN DISK"
	SUBEND
