I am trying to wedge/hack some existing 6502 code that does a BMI instruction. Note that I don't want to insert any new code into the existing code - I'm replacing 3 bytes where possible with a JSR to my patch routine.
e.g.
Code:
nop ; These 3 bytes I will replace with a jsr to my patch routine
lda ($10),y
return_point:
bmi blah
I need to look ahead a bit further in my patch routine, but I need to restore Y, so I'm currently doing this:
Code:
my_routine:
lda ($10),y
cmp #$02
bne skip_done
iny ; Skip my $02 byte
lda ($10),y ; Load A with next byte so original code doesn't realise there was a $02
; Negative flag is set here because it reads $DB
dey ; Decrement Y so that it can be used with a destination copy
; Negative flag no longer set
rts
I apologise if I'm tired and talking complete rubbish but I am correct in that the DEY instruction will clear/set the negative flag based on the result of Y, yes?
Assuming I'm right about this, then how can I re-test the value in A so that the N flag becomes set according to the value of A?
I wonder if ORA #$00 would do the trick?