

; Bliss-32 7.352	Saturday 22-AUG-1978 03:08:39	DBB3:[PATCH.SRC]PATCON.B32;2					Page 1

; Digital Equipment Corporation

;

;	0001	MODULE PATCON (

;	0002			%IF %VARIANT EQL 1

;     L 0003			%THEN

;	0004				ADDRESSING_MODE (EXTERNAL = LONG_RELATIVE, NONEXTERNAL = LONG_RELATIVE),

;	0005			%FI

;	0006			IDENT = 'X01.08') =

;	0007	BEGIN

;	0008	

;	0009	! Copyright (C) 19761977,1978

;	0010	! Digital Equipment Corporation, Maynard, Massachusetts 01754

;	0011	!

;	0012	! This software is furnished under a license for use only on a

;	0013	! single computer system and may be copied only with the inclusion

;	0014	! of the above copyright notice. This software, or any

;	0015	! other copies thereof, may not be provided or otherwise made

;	0016	! available to any other person except for use on such system

;	0017	! and to one who agrees to these license terms. Title to and

;	0018	! ownership of the software shall at all times remain in DEC.

;	0019	!

;	0020	! The information in this software is subject to change without

;	0021	! notice and should not be construed as a commitment by Digital

;	0022	! Equipment Corporation.

;	0023	!

;	0024	! DEC assumes no responsibility for the use or reliability of

;	0025	! its software on equipment which is not supplied by DEC.

;	0026	!

;	0027	! FACILITY:	PATCH

;	0028	!

;	0029	!++

;	0030	! FUNCTIONAL DESCRIPTION:

;	0031	!

;	0032	!	CONVERSION ROUTINES.

;	0033	!

;	0034	! Version:	X01.08

;	0035	!

;	0036	! History:

;	0037	!	Author:

;	0038	!		Carol Peters, 18 May 1976: Version 01

;	0039	!

;	0040	! MODIFICATIONS:

;	0041	!

;	0042	!  NO	DATE		PROGRAMMER		PURPOSE

;	0043	!  --	----		----------		-------

;	0044	!

;	0045	!  00	19-OCT-77	K.D. MORSE		CONVERT VERSION 7 FOR PATCH.

;	0046	!  01	4-JAN-78	K.D. MORSE		NO CHANGES FOR VERS 8.

;	0047	!  02	21-FEB-78	K.D. MORSE		USE EMUL FOR OVERFLOW CHECK.

;	0048	!  03	24-MAR-78	K.D. MORSE		REPLACE SELECT WITH IF...THEN

;	0049	!						AS IN DEBUG OVERFLOW CHECK AS

;	0050	!						THIS SAVES BYTES. (9)

;	0051	!  04	04-APR-78	K.D. MORSE		NO CHANGES FOR 10.

;	0052	!  05	25-APR-78	K.D. MORSE		CONVERT TO NATIVE COMPILER.

;	0053	!  06	18-MAY-78	K.D. MORSE		NO CHANGES FOR VERS 11.

;	0054	!  07	13-JUN-78	K.D. MORSE		ADD FAO COUNTS TO SIGNALS.

;	0055	!  08	19-JUN-78	K.D. MORSE		NO CHANGES FOR VERS 12-13.



; Bliss-32 7.352	Saturday 22-AUG-1978 03:08:39	DBB3:[PATCH.SRC]PATCON.B32;2					Page 1-1

; Digital Equipment Corporation

;

;	0056	!

;	0057	!--



; Bliss-32 7.352	Saturday 22-AUG-1978 03:08:39	DBB3:[PATCH.SRC]PATCON.B32;2					Page 2

; Digital Equipment Corporation

;

;	0058	FORWARD ROUTINE

;	0059		PAT$CONV_R_50 : NOVALUE,				! Special purpose RAD50 conversion routine

;	0060		PAT$RADX_CONVRT : NOVALUE;				! Converts a string to a value

;	0061	

;	0062	LIBRARY 'SYS$LIBRARY:STARLET.L32';

;	0063	REQUIRE 'SRC$:VXSMAC.REQ';

;	0103	REQUIRE 'SRC$:PATPCT.REQ';

;	0119	REQUIRE 'SRC$:PATGEN.REQ';

;	0298	REQUIRE 'LIB$:PATMSG.REQ';

;	0456	

;	0457	EXTERNAL

;	0458		PAT$GB_MOD_PTR: REF VECTOR [, BYTE];			! Pointer to current modes



; Bliss-32 7.352	Saturday 22-AUG-1978 03:08:39	DBB3:[PATCH.SRC]PATCON.B32;2					Page 3

; Digital Equipment Corporation

;

;	0459	GLOBAL ROUTINE PAT$RADX_CONVRT (STRING_ADDR, VALUE_ADDR) : NOVALUE =

;	0460	

;	0461	!++

;	0462	! FUNCTIONAL DESCRIPTION:

;	0463	!

;	0464	!	Converts an ascii string to a longword value in the current radix.

;	0465	!

;	0466	! CALLING SEQUENCE:

;	0467	!

;	0468	!	PAT$RADX_CONVRT ()

;	0469	!

;	0470	! INPUTS:

;	0471	!

;	0472	!	STRING_ADDR	- Address of ascii string

;	0473	!	VALUE_ADDR	- Address in which to put converted value

;	0474	!

;	0475	! IMPLICIT INPUTS:

;	0476	!

;	0477	!	Contents of PAT$gb_mod_ptr [mode_radix], which is the current

;	0478	!	radix.

;	0479	!

;	0480	! OUTPUTS:

;	0481	!

;	0482	!	none

;	0483	!

;	0484	! IMPLICIT OUTPUTS:

;	0485	!

;	0486	!	A signal and unwind occurs if the conversion fails.

;	0487	!	The converted value is placed in the address passed as the

;	0488	!	second argument.

;	0489	!

;	0490	! ROUTINE value:

;	0491	!

;	0492	!	novalue

;	0493	!

;	0494	! SIDE EFFECTS:

;	0495	!

;	0496	!	none

;	0497	!

;	0498	!--

;	0499	

;	0500	BEGIN

;	0501	

;	0502	BUILTIN

;	0503		EMUL;							! Longword mul and add to get quadword

;	0504	

;	0505	MAP

;	0506		STRING_ADDR: REF VECTOR [, BYTE],

;	0507		VALUE_ADDR: REF VECTOR;

;	0508	

;	0509	LOCAL

;	0510		GIVE_MESSAGE,						! Error flag

;	0511		value : VECTOR[2,LONG],					! Converted value

;	0512		NEGATE,							! Negative number flag

;	0513		CHAR;							! Character-holding variable



; Bliss-32 7.352	Saturday 22-AUG-1978 03:08:39	DBB3:[PATCH.SRC]PATCON.B32;2					Page 3-1

; Digital Equipment Corporation

;

;	0514	

;	0515	VALUE[0] = 0;

;	0516	VALUE[1] = 0;

;	0517	GIVE_MESSAGE = FALSE;

;	0518	NEGATE = FALSE;

;	0519	INCR N FROM 0 TO (NUM_MAX_LENGTH - 1) DO

;	0520		BEGIN

;	0521		IF (CHAR = .STRING_ADDR [.N]) EQL 0 THEN EXITLOOP;

;	0522		IF (.N EQL 0)

;	0523		THEN

;	0524			BEGIN

;	0525			IF (.CHAR EQL '-')

;	0526			THEN

;	0527				BEGIN

;	0528				NEGATE = TRUE;

;	0529				CHAR = '0'

;	0530				END

;	0531			ELSE

;	0532				IF (.CHAR EQL '+')

;	0533				THEN CHAR = '0';

;	0534			END;

;	0535		IF ((.CHAR GEQ '0') AND (.CHAR LEQ '9'))

;	0536		THEN

;	0537			CHAR = .CHAR - '0'

;	0538		ELSE

;	0539			IF ((.CHAR GEQ 'A') AND (.CHAR LEQ 'F'))

;	0540			THEN

;	0541				CHAR = .CHAR - 'A' + 10

;	0542			ELSE

;	0543				CHAR = 256;

;	0544		IF .CHAR GEQ .PAT$GB_MOD_PTR [MODE_RADIX]

;	0545		THEN

;	0546			GIVE_MESSAGE = PAT$_INVNUMBER

;	0547	

;	0548		ELSE

;	0549			EMUL(VALUE[0], %REF(.PAT$GB_MOD_PTR[MODE_RADIX]), CHAR, VALUE);

;	0550		IF .VALUE[1] NEQ 0

;	0551		THEN

;	0552			GIVE_MESSAGE = PAT$_NUMTRUNC;			! Numeric overflow

;	0553		END;

;	0554	IF (.GIVE_MESSAGE NEQ 0)

;	0555	THEN

;	0556		SIGNAL(.GIVE_MESSAGE);

;	0557	IF .NEGATE

;	0558	THEN

;	0559		VALUE[0] = - .VALUE[0];

;	0560	VALUE_ADDR [0] = .VALUE[0];

;	0561	END;





							    .TITLE  PATCON

							    .IDENT  \X01.08\



							    .GLOBL  PAT$GB_MOD_PTR





; Bliss-32 7.352	Saturday 22-AUG-1978 03:08:39	DBB3:[PATCH.SRC]PATCON.B32;2					Page 3-2

; Digital Equipment Corporation

;

							    .PSECT  _PAT$CODE,NOWRT,2



					 001C 00000 	    .ENTRY  PAT$RADX_CONVRT, Save R2,R3,R4			      ; 0459

		         5E	       04  C2 00002 	    SUBL2   #4, SP						      ;

				       7E  D4 00005 	    CLRL    VALUE						      ; 0515

				  04   AE  D4 00007 	    CLRL    VALUE+4						      ; 0516

				       53  7C 0000A 	    CLRQ    GIVE_MESSAGE					      ; 0517

				       51  D4 0000C 	    CLRL    N							      ; 0519

		         50	  04 BC41  9A 0000E 1$:     MOVZBL  @STRING_ADDR[N], CHAR				      ; 0521

				       71  13 00013 	    BEQL    11$							      ;

				       51  D5 00015 	    TSTL    N							      ; 0522

				       12  12 00017 	    BNEQ    4$							      ;

		         2D	       50  D1 00019 	    CMPL    CHAR, #45						      ; 0525

				       05  12 0001C 	    BNEQ    2$							      ;

		         54	       01  D0 0001E 	    MOVL    #1, NEGATE						      ; 0528

				       05  11 00021 	    BRB     3$							      ; 0529

		         2B	       50  D1 00023 2$:     CMPL    CHAR, #43						      ; 0532

				       03  12 00026 	    BNEQ    4$							      ;

		         50	       30  D0 00028 3$:     MOVL    #48, CHAR						      ; 0533

		         30	       50  D1 0002B 4$:     CMPL    CHAR, #48						      ; 0535

				       0A  19 0002E 	    BLSS    5$							      ;

		         39	       50  D1 00030 	    CMPL    CHAR, #57						      ;

				       05  14 00033 	    BGTR    5$							      ;

		         50	       30  C2 00035 	    SUBL2   #48, CHAR						      ; 0537

				       1C  11 00038 	    BRB     7$							      ; 0535

	      00000041   8F	       50  D1 0003A 5$:     CMPL    CHAR, #65						      ; 0539

				       0E  19 00041 	    BLSS    6$							      ;

	      00000046   8F	       50  D1 00043 	    CMPL    CHAR, #70						      ;

				       05  14 0004A 	    BGTR    6$							      ;

		         50	       37  C2 0004C 	    SUBL2   #55, CHAR						      ; 0541

				       05  11 0004F 	    BRB     7$							      ; 0539

		         50	0100   8F  3C 00051 6$:     MOVZWL  #256, CHAR						      ; 0543

00000000G  FF	         08	       00  ED 00056 7$:     CMPZV   #0, #8, @PAT$GB_MOD_PTR, CHAR			      ; 0544

				       50     0005E									      ;

				       09  14 0005F 	    BGTR    8$							      ;

		         53 006D80D2   8F  D0 00061 	    MOVL    #7176402, GIVE_MESSAGE				      ; 0546

				       0C  11 00068 	    BRB     9$							      ; 0544

		         52 00000000G  FF  9A 0006A 8$:     MOVZBL  @PAT$GB_MOD_PTR, R2					      ; 0549

	   50	         52	       6E  7A 00071 	    EMUL    VALUE, R2, CHAR, VALUE				      ;

				       6E     00075									      ;

				  04   AE  D5 00076 9$:     TSTL    VALUE+4						      ; 0550

				       07  13 00079 	    BEQL    10$							      ;

		         53 006D8023   8F  D0 0007B 	    MOVL    #7176227, GIVE_MESSAGE				      ; 0552

	   88	         51	       13  F3 00082 10$:    AOBLEQ  #19, N, 1$						      ; 0519

				       53  D5 00086 11$:    TSTL    GIVE_MESSAGE					      ; 0554

				       09  13 00088 	    BEQL    12$							      ;

				       53  DD 0008A 	    PUSHL   GIVE_MESSAGE					      ; 0556

	      00000000G  00	       01  FB 0008C 	    CALLS   #1, LIB$SIGNAL					      ;

		         03	       54  E9 00093 12$:    BLBC    NEGATE, 13$						      ; 0557

		         6E	       6E  CE 00096 	    MNEGL   VALUE, VALUE					      ; 0559

		    08   BC	       6E  D0 00099 13$:    MOVL    VALUE, @VALUE_ADDR					      ; 0560

					   04 0009D 	    RET     							      ; 0459



; Routine Size:  158 bytes





; Bliss-32 7.352	Saturday 22-AUG-1978 03:08:39	DBB3:[PATCH.SRC]PATCON.B32;2					Page 3-3

; Digital Equipment Corporation

;





; Bliss-32 7.352	Saturday 22-AUG-1978 03:08:39	DBB3:[PATCH.SRC]PATCON.B32;2					Page 4

; Digital Equipment Corporation

;

;	0562	GLOBAL ROUTINE PAT$CONV_R_50( OPWORD, DST_PTR ) : NOVALUE =

;	0563	

;	0564	!++

;	0565	! FUNCTIONAL DESCRIPTION:

;	0566	!

;	0567	!	This routine is a special-purpose RAD50 to ascii conversion routine.

;	0568	!	It takes a longword containing 2 RAD50 words, converts them to a

;	0569	!	6-character string, and "stuffs" these characters into the byte

;	0570	!	vector it is passed a pointer to.

;	0571	!

;	0572	! WARNING:

;	0573	!

;	0574	!	The rest of the code which interfaces to this uses the

;	0575	!	literal OP_CH_SIZE to refer to this 6-character string,

;	0576	!	but this size is implicit in the code here.  If this

;	0577	!	code is changed, the literal must also be changed.  Just

;	0578	!	changing the literal is not enough.

;	0579	!

;	0580	! CALLING SEQUENCE:

;	0581	!

;	0582	!	PAT$CONV_R_50 ( LONGWORD, BYTE_POINTER );

;	0583	!

;	0584	! INPUTS:

;	0585	!

;	0586	!	OPWORD	- The longword which contains the 6 RAD50 characters.

;	0587	!		- This word comes from the OP_NAME field of the

;	0588	!		  PAT$GB_OPINFO data vector.

;	0589	!	DST_PTR - Any byte address into which this routine will

;	0590	!		  stuff the 6 ascii characters obtained from OPWORD.

;	0591	!

;	0592	! IMPLICIT INPUTS:

;	0593	!

;	0594	!	OP_CH_SIZE - From VAXOPS.REQ, which must be 6 to match this code.

;	0595	!

;	0596	! OUTPUTS:

;	0597	!

;	0598	!	NONE.

;	0599	!

;	0600	! IMPLICIT OUTPUTS:

;	0601	!

;	0602	!	The 6 ascii chars are stuffed back into the user-supplied string.

;	0603	!

;	0604	! ROUTINE VALUE:

;	0605	!

;	0606	!	NONE.

;	0607	!

;	0608	! SIDE EFFECTS:

;	0609	!

;	0610	!	See implicit outputs.

;	0611	!

;	0612	!--

;	0613	

;	0614	BEGIN

;	0615	

;	0616	MAP



; Bliss-32 7.352	Saturday 22-AUG-1978 03:08:39	DBB3:[PATCH.SRC]PATCON.B32;2					Page 4-1

; Digital Equipment Corporation

;

;	0617		DST_PTR : REF VECTOR[,BYTE];				! Where to stuff the chars

;	0618	

;	0619	LOCAL

;	0620		J,							! Index

;	0621		W,							! The longword

;	0622		PTR : REF VECTOR[,BYTE];

;	0623	

;	0624	BIND

;	0625		DIVTAB = UPLIT(1, %O'50', %O'3100') : VECTOR;

;	0626	

;	0627	!++

;	0628	! Just extract each of the two words, convert them, and stuff back the results.

;	0629	!--

;	0630	PTR = .DST_PTR;

;	0631	

;	0632	INCR K FROM 0 TO 16 BY 16

;	0633	DO

;	0634		BEGIN 							! Do the conversion on both words separately

;	0635		W = .OPWORD<.K,16>;

;	0636		

;	0637		DECR I FROM 2 TO 0 DO

;	0638			BEGIN

;	0639			J = .W/.DIVTAB[.I]; W = .W - .J*.DIVTAB[.I];

;	0640			IF (.J NEQ 0)

;	0641			THEN

;	0642				BEGIN

;	0643				IF (.J NEQ %O'33')

;	0644				THEN

;	0645					BEGIN

;	0646					IF (.J LSS %O'33') THEN J = .J + %O'56';

;	0647					J = .J + %O'11';

;	0648					END;

;	0649				J = .J + %O'11';

;	0650				END

;	0651			ELSE

;	0652				J = %O'40';

;	0653			!++	

;	0654			! At this point, a single character is in byte 0 of J.

;	0655			!--	

;	0656			(.PTR)<0,8> = .J;

;	0657			PTR = .PTR + 1;

;	0658			END;

;	0659		

;	0660		END;							! End of K loop.

;	0661		

;	0662	END;								! End of PAT$CONV_R_50 routine







							    .PSECT  _PAT$PLIT,NOWRT,NOEXE,0



					      00000 P.AAA:  .LONG   1, 40, 1600						      ;



						    DIVTAB=		P.AAA





; Bliss-32 7.352	Saturday 22-AUG-1978 03:08:39	DBB3:[PATCH.SRC]PATCON.B32;2					Page 4-2

; Digital Equipment Corporation

;



							    .PSECT  _PAT$CODE,NOWRT,2



					 083C 0009E 	    .ENTRY  PAT$CONV_R_50, Save R2,R3,R4,R5,R11			      ; 0562

		         5B 00000000'  EF  9E 000A0 	    MOVAB   DIVTAB, R11						      ;

		         55	  08   AC  D0 000A7 	    MOVL    DST_PTR, PTR					      ; 0630

				       53  D4 000AB 	    CLRL    K							      ; 0632

      04   AC	         10	       53  EF 000AD 1$:     EXTZV   K, #16, OPWORD, W					      ; 0635

				       54     000B2									      ;

		         50	       02  D0 000B3 	    MOVL    #2, I						      ; 0637

	   52	         54	     6B40  C7 000B6 2$:     DIVL3   DIVTAB[I], W, J					      ; 0639

	   51	         52	     6B40  C5 000BB 	    MULL3   DIVTAB[I], J, R1					      ;

		         54	       51  C2 000C0 	    SUBL2   R1, W						      ;

				       52  D5 000C3 	    TSTL    J							      ; 0640

				       15  13 000C5 	    BEQL    5$							      ;

		         1B	       52  D1 000C7 	    CMPL    J, #27						      ; 0643

				       0B  13 000CA 	    BEQL    4$							      ;

		         1B	       52  D1 000CC 	    CMPL    J, #27						      ; 0646

				       03  18 000CF 	    BGEQ    3$							      ;

		         52	       2E  C0 000D1 	    ADDL2   #46, J						      ;

		         52	       09  C0 000D4 3$:     ADDL2   #9, J						      ; 0647

		         52	       09  C0 000D7 4$:     ADDL2   #9, J						      ; 0649

				       03  11 000DA 	    BRB     6$							      ; 0640

		         52	       20  D0 000DC 5$:     MOVL    #32, J						      ; 0652

		         85	       52  90 000DF 6$:     MOVB    J, (PTR)+						      ; 0656

		         D1	       50  F4 000E2 	    SOBGEQ  I, 2$						      ; 0637

	   53	         10	       10  F1 000E5 	    ACBL    #16, #16, K, 1$					      ; 0632

				     FFC2     000E9									      ;

					   04 000EB 	    RET     							      ; 0562



; Routine Size:  78 bytes







; Bliss-32 7.352	Saturday 22-AUG-1978 03:08:39	DBB3:[PATCH.SRC]PATCON.B32;2					Page 5

; Digital Equipment Corporation

;

;	0663	END

;	0664	ELUDOM









							    .GLOBL  LIB$SIGNAL



;				       PSECT SUMMARY

;

;	Name		 Bytes			       Attributes

;

;  _PAT$CODE      	   236  NOWRT,  RD ,  EXE,NOSHR,  LCL,  REL,  CON,NOPIC,ALIGN(2)

;  _PAT$PLIT      	    12  NOWRT,  RD ,NOEXE,NOSHR,  LCL,  REL,  CON,NOPIC,ALIGN(0)

;  $CODE$         	     0  NOWRT,  RD ,  EXE,NOSHR,  LCL,  REL,  CON,NOPIC,ALIGN(2)









;				LIBRARY STATISTICS

;

;					     -------- Symbols --------    Blocks

;	File				     Total    Loaded   Percent      Read

;

;  DBA4:[SYSLIB]STARLET.L32;1		      2688         3         0       108











; Size:		236 code + 12 data bytes

; Run Time:	00:14.2

; Elapsed Time:	00:22.9

; Memory Used:	180 pages

; Compilation Complete

