TITLE ECHO INPUT LINE -- Example 3 SEARCH MONSYM BUFLEN==40 ;the length of the input buffer. PROMPT: ASCIZ /Welcome to Echo. Please type a line: / IBUFR: BLOCK BUFLEN ;reserve space for the input line START: RESET ;start here. initialize I/O GETLIN: HRROI 1,PROMPT ;source of the prompt message PSOUT ;send prompt to the terminal HRROI 1,IBUFR ;descriptor of the input buffer MOVEI 2,5*BUFLEN-1 ;character count of the buffer HRROI 3,PROMPT ;the reprompt pointer for RDTTY RDTTY ;read one line from the terminal ERJMP INERR ;in case of error, print a message MOVE 15,IBUFR ;first five letters of input line CAMN 15,[ASCII/LEAVE/] ;test to see if user typed LEAVE JRST STOP ;LEAVE was typed. Halt the program. HRROI 1,[ASCIZ /The line you typed was: /] PSOUT HRROI 1,IBUFR ;point to the input line for PSOUT PSOUT ;echo (retype) the input line. JRST GETLIN ;Go get another line. INERR: HRROI 1,[ASCIZ/Error from RDTTY. I give up /] PSOUT ;send an error message and stop. STOP: HALTF ;stop the program here JRST STOP ;In case of a CONTINUE command, ; stay stopped. END START ;specify the start address.