Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-10 - 43,50517/cdd.mac
There are 9 other files named cdd.mac in the archive. Click here to see a list.
TITLE	CDD FOR LIBOL V10 AND RPGLIB V1
SUBTTL	CONVERT FROM DISPLAY TO DISPLAY	15-DEC-74	/ACK

;LIBOL VERSION
;COPYRIGHT 1974, 1975, DIGITAL EQUIPMENT CORP., MAYNARD MASS.
;RPGLIB VERSION COPYRIGHT 1976, BOB CURRIER

;REVISION HISTORY:

;V10 *****

;	15-DEC-74	/ACK	CREATION.

;	5/10/75		/DBT	ADD BIS
;*****

	SEARCH	RPGPRM		;DEFINE PARAMETERS.
	%%LBLP==:%%LBLP
	EBCMP.==:EBCMP.
	BIS==:BIS

	EXTERN	EASTB.		;FORCE EASTBL TO BE LOADED.

	HISEG

COMMENT	\

	THIS ROUTINE CONVERTS A STRING FROM ONE FLAVOR OF DISPLAY TO ANOTHER.

CALL:
	MOVE	16,PARAMETER ADDRESS
	PUSHJ	17,C.D6D7/C.D6D9/C.D7D6/C.D7D9/C.D9D6/C.D9D7

PARAMETERS:
	WORD 1:
		BYTE POINTER FOR THE INPUT STRING.
	WORD 2:
		BITS	0-5	BYTE POINTER RESIDUE FOR THE OUTPUT STRING.
		BIT	6	IGNORED (1 IF THE OUTPUT FIELD IS SIGNED.)
		BITS	7-17	THE SIZE OF BOTH FIELDS.
		BITS	18-35	ADDRESS OF THE FIRST BYTE OF THE OUTPUT FIELD.

RETURNS:
	CALL+1	ALWAYS.

REGISTERS USED:
	CPTR, JAC, CH, IPTR, OPTR, CNT

\
	ENTRY	C.D6D7		;TO CONVERT SIXBIT TO ASCII.
	ENTRY	C.D7D6		;TO CONVERT ASCII TO SIXBIT.
IFN EBCMP.,<
	ENTRY	C.D6D9		;TO CONVERT SIXBIT TO EBCIDC.
	ENTRY	C.D7D9		;TO CONVERT ASCII TO EBCDIC.
	ENTRY	C.D9D6		;TO CONVERT EBCDIC TO SIXBIT.
	ENTRY	C.D9D7		;TO CONVERT EBCDIC TO ASCII.
>

IFE	BIS,<

	EXTERN	SET2.		;ROUTINE TO PICK UP THE PARAMETERS.
	EXTERN	RET.1		;RETURNS TO CALL+1.

;THE FOLLOWING ARE BYTE POINTERS WHICH CONVERT THE CHARACTER IN CH
; FROM ONE FORM OF DISPLAY TO ANOTHER.

;		NAME			FROM		TO

	EXTERN	PTR67.		;	SIXBIT		ASCII
	EXTERN	PTR76.		;	ASCII		SIXBIT
IFN EBCMP.,<
	EXTERN	PTR69.		;	SIXBIT		EBCDIC
	EXTERN	PTR79.		;	ASCII		EBCDIC
	EXTERN	PTR96.		;	EBCDIC		SIXBIT
	EXTERN	PTR97.		;	EBCDIC		ASCII
>

C.D6D7:	SKIPA	CPTR,	PTR67.		;ENTER HERE TO CONVERT SIXBIT TO ASCII,
C.D7D6:	MOVE	CPTR,	PTR76.		; HERE TO CONVERT ASCII TO SIXBIT,
IFN	EBCMP.,<
	JRST		CDD
C.D6D9:	SKIPA	CPTR,	PTR69.		; HERE TO CONVERT SIXBIT TO EBCDIC,
C.D7D9:	MOVE	CPTR,	PTR79.		; HERE TO CONVERT ASCII TO EBCDIC,
	JRST		CDD
C.D9D6:	SKIPA	CPTR,	PTR96.		; HERE TO CONVERT EBCDIC TO SIXBIT AND
C.D9D7:	MOVE	CPTR,	PTR97.		; HERE TO CONVERT EBCDIC TO ASCII.
>

CDD:	JSP	JAC,	SET2.		;GO PICK UP THE PARAMETERS.
	EXP		RET.1		;RETURN TO CALL+1 THROUGH HERE IF
					; THE STRING LENGTH IS 0.
	HLRZ	CH,	CPTR		;PUT THE OUTPUT BYTE SIZE IN 
	ANDI	CH,	(POINT ^O77,0,35)	; THE OUTPUT POINTER.
	TLO	OPTR,	(CH)

;CONVERSION ROUTINE:

CDD1:	ILDB	CH,	IPTR		;GET A CHAR.
	LDB	CH,	CPTR		;CONVERT IT.
	IDPB	CH,	OPTR		;STASH IT.
	SOJG	CNT,	CDD1		;LOOP IF THER ARE MORE CHARS.
	POPJ	PP,			;OTHERWISE RETURN.

>		;END NON-BIS
IFN	BIS,<

	EXTERN	BSET2.		;ROUTINE TO PICK UP THE PARAMETERS.
	EXTERN	RET.1		;RETURNS TO CALL+1.

C.D7D6:	JSP	BISCH,	CDD		; HERE TO CONVERT ASCII TO SIXBIT,
C.D9D6:	JSP	BISCH,	CDD		; HERE TO CONVERT EBCDIC TO SIXBIT AND
C.D6D7:	JSP	BISCH,	CDD		;ENTER HERE TO CONVERT SIXBIT TO ASCII,
C.D9D7:	JSP	BISCH,	CDD		; HERE TO CONVERT EBCDIC TO ASCII.
	Z
	Z
C.D6D9:	JSP	BISCH,	CDD		; HERE TO CONVERT SIXBIT TO EBCDIC,
C.D7D9:	JSP	BISCH,	CDD		; HERE TO CONVERT ASCII TO EBCDIC,

CDD:
	SUBI	BISCH,C.D7D6-13	;COMPUTE INDEX
	JSP	JAC,	BSET2.		;GO PICK UP THE PARAMETERS.
	EXP		RET.1		;RETURN TO CALL+1 THROUGH HERE IF
					; THE STRING LENGTH IS 0.
	MOVE	BIST0,	C.DTBL-14(BISCH)	;GET INSTRUCTION
	LSH	BISCH,-1		;GET BYTE SIZE
	DPB	BISCH,BPTOBS##		;STORE IN OUTPUT POINTER
	TLO	B.FLAG,BFLG.S		;TURN SIGNIFICANCE ON
	EXTEND	B.FLAG,BIST0		;GO
	JRST	ERROR
	POPJ	PP,			;DONE

C.DTBL:
	XWD	MOVST,	ALP.76##	;7 TO 6
	XWD	MOVST,	ALP.96##	;9 TO 6
	XWD	MOVSO,	+40		;6 TO 7
	XWD	MOVST,	ALP.97##	;9 TO 7
	0
	0
	XWD	MOVST,	ALP.69##	;6 TO 9
	XWD	MOVST,	ALP.79##	;7 TO 9


ERROR:	OUTSTR	[ASCIZ	'?LIBOL CDD.N ERROR
']
	POPJ	PP,


>		;END OF BIS
	END