public int handler(int offset) {
            switch (offset) {
                case 0x000:
                    return snk_input_port_r(0); // coin input, player start
                case 0x100:
                    return snk_input_port_r(1); // joy1
                case 0x180:
                    return snk_input_port_r(2); // joy2
                case 0x200:
                    return snk_input_port_r(3); // joy3
                case 0x280:
                    return snk_input_port_r(4); // joy4
                case 0x300:
                    return snk_input_port_r(5); // aim1
                case 0x380:
                    return snk_input_port_r(6); // aim2
                case 0x400:
                    return snk_input_port_r(7); // aim3
                case 0x480:
                    return snk_input_port_r(8); // aim4
                case 0x500:
                    return snk_input_port_r(9); // unused by tdfever
                case 0x580:
                    return snk_input_port_r(10); // dsw
                case 0x600:
                    return snk_input_port_r(11); // dsw

                case 0x700:
                    if ((cpuB_latch & SNK_NMI_ENABLE) != 0) {
                        cpu_cause_interrupt(1, Z80_NMI_INT);
                        cpuB_latch = 0;
                    } else {
                        cpuB_latch |= SNK_NMI_PENDING;
                    }
                    return 0xff;

                /* "Hard Flags" */
                case 0xe00:
                case 0xe20:
                case 0xe40:
                case 0xe60:
                case 0xe80:
                case 0xea0:
                case 0xee0:
                    if (hard_flags != 0) {
                        return 0xff;
                    }
            }
            return io_ram.read(offset);
        }