Beispiel #1
0
        internal void PitWrite(int pt)
        {
#if TIMER_NO_GO
            return;
#endif // TIMER_NO_GO
            IoResult result;

            result = CWPort.Write8NoThrow(i8254_CW_MODE0 | i8254_CW_BOTH | i8254_CW_SEL0);
            DebugStub.Assert(IoResult.Success == result);

            result = C0Port.Write8NoThrow((byte)(pt & 0xff));
            DebugStub.Assert(IoResult.Success == result);

            result = C0Port.Write8NoThrow((byte)(pt >> 8));
            DebugStub.Assert(IoResult.Success == result);
            byte v;
            do
            {
                result = CWPort.Write8NoThrow(i8254_RB_NOCOUNT | i8254_RB_SEL0);
                DebugStub.Assert(IoResult.Success == result);

                result = C0Port.Read8NoThrow(out v);
                DebugStub.Assert(IoResult.Success == result);
            } while ((v & i8254_RB_NULL) == i8254_RB_NULL);
        }
Beispiel #2
0
        private void Mask(byte irq)
        {
            DebugStub.Assert(Processor.InterruptsDisabled());
            ushort newMask = (ushort)(irqMask | (1 << irq));

            if (newMask != irqMask)
            {
#if DEBUG_DISPATCH_IO
                DebugStub.WriteLine("-- Mask IRQs:   old={0:x4} new={1:x4}",
                                    __arglist(irqMask, newMask));
#endif
                irqMask = newMask;
                IoResult result;
                result = pic1MaskPort.Write8NoThrow((byte)(irqMask >> 8));
                DebugStub.Assert(IoResult.Success == result);
                result = pic0MaskPort.Write8NoThrow((byte)(irqMask & 0xff));
                DebugStub.Assert(IoResult.Success == result);
#if PIC_DEBUG
                byte mask0;
                pic0MaskPort.Read8NoThrow(out mask0);
                byte mask1;
                pic1MaskPort.Read8NoThrow(out mask1);

                DebugStub.Print("PIC Mask: {0:x2}{1:x2}\n",
                                __arglist(mask1, mask0));
#endif
            }
        }
Beispiel #3
0
        public void DumpRegisters()
        {
            byte     irr0, isr0, irr1, isr1;
            IoResult result;

            // OCW3  - read IRR
            result = pic0CtrlPort.Write8NoThrow(0x04 | 0x02);
            DebugStub.Assert(IoResult.Success == result);

            result = pic0CtrlPort.Read8NoThrow(out irr0);
            DebugStub.Assert(IoResult.Success == result);

            // OCW3  - read ISR
            result = pic0CtrlPort.Write8NoThrow(0x04 | 0x03);
            DebugStub.Assert(IoResult.Success == result);

            result = pic0CtrlPort.Read8NoThrow(out isr0);
            DebugStub.Assert(IoResult.Success == result);

            // OCW3  - read IRR
            result = pic1CtrlPort.Write8NoThrow(0x04 | 0x02);
            DebugStub.Assert(IoResult.Success == result);

            result = pic1CtrlPort.Read8NoThrow(out irr1);
            DebugStub.Assert(IoResult.Success == result);

            // OCW3  - read ISR
            result = pic1CtrlPort.Write8NoThrow(0x04 | 0x03);
            DebugStub.Assert(IoResult.Success == result);

            result = pic1CtrlPort.Read8NoThrow(out isr1);
            DebugStub.Assert(IoResult.Success == result);

            // Get mask state
            byte mask0, mask1;

            result = pic0MaskPort.Read8NoThrow(out mask0);
            DebugStub.Assert(IoResult.Success == result);

            result = pic1MaskPort.Read8NoThrow(out mask1);
            DebugStub.Assert(IoResult.Success == result);

            DebugStub.Print("PIC IRR: {0:x2}/{1:x2} ISR: {2:x2}/{3:x2} Mask {4:x2}/{5:x2}\n",
                            __arglist(irr0, irr1, isr0, isr1, mask0, mask1));
        }
Beispiel #4
0
        private byte ReadRtc(byte addr)
        {
            IoResult result;

            result = rtcadd.Write8NoThrow(addr);
            DebugStub.Assert(IoResult.Success == result);

            byte value;
            result = rtcdat.Read8NoThrow(out value);
            DebugStub.Assert(IoResult.Success == result);
            return value;
        }
Beispiel #5
0
        internal int Timer2Read()
        {
            timer2reads++;
            DebugStub.Assert(timer2reads == 1);

            IoResult result = CWPort.Write8NoThrow(i8254_RB_NOSTATUS | i8254_RB_SEL2);

            DebugStub.Assert(IoResult.Success == result);

            byte lo, hi;

            result = C2Port.Read8NoThrow(out lo);
            DebugStub.Assert(IoResult.Success == result);

            result = C2Port.Read8NoThrow(out hi);
            DebugStub.Assert(IoResult.Success == result);

            timer2reads--;
            DebugStub.Assert(timer2reads == 0);

            return((int)lo | ((int)hi << 8));
        }
Beispiel #6
0
        public ushort Pending()
        {
            byte irr0;
            byte irr1;

            IoResult result = pic0CtrlPort.Write8NoThrow(0x04 | 0x02); // OCW3  - read IRR

            DebugStub.Assert(IoResult.Success == result);

            result = pic0CtrlPort.Read8NoThrow(out irr0);
            DebugStub.Assert(IoResult.Success == result);

            result = pic1CtrlPort.Write8NoThrow(0x04 | 0x02); // OCW3  - read IRR
            DebugStub.Assert(IoResult.Success == result);

            result = pic1CtrlPort.Read8NoThrow(out irr1);
            DebugStub.Assert(IoResult.Success == result);

            return((ushort)(irr0 | (irr1 << 8)));
        }