public static /*unsigned*/ char OPLRead(FM_OPL OPL, int a) {
        if ((a & 1) == 0) {	/* status port */

            return (char) ((OPL.status & (OPL.statusmask | 0x80)) & 0xFF);
        }
        /* data port */
        switch (OPL.address) {
            case 0x05: /* KeyBoard IN */
        	if((OPL.type&OPL_TYPE_KEYBOARD)!=0)
   		{
   			if(OPL.keyboardhandler_r!=null)
                        {
   				return (char)OPL.keyboardhandler_r.handler(OPL.keyboard_param);
                        }
   			else
                        {
   				//Log(LOG_WAR,"OPL:read unmapped KEYBOARD port\n");
                        }
   		}
   		return 0;
            case 0x19: /* I/O DATA    */
                if((OPL.type&OPL_TYPE_IO)!=0)
   		{
   			if(OPL.porthandler_r!=null)
                        {
   				return (char)OPL.porthandler_r.handler(OPL.port_param);
                        }
   			else
                        {
   				//Log(LOG_WAR,"OPL:read unmapped I/O port\n");
                        }
   		}
   		return 0;
            case 0x1a: /* PCM-DATA    */

                return 0;
        }
        return 0;
    }