Google
 

Trailing-Edge - PDP-10 Archives - BB-H506E-SM - cobol/source/cdd.mac
There are 9 other files named cdd.mac in the archive. Click here to see a list.
TITLE	CDD FOR LIBOL V12C
SUBTTL	CONVERT FROM DISPLAY TO DISPLAY	/ACK

	SEARCH COPYRT
	SALL

COPYRIGHT (C) DIGITAL EQUIPMENT CORPORATION 1974, 1985
;ALL RIGHTS RESERVED.
;
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
;ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH LICENSE.

;REVISION HISTORY:

;V10 *****

;	15-DEC-74	/ACK	CREATION.

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

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

	EXTERN	EASTB.		;FORCE EASTBL TO BE LOADED.

	HISEG
	.COPYRIGHT		;Put standard copyright statement in REL file


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.
>
T2==7
T3==10

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)
	TLNE	16,	400000		;DEPENDING MOVE ?
	 JRST		DEPCDD		;YES-- DO SPECIAL WAY

;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.

;HERE FOR DEPENDING MOVE
DEPCDD:	HLRZ	T2,16		;T2= # CHARS IN DEST.
	TRZ	T2,400000

;MOVE THE MINIMUM OF CNT AND T2 CHARS. IF DEST LEN IS GREATER, FILL WITH SPACES

	MOVEI	T3,(CNT)
	CAILE	CNT,(T2)
	MOVE	CNT,T2

	ILDB	CH,IPTR		;GET A CHAR
	LDB	CH,CPTR		;CONVERT IT
	IDPB	CH,OPTR		;STASH IT
	SOJG	CNT,.-3		;LOOP

;SPACE FILL IF NECESSARY

	CAIG	T2,(T3)		;MORE CHARS IN DEST.?
	 POPJ	PP,		;NO, DONE
	SUB	T2,T3		;T2:= # SPACES TO PUT IN
	LDB	T3,[POINT 6,OPTR,11] ;GET OUTPUT BYTE SIZE
	SUBI	T3,6
	MOVE	CH,[0
		40
		0
		100](T3)	;GET PROPER OUTPUT SPACE
	IDPB	CH,OPTR		;STORE IT
	SOJG	T2,.-1
	POPJ	PP,		;DONE SPACE FILL...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:
	MOVST	ALP.76##		;7 TO 6
	MOVST	ALP.96##		;9 TO 6
	MOVSO	+40			;6 TO 7
	MOVST	ALP.97##		;9 TO 7
	0
	0
	MOVST	ALP.69##		;6 TO 9
	MOVST	ALP.79##		;7 TO 9


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


>		;END OF BIS

	END