Trailing-Edge
-
PDP-10 Archives
-
decuslib10-01
-
43,50161/mshift.mp
There are no other files named mshift.mp in the archive.
TITLE MSHIFT
ENTRY MSHIFT
MSHIFT: Z
MOVEM 17,STORE+17 ;SAVE
MOVEI 17,STORE ;THE
BLT 17,STORE+16 ;AC'S
MOVE 0,@1(16) ;AC0=PRECISION
MOVE 1,(16) ;AC1=ADDR OF CHARACTERISTIC WORD
HRRZ 11,1
MOVE 2,2(16) ;AC2=#OF BITS AND SIGN OF DIRECTION
JUMPL 2,RIGHT ;IF AC2<0, THEN MUST SHIFT RIGHT
IDIVI 2,43 ;AC2=# OF WHOLE WORDS TO BE MOVED
;AC3=# OF EXTRA BITS TO BE MOVED
MOVE 12,0 ;AC12=# OF ACTUAL WORDS TO BE SHIFTED
SUB 12,2
JUMPE 3,NBL ;IF NO EXTRA BITS TO BE SHIFTED JUMP
MOVN 4,12
MOVE 5,2
ADD 5,1 ;AC5=ADDR OF FIRST WHOLE WORD
AOJ 5,0 ;TO BE SHIFTED
HRL 11,4 ;AC11=COUNTER FOR LOOPING
MOVE 6,(5) ;AC6=FIRST WORD FOR BIT SHIFTING
ASH 6,(3)
MOVE 15,1
ADD 15,0
AOJ 15,0
LOOP1: SETZB 7,10
AOJ 5,0
CAMN 5,15
JRST .+2
MOVE 10,(5) ;AC10=CONTENTS OF NEXT SEQ. WORD
ASHC 7,(3)
IOR 6,7 ;AC6=SHIFTED WORD
MOVEM 6,1(11) ;MOVE WORD TO CORRECT NEW ADDR
MOVE 6,10
AOBJN 11,LOOP1 ;LOOP UNTIL ALL WORDS HAVE BEEN MOVED
JUMPE 2,RETS ;IF ONLY BITS MOVED, NO WORDS TO BE ZEROED
LOOP2: MOVE 5,1
ADD 5,0
SUB 5,2
AOJ 5,1 ;AC5=ADDR OF FIRST WORD TO BE ZEROED
MOVN 2,2
HRL 5,2
SETZM 0,(5) ;LOOP UNTIL ALL WORDS NEC. ARE ZEROED
AOBJN 5,.-1
JRST RETS
NBL: MOVE 17,1
AOJ 17,0 ;AC17=TO ADDR FOR BLT
MO VE 16,17
ADD 16,2
HRL 17,16 ;LEFT HALF AC17=FROM ADDR FOR BLT
ADD 12,1 ;UNTIL ADDR IS IN AC12 FOR THE BLT
BLT 17,(12)
JRST LOOP2
RIGHT: IDIVI 2,43 ;AC2=# OF WHOLE WORDS TO BE MOVED
;AC3=# OF EXTRA BITS TO BE MOVED
ADD 11,0
MOVE 12,0
ADD 12,2 ;AC12=# OF WORDS ACTUALLY NEED MOVING
JUMPE 3, NBR ;IF NO EXTRA BITS TO BE SHIFTED JUMP
MOVE 5,2
ADD 5,0 ;AC5=ADDR OF FIRST WHOLE
ADD 5,1 ;WORD TO BE SHIFTED
MOVE 10,(5)
ASH 10,(3)
LOOP3: SETZB 7,6
SOJ 5,0
CAMN 5,1
JRST .+2
MOVE 6,(5) ;AC6=NEXT SEQUENTIAL WORD
ASHC 6,(3)
IOR 10,7 ;AC10=SHIFTED WORD
MOVEM 10,(11)
MOVE 10,6
SOJ 11,0
SOJG 12,LOOP3 ;LOOP UNTIL ALL SHIFTED AND MOVED
JUMPE 2,RETS ;IF ONLY BITS SHIFTED, NO WORDS TO BE ZEROED
LOOP4: MOVE 5,1
AOJ 5,0 ;AC5=FIRST WORD TO BE ZEROED
HRL 5,2
SETZM 0,(5)
AOBJN 5,.-1 ;LOOP UNTIL ALL WORDS ZEROED THAT NEED IT
RETS: HRLZI 17,STORE
BLT 17,17 ;RESTORE AC'S
JRA 16,3(16)
STORE: BLOCK 20
NBR: MOVE 17,1
ADD 17,0 ;AC17=TO ADDR
MOVE 16,17
ADD 16,2 ;AC16=FROM ADDR
MOVE 15,(16)
MOVEM 15,(17)
SOJ 16,0
SOJ 17,0
SOJG 12,.-4 ;LOOP UNTIL TRANSFER COMPLETED
JRST LOOP4
END