Trailing-Edge
-
PDP-10 Archives
-
decuslib10-05
-
43,50337/23/depbyt.mac
There is 1 other file named depbyt.mac in the archive. Click here to see a list.
00100 COMMENT * depbyte: SIMULA specification;
00200 OPTIONS(/E:QUICK,depbyte);
00300 INTEGER PROCEDURE depbyte(val,w,firstbit,len);
00400 INTEGER val,w,firstbit,len;
00500 COMMENT Returns the value of W with the modification:
00600 The byte starting at FIRSTBIT (0-35) of length LEN bits is replaced
00700 by VAL.
00800 LEN>=0 AND LEN<=36 AND FIRSTBIT+LEN<=36 must hold.
00900 Note: The last LEN bits of VAL will be used, the other bits will be
01000 ignored.
01100 ;
01200
01300 !*;! MACRO-10 code !*;!
01400
01500 TITLE depbyte
01600 ENTRY depbyte
01700 SUBTTL SIMULA utility, Lars Enderin Feb 1978
01800
01900 ;!*** Copyright 1978 by the Swedish Defence Research Institute. ***
02000 ;!*** Copying is allowed. ***
02100
02200
02300 sall
02400 search simmac,simmcr,simrpa
02500 macinit
02600
02700 ;! Local definitions ;!
02800
02900 len==1+<firstbit==1+<w==1+<result==<val==0>>>>
03300
03400 depbyte:PROC
03500 L X1,len(XTAC) ;! Byte length
03600 LI XIAC ;! Address of target for DPB
03700 DPB X1,[POINT 6,,11] ;! Size field in byte pointer
03800 SUBI X1,^D36 ;! Neg of bits left in word
03900 JUMPG X1,L9 ;! Too big
04000 ADD X1,firstbit(XTAC);! Last bit no
04100 JUMPG X1,L9 ;! Return zero on error
04200 MOVN X1,X1 ;! Bits left in word
04300 CAILE X1,^D36
04400 GOTO L9
04500 DPB X1,[POINT 6,,5] ;! Pos in byte pointer
04600 L XIAC,w(XTAC) ;! Initial word
04700 L X1,val(XTAC) ;! Byte value to insert
04800 DPB X1, ;! Insert it
04900 ST XIAC,result(XTAC)
05000 RET
05100 L9():! SETZM val(XTAC)
05200 RET
05300 EPROC
05400 LIT
05500 END;