.ENABLE LC .title bits ; ; integer function iand(i,j) ; ;############################################################################# ; ; performs a bitwise logical and of i and j and returns the ; result as the value of the funciton. ; ;############################################################################# ; iand:: mov @2(r5),r0 ; load word 1 mov @4(r5),r1 ; load word 2 com r0 ; demoivre's theorem com r1 ; complement r0 and r1 bis r1,r0 ; perform 'or' operation com r0 ; complement again, done. return ; ; ; integer function ior(i,j) ; ;############################################################################# ; ; performs a bitwise logical or of i and j and returns the ; result as the value of the function. ; ;############################################################################# ; ior:: mov @2(r5),r0 ; store i bis @4(r5),r0 ; or with j return ; ; ; integer function ishft(ival,n) ; ;############################################################################# ; ; performs a bit by bit shift on the input parameter ival. if ; n is positive, ival is shifted left (multiplied by 2 n times). ; if n is negative, ival is shifted right n times. the function value ; returns the result of the shift operation. ; ;############################################################################# ; ishft:: mov @2(r5),r0 ; store ival in r0 mov @4(r5),r1 ; store n beq out ; n=0 bmi neg ; n<<0, shift right ; ; shift left 10$: asl r0 ; shift once sob r1,10$ ; shift until 0 br out ; done ; ; shift right neg: asr r0 ; shift right once inc r1 ; inc count bmi neg ; shift abs(n) times ; out: return ; .end