Beispiel #1
0
        public void SetFlagBit(Flag_Register_Bits bitNumber, bool state)
        {
            Byte reg_f = Program.emulator.getCPU().get_reg_f();

            if (state)
            {
                reg_f |= (Byte)(1 << (Byte)bitNumber);
            }
            else
            {
                reg_f &= (Byte) ~(1 << (Byte)bitNumber);
            }

            Program.emulator.getCPU().set_reg_f(reg_f);
        }
Beispiel #2
0
        /*
         * The interrupt process is as follows:
         *  1 When an interrupt is processed, the corresponding IF flag is set.
         *  2 Interrupt enabled.
         *  If the IME flag (Interrupt Master Enable) and the corresponding IE flag are set, the interrupt is performed by the following steps.
         *
         *  3 The IME flag is reset, and all interrupts are prohibited.
         *  4 The contents of the PC (program counter) are pushed onto the stack RAM.
         *  5 Control jumps to the interrupt starting address of the interrupt.
         *
         */

        public bool GetFlagBit(Flag_Register_Bits bitNumber)
        {
            return((Program.emulator.getCPU().get_reg_f() & (1 << (Byte)bitNumber)) != 0);
        }