Google
 

Trailing-Edge - PDP-10 Archives - BB-P363B-SM_1985 - mcb/cex/cbta.lst
There are 2 other files named cbta.lst in the archive. Click here to see a list.
!	NONE
!
! MACROS:
!
!	NONE							28-May-1985 14:29:31	TOPS-20 Bliss-16 2A(530)	    Page   1
								30-Dec-1982 17:29:07	DNET61:<MCB.UTILITIES>CBTA.BLI.1 (1)

;	  0001	
;	  0002	MODULE CBTA (					!Binary to ASCII conversion
;	  0003			IDENT = '001010',
;	P 0004			LANGUAGE (BLISS16, BLISS36) %BLISS36 (, ENTRY ($CBDAT, $CBDMG, $CBDSG, $CBOMG, $CBOSG, $CBTA,
;	  0005			    $CBTMG))
;	  0006			) =
;	  0007	BEGIN
;	  0008	!
;	  0009	!
;	  0010	!
;	  0011	!                    COPYRIGHT (c) 1980, 1981, 1982
;	  0012	!                    DIGITAL EQUIPMENT CORPORATION
;	  0013	!                        Maynard, Massachusetts
;	  0014	!
;	  0015	!     This software is furnished under a license and may  be  used
;	  0016	!     and copied only in accordance with the terms of such license
;	  0017	!     and with the inclusion of the above copyright notice.   This
;	  0018	!     software  or any other copies thereof may not be provided or
;	  0019	!     otherwise made available to any other person.  No  title  to
;	  0020	!     and ownership of the software is hereby transferred.
;	  0021	!
;	  0022	!     The information  in  this  software  is  subject  to  change
;	  0023	!     without  notice  and should not be construed as a commitment
;	  0024	!     by DIGITAL EQUIPMENT CORPORATION.
;	  0025	!
;	  0026	!     DIGITAL assumes no responsibility for the use or reliability
;	  0027	!     of  its  software  on  equipment  which  is  not supplied by
;	  0028	!     DIGITAL.
;	  0029	!
;	  0030	
;	  0031	!++
;	  0032	! FACILITY: SYSTEM LIBRARY
;	  0033	!
;	  0034	! ABSTRACT:
;	  0035	!
;	  0036	!
;	  0037	! THIS MODULE CONTAINS ROUTINES FOR CONVERION OF BINARY TO VARIOUS
;	  0038	! NUMERIC ASCII REPRESENTATIONS.
;	  0039	!
;	  0040	!
;	  0041	! ENVIRONMENT: ANY
;	  0042	!
;	  0043	! AUTHOR: ALAN D. PECKHAM, CREATION DATE: 28-AUG-78
;	  0044	!
;	  0045	! MODIFIED BY:
;	  0046	!
;	  0047	!	, : VERSION
;	  0048	! 01	-
;	  0049	!--
;	  0050	
;	  0051	!
;	  0052	! TABLE OF CONTENTS:
CBTA								28-May-1985 14:29:31	TOPS-20 Bliss-16 2A(530)	    Page   2
001010								30-Dec-1982 17:29:07	DNET61:<MCB.UTILITIES>CBTA.BLI.1 (1)

;	  0053	!
;	  0054	
;	  0055	FORWARD ROUTINE
;	  0056	    $CBDAT,					!Convert 2-digit date
;	  0057	    $CBDMG,					!Convert 5-digit unsigned decimal
;	  0058	    $CBDSG,					!Convert 5-digit signed decimal
;	  0059	    $CBOMG,					!Convert 6-digit unsigned octal
;	  0060	    $CBOSG,					!Convert 6-digit signed octal
;	  0061	    $CBTA,					!General convert binary to ASCII.
;	  0062	    $CBTMG;					!Convert 3-digit byte to unsigned octal
;	  0063	
;	  0064	!
;	  0065	! INCLUDE FILES
;	  0066	!
;	  0067	!	NONE
;	  0068	!
;	  0069	! MACROS:
;	  0070	!
;	  0071	!	NONE
;	  0072	!
;	  0073	! EQUATED SYMBOLS:
;	  0074	!
;	  0075	!	NONE
;	  0076	!
;	  0077	! OWN STORAGE:
;	  0078	!
;	  0079	!	NONE
;	  0080	!
;	  0081	! EXTERNAL REFERENCES:
;	  0082	!
;	  0083	!	NONE
;	  0084	!
;	  0085	
CBTA								28-May-1985 14:29:31	TOPS-20 Bliss-16 2A(530)	    Page   3
001010								30-Dec-1982 17:29:07	DNET61:<MCB.UTILITIES>CBTA.BLI.1 (2)

;	  0086	GLOBAL ROUTINE $CBDAT (BUF_PTR_ADR, VALUE, FLAGS) =
;	  0087	
;	  0088	!++
;	  0089	! FUNCTIONAL DESCRIPTION:
;	  0090	!
;	  0091	!
;	  0092	!
;	  0093	!
;	  0094	! FORMAL PARAMETERS:
;	  0095	!
;	  0096	!	.BUF_PTR_ADR				!Address of character sequence
;	  0097	!						!pointer to buffer to insert
;	  0098	!						!the number at.
;	  0099	!	.VALUE					!The value to convert.
;	  0100	!	.FLAGS					!Suppress leading zeros
;	  0101	!						!if zero.
;	  0102	!
;	  0103	! IMPLICIT INPUTS:
;	  0104	!
;	  0105	!	NONE
;	  0106	!
;	  0107	! IMPLICIT OUTPUTS:
;	  0108	!
;	  0109	!	The buffer pointer ..BUF_PTR_ADR is updated to point past
;	  0110	!	the characters inserted.
;	  0111	!
;	  0112	! ROUTINE VALUE:
;	  0113	!
;	  0114	!	The number of characters inserted into the output buffer.
;	  0115	!
;	  0116	! SIDE EFFECTS
;	  0117	!
;	  0118	!	NONE
;	  0119	!
;	  0120	!--
;	  0121	
;	  0122	    BEGIN
;	  0123	
;	  0124	    LITERAL
;	  0125		RADIX = 10,
;	  0126		WIDTH = 2,
;	  0127		SUPPRESS = RADIX + WIDTH^11,
;	  0128		NO_SUPPRESS = RADIX + WIDTH^11 + 1^9;
;	  0129	
;	  0130	    $CBTA (.BUF_PTR_ADR, .VALUE, (IF .FLAGS EQL 0 THEN SUPPRESS ELSE NO_SUPPRESS))
;	  0131	    END;					!OF $CBDAT


						.TITLE	CBTA
						.IDENT	/001010/

						.SBTTL	$CBDAT
CBTA								28-May-1985 14:29:31	TOPS-20 Bliss-16 2A(530)	    Page   4
001010								30-Dec-1982 17:29:07	DNET61:<MCB.UTILITIES>CBTA.BLI.1 (2)

000000						.PSECT	$CODE$,  RO 

000000	016646  000006 			$CBDAT::MOV	6(SP),-(SP)			; BUF.PTR.ADR,*				0130
000004	016646  000006 				MOV	6(SP),-(SP)			; VALUE,*
000010	005766  000006 				TST	6(SP)				; FLAGS
000014	001003 					BNE	1$
000016	012746  010012 				MOV	#10012,-(SP)
000022	000402 					BR	2$
000024	012746  011012 			1$:	MOV	#11012,-(SP)
000030	004767  000000V			2$:	JSR	PC,$CBTA
000034	062706  000006 				ADD	#6,SP				;					0122
000040	000207 					RTS	PC				;					0086

; Routine Size:  17 words,	Routine Base:  $CODE$ + 0000
; Maximum stack depth per invocation:  4 words


;	  0132	
CBTA								28-May-1985 14:29:31	TOPS-20 Bliss-16 2A(530)	    Page   5
001010								30-Dec-1982 17:29:07	DNET61:<MCB.UTILITIES>CBTA.BLI.1 (3)

;	  0133	GLOBAL ROUTINE $CBDMG (BUF_PTR_ADR, VALUE, FLAGS) =
;	  0134	
;	  0135	!++
;	  0136	! FUNCTIONAL DESCRIPTION:
;	  0137	!
;	  0138	!
;	  0139	!
;	  0140	!
;	  0141	! FORMAL PARAMETERS:
;	  0142	!
;	  0143	!	.BUF_PTR_ADR				!Address of character sequence
;	  0144	!						!pointer to buffer to insert
;	  0145	!						!the number at.
;	  0146	!	.VALUE					!The value to convert.
;	  0147	!	.FLAGS					!Suppress leading zeros
;	  0148	!						!if zero.
;	  0149	!
;	  0150	! IMPLICIT INPUTS:
;	  0151	!
;	  0152	!	NONE
;	  0153	!
;	  0154	! IMPLICIT OUTPUTS:
;	  0155	!
;	  0156	!	The buffer pointer ..BUF_PTR_ADR is updated to point past
;	  0157	!	the characters inserted.
;	  0158	!
;	  0159	! ROUTINE VALUE:
;	  0160	!
;	  0161	!	The number of characters inserted into the output buffer.
;	  0162	!
;	  0163	! SIDE EFFECTS
;	  0164	!
;	  0165	!	NONE
;	  0166	!
;	  0167	!--
;	  0168	
;	  0169	    BEGIN
;	  0170	
;	  0171	    LITERAL
;	  0172		RADIX = 10,
;	  0173		WIDTH = 5,
;	  0174		SUPPRESS = RADIX + WIDTH^11,
;	  0175		NO_SUPPRESS = RADIX + WIDTH^11 + 1^9;
;	  0176	
;	  0177	    $CBTA (.BUF_PTR_ADR, .VALUE, (IF .FLAGS EQL 0 THEN SUPPRESS ELSE NO_SUPPRESS))
;	  0178	    END;					!OF $CBDMG


						.SBTTL	$CBDMG
000000	016646  000006 			$CBDMG::MOV	6(SP),-(SP)			; BUF.PTR.ADR,*				0177
000004	016646  000006 				MOV	6(SP),-(SP)			; VALUE,*
000010	005766  000006 				TST	6(SP)				; FLAGS
CBTA								28-May-1985 14:29:31	TOPS-20 Bliss-16 2A(530)	    Page   6
001010								30-Dec-1982 17:29:07	DNET61:<MCB.UTILITIES>CBTA.BLI.1 (3)

000014	001003 					BNE	1$
000016	012746  024012 				MOV	#24012,-(SP)
000022	000402 					BR	2$
000024	012746  025012 			1$:	MOV	#25012,-(SP)
000030	004767  000000V			2$:	JSR	PC,$CBTA
000034	062706  000006 				ADD	#6,SP				;					0169
000040	000207 					RTS	PC				;					0133

; Routine Size:  17 words,	Routine Base:  $CODE$ + 0042
; Maximum stack depth per invocation:  4 words


;	  0179	
CBTA								28-May-1985 14:29:31	TOPS-20 Bliss-16 2A(530)	    Page   7
001010								30-Dec-1982 17:29:07	DNET61:<MCB.UTILITIES>CBTA.BLI.1 (4)

;	  0180	GLOBAL ROUTINE $CBDSG (BUF_PTR_ADR, VALUE, FLAGS) =
;	  0181	
;	  0182	!++
;	  0183	! FUNCTIONAL DESCRIPTION:
;	  0184	!
;	  0185	!
;	  0186	!
;	  0187	!
;	  0188	! FORMAL PARAMETERS:
;	  0189	!
;	  0190	!	.BUF_PTR_ADR				!Address of character sequence
;	  0191	!						!pointer to buffer to insert
;	  0192	!						!the number at.
;	  0193	!	.VALUE					!The value to convert.
;	  0194	!	.FLAGS					!Suppress leading zeros
;	  0195	!						!if zero.
;	  0196	!
;	  0197	! IMPLICIT INPUTS:
;	  0198	!
;	  0199	!	NONE
;	  0200	!
;	  0201	! IMPLICIT OUTPUTS:
;	  0202	!
;	  0203	!	The buffer pointer ..BUF_PTR_ADR is updated to point past
;	  0204	!	the characters inserted.
;	  0205	!
;	  0206	! ROUTINE VALUE:
;	  0207	!
;	  0208	!	The number of characters inserted into the output buffer.
;	  0209	!
;	  0210	! SIDE EFFECTS
;	  0211	!
;	  0212	!	NONE
;	  0213	!
;	  0214	!--
;	  0215	
;	  0216	    BEGIN
;	  0217	
;	  0218	    LITERAL
;	  0219		RADIX = 10,
;	  0220		WIDTH = 5,
;	  0221		SUPPRESS = RADIX + WIDTH^11 + 1^8,
;	  0222		NO_SUPPRESS = RADIX + WIDTH^11 + 1^8 + 1^9;
;	  0223	
;	  0224	    $CBTA (.BUF_PTR_ADR, .VALUE, (IF .FLAGS EQL 0 THEN SUPPRESS ELSE NO_SUPPRESS))
;	  0225	    END;					!OF $CBDSG


						.SBTTL	$CBDSG
000000	016646  000006 			$CBDSG::MOV	6(SP),-(SP)			; BUF.PTR.ADR,*				0224
000004	016646  000006 				MOV	6(SP),-(SP)			; VALUE,*
000010	005766  000006 				TST	6(SP)				; FLAGS
CBTA								28-May-1985 14:29:31	TOPS-20 Bliss-16 2A(530)	    Page   8
001010								30-Dec-1982 17:29:07	DNET61:<MCB.UTILITIES>CBTA.BLI.1 (4)

000014	001003 					BNE	1$
000016	012746  024412 				MOV	#24412,-(SP)
000022	000402 					BR	2$
000024	012746  025412 			1$:	MOV	#25412,-(SP)
000030	004767  000000V			2$:	JSR	PC,$CBTA
000034	062706  000006 				ADD	#6,SP				;					0216
000040	000207 					RTS	PC				;					0180

; Routine Size:  17 words,	Routine Base:  $CODE$ + 0104
; Maximum stack depth per invocation:  4 words


;	  0226	
CBTA								28-May-1985 14:29:31	TOPS-20 Bliss-16 2A(530)	    Page   9
001010								30-Dec-1982 17:29:07	DNET61:<MCB.UTILITIES>CBTA.BLI.1 (5)

;	  0227	GLOBAL ROUTINE $CBOMG (BUF_PTR_ADR, VALUE, FLAGS) =
;	  0228	
;	  0229	!++
;	  0230	! FUNCTIONAL DESCRIPTION:
;	  0231	!
;	  0232	!
;	  0233	!
;	  0234	!
;	  0235	! FORMAL PARAMETERS:
;	  0236	!
;	  0237	!	.BUF_PTR_ADR				!Address of character sequence
;	  0238	!						!pointer to buffer to insert
;	  0239	!						!the number at.
;	  0240	!	.VALUE					!The value to convert.
;	  0241	!	.FLAGS					!Suppress leading zeros
;	  0242	!						!if zero.
;	  0243	!
;	  0244	! IMPLICIT INPUTS:
;	  0245	!
;	  0246	!	NONE
;	  0247	!
;	  0248	! IMPLICIT OUTPUTS:
;	  0249	!
;	  0250	!	The buffer pointer ..BUF_PTR_ADR is updated to point past
;	  0251	!	the characters inserted.
;	  0252	!
;	  0253	! ROUTINE VALUE:
;	  0254	!
;	  0255	!	The number of characters inserted into the output buffer.
;	  0256	!
;	  0257	! SIDE EFFECTS
;	  0258	!
;	  0259	!	NONE
;	  0260	!
;	  0261	!--
;	  0262	
;	  0263	    BEGIN
;	  0264	
;	  0265	    LITERAL
;	  0266		RADIX = 8,
;	  0267		WIDTH = 6,
;	  0268		SUPPRESS = RADIX + WIDTH^11,
;	  0269		NO_SUPPRESS = RADIX + WIDTH^11 + 1^9;
;	  0270	
;	  0271	    $CBTA (.BUF_PTR_ADR, .VALUE, (IF .FLAGS EQL 0 THEN SUPPRESS ELSE NO_SUPPRESS))
;	  0272	    END;					!OF $CBOMG


						.SBTTL	$CBOMG
000000	016646  000006 			$CBOMG::MOV	6(SP),-(SP)			; BUF.PTR.ADR,*				0271
000004	016646  000006 				MOV	6(SP),-(SP)			; VALUE,*
000010	005766  000006 				TST	6(SP)				; FLAGS
CBTA								28-May-1985 14:29:31	TOPS-20 Bliss-16 2A(530)	    Page  10
001010								30-Dec-1982 17:29:07	DNET61:<MCB.UTILITIES>CBTA.BLI.1 (5)

000014	001003 					BNE	1$
000016	012746  030010 				MOV	#30010,-(SP)
000022	000402 					BR	2$
000024	012746  031010 			1$:	MOV	#31010,-(SP)
000030	004767  000000V			2$:	JSR	PC,$CBTA
000034	062706  000006 				ADD	#6,SP				;					0263
000040	000207 					RTS	PC				;					0227

; Routine Size:  17 words,	Routine Base:  $CODE$ + 0146
; Maximum stack depth per invocation:  4 words


;	  0273	
CBTA								28-May-1985 14:29:31	TOPS-20 Bliss-16 2A(530)	    Page  11
001010								30-Dec-1982 17:29:07	DNET61:<MCB.UTILITIES>CBTA.BLI.1 (6)

;	  0274	GLOBAL ROUTINE $CBOSG (BUF_PTR_ADR, VALUE, FLAGS) =
;	  0275	
;	  0276	!++
;	  0277	! FUNCTIONAL DESCRIPTION:
;	  0278	!
;	  0279	!
;	  0280	!
;	  0281	!
;	  0282	! FORMAL PARAMETERS:
;	  0283	!
;	  0284	!	.BUF_PTR_ADR				!Address of character sequence
;	  0285	!						!pointer to buffer to insert
;	  0286	!						!the number at.
;	  0287	!	.VALUE					!The value to convert.
;	  0288	!	.FLAGS					!Suppress leading zeros
;	  0289	!						!if zero.
;	  0290	!
;	  0291	! IMPLICIT INPUTS:
;	  0292	!
;	  0293	!	NONE
;	  0294	!
;	  0295	! IMPLICIT OUTPUTS:
;	  0296	!
;	  0297	!	The buffer pointer ..BUF_PTR_ADR is updated to point past
;	  0298	!	the characters inserted.
;	  0299	!
;	  0300	! ROUTINE VALUE:
;	  0301	!
;	  0302	!	The number of characters inserted into the output buffer.
;	  0303	!
;	  0304	! SIDE EFFECTS
;	  0305	!
;	  0306	!	NONE
;	  0307	!
;	  0308	!--
;	  0309	
;	  0310	    BEGIN
;	  0311	
;	  0312	    LITERAL
;	  0313		RADIX = 8,
;	  0314		WIDTH = 6,
;	  0315		SUPPRESS = RADIX + WIDTH^11 + 1^8,
;	  0316		NO_SUPPRESS = RADIX + WIDTH^11 + 1^8 + 1^9;
;	  0317	
;	  0318	    $CBTA (.BUF_PTR_ADR, .VALUE, (IF .FLAGS EQL 0 THEN SUPPRESS ELSE NO_SUPPRESS))
;	  0319	    END;					!OF $CBOSG


						.SBTTL	$CBOSG
000000	016646  000006 			$CBOSG::MOV	6(SP),-(SP)			; BUF.PTR.ADR,*				0318
000004	016646  000006 				MOV	6(SP),-(SP)			; VALUE,*
000010	005766  000006 				TST	6(SP)				; FLAGS
CBTA								28-May-1985 14:29:31	TOPS-20 Bliss-16 2A(530)	    Page  12
001010								30-Dec-1982 17:29:07	DNET61:<MCB.UTILITIES>CBTA.BLI.1 (6)

000014	001003 					BNE	1$
000016	012746  030410 				MOV	#30410,-(SP)
000022	000402 					BR	2$
000024	012746  031410 			1$:	MOV	#31410,-(SP)
000030	004767  000000V			2$:	JSR	PC,$CBTA
000034	062706  000006 				ADD	#6,SP				;					0310
000040	000207 					RTS	PC				;					0274

; Routine Size:  17 words,	Routine Base:  $CODE$ + 0210
; Maximum stack depth per invocation:  4 words


;	  0320	
CBTA								28-May-1985 14:29:31	TOPS-20 Bliss-16 2A(530)	    Page  13
001010								30-Dec-1982 17:29:07	DNET61:<MCB.UTILITIES>CBTA.BLI.1 (7)

;	  0321	GLOBAL ROUTINE $CBTA (BUF_PTR_ADR, VALUE, FLAGS) =
;	  0322	
;	  0323	!++
;	  0324	! FUNCTIONAL DESCRIPTION:
;	  0325	!
;	  0326	!
;	  0327	!
;	  0328	!
;	  0329	! FORMAL PARAMETERS:
;	  0330	!
;	  0331	!	.BUF_PTR_ADR				!Address of character sequence
;	  0332	!						!pointer to buffer to insert
;	  0333	!						!the number at.
;	  0334	!	.VALUE					!The value to convert.
;	  0335	!	.FLAGS<0,8>				!The conversion radix.
;	  0336	!	.FLAGS<8,1>				!VALUE is signed in TRUE.
;	  0337	!	.FLAGS<9,1>				!Don't compress leading zeros
;	  0338	!	.FLAGS<10,1>				!Replace leading zeros with blanks
;	  0339	!	.FLAGS<11,5>				!The maximum field length.
;	  0340	!
;	  0341	! IMPLICIT INPUTS:
;	  0342	!
;	  0343	!	NONE
;	  0344	!
;	  0345	! IMPLICIT OUTPUTS:
;	  0346	!
;	  0347	!	The buffer pointer ..BUF_PTR_ADR is updated to point past
;	  0348	!	the characters inserted.
;	  0349	!
;	  0350	! ROUTINE VALUE:
;	  0351	!
;	  0352	!	The number of characters inserted into the output buffer.
;	  0353	!
;	  0354	! SIDE EFFECTS
;	  0355	!
;	  0356	!	NONE
;	  0357	!
;	  0358	!--
;	  0359	
;	  0360	    BEGIN
;	  0361	
;	  0362	    LOCAL
;	  0363		BUF_PTR,
;	  0364		BUF_PTR_INI,				!Initial pointer into buffer
;	  0365		CHAR : VECTOR [32],			!Holding area for remainders
;	  0366		CHAR_ADR,				!Character position index
;	  0367		FIELD_LENGTH,				!Length of receiving field
;	  0368		FILL_CHAR,				!Fill character.
;	  0369		WORKING_VALUE;				!This is our copy of his number.
;	  0370	
;	  0371	    BIND
;	  0372		RADIX = .FLAGS<0, 8>,			!Radix for conversion
CBTA								28-May-1985 14:29:31	TOPS-20 Bliss-16 2A(530)	    Page  14
001010								30-Dec-1982 17:29:07	DNET61:<MCB.UTILITIES>CBTA.BLI.1 (7)

;	  0373		SIGN_FLAG = .FLAGS<8, 1>,		!On if number should be signed
;	  0374		COMPRESS_FLAG = .FLAGS<9, 1>,		!Zero compress if off
;	  0375		SUPPRESS_FLAG = .FLAGS<10, 1>;		!On to change leading zeros to blanks
;	  0376	
;	  0377	    BUF_PTR_INI = (BUF_PTR = ..BUF_PTR_ADR);	!Save the initial buffer position
;	  0378	    FIELD_LENGTH = .FLAGS<11, 5>;		!and get length of receiving field.
;	  0379	    FILL_CHAR = %C'0';
;	  0380	    WORKING_VALUE = (IF SIGN_FLAG AND .VALUE LSS 0 THEN
;	  0381		BEGIN
;	  0382		CH$WCHAR_A (%C'-', BUF_PTR);		!Insert a minus sign
;	  0383		-.VALUE					!and make positive.
;	  0384		END
;	  0385	    ELSE .VALUE);				!Copy the number.
;	  0386	
;	  0387	    !+
;	  0388	    ! Divide the value to death to get the individual digits.
;	  0389	    !-
;	  0390	
;	  0391	    INCRA CHAR_ADR FROM CHAR [0] TO CHAR [.FIELD_LENGTH - 1] BY %UPVAL DO
;	  0392		BEGIN
;	  0393		.CHAR_ADR = .WORKING_VALUE MOD RADIX;	!Save the remainder
;	  0394		WORKING_VALUE = .WORKING_VALUE/RADIX;	!and do the division.
;	  0395	
;	  0396		!+
;	  0397		! Now turn the number into a digit. If the radix allows digits beyond 9,
;	  0398		! map them up to 'A' through 'Z'.
;	  0399		!-
;	  0400	
;	  0401		.CHAR_ADR = ..CHAR_ADR + (IF ..CHAR_ADR GTR 9 THEN %C'A' - 10 ELSE .FILL_CHAR);
;	  0402	
;	  0403		IF .WORKING_VALUE EQL 0
;	  0404		THEN
;	  0405		    BEGIN
;	  0406	
;	  0407		    !+
;	  0408		    ! If we haven't run out of room in the output field, then check
;	  0409		    ! for significant digit runout. If finished, shorten the field.
;	  0410		    !-
;	  0411	
;	  0412		    IF NOT COMPRESS_FLAG THEN EXITLOOP (FIELD_LENGTH = (.CHAR_ADR - CHAR [0])/%UPVAL + 1);
;	  0413	
;	  0414		    !+
;	  0415		    ! If supressing leading zeros, do this now.
;	  0416		    !-
;	  0417	
;	  0418		    IF SUPPRESS_FLAG THEN FILL_CHAR = %C' ';
;	  0419	
;	  0420		    END;
;	  0421	
;	  0422		END;
;	  0423	
;	  0424	    !+
CBTA								28-May-1985 14:29:31	TOPS-20 Bliss-16 2A(530)	    Page  15
001010								30-Dec-1982 17:29:07	DNET61:<MCB.UTILITIES>CBTA.BLI.1 (7)

;	  0425	    ! The digits are extracted, place them into the output buffer.
;	  0426	    !-
;	  0427	
;	  0428	    WHILE (FIELD_LENGTH = .FIELD_LENGTH - 1) GEQ 0 DO
;	  0429		CH$WCHAR_A (.CHAR [.FIELD_LENGTH], BUF_PTR);	!Insert the digit.
;	  0430	
;	  0431	    .BUF_PTR_ADR = .BUF_PTR;			!Return updated buffer pointer
;	  0432	    CH$DIFF (.BUF_PTR, .BUF_PTR_INI)		!and the number of characters inserted.
;	  0433	    END;					!OF $CBTA


						.SBTTL	$CBTA
000000	004167  000000G			$CBTA:: JSR	R1,$SAVE5			;					0321
000004	162706  000106 				SUB	#106,SP
000010	017666  000130  000002 			MOV	@130(SP),2(SP)			; BUF.PTR.ADR,BUF.PTR			0377
000016	016666  000002  000004 			MOV	2(SP),4(SP)			; BUF.PTR,BUF.PTR.INI
000024	016605  000124 				MOV	124(SP),R5			; FLAGS,FIELD.LENGTH			0378
000030	072527  177765 				ASH	#-13,R5				; *,FIELD.LENGTH
000034	042705  177740 				BIC	#177740,R5			; *,FIELD.LENGTH
000040	012704  000060 				MOV	#60,R4				; *,FILL.CHAR				0379
000044	032766  000400  000124 			BIT	#400,124(SP)			; *,FLAGS				0380
000052	001414 					BEQ	1$
000054	005766  000126 				TST	126(SP)				; VALUE
000060	002011 					BGE	1$
000062	112776  000055  000002 			MOVB	#55,@2(SP)			; *,BUF.PTR				0382
000070	005266  000002 				INC	2(SP)				; BUF.PTR
000074	016602  000126 				MOV	126(SP),R2			; VALUE,WORKING.VALUE			0383
000100	005402 					NEG	R2				; WORKING.VALUE
000102	000402 					BR	2$				;					0380
000104	016602  000126 			1$:	MOV	126(SP),R2			; VALUE,WORKING.VALUE
000110	012716  000006 			2$:	MOV	#6,(SP)				;					0391
000114	060616 					ADD	SP,(SP)				; CHAR,*
000116	010500 					MOV	R5,R0				; FIELD.LENGTH,*
000120	006300 					ASL	R0
000122	012701  000006 				MOV	#6,R1
000126	060601 					ADD	SP,R1				; CHAR,*
000130	060100 					ADD	R1,R0
000132	010003 					MOV	R0,R3
000134	162703  000002 				SUB	#2,R3
000140	000466 					BR	8$
000142	005046 				3$:	CLR	-(SP)				;					0393
000144	116616  000126 				MOVB	126(SP),(SP)			; FLAGS,*
000150	010201 					MOV	R2,R1				; WORKING.VALUE,*
000152	006700 					SXT	R0
000154	071016 					DIV	(SP),R0
000156	010176  000002 				MOV	R1,@2(SP)			; *,CHAR.ADR
000162	005016 					CLR	(SP)				;					0394
000164	116616  000126 				MOVB	126(SP),(SP)			; FLAGS,*
000170	010201 					MOV	R2,R1				; WORKING.VALUE,*
000172	006700 					SXT	R0
000174	071016 					DIV	(SP),R0
000176	010002 					MOV	R0,R2				; *,WORKING.VALUE
CBTA								28-May-1985 14:29:31	TOPS-20 Bliss-16 2A(530)	    Page  16
001010								30-Dec-1982 17:29:07	DNET61:<MCB.UTILITIES>CBTA.BLI.1 (7)

000200	005726 					TST	(SP)+
000202	027627  000000  000011 			CMP	@0(SP),#11			; CHAR.ADR,*				0401
000210	003403 					BLE	4$
000212	012700  000067 				MOV	#67,R0
000216	000401 					BR	5$
000220	010400 				4$:	MOV	R4,R0				; FILL.CHAR,*
000222	067600  000000 			5$:	ADD	@0(SP),R0			; CHAR.ADR,*
000226	010076  000000 				MOV	R0,@0(SP)			; *,CHAR.ADR
000232	005702 					TST	R2				; WORKING.VALUE				0403
000234	001026 					BNE	7$
000236	032766  001000  000124 			BIT	#1000,124(SP)			; *,FLAGS				0412
000244	001014 					BNE	6$
000246	012701  000006 				MOV	#6,R1
000252	060601 					ADD	SP,R1				; CHAR,*
000254	011600 					MOV	(SP),R0				; CHAR.ADR,*
000256	160100 					SUB	R1,R0
000260	010001 					MOV	R0,R1
000262	006700 					SXT	R0
000264	071027  000002 				DIV	#2,R0
000270	010005 					MOV	R0,R5				; *,FIELD.LENGTH
000272	005205 					INC	R5				; FIELD.LENGTH
000274	000412 					BR	9$
000276	032766  002000  000124 		6$:	BIT	#2000,124(SP)			; *,FLAGS				0418
000304	001402 					BEQ	7$
000306	012704  000040 				MOV	#40,R4				; *,FILL.CHAR
000312	062716  000002 			7$:	ADD	#2,(SP)				; *,CHAR.ADR				0391
000316	021603 				8$:	CMP	(SP),R3				; CHAR.ADR,*
000320	101710 					BLOS	3$
000322	005305 				9$:	DEC	R5				; FIELD.LENGTH				0428
000324	100413 					BMI	10$
000326	010500 					MOV	R5,R0				; FIELD.LENGTH,*			0429
000330	006300 					ASL	R0
000332	012701  000006 				MOV	#6,R1
000336	060601 					ADD	SP,R1				; CHAR,*
000340	060100 					ADD	R1,R0
000342	111076  000002 				MOVB	(R0),@2(SP)			; *,BUF.PTR
000346	005266  000002 				INC	2(SP)				; BUF.PTR
000352	000763 					BR	9$				;					0428
000354	016676  000002  000130 		10$:	MOV	2(SP),@130(SP)			; BUF.PTR,BUF.PTR.ADR			0431
000362	016600  000002 				MOV	2(SP),R0			; BUF.PTR,*				0432
000366	166600  000004 				SUB	4(SP),R0			; BUF.PTR.INI,*
000372	062706  000106 				ADD	#106,SP				;					0321
000376	000207 					RTS	PC

; Routine Size:  128 words,	Routine Base:  $CODE$ + 0252
; Maximum stack depth per invocation:  42 words


;	  0434	
CBTA								28-May-1985 14:29:31	TOPS-20 Bliss-16 2A(530)	    Page  17
001010								30-Dec-1982 17:29:07	DNET61:<MCB.UTILITIES>CBTA.BLI.1 (8)

;	  0435	GLOBAL ROUTINE $CBTMG (BUF_PTR_ADR, VALUE, FLAGS) =
;	  0436	
;	  0437	!++
;	  0438	! FUNCTIONAL DESCRIPTION:
;	  0439	!
;	  0440	!
;	  0441	!
;	  0442	!
;	  0443	! FORMAL PARAMETERS:
;	  0444	!
;	  0445	!	.BUF_PTR_ADR				!Address of character sequence
;	  0446	!						!pointer to buffer to insert
;	  0447	!						!the number at.
;	  0448	!	.VALUE					!The value to convert.
;	  0449	!	.FLAGS					!Suppress leading zeros
;	  0450	!						!if zero.
;	  0451	!
;	  0452	! IMPLICIT INPUTS:
;	  0453	!
;	  0454	!	NONE
;	  0455	!
;	  0456	! IMPLICIT OUTPUTS:
;	  0457	!
;	  0458	!	The buffer pointer ..BUF_PTR_ADR is updated to point past
;	  0459	!	the characters inserted.
;	  0460	!
;	  0461	! ROUTINE VALUE:
;	  0462	!
;	  0463	!	The number of characters inserted into the output buffer.
;	  0464	!
;	  0465	! SIDE EFFECTS
;	  0466	!
;	  0467	!	NONE
;	  0468	!
;	  0469	!--
;	  0470	
;	  0471	    BEGIN
;	  0472	
;	  0473	    LITERAL
;	  0474		RADIX = 8,
;	  0475		WIDTH = 3,
;	  0476		SUPPRESS = RADIX + WIDTH^11,
;	  0477		NO_SUPPRESS = RADIX + WIDTH^11 + 1^9;
;	  0478	
;	  0479	    $CBTA (.BUF_PTR_ADR, .VALUE, (IF .FLAGS EQL 0 THEN SUPPRESS ELSE NO_SUPPRESS))
;	  0480	    END;					!OF $CBTMG


						.SBTTL	$CBTMG
000000	016646  000006 			$CBTMG::MOV	6(SP),-(SP)			; BUF.PTR.ADR,*				0479
000004	016646  000006 				MOV	6(SP),-(SP)			; VALUE,*
000010	005766  000006 				TST	6(SP)				; FLAGS
CBTA								28-May-1985 14:29:31	TOPS-20 Bliss-16 2A(530)	    Page  18
001010								30-Dec-1982 17:29:07	DNET61:<MCB.UTILITIES>CBTA.BLI.1 (8)

000014	001003 					BNE	1$
000016	012746  014010 				MOV	#14010,-(SP)
000022	000402 					BR	2$
000024	012746  015010 			1$:	MOV	#15010,-(SP)
000030	004767  177344 			2$:	JSR	PC,$CBTA
000034	062706  000006 				ADD	#6,SP				;					0471
000040	000207 					RTS	PC				;					0435

; Routine Size:  17 words,	Routine Base:  $CODE$ + 0652
; Maximum stack depth per invocation:  4 words


;	  0481	
;	  0482	END
;	  0483	
;	  0484	ELUDOM



;					OTS external references
						.GLOBL	$SAVE5


;					PSECT SUMMARY
;
;	Psect Name			Words	  Attributes
;	 $CODE$				  230	    RO ,  I  ,  LCL,  REL,  CON





; Size:		230 code + 0 data words
; Run Time:	00:02.9
; Elapsed Time:	00:05.4
; Memory Used:	15 pages
; Compilation Complete