Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-05 - 43,50337/23/bitfie.mac
There is 1 other file named bitfie.mac in the archive. Click here to see a list.
COMMENT * SIMULA specification;
OPTIONS(/E:QUICK,bitfield);
INTEGER PROCEDURE bitfield(w,firstbit,len);
INTEGER w,firstbit,len;
COMMENT Returns the byte starting at firstbit (0-35) of length len bits.
len>=0 AND len<36 AND firstbit+len<=36 must hold.
Special option: IF len<0, use -len and extend sign bit.
;

!*;! MACRO-10 code !*;!

	TITLE	bitfield
	ENTRY	bitfield
	SUBTTL	SIMULA utility, Lars Enderin April 1976

;!*** Copyright 1976 by the Swedish Defence Research Institute. ***
;!*** Copying is allowed.					***


	sall
	search	simmac,simmcr,simrpa
	macinit

	;! Local definitions ;!

	w==0
	firstbit==1
	len==2

bitfield:
	PROC
	L	w(XTAC)
	L	X1,firstbit(XTAC)
	LSH	(X1)
	L	X1,len(XTAC)
	IF	;! Positive len
		JUMPL	X1,FALSE
	THEN	;! Do not propagate sign
		LSH	-^d36(X1)
	ELSE	;! Extend sign bit to the left
		MOVNI	X1,^d36(X1)
		ASH	(X1)
	FI
	ST	(XTAC)
	RETURN
	EPROC
	LIT
	END;