示例#1
0
        public virtual void TestException()
        {
            bus.WriteLong(0x08, 0x56789);
            bus.WriteLong(0x0c, 0x12345);
            bus.WriteLong(0x10, 0x23456);
            cpu.SetPC(0x32);
            cpu.SetSR(0x04);
            cpu.SetAddrRegisterLong(7, 0x0100);
            cpu.SetSSP(0x0200);
            cpu.RaiseException(2);
            Assert.Equal(0x56789, cpu.GetPC());
            Assert.Equal(0x01fa, cpu.GetAddrRegisterLong(7));
            Assert.Equal(0x0100, cpu.GetUSP());
            Assert.True(cpu.IsSupervisorMode());
            int sr = cpu.PopWord();
            int pc = cpu.PopLong();

            Assert.Equal(0x04, sr);
            Assert.Equal(0x32, pc);
            cpu.SetSR(sr);
            Assert.False(cpu.IsSupervisorMode());
            Assert.Equal(0x0100, cpu.GetUSP());
            Assert.Equal(0x0100, cpu.GetAddrRegisterLong(7));
            Assert.Equal(0x0200, cpu.GetSSP());
        }
示例#2
0
        public int Execute(int opcode)
        {
            int vector;

            if ((opcode & 0xf000) == 0xa000)
            {
                vector = 10;
            }
            else if ((opcode & 0xf000) == 0xf000)
            {
                vector = 11;
            }
            else
            {
                vector = 4;
            }

            cpu.RaiseException(vector);
            return(34);
        }