.TITLE TERMINal emulator program .SBTTL Preamble .VERSION 1 / TERMIN.MA / CLARKE M. WALKER / MAR SUPPORT STAFF / 23-JAN-80 / / This program is used to have the PDP-8 act as a remote / terminal to another computer system. For this / program to operate the "local" serial interface is / (03,04) and the "remote" serial interface is (REMINP, / REMOUT). CONTROL/E typed at the local interface causes / the program to exit to the monitor. CONTROL/X means to / send the next local character as is. Thus CONTROL/X / CONTROL/E sends a CONTROL/E to the "remote" interface. / / .LIST MEB .ENABLE ASCII,7BIT /Device definitions: REMINP= 43 /Remote input code. REMOUT= 44 /Remote output code. KSFR= 6001+ /Skip on keyboard flag. KRBR= 6006+ /Read keyboard buffer. TFLR= 6000+ /Set teleprinter flag. TSFR= 6001+ /Skip on teleprinter flag. TLSR= 6006+ /Load teleprinter buffer. CR=12 LF=15 CRLF=0 /Do output a . NOCRLF=200 /Don't output a . P=0 /Print macro counter. .MACRO PCHAR PSKP,PLOAD /Print a character. .IF BL PSKP .IF NB PSKP /Wait till ready. JMP .-1 .IF BL PLOAD .IF NB PLOAD /Print it. .ENDM PCHAR .MACRO ICHAR ISKP,IGET,IERR /Input a character. CLA /Clear accumulator. .IF BL ISKP .IF NB ISKP /Anything ? .IF BL IERR < SKP> .IF NB IERR < JMP IERR> /Nothing. .IF BL IGET .IF NB IGET /Yes, get it. AND (177 /Trim to 7-bit ASCII. .ENDM ICHAR .MACRO PRINT MESG,PCRLF /Print a message to console. If / PCRLF=200 then no . P=P+1 /Counter to make each call unique. CLA TAD (MSG\P /Get address. DCA PMSG\P /Save it. PRST\P, TAD I PMSG\P /Get character. SNA /Null ? JMP PRET\P /Yes, so return. PCHAR /Print character. CLA ISZ PMSG\P /Increment pointer. JMP PRST\P /Get next. PMSG\P, 0 /Store pointer. MSG\P, TEXT "MESG" /Message to be printed. PRET\P, /Fall thourgh. .IF BL PCRLF< TAD (CR /Output if not told PCHAR / elsewise. CLA TAD (LF PCHAR CLA > .IF NB PCRLF< .IF NE PCRLF-NOCRLF< TAD (CR /Output if not equal 200. PCHAR CLA TAD (LF PCHAR CLA > > .ENDM PRINT .SBTTL Main Program Code .ASECT MAIN START, JMS INIT /Monitor start of program. NOP /Chain start of program. TFL /Set flags. TFLR JMS TERM /Goto "TERMINAL" routine. EXIT, CDF CIF 00 /Go back to monitor. JMP I (7600 INIT, 0 /Initialization code. CLL CLA TFL /Set flags. TFLR PRINT "TERMIN Version 1" CLA DCA CHAR /Save it. JMP I INIT .SBTTL Terminal Simulation Code .RSECT TERMINAL TERM, 0 /Simulate terminal to host computer. CONT, TAD CHAR /Get character to be sent. JMS SENDR /Send character to remote. TRY, JMS RECVR /Receive character from remote. JMS RECVL /Anything from local terminal ? JMP TRY /Wait for something to happen. JMS SENDL /Echo on local terminal. SZL /Where from ? JMP TRY /Remote, so wait for more. DCA CHAR /Save. TAD CHAR /Was exit character typed? TAD (-^"E SNA CLA /Skip if it wasn't. JMP I TERM /Return to main program. TAD CHAR TAD (-^"X /Was quote literal char typed. SNA CLA /Skip if it wasn't. JMP LITW /Yes. JMP CONT /No, get more characters. LITW, JMS RECVL /Get next character from local. JMP LITW /And no place else. (Could be losing NOP / characters from remote.) JMP CONT /Send it. CHAR, 0 /Store last character. SENDR, 0 /Send char to remote. PCHAR TSFR,TLSR JMP I SENDR /Return with char still in AC. RECVR, 0 /Receive char from remote. ICHAR KSFR,KRBR,RRERR ISZ RECVR /Inc pass error return. ISZ RECVR STL /Set link so we know it came from remote. RRERR, JMP I RECVR /Return. SENDL, 0 /Send char to local. PCHAR JMP I SENDL /Return with char still in AC. RECVL, 0 /Receive from local. ICHAR ,,RLERR ISZ RECVL /Inc pass error return. ISZ RECVL CLL /Clear link so we know it came from local. RLERR, JMP I RECVL /Return. $$$$$$$$$$$$$$$$$$$$/END/$$$$$$$$$$$$$$$$$$$$