public void Interrupt(byte intnum) { this.halted = false; uint oldCtl = controlRegister; controlRegister &= ~0x01u; stack.PushInt32(oldCtl); for (int i = 0; i < 16; i++) { stack.PushInt32(GetGeneralPurposeRegister((Register)i)); } SetGeneralPurposeRegister(Register.R15, memory.ReadInt32(ivtRegister + (uint)(intnum * 4))); Console.WriteLine("i {0:x8}", memory.ReadInt32(ivtRegister + (uint)(intnum * 4))); }
private static object ReadOperand(QuasarRam memory, ref uint address, AddressingMode am) { switch (am) { case AddressingMode.DIRECT_REGISTER: address++; return((Register)memory[address - 1]); case AddressingMode.CONDITION_CODE: address++; return((byte)memory[address - 1]); case AddressingMode.INDIRECT_REG8: case AddressingMode.INDIRECT_REG16: case AddressingMode.INDIRECT_REG32: Register reg = (Register)memory[address]; byte[] bytes = new byte[2]; memory.Read(address + 1, 2, 0, bytes); address += 3; return(new IndirectOffset(reg, BitConverter.ToInt16(bytes, 0))); case AddressingMode.IMMEDIATE_32: address += 4; return(memory.ReadInt32(address - 4)); } return(null); }
public uint PopInt32() { uint sp = host.GetGeneralPurposeRegister(Register.R14) + 4; uint ret = memory.ReadInt32(sp); host.SetGeneralPurposeRegister(Register.R14, sp); return(ret); }