.title maskit ; ; integer*2 function maskit(type, mask, value) ; logical*1 function maskit(type, mask, value) ; ; performs an and function of mask on value and returns ; it as a 16-bit integer. type indicates the type of operands, ; with 0 indicating bytes or 1 indicating words ; ; ap=%5 ; argument pointer type=2 mask=4 value=6 maskit:: tst @type(ap) ; see if byte or word bne doword ; != 0 => words dobyte: movb @mask(ap),r1 ; place mask in r1 movb @value(ap),r0 ; place value to mask in r0 br domask doword: mov @mask(ap),r1 mov @value(ap),r0 domask: com r1 ; complement mask word bic r1,r0 ; clear all bits in r0 which are set ; in r1 return .end