public static WriteHandlerPtr toaplan2_coin_w = new WriteHandlerPtr() { public void handler(int offset, int data)
	{
		switch (data & 0x0f)
		{
			case 0x00:	coin_lockout_global_w.handler(0,1); break;	/* Lock all coin slots */
			case 0x0c:	coin_lockout_global_w.handler(0,0); break;	/* Unlock all coin slots */
			case 0x0d:	coin_counter_w.handler(0,1); coin_counter_w.handler(0,0);	/* Count slot A */
						if (errorlog!=null) fprintf(errorlog,"Count coin slot A\n"); break;
			case 0x0e:	coin_counter_w.handler(1,1); coin_counter_w.handler(1,0);	/* Count slot B */
						if (errorlog!=null) fprintf(errorlog,"Count coin slot B\n"); break;
		/* The following are coin counts after coin-lock active (faulty coin-lock ?) */
			case 0x01:	coin_counter_w.handler(0,1); coin_counter_w.handler(0,0); coin_lockout_w.handler(0,1); break;
			case 0x02:	coin_counter_w.handler(1,1); coin_counter_w.handler(1,0); coin_lockout_global_w.handler(0,1); break;
	
			default:	if (errorlog!=null) fprintf(errorlog,"Writing unknown command (%04x) to coin control\n",data);
						break;
		}
		if (data > 0xf)
		{
			if (errorlog!=null) fprintf(errorlog,"Writing unknown upper bits command (%04x) to coin control\n",data);
		}
	} }