Well it looked like you were using the 'R' button to bring up the subscreen in your code?
What that while loop does is it says 'keep running this code, unless Link presses R, in which case stop it'. Which basically says, keep the subscreen up till Link presses R. All of the subscreen code is intended to go inside the while loop.
Using a boolean it'd work a bit like this (might seem more obvious to you?):
CODE
bool done = false;
while(!done)
{
//Subscreen drawing and things go here
if(Link->PressR)
done = true;
Waitframe();
}
They're basically equivalent.
I thought you were using the kludge thing and moving the items equipped to the B button around?
I think you'll have to post a bit more than those 5 lines if you want me to work out what's wrong.
EDIT:
Oh, and you asked about how to deal with items that upgrade. I'm roughing out some code to make writing subscreens a bit easier for people, and I'm going to include it in that.
It involves using the itemdata pointer which I've never used before.