It's very difficult to address, because in the case of a character dying before they can use the item, there's no practical way to check, "Was their turn unable to execute?". It's not like you know for a fact that their turn will have completed within X seconds if it's going to complete at all, as there are so many possible intervening factors. Besides, a timer would be tedious and difficult to set up anyway.
Ok, I found where the item is initially being adding to the reserve.
Code:
C2/4DA7: C9 01 CMP #$01
C2/4DA9: F0 04 BEQ $4DAF (Branch if Item)
C2/4DAB: C9 08 CMP #$08
C2/4DAD: D0 05 BNE $4DB4 (Branch if not Throw)
C2/4DAF: EB XBA
C2/4DB0: 99 F4 32 STA $32F4,Y (store as item to add back to inventory. this can
happen with:
1) Equipment Magic that doesn't destroy the item
[no items have this, but the game supports it]
2) the item user's turn never happens. perhaps the
character who acted before them won the battle.)
C2/4DB3: EB XBA Simply adding a hook there wouldn't work though. As Kejar pointed it out to me last night, it'd make all items bottomless. $3A8C isn't tweaked until the item is actually used though. It seems like this is where it needs to be done, but I'm currently unsure as to how. Any ideas?
how about _before_ C2/4DB0, you preserve A, check the character's current $32F4,Y value, and if it isn't FFh, then call a routine to put its contents back into inventory? (you'd want to code a custom version of C2/62C7 to focus on one character, as calling the entire function would mess with other characters' $32F4 values.) that oughta take care of any aborted Item usages from the character's previous turns. as you said, you wouldn't be able to use $3A8C here, but i think that'll be alright, unless $32F4 somehow gets misleading garbage in it.
still, there's the matter of if a character is killed while attempting to use Tonic, then they are revived, why should they have to wait til the end of battle to get that Tonic back into inventory? it's not like the Tonic rolled meters away from them and they have to scour the ground for it. obviously, the end-of-battle check serves as a catch-all, but there's no good reason that restoral shouldn't happen sooner/immediately.
at one point, i think Imzogelmo suggested cutting off all the ways a character can be taken out of commission (e.g. dying, being petrified, being Sneezed, etc, etc), and adding an item restoral call to each one. if the character died before they can use an item, it's presumably still on their person, so the party shouldn't even have to wait for the character to be revived just so they can have access to the item -- rigor mortis aside.