static int mame_stats(int selected)
    {
    	String buf="";
    	int sel, i;
    
    
    	sel = selected - 1;
      
    	if (dispensed_tickets!=0)
    	{
    		 buf = "Tickets dispensed: " + sprintf("%d\n\n", dispensed_tickets);
    	}
    
    	for (i=0;  i<COIN_COUNTERS; i++)
    	{
    		buf += sprintf("Coin %c: ", i + 'A');
    		if (coins[i]==0)
    			buf += "NA";
    		else
    		{
                        buf += sprintf("%d", coins[i]);
    		}
    		if (coinlockedout[i]!=0)
    		{
    			buf += " (locked)\n";
    		}
    		else
    		{
    			buf += "\n";
    		}
    	}
    
    	{
    		/* menu system, use the normal menu keys */
    		buf +="\n\t\u001a Return to Main Menu \u001b";
    
    		ui_displaymessagewindow(buf);
    
    		if (input_ui_pressed(IPT_UI_SELECT)!=0)
    			sel = -1;
    
    		if (input_ui_pressed(IPT_UI_CANCEL)!=0)
    			sel = -1;
    
    		if (input_ui_pressed(IPT_UI_CONFIGURE)!=0)
    			sel = -2;
    	}
    
    	if (sel == -1 || sel == -2)
    	{
    		/* tell updatescreen() to clean after us */
    		need_to_clear_bitmap = 1;
    	}
    
    	return sel + 1;
    }