HP 3000 Manuals

SPL BDEPOSIT Procedure: Bit Deposit [ SPL to HP C/XL Migration Guide ] MPE/iX 5.0 Documentation


SPL to HP C/XL Migration Guide

SPL BDEPOSIT Procedure:  Bit Deposit 

     <<  BDEPOSIT           SPL BIT DEPOSIT                              >>
     <<                                                                  >>
     <<  This emulates the SPL bit deposit operation, for example:       >>
     <<           I.(5:6) := J + K;                                      >>
     <<  as an SPL procedure:                                            >>
     <<           BDEPOSIT(@i,5,6,j+k);                                  >>
     <<                                                                  >>
     <<  The parameters used by BDEPOSIT are:                            >>
     <<    dw  --  The address of the destination word.                  >>
     <<    sb  --  The starting bit of the deposit field.                >>
     <<    nb  --  The number of bits to deposit.                        >>
     <<    exp --  The expression to deposit into the field specified.   >>
     <<                                                                  >>

     PROCEDURE BDEPOSIT(dw,sb,nb,exp);
       VALUE dw, sb, nb, exp;
       LOGICAL dw, sb, nb, exp;
     BEGIN
       LOGICAL M;
       POINTER P;
       nb := 16-nb;
       sb := nb-sb;
       M := (%(16)FFFF & LSR(nb)) & LSL(sb);
       @p := dw;
       p := (p LAND NOT m) LOR (exp & LSL(sb) LAND m);
     END;



MPE/iX 5.0 Documentation