public static Bootdev Init(string configfile) { XmlSerializer SerializerObj = new XmlSerializer(typeof(Config704)); FileStream ReadFileStream = new FileStream(configfile, FileMode.Open, FileAccess.Read, FileShare.Read); Config = (Config704)SerializerObj.Deserialize(ReadFileStream); ReadFileStream.Close(); SenseSwitches.Init(Config.Switch); CoreMemory.Init(Config.MemSize); if (Config.LogCPU != null) { LogCPU = new StreamWriter(Config.LogCPU, false, Encoding.ASCII); } if (Config.LogIO != null) { if (Config.LogIO == Config.LogCPU) { LogIO = LogCPU; } else { LogIO = new StreamWriter(Config.LogIO, false, Encoding.ASCII); } } return(Config.boot); }
public static uint PSE(uint unit) /* plus sense */ { uint skip = 0; uint CurrUnit = unit >> 4; uint CurrSubUnit = unit & 0xF; switch (CurrUnit) { case 6: /* Sense Lights */ if (CurrSubUnit == 0) { SenseLights.SLF(); } else if (CurrSubUnit >= 1 && CurrSubUnit <= 4) { SenseLights.SLN(CurrSubUnit); } else { throw new InvalidOperationException("invalid Sense Light"); } break; case 7: /* Sense Switches */ if (CurrSubUnit >= 1 && CurrSubUnit <= 6) { skip = SenseSwitches.SWT(CurrSubUnit); } else { throw new InvalidOperationException("invalid Sense Switch"); } break; case 14: /* Punch */ if (CPU != null && CurrSubUnit >= 1 && CurrSubUnit <= 2) { CPU.SPU(CurrSubUnit); } else { throw new InvalidOperationException("invalid Punch Sense"); } break; case 15: /* Printer */ if (LP != null && CurrSubUnit == 0) { skip = LP.SPT(); } else if (LP != null && CurrSubUnit >= 1 && CurrSubUnit <= 10) { LP.SPR(CurrSubUnit); } else { throw new InvalidOperationException("invalid Printer Sense"); } break; default: throw new InvalidOperationException("invalid device for PSE"); } return(skip); }