//Loads word from memory address: public override void Execute(uint Rn, uint Rd, Offset offst) { //LDR <Rd>, <addressing_mode> int EA = GetEffAddr(Rn, offst); //((int)Rn + (U == 1 ? offst.GetValue(): -offst.GetValue())) & 0xFFFFFFFF; if (EA == 0x100001) { //check after check if input buff is empty I_Last_Char = I_Input_Buff.Count != 0 ? I_Input_Buff[I_Input_Buff.Count - 1] : (char)0; CPU.SetReg(I_Reg, (int)Rd, Convert.ToInt32(I_Last_Char)); } else { if (B == 1) { CPU.SetReg(I_Reg, (int)Rd, I_RAM.ReadByte((uint)EA)); } else { CPU.SetReg(I_Reg, (int)Rd, I_RAM.ReadWord(EA)); //Remember to check what memreads return if invalid EA } if (W == 1) { CPU.SetReg(I_Reg, (int)Rn, EA); } } }
public override void Execute(uint Rn, List <int> Reglist) { int EA = CPU.GetRegr(I_Reg, (int)Rn); foreach (int i in Reglist) { int val = I_RAM.ReadWord(EA); CPU.SetReg(I_Reg, i, val); EA += 4; } if (W == 1) { CPU.SetReg(I_Reg, (int)Rn, EA); } }