I have just found that if I comment out the following include files, the shift function in the main program compiles/assembles without error.

With the shift function omitted and these files included, the program compiles/assembles without error and runs perfectly so somehow one of them is affecting MPASM and shift functions.

'INCLUDE "DT_INTS-18.bas"
'INCLUDE "ReEnterPBP-18.bas"
'INCLUDE "NewRXbuff.inc"