Try to keep the value 0 in the Y register.
echo tya|asm|mondump -r|6502 A=AA X=00 Y=00 S=00 P=22 PC=0300 0 0300- 98 TYA A=00 X=00 Y=00 S=00 P=22 PC=0301 2