Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50211/ascode.mac
There are 2 other files named ascode.mac in the archive. Click here to see a list.
TITLE ASCODE	
SUBTTL PUT OUT A WORD, GET A CHARACTER

ENTRY PUTWRD

PUTWRD:	MOVEI	TA,4		;GET ADDRESS OF
	EXCH	TA,0(PP)	; PARAMETERS, AND
	ADDM	TA,0(PP)	; RESET RETURN ADDRESS

	MOVE	TB,@0(TA)	;GET BYTE-POINTER TO INPUT
	MOVE	TD,@1(TA)	;GET BYTE-POINTER TO OUTPUT
	MOVE	TE,@3(TA)	;GET ADDRESS OF ERROR FLAG
	TLZ	TE,-1		;MAKE A 3-CHAR POINTER
	TLO	TE,(POINT 7,0,20)

PUTWD1:	ILDB	TC,TB		;GET A CHARACTER
	JUMPE	TC,CPOPJ	;LEAVE IF IT'S A SPACE
	AOS	@2(TA)		;BUMP "J"
	ADDI	TC,40		;CONVERT OT ASCII
	IDPB	TC,TD		;STASH IT AWAY

	CAIE	TC,"\"		;BAD CHARACTER?
	JRST	PUTWD1		;NO--LOOP

	MOVE	TC,[OCT 2512452];YES--GET THREE ASCII STARS
	DPB	TC,TE		;STASH INTO ERROR FLAG
	JRST	PUTWD1		;LOOP


;GET ONE CHARACTER FROM INPUT RECORD.
;"INPTR" AND "THSKAR" WERE SET UP BY "CONVRT" ROUTINE.

ENTRY GETKAR

GETKAR:	ILDB	TA,INPTR	;GET A CHARACTER
	DPB	TA,THSKAR	;STASH IT
	MOVEI	TA," "		;REPLACE IT WITH
	DPB	TA,INPTR	; A SPACE

CPOPJ:	POPJ	PP,
SUBTTL CONVERT B300 CODE TO ASCII

ENTRY CONVRT

CONVRT:	MOVEI	TA,3		;RESET RETURN ADDRESS AND
	EXCH	TA,0(PP)	; PUT PARAMETER ADDRESS INTO
	ADDM	TA,0(PP)	; TA

	MOVE	TB,@2(TA)	;GET RECORD SIZE
	MOVE	TD,@1(TA)	;PICK UP CONVERSION-TABLE ADDRESS
	MOVE	TA,@0(TA)	;PICK UP RECORD ADDRESS
	MOVE	TC,TA		;SAVE IT FOR "GETKAR"
	IBP	TC
	MOVEM	TC,INPTR
	MOVEM	TC,THSKAR

ASCOD1:	ILDB	TC,TA		;GET A CHARACTER
	CAIG	TC,137		;IS IT WITHIN
	CAIGE	TC,40		; THE SIXBIT RANGE?
	JRST	ASCOD3		;NO

	SUBI	TC,40		;CONVERT TO SIXBIT
	IDIVI	TC,5
	ADD	TC,TD
	MOVE	TE,ASCOD9(TC+1)
	DPB	TE,[POINT 6,TC,5]
	LDB	TE,TC
	DPB	TE,TA

ASCOD3:	SOJG	TB,ASCOD1	;LOOP THRU ENTIRE RECORD
	POPJ	PP,

ASCOD9:	35
	26
	17
	10
	01

INPTR:	BLOCK	1	;BYTE-POINTER TO SOURCE-RECORD CHARACTER
THSKAR:	BLOCK	1	;BYTE-POINTER TO CURRENT CHARACTER

TA=5
TB=6
TC=7 ;(2 AC'S)
TD=11
TE=12
PP=17

	END