Exemplo n.º 1
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
            }
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public override void AckIrq(byte irq)
        {
            DebugStub.Assert(Processor.InterruptsDisabled());
#if PIC_DEBUG
            DumpRegisters();
#endif

            // Mark the IRQ as activated and mask it
#if DEBUG_INTERRUPTS
            DebugStub.Print("Int{0:x2}  Acked, Mask={1:x4}\n",
                            __arglist(irq + baseVector, irqMask));
#endif

            // Quite the interrupt controller.
            IoResult result;
            if (irq >= 8)
            {
                result = pic1CtrlPort.Write8NoThrow(PIC_NS_EOI);
                DebugStub.Assert(IoResult.Success == result);
            }
            result = pic0CtrlPort.Write8NoThrow(PIC_NS_EOI);
            DebugStub.Assert(IoResult.Success == result);

#if PIC_DEBUG
            DumpRegisters();
#endif
        }
Exemplo n.º 4
0
        private void UpdateCursor(bool newVisibleState)
        {
            IoResult result;

            if (newVisibleState != cursorVisible)
            {
                byte cgaStart = 32; // Cursor off
                if (newVisibleState)
                {
                    cgaStart = (byte)(64 + cursorStartLine);  // Cursor on
                }

                result = indexRegister.Write8NoThrow(CGA_CURSOR_START);
                DebugStub.Assert(IoResult.Success == result);

                result = dataRegister.Write8NoThrow(cgaStart);
                DebugStub.Assert(IoResult.Success == result);

                cursorVisible = newVisibleState;
            }

            if (newVisibleState)
            {
                // Write cursor location
                result = indexRegister.Write8NoThrow(CGA_CURSOR_MSB);
                DebugStub.Assert(IoResult.Success == result);
                result = dataRegister.Write8NoThrow((byte)(cursor >> 8));
                DebugStub.Assert(IoResult.Success == result);
                result = indexRegister.Write8NoThrow(CGA_CURSOR_LSB);
                DebugStub.Assert(IoResult.Success == result);
                result = dataRegister.Write8NoThrow((byte)(cursor & 0xff));
                DebugStub.Assert(IoResult.Success == result);
            }
        }
Exemplo n.º 5
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;
        }
Exemplo n.º 6
0
        private void WriteRtc(byte addr, byte val)
        {
            IoResult result;

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

            result = rtcdat.Write8NoThrow(val);
            DebugStub.Assert(IoResult.Success == result);
        }
Exemplo n.º 7
0
        public void AckIrq(byte irq)
        {
            DumpRegisters();

#if DEBUG_INTERRUPTS
            DebugStub.Print("Int{0:x2}  Acked, Mask={1:x8}\n",
                            __arglist(irq + baseVector, irqMask));
#endif

            // Quiet the interrupt controller.
            IoResult result;
            if (irq >= 8)
            {
                result = pic1CtrlPort.Write8NoThrow(0x20);
                DebugStub.Assert(IoResult.Success == result);
            }
            result = pic0CtrlPort.Write8NoThrow(0x20);
            DebugStub.Assert(IoResult.Success == result);

            DumpRegisters();
        }