Oh, actually, what I meant was, if 9840 stores other statuses besides Burnt and Skip Sandwich (like, for example, Mushroom or Diamond Head status) then you'll need to make the code ignore them with the AND opcode. But if the only possible values are 00, 01 and 03, then you can ignore what I said about using the AND.
If letting go of Y is going to cancel running, you'll have to write separate code for that - effectively the opposite of the code that turns running on.
BNE RunButton: ; If Y Button is being pressed, run the code from the RunButton SubroutineInstead of just an RTS, you'll need to put in the part about cancelling running.
RTS ; Return if condition is not met
STZ $9840 won't be enough, because then you'd be cancelling burnt status, too (probably not the end of the world, but also not the desired effect).
You'll need to use an AND to only turn off the relevant bits in the value.
Do you know how AND and ORA work, exactly?
Quick tutorial (apologies if you already know this):
Every hex byte is a two character representation of 8 bits...
00 = 00000000
01 = 00000001
02 = 00000010
03 = 00000011
04 = 00000100
etc, but that's enough for this explanation.
The ORA Operation essentially combines the set bits (1's, as opposed to 0's) of the accumulator (A) and the given value.
So if A is 04 (00000100) and you ORA #$03 (00000011), the resulting A will be 07 (00000111). The ORA combined the turned-on bits of the two values. This isn't the same as addition. 01 ORA #$01 will result in 01, because the operation is simply turning on the lowest bit if it's not already on.
ORA is generally used to set certain bits in a byte while leaving others alone.
Now, AND is sort of the opposite. When you AND two values, the result will be a value that has only the turned-on bits of the two original values.
01 AND #$01 = 01
02 AND #$03 = 02, because the two only have the second bit in common
04 AND #$03 = 00, because the two have no bits in common.
So... You want an operation that says, "load A; if the running bit is set, then turn it off, but don't touch the burnt bit."
AND #$01; turn all bits to zero except the lowest bit
This will take any value in 9840 (if what you're saying is true, then the only possibilities are 00, 01 and 03 under normal circumstances), and cancel out anything except the burnt bit.
... Wait. That won't work. Are you sure running is 03 and not 02? If running is 03, then that means the value for running (00000011) necessarily includes the value for being burnt (00000001). That means the code I just wrote above would make letting go of Y always result in being burnt (pressing Y turns the bottom two bits on, but letting go of Y only turns the second-lowest bit off).
So, you know that burnt check?
LDA $009840 ; Load the data in RAM $9840
AND #$01 ; Check if ONLY the Burnt Status is being loaded
CMP #$01 ; Is the current status Burnt?
BNE RunStat: ; If the status is not Burnt, set status to #$03 (Skip Sandwich)
RTS ; Return if status is Burnt
That's going to have to come before the Y button check, hence the game will ignore any Y button activity if and only if current status is burnt.
Does that make sense?
Sorry it took so long to get back to you on this, and sorry that this response was kind of a stream of consciousness.
I hope it helps.