Google
 

Trailing-Edge - PDP-10 Archives - decus_20tap4_198111 - decus/20-0125/byte.mac
There are 2 other files named byte.mac in the archive. Click here to see a list.
	TITLE	BYTE - MANIPULATION ROUTINES
	ENTRY	GFIELD,SFIELD
	;
	; THESE ROUTINES ARE FORTRAN-10 AND F40 COMPATIBLE
	; REGISTER DEFINITIONS
	;
RESULT=0
TEMP=1
L=16
P=17
BYTEP:	EXP	0			; BYTE POINTER
	;
	; GFIELD, CALLING SEQUENCE IS:
	;
	; IRESLT = GFIELD(IVAR, IPOS, ILEN)
	;
	; WHERE GFIELD IS AN INTEGER FUNCTION WHICH
	; RETURNS A BYTE WITHIN IVAR DEFINED BY:
	;
	; IPOS - BYTE POSITION (NUMBER OF BITS FROM LEFT)
	; ILEN - THE LENGTH OF THE BYTE IN BITS
	;
GFIELD:	SKIPA			; F40 AND
	PUSH	P,L		; FORTRAN-10 COMPATIBLE
	JSR	POINT		; CREATE BYTE POINTER
	LDB	RESULT,BYTEP	; GET THE BYTE
	POPJ	P,		; RETURN TO FORTRAN
	PAGE
	; SFIELD, CALLING SEQUENCE IS:
	;
	; CALL SFIELD(IVAR, IPOS, ILEN, IVAL)
	;
	; THIS STORES A BYTE (AS DEFINED IN GFIELD)
	; WITH VALUE "IVAL"
	;
SFIELD:	SKIPA			; F40 AND
	PUSH	P,L		; FORTRAN-10 COMPATIBLE
	JSR	POINT		; CREATE BYTE POINTER
	MOVE	TEMP,@3(L)	; GET THE VALUE
	DPB	TEMP,BYTEP	; STORE THE BYTE
	POPJ	P,		; AND RETURN TO FORTRAN
	PAGE
	; POINT, THIS ROUTINE CREATES THE BYTE POINTER
	;
POINT:	EXP	0			; ENTRY POINT
	MOVEI	TEMP,^D36		; 36 BITS IN A WORD
	SUB	TEMP,@1(L)		; MINUS THE POSITION
	SUB	TEMP,@2(L)		; MINUS THE LENGTH
	LSH	TEMP,^D30		; SHIFT TO POSITION FIELD
	MOVEM	TEMP,BYTEP		; AND STORE IN BYTEP
	MOVE	TEMP,@2(L)		; GET THE LENGTH
	LSH	TEMP,^D24		; SHIFT TO SIZE FIELD
	IORM	TEMP,BYTEP		; AND STORE IN BYTEP
	MOVE	TEMP,0(L)		; GET ADDRESS FIELD
	TLNE	TEMP,20			; IF INDIRECT ADDRESSING (I.E. F10)
	MOVE	TEMP,0(TEMP)		; THEN GET ADDRESS
	HRRZ	TEMP,TEMP		; CLEAR LEFT HALF WORD
	IORM	TEMP,BYTEP		; AND FORM THE BYTE POINTER
	JUMPA	@POINT			; RETURN
	END