Beispiel #1
0
        /// <summary>
        /// The OTDR instruction.
        /// </summary>
        byte OTDR()
        {
            FetchFinished();

            var portNumber = Registers.C;
            var address    = Registers.HL;
            var value      = ProcessorAgent.ReadFromMemory(address.ToUShort());

            ProcessorAgent.WriteToPort(portNumber, value);

            Registers.HL = address.Dec();
            var counter = Registers.B;

            counter      = counter.Dec();
            Registers.B  = counter;
            Registers.ZF = (counter == 0);
            Registers.NF = 1;
            Registers.SF = counter.GetBit(7);
            SetFlags3and5From(counter);

            if (counter != 0)
            {
                Registers.PC = Registers.PC.Sub(2);
                return(21);
            }

            return(16);
        }
Beispiel #2
0
        /// <summary>
        /// The OTDR instruction.
        /// </summary>
        byte OTDR()
        {
            FetchFinished();

            var portNumber = Registers.C;
            var address    = Registers.HL;
            var value      = ProcessorAgent.ReadFromMemory((ushort)address);

            ProcessorAgent.WriteToPort(portNumber, value);

            Registers.HL--;
            var counter = Registers.B;

            counter      = (byte)(counter - 1);
            Registers.B  = counter;
            Registers.ZF = (counter == 0);
            Registers.NF = 1;
            Registers.SF = counter.GetBit(7);
            SetFlags3and5From(counter);

            if (counter != 0)
            {
                Registers.PC = (ushort)(Registers.PC - 2);
                return(21);
            }

            return(16);
        }
Beispiel #3
0
        /// <summary>
        /// The OUT (C),0 instruction.
        /// </summary>
        byte OUT_C_0()
        {
            FetchFinished();

            ProcessorAgent.WriteToPort(Registers.C, 0);

            return(12);
        }
Beispiel #4
0
        /// <summary>
        /// The OUT (n),A instruction.
        /// </summary>
        byte OUT_n_A()
        {
            var portNumber = ProcessorAgent.FetchNextOpcode();

            FetchFinished();

            ProcessorAgent.WriteToPort(portNumber, Registers.A);

            return(11);
        }