$compact debug pw(79) rom echo$mod: DO; $INCLUDE (:RMX:inc/rmxplm.ext) $if rmx=3 DECLARE SIZE$OF$OFFSET LITERALLY 'DWORD'; $else DECLARE SIZE$OF$OFFSET LITERALLY 'WORD'; $endif DECLARE JOB$ABORTED LITERALLY '4', CR LITERALLY '0DH', LF LITERALLY '0AH', READ$WRITE LITERALLY '3', TRUE LITERALLY '0FFH', FALSE LITERALLY '0', FOREVER LITERALLY 'WHILE 1'; DECLARE console$token TOKEN, actual SIZE$OF$OFFSET, status WORD, io$buffer (256) BYTE; DECLARE init$msg (*) BYTE DATA (CR,LF,'Enter data from keyboard',CR,LF), control$c$msg (*) BYTE DATA (CR,LF,'Gonna go bye bye now',CR,LF); cc$trap: PROCEDURE PUBLIC; DECLARE status WORD; /* Let the operator know that we are finished. */ CALL dq$write (console$token,@control$c$msg,SIZE(control$c$msg),@status); /* Return control back to the CLI. */ CALL dq$exit (JOB$ABORTED); END cc$trap; /* Main line code is required so the Application Loader gets an * initialization record. We will open a connection to the terminal * and set a CONTROL-C handler in place before installing the interrupt * handler. If a CONTROL-C is entered from the keyboard, the CONTROL-C * handler, cc$trap, will reset the interrupt and then call dq$exit. */ /* Install the CONTROL-C handler. */ CALL dq$trap$cc (@cc$trap, @status); /* Create an open connection to the console. :CI: and :CO: will * automatically be cataloged in our job's object directory as * part of the loading process. */ console$token = dq$attach (@(4,':CO:'), @status); CALL dq$open (console$token, READ$WRITE, 0, @status); /* Inform the operator. */ CALL dq$write (console$token, @init$msg, SIZE(init$msg), @status); /* Loop forever, echoing lines entered at the console. */ DO FOREVER; /* Read a line from the keyboard. */ actual = dq$read (console$token, @io$buffer, SIZE(io$buffer), @status); /* Echo it back to the CRT. */ CALL dq$write (console$token, @io$buffer, actual, @status); END; /* DO FOREVER */ END echo$mod;