maybe you should check the math.
With a change to the math the program works correctly. Running on a EasyPIC5 board.

Sorry I was sleeping that day in class, so I can't explain why PBP and MBasic work differently.