Seems like you forgot to set TRIS registers in the second code unless I am snowblind.
Ver 2.6 makes LOOP a reserved word.