static int snk_input_port_r(int which) {
        switch (snk_io[which]) {
            case SNK_INP0: {
                int value = input_port_0_r.handler(0);
                if ((snk_sound_register & 0x04) == 0) {
                    value &= ~snk_sound_busy_bit;
                }
                return value;
            }

            case SNK_ROT8_PLAYER1:
                return snk_rot8(0);
            case SNK_ROT8_PLAYER2:
                return snk_rot8(1);

            case SNK_ROT12_PLAYER1:
                return snk_rot12(0);
            case SNK_ROT12_PLAYER2:
                return snk_rot12(1);

            case SNK_INP1:
                return input_port_1_r.handler(0);
            case SNK_INP2:
                return input_port_2_r.handler(0);
            case SNK_INP3:
                return input_port_3_r.handler(0);
            case SNK_INP4:
                return input_port_4_r.handler(0);
            case SNK_INP5:
                return input_port_5_r.handler(0);
            case SNK_INP6:
                return input_port_6_r.handler(0);
            case SNK_INP7:
                return input_port_7_r.handler(0);
            case SNK_INP8:
                return input_port_8_r.handler(0);
            case SNK_INP9:
                return input_port_9_r.handler(0);
            case SNK_INP10:
                return input_port_10_r.handler(0);

            default:
                if (errorlog != null) {
                    fprintf(errorlog, "read from unmapped input port:%d\n", which);
                }
                break;
        }
        return 0;
    }