Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-10 - 43,50517/ttyout.mac
There is 1 other file named ttyout.mac in the archive. Click here to see a list.
	TITLE TTYOUT
	ENTRY TTYOUT

AC0==0
AC1==1
AC2==2
AC3==3
AC4==4
J==16
P==17

TTYOUT:	PUSH	P,AC0
	PUSH	P,AC1
	PUSH	P,AC2		;SAVE AC'S
	PUSH	P,AC3
	PUSH	P,AC4

	HLLZ	AC0,-1(J)	;-ARG #,,0
	AOBJN	.		;0,,+ARG #
	SKIPA			;SKIP 1ST TIME
LOOP:	ADDI	16,1		;NEXT ARG
	MOVE	AC1,(J)		;ARG
	HLRZ	AC2,AC1		;CODE
	CAIE	AC2,100		;NUMERIC?
	JRST	DOASCI		;NO, ASCII-SIXBIT
	MOVE	AC3,(AC1)	;YES, GET NUMBER
	PUSHJ	P,DECOCT
	JRST	DOIT		;& DOIT TOIT
DOASCI:	HRRZ	AC2,1(AC1)	;SIZE
	MOVE	AC1,(AC1)	;POINTER
	SETZ	AC3,
LOOP1:	ILDB	AC4,AC1		;LOAD BYTE
	TLNE	AC1,100		;SIXBIT?
	SUBI	AC4,40		;NO CONVERT
	SUBI	AC4,20		;TO BINARY
	IMULI	AC3,10		;BUMP UP
	ADD	AC3,AC4		;ADD
	SOJG	AC2,LOOP1	;LOOP CHAR. # TIMES
DOIT:	OUTCHR	AC3		;OUTPUT C(AC3)
	SOJG	LOOP		;GET NEXT CHARACTER

	POP	P,AC4
	POP	P,AC3
	POP	P,AC2
	POP	P,AC1
	POP	P,AC0
	POPJ	P,		;RETURN

DECOCT:	IDIVI	AC3,12
	JUMPE	AC3,.+5
	HRLM	AC4,(P)
	PUSHJ	P,DECOCT
	HLRZ	AC4,(P)
	IMULI	AC3,10
	ADD	AC3,AC4
	POPJ	P,
	END