OK, I probably just suck at 6502, but what is the purpose of tay immediately followed by tya?
Code
 C940  lda #$87                                            A9 87
 C942  jsr $cbc0                                           20 C0 CB
 C945  tay                                                 A8
 C946  tya                                                 98
 C947  cmp #$8d                                            C9 8D
 C949  bne $c968                                           D0 1D
 C94B  lda #$00                                            A9 00
 C94D  sta $0438, x                                        9D 38 04