예제 #1
0
파일: Computer.cs 프로젝트: zoness32/armsim
        private void SetLblTexts(Instruction instr)
        {
            obsTest.ChangeText("" + cpu.stepNum, "stepNumLbl");
            obsTest.ChangeText(instr.disasm.instrCode, "instrTextLbl");
            obsTest.ChangeText(instr.disasm.instruction + " " + instr.disasm.value, "disassemblyLbl");

            // fetch next instruction
            uint        data = cpu.Fetch();
            Instruction i    = cpu.Decode(data);
            uint        val  = registers.ReadWord((uint)regs.PC);

            registers.WriteWord((uint)regs.PC, val - 4); // reset PC
            obsTest.ChangeText(i.disasm.instrCode, "nextInstrLbl");
            obsTest.ChangeText(i.disasm.instruction + " " + i.disasm.value, "nextDisasmLbl");
        }
예제 #2
0
 //--------------------------------------------------------------
 // Purpose: "Software Interrupt" stops the CPU
 // Returns: nothing
 //--------------------------------------------------------------
 public void SWI(SWI instr, bool generateDisasm)
 {
     if (generateDisasm)
     {
         instr.disasm.instruction = "swi";
         instr.disasm.value       = "0x" + instr.immediateVal.ToString("x2");
     }
     else
     {
         if (instr.immediateVal == 0x11)
         {
             instr.haltExecution = true;
         }
         else if (instr.immediateVal == 0x00)
         {
             observer.ChangeText((char)Computer.GetCPU().registers.ReadByte((uint)regs.r0));
         }
         else if (instr.immediateVal == 0x6a)
         {
             uint   addr    = Computer.GetCPU().registers.ReadWord((uint)regs.r1);
             Memory progRAM = Computer.GetCPU().progRAM;
             char   c       = ' ';
             uint   max     = Computer.GetCPU().registers.ReadWord((uint)regs.r2);
             while (!Computer.crTyped)
             {
             }                             // wait
             for (uint i = 0; i < max; i++)
             {
                 c = Computer.charBuffer[i];
                 progRAM.WriteByte(addr + i, (byte)c);
                 if (c == '\0')
                 {
                     break;
                 }
             }
         }
         else
         {
         }        // do nothing
     }
 }