NIBHEX 411 * REVBIT$ entry point REVBIT CD1EX D1=C R0=C string header GOSBVL #0BD38 =POP1S C=0 W C=A A nib length of string CSRB byte length D=C A byte counter r500C7 D=D-1 A decrement GOC r500E8 last byte done if D[A]=0 *********************************************** * This is the heart of REVBIT$ - reverses the bit order P= 7 A=DAT1 B get the byte r500D1 A=A+A X shift the bit to least significant position of A[XS] C=A XS move to C[XS] CSRB and shift it to C[B] most significant bit P=P-1 do it once for each bit and C[B] is in reverse order GONC r500D1 next bit unless carry DAT1=C B - store the reversed byte, we are done with this one D1=D1+ 2 advance to next byte GONC r500C7 and go reverse it r500E8 C=R0 get header address D1=C P= 0 GOVLNG #0F23C =EXPR